/* =====================================================================
   WiseFinance design system  ·  wf.css
   One shared stylesheet for every page: tokens (dark + light), base,
   and reusable components. Page sheets (home.css, auth.css, bank.css,
   app.css, privacy.css) only add layout on top of these tokens.

   Design language (owner's Figma "אתר פיננסים"):
   - LIGHT is the default theme (the home page follows the device); theme.js switches
     to the matching dark theme on request (<html data-theme="dark|light">, stored in wf-theme).
   - Two dark families: deep navy for the public site (landing, auth, bank,
     privacy – <body class="surface-navy">) and neutral near-black for /app.
   - Sky→teal gradient for primary actions, highlights and chart bars; thin
     light borders; ~16px radii; income green / expense rose / balance cyan.

   Contrast notes (WCAG AA, checked for every text pair):
   - Figma button gradient #1490B1→#1CA0A4 gives white text only 3.7:1 / 3.2:1,
     so filled buttons use the same hues darkened: #0E7A97→#0F7F86 (4.9:1 / 4.8:1).
     The bright Figma gradient is kept for non-text marks (bars, rules, headline
     gradient text on navy: 5.0:1 / 5.9:1).
   - Figma expense rose #F43F5E is 4.5:1 on the navy card #17202E → #FB5A73 there.
   - Light theme uses the 700 shades of the same hues (green/rose/cyan/amber).
   ===================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  /* type */
  --font-sans: "Heebo", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --font-display: "Rubik", "Heebo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --fs-2xs: 0.6875rem;  /* 11 */
  --fs-xs: 0.75rem;     /* 12 */
  --fs-sm: 0.875rem;    /* 14 */
  --fs-md: 1rem;        /* 16 */
  --fs-lg: 1.125rem;    /* 18 */
  --fs-xl: 1.375rem;    /* 22 */
  --fs-2xl: 1.75rem;    /* 28 */
  --fs-3xl: 2.25rem;    /* 36 */
  --fs-hero: clamp(2.5rem, 1.6rem + 3.6vw, 4.5rem);
  --lh-tight: 1.15;
  --lh-snug: 1.35;
  --lh-body: 1.6;
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  /* spacing (4px grid) */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;
  --sp-12: 48px; --sp-16: 64px; --sp-20: 80px; --sp-24: 96px;

  /* radius */
  --r-xs: 6px; --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 20px; --r-pill: 999px;

  /* layers */
  --z-header: 50; --z-sidebar: 70; --z-dropdown: 60; --z-overlay: 80; --z-modal: 90; --z-toast: 100;

  /* motion */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur-1: 120ms; --dur-2: 200ms; --dur-3: 320ms;

  --container: 1200px;
  --header-h: 64px;

  /* gradient stops (same in both themes) */
  --sky: #1490B1;
  --teal: #1CA0A4;
  --grad-accent: linear-gradient(90deg, var(--sky), var(--teal));       /* marks, bars, highlights */
  --grad-accent-v: linear-gradient(0deg, var(--sky), var(--teal));      /* vertical bars */
  --grad-primary: linear-gradient(270deg, #0E7A97, #0F7F86);            /* filled buttons (white text ≥4.7:1) */
  --grad-primary-hover: linear-gradient(270deg, #0B6A84, #0C6E74);

  /* ---- color: DARK (default) – neutral near-black app surfaces ---- */
  color-scheme: dark;
  --bg: #101214;
  --surface: #1A1D20;
  --surface-2: #23272B;
  --surface-3: #2D3236;
  --surface-raised: #1F2326;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #F2F4F5;
  --text-2: #C9CED1;
  --text-muted: #9BA3A8;
  --brand: #3CC6CF;            /* text, icons, links */
  --brand-solid: #0F7F86;      /* flat fallback for filled controls */
  --brand-solid-hover: #0C6E74;
  --on-brand: #FFFFFF;
  --brand-soft: rgba(28, 160, 164, 0.16);
  --brand-softer: rgba(28, 160, 164, 0.08);
  --brand-ring: rgba(60, 198, 207, 0.55);
  --outline: #3CC6CF;          /* outline (secondary) buttons */
  --income: #10B981;
  --expense: #F43F5E;
  --balance: #0D96A5;
  --balance-text: #1FB2C1;
  --positive: #10B981;
  --positive-soft: rgba(16, 185, 129, 0.14);
  --danger: #F43F5E;
  --danger-soft: rgba(244, 63, 94, 0.13);
  --danger-border: rgba(244, 63, 94, 0.42);
  --warning: #F59E0B;
  --warning-soft: rgba(245, 158, 11, 0.14);
  --chart-income: #22D3EE;
  --chart-expense: #F97316;
  --chart-savings: #A78BFA;  /* dashed savings / investments line */
  --chart-grid: rgba(255, 255, 255, 0.07);
  --track: #2D3236;
  --sidebar-bg: #15181A;
  --nav-active: rgba(60, 198, 207, 0.12);
  --nav-active-text: #5FD3DB;
  --logo-tile: #FFFFFF;
  --mark-tile: #2BA3AE;
  --scrim: rgba(0, 0, 0, 0.66);
  --shadow-xs: none;
  --shadow-sm: none;
  --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.3), 0 12px 32px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.4), 0 28px 64px rgba(0, 0, 0, 0.55);
  --focus-ring: 0 0 0 3px var(--brand-ring);

  /* redesign (RiseUp-style structure): hero header, airy cards, list rows */
  --hero-bg: linear-gradient(160deg, #0F6779 0%, #0B4D5C 100%);
  --hero-top: #0F6779;          /* solid top colour: phone top bar + browser chrome (theme.js) */
  --hero-text: #FFFFFF;
  --hero-text-2: rgba(255, 255, 255, 0.78);
  --hero-pill-bg: rgba(255, 255, 255, 0.14);
  --r-card: 20px;
  --shadow-card: none;
  --row-h: 56px;
  --page-gutter: 32px;
}
@media (max-width: 760px) { :root { --page-gutter: 16px; } }

