/*
 * style.css — «החשבון שלי» V2
 *
 * A bright, quiet surface with one accent and a strict hierarchy: one hero
 * figure per card, everything else subordinate to it. No chart library, no
 * gradients on data, no pie charts — proportion is shown with a plain bar,
 * because a bar can be read at a glance and a pie of eleven slices cannot.
 *
 * Two rules here are load-bearing rather than decorative:
 *
 *   1. `.block--credit` is styled as a DETACHED block, never as a row in the
 *      money column above it. A credit limit is not money (CLAUDE.md §3.1), and
 *      a reader who meets borrowed headroom at the same visual weight as their
 *      own balance will add the two.
 *
 *   2. `.is-estimate` is visually weaker than `.is-certain` everywhere. A
 *      forecast rendered at the same weight as a bank balance is a forecast that
 *      will be quoted as a fact.
 */

/* ── Tokens ─────────────────────────────────────────────────────────────── */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --ink: #0f172a;
  --ink-2: #475467;
  --ink-3: #98a2b3;
  --line: #eceef2;
  --line-2: #e2e5ea;

  --accent: #2f5bea;
  --accent-soft: #eef2fe;
  --pos: #067647;
  --pos-soft: #ecfdf3;
  --neg: #b42318;
  --neg-soft: #fef3f2;
  --warn: #b54708;
  --warn-soft: #fffaeb;

  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;

  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px -12px rgba(16, 24, 40, .12);
  --shadow-lift: 0 2px 4px rgba(16, 24, 40, .05), 0 16px 32px -16px rgba(16, 24, 40, .2);

  --tabbar-h: 62px;
  --font: "Segoe UI", "Rubik", "Assistant", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

/*
 * The horizontal axis is closed at the shell.
 *
 * `overflow-x: hidden` is the usual spelling and it is declared first, so an
 * engine that knows only that word still gets the clip. It is then overridden
 * with `clip`, and the difference is load-bearing rather than pedantic: `hidden`
 * makes the box a SCROLL CONTAINER, and a scroll container on `body` is the
 * nearest scrollport for everything inside it — which silently kills
 * `position: sticky` on `.topbar`, since body's own box never scrolls. `clip`
 * is the one value that refuses the overflow without claiming the scroll, so
 * the header keeps sticking and the page still cannot be dragged sideways.
 *
 * This is a backstop and not the fix. Every rule below that could push a box
 * past the viewport — a bare `1fr` track, a flex item with no `min-width`, a
 * pill strip — is corrected at its own site, because a clip that is doing real
 * work is a layout bug that has been made invisible rather than solved.
 */
html, body {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  overflow-x: clip;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { overscroll-behavior-y: none; }

button, input, select { font: inherit; color: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ── Lock ───────────────────────────────────────────────────────────────── */

.lock {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  /* Insets, not a flat 24px: on a notched phone the card otherwise starts under
     the status bar and ends under the home indicator. */
  padding: max(24px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right))
           max(24px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  overflow-y: auto;
  background: radial-gradient(120% 90% at 50% 0%, #ffffff 0%, #eef1f6 60%, #e6eaf1 100%);
}
.lock[hidden] { display: none; }

.lock__card {
  width: 100%; max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow-lift);
  padding: 32px 26px 24px;
  text-align: center;
}
.lock__mark { display: flex; justify-content: center; margin-bottom: 16px; }
.lock__mark img { border-radius: 14px; }
.lock__title { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: -.01em; }
.lock__sub { margin: 6px 0 22px; font-size: 14px; color: var(--ink-2); }

.lock__form { display: flex; flex-direction: column; gap: 10px; }
.lock__pin {
  width: 100%; padding: 14px 16px;
  border: 1px solid var(--line-2); border-radius: var(--r-md);
  background: var(--surface-2);
  font-size: 20px; letter-spacing: .3em; text-align: center;
  outline: none;
}
.lock__pin:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 4px var(--accent-soft); }

.lock__go {
  min-height: 44px;
  padding: 13px 16px; border: 0; border-radius: var(--r-md);
  background: var(--accent); color: #fff; font-weight: 600; font-size: 15px;
  cursor: pointer;
}
.lock__go:disabled { opacity: .55; cursor: progress; }

/*
 * Biometric unlock — the primary action when it is available.
 *
 * It sits ABOVE the code field and is weighted like the main button, because on
 * a phone it is the path that gets used; the field below it is the fallback and
 * the way in on a device with no enrolment. It is `hidden` until app.js has
 * confirmed both a platform authenticator and a stored enrolment.
 */
.lock__bio {
  width: 100%; min-height: 52px;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  margin-bottom: 14px; padding: 14px 16px;
  border: 1px solid #d5deff; border-radius: var(--r-md);
  background: var(--accent-soft); color: var(--accent);
  font-size: 15px; font-weight: 620; cursor: pointer;
}
.lock__bio[hidden] { display: none; }
.lock__bio:disabled { opacity: .6; cursor: progress; }
.lock__bio svg {
  width: 24px; height: 24px; fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}

.lock__error {
  margin: 14px 0 0; padding: 10px 12px; border-radius: var(--r-sm);
  background: var(--neg-soft); color: var(--neg); font-size: 13px;
}
.lock__hint { margin: 12px 0 0; font-size: 12px; color: var(--ink-2); }
.lock__hint[hidden] { display: none; }
.lock__meta { margin: 16px 0 0; font-size: 12px; color: var(--ink-3); line-height: 1.7; }
.lock__note { margin: 14px 0 0; font-size: 11px; color: var(--ink-3); }

/* ── Biometric panel ────────────────────────────────────────────────────── */

.bio { display: grid; gap: 12px; }
.bio__body { margin: 0; font-size: 13.5px; line-height: 1.65; color: var(--ink-2); }
.bio__note {
  margin: 0; padding: 10px 12px; border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--ink-3); font-size: 12px; line-height: 1.6;
}
.bio__note--ok { background: var(--pos-soft); color: var(--pos); }
.bio__note--warn { background: var(--warn-soft); color: var(--warn); }
.bio__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.bio__btn {
  flex: 1 1 auto; min-height: 44px; padding: 12px 16px;
  border: 0; border-radius: var(--r-md);
  background: var(--accent); color: #fff; font-size: 14.5px; font-weight: 620;
  cursor: pointer;
}
.bio__btn:disabled { opacity: .6; cursor: progress; }
.bio__btn--ghost { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line-2); }

