/* Design tokens. Every theme defines the same set of custom properties. */

/* Figtree 2.002 (SIL OFL 1.1), self-hosted subsets; see static/fonts/README.md (spec 029).
   shortcut: no preload and no size-adjust fallback metrics; revisit if the swap flash is
   noticeable on staging. */
@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url("../fonts/figtree-latin.ce3d294ef8db.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url("../fonts/figtree-latin-ext.7ff3edf41f35.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root,
[data-theme="light"],
[data-theme="system"] {
  color-scheme: light;
  --color-bg: #ffffff;
  /* Charts (spec 026): income/expense and the pie sequence, >= 3:1 on --color-bg. */
  --color-chart-income: #4f46e5;
  --color-chart-expense: #c2410c;
  --color-chart-open: #0f766e;
  --color-chart-1: #4f46e5;
  --color-chart-2: #c2410c;
  --color-chart-3: #0f766e;
  --color-chart-4: #a21caf;
  --color-chart-5: #4d7c0f;
  --color-chart-6: #b45309;
  --color-chart-7: #0369a1;
  --color-chart-8: #be123c;
  --color-chart-9: #57534e;
  --color-surface: #f8fafc;
  --color-border: #cbd5e1;
  --color-fg: #0f172a;
  --color-fg-muted: #475569;
  --color-accent: #6366f1;
  --color-primary: #4f46e5;
  --color-primary-fg: #ffffff;
  --color-primary-hover: #4338CA;
  --color-nav-active-bg: #EEF2FF;
  --color-nav-active-fg: #3730A3;
  --color-link: #4338ca;
  --color-focus: #6366f1;
  --color-danger: #b91c1c;
  --color-danger-bg: #fef2f2;
  --color-tooltip-bg: #0f172a;
  --color-tooltip-fg: #f8fafc;
  /* Status pairs (spec 030): light values are the Farben board; see the spec
     for the measured ratios. */
  --color-status-draft-fg: #334155;
  --color-status-draft-bg: #F1F5F9;
  --color-status-issued-fg: #3730A3;
  --color-status-issued-bg: #EEF2FF;
  --color-status-sent-fg: #075985;
  --color-status-sent-bg: #E0F2FE;
  --color-status-paid-fg: #166534;
  --color-status-paid-bg: #DCFCE7;
  --color-status-overdue-fg: #9A3412;
  --color-status-overdue-bg: #FFEDD5;
  --color-status-cancelled-fg: #475569;
  --color-status-cancelled-bg: #F1F5F9;
  /* Surfaces: light hint values are the board's; the rest are extensions. */
  --color-notice-bg: #F8FAFC;
  --color-notice-border: #CBD5E1;
  --color-notice-fg: #0F172A;
  --color-marker-bg: #FEFCE8;
  --color-marker-border: #FDE047;
  --color-marker-fg: #422006;
  --shadow-overlay: 0 8px 24px rgb(15 23 42 / 0.18);

}

[data-theme="dark"] {
  color-scheme: dark;
  --color-bg: #0f172a;
  /* Charts (spec 026): income/expense and the pie sequence, >= 3:1 on --color-bg. */
  --color-chart-income: #818cf8;
  --color-chart-expense: #fb923c;
  --color-chart-open: #2dd4bf;
  --color-chart-1: #818cf8;
  --color-chart-2: #fb923c;
  --color-chart-3: #2dd4bf;
  --color-chart-4: #e879f9;
  --color-chart-5: #a3e635;
  --color-chart-6: #fbbf24;
  --color-chart-7: #38bdf8;
  --color-chart-8: #fb7185;
  --color-chart-9: #a8a29e;
  --color-surface: #1e293b;
  --color-border: #475569;
  --color-fg: #e2e8f0;
  --color-fg-muted: #94a3b8;
  --color-accent: #818cf8;
  --color-primary: #818cf8;
  --color-primary-fg: #0f172a;
  --color-primary-hover: #A5B4FC;
  --color-nav-active-bg: #312E81;
  --color-nav-active-fg: #C7D2FE;
  --color-link: #a5b4fc;
  --color-focus: #a5b4fc;
  --color-danger: #fca5a5;
  --color-danger-bg: #450a0a;
  --color-tooltip-bg: #e2e8f0;
  --color-tooltip-fg: #0f172a;
  --color-status-draft-fg: #CBD5E1;
  --color-status-draft-bg: #334155;
  --color-status-issued-fg: #C7D2FE;
  --color-status-issued-bg: #312E81;
  --color-status-sent-fg: #7DD3FC;
  --color-status-sent-bg: #0C4A6E;
  --color-status-paid-fg: #86EFAC;
  --color-status-paid-bg: #14532D;
  --color-status-overdue-fg: #FDBA74;
  --color-status-overdue-bg: #7C2D12;
  --color-status-cancelled-fg: #CBD5E1;
  --color-status-cancelled-bg: #334155;
  --color-notice-bg: #1E293B;
  --color-notice-border: #475569;
  --color-notice-fg: #E2E8F0;
  --color-marker-bg: #422006;
  --color-marker-border: #A16207;
  --color-marker-fg: #FEF9C3;

}

@media (prefers-color-scheme: dark) {
  [data-theme="system"] {
    color-scheme: dark;
    --color-bg: #0f172a;
    /* Charts (spec 026): income/expense and the pie sequence, >= 3:1 on --color-bg. */
    --color-chart-income: #818cf8;
    --color-chart-expense: #fb923c;
    --color-chart-open: #2dd4bf;
    --color-chart-1: #818cf8;
    --color-chart-2: #fb923c;
    --color-chart-3: #2dd4bf;
    --color-chart-4: #e879f9;
    --color-chart-5: #a3e635;
    --color-chart-6: #fbbf24;
    --color-chart-7: #38bdf8;
    --color-chart-8: #fb7185;
    --color-chart-9: #a8a29e;
    --color-surface: #1e293b;
    --color-border: #475569;
    --color-fg: #e2e8f0;
    --color-fg-muted: #94a3b8;
    --color-accent: #818cf8;
    --color-primary: #818cf8;
    --color-primary-fg: #0f172a;
    --color-primary-hover: #A5B4FC;
    --color-nav-active-bg: #312E81;
    --color-nav-active-fg: #C7D2FE;
    --color-link: #a5b4fc;
    --color-focus: #a5b4fc;
    --color-danger: #fca5a5;
    --color-danger-bg: #450a0a;
    --color-tooltip-bg: #e2e8f0;
    --color-tooltip-fg: #0f172a;
    --color-status-draft-fg: #CBD5E1;
    --color-status-draft-bg: #334155;
    --color-status-issued-fg: #C7D2FE;
    --color-status-issued-bg: #312E81;
    --color-status-sent-fg: #7DD3FC;
    --color-status-sent-bg: #0C4A6E;
    --color-status-paid-fg: #86EFAC;
    --color-status-paid-bg: #14532D;
    --color-status-overdue-fg: #FDBA74;
    --color-status-overdue-bg: #7C2D12;
    --color-status-cancelled-fg: #CBD5E1;
    --color-status-cancelled-bg: #334155;
    --color-notice-bg: #1E293B;
    --color-notice-border: #475569;
    --color-notice-fg: #E2E8F0;
    --color-marker-bg: #422006;
    --color-marker-border: #A16207;
    --color-marker-fg: #FEF9C3;

  }
}

/* Catppuccin Latte (https://catppuccin.com, MIT), light (spec 017). Three
   tokens are darkened official colors, so text keeps WCAG AA contrast. */
[data-theme="light"][data-light-theme="catppuccin-latte"] {
  color-scheme: light;
  --color-bg: #eff1f5;            /* base */
  /* Charts (spec 026): income/expense and the pie sequence, >= 3:1 on --color-bg. */
  --color-chart-income: #1e66f5;
  --color-chart-expense: #c4510a;
  --color-chart-open: #137a72;
  --color-chart-1: #1e66f5;
  --color-chart-2: #c4510a;
  --color-chart-3: #137a72;
  --color-chart-4: #8839ef;
  --color-chart-5: #3b7f26;
  --color-chart-6: #9a6a00;
  --color-chart-7: #0b7fb0;
  --color-chart-8: #d20f39;
  --color-chart-9: #6c6f85;
  --color-surface: #e6e9ef;       /* mantle */
  --color-border: #9ca0b0;        /* overlay0 */
  --color-fg: #4c4f69;            /* text */
  --color-fg-muted: #5c5f77;      /* subtext1 */
  --color-accent: #8839ef;        /* mauve */
  --color-primary: #8839ef;
  --color-primary-fg: #eff1f5;
  --color-primary-hover: #7430CB;  /* primary 85% + black: 6.13:1 with primary-fg */
  --color-nav-active-bg: #EDE3FB;
  --color-nav-active-fg: #6C2BD9;
  --color-link: #1a5ce0;          /* blue #1e66f5 darkened: 5.09:1 on base, 4.73:1 on mantle */
  --color-focus: #8839ef;
  --color-danger: #bd0d33;        /* red #d20f39 darkened: 5.68:1 on base, 5.28:1 on mantle */
  --color-danger-bg: #eddfe6;     /* base mixed with 8 % red; danger on it 4.99:1 */
  --color-tooltip-bg: #4c4f69;
  --color-tooltip-fg: #eff1f5;
  --color-status-draft-fg: #5C5F77;
  --color-status-draft-bg: #E6E9EF;
  --color-status-issued-fg: #6C2BD9;
  --color-status-issued-bg: #EDE3FB;
  --color-status-sent-fg: #0B5E8A;
  --color-status-sent-bg: #DCEAF3;
  --color-status-paid-fg: #2E6B1F;
  --color-status-paid-bg: #DDEED6;
  --color-status-overdue-fg: #A03D00;
  --color-status-overdue-bg: #FBE6D6;
  --color-status-cancelled-fg: #5C5F77;
  --color-status-cancelled-bg: #E6E9EF;
  --color-notice-bg: #E6E9EF;
  --color-notice-border: #9CA0B0;
  --color-notice-fg: #4C4F69;
  --color-marker-bg: #FEF9C3;
  --color-marker-border: #FDE047;
  --color-marker-fg: #713F12;

}

/* Same tokens for "Follow device" (spec 032). shortcut: duplicated block, guarded by a
   unit test; revisit if a CSS build step or a third palette per scheme appears. */
@media (prefers-color-scheme: light) {
  [data-theme="system"][data-light-theme="catppuccin-latte"] {
    color-scheme: light;
    --color-bg: #eff1f5;            /* base */
    /* Charts (spec 026): income/expense and the pie sequence, >= 3:1 on --color-bg. */
    --color-chart-income: #1e66f5;
    --color-chart-expense: #c4510a;
    --color-chart-open: #137a72;
    --color-chart-1: #1e66f5;
    --color-chart-2: #c4510a;
    --color-chart-3: #137a72;
    --color-chart-4: #8839ef;
    --color-chart-5: #3b7f26;
    --color-chart-6: #9a6a00;
    --color-chart-7: #0b7fb0;
    --color-chart-8: #d20f39;
    --color-chart-9: #6c6f85;
    --color-surface: #e6e9ef;       /* mantle */
    --color-border: #9ca0b0;        /* overlay0 */
    --color-fg: #4c4f69;            /* text */
    --color-fg-muted: #5c5f77;      /* subtext1 */
    --color-accent: #8839ef;        /* mauve */
    --color-primary: #8839ef;
    --color-primary-fg: #eff1f5;
    --color-primary-hover: #7430CB;  /* primary 85% + black: 6.13:1 with primary-fg */
    --color-nav-active-bg: #EDE3FB;
    --color-nav-active-fg: #6C2BD9;
    --color-link: #1a5ce0;          /* blue #1e66f5 darkened: 5.09:1 on base, 4.73:1 on mantle */
    --color-focus: #8839ef;
    --color-danger: #bd0d33;        /* red #d20f39 darkened: 5.68:1 on base, 5.28:1 on mantle */
    --color-danger-bg: #eddfe6;     /* base mixed with 8 % red; danger on it 4.99:1 */
    --color-tooltip-bg: #4c4f69;
    --color-tooltip-fg: #eff1f5;
    --color-status-draft-fg: #5C5F77;
    --color-status-draft-bg: #E6E9EF;
    --color-status-issued-fg: #6C2BD9;
    --color-status-issued-bg: #EDE3FB;
    --color-status-sent-fg: #0B5E8A;
    --color-status-sent-bg: #DCEAF3;
    --color-status-paid-fg: #2E6B1F;
    --color-status-paid-bg: #DDEED6;
    --color-status-overdue-fg: #A03D00;
    --color-status-overdue-bg: #FBE6D6;
    --color-status-cancelled-fg: #5C5F77;
    --color-status-cancelled-bg: #E6E9EF;
    --color-notice-bg: #E6E9EF;
    --color-notice-border: #9CA0B0;
    --color-notice-fg: #4C4F69;
    --color-marker-bg: #FEF9C3;
    --color-marker-border: #FDE047;
    --color-marker-fg: #713F12;

  }
}

/* Catppuccin Mocha (https://catppuccin.com, MIT). */
[data-theme="dark"][data-dark-theme="catppuccin"] {
  color-scheme: dark;
  --color-bg: #1e1e2e;
  /* Charts (spec 026): income/expense and the pie sequence, >= 3:1 on --color-bg. */
  --color-chart-income: #89b4fa;
  --color-chart-expense: #fab387;
  --color-chart-open: #94e2d5;
  --color-chart-1: #89b4fa;
  --color-chart-2: #fab387;
  --color-chart-3: #94e2d5;
  --color-chart-4: #cba6f7;
  --color-chart-5: #a6e3a1;
  --color-chart-6: #f9e2af;
  --color-chart-7: #89dceb;
  --color-chart-8: #f38ba8;
  --color-chart-9: #a6adc8;
  --color-surface: #313244;
  --color-border: #585b70;
  --color-fg: #cdd6f4;
  --color-fg-muted: #a6adc8;
  --color-accent: #cba6f7;
  --color-primary: #cba6f7;
  --color-primary-fg: #11111b;
  --color-primary-hover: #D3B3F8;  /* primary 85% + white: 10.33:1 with primary-fg */
  --color-nav-active-bg: #3A2C52;
  --color-nav-active-fg: #CBA6F7;
  --color-link: #b4befe;
  --color-focus: #f9e2af;
  --color-danger: #f38ba8;
  --color-danger-bg: #45273a;
  --color-tooltip-bg: #cdd6f4;
  --color-tooltip-fg: #11111b;
  --color-status-draft-fg: #BAC2DE;
  --color-status-draft-bg: #313244;
  --color-status-issued-fg: #CBA6F7;
  --color-status-issued-bg: #3A2C52;
  --color-status-sent-fg: #89DCEB;
  --color-status-sent-bg: #1E3A4A;
  --color-status-paid-fg: #A6E3A1;
  --color-status-paid-bg: #233A2A;
  --color-status-overdue-fg: #FAB387;
  --color-status-overdue-bg: #4A2E1E;
  --color-status-cancelled-fg: #A6ADC8;
  --color-status-cancelled-bg: #313244;
  --color-notice-bg: #313244;
  --color-notice-border: #585B70;
  --color-notice-fg: #CDD6F4;
  --color-marker-bg: #422006;
  --color-marker-border: #A16207;
  --color-marker-fg: #FEF9C3;

}

/* Same tokens for "Follow device" (spec 032). shortcut: duplicated block, guarded by a
   unit test; revisit if a CSS build step or a third palette per scheme appears. */
@media (prefers-color-scheme: dark) {
  [data-theme="system"][data-dark-theme="catppuccin"] {
    color-scheme: dark;
    --color-bg: #1e1e2e;
    /* Charts (spec 026): income/expense and the pie sequence, >= 3:1 on --color-bg. */
    --color-chart-income: #89b4fa;
    --color-chart-expense: #fab387;
    --color-chart-open: #94e2d5;
    --color-chart-1: #89b4fa;
    --color-chart-2: #fab387;
    --color-chart-3: #94e2d5;
    --color-chart-4: #cba6f7;
    --color-chart-5: #a6e3a1;
    --color-chart-6: #f9e2af;
    --color-chart-7: #89dceb;
    --color-chart-8: #f38ba8;
    --color-chart-9: #a6adc8;
    --color-surface: #313244;
    --color-border: #585b70;
    --color-fg: #cdd6f4;
    --color-fg-muted: #a6adc8;
    --color-accent: #cba6f7;
    --color-primary: #cba6f7;
    --color-primary-fg: #11111b;
    --color-primary-hover: #D3B3F8;  /* primary 85% + white: 10.33:1 with primary-fg */
    --color-nav-active-bg: #3A2C52;
    --color-nav-active-fg: #CBA6F7;
    --color-link: #b4befe;
    --color-focus: #f9e2af;
    --color-danger: #f38ba8;
    --color-danger-bg: #45273a;
    --color-tooltip-bg: #cdd6f4;
    --color-tooltip-fg: #11111b;
    --color-status-draft-fg: #BAC2DE;
    --color-status-draft-bg: #313244;
    --color-status-issued-fg: #CBA6F7;
    --color-status-issued-bg: #3A2C52;
    --color-status-sent-fg: #89DCEB;
    --color-status-sent-bg: #1E3A4A;
    --color-status-paid-fg: #A6E3A1;
    --color-status-paid-bg: #233A2A;
    --color-status-overdue-fg: #FAB387;
    --color-status-overdue-bg: #4A2E1E;
    --color-status-cancelled-fg: #A6ADC8;
    --color-status-cancelled-bg: #313244;
    --color-notice-bg: #313244;
    --color-notice-border: #585B70;
    --color-notice-fg: #CDD6F4;
    --color-marker-bg: #422006;
    --color-marker-border: #A16207;
    --color-marker-fg: #FEF9C3;

  }
}

:root {
  --font-sans: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  /* Brand constant (spec 029): yellow only as dot, marker or notice surface, never as text. */
  --color-marker: #FACC15;
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.778rem;
  --radius-pill: 999px;
  --radius: var(--radius-md);
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  /* Type scale (spec 029), rem so the font-size setting (spec 022) scales it. */
  --text-display: 2.667rem;
  --text-h1: 2rem;
  --text-h2: 1.5rem;
  --text-h3: 1.222rem;
  --text-body: 1rem;
  --text-hint: 0.889rem;
  --text-label: 0.778rem;
  --text-amount: 1rem;
}

/* Phones (spec 017's breakpoint): smaller headings, everything else unchanged. */
@media (max-width: 647.98px) {
  :root {
    --text-h1: 1.556rem;
    --text-h2: 1.222rem;
  }
}
