:root {
  /* Controles nativos (select, scrollbar, checkbox) seguem o tema */
  color-scheme: dark;

  /* ============ ESPAÇAMENTO (8pt grid) ============ */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  /* ============ TIPOGRAFIA — sistema enxuto e profissional ============ */
  --font-ui:    'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-brand: 'Montserrat', 'Inter', system-ui, sans-serif;
  --font-mono:  'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --font-sans:  var(--font-ui); /* compat */

  /* Escala tipográfica — VALORES FINAIS */
  --fs-9:  9px;
  --fs-10: 10px;
  --fs-11: 11px;
  --fs-12: 12px;
  --fs-13: 13px;
  --fs-14: 14px;
  --fs-16: 16px;

  /* Aliases legados */
  --text-2xs: var(--fs-10);
  --text-xs:  var(--fs-11);
  --text-sm:  var(--fs-12);
  --text-md:  var(--fs-13);
  --text-lg:  var(--fs-14);
  --text-xl:  var(--fs-16);

  --leading-tight:  1.25;
  --leading-normal: 1.5;

  --tracking-caps-tight: 0.06em;
  --tracking-caps-wide:  0.10em;
  --tracking-wide:  var(--tracking-caps-tight); /* compat */
  --tracking-wider: var(--tracking-caps-wide);  /* compat */

  --fw-regular:  400;
  --fw-medium:   500;
  --fw-semibold: 600;
  --fw-bold:     700;

  /* ============ DIMENSÕES — VALORES FINAIS ============ */
  --panel-width:       300px;
  --h-input:           28px;
  --h-input-sm:        24px;
  --h-input-lg:        36px;
  --field-label-width: 44px;

  --section-pad-y: 12px;
  --section-pad-x: 14px;
  --gap-field:      8px;
  --gap-row:        6px;

  --w-input-sm:  56px;
  --w-input-md:  88px;
  --w-input-lg: 100%;

  /* ============ CORES — dark cyan system ============ */
  --bg-app:            #0a1218;
  --bg-panel:          #0f1923;
  --bg-panel-elevated: #142230;
  --bg-input:          #1a2735;
  --bg-input-hover:    #1f2e3d;
  --bg-input-focus:    #233242;
  --bg-input-disabled: #131e28;

  --border-subtle:  #1e2d3c;
  --border-default: #2a3d50;
  --border-strong:  #3a5268;
  --border-focus:   #00e5ff;

  --text-primary:   #e8f4f8;
  --text-secondary: #9ab3c4;
  --text-tertiary:  #6b8aa0;
  --text-muted:     #4a6478;
  --text-disabled:  #2d4252;

  --accent:            #00e5ff;
  --accent-hover:      #33eaff;
  --accent-glow:       rgba(0, 229, 255, 0.15);
  --accent-glow-strong: rgba(0, 229, 255, 0.35);

  --success: #34d399;
  --warning: #fbbf24;
  --danger:  #f87171;
  --info:    var(--accent);

  /* ============ BORDAS E RAIOS ============ */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;

  --border-w-thin:    1px;
  --border-w-default: 1.5px;

  /* ============ SOMBRAS E ELEVAÇÃO ============ */
  --shadow-sm:           0 1px 2px rgba(0,0,0,0.4);
  --shadow-md:           0 4px 12px rgba(0,0,0,0.35);
  --shadow-lg:           0 12px 32px rgba(0,0,0,0.45);
  --shadow-focus:        0 0 0 3px var(--accent-glow);
  --shadow-focus-strong: 0 0 0 3px var(--accent-glow-strong);

  /* ============ TRANSIÇÕES ============ */
  --t-fast: 120ms cubic-bezier(0.16, 1, 0.3, 1);
  --t-base: 180ms cubic-bezier(0.16, 1, 0.3, 1);
  --t-slow: 280ms cubic-bezier(0.16, 1, 0.3, 1);

  /* ============ CORES DOS LOBOS PULMONARES — Atlas AlvusMed v1 ============ */
  --lobo-lsd: #00e5ff;   /* Lobo Superior Direito  — cyan   */
  --lobo-lm:  #fbbf24;   /* Lobo Médio             — amber  */
  --lobo-lid: #f87171;   /* Lobo Inferior Direito  — red    */
  --lobo-lse: #a78bfa;   /* Lobo Superior Esquerdo — purple */
  --lobo-lie: #34d399;   /* Lobo Inferior Esquerdo — green  */

  /* ============ TOOLBAR ============ */
  --toolbar-h: 44px;
  --toolbar-btn-h: 28px;
  --toolbar-btn-icon-w: 28px;
  --toolbar-gap: 4px;
  --toolbar-group-gap: 12px;
  --toolbar-separator: 1px solid var(--border-subtle);
  --voice-dot-size: 6px;
  --voice-dot-color: var(--success);
  --bg-input-elevated: #1a2a38;

  /* ============ SNIPPETS PREMIUM (piloto Ovários) ============ */
  --snp-item-pad-x:   10px;
  --snp-item-pad-y:    5px;
  --snp-item-radius:  var(--radius-md);
  --snp-item-gap:      6px;
  --snp-group-sep:    12px;
  --snp-lat-btn-h:    22px;
  --snp-lat-btn-pad:   0 7px;
  --snp-grav-bar-w:    2px;
  --snp-intrusos-opacity: 0.62;
  --snp-intrusos-bg:  rgba(30, 12, 4, 0.45);
}

