/* ============================================
   FLUXO DE CAIXA - Design System
   Clean Dark & Orange
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Backgrounds */
  --bg-primary: #17181C;
  --bg-secondary: #1C1D22;
  --bg-surface: #24252B;
  --bg-elevated: #2A2B32;
  --bg-input: #2F3038;

  /* Accent */
  --accent: #FF6B00;
  --accent-hover: #FF8533;
  --accent-muted: rgba(255, 107, 0, 0.15);
  --accent-glow: rgba(255, 107, 0, 0.35);

  /* Text */
  --text-primary: #F2F2F4;
  --text-secondary: #ABADB4;
  --text-muted: #82858E;
  --text-inverse: #17181C;

  /* Semantic */
  --success: #22C55E;
  --danger: #EF4444;
  --warning: #F59E0B;
  --info: #3B82F6;

  /* Borders */
  --border-color: #35363E;
  --border-subtle: #2A2B31;

  /* Typography */
  --font-sans: 'Inter', 'Segoe UI', system-ui, sans-serif;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.16);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.22);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.28);
  --shadow-glow: 0 0 20px var(--accent-glow);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;

  /* Layout */
  --sidebar-width: 240px;
  --header-height: 64px;
  --bottom-nav-height: 64px;
  --content-max-width: 1240px;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Scrollbar fina e discreta em todo o sistema (Firefox) — o padrão do navegador ficava
     grosso/claro demais contra o tema escuro. `scrollbar-width`/`scrollbar-color` são
     herdados, então basta declarar aqui pra valer em qualquer scroll da página inteira
     (inclusive dentro de containers com overflow próprio, tipo a grade de Projeção). */
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

/* Mesma ideia, motor WebKit/Blink (Chrome, Edge, Safari) — API baseada em pseudo-elementos,
   não em scrollbar-width/-color. */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

::-webkit-scrollbar-corner {
  background: transparent;
}

/* Sem isso, o Chrome mantém as setinhas nativas de step nas pontas mesmo com thumb/track
   customizados — ficava com uma pontinha "antiga" grudada no visual novo. */
::-webkit-scrollbar-button {
  display: none;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-hover);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, select, textarea {
  font-family: inherit;
  font-size: 1rem;
}

/* Typography */
.text-xs { font-size: 0.75rem; color: var(--text-muted); }
.text-sm { font-size: 0.875rem; color: var(--text-secondary); }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; font-weight: 500; }
.text-xl { font-size: 1.25rem; font-weight: 600; }
.text-2xl { font-size: 1.5rem; font-weight: 600; }
.text-3xl { font-size: 1.875rem; font-weight: 700; }
.text-4xl { font-size: 2.25rem; font-weight: 700; }

.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.opacity-60 { opacity: 0.6; }

/* ----- Loading global (barra fina no topo) — ligada/desligada automaticamente por
   apiRequest()/apiDownloadBlob() em api.js pra toda chamada de API do sistema, sem nenhuma
   tela precisar chamar nada manualmente. Ver comentário completo em api.js. ----- */
.loading-global-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: var(--accent);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.loading-global-bar.ativa {
  opacity: 1;
  animation: loading-global-progress 1.1s ease-in-out infinite;
}

@keyframes loading-global-progress {
  0% { width: 0%; margin-left: 0%; }
  50% { width: 55%; margin-left: 25%; }
  100% { width: 0%; margin-left: 100%; }
}
