/* Gestão Financeira · tokens v4
   Contrastes conferidos (WCAG 2.x) em docs/DESIGN-SYSTEM.md.
   Regras: cores "-ink" são para texto; as demais servem a preenchimento, ícone e borda.
   Latão (--accent) é decorativo e raro: nunca texto corrido, nunca mais de 10% da tela. */

@font-face { font-family: "Fraunces"; src: url("../fonts/fraunces-latin-wght-normal.woff2") format("woff2"); font-weight: 300 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("../fonts/fraunces-latin-wght-italic.woff2") format("woff2"); font-weight: 300 900; font-style: italic; font-display: swap; }
@font-face { font-family: "Geist"; src: url("../fonts/geist-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("../fonts/geist-mono-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }

:root {
  color-scheme: light;

  /* Superfícies: papel (60) → superfície → elevada */
  --paper: #F5F2EC;
  --surface: #FFFFFF;
  --surface-2: #FBF9F5;
  --surface-sunk: #EFEBE3;
  --scrim: rgb(22 24 28 / .42);

  /* Tinta */
  --ink: #16181C;
  --ink-2: #5C6066;
  --ink-3: #66696F;
  --ink-inverse: #FFFFFF;

  /* Linhas: --line para divisórias; --line-strong para bordas de controle (≥3:1) */
  --line: #E4DFD5;
  --line-soft: #EDE9E1;
  --line-strong: #8F8A80;

  /* Marca (30) e acento (10) */
  --primary: #0F5B47;
  --primary-hover: #0B4A3A;
  --primary-press: #083A2D;
  --primary-bg: #E3EDE8;
  --on-primary: #FFFFFF;
  --accent: #B8924A;
  --accent-ink: #82662F;
  --accent-bg: #F3ECDD;

  /* Semântica financeira */
  --pos: #1F7A55;
  --pos-bg: #E3F0E9;
  --neg: #C2483A;
  --neg-ink: #B23D30;
  --neg-bg: #F8E7E3;
  --warn: #C98A1B;
  --warn-ink: #8A5D0E;
  --warn-bg: #F7EDD9;
  --focus: #0F5B47;

  /* Gráficos: 5 tons categóricos em ordem fixa + neutro "Outras" (validado com dataviz) */
  --chart-1: #12805F;
  --chart-2: #A87A22;
  --chart-3: #2E6CC0;
  --chart-4: #C04A2E;
  --chart-5: #7A4FB8;
  --chart-other: #A9A49A;
  --chart-grid: #ECE8E0;
  --chart-axis: #66696F;

  /* Tipografia */
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-ui: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --text-xs: .75rem;     /* 12 */
  --text-sm: .8125rem;   /* 13 */
  --text-base: .9375rem; /* 15 */
  --text-md: 1.0625rem;  /* 17 */
  --text-lg: 1.375rem;   /* 22 */
  --text-xl: 1.875rem;   /* 30 */
  --text-2xl: 2.625rem;  /* 42 */
  --text-hero: clamp(2.75rem, 1.6rem + 4.6vw, 5.25rem);
  --leading-tight: 1.1;
  --leading-snug: 1.3;
  --leading: 1.55;
  --tracking-caps: .08em;

  /* Espaço (base 4) */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px;
  --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px; --s-16: 64px; --s-24: 96px;
  --gutter: clamp(16px, 4vw, 40px);
  --content: 1200px;

  /* Forma */
  --r-xs: 4px; --r-sm: 6px; --r: 10px; --r-lg: 16px; --r-pill: 999px;
  --control-h: 40px;
  --control-h-sm: 32px;
  --hit: 44px;

  /* Profundidade: borda primeiro, sombra só quando flutua */
  --shadow-1: 0 1px 2px rgb(22 24 28 / .06);
  --shadow-2: 0 2px 6px rgb(22 24 28 / .06), 0 12px 28px rgb(22 24 28 / .08);
  --shadow-3: 0 4px 12px rgb(22 24 28 / .08), 0 24px 64px rgb(22 24 28 / .16);

  /* Movimento: só transform e opacity */
  --dur-fast: 120ms;
  --dur-base: 200ms;
  --dur-slow: 400ms;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-in: cubic-bezier(.4, 0, 1, 1);

  /* Camadas */
  --z-sticky: 10; --z-nav: 20; --z-overlay: 40; --z-modal: 50; --z-toast: 60; --z-tooltip: 70;
}

/* Modo escuro: quase-preto esverdeado, com tokens próprios (não é inversão) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0D100F; --surface: #151918; --surface-2: #1C211F; --surface-sunk: #0A0C0B; --scrim: rgb(0 0 0 / .6);
    --ink: #ECE8E1; --ink-2: #A6A199; --ink-3: #8D8A84; --ink-inverse: #0D100F;
    --line: #232826; --line-soft: #1C211F; --line-strong: #646C68;
    --primary: #3FB68B; --primary-hover: #52C49A; --primary-press: #34A07A; --primary-bg: #13261F; --on-primary: #0D100F;
    --accent: #D4B06A; --accent-ink: #D4B06A; --accent-bg: #262116;
    --pos: #4CC08F; --pos-bg: #12261C; --neg: #F08474; --neg-ink: #F08474; --neg-bg: #2A1714;
    --warn: #E5AC45; --warn-ink: #E5AC45; --warn-bg: #2A2112; --focus: #3FB68B;
    --chart-1: #2A9A73; --chart-2: #B08A2E; --chart-3: #5587D6; --chart-4: #D8644A; --chart-5: #9473D3;
    --chart-other: #5E625F; --chart-grid: #222725; --chart-axis: #8D8A84;
    --shadow-1: 0 1px 2px rgb(0 0 0 / .4);
    --shadow-2: 0 2px 6px rgb(0 0 0 / .35), 0 12px 28px rgb(0 0 0 / .4);
    --shadow-3: 0 4px 12px rgb(0 0 0 / .4), 0 24px 64px rgb(0 0 0 / .6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0D100F; --surface: #151918; --surface-2: #1C211F; --surface-sunk: #0A0C0B; --scrim: rgb(0 0 0 / .6);
  --ink: #ECE8E1; --ink-2: #A6A199; --ink-3: #8D8A84; --ink-inverse: #0D100F;
  --line: #232826; --line-soft: #1C211F; --line-strong: #646C68;
  --primary: #3FB68B; --primary-hover: #52C49A; --primary-press: #34A07A; --primary-bg: #13261F; --on-primary: #0D100F;
  --accent: #D4B06A; --accent-ink: #D4B06A; --accent-bg: #262116;
  --pos: #4CC08F; --pos-bg: #12261C; --neg: #F08474; --neg-ink: #F08474; --neg-bg: #2A1714;
  --warn: #E5AC45; --warn-ink: #E5AC45; --warn-bg: #2A2112; --focus: #3FB68B;
  --chart-1: #2A9A73; --chart-2: #B08A2E; --chart-3: #5587D6; --chart-4: #D8644A; --chart-5: #9473D3;
  --chart-other: #5E625F; --chart-grid: #222725; --chart-axis: #8D8A84;
  --shadow-1: 0 1px 2px rgb(0 0 0 / .4);
  --shadow-2: 0 2px 6px rgb(0 0 0 / .35), 0 12px 28px rgb(0 0 0 / .4);
  --shadow-3: 0 4px 12px rgb(0 0 0 / .4), 0 24px 64px rgb(0 0 0 / .6);
}

@media (prefers-reduced-motion: reduce) {
  :root { --dur-fast: 0ms; --dur-base: 0ms; --dur-slow: 0ms; }
}