/* ============ TEMA CLARO ============
   Ativado por <html data-theme="light"> (alvus-theme.js persiste a escolha em
   localStorage; o padrão de toda tela segue sendo o dark). Só as cores mudam —
   espaçamento/tipografia/raios são compartilhados. Ciano escurecido para manter
   contraste AA sobre fundo claro. */
[data-theme="light"] {
  color-scheme: light;

  --bg-app:            #eef3f6;
  --bg-panel:          #ffffff;
  --bg-panel-elevated: #f4f8fa;
  --bg-input:          #f1f5f8;
  --bg-input-hover:    #e9f0f4;
  --bg-input-focus:    #e3edf2;
  --bg-input-disabled: #f5f7f9;
  --bg-input-elevated: #e9f0f4;

  --border-subtle:  #dde6ec;
  --border-default: #c3d2dc;
  --border-strong:  #9fb5c2;
  --border-focus:   #0092b8;

  --text-primary:   #12242e;
  --text-secondary: #3d5a6c;
  --text-tertiary:  #61798a;
  --text-muted:     #8ba0ae;
  --text-disabled:  #b9c8d2;

  --accent:             #0092b8;
  --accent-hover:       #00a5cf;
  --accent-glow:        rgba(0, 146, 184, 0.16);
  --accent-glow-strong: rgba(0, 146, 184, 0.34);

  --success: #0e9f6e;
  --warning: #b45309;
  --danger:  #dc2626;

  --shadow-sm: 0 1px 2px rgba(16, 42, 58, 0.10);
  --shadow-md: 0 4px 12px rgba(16, 42, 58, 0.12);
  --shadow-lg: 0 12px 32px rgba(16, 42, 58, 0.16);
}

/* ============ TEMA SOFT ============
   Modo "amigável" (recepção/secretárias): claro, azul calmo no lugar do
   ciano-sinal, contrastes suaves e superfícies familiares de software de
   escritório. Mesma malha de espaçamento/tipografia — só as cores mudam.
   Ativado por <html data-theme="soft"> (alvus-theme.js cicla os 3 temas). */
[data-theme="soft"] {
  color-scheme: light;

  --bg-app:            #f4f6f9;
  --bg-panel:          #ffffff;
  --bg-panel-elevated: #f8fafc;
  --bg-input:          #f1f5f9;
  --bg-input-hover:    #e8eef5;
  --bg-input-focus:    #e2eaf3;
  --bg-input-disabled: #f5f7fa;
  --bg-input-elevated: #eef2f7;

  --border-subtle:  #e5eaf1;
  --border-default: #cbd5e1;
  --border-strong:  #94a3b8;
  --border-focus:   #2563eb;

  --text-primary:   #1f2937;
  --text-secondary: #475569;
  --text-tertiary:  #64748b;
  --text-muted:     #94a3b8;
  --text-disabled:  #cbd5e1;

  --accent:             #2563eb;
  --accent-hover:       #1d4ed8;
  --accent-glow:        rgba(37, 99, 235, 0.12);
  --accent-glow-strong: rgba(37, 99, 235, 0.28);

  --success: #16a34a;
  --warning: #b45309;
  --danger:  #dc2626;

  --shadow-sm: 0 1px 2px rgba(30, 41, 59, 0.08);
  --shadow-md: 0 4px 12px rgba(30, 41, 59, 0.10);
  --shadow-lg: 0 12px 32px rgba(30, 41, 59, 0.14);
}

/* Reset global de fonte */
html, body, button, input, textarea, select {
  font-family: var(--font-ui);
}
