/* Design tokens: the one place a colour, font, radius or shadow is written (design handoff 2026-10-05,
   "מעשה פיננסי" redesign; replaces the "Lagoon" palette and the per-page colour roles).
   Rules (docs/AI_AGENT_GUIDE.md, "מערכת עיצוב"):
   - colour = meaning only. Indigo (--accent) is for actions: primary button, link, focus, the selected item in a chart.
   - green = income. Red = expense, but only in KPI cards, totals and errors (an expense row in a table is --text),
     and a figure older than the red threshold ("עודכן ב-…", owner request 2026-10-12).
   - amber (--attention*) only for "needs attention": a pending decision, a note in a card, a renewal within 60 days,
     an unusual month, an import waiting for approval. Never a button, a heading or a whole card.
   - no gradients, no emoji, no heavy shadows. Every other stylesheet uses var(--…) only (src/designTokens.test.ts).
   Shared by the site: scripts/build-site.mjs copies this file to site/tokens.css. */

/* Rubik (SIL Open Font License 1.1), self-hosted (security audit 2026-09-30):
   loading it from Google Fonts told Google every time the dashboard was opened. */
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url(fonts/rubik-hebrew.woff2) format('woff2');
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url(fonts/rubik-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* surfaces */
  --bg: #F6F7FB;            /* page background */
  --surface: #FFFFFF;       /* cards, fields, tables */
  --surface-head: #E9EBF6;  /* page header band and card header bands */
  --surface-sub: #F0F1F7;   /* hover, tags, progress track */
  --surface-foot: #FAFBFD;  /* bottom summary row */
  --row-selected: #EEEFFD;
  --group-row: #ECEDFA;
  --group-row-hover: #E2E4F8;
  --border: #E3E6F0;
  --border-strong: #CDD2E3;
  --switch-off: #767C96;     /* the track of a switch that is off: 4.3:1 on the surface (non-text contrast) */
  --row-line: #F0F1F7;

  /* text */
  --text: #121528;
  --text-strong-body: #343A55;
  --text-body: #4A5070;
  --text-muted: #666C8A;
  --text-faint: #9AA0BA;    /* separators and decoration only: 2.6:1, never for text that must be read */
  --heading: #1E1B4B;

  /* action */
  --accent: #4338CA;
  --accent-hover: #3730A3;
  --accent-tint: #E0E1FA;
  --on-accent: #FFFFFF;
  --chip-on: #1E1B4B;       /* active chip / segment, white text */

  /* meaning */
  --income: #0F7B55;
  --income-bar: #22A375;
  --income-tint: #D5F2E6;
  --income-soft: #EAF8F1;   /* behind --income text in a tag: 4.8:1 (the tint is 4.4:1, for decoration only) */
  --expense: #C2334D;
  --expense-bar: #E26179;
  --expense-tint: #FBE6EA;  /* error banner / error message background (not in the handoff; derived from --expense) */
  --attention: #B45309;
  --attention-bg: #FEF3C7;
  --attention-border: #F5D98A;
  --attention-text: #78350F;
  --attention-row: #FFFBEB;

  /* data-viz: shades of the accent. --data-1 is a selected / primary series. */
  --data-1: var(--accent);
  --data-2: #7C74E0;
  --data-3: #B3AEF0;
  --data-4: #D6D3F7;
  --data-5: #3B3790;
  --chart-grid: var(--row-line);
  --chart-axis: var(--text-muted);

  /* website: the dark band */
  --band: #1E1B4B;
  --band-text: #D4D3F0;
  --band-muted: #A9A7D8;
  --band-line: #4B4790;
  --band-node: rgba(255, 255, 255, 0.08);
  --band-strong: #FFFFFF; /* headings and bold text on the band */

  /* shape */
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 10px;
  --radius-pill: 999px;     /* dots, progress tracks and avatars only; chips and tags use --radius */
  --shadow-kpi: 0 1px 2px rgba(18, 21, 40, 0.05);
  --shadow-pop: 0 20px 50px rgba(18, 21, 40, 0.18);

  /* overlays */
  --header-bg: rgba(255, 255, 255, 0.92);
  --overlay: rgba(18, 21, 40, 0.28);      /* modal / command palette backdrop */
  --overlay-lock: rgba(246, 247, 251, 0.86);

  /* type */
  --font: 'Rubik', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --fs-base: 15px;
  --fs-table: 14.5px;
  --fs-small: 13px;
  --fs-label: 12px;
  --fs-h1: 24px;
  --fs-h2: 16px;
  --fs-kpi: 27px;

  /* motion: background / border only */
  --t-fast: 150ms ease;
}

/* Dark mode: the website only (its <html> carries data-site). The app has no dark mode.
   The same roles, lighter accent on dark surfaces; every text pair keeps 4.5:1 or more. */
@media (prefers-color-scheme: dark) {
  :root[data-site] {
    color-scheme: dark;
    --bg: #0E1014;
    --surface: #161920;
    --surface-head: #1B1F27;
    --surface-sub: #20252E;
    --surface-foot: #13161C;
    --row-selected: #1C2033;
    --border: #2A2F3A;
    --border-strong: #3A4150;
    --switch-off: #7A8190;
    --row-line: #20252E;
    --text: #ECEEF2;
    --text-strong-body: #C9CDD6;
    --text-body: #B4B9C4;
    --text-muted: #969CA8;
    --text-faint: #626875;
    --heading: #ECEEF2;
    --accent: #A5A0F5;
    --accent-hover: #C3BFFA;
    --accent-tint: #24224A;
    --on-accent: #0E1014;
    --chip-on: #ECEEF2;
    --income: #4ADE80;
    --income-tint: #12291E;
    --income-soft: #12291E;
    --expense: #F87171;
    --expense-tint: #3A1A1F;
    --attention: #FBBF24;
    --attention-bg: #2B2312;
    --attention-border: #4A3B17;
    --attention-text: #FCD58A;
    --attention-row: #221C10;
    --data-3: #4B4790;
    --band: #1B1A3A;
    --header-bg: rgba(14, 16, 20, 0.9);
    --overlay: rgba(0, 0, 0, 0.55);
    --shadow-kpi: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-pop: 0 20px 50px rgba(0, 0, 0, 0.5);
  }
}
