/*
 * Tandem design tokens (DESIGN.md, look book Option B "Classic Linen").
 * Light is the default. Dark follows the system unless the user picks a theme,
 * so the dark set appears twice: once for the system setting, once for the manual toggle.
 * Keep the two dark blocks identical (tests/contrast.test.mjs checks this).
 */

:root {
  color-scheme: light;

  /* Brand */
  --evergreen: #12302A;
  --evergreen-2: #1E4A40;
  --sage: #9DB48C;
  --linen: #F2F0EA;
  --mist: #B9CAD6;

  /* Logo (fixed in both themes) */
  --logo-a: #F2F0EA;
  --logo-b1: #A9C09B;
  --logo-b2: #94AD85;
  --logo-ours: #12302A;
  --icon-bg-1: #1E4A40;
  --icon-bg-2: #12302A;
  --avatar-a-bg: #F2F0EA;
  --avatar-a-fg: #6F5F45;
  --avatar-b-bg: #9DB48C;
  --avatar-b-fg: #12302A;

  /* Partners: colors follow the person, not the word */
  --a-chart: #A08E6E;
  --a-text: #7A6A4F;
  --b-chart: #9DB48C;
  --b-text: #4A6A3C;
  --ours-chart: #12302A;

  /* Surfaces and text */
  --bg: #F7F6F2;
  --card: #FFFFFF;
  --line: #E6E3DA;
  --track: #ECE9E1;
  --fg: #1F2A2E;
  --muted: #5E6B66;
  --hover: #F1EFE9;
  --progress: #1E4A40;
  --toast-bg: #12302A;
  --toast-fg: #F2F0EA;
  --backdrop: rgba(10, 21, 18, 0.45);

  /* Sidebar (always dark) */
  --side-bg: #12302A;
  --side-active: #1E4A40;
  --side-fg: #F2F0EA;
  --nav-off: #A9B8B1;
  --side-hover: #1A3E36;
  --side-line: #24463E;

  /* Buttons */
  --primary-bg: #1E4A40;
  --primary-fg: #F2F0EA;
  --primary-hover: #12302A;

  /* Spending groups */
  --needs: #6E7F8D;
  --wants: #8A6E8C;
  --savings: #2F7A72;
  --set-aside: #46648F;

  /* Status: dots use the look book colors; text uses darker shades that pass WCAG AA */
  --ok: #4E8B5F;
  --watch: #C8963E;
  --risk: #B5523B;
  --ok-text: #3B6F4B;
  --watch-text: #845F1C;
  --risk-text: #9C4330;
  --ok-tint: #E8F1EA;
  --watch-tint: #FAF1E1;
  --risk-tint: #F8E7E2;
  --info-tint: #EAF0F4;
  --info-text: #3E5566;

  /* Owner chips */
  --chip-all-bg: #12302A;
  --chip-all-fg: #F2F0EA;
  --chip-a-bg: #F4F0E6;
  --chip-a-fg: #6F5F45;
  --chip-b-bg: #E4ECDD;
  --chip-b-fg: #435F36;
  --chip-ours-bg: #E2E7E4;
  --chip-ours-fg: #1F2A2E;

  /* Card faces (generated card thumbnails) */
  --face-1a: #2A4C86;
  --face-1b: #0D1D3A;
  --face-2a: #1E4A40;
  --face-2b: #0B201C;
  --face-3a: #7A3B2E;
  --face-3b: #3A1A14;
  --face-4a: #4B4F58;
  --face-4b: #1D2026;
  --face-5a: #5B3F7A;
  --face-5b: #24163A;
  --face-6a: #2F6B73;
  --face-6b: #0F2A2E;
  --face-fg: #FFFFFF;

  /* Focus ring */
  --focus: #1E4A40;
  --focus-on-dark: #F2F0EA;

  /* Type */
  --font-sans: "Inter", "Inter Variable", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Newsreader", Georgia, "Times New Roman", serif;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 20px;
  --fs-2xl: 30px;
  --fs-num: 28px;

  /* Space, radius, shadow */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-card: 14px;
  --r-pill: 999px;
  --shadow: 0 1px 2px rgba(18, 48, 42, 0.05), 0 6px 20px rgba(18, 48, 42, 0.04);
  --shadow-pop: 0 12px 40px rgba(18, 48, 42, 0.18);

  /* Layout */
  --sidebar-w: 232px;
  --rail-w: 72px;
  --drawer-w: 280px;
  --topbar-h: 60px;
  --topbar-shadow: 0 2px 12px rgba(18, 48, 42, 0.22);
  --content-max: 1180px;

  /* Motion */
  --t-fast: 120ms;
  --t-page-out: 150ms;
  --t-page-in: 200ms;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --a-chart: #B9A684;
    --a-text: #D4C19C;
    --b-chart: #9DB48C;
    --b-text: #B7CDA7;
    --ours-chart: #6F9C8E;
    --bg: #0F1B18;
    --card: #172521;
    --line: #26362F;
    --track: #24332E;
    --fg: #ECE9E1;
    --muted: #A3B2AB;
    --hover: #1D2D28;
    --progress: #7FB3A3;
    --toast-bg: #24433A;
    --toast-fg: #F2F0EA;
    --backdrop: rgba(0, 0, 0, 0.6);
    --side-bg: #0A1512;
    --side-active: #1E4A40;
    --side-fg: #F2F0EA;
    --nav-off: #93A59D;
    --side-hover: #142520;
    --side-line: #1C2E29;
    --primary-bg: #2B6153;
    --primary-fg: #F2F0EA;
    --primary-hover: #33705F;
    --needs: #93A3B0;
    --wants: #B497B6;
    --savings: #52AA9F;
    --set-aside: #8099C4;
    --ok: #6DAE80;
    --watch: #D8A852;
    --risk: #DB7A62;
    --ok-text: #86C097;
    --watch-text: #E2B76A;
    --risk-text: #E99580;
    --ok-tint: #1C3326;
    --watch-tint: #33291A;
    --risk-tint: #3A231D;
    --info-tint: #1C2A33;
    --info-text: #B5C8D6;
    --chip-all-bg: #F2F0EA;
    --chip-all-fg: #12302A;
    --chip-a-bg: #2F2A20;
    --chip-a-fg: #E0CFAE;
    --chip-b-bg: #233122;
    --chip-b-fg: #C2D6B3;
    --chip-ours-bg: #26332F;
    --chip-ours-fg: #E1E6E3;
    --focus: #C9DBBB;
    --focus-on-dark: #F2F0EA;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.2);
    --shadow-pop: 0 12px 40px rgba(0, 0, 0, 0.5);
    --topbar-shadow: 0 2px 14px rgba(0, 0, 0, 0.6);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --a-chart: #B9A684;
  --a-text: #D4C19C;
  --b-chart: #9DB48C;
  --b-text: #B7CDA7;
  --ours-chart: #6F9C8E;
  --bg: #0F1B18;
  --card: #172521;
  --line: #26362F;
  --track: #24332E;
  --fg: #ECE9E1;
  --muted: #A3B2AB;
  --hover: #1D2D28;
  --progress: #7FB3A3;
  --toast-bg: #24433A;
  --toast-fg: #F2F0EA;
  --backdrop: rgba(0, 0, 0, 0.6);
  --side-bg: #0A1512;
  --side-active: #1E4A40;
  --side-fg: #F2F0EA;
  --nav-off: #93A59D;
  --side-hover: #142520;
  --side-line: #1C2E29;
  --primary-bg: #2B6153;
  --primary-fg: #F2F0EA;
  --primary-hover: #33705F;
  --needs: #93A3B0;
  --wants: #B497B6;
  --savings: #52AA9F;
  --set-aside: #8099C4;
  --ok: #6DAE80;
  --watch: #D8A852;
  --risk: #DB7A62;
  --ok-text: #86C097;
  --watch-text: #E2B76A;
  --risk-text: #E99580;
  --ok-tint: #1C3326;
  --watch-tint: #33291A;
  --risk-tint: #3A231D;
  --info-tint: #1C2A33;
  --info-text: #B5C8D6;
  --chip-all-bg: #F2F0EA;
  --chip-all-fg: #12302A;
  --chip-a-bg: #2F2A20;
  --chip-a-fg: #E0CFAE;
  --chip-b-bg: #233122;
  --chip-b-fg: #C2D6B3;
  --chip-ours-bg: #26332F;
  --chip-ours-fg: #E1E6E3;
  --focus: #C9DBBB;
  --focus-on-dark: #F2F0EA;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.2);
  --shadow-pop: 0 12px 40px rgba(0, 0, 0, 0.5);
  --topbar-shadow: 0 2px 14px rgba(0, 0, 0, 0.6);
}
