/* ═══════════════════════════════════════════════════════════════════════
   Domani Design System — tokens, tema claro/escuro, base e tipografia
   Regra: componentes nunca usam cores "cruas"; sempre estes tokens.
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  /* Tipografia */
  --font-body: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;

  --text-xs:   clamp(0.6875rem, 0.68rem + 0.05vw, 0.75rem);
  --text-sm:   clamp(0.8125rem, 0.8rem + 0.1vw, 0.875rem);
  --text-base: clamp(0.875rem, 0.85rem + 0.15vw, 1rem);
  --text-lg:   clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-xl:   clamp(1.125rem, 1rem + 0.4vw, 1.25rem);
  --text-2xl:  clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  --text-3xl:  clamp(1.5rem, 1.25rem + 1vw, 2rem);

  --leading-tight: 1.2;
  --leading-normal: 1.5;
  --tracking-tight: -0.02em;
  --tracking-wide: 0.06em;

  /* Espaçamento (grade de 4 px) */
  --space-1: 0.25rem;  --space-2: 0.5rem;   --space-3: 0.75rem;  --space-4: 1rem;
  --space-5: 1.25rem;  --space-6: 1.5rem;   --space-8: 2rem;     --space-10: 2.5rem;
  --space-12: 3rem;    --space-16: 4rem;

  /* Raios */
  --radius-sm: 0.375rem; --radius-md: 0.625rem; --radius-lg: 0.875rem;
  --radius-xl: 1.125rem; --radius-full: 9999px;

  /* Movimento */
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --t-fast: 150ms var(--ease);
  --t-base: 220ms var(--ease);

  /* Camadas */
  --z-nav: 40; --z-menu: 60; --z-modal: 80; --z-toast: 100;

  /* Alvo de toque mínimo */
  --touch: 44px;

  /* Layout */
  --bottom-nav-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);

  color-scheme: dark;
}

/* ── Tema escuro (padrão) ─────────────────────────────────────────────── */
:root,
:root[data-theme="dark"] {
  --bg: #090c10;
  --surface: #11161c;
  --surface-2: #171d25;
  --surface-3: #1f2731;
  --overlay: #151b22;

  --text: #eef3f6;
  --text-2: #a3b3bf;
  --text-3: #7d8e9b;
  --text-on-accent: #ffffff;

  --border-subtle: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.11);
  --border-strong: rgba(255, 255, 255, 0.2);

  --accent: #2dd4bf;
  --accent-strong: #14b8a6;
  --accent-soft: rgba(45, 212, 191, 0.13);
  --btn-bg: #0f766e;
  --btn-bg-hover: #115e59;
  --ring: rgba(45, 212, 191, 0.45);

  --success: #34d399;  --success-soft: rgba(52, 211, 153, 0.13);
  --danger:  #f87171;  --danger-soft:  rgba(248, 113, 113, 0.13);
  --warning: #fbbf24;  --warning-soft: rgba(251, 191, 36, 0.13);
  --info:    #60a5fa;  --info-soft:    rgba(96, 165, 250, 0.13);
  --purple:  #c084fc;  --purple-soft:  rgba(192, 132, 252, 0.13);

  --chrome-bg: #000000;
  --chrome-text: #ffffff;
  --chrome-text-2: #9aa9b4;
  --chrome-border: rgba(255, 255, 255, 0.1);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.55);
  --glass-bg: rgba(17, 22, 28, 0.82);
  --glass-border: rgba(255, 255, 255, 0.08);

  --chart-prev: rgba(125, 142, 155, 0.4);
  --chart-grid: rgba(255, 255, 255, 0.07);
  --chart-axis: rgba(255, 255, 255, 0.22);
}

/* ── Tema claro ───────────────────────────────────────────────────────── */
:root[data-theme="light"] {
  color-scheme: light;

  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f6;
  --overlay: #ffffff;

  --text: #0f172a;
  --text-2: #475569;
  --text-3: #64748b;

  --border-subtle: rgba(15, 23, 42, 0.06);
  --border: rgba(15, 23, 42, 0.12);
  --border-strong: rgba(15, 23, 42, 0.24);

  --accent: #0f766e;
  --accent-strong: #0d9488;
  --accent-soft: rgba(13, 148, 136, 0.1);
  --btn-bg: #0f766e;
  --btn-bg-hover: #115e59;
  --ring: rgba(13, 148, 136, 0.4);

  --success: #047857;  --success-soft: rgba(4, 120, 87, 0.1);
  --danger:  #dc2626;  --danger-soft:  rgba(220, 38, 38, 0.09);
  --warning: #b45309;  --warning-soft: rgba(180, 83, 9, 0.1);
  --info:    #1d4ed8;  --info-soft:    rgba(29, 78, 216, 0.09);
  --purple:  #7e22ce;  --purple-soft:  rgba(126, 34, 206, 0.09);

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 6px 16px rgba(15, 23, 42, 0.1);
  --shadow-lg: 0 18px 48px rgba(15, 23, 42, 0.18);
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(15, 23, 42, 0.08);

  --chart-prev: rgba(100, 116, 139, 0.4);
  --chart-grid: rgba(15, 23, 42, 0.08);
  --chart-axis: rgba(15, 23, 42, 0.3);
}

/* ── Base ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--t-base), color var(--t-base);
}

h1, h2, h3, h4 { line-height: var(--leading-tight); letter-spacing: var(--tracking-tight); font-weight: 700; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; touch-action: manipulation; }
a { color: var(--accent); }
img, svg { display: block; max-width: 100%; }
table { border-collapse: collapse; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm); }
::selection { background: var(--accent-soft); color: var(--text); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.num { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }

/* Barra de rolagem discreta */
.scroll { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.scroll::-webkit-scrollbar { width: 6px; height: 6px; }
.scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