/* dark · public site (landing, auth, bank, privacy): deep navy */
:root:not([data-theme="light"]) body.surface-navy {
  --bg: #0C1221;
  --surface: #111A2A;
  --surface-2: #17202E;
  --surface-3: #212C3D;
  --surface-raised: #17202E;
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.22);
  --text: #EEF2F7;
  --text-2: #C3CBD8;
  --text-muted: #9AA6B8;
  --expense: #FB5A73;
  --danger: #FB5A73;
  --danger-soft: rgba(251, 90, 115, 0.14);
  --danger-border: rgba(251, 90, 115, 0.42);
  --track: #212C3D;
  --chart-grid: rgba(255, 255, 255, 0.08);
  --scrim: rgba(3, 7, 16, 0.7);
}

/* ---- color: LIGHT (via the toggle) ---- */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #F6F7FB;
  --surface: #FFFFFF;
  --surface-2: #F1F4F8;
  --surface-3: #E5EAF1;
  --surface-raised: #FFFFFF;
  --border: #E7EBF1;
  --border-strong: #D3DAE4;
  --text: #111A1F;
  --text-2: #36424A;
  --text-muted: #55616A;
  --brand: #0E7490;
  --brand-solid: #0F7F86;
  --brand-solid-hover: #0C6E74;
  --on-brand: #FFFFFF;
  --brand-soft: #DDF1F2;
  --brand-softer: #EEF8F8;
  --brand-ring: rgba(14, 116, 144, 0.38);
  --outline: #0E7490;
  --income: #047857;
  --expense: #BE123C;
  --balance: #0E7490;
  --balance-text: #0E7490;
  --positive: #047857;
  --positive-soft: #E3F5EE;
  --danger: #BE123C;
  --danger-soft: #FDECEF;
  --danger-border: #F3BFCA;
  --warning: #B45309;
  --warning-soft: #FDF2E2;
  --chart-income: #0891B2;
  --chart-expense: #EA580C;
  --chart-savings: #7C3AED;
  --chart-grid: rgba(17, 26, 31, 0.08);
  --track: #E3E9EB;
  --sidebar-bg: #FFFFFF;
  --nav-active: #E2F2F3;
  --nav-active-text: #0B5F6E;
  --logo-tile: #FFFFFF;
  --mark-tile: #138E99;
  --scrim: rgba(10, 18, 22, 0.5);
  --shadow-xs: 0 1px 2px rgba(23, 33, 56, 0.05);
  --shadow-sm: 0 1px 2px rgba(23, 33, 56, 0.04), 0 6px 18px rgba(23, 33, 56, 0.06);
  --shadow-md: 0 2px 6px rgba(23, 33, 56, 0.05), 0 14px 34px rgba(23, 33, 56, 0.09);
  --shadow-lg: 0 4px 12px rgba(17, 26, 31, 0.06), 0 28px 64px rgba(17, 26, 31, 0.14);
  --bg: #F3F5F8;
  --hero-bg: linear-gradient(160deg, #13849C 0%, #0E6A80 100%);
  --hero-top: #13849C;
  --hero-pill-bg: rgba(255, 255, 255, 0.18);
  --shadow-card: 0 1px 2px rgba(16, 38, 48, 0.04), 0 6px 20px rgba(16, 38, 48, 0.06);
}
/* light · public site: a cool, faintly blue paper that mirrors the navy */
:root[data-theme="light"] body.surface-navy {
  --bg: #F3F6FA;
  --surface: #FFFFFF;
  --surface-2: #EDF1F7;
  --surface-3: #E1E7F0;
  --border: #DCE3EC;
  --border-strong: #C2CCD9;
  --text: #0E1626;
  --text-2: #33405A;
  --text-muted: #56627A;
  --track: #E1E7F0;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
  color: var(--text);
}
p { margin: 0; }
img, svg { display: block; max-width: 100%; }
a { color: var(--brand); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--sp-6) 0; }
::selection { background: var(--brand-soft); color: var(--text); }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; inset-inline-start: var(--sp-4); top: -60px;
  z-index: var(--z-toast);
  background: var(--brand-solid); color: var(--on-brand);
  padding: var(--sp-2) var(--sp-4); border-radius: var(--r-sm);
  font-weight: var(--fw-semibold); text-decoration: none;
}
.skip-link:focus { top: var(--sp-3); }