/* ── Shell ──────────────────────────────────────────────────────────────── */

.app[hidden] { display: none; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
  padding: max(10px, env(safe-area-inset-top)) 16px 10px;
}
.topbar__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.topbar__greet { min-width: 0; }
.topbar__hello { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.freshness {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 3px; padding: 0; border: 0; background: none;
  font-size: 12px; color: var(--ink-2); cursor: pointer;
}
.freshness__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.freshness__dot.is-fresh { background: var(--pos); }
.freshness__dot.is-stale { background: var(--warn); }

.topbar__actions { display: flex; flex: none; gap: 6px; }
.iconbtn {
  position: relative;
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
/*
 * The hit area is 44px; the drawn box stays 38px.
 *
 * Four header buttons at a real 44px each would push the greeting off a 360px
 * phone, so the target is grown with a transparent overlay instead of with the
 * border. MOBILE_RULES.minTouchTargetPx is about the finger, not the paint.
 */
.iconbtn::after {
  content: ''; position: absolute;
  top: 50%; inset-inline-start: 50%;
  transform: translate(50%, -50%);
  width: 44px; height: 44px;
}
.iconbtn[hidden] { display: none; }
.iconbtn:hover { background: var(--surface-2); }
.iconbtn svg { width: 19px; height: 19px; fill: none; stroke: var(--ink-2); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.iconbtn[aria-pressed="true"] { background: var(--accent-soft); border-color: #d5deff; }
.iconbtn[aria-pressed="true"] svg { stroke: var(--accent); }
.iconbtn.is-spinning svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(-360deg); } }

.iconbtn__badge {
  position: absolute; top: -5px; inset-inline-start: -5px;
  min-width: 17px; height: 17px; padding: 0 4px;
  display: grid; place-items: center;
  border-radius: 9px; background: var(--warn); color: #fff;
  font-size: 10px; font-weight: 700;
}

.sheet {
  margin-top: 12px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface-2);
}
.sheet__title { margin: 0 0 8px; font-size: 12px; font-weight: 650; color: var(--ink-2); }
.sheet__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sheet__list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; font-size: 12.5px; }
.sheet__list li > * { min-width: 0; overflow-wrap: anywhere; }
.sheet__list span:last-child { color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ── Screens ────────────────────────────────────────────────────────────── */

.screens {
  width: 100%; max-width: 100%; overflow-x: clip;
  padding: 14px 14px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 22px);
}
.screen[hidden] { display: none; }
/* One column on a phone, and the single column is `minmax(0, 1fr)` for the same
   reason every other track in this file is: the default `auto` minimum would let
   one wide card set the width of the screen. */
.screen {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px;
  width: 100%; max-width: 100%; margin: 0 auto;
}

/* ── Card ───────────────────────────────────────────────────────────────── */

/*
 * A card is always the full width of its column and never wider. The explicit
 * `min-width: 0` is for the grid parent: `.screen` is a grid, and a grid item
 * defaults to a minimum of its own content size, so one long merchant name deep
 * inside a card could otherwise widen the card, the screen and the document.
 */
.card {
  width: 100%; max-width: 100%; min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 16px;
}
.card__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 10px; margin-bottom: 14px; }
.card__title { min-width: 0; margin: 0; font-size: 14px; font-weight: 650; color: var(--ink); letter-spacing: -.005em; overflow-wrap: anywhere; }
.card__meta { min-width: 0; font-size: 11.5px; color: var(--ink-3); overflow-wrap: anywhere; }
.card__note {
  margin: 14px 0 0; padding-top: 12px; border-top: 1px dashed var(--line-2);
  font-size: 11.5px; line-height: 1.6; color: var(--ink-3);
}

/* Hero figure — one per card, and nothing else at this weight. */
.hero { display: grid; gap: 4px; min-width: 0; }
.hero__label { font-size: 12.5px; color: var(--ink-2); overflow-wrap: anywhere; }
/* 34px is the largest type in the app, so it is also the first thing to run out
   of room: a seven-figure balance on a 320px phone needs more than the card has.
   It wraps instead of widening the card. */