/* money & numbers: LTR digits, tabular */
.num, .money {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  direction: ltr;
  unicode-bidi: isolate;
  white-space: nowrap;
}
.muted { color: var(--text-muted); }
.text-positive { color: var(--positive); }
.text-danger { color: var(--danger); }

/* amounts (one format everywhere): <bdi class="num amt">−402<span class="dec">.45</span> <span class="cur">₪</span></bdi>
   expenses neutral, income green with "+", red only for over-budget / negative balance */
.amt { font-family: var(--font-display); font-weight: var(--fw-semibold); color: var(--text); }
.amt .dec, .amt .cur { font-size: 0.62em; font-weight: var(--fw-medium); }
.amt-income { color: var(--income); }
.amt-muted { color: var(--text-muted); }
.amt-bad { color: var(--danger); }
.amt-hero {
  font-size: clamp(2.5rem, 2rem + 2vw, 3rem); line-height: 1.05;
  font-weight: var(--fw-medium); letter-spacing: -0.02em;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--sp-6);
}
@media (max-width: 640px) { .container { padding-inline: var(--sp-4); } }

.eyebrow {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-sm); font-weight: var(--fw-semibold);
  color: var(--brand);
}

/* ---------- 3. Logo ---------- */
.wf-logo {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text); text-decoration: none;
  direction: ltr; /* wordmark is Latin */
}
.wf-logo-mark {
  width: 32px; height: 32px; flex: none;
  border-radius: 9px;
  background: var(--mark-tile);
  color: #FFFFFF;
  display: grid; place-items: center;
}
.wf-logo-mark svg { width: 20px; height: 20px; }
.wf-logo-word {
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  font-size: 1.1875rem;
  letter-spacing: -0.02em;
  line-height: 1;
}
.wf-logo-word b { font-weight: var(--fw-semibold); color: var(--brand); }
:root:not([data-theme="light"]) .wf-logo-word b {
  background: var(--grad-accent); -webkit-background-clip: text; background-clip: text; color: transparent;
}
@media (forced-colors: active) { .wf-logo-word b { color: CanvasText; background: none; } }
.wf-logo--lg .wf-logo-mark { width: 40px; height: 40px; border-radius: 11px; }
.wf-logo--lg .wf-logo-mark svg { width: 24px; height: 24px; }
.wf-logo--lg .wf-logo-word { font-size: 1.5rem; }

/* ---------- 4. Buttons ---------- */
/* calm: one filled brand button per screen, soft tinted secondary, 12px radius (.btn--pill = round ends) */
.btn {
  --btn-h: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: var(--btn-h);
  padding: 0 var(--sp-5);
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease),
              color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease), transform var(--dur-1) var(--ease);
}
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn:active { transform: scale(0.98); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn .fa-solid { font-size: 15px; width: 18px; text-align: center; line-height: 1; flex: none; }

.btn--primary { background: var(--brand-solid); color: var(--on-brand); }
.btn--primary:hover { background: var(--brand-solid-hover); }
/* secondary: soft brand tint, no outline */
.btn--secondary { background: var(--brand-softer); color: var(--brand); }
.btn--secondary:hover { background: var(--brand-soft); }
.btn--outline { background: transparent; color: var(--brand); border-color: var(--border-strong); }
.btn--outline:hover { background: var(--brand-softer); border-color: var(--brand); }
.btn--ghost { background: transparent; color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }
.btn--danger { background: transparent; color: var(--danger); border-color: var(--danger-border); }
.btn--danger:hover { background: var(--danger-soft); }
.btn--sm { --btn-h: 36px; padding: 0 var(--sp-4); font-size: var(--fs-sm); }
.btn--lg { --btn-h: 52px; padding: 0 var(--sp-6); font-size: var(--fs-md); border-radius: 14px; }
.btn--pill { border-radius: var(--r-pill); }
.btn--block { width: 100%; }

.icon-btn {
  width: 40px; height: 40px; flex: none;
  display: inline-grid; place-items: center;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.icon-btn .fa-solid { font-size: 16px; width: 18px; text-align: center; line-height: 1; }

/* text link with a small chevron pointing "forward" (‹ in RTL): <a class="text-link">לכל התנועות</a> */
.text-link {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; background: none; padding: 0;
  color: var(--brand); font-size: var(--fs-sm); font-weight: var(--fw-semibold);
  text-decoration: none; cursor: pointer;
}
.text-link::after {
  content: ""; width: 6px; height: 6px; flex: none;
  border-left: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg); border-radius: 1px; margin-top: 1px;
}
.text-link:hover { text-decoration: underline; text-decoration-thickness: 1px; }

/* theme toggle – shows the icon of the theme you'd switch to (dark is the default → sun) */
.theme-toggle-btn .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle-btn .icon-moon { display: block; }
:root[data-theme="light"] .theme-toggle-btn .icon-sun { display: none; }

/* spinner */
.spinner {
  width: 18px; height: 18px; flex: none;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-inline-end-color: transparent;
  animation: wf-spin 0.8s linear infinite;
}
@keyframes wf-spin { to { transform: rotate(360deg); } }

/* ---------- 5. Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text-2); }
.label .opt { color: var(--text-muted); font-weight: var(--fw-regular); }
.hint { font-size: var(--fs-xs); color: var(--text-muted); line-height: 1.5; }

.input, .select {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: var(--fs-md); /* 16px: no iOS zoom */
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease), background-color var(--dur-1) var(--ease);
}
.input::placeholder { color: var(--text-muted); opacity: 0.75; }
.input:hover, .select:hover { border-color: var(--border-strong); }
.input:focus, .select:focus { outline: none; border-color: var(--brand); background-color: var(--surface); box-shadow: var(--focus-ring); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input--ltr { direction: ltr; text-align: start; }
.input--ltr::placeholder { text-align: right; }

.select {
  appearance: none;
  -webkit-appearance: none;
  padding-inline-end: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239BA3A8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
}
:root[data-theme="light"] .select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2355616A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
.select option { background: var(--surface-raised); color: var(--text); }

.input-wrap { position: relative; }
.input-wrap .input { padding-inline-end: 48px; }
/* LTR inputs (email/password) inside an RTL wrap: the action button sits on the physical left */
.input-wrap .input--ltr { padding-inline-end: 14px; padding-left: 48px; }
.input-wrap .input-action {
  position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%);
  width: 40px; height: 38px; border: 0; background: transparent;
  border-radius: var(--r-sm); color: var(--text-muted);
  display: grid; place-items: center;
}
.input-wrap .input-action:hover { color: var(--text); background: var(--surface-3); }
.input-wrap .input-action:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.input-wrap .input-action .fa-solid { font-size: 16px; width: 18px; text-align: center; line-height: 1; }