.hero__value {
  font-size: 34px; font-weight: 680; letter-spacing: -.025em; line-height: 1.1;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.hero__value.is-neg { color: var(--neg); }
.hero__sub { font-size: 12px; color: var(--ink-3); overflow-wrap: anywhere; }

/* ── Rows ───────────────────────────────────────────────────────────────── */

.rows { display: grid; gap: 2px; margin-top: 16px; }
.row {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 8px; margin: 0 -8px;
  border: 0; border-radius: var(--r-sm); background: none;
  text-align: start; cursor: pointer;
  transition: background .12s ease;
}
.row:hover { background: var(--surface-2); }
.row:active { background: var(--line); }
.row__main { flex: 1; min-width: 0; }
.row__label { display: block; font-size: 13.5px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__sub { display: block; margin-top: 2px; font-size: 11px; color: var(--ink-3); }
.row__value { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row__value.is-neg { color: var(--neg); }
.row__value.is-pos { color: var(--pos); }
.row__chev { width: 14px; height: 14px; flex: none; fill: none; stroke: var(--ink-3); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* A row that is not a button must not claim to be one. */
.row--static { cursor: default; }
.row--static:hover { background: none; }

.row--total {
  margin-top: 6px; padding-top: 14px;
  border-top: 1px solid var(--line-2); border-radius: 0;
}
.row--total .row__label { font-weight: 650; }
.row--total .row__value { font-size: 17px; font-weight: 680; }

/* ── Detached credit block ──────────────────────────────────────────────── */

/*
 * Deliberately separated from the money above by a gap, a different surface and
 * its own heading. It is not a row in the column — see the header note.
 */
.block--credit {
  margin-top: 18px; padding: 14px;
  border: 1px dashed var(--line-2); border-radius: var(--r-md);
  background: var(--surface-2);
}
.block__title { display: flex; align-items: center; gap: 7px; margin: 0 0 10px; font-size: 12.5px; font-weight: 650; color: var(--ink-2); }
.block__tag {
  padding: 2px 7px; border-radius: 999px;
  background: #fff; border: 1px solid var(--line-2);
  font-size: 10px; font-weight: 600; color: var(--ink-3);
}
/*
 * `minmax(0, 1fr)`, and never a bare `1fr` — the single biggest cause of the
 * sideways drag this file used to have.
 *
 * A bare `1fr` is `minmax(auto, 1fr)`, and `auto` as a MINIMUM is the track's
 * content size: the column refuses to shrink below the longest thing in it. On
 * a 360px phone this grid gets roughly 82px per cell and «12,345.67 ₪» at 15px
 * needs about 90px, so the grid quietly grew wider than the card, the card grew
 * wider than the screen, and the whole page could be pulled sideways. Every
 * multi-column track in this file is therefore written with an explicit `0`
 * minimum, so the overflow lands inside the cell where it can be ellipsised or
 * wrapped, not on the document.
 */
.block__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.block__cell { display: grid; gap: 3px; min-width: 0; }
.block__cell dt { font-size: 11px; color: var(--ink-3); overflow-wrap: anywhere; }
.block__cell dd { margin: 0; font-size: 15px; font-weight: 620; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* ── Confidence & tags ──────────────────────────────────────────────────── */

.tag {
  display: inline-block; padding: 2px 7px; border-radius: 999px;
  font-size: 10px; font-weight: 600; line-height: 1.5;
  border: 1px solid transparent; white-space: nowrap;
}
.tag--data { background: var(--pos-soft); color: var(--pos); }
.tag--derived { background: var(--accent-soft); color: var(--accent); }
.tag--inferred { background: var(--warn-soft); color: var(--warn); }
.tag--muted { background: var(--surface-2); color: var(--ink-3); border-color: var(--line-2); }

/* ── Forecast range ─────────────────────────────────────────────────────── */

.forecast { display: grid; gap: 16px; }
.forecast__split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.forecast__cell { padding: 12px; border-radius: var(--r-md); min-width: 0; }
.forecast__cell.is-certain { background: var(--accent-soft); }
.forecast__cell.is-estimate { background: var(--surface-2); border: 1px dashed var(--line-2); }
.forecast__cell dt { font-size: 11px; color: var(--ink-2); overflow-wrap: anywhere; }
.forecast__cell dd { margin: 4px 0 0; font-size: 19px; font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.forecast__cell.is-estimate dd { color: var(--ink-2); }

.band { margin-top: 4px; }
.band__track { position: relative; height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.band__fill { position: absolute; top: 0; bottom: 0; background: linear-gradient(90deg, #cbd6ff, var(--accent)); border-radius: 999px; }
.band__labels { display: flex; flex-wrap: wrap; gap: 6px; justify-content: space-between; margin-top: 8px; font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.band__labels > * { min-width: 0; }
.band__labels b { font-weight: 650; color: var(--ink); }

/* ── Timeline ───────────────────────────────────────────────────────────── */

.timeline { display: grid; gap: 0; margin-top: 4px; }
.tl {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  width: 100%; padding: 11px 8px; margin: 0 -8px;
  border: 0; background: none; text-align: start; cursor: pointer;
  border-radius: var(--r-sm);
  position: relative;
}
.tl:hover { background: var(--surface-2); }
.tl + .tl::before {
  content: ""; position: absolute; top: 0; inset-inline: 8px;
  border-top: 1px solid var(--line);
}
.tl__date { text-align: center; }
.tl__day { display: block; font-size: 15px; font-weight: 650; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tl__mon { display: block; font-size: 10px; color: var(--ink-3); }
.tl__label { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl__kind { display: block; margin-top: 2px; font-size: 11px; color: var(--ink-3); }
.tl__amount { font-size: 14px; font-weight: 620; font-variant-numeric: tabular-nums; }
.tl__amount.is-neg { color: var(--neg); }
.tl__amount.is-pos { color: var(--pos); }

.lowpoint {
  margin-top: 16px; padding: 13px 14px;
  border-radius: var(--r-md); background: var(--warn-soft);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
}
.lowpoint > * { min-width: 0; }
.lowpoint.is-safe { background: var(--pos-soft); }
.lowpoint__label { font-size: 12px; color: var(--ink-2); }
.lowpoint__date { display: block; margin-top: 2px; font-size: 11px; color: var(--ink-3); }
.lowpoint__value { font-size: 19px; font-weight: 680; font-variant-numeric: tabular-nums; }

/* ── In vs out ──────────────────────────────────────────────────────────── */

.flow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.flow__cell { min-width: 0; padding: 13px; border-radius: var(--r-md); background: var(--surface-2); cursor: pointer; border: 1px solid var(--line); text-align: start; }
.flow__cell:hover { border-color: var(--line-2); }
.flow__k { font-size: 11.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.flow__v { margin-top: 5px; font-size: 21px; font-weight: 660; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.flow__v.is-pos { color: var(--pos); }
.flow__v.is-neg { color: var(--neg); }
.flow__proj { margin-top: 4px; font-size: 11px; color: var(--ink-3); }

/* ── Category bars ──────────────────────────────────────────────────────── */

.bars { display: grid; gap: 12px; margin-top: 4px; }
.bar { width: 100%; padding: 0; border: 0; background: none; text-align: start; cursor: pointer; }
.bar__top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.bar__label { min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar__nums { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar__nums b { font-weight: 650; color: var(--ink); }
.bar__track { height: 7px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar__fill { height: 100%; border-radius: 999px; background: var(--accent); opacity: .9; }
.bar:nth-child(2) .bar__fill { opacity: .78; }
.bar:nth-child(3) .bar__fill { opacity: .66; }
.bar:nth-child(4) .bar__fill { opacity: .54; }
.bar:nth-child(5) .bar__fill { opacity: .44; }
.bar:nth-child(n+6) .bar__fill { opacity: .34; }

/* ── Commitment groups ──────────────────────────────────────────────────── */

.group { border-top: 1px solid var(--line); }
.group:first-of-type { border-top: 0; }
.group__head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; padding: 12px 8px; margin: 0 -8px;
  border: 0; background: none; cursor: pointer; text-align: start;
}
.group__head > * { min-width: 0; }
.group__name { overflow-wrap: anywhere; }
.group__head:hover { background: var(--surface-2); border-radius: var(--r-sm); }
.group__name { font-size: 13.5px; font-weight: 600; }
.group__count { margin-inline-start: 6px; font-size: 11px; color: var(--ink-3); font-weight: 400; }
.group__sum { font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; }
.group__year { display: block; font-size: 10.5px; color: var(--ink-3); font-weight: 400; text-align: start; }
.group__body { padding: 0 0 8px; display: grid; gap: 2px; }
.group__body[hidden] { display: none; }

.totals2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 6px; }
.totals2 > div { min-width: 0; padding: 13px; border-radius: var(--r-md); background: var(--surface-2); }
.totals2 dt { font-size: 11.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.totals2 dd { margin: 5px 0 0; font-size: 21px; font-weight: 660; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* ── Comparison ─────────────────────────────────────────────────────────── */

.cmp { display: grid; gap: 2px; }
.cmp__row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px;
  width: 100%; padding: 11px 8px; margin: 0 -8px;
  border: 0; background: none; cursor: pointer; text-align: start; border-radius: var(--r-sm);
}
.cmp__row:hover { background: var(--surface-2); }
.cmp__row + .cmp__row { border-top: 1px solid var(--line); border-radius: 0; }
.cmp__label { font-size: 13.5px; overflow-wrap: anywhere; }
.cmp__hint { display: block; margin-top: 2px; font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.cmp__now { font-size: 14px; font-weight: 620; font-variant-numeric: tabular-nums; }
.cmp__delta { min-width: 62px; text-align: center; font-size: 11.5px; font-weight: 620; padding: 3px 7px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.cmp__delta.is-up { background: var(--neg-soft); color: var(--neg); }
.cmp__delta.is-down { background: var(--pos-soft); color: var(--pos); }
.cmp__delta.is-flat { background: var(--surface-2); color: var(--ink-3); }

/* ── Transactions ───────────────────────────────────────────────────────── */

/*
 * The pill strip scrolls; the page does not.
 *
 * `flex-wrap: nowrap` keeps the pills on one line, and the explicit
 * `width/max-width: 100%` plus `overflow-x: auto` is what confines that line to
 * the strip. Without the pair, a flex row of eight pills is simply a very wide
 * box: it reports its full content width to the grid above it and the entire
 * document becomes draggable sideways — which is exactly what the phone was
 * doing. `min-width: 0` is the same statement to the grid parent, said in the
 * form the parent listens to.
 */
.filters {
  display: flex; flex-wrap: nowrap; gap: 8px;
  width: 100%; max-width: 100%; min-width: 0;
  overflow-x: auto; overflow-y: hidden;
  padding-bottom: 2px; margin-bottom: 2px; scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; min-height: 44px; display: inline-flex; align-items: center;
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface);
  font-size: 12.5px; color: var(--ink-2); cursor: pointer; white-space: nowrap;
}
.chip.is-on { background: var(--ink); border-color: var(--ink); color: #fff; }

/* 16px, not 14px — below that iOS Safari zooms the page on focus and does not
   zoom back out. See MOBILE_RULES.minInputFontPx for why the fix is here and
   not `maximum-scale=1` on the viewport. */
.search {
  width: 100%; padding: 11px 14px; margin-bottom: 12px;
  border: 1px solid var(--line-2); border-radius: var(--r-md);
  background: var(--surface); font-size: 16px; outline: none;
}
.search:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

.context {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px;
  padding: 11px 13px; margin-bottom: 12px;
  border-radius: var(--r-md); background: var(--accent-soft);
  font-size: 12.5px; color: #1e3a8a;
}
.context button { flex: none; border: 0; background: none; color: #1e3a8a; font-size: 12.5px; font-weight: 650; cursor: pointer; text-decoration: underline; }

.context__body { min-width: 0; overflow-wrap: anywhere; }
.context__note { display: block; margin-top: 2px; opacity: .8; }

/* A transaction row: glyph, name, amount, then the facts under it. */
.txlist { display: grid; }
.txc {
  display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; align-items: start;
  width: 100%; padding: 12px 8px; margin: 0 -8px;
  border: 0; border-top: 1px solid var(--line); background: none;
  text-align: start; cursor: pointer; border-radius: var(--r-sm);
}
.txc:first-child { border-top: 0; }
.txc:hover { background: var(--surface-2); }
.txc__icon {
  width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line);
}
.glyph { width: 17px; height: 17px; fill: none; stroke: var(--ink-2); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.txc__body { min-width: 0; }
.txc__top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; min-width: 0; }
.txc__name { min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.txc__amount { font-size: 14px; font-weight: 620; font-variant-numeric: tabular-nums; white-space: nowrap; }
.txc__amount.is-neg { color: var(--neg); }
.txc__amount.is-pos { color: var(--pos); }
.txc__meta { display: block; margin-top: 3px; font-size: 11px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.txc__tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.txc.is-excluded { opacity: .62; }
.txc.is-excluded .txc__amount { text-decoration: line-through; }
.txc.is-marked-out .txc__name { text-decoration: line-through; text-decoration-color: var(--ink-3); }

.more {
  width: 100%; margin-top: 12px; padding: 11px;
  border: 1px solid var(--line-2); border-radius: var(--r-md);
  background: var(--surface-2); color: var(--ink-2);
  font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.more:hover { background: var(--line); }
.more[hidden] { display: none; }

.linkbtn {
  margin-top: 10px; padding: 0; border: 0; background: none;
  color: var(--accent); font-size: 12.5px; font-weight: 600;
  cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}

/* ── Detail sheet ───────────────────────────────────────────────────────── */

.modal { position: fixed; inset: 0; z-index: 70; display: flex; align-items: flex-end; justify-content: center; }
.modal[hidden] { display: none; }
.modal__scrim { position: absolute; inset: 0; background: rgba(15, 23, 42, .45); }
.modal__sheet {
  position: relative; width: 100%; max-width: 560px;
  max-height: 92vh; display: flex; flex-direction: column;
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  box-shadow: var(--shadow-lift);
  animation: rise .18s ease-out;
}
@keyframes rise { from { transform: translateY(18px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .modal__sheet { animation: none; } }

.modal__bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px 12px; border-bottom: 1px solid var(--line);
}
.modal__title { min-width: 0; margin: 0; font-size: 14px; font-weight: 650; overflow-wrap: anywhere; }
.modal__close {
  flex: none;
  width: 32px; height: 32px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer;
}
.modal__close svg { width: 15px; height: 15px; fill: none; stroke: var(--ink-2); stroke-width: 1.8; stroke-linecap: round; }
/* The sheet is the narrowest column in the app and it shows the bank's own raw
   wording, which arrives as one unbroken token often enough to matter. */
.modal__body {
  padding: 16px 18px calc(22px + env(safe-area-inset-bottom));
  overflow-y: auto; overflow-x: hidden;
  overflow-wrap: anywhere; word-break: break-word;
}

body.is-locked { overflow: hidden; }

.sheethead { display: flex; align-items: center; gap: 12px; }
.sheethead__icon {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center;
  border-radius: 14px; background: var(--accent-soft);
}
.sheethead__icon .glyph { width: 21px; height: 21px; stroke: var(--accent); }
.sheethead__text { flex: 1; min-width: 0; }
.sheethead__name { display: block; font-size: 15px; font-weight: 620; }
.sheethead__sub { display: block; margin-top: 2px; font-size: 11.5px; color: var(--ink-3); }
.sheethead__amount { font-size: 20px; font-weight: 680; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sheethead__amount.is-neg { color: var(--neg); }
.sheethead__amount.is-pos { color: var(--pos); }

.sheethead__name { overflow-wrap: anywhere; }
.sheethead__amount { flex: none; }

.sheettags { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 4px; }

.defs { margin: 12px 0 0; display: grid; gap: 0; }
.def {
  display: grid; grid-template-columns: minmax(0, 42%) minmax(0, 1fr); gap: 12px;
  padding: 8px 0; border-top: 1px solid var(--line);
  font-size: 12.5px; line-height: 1.6;
}
.def dt { margin: 0; color: var(--ink-3); overflow-wrap: anywhere; }
.def dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }

.callout {
  margin-top: 12px; padding: 11px 13px; border-radius: var(--r-md);
  background: var(--accent-soft); color: #1e3a8a; font-size: 12.5px; line-height: 1.6;
}
.callout--warn { background: var(--warn-soft); color: var(--warn); }

.block { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.block .block__grid { margin-top: 10px; }
.block .bar__track { margin: 4px 0 2px; }

.hist { display: grid; margin-top: 10px; }
.hist__row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: baseline;
  padding: 8px 0; border-top: 1px solid var(--line); font-size: 12.5px;
}
.hist__row:first-child { border-top: 0; }
.hist__date { color: var(--ink-3); font-size: 11.5px; white-space: nowrap; }
.hist__where { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist__amount { font-weight: 620; font-variant-numeric: tabular-nums; }
.hist__amount.is-neg { color: var(--neg); }
.hist__amount.is-pos { color: var(--pos); }

/* ── Local marks ────────────────────────────────────────────────────────── */

.block--marks { background: var(--surface-2); border-radius: var(--r-md); padding: 14px; margin-top: 18px; border-top: 0; }
.mark { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 8px 0; }
.mark__label { min-width: 0; font-size: 12.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.mark__edit { display: flex; flex-wrap: wrap; min-width: 0; max-width: 100%; gap: 6px; }

.seg { display: flex; flex-wrap: wrap; max-width: 100%; gap: 4px; padding: 3px; border-radius: 999px; background: #fff; border: 1px solid var(--line-2); }
.seg__btn {
  padding: 6px 10px; border: 0; border-radius: 999px; background: none;
  font-size: 11.5px; color: var(--ink-2); cursor: pointer; white-space: nowrap;
}
.seg__btn.is-on { background: var(--ink); color: #fff; font-weight: 600; }

.toggle {
  padding: 7px 13px; border: 1px solid var(--line-2); border-radius: 999px;
  background: #fff; font-size: 12px; color: var(--ink-2); cursor: pointer; white-space: nowrap;
}
.toggle.is-on { background: var(--warn-soft); border-color: #f0c48a; color: var(--warn); font-weight: 600; }
.markinput {
  min-width: 0; width: 100%; max-width: 150px; padding: 7px 10px;
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: #fff; font-size: 12.5px; outline: none;
}
.markinput:focus { border-color: var(--accent); }

/* ── Cards tab ──────────────────────────────────────────────────────────── */

.plastic {
  display: block; width: 100%; max-width: 100%; min-width: 0; text-align: start;
  padding: 16px; border: 0; border-radius: var(--r-md);
  background: linear-gradient(135deg, #172554, #2f5bea);
  color: #fff; margin-bottom: 14px; cursor: pointer;
}
.plastic__row { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 6px 10px; }
.plastic__row > * { min-width: 0; }
.plastic__name { display: block; font-size: 15px; font-weight: 620; overflow-wrap: anywhere; }
.plastic__issuer { display: block; margin-top: 2px; font-size: 11px; opacity: .78; overflow-wrap: anywhere; }
.plastic__num { flex: none; font-size: 12px; opacity: .8; font-variant-numeric: tabular-nums; letter-spacing: .08em; white-space: nowrap; }
.plastic__due { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 10px; margin-top: 16px; }
.plastic__due > * { min-width: 0; }
.plastic__duek { font-size: 11.5px; opacity: .8; overflow-wrap: anywhere; }
.plastic__duev { font-size: 24px; font-weight: 660; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.plastic__cap { display: block; margin-top: 12px; font-size: 11px; opacity: .82; overflow-wrap: anywhere; }
.plastic__open { font-weight: 650; font-variant-numeric: tabular-nums; }

/*
 * The utilisation meter lives on the plastic and carries its own «אינה כסף»
 * tag. A bar this prominent beside a balance is exactly where borrowed headroom
 * gets added to real money — CLAUDE.md §3.1.
 */
.meter { display: block; margin-top: 14px; }
.meter__top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 8px; }
.meter__top > * { min-width: 0; }
.meter__k { font-size: 11.5px; opacity: .86; overflow-wrap: anywhere; }
.meter__k b { font-weight: 680; }
.meter__tag {
  padding: 2px 7px; border-radius: 999px;
  background: rgba(255, 255, 255, .16); font-size: 9.5px; font-weight: 600; white-space: nowrap;
}
.meter__track { display: block; height: 7px; margin-top: 7px; border-radius: 999px; background: rgba(255, 255, 255, .22); overflow: hidden; }
.meter__fill { display: block; height: 100%; border-radius: 999px; background: #cfe0ff; }
.meter__fill.is-hot { background: #ffd7c2; }
.meter__legend { display: block; margin-top: 7px; font-size: 11px; opacity: .82; font-variant-numeric: tabular-nums; }
.meter__num { font-weight: 620; }

.lowpoint--btn { width: 100%; border: 0; cursor: pointer; text-align: start; background: var(--accent-soft); }
.lowpoint--btn:hover { filter: brightness(.98); }

/* ── Twelve-month strip ─────────────────────────────────────────────────── */

.trend { margin-top: 12px; }
.trend__bars {
  display: flex; flex-wrap: nowrap; align-items: flex-end; gap: 6px;
  width: 100%; max-width: 100%; min-width: 0;
  overflow-x: auto; padding-bottom: 4px; scrollbar-width: none;
}
.trend__bars::-webkit-scrollbar { display: none; }
.tb { flex: 1 0 26px; border: 0; background: none; padding: 0; cursor: pointer; display: grid; gap: 5px; justify-items: center; }
.tb__col { display: flex; align-items: flex-end; width: 100%; height: 76px; border-radius: 6px; background: var(--line); overflow: hidden; }
.tb__fill { width: 100%; border-radius: 6px; background: var(--accent); opacity: .85; }
.tb:hover .tb__fill { opacity: 1; }
.tb__lbl { font-size: 9.5px; color: var(--ink-3); white-space: nowrap; }
/* A month the data cannot vouch for is drawn, striped, and excluded from the
   average — a gap in the strip would read as a month with no spending. */
.tb.is-partial .tb__fill {
  opacity: .5;
  background: repeating-linear-gradient(45deg, var(--accent) 0 4px, #a9bdf5 4px 8px);
}
.tb.is-partial .tb__lbl { font-style: italic; }

/* ── Business tab ───────────────────────────────────────────────────────── */

/*
 * A breakdown group: glyph, label, share bar. The same bar language as the
 * category card on «אישי» — the business split is a different QUESTION, not a
 * different kind of chart, and giving it its own visual grammar would imply the
 * two cannot be read the same way.
 */
.bars .gbar { width: 100%; padding: 0; border: 0; background: none; text-align: start; cursor: pointer; }
.gbar__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.gbar__id { display: flex; align-items: center; gap: 8px; min-width: 0; }
.gbar__icon {
  width: 26px; height: 26px; flex: none; display: grid; place-items: center;
  border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line);
}
.gbar__icon .glyph { width: 14px; height: 14px; }
.gbar__label { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gbar__nums { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.gbar__nums b { font-weight: 650; color: var(--ink); }

/*
 * The three deductibility states, tinted by standing. «מועמדת» is deliberately
 * the warm one: it is the state that still needs a person, and it must not read
 * as settled just because it sits between two states that are.
 */
.row--ded { border-inline-start: 3px solid transparent; padding-inline-start: 10px; }
.row--ded.is-approved { border-inline-start-color: var(--pos); }
.row--ded.is-candidate { border-inline-start-color: var(--warn); }
.row--ded.is-not-business { border-inline-start-color: var(--line-2); }

/* ── Banker tab ─────────────────────────────────────────────────────────── */

/*
 * An insight is a CARD and not a list row, because it carries eight fields a
 * reader has to weigh before acting. The priority band is a colour on the edge
 * plus a glyph and a word — colour alone would be the only signal, and it is
 * the one signal a colour-blind reader does not get.
 */
/*
 * An insight card carries eight prose fields written by the engine, and prose
 * is the one thing on this surface whose length nobody controls. Every text
 * node in here therefore breaks rather than pushes: `overflow-wrap: anywhere`
 * (not `break-word`) because only `anywhere` also shrinks the box's MIN-CONTENT
 * width, which is the number a grid or flex parent actually reads when it
 * decides how wide the card has to be.
 */
.insights { display: grid; gap: 12px; margin-top: 4px; }
.ins {
  min-width: 0; max-width: 100%;
  padding: 14px; border-radius: var(--r-md);
  border: 1px solid var(--line); border-inline-start-width: 4px;
  background: var(--surface-2);
  overflow-wrap: anywhere; word-break: break-word;
}
.ins--urgent { border-inline-start-color: var(--neg); background: var(--neg-soft); }
.ins--act { border-inline-start-color: var(--warn); background: var(--warn-soft); }
.ins--save { border-inline-start-color: var(--pos); background: var(--pos-soft); }
.ins--info { border-inline-start-color: var(--accent); background: var(--accent-soft); }

.ins__top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; }
.ins__top > * { min-width: 0; }
.ins__band { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 620; color: var(--ink-2); }
.ins__dot { font-size: 12px; line-height: 1; }
.ins__title { margin: 8px 0 0; font-size: 14.5px; font-weight: 650; letter-spacing: -.005em; }
.ins__found { margin: 5px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--ink-2); }

.ins__impact {
  margin-top: 12px; padding: 11px 12px; border-radius: var(--r-sm);
  background: rgba(255, 255, 255, .72); border: 1px solid rgba(255, 255, 255, .9);
}
.ins__impact.is-unpriced { background: rgba(255, 255, 255, .5); }
.ins__impactk { display: block; font-size: 11px; font-weight: 620; color: var(--ink-2); margin-bottom: 6px; }
.ins__impact .block__grid { margin: 0; }
.ins__impact .block__cell dd { font-size: 16px; }
.ins__basis { margin: 8px 0 0; font-size: 11px; line-height: 1.6; color: var(--ink-3); }

.ins__spec { margin-top: 12px; display: grid; gap: 0; }
.spec { display: grid; grid-template-columns: minmax(0, 34%) minmax(0, 1fr); gap: 10px; padding: 7px 0; border-top: 1px dashed rgba(15, 23, 42, .12); font-size: 12px; line-height: 1.6; }
.spec__k { color: var(--ink-3); overflow-wrap: anywhere; }
.spec__v { color: var(--ink); overflow-wrap: anywhere; }

.ins__acts { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 4px; }

/* The inquiry surface. Answers land in `.rows`, so every figure is a `.money`. */
.answer { margin-top: 6px; }
.answer__q { margin: 4px 0 0; font-size: 13.5px; font-weight: 650; }
.answer__lead { margin: 4px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--ink-2); }

.checklist { display: grid; gap: 2px; }

.check { display: flex; gap: 9px; align-items: flex-start; padding: 9px 0; border-top: 1px solid var(--line); font-size: 12.5px; }
.check:first-child { border-top: 0; }
.check__mark { flex: none; width: 16px; text-align: center; font-weight: 700; }
.check__mark.is-ok { color: var(--pos); }
.check__mark.is-bad { color: var(--neg); }
.check__mark.is-na { color: var(--ink-3); }
.check__body { min-width: 0; }
.check__id { color: var(--ink-3); font-size: 11px; }

.empty { padding: 26px 12px; text-align: center; font-size: 13px; color: var(--ink-3); }

/* ── Prose cannot widen its container ───────────────────────────────────── */

/*
 * Every text surface the ENGINE writes, in one place.
 *
 * These strings are not authored here: they are merchant names off a bank
 * statement, method sentences from `banker.js`, supplier labels, category codes
 * the provider invented last week. Their length is nobody's decision, and a
 * single unbroken token — a 40-character merchant name with no spaces, a URL in
 * a note — is enough to set a card's min-content width and drag the whole page
 * sideways on a phone.
 *
 * `overflow-wrap: anywhere` rather than `break-word`, and the difference is the
 * whole point: both break the visible line, but only `anywhere` also lowers the
 * box's reported MIN-CONTENT width, which is the number the flex and grid
 * parents above actually read when deciding how wide they have to be. With
 * `break-word` the text looks wrapped and the layout still overflows.
 * `word-break: break-word` is kept alongside it as the legacy spelling.
 */
.card__note,
.callout,
.answer__q,
.answer__lead,
.check__body,
.empty,
.row__sub,
.tl__kind,
.ins__title,
.ins__found,
.ins__basis,
.ins__impactk,
.block__title,
.lowpoint__label,
.lowpoint__date,
.sheethead__sub,
.hist__where,
.def dd,
.meter__legend,
.plastic__issuer {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* ── Tab bar ────────────────────────────────────────────────────────────── */

.tabbar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, .93);
  backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--line);
}
.tab {
  min-height: 44px; min-width: 0; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: 0; background: none; cursor: pointer; color: var(--ink-3);
  font-size: 10.5px; padding: 0 2px;
  transition: color .15s ease;
}
/* Five labels across a 320px phone: the longest («הבנקאי שלי») gets 62px of
   track, so the label is clipped rather than allowed to widen its column. */
.tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab svg { flex: none; width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tab.is-active { color: var(--accent); font-weight: 620; }

/* ── Skeleton ───────────────────────────────────────────────────────────── */

.sk { border-radius: 8px; background: linear-gradient(90deg, #eef0f4 25%, #f6f7f9 50%, #eef0f4 75%); background-size: 200% 100%; animation: sheen 1.4s ease-in-out infinite; }
@keyframes sheen { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.sk--line { height: 12px; margin: 8px 0; }
.sk--hero { height: 38px; width: 62%; margin: 10px 0 6px; }
.sk--chip { height: 12px; width: 36%; }

@media (prefers-reduced-motion: reduce) {
  .sk { animation: none; }
  .iconbtn.is-spinning svg { animation: none; }
}

/* ── Privacy mode ───────────────────────────────────────────────────────── */

/*
 * Blur, not removal: the layout must not reflow when it is toggled, or the
 * gesture becomes a page jump instead of a quick shield in a public place.
 */
body.is-private .money {
  filter: blur(7px);
  user-select: none;
  pointer-events: none;
}
body.is-private .money { transition: filter .12s ease; }

/* ── Toast ──────────────────────────────────────────────────────────────── */

.toast {
  position: fixed; z-index: 50;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
  inset-inline: 20px;
  max-width: 420px; margin: 0 auto;
  padding: 12px 15px; border-radius: var(--r-md);
  background: var(--ink); color: #fff; font-size: 13px;
  box-shadow: var(--shadow-lift);
}
.toast[hidden] { display: none; }

/* ── Phone ──────────────────────────────────────────────────────────────── */

/*
 * Up to 768px this is a phone app, and the one thing it must never do is scroll
 * sideways. The rules below are the belt to the shell's braces: nothing declares
 * a width in pixels, every strip that scrolls is told to keep the scroll to
 * itself, and every horizontal flex row is allowed to wrap onto a second line
 * rather than reach past the edge.
 *
 * The card padding is 16px — the requested comfortable inset, and small enough
 * that a 320px screen still leaves 260px of usable column.
 */
@media (max-width: 768px) {
  .screens { padding-inline: 12px; }

  .card,
  .plastic,
  .ins,
  .block--credit,
  .block--marks { width: 100%; max-width: 100%; min-width: 0; }

  .card { padding: 16px; }

  /* Scrolling strips: the pills move, the document stays put. */
  .filters,
  .trend__bars {
    width: 100%; max-width: 100%; min-width: 0;
    display: flex; flex-wrap: nowrap; gap: 8px;
    overflow-x: auto;
  }

  /* Anything that pairs a label with a value gets to break the pair onto two
     lines instead of pushing the row wider than the card. */
  .card__head,
  .lowpoint,
  .plastic__due,
  .plastic__row,
  .meter__top,
  .ins__top,
  .mark,
  .mark__edit,
  .band__labels,
  .context,
  .sheet__list li { flex-wrap: wrap; }

  /* Two-up number blocks stay two-up — they are short — but the cells may no
     longer refuse to shrink. */
  .flow,
  .totals2,
  .forecast__split { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* The three-cell credit block is the tightest grid in the app: three amounts
     across a 320px screen is ~76px each, and «12,345.67 ₪» does not fit. Below
     420px it becomes a single column rather than overflowing. */
  .block__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  .modal__sheet { max-width: 100%; }
}

@media (max-width: 420px) {
  .block__grid { grid-template-columns: minmax(0, 1fr); }
  .hero__value { font-size: 30px; }
  .plastic__duev { font-size: 21px; }
}

/* ── Tablet and desktop ─────────────────────────────────────────────────── */

/*
 * From 769px the app stops being a phone and becomes a centred column: 960px
 * wide, gutters either side, and the compact cards paired two-across.
 *
 * The pairing is an explicit ALLOWLIST via `:has()`, not `grid-auto-flow: dense`
 * over everything. Four cards qualify — the two-number ones («נכנס מול יוצא»,
 * «התחייבויות קבועות», «תחזית סוף חודש», «השוואה לעצמי») — because they are the
 * only ones whose content is short enough that half a column is not a squeeze.
 * Everything else spans the full width: a transaction ledger, a twelve-month
 * strip or an eight-field insight in a 460px column is a narrower reading
 * surface than the phone has, which is the opposite of what the extra room is
 * for. Anything the allowlist does not name stays full width, so a card added
 * later is wrong-but-readable rather than wrong-and-cramped.
 */
@media (min-width: 769px) {
  .screens { padding-inline: 32px; }

  .topbar { padding-inline: 32px; }
  .topbar__row,
  .sheet { max-width: 960px; margin-inline: auto; }

  .screen {
    max-width: 960px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 16px;
  }
  /* Full width is the default for EVERY direct child, not just `.card` — the
     allowlist below is the only thing that opts out. A card added later, or a
     stray non-card node, lands full width instead of silently taking half a row
     it was never designed for. */
  .screen > * { grid-column: 1 / -1; }
  .screen > .card:has(> .flow),
  .screen > .card:has(> .totals2),
  .screen > .card:has(> .forecast),
  .screen > .card:has(> .cmp) { grid-column: span 1; }

  .card { padding: 22px; }

  .toast { max-width: 420px; }
}

/* ── Touch ──────────────────────────────────────────────────────────────── */

/*
 * The rules that make this feel like an app on a phone rather than a page.
 *
 * The lock screen needs no height unit at all: it is `position: fixed; inset: 0`,
 * which is the visual viewport by definition and therefore already immune to the
 * `100vh` trap on mobile Safari, where that unit means "the height with the URL
 * bar hidden" and puts the unlock button below the fold until somebody scrolls.
 * The sheet below is the surface that does need a unit, and it uses `dvh`.
 */

/*
 * `manipulation` removes the 300ms double-tap-to-zoom wait on every control, so
 * a tab change happens on the finger and not a third of a second later. It is
 * scoped to controls: applying it to the document would take double-tap zoom
 * away from the statement text, which is a reading aid, not a delay.
 */
button, .tab, .chip, .row, .txc, a {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Grey flash suppressed above, so pressed state has to be drawn back in — a
   control that gives no feedback reads as a control that did not register. */
.tab:active, .chip:active, .iconbtn:active, .lock__go:active, .lock__bio:active, .bio__btn:active {
  opacity: .72;
}

.tabbar { user-select: none; -webkit-user-select: none; }

/* A scroll that reaches the end of these must not become a page scroll, or a
   swipe through the filter pills drags the whole screen with it. */
.filters, .modal__body, .sheet__list { overscroll-behavior: contain; }
.screens { -webkit-overflow-scrolling: touch; }

/* The sheet must not grow past the viewport on a short phone in landscape. */
.modal__sheet { max-height: 92dvh; }

/* Same overlay trick as `.iconbtn`: a 32px close button on a 22px corner radius
   is a mis-tap that dismisses a sheet the reader was still reading. */
.modal__close { position: relative; }
.modal__close::after {
  content: ''; position: absolute;
  top: 50%; inset-inline-start: 50%;
  transform: translate(50%, -50%);
  width: 44px; height: 44px;
}

/* Standalone mode has no URL bar to pull down on, so the body must not rubber
   band at all — a bounce there looks like the app has come loose. */
@media (display-mode: standalone) {
  body { overscroll-behavior: none; }
}