/* ---------- 6. Card ---------- */
/* one white card per idea: 20px radius, no border, very soft shadow (dark: lifted surface, no shadow) */
.card {
  background: var(--surface);
  border: 0;
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
}
.card-pad { padding: var(--sp-5); }
.card-title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); }
.card-sub { font-size: var(--fs-sm); color: var(--text-muted); }
@media (max-width: 760px) { .card-pad { padding: var(--sp-4); } }

/* ---------- 7. Badge / tag / chip ---------- */
/* badges are quiet: only where they carry meaning */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 22px; padding: 1px 9px;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: var(--fw-medium);
  background: var(--surface-2); color: var(--text-2);
  white-space: nowrap;
}
.badge .fa-solid { font-size: 12px; width: 13px; text-align: center; line-height: 1; }
.badge--brand { background: var(--brand-softer); color: var(--brand); }
.badge--positive { background: var(--positive-soft); color: var(--positive); }
.badge--warning { background: var(--warning-soft); color: var(--warning); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* chips: filter / pick one of many. <div class="chip-row"><button class="chip" aria-pressed="true">…</button></div>
   the row scrolls sideways on narrow screens */
.chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: none;
  min-height: 36px; padding: 0 14px;
  border: 1px solid transparent; border-radius: var(--r-pill);
  background: var(--surface-2); color: var(--text-2);
  font-size: var(--fs-sm); font-weight: var(--fw-medium); white-space: nowrap;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: background-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.chip:hover { background: var(--surface-3); color: var(--text); }
.chip:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.chip[aria-pressed="true"], .chip[aria-selected="true"], .chip.active {
  background: var(--brand-soft); color: var(--brand); font-weight: var(--fw-semibold);
}
.chip .seg-count, .chip .chip-count { font-size: var(--fs-xs); opacity: 0.8; }
.chip-row {
  display: flex; gap: var(--sp-2); align-items: center;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  padding-block: 2px;
}
.chip-row::-webkit-scrollbar { display: none; }

/* ---------- 8. Alert ---------- */
.alert {
  display: flex; gap: var(--sp-3); align-items: flex-start;
  padding: var(--sp-3) var(--sp-4);
  border-radius: 14px;
  border: 0;
  background: var(--surface-2);
  color: var(--text);
  font-size: var(--fs-sm);
  line-height: 1.5;
}
.alert > .fa-solid { font-size: 16px; width: 18px; text-align: center; line-height: 1; flex: none; margin-top: 2px; }
.alert-title { font-weight: var(--fw-semibold); }
.alert--info { background: var(--brand-softer); }
.alert--info > .fa-solid { color: var(--brand); }
.alert--success { background: var(--positive-soft); }
.alert--success > .fa-solid { color: var(--positive); }
.alert--warning { background: var(--warning-soft); }
.alert--warning > .fa-solid { color: var(--warning); }
.alert--danger { background: var(--danger-soft); }
.alert--danger > .fa-solid { color: var(--danger); }
.alert:empty { display: none; }
.alert[hidden] { display: none; }

/* ---------- 9. Top tabs (rounded underline) & segmented control ---------- */
/* <div class="tabs" role="tablist"><button class="tabs-item" role="tab" aria-selected="true">הוצאות</button>…</div>
   (the phone bottom navigation is .tabbar – a different component, see mobile.css) */
.tabs {
  display: flex; gap: var(--sp-1);
  border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs-item {
  position: relative; flex: none;
  min-height: 44px; padding: var(--sp-2) var(--sp-4);
  border: 0; background: transparent;
  font-size: var(--fs-md); font-weight: var(--fw-medium);
  color: var(--text-muted); white-space: nowrap;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: color var(--dur-1) var(--ease);
}
.tabs-item:hover { color: var(--text); }
.tabs-item:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--brand-ring); border-radius: var(--r-sm); }
.tabs-item[aria-selected="true"], .tabs-item.active { color: var(--brand); font-weight: var(--fw-semibold); }
.tabs-item::after {
  content: ""; position: absolute; inset-inline: var(--sp-3); bottom: -1px; height: 3px;
  border-radius: 3px 3px 0 0; background: var(--brand);
  transform: scaleX(0); transition: transform var(--dur-2) var(--ease);
}
.tabs-item[aria-selected="true"]::after, .tabs-item.active::after { transform: none; }

/* segmented: a soft pill track with a white thumb under the chosen option.
   .segmented – the thumb is painted on the chosen button;
   .seg – same look, the thumb SLIDES between options (2–5 equal options; pure CSS via :has) */
.segmented, .seg {
  --seg-track: color-mix(in srgb, var(--text) 6%, var(--surface));
  --seg-thumb: var(--surface);
  display: inline-flex; padding: 4px; gap: 2px;
  border-radius: var(--r-pill); background: var(--seg-track); border: 0;
}
:root:not([data-theme="light"]) .segmented, :root:not([data-theme="light"]) .seg {
  --seg-track: var(--surface-2); --seg-thumb: var(--surface-3);
}
.segmented > *, .seg > * {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; border: 0; background: transparent; padding: 0 16px;
  border-radius: var(--r-pill); font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text-muted);
  white-space: nowrap; text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: color var(--dur-2) var(--ease), background-color var(--dur-2) var(--ease);
}
.segmented > *:hover, .seg > *:hover { color: var(--text); }
.segmented > *:focus-visible, .seg > *:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--brand-ring); }
.segmented > [aria-pressed="true"], .segmented > [aria-selected="true"], .segmented > [aria-current="page"], .segmented > .active {
  background: var(--seg-thumb); color: var(--text); font-weight: var(--fw-semibold);
  box-shadow: 0 1px 2px rgba(16, 38, 48, 0.08), 0 2px 8px rgba(16, 38, 48, 0.06);
}
:root:not([data-theme="light"]) .segmented > :is([aria-pressed="true"], [aria-selected="true"], [aria-current="page"], .active) { box-shadow: none; }

.seg {
  --n: 2; --i: 0;
  position: relative; isolation: isolate;
  display: inline-grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0;
}
.seg::before {
  content: ""; position: absolute; z-index: -1; top: 4px; bottom: 4px;
  width: calc((100% - 8px) / var(--n));
  inset-inline-start: calc(4px + var(--i) * (100% - 8px) / var(--n));
  border-radius: var(--r-pill); background: var(--seg-thumb);
  box-shadow: 0 1px 2px rgba(16, 38, 48, 0.08), 0 2px 8px rgba(16, 38, 48, 0.06);
  transition: inset-inline-start var(--dur-3) var(--ease);
}
:root:not([data-theme="light"]) .seg::before { box-shadow: none; }
.seg:has(> :nth-child(3):last-child) { --n: 3; }
.seg:has(> :nth-child(4):last-child) { --n: 4; }
.seg:has(> :nth-child(5):last-child) { --n: 5; }
.seg:has(> :nth-child(2):is([aria-pressed="true"], [aria-selected="true"], [aria-current="page"], .active)) { --i: 1; }
.seg:has(> :nth-child(3):is([aria-pressed="true"], [aria-selected="true"], [aria-current="page"], .active)) { --i: 2; }
.seg:has(> :nth-child(4):is([aria-pressed="true"], [aria-selected="true"], [aria-current="page"], .active)) { --i: 3; }
.seg:has(> :nth-child(5):is([aria-pressed="true"], [aria-selected="true"], [aria-current="page"], .active)) { --i: 4; }
.seg:not(:has(> :is([aria-pressed="true"], [aria-selected="true"], [aria-current="page"], .active)))::before { opacity: 0; }
.seg > :is([aria-pressed="true"], [aria-selected="true"], [aria-current="page"], .active) { color: var(--text); font-weight: var(--fw-semibold); }
/* browsers without :has – paint the thumb on the button itself */
@supports not selector(:has(*)) {
  .seg::before { display: none; }
  .seg > :is([aria-pressed="true"], [aria-selected="true"], .active) { background: var(--seg-thumb); }
}
.seg--block, .segmented--block { display: grid; width: 100%; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }

/* chips inside a .segmented container (the transaction filter) keep the chip look */
.segmented.chip-row { padding: 2px 0; gap: var(--sp-2); background: transparent; border-radius: 0; }
.segmented.chip-row > .chip { min-height: 36px; padding: 0 14px; background: var(--surface-2); color: var(--text-2); box-shadow: none; font-weight: var(--fw-medium); }
.segmented.chip-row > .chip:hover { background: var(--surface-3); color: var(--text); }
.segmented.chip-row > .chip:is([aria-pressed="true"], .active) { background: var(--brand-soft); color: var(--brand); font-weight: var(--fw-semibold); }

/* ---------- 10. Table ---------- */
/* airy: rows ≥52px, hairline separators, no zebra, small muted header without a fill */
.table-wf { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table-wf th {
  text-align: start; font-weight: var(--fw-medium); font-size: var(--fs-xs);
  color: var(--text-muted); padding: 10px 14px;
  background: transparent; border-bottom: 1px solid var(--border);
}
.table-wf td { height: 52px; padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--text); }
.table-wf tr:last-child td { border-bottom: 0; }
.table-wf tbody tr:hover td { background: color-mix(in srgb, var(--text) 3%, transparent); }
.table-wf td.num, .table-wf th.num { text-align: end; }

/* ---------- 11. Modal (phone: bottom sheet) ---------- */
.modal-scrim {
  position: fixed; inset: 0; z-index: var(--z-modal);
  background: var(--scrim);
  display: grid; place-items: center; padding: var(--sp-4);
}
.modal {
  width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  background: var(--surface-raised); border: 0;
  border-radius: 24px; box-shadow: var(--shadow-lg); padding: var(--sp-6);
}
:root:not([data-theme="light"]) .modal { border: 1px solid var(--border); }
@media (max-width: 760px) {
  .modal-scrim { place-items: end stretch; padding: 0; }
  .modal-scrim > .modal {
    width: 100%; max-height: 92vh; max-height: 92dvh;
    border-radius: 24px 24px 0 0; border-width: 1px 0 0;
    padding: var(--sp-3) var(--sp-4) calc(var(--sp-5) + env(safe-area-inset-bottom));
    animation: wf-sheet-up var(--dur-3) var(--ease);
  }
  /* grabber */
  .modal-scrim > .modal::before {
    content: ""; display: block; flex: none; align-self: center;
    width: 40px; height: 4px; margin: 0 auto var(--sp-1); border-radius: 4px;
    background: var(--border-strong);
  }
}
@keyframes wf-sheet-up { from { transform: translateY(40px); opacity: 0.4; } }

/* ---------- 12. Toast ---------- */
/* a quiet dark "snackbar", centred above the content (phone: above the tab bar) */
.toast-region {
  position: fixed; z-index: var(--z-toast);
  left: 50%; transform: translateX(-50%); bottom: var(--sp-6);
  width: max-content; max-width: calc(100vw - 32px);
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2);
}
.toast {
  --toast-bg: #1D2A30;
  display: flex; align-items: center; gap: var(--sp-3);
  min-width: 260px; max-width: 420px;
  padding: 12px var(--sp-4);
  border-radius: 14px;
  background: var(--toast-bg); color: #FFFFFF;
  border: 0;
  box-shadow: 0 10px 30px -8px rgba(10, 20, 26, 0.35);
  font-size: var(--fs-sm); font-weight: var(--fw-medium);
}
:root:not([data-theme="light"]) .toast { --toast-bg: #2E3438; box-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.6); }
.toast--success { --toast-c: #5EE0B0; }
.toast--error { --toast-c: #FF8A9C; }
.toast--info { --toast-c: #7FDDE4; }
.toast .toast-icon { color: var(--toast-c, #7FDDE4); }
.toast .toast-close { color: #FFFFFF; }
.toast .toast-close:hover { background: rgba(255, 255, 255, 0.12); }

/* ---------- 13. Skeleton / empty state / progress ---------- */
/* skeleton shimmer – match the final layout: <span class="skel skel-line" style="width:40%"></span>
   .skel (block, 12px radius) · .skel-line (text line) · .skel-circle (icon) · .skel-card (whole card) */
.skel, .skeleton {
  display: block; position: relative; overflow: hidden;
  border-radius: var(--r-md);
  background: var(--surface-2);
  min-height: 12px;
}
.skel::after, .skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 70%, transparent), transparent);
  transform: translateX(-100%);
  animation: wf-shimmer 1.4s ease-in-out infinite;
}
:root:not([data-theme="light"]) .skel::after, :root:not([data-theme="light"]) .skeleton::after {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
}
.skel-line { height: 12px; min-height: 0; border-radius: 6px; }
.skel-line + .skel-line { margin-top: 10px; }
.skel-title { height: 18px; width: 45%; border-radius: 8px; }
.skel-amt { height: 40px; width: 55%; border-radius: 10px; }
.skel-circle { width: 40px; height: 40px; border-radius: 50%; flex: none; }
.skel-card { min-height: 140px; border-radius: var(--r-card); }
.skel-row { display: flex; align-items: center; gap: var(--sp-3); min-height: var(--row-h); }
.skel-row > .skel-line { flex: 1; margin: 0; }
@keyframes wf-shimmer { to { transform: translateX(100%); } }

/* friendly empty state: icon in a soft circle, one sentence, one action
   <div class="empty"><span class="empty-icon"><i class="fa-solid fa-receipt"></i></span>
   <p class="empty-title">אין עדיין תנועות החודש</p><p class="empty-text">…</p><button class="btn btn--secondary">…</button></div> */
.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 6px; padding: var(--sp-10) var(--sp-4);
}
.empty--compact { padding: var(--sp-6) var(--sp-3); }
.empty-icon {
  width: 56px; height: 56px; margin-bottom: var(--sp-2); flex: none;
  border-radius: 50%; display: grid; place-items: center;
  background: var(--brand-softer); color: var(--brand);
}
.empty-icon .fa-solid { font-size: 22px; width: 24px; text-align: center; line-height: 1; }
.empty-title { font-weight: var(--fw-semibold); color: var(--text); font-size: var(--fs-md); }
.empty-text { max-width: 42ch; font-size: var(--fs-sm); color: var(--text-muted); }
.empty > .btn { margin-top: var(--sp-3); }

.progress {
  position: relative; height: 8px; border-radius: var(--r-pill);
  background: var(--track); overflow: hidden;
}
.progress > span {
  position: absolute; inset-block: 0; inset-inline-start: 0;
  border-radius: inherit; background: var(--brand-solid);
  transition: width var(--dur-3) var(--ease);
}
.progress--indeterminate > span {
  width: 35%;
  animation: wf-indeterminate 1.6s var(--ease) infinite;
}
@keyframes wf-indeterminate {
  from { inset-inline-start: -35%; }
  to { inset-inline-start: 100%; }
}

/* ---------- 14. Provider logo tile ---------- */
/* Bank logos ship in very different shapes (full-bleed icons, wordmarks,
   padded squares). One tile normalizes them: same size, same radius,
   per-provider fit. */
.provider-logo {
  --size: 44px;
  width: var(--size); height: var(--size); flex: none;
  border-radius: calc(var(--size) * 0.26);
  overflow: hidden;
  background: var(--logo-tile);
  box-shadow: inset 0 0 0 1px rgba(17, 26, 31, 0.08);
  display: grid; place-items: center;
  position: relative;
}
.provider-logo img { width: 100%; height: 100%; object-fit: cover; }
.provider-logo[data-provider="isracard"] img,
.provider-logo[data-provider="max"] img { object-fit: contain; padding: 3px; }
.provider-logo[data-provider="mizrahi"] img { transform: scale(1.75); }
.provider-logo[data-provider="benleumi"] { background: #142A60; }
.provider-logo[data-provider="benleumi"] img { object-fit: contain; transform: scale(1.5); }
.provider-logo[data-provider="hapoalim"] img { transform: scale(1.15); }
.provider-logo--sm { --size: 32px; }
.provider-logo--lg { --size: 56px; }

/* ---------- 15. Site header (marketing / auth / bank) ---------- */
.site-header {
  position: sticky; top: 0; z-index: var(--z-header);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
  transition: border-color var(--dur-2) var(--ease), background-color var(--dur-2) var(--ease);
}
.site-header.is-scrolled { border-bottom-color: var(--border-strong); }
.site-header-inner {
  height: var(--header-h);
  display: flex; align-items: center; gap: var(--sp-6);
}
.site-nav { display: flex; align-items: center; gap: var(--sp-1); }
.site-nav a {
  padding: 8px 12px; border-radius: var(--r-sm);
  color: var(--text-2); text-decoration: none; font-size: var(--fs-sm); font-weight: var(--fw-medium);
}
.site-nav a:hover { color: var(--text); background: var(--surface-2); }
.site-header-actions { margin-inline-start: auto; display: flex; align-items: center; gap: var(--sp-2); }

/* ---------- 16. Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .spinner, .progress--indeterminate > span { animation: none !important; }
  .progress--indeterminate > span { width: 100%; opacity: 0.5; inset-inline-start: 0; }
}

/* "install the app" buttons (pwa.js) stay out of the layout until the browser allows installing */
[data-install-app][hidden] { display: none !important; }
