/* רישום — dual theme.
   DARK  (default) = the navy dashboard ported from the 575live backoffice (/admin).
   LIGHT           = the previous light/green financial design, kept verbatim.

   Dark is the default so it lives on plain :root and the common case paints with no flash;
   light is a [data-theme="light"] override, applied by a tiny script in index.html <head>
   before the stylesheet paints. Every component rule below reads tokens only — no rule
   hard-codes a surface colour — so the two themes stay in step by construction. */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Assistant:wght@300;400;500;600;700&family=Heebo:wght@400;500;600;700;800&display=swap');

/* ============================ DARK (default) ============================ */
:root {
  --paper:      #0D1B2A;
  --card:       #152238;
  --card-alt:   #1B2D47;
  --bg-input:   #1B2D47;
  --input-bg:   #1B2D47;
  --readonly-bg:#16253C;
  --hover:      #223A5C;
  --zebra:      rgba(27,45,71,.45);
  --row-hover:  #1B2D47;
  --placeholder:#5C6F87;
  --bar:        #0F1F36;
  --ink:        #E4E9F0;
  --ink-strong: #FFFFFF;
  --ink-muted:  #7A8DA6;
  --muted:      #7A8DA6;   /* alias — app.js writes var(--muted) inline in three places */
  --line:       #1E3A5F;
  --line-strong:#2A4A75;
  --brand:      #1A90FF;
  --brand-hov:  #1478D4;
  /* ק rows in סיכום הנהלה — capital, never profit, so they read blue wherever they appear.
     Deliberately NOT --brand: that is blue on dark but GREEN on light (#06564D), so the capital
     rows changed colour with the theme and stopped reading as one thing. */
  --capital:    #1A90FF;
  --btn-bg:     linear-gradient(135deg, #1A90FF, #1478D4);
  --btn-bg-hov: linear-gradient(135deg, #1478D4, #0F5DB3);
  --btn-ink:    #FFFFFF;
  --accent:     #00C853;
  --accent-ink: #042E17;
  --accent-hov: #00B24A;
  --danger:     #FF1744;
  --danger-hov: #E00034;
  --danger-bg:  rgba(255,23,68,.12);
  --danger-line:rgba(255,23,68,.38);
  --danger-ink: #FF6B85;
  --success:    #00C853;
  --success-bg: rgba(0,200,83,.12);
  --success-ink:#4ADE80;
  --warn:       #FFAB00;
  --warn-bg:    rgba(255,171,0,.13);
  --warn-bg-hov: rgba(255,171,0,.22);
  /* מורווח — light purple. A giveback is neither a warning nor an approval, so it takes a colour
     of its own rather than borrowing one that already means something else. Light-on-both:
     a pale purple chip reads the same against the dark card and the white one. */
  --violet-bg:  #DDD6FE;
  --violet-ink: #4C1D95;
  --violet-hov: #C4B5FD;
  /* דחה חשבון — brown. Pushing a bill to another day is not destructive and not an approval. */
  --defer-bg:   #FFAB00;
  --defer-ink:  #3D2600;
  --defer-hov:  #E09600;
  --warn-ink:   #FFC24D;
  --info-bg:    rgba(26,144,255,.12);
  --info-ink:   #6BB8FF;
  --info-line:  rgba(26,144,255,.32);
  --partial-bg: rgba(255,171,0,.20);
  --partial-ink:#FFD27A;
  --partial-line:rgba(255,171,0,.45);
  --closed-bg:  #223A5C;
  --closed-ink: #A8B8CC;
  --rollover-ink:#042E17;
  /* baby blue — בקשות פתוחות, identical in both themes: it is the one button meant to stand out */
  --focus:      #1A90FF;
  --focus-ring: rgba(26,144,255,.20);
  /* שלח (PDF export) — its own token so the light theme can carry a light blue without
     touching --brand, which drives the menu numerals and every primary button. */
  --send-bg:    #1A90FF;
  --send-ink:   #FFFFFF;
  --selection:  rgba(26,144,255,.35);
  --scroll-thumb: #2A4A75;
  --scroll-thumb-hov: #35608F;
  --date-filter: invert(1) opacity(.65);
  --shadow-sm:  0 1px 2px rgba(0,0,0,.35);
  --shadow-md:  0 6px 20px rgba(0,0,0,.35), 0 2px 6px rgba(0,0,0,.25);
  --shadow-btn: 0 1px 2px rgba(0,0,0,.30);
  --radius:     16px;
  --radius-sm:  10px;
  --radius-lg:  22px;
  --thead-bg:   #0F2844;
  --thead-ink:  #FFFFFF;
}

/* ============================ LIGHT ============================ */
:root[data-theme="light"] {
  --paper:      #F1F4F6;
  --card:       #FFFFFF;
  --card-alt:   #F7F9FA;
  --bg-input:   #FFFFFF;
  --input-bg:   #FFFFFF;
  --readonly-bg:#F1F3F5;
  --hover:      #EDF1F3;
  --zebra:      #FBFCFD;
  --row-hover:  #EEF4F3;
  --placeholder:#9AA6B2;
  --bar:        transparent;
  --ink:        #16191D;
  --ink-strong: #0A0C0F;
  --ink-muted:  #67717E;
  --muted:      #67717E;
  --line:       #E3E8EC;
  --line-strong:#CBD3DA;
  --brand:      #06564D;
  --brand-hov:  #04443D;
  --capital:    #1565C0;
  --btn-bg:     #06564D;
  --btn-bg-hov: #04443D;
  --btn-ink:    #FFFFFF;
  --accent:     #25D366;
  --accent-ink: #05372F;
  --accent-hov: #1FC55D;
  --danger:     #B91C1C;
  --danger-hov: #991919;
  --danger-bg:  #FEE2E2;
  --danger-line:#FECACA;
  --danger-ink: #991B1B;
  --success:    #065F46;
  --success-bg: #D1FAE5;
  --success-ink:#065F46;
  --warn:       #B45309;
  --warn-bg:    #FEF3C7;
  --warn-bg-hov: #FDE68A;
  --violet-bg:  #DDD6FE;
  --violet-ink: #4C1D95;
  --violet-hov: #C4B5FD;
  /* Brown proper on the light theme, with cream ink: --warn is already dark here, so the dark
     brown ink the dark theme uses would sit on it with almost no contrast. */
  --defer-bg:   #B45309;
  --defer-ink:  #FFF7ED;
  --defer-hov:  #92400E;
  --warn-ink:   #92400E;
  --info-bg:    #DBEAFE;
  --info-ink:   #1E40AF;
  --info-line:  #BFDBFE;
  --partial-bg: #FDE68A;
  --partial-ink:#7C2D12;
  --partial-line:#FCD34D;
  --closed-bg:  #E5E7EB;
  --closed-ink: #374151;
  --rollover-ink:#FFFFFF;
  --focus:      #0E8F7E;
  --focus-ring: rgba(14,143,126,.16);
  --send-bg:    #A8D8F0;   /* light blue */
  --send-ink:   #0B3B52;
  --selection:  rgba(37,211,102,.28);
  --scroll-thumb: #CBD3DA;
  --scroll-thumb-hov: #A9B4BF;
  --date-filter: none;
  --shadow-sm:  0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.04);
  --shadow-md:  0 6px 18px rgba(16,24,40,.07), 0 2px 6px rgba(16,24,40,.04);
  --shadow-btn: 0 1px 2px rgba(16,24,40,.08);
  --radius:     16px;
  --radius-sm:  10px;
  --radius-lg:  22px;
  --thead-bg:   #F7F9FA;
  --thead-ink:  #67717E;
}

/* ======================= SHARED METRICS (both themes) =======================
   Sizing, weights and typefaces are identical in light and dark — the two themes differ in
   COLOUR only. Declared once here, after both token blocks and covering both selectors, so a
   value cannot be changed for one theme and forgotten in the other.

   These previously diverged, which is what made dark mode look differently proportioned: it
   used a 10px button radius against light's 12px, uppercase table headers at a lighter weight,
   a 1px hover lift, and Inter in front of Assistant. Inter and Assistant have different metrics,
   so the same 14.5px text rendered at visibly different sizes between the themes. */
:root,
:root[data-theme="light"] {
  --radius-btn: 12px;
  --btn-lift:   0px;
  --thead-transform: none;
  --thead-spacing:   0.04em;
  --thead-weight:    700;
  --font-serif: "Heebo", "Assistant", -apple-system, "Segoe UI", Arial, sans-serif;
  --font-sans:  "Assistant", "Heebo", -apple-system, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
/* Nothing is allowed to scroll the PAGE sideways. The tables below are made to fit rather than
   to overflow, so this is a backstop for one long word or a stray wide element — not the fix
   itself. Both elements need it: on iOS, overflow-x on body alone still lets html scroll. */
html, body { overflow-x: hidden; max-width: 100%; }
/* A long name, note or URL must wrap instead of widening its container. */
body { overflow-wrap: break-word; }
/* Removes the ~300ms tap delay and the grey flash on tap. */
button, .btn, .vbox, a, select, input[type="checkbox"] {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  direction: rtl;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
  transition: background 200ms, color 200ms;
}

/* Typography */
h1, h2, h3, h4 { font-family: var(--font-serif); color: var(--ink-strong); font-weight: 700; letter-spacing: -0.02em; margin: 0; }
h2 { font-size: 24px; line-height: 1.25; margin-bottom: 20px; font-weight: 700; }
h3 { font-size: 16px; line-height: 1.35; margin: 22px 0 10px; color: var(--ink); font-weight: 600; letter-spacing: -0.005em; }
p  { margin: 0 0 12px; }

/* Layout shell */
#app { max-width: 760px; margin: 0 auto; padding: 24px 20px 48px; }

/* Header */
header.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  background: var(--bar);
  border-bottom: 1px solid var(--line);
  margin: 0 -20px 24px;
  padding-inline: 24px;
}
header.top .brandwrap { display: flex; align-items: center; gap: 10px; min-width: 0; }
header.top .title {
  font-family: var(--font-serif); font-size: 22px; font-weight: 700; letter-spacing: -0.02em;
  color: var(--brand);
}
header.top .who { color: var(--ink-muted); font-size: 13px; }
header.top button {
  background: var(--card-alt); color: var(--ink); border: 1px solid var(--line);
  padding: 7px 14px; border-radius: var(--radius-sm); cursor: pointer; font: inherit; font-size: 13px;
  font-weight: 600; font-family: var(--font-sans);
  transition: background 150ms, border-color 150ms;
}
header.top button:hover { background: var(--hover); border-color: var(--line-strong); }
/* Theme switch — sits beside the רישום headline */
header.top button.theme-toggle {
  padding: 0; width: 34px; height: 34px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px; line-height: 1; border-radius: 999px;
}
header.top button.theme-toggle:hover { border-color: var(--brand); }

/* Card container */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-md);
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 9px 16px;
  border-radius: var(--radius-btn);
  border: 1px solid transparent;
  cursor: pointer;
  font: inherit; font-family: var(--font-sans); font-weight: 600; font-size: 13.5px;
  letter-spacing: -0.002em;
  /* Vertical breathing room. margin-inline-start below only separates buttons that land on the
     SAME line — the moment an action row wraps, the lines would otherwise sit edge to edge. */
  margin-block: 4px;
  background: var(--btn-bg); color: var(--btn-ink);
  box-shadow: var(--shadow-btn);
  transition: background 200ms, border-color 200ms, color 200ms, box-shadow 200ms, transform 120ms;
}
.btn:hover  { background: var(--btn-bg-hov); transform: translateY(var(--btn-lift)); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.btn:disabled { opacity: .40; cursor: not-allowed; box-shadow: none; transform: none; }
.btn.block  { display: block; width: 100%; }
.btn.ghost  { background: var(--card-alt); color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--hover); border-color: var(--line-strong); }
/* red — destructive actions, and בקשות פתוחות on the menu.
   Sets its own border-color for the same reason .accent does: mkAction builds every menu button as
   `btn block ghost <extra>`, so without it .ghost's --line edge stays drawn around the red. On a
   solid red background a transparent border and a red one paint identically, so no existing
   danger button changes. */
.btn.danger { background: var(--danger); color: #FFFFFF; border-color: var(--danger); }
.btn.danger:hover { background: var(--danger-hov); border-color: var(--danger-hov); }
/* green — the אישור button, and בקשות סגורות on the menu.
   Sits AFTER .ghost for the same reason .warn does: mkAction builds every menu button as
   `btn block ghost <extra>`, so both classes land on one element at equal specificity (0,2,0)
   and source order decides. Declared above .ghost it lost, and the button came out grey.
   It also has to set its own border-color, or .ghost's --line edge stays visible around it.
   Nothing combined .accent with .ghost before this move, so no existing button changed. */
.btn.accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.accent:hover { background: var(--accent-hov); border-color: var(--accent-hov); }
/* טבלה — the PDF-of-this-screen button. Reuses the לא התקבל badge's pair rather than inventing a
   colour, so the app still has one yellow. */
.btn.warn   { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-bg); }
.btn.warn:hover { background: var(--warn-bg-hov); border-color: var(--warn-bg-hov); }
/* מורווח */
.btn.violet { background: var(--violet-bg); color: var(--violet-ink); border-color: var(--violet-bg); }
.btn.violet:hover { background: var(--violet-hov); border-color: var(--violet-hov); }
/* דחה חשבון / שנה דחייה */
.btn.defer  { background: var(--defer-bg);  color: var(--defer-ink);  border-color: var(--defer-bg); }
.btn.defer:hover { background: var(--defer-hov); border-color: var(--defer-hov); }

/* ---------- סיכום יוזרים — the category totals under the table ----------
   A block rather than a wider totals row: ה splits into ק and ע, which is two figures in one
   column, and a phone has no room for eight columns of sums anyway. Plain flex rows, so this
   reads the same on a phone as on a desktop and needs no card-layout fallback. */
.totals-box {
  margin-top: 14px; padding: 4px 16px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card-alt);
}
.totals-box .row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 9px 0;
  font-variant-numeric: tabular-nums lining-nums;
}
.totals-box .row + .row { border-top: 1px solid var(--line); }
.totals-box .row .lbl { color: var(--ink-muted); font-weight: 600; }
.totals-box .row .val { font-weight: 600; color: var(--ink); }
/* ק is capital, not profit — the same blue it reads in סיכום הנהלה, and --capital rather than
   --brand for the same reason: --brand is green on the light theme. */
.totals-box .row.capital .lbl,
.totals-box .row.capital .val { color: var(--capital); }
/* יתרה קודמת — the לא התקבל yellow, because it is the same thing: money expected that did not
   arrive. The negative inline margin lets the tint reach the box's edges, which the box's own
   16px padding would otherwise inset it from. */
.totals-box .row.warn {
  background: var(--warn-bg);
  margin-inline: -16px; padding-inline: 16px;
}
.totals-box .row.warn .lbl,
.totals-box .row.warn .val { color: var(--warn-ink); }
.totals-box .row.grand {
  border-top: 2px solid var(--line-strong); margin-top: 2px; padding-top: 12px; font-size: 16px;
}
.totals-box .row.grand .lbl,
.totals-box .row.grand .val { color: var(--ink-strong); font-weight: 700; }
.btn + .btn { margin-inline-start: 8px; }
/* Rows built as flex containers already space their children with `gap`; the inline margin
   would double up on those, so it is cancelled where a gap is doing the work. */
[style*="display:flex"] > .btn + .btn { margin-inline-start: 0; }

/* Menu (section headers ה / ב / ג / פ / יוזרים) */
.menu button {
  display: flex; align-items: center;
  width: 100%;
  padding: 14px 18px; margin-bottom: 8px;
  background: var(--card-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-btn);
  font: inherit; font-family: var(--font-sans); font-size: 15px; font-weight: 500; color: var(--ink);
  text-align: start; cursor: pointer;
  transition: background 150ms, border-color 150ms;
}
.menu button:hover { background: var(--hover); border-color: var(--brand); }
.menu .num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 8px;
  background: var(--brand); color: #FFFFFF;
  margin-inline-end: 12px; font-family: var(--font-serif); font-weight: 700; font-size: 12.5px;
  letter-spacing: -0.02em;
}

/* Form controls */
label {
  display: block;
  font-size: 13px; font-weight: 500;
  color: var(--ink-muted);
  margin-top: 16px; margin-bottom: 8px;
  letter-spacing: 0.01em;
  text-transform: none;
}
input, select, textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  font: inherit; font-family: var(--font-sans); font-size: 15px;
  font-variant-numeric: tabular-nums lining-nums;
  color: var(--ink);
  transition: border-color 200ms, box-shadow 200ms;
}
input::placeholder, textarea::placeholder { color: var(--placeholder); }
/* color-scheme is what keeps the native date picker, dropdown arrow and autofill legible on a
   dark field. It is applied to the CONTROLS rather than to :root, because at root level it also
   nudges how the UA lays out form elements — and a styled <button> must measure identically in
   both themes. Everything else that color-scheme would have handled (page background,
   scrollbars, ::selection) is already set explicitly below. */
input, select, textarea, button { color-scheme: dark; }
:root[data-theme="light"] input,
:root[data-theme="light"] select,
:root[data-theme="light"] textarea,
:root[data-theme="light"] button { color-scheme: light; }
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
input[readonly] { background: var(--readonly-bg); color: var(--ink-muted); }
/* On the dark theme the native picker glyph is near-invisible; --date-filter is `none` on light. */
input[type="date"]::-webkit-calendar-picker-indicator { filter: var(--date-filter); cursor: pointer; }
input[type="checkbox"] { width: auto; margin: 0; accent-color: var(--brand); }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

/* שיוך V-boxes — the D / E / S / N assignment selector and the הכל/code filters.
   No min-width: with five boxes (הכל + four codes) a fixed width cannot fit a phone. They
   share the row instead, each shrinking to an equal slice. */
.assign-row { display: flex; gap: 8px; flex-wrap: wrap; }
.vbox {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 12px; min-width: 0;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--card-alt); color: var(--ink);
  font: inherit; font-family: var(--font-sans); font-weight: 700; font-size: 14.5px;
  white-space: nowrap;
  cursor: pointer;
  transition: background 150ms, border-color 150ms, color 150ms;
}
.vbox:hover { border-color: var(--brand); }
/* The שיתוף רווחים disclosure box stands exactly where a <label> used to, so it needs a label's
   vertical rhythm (16px above, 8px below). .vbox is inline-flex and carries NO margin of its own,
   so without this wrapper the button sits flush against the control above it and against the very
   E / D boxes it reveals — which is what jammed it into them on ה. */
.share-disclosure { display: block; margin: 16px 0 8px; }
.vbox .tick {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 4px; flex: none;
  border: 1px solid var(--line-strong); background: var(--input-bg);
  font-size: 11px; font-weight: 700; line-height: 1;
}
.vbox.on { border-color: var(--brand); background: var(--info-bg); color: var(--ink-strong); }
/* E / D in שיתוף רווחים — permanently on. Carries no click handler, so this only has to
   LOOK unavailable; it is not what enforces the lock. The padlock is drawn INSIDE .tick by
   the script rather than added as a pseudo-element: an extra element was a third flex child
   that S and N do not have, which made E and D wider and spilled the glyph past the border. */
.vbox.locked { cursor: default; }
.vbox.locked:hover { border-color: var(--brand); }
.vbox.on .tick { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
/* After .vbox.on .tick on purpose — equal specificity, so order decides. Strips the checkbox
   chrome so the padlock reads as a padlock and not as a ticked box. */
.vbox.locked .tick { background: transparent; border-color: transparent; font-size: 12px; }

/* A picker inside a table cell (the שיתוף column on the ב / פ / ג screens) has far less room
   than the full-width form row the mobile rules below were tuned for. All four stay on ONE line:
   flex:0 0 auto stops them shrinking (which is what pushed the ✓ past the border), and the
   tighter padding/tick make the set narrow enough to fit without it. Higher specificity than the
   media-query rule, so it holds at every width. */
td .assign-row { flex-wrap: nowrap; gap: 5px; }
/* שמור / פתח sits in the same row as the boxes but must not be shrunk by the nowrap rules that
   let the V-boxes share the width between them. */
.assign-row > .btn { flex: 0 0 auto; white-space: nowrap; }
td .assign-row .vbox {
  flex: 0 0 auto; min-width: auto;
  padding: 6px 8px; gap: 4px; font-size: 13px;
}
td .assign-row .vbox .tick { width: 14px; height: 14px; font-size: 10px; }

/* שיוך code chip — E / D / S beside a name in the יוזרים list */
.owner-code {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 6px; margin-inline-end: 4px;
  background: var(--brand); color: #FFFFFF;
  font-family: var(--font-sans); font-size: 11.5px; font-weight: 700;
  letter-spacing: 0.02em; vertical-align: middle;
}
/* An AGENT who shares this borrower, beside the owner's chip. Outlined rather than filled, so the
   owner still reads as the owner at a glance and the share reads as an annotation on it — the card
   is the owner's, the agent earns from it. Same size and rhythm, so a row of chips stays even.
   Declared after .owner-code and adds one class, so it wins without !important. */
.owner-code.shared {
  background: transparent; color: var(--brand);
  border: 1px solid var(--brand); font-weight: 600;
}
/* IN AN EXPORT the agent's letter REPLACES the owner's — nameWithCode drops the owner chip from
   the document whenever there is an agent — so it is the only chip on the line and has to read as
   one. The outline exists on screen to say "this is an annotation on the owner's chip beside it",
   and with that chip gone it would only look like a lesser version of the thing it replaced.
   Two classes plus .pdf-export against two, declared later, so source order settles it. */
/* The red ק dot: marks a סכום כולל that includes the agent's own stake coming back. --danger, the
   colour everything overdue and destructive already uses, and it is redeclared inside .pdf-export
   at a print-safe value, so the dot survives the export it exists for. */
.k-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger); margin-inline-start: 6px; vertical-align: middle; flex: none;
}
.pdf-export .owner-code.shared {
  background: var(--brand); color: #FFFFFF; border-color: var(--brand); font-weight: 700;
}

/* Messages */
.msg { padding: 12px 14px; border-radius: var(--radius-sm); margin: 10px 0; font-size: 14px; border: 1px solid transparent; }
.msg.err  { background: var(--danger-bg);  color: var(--danger-ink);  border-color: var(--danger-line); }
.msg.info { background: var(--info-bg);    color: var(--info-ink);    border-color: var(--info-line); }
.msg.ok   { background: var(--success-bg); color: var(--success-ink); border-color: var(--success-bg); }

/* Lists (loans, borrowers, due) */
.list .item {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 150ms;
}
.list .item:last-child { border-bottom: 0; }
.list .item:hover { background: var(--card-alt); }
.list .item .l { min-width: 0; }
.list .item .r { text-align: end; color: var(--ink-muted); font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums lining-nums; }
.list .item .name { font-family: var(--font-serif); font-weight: 600; font-size: 16px; color: var(--ink-strong); }
.list .item .sub  { color: var(--ink-muted); font-size: 13px; margin-top: 2px; }

/* Badges */
.badge {
  display: inline-block; padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em;
  border: 1px solid transparent;
  font-variant-numeric: tabular-nums lining-nums;
}
.badge.unpaid  { background: var(--warn-bg);    color: var(--warn-ink);    border-color: var(--warn-bg); }
.badge.partial { background: var(--partial-bg); color: var(--partial-ink); border-color: var(--partial-line); }
.badge.paid    { background: var(--info-bg);    color: var(--info-ink);    border-color: var(--info-line); }
.badge.settled { background: var(--success-bg); color: var(--success-ink); border-color: var(--success-bg); }
.badge.closed  { background: var(--closed-bg);  color: var(--closed-ink);  border-color: var(--line-strong); }
.badge.active  { background: var(--success-bg); color: var(--success-ink); border-color: var(--success-bg); }
.badge.defaulted { background: var(--danger-bg); color: var(--danger-ink); border-color: var(--danger-line); }
.badge.interest_rollover { background: var(--success); color: var(--rollover-ink); border-color: transparent; font-weight: 700; }
.badge.fine_active { background: var(--danger); color: #FFFFFF; border-color: transparent; font-weight: 700; }

/* Schedule table */
table.schedule {
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums lining-nums;
}
table.schedule th, table.schedule td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: start;
}
table.schedule th {
  background: var(--thead-bg);
  color: var(--thead-ink);
  font-weight: var(--thead-weight);
  font-size: 11.5px;
  letter-spacing: var(--thead-spacing);
  text-transform: var(--thead-transform);
  border-bottom: 1px solid var(--line-strong);
  position: sticky; top: 0;
}
table.schedule td { font-variant-numeric: tabular-nums lining-nums; }
table.schedule tbody tr:nth-child(even) { background: var(--zebra); }
table.schedule tbody tr:hover { background: var(--row-hover); }

@media (max-width: 640px) {
  #app { padding: 16px 14px 40px; }

  /* All five boxes on one row. flex:1 1 0 + min-width:0 lets them shrink to an equal share of
     whatever the card offers, so they fit any phone width without reaching the edges; nowrap
     keeps them from spilling onto a second line. */
  .assign-row { gap: 5px; flex-wrap: nowrap; flex: 1 1 100%; width: 100%; }
  .assign-row .vbox { flex: 1 1 0; min-width: 0; padding: 8px 2px; gap: 3px; font-size: 13px; }
  .assign-row .vbox .tick { width: 14px; height: 14px; font-size: 10px; }
  header.top { margin-inline: -14px; padding-inline: 16px; }
  h2 { font-size: 21px; }
  .card { padding: 18px; }
  /* 44px is the smallest comfortable touch target; the desktop size is ~36px. */
  .btn { min-height: 44px; padding: 11px 16px; }
  /* iOS zooms the page in when a focused field is under 16px, which then leaves the layout
     shifted sideways. 16px is the threshold, not a preference. */
  input, select, textarea { font-size: 16px; }
  /* Action rows wrap instead of running off the edge. */
  .card > div > .btn { margin-block: 4px; }
  table.schedule { font-size: 12.5px; }
  table.schedule th, table.schedule td { padding: 8px 6px; }

  /* EVERY table becomes a stack of labelled cards on a phone — .schedule is on all of them.
     A 9-column schedule cannot be read at 360px, and making it scroll sideways just moves the
     problem. Each td carries data-label, so the field name is printed by ::before below. */
  table.schedule, table.schedule thead, table.schedule tbody, table.schedule tr, table.schedule td { display: block; width: 100%; }
  table.schedule { border: 0; min-width: 0 !important; }
  table.schedule thead { display: none; }
  table.schedule tr {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 10px;
    background: var(--card-alt);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    align-items: center;
  }
  table.schedule td { border: 0; padding: 0; display: flex; align-items: center; gap: 8px; min-width: 0; }
  table.schedule td[data-label]::before {
    content: attr(data-label) ":";
    color: var(--ink-muted); font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
    min-width: 46px;
  }
  table.schedule td[data-label="שם"] {
    grid-column: 1 / -1; font-size: 16px; font-weight: 700; color: var(--ink-strong);
    border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 4px;
  }
  table.schedule td[data-label="שם"]::before { display: none; }
  table.schedule td[data-label="פעולות"] {
    grid-column: 1 / -1; justify-content: flex-end; padding-top: 6px;
  }
  table.schedule td[data-label="פעולות"]::before { display: none; }
  /* שיתוף ברווחים — a long label next to a row of boxes that asks for width:100%. In a
     half-width grid cell the two fight for the same line and the label ends up jammed against
     the D box. Give the cell the full row and let it wrap, so the label sits above the boxes. */
  table.schedule td[data-label="שיתוף ברווחים"] {
    grid-column: 1 / -1;
    flex-wrap: wrap;
    row-gap: 6px;
    align-items: flex-start;
  }
  table.schedule td[data-label="שיתוף ברווחים"]::before {
    min-width: 0;
    flex: 0 0 100%;   /* label on its own line, never shoulder-to-shoulder with a box */
  }
  table.schedule td select { padding: 6px 8px; font-size: 13px; }
  /* Grand-total row. Deliberately still .points: those tables end with a totals row, while a
     schedule's last row is an ordinary פעימה and must not be painted as a total. */
  table.points tbody tr:last-child { background: var(--hover); font-weight: 700; grid-template-columns: 1fr auto; }
  table.points tbody tr:last-child td[colspan] { grid-column: 1 / -1; }
  /* עמלות is printed AFTER the grand total, so the :last-child rule above would hand it the
     total row's 1fr/auto split — which is what opened a wide gap between the label and the
     figure. It is an ordinary line, so put the normal two-column grid back. Declared after the
     rule it overrides, since both selectors carry the same specificity. */
  table.points tbody tr.subtotal {
    background: var(--card-alt);
    font-weight: 400;
    grid-template-columns: 1fr 1fr;
  }
  /* .classic — סיכום הנהלה's drill-down keeps the ORIGINAL table look on a phone. Its rows are
     meant to be compared column by column, which cards defeat. Higher specificity than the
     card rules above (two classes vs one), so it wins wherever it is declared. Its dialog
     wrapper carries overflow-x:auto, so a wide list scrolls inside the dialog rather than
     being clipped by the page-level overflow-x:hidden. */
  table.schedule.classic { display: table; width: 100%; border-collapse: collapse; }
  table.schedule.classic thead { display: table-header-group; }
  table.schedule.classic tbody { display: table-row-group; }
  table.schedule.classic tr {
    display: table-row;
    border: 0; border-radius: 0; padding: 0; margin: 0;
    background: transparent; grid-template-columns: none; gap: 0;
  }
  table.schedule.classic td {
    display: table-cell; width: auto; padding: 8px 6px;
    border-bottom: 1px solid var(--line); vertical-align: middle;
  }
  table.schedule.classic td[data-label]::before { content: none; display: none; }

  /* Opt a row out of the :last-child grand-total grid while keeping its own styling. That rule
     switches to 1fr/auto for the ledger tables' total row, which opens a wide label-to-figure
     gap; סיכום הנהלה's סה"כ wants the same spacing as the category rows above it. */
  table.points tbody tr.grid-2 { grid-template-columns: 1fr 1fr; }
  /* A table with NO grand total at all — סיכום הנהלה's ק וחיסורים. Its last row (חיסורים) is an
     ordinary category, but the :last-child rule above still caught it: the 1fr/auto grid opened a
     wide label-to-figure gap that no other row had, and the tint and bold made a plain line read
     as a sum. Same specificity as that rule, so it is declared after it and wins on order. */
  table.points tbody tr.not-total {
    background: transparent;
    font-weight: inherit;
    grid-template-columns: 1fr 1fr;
  }
  /* A .points table whose grand total lives OUTSIDE it — סיכום יוזרים, whose totals moved into
     .totals-box. The :last-child rule above would otherwise paint the last borrower's card as a
     sum: tinted, bold, and on the 1fr/auto grid that opens a wide label-to-figure gap. Unlike
     .not-total this keeps the card background, because here the row is still a card. */
  table.points.no-total tbody tr:last-child {
    background: var(--card-alt);
    font-weight: inherit;
    grid-template-columns: 1fr 1fr;
  }
}

/* Utility bits */
.footer { text-align: center; color: var(--ink-muted); font-size: 12px; padding: 24px 0 0; letter-spacing: 0.04em; }
.spinner { text-align: center; padding: 40px; color: var(--ink-muted); font-family: var(--font-serif); font-weight: 500; }

/* ---------- modal backdrop ----------
   The layer every dialog sits on. It scrolls, so a dialog taller than the screen is reachable,
   and it CONTAINS that scroll so the gesture never chains through to the page behind it. */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0, 0, 0, .66);
  display: flex; justify-content: center;
  padding: 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
/* margin:auto centres the dialog AND keeps a tall one scrollable from its top. align-items:center
   would put the overflow above the scroll origin, where it cannot be reached at all. */
.modal-backdrop > * { margin: auto; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 12px 0 6px; font-size: 14.5px; }
.kv dt { color: var(--ink-muted); font-weight: 500; }
.kv dd { margin: 0; font-weight: 600; color: var(--ink-strong); font-variant-numeric: tabular-nums lining-nums; }
/* רווח סוכן בסוף — the same yellow as the לא התקבל badge, from the same two tokens, so the app
   keeps one yellow rather than growing a second one that drifts. */
.kv-warn {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  background: var(--warn-bg); color: var(--warn-ink);
  font-weight: 700;
}

.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--bg-input);
  border: 1px dashed var(--line-strong);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 22px;
  letter-spacing: 6px;
  text-align: center;
  font-weight: 700;
  color: var(--ink-strong);
  margin: 10px 0;
}

/* Selection */
::selection { background: var(--selection); }

/* Money figures anywhere: keep digits aligned and unambiguous. */
table.points td, .badge, .list .item .r { font-variant-numeric: tabular-nums lining-nums; }

/* Scrollbars — a light default scrollbar on navy looks broken. */
* { scrollbar-color: var(--scroll-thumb) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hov); }

/* PDF export scope. exportElementToPdf() clones a card into an off-screen box and prints it on
   white paper, but the clone's inline styles reference the live theme's tokens — on dark,
   --ink-strong is near-white and would come out invisible. Re-declaring the tokens here flips
   every var() inside the subtree to print-safe values in one go, in either theme. */
.pdf-export {
  --paper: #FFFFFF; --card: #FFFFFF; --card-alt: #F4F6F8; --bg-input: #FFFFFF; --input-bg: #FFFFFF;
  --ink: #111111; --ink-strong: #000000; --ink-muted: #555555; --muted: #555555;
  --line: #CCCCCC; --line-strong: #999999;
  --brand: #075E54; --accent: #0B8043; --accent-ink: #FFFFFF;
  --capital: #1565C0;
  --danger: #B91C1C; --danger-bg: #FEE2E2; --danger-line: #FECACA; --danger-ink: #991B1B;
  --warn: #B45309; --warn-bg: #FEF3C7; --warn-ink: #92400E;
  --violet-bg: #DDD6FE; --violet-ink: #4C1D95; --violet-hov: #C4B5FD;
  --defer-bg: #B45309; --defer-ink: #FFF7ED; --defer-hov: #92400E;
  --success: #065F46; --success-bg: #D1FAE5; --success-ink: #065F46;
  --info-bg: #DBEAFE; --info-ink: #1E40AF; --info-line: #BFDBFE;
  --partial-bg: #FDE68A; --partial-ink: #7C2D12; --partial-line: #FCD34D;
  --closed-bg: #E5E7EB; --closed-ink: #374151; --rollover-ink: #FFFFFF;
  --zebra: #F7F7F7; --row-hover: #F0F0F0; --readonly-bg: #F1F1F1;
  --thead-bg: #EEEEEE; --thead-ink: #333333;
  --send-bg: #A8D8F0; --send-ink: #0B3B52;
  color: #000000;
}


/* Touch devices: a tap leaves :hover applied until you tap something else, so the lift and the
   hover tint stay stuck on the last button pressed. Neutralised here rather than by rewriting
   all 14 hover rules; :active still gives press feedback. */
@media (hover: none) {
  .btn:hover { transform: none; box-shadow: var(--shadow-btn); background: var(--btn-bg); }
  /* .ghost FIRST, then every role colour — THE SAME ORDER AS THE MAIN CASCADE, and for the same
     reason: mkAction builds every menu button as `btn block ghost <extra>`, so .ghost and the role
     colour land on one element at equal specificity (0,2,1) and source order decides.

     .accent used to sit ABOVE .ghost here, so it lost: בקשות סגורות went GREY the moment a finger
     landed on it, and since a touch device leaves :hover applied until you touch something else,
     it stayed grey for the whole scroll. That is the identical trap the main cascade documents —
     it was fixed there and reintroduced here, which is why the two now read in one order.

     .danger was already below .ghost and so was never affected; .warn, .violet and .defer were
     never listed at all, so their hover colour was not neutralised and stuck to the touch the same
     way. Each rule restores the class's OWN resting colour, so a touch moves nothing. */
  .btn.ghost:hover  { background: var(--card-alt); border-color: var(--line); }
  .btn.danger:hover { background: var(--danger);   border-color: var(--danger); }
  .btn.accent:hover { background: var(--accent);   border-color: var(--accent); }
  .btn.warn:hover   { background: var(--warn-bg);   border-color: var(--warn-bg); }
  .btn.violet:hover { background: var(--violet-bg); border-color: var(--violet-bg); }
  .btn.defer:hover  { background: var(--defer-bg);  border-color: var(--defer-bg); }
  .vbox:not(.on):hover { border-color: var(--line-strong); }
  input:hover, select:hover, textarea:hover { border-color: var(--line); }
  .list .item:hover { background: transparent; }
}


/* Exports keep the ORIGINAL table look, on every device.
   The card layout above is a @media (max-width:640px) rule, and a media query tests the VIEWPORT
   — not the element — so a PDF produced on a phone would come out as stacked cards. The export
   clone lives inside .pdf-export at a fixed 900px, where a real table fits comfortably, so the
   table display is put back here.
   These sit at the END of the file on purpose: .pdf-export table.schedule td[data-label]::before
   and the mobile rule it overrides carry the SAME specificity, so source order is what decides.
   That is also why none of this needs !important. */
.pdf-export table.schedule,
.pdf-export table.schedule thead,
.pdf-export table.schedule tbody,
.pdf-export table.schedule tr,
.pdf-export table.schedule td { width: auto; }
.pdf-export table.schedule { display: table; width: 100%; border-collapse: collapse; }
.pdf-export table.schedule thead { display: table-header-group; }
.pdf-export table.schedule tbody { display: table-row-group; }
.pdf-export table.schedule tr {
  display: table-row;
  border: 0; border-radius: 0; padding: 0; margin: 0;
  background: transparent;
  grid-template-columns: none; gap: 0;
}
.pdf-export table.schedule td {
  display: table-cell; padding: 5px 8px; border: 1px solid #333;
  vertical-align: middle;
}
/* The field name is a column header again, so the per-cell prefix must go. */
.pdf-export table.schedule td::before,
.pdf-export table.schedule td[data-label]::before { content: none; display: none; }
/* שם and פעולות are given full-width grid rows on mobile; back to ordinary cells here. */
.pdf-export table.schedule td[data-label="שם"],
.pdf-export table.schedule td[data-label="פעולות"] {
  grid-column: auto; font-size: inherit; font-weight: inherit;
  border: 1px solid #333; padding: 5px 8px; margin: 0; justify-content: flex-start;
}

/* ---------- PDF export "working" overlay ----------
   Building a PDF takes a second or two of html2canvas, and html2canvas blocks the main thread —
   so the feedback has to be a CSS animation, not anything driven by JS, or it freezes mid-spin.
   Appended after the .pdf-export block on purpose: unrelated selectors, so the documented
   "these overrides win on source order" rule above is untouched. */
.pdf-busy-ring {
  width: 44px; height: 44px; border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, .25);
  border-top-color: #fff;
  animation: pdf-busy-spin .8s linear infinite;
}
@keyframes pdf-busy-spin { to { transform: rotate(360deg); } }

/* Respect the OS setting: pulse instead of spin rather than showing nothing at all. */
@media (prefers-reduced-motion: reduce) {
  .pdf-busy-ring { animation: pdf-busy-pulse 1.2s ease-in-out infinite; }
  @keyframes pdf-busy-pulse { 50% { opacity: .35; } }
}

/* ==================== clothing26s.com — the shop front ====================
   FIXED WHITE, whatever theme the account is on. This is a storefront, not a screen of the app,
   and the account's own theme is applied the moment login succeeds (login.php returns it) so the
   first real screen is already right.

   EVERY VALUE HERE IS LITERAL — no var(--…) anywhere. A token would follow the dark theme and the
   shop would change colour with it, which is the one thing it must not do. That is a deliberate
   exception to "every component rule reads tokens only", and the only one in this file.

   Scoped under .shop / .auth, which only screen_shop() renders, so nothing else can pick it up.
   ========================================================================= */

html.shopfront, html.shopfront body { background: #fff; }

/* The shell is built for a document: #app is capped at 760px with 24px/20px/48px of padding.
   A storefront is full-bleed, so the cap and the padding are dropped rather than cancelled with
   negative margins — a negative margin would have to track three padding values to stay correct.
   Scoped to html.shopfront, so the app's own screens keep the shell exactly as it was. */
html.shopfront #app { max-width: none; padding: 0; }

.shop {
  direction: rtl;
  background: #fff;
  color: #333;
  font-family: 'Heebo', 'Assistant', -apple-system, 'Segoe UI', Arial, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}
.shop *, .auth * { box-sizing: border-box; }
.shop-ico { display: inline-flex; }

/* The wordmark. Jost is not loaded, so this is Heebo tracked wide — same idea, no extra request.
   direction:ltr because the page is rtl and the mark is Latin; the negative margin-inline-end
   cancels the trailing letter-space so it still optically centres. */
.shop-mark {
  direction: ltr;
  font-size: 13px; font-weight: 500;
  letter-spacing: 0.26em; margin-inline-end: -0.26em;
  color: #000; white-space: nowrap;
}

.shop-ann {
  height: 30px; background: #eee; color: #222;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 500;
}

.shop-hd {
  height: 56px; background: #fff; border-bottom: 1px solid #eee;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
}
.shop-hd-l { display: flex; align-items: center; gap: 14px; }
.shop-ic {
  background: none; border: 0; padding: 0; color: #000; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; margin: 0 -12px;   /* 44px touch target, no visual bulk */
}
.shop-signin {
  background: none; border: 0; padding: 4px 0; cursor: pointer;
  font-family: inherit; font-size: 12.5px; font-weight: 600; color: #000;
  border-bottom: 1px solid #000; line-height: 1.2;
}

.shop-cats {
  height: 44px; border-bottom: 1px solid #eee;
  display: flex; align-items: center; gap: 22px; padding: 0 16px;
  overflow-x: auto; white-space: nowrap;
  scrollbar-width: none;
}
.shop-cats::-webkit-scrollbar { display: none; }
.shop-cat { font-size: 13.5px; font-weight: 400; color: #666; flex: 0 0 auto; }
.shop-cat.is-on {
  font-weight: 600; color: #000;
  border-bottom: 2px solid #000; padding-bottom: 11px; margin-top: 13px;
}

.shop-hero { position: relative; width: 100%; height: 360px; overflow: hidden; }
.shop-hero img { width: 100%; height: 360px; object-fit: cover; display: block; }
.shop-hero-t {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.55) 0%, rgba(0,0,0,.12) 42%, rgba(0,0,0,0) 70%);
  display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end;
  gap: 12px; padding: 0 20px 22px 20px;
}
.shop-hero-h { color: #fff; font-size: 26px; font-weight: 800; letter-spacing: .05em; line-height: 1.15; }
.shop-hero-s { color: #fff; font-size: 13px; opacity: .9; }
.shop-hero-b { background: #fff; color: #000; font-size: 13px; font-weight: 600; letter-spacing: .04em; padding: 11px 26px; }

.shop-sec { display: flex; align-items: baseline; justify-content: space-between; padding: 26px 16px 16px; }
.shop-sec-h { font-size: 16px; font-weight: 700; color: #000; letter-spacing: .04em; }
.shop-sec-l { font-size: 12.5px; color: #666; text-decoration: underline; text-underline-offset: 3px; }

.shop-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; }
.shop-tile { display: flex; flex-direction: column; }
.shop-tile img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; display: block; background: #f4f4f4; }
.shop-tile-t { padding: 9px 8px 18px; display: flex; flex-direction: column; gap: 4px; }
.shop-tile-n { font-size: 13px; color: #333; }
.shop-tile-p { font-size: 14px; font-weight: 700; color: #000; display: flex; align-items: baseline; gap: 8px; }
.shop-sale { color: #c92527; }
.shop-was { font-size: 12px; font-weight: 400; color: #999; text-decoration: line-through; }

.shop-ft { border-top: 1px solid #eee; margin-top: 14px; padding: 26px 16px 30px; display: flex; flex-direction: column; gap: 16px; }
.shop-ft-l { display: flex; gap: 20px; font-size: 12.5px; color: #666; }
.shop-ft-c { font-size: 11px; letter-spacing: .08em; color: #999; }

/* ---------------- the sign-in panel, over the shop ---------------- */
.auth {
  position: fixed; inset: 0; z-index: 400;
  background: #fff; color: #333;
  direction: rtl;
  font-family: 'Heebo', 'Assistant', -apple-system, 'Segoe UI', Arial, sans-serif;
  overflow-y: auto;
  overscroll-behavior: contain;   /* the gesture must never reach the shop underneath */
  display: flex; flex-direction: column;
}
.auth[hidden] { display: none; }  /* [hidden] alone loses to display:flex */
.auth-x {
  position: absolute; top: 20px; left: 20px;
  width: 44px; height: 44px; background: none; border: 0; padding: 0; cursor: pointer; color: #000;
  display: flex; align-items: center; justify-content: center;
}
.auth-inner { flex: 1; padding: 96px 28px 0; }
.auth-mark { font-size: 19px; font-weight: 300; letter-spacing: .32em; margin-inline-end: -.32em; text-align: center; }

.auth-tabs { display: flex; justify-content: center; gap: 40px; margin: 40px -28px 0; padding: 0 28px; border-bottom: 1px solid #eee; }
.auth-tab {
  position: relative; background: none; border: 0; cursor: pointer;
  font-family: inherit; font-size: 15px; font-weight: 400; color: #666;
  padding: 0 0 12px;
}
.auth-tab.is-on { font-weight: 600; color: #000; }
.auth-tab.is-on::after {
  content: ''; position: absolute; bottom: -1px; right: 50%; transform: translateX(50%);
  width: 40px; height: 2px; background: #000;
}

.auth-form { display: flex; flex-direction: column; gap: 16px; margin-top: 30px; }
.auth-row { display: flex; flex-direction: column; gap: 6px; }
.auth-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.auth-lbl { font-size: 13px; font-weight: 500; color: #666; }
.auth-req { color: #c92527; }
.auth-note { font-size: 11.5px; color: #999; }
.auth-in {
  height: 46px; width: 100%;
  border: 1px solid #e5e5e5; border-radius: 2px; background: #fff; color: #000;
  padding: 0 12px;
  /* 16px, NOT the reference's 14 — anything under 16 makes iOS zoom the field and leave the
     page shifted sideways, which is the defect this app has already fixed once. */
  font-family: inherit; font-size: 16px;
}
.auth-in::placeholder { color: #999; }
.auth-in:focus { outline: none; box-shadow: 0 0 3px 1px #68a8e0; }

.auth-cta {
  height: 46px; width: 100%;
  border: 1px solid #000; border-radius: 0; background: #000; color: #fff;
  font-family: inherit; font-size: 15px; font-weight: 600; letter-spacing: .04em; cursor: pointer;
  margin-top: 6px;
}
.auth-cta:disabled { background: #bbb; border-color: #bbb; cursor: not-allowed; }
.auth-link {
  background: none; border: 0; padding: 0; cursor: pointer; align-self: flex-start;
  font-family: inherit; font-size: 13px; color: #666;
  text-decoration: underline; text-underline-offset: 3px;
}
.auth-link-c { align-self: center; margin-top: 12px; }
.auth-err {
  border: 1px solid #e4c3c4; background: #fbf4f4; color: #c92527;
  font-size: 13.5px; font-weight: 500; line-height: 1.5; padding: 11px 13px; text-align: center;
}

.auth-consent { display: flex; align-items: flex-start; gap: 10px; font-size: 11.5px; color: #666; line-height: 1.65; }
.auth-consent a { color: #666; text-decoration: underline; text-underline-offset: 2px; }
.auth-cb { flex: 0 0 auto; width: 16px; height: 16px; margin: 2px 0 0; accent-color: #000; }

.auth-done { display: flex; flex-direction: column; align-items: center; text-align: center; margin-top: 70px; }
.auth-done-mark { width: 62px; height: 62px; border: 1px solid #000; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #000; }
.auth-done-h { font-size: 22px; font-weight: 700; color: #000; margin-top: 28px; }
.auth-done-p { font-size: 14.5px; color: #333; line-height: 1.7; margin-top: 12px; max-width: 280px; }
.auth-done-t { font-size: 14.5px; font-weight: 500; color: #000; margin-top: 18px; }
.auth-done .auth-cta { margin-top: 40px; }

.auth-foot { padding: 26px 28px 30px; text-align: center; font-size: 11px; letter-spacing: .08em; color: #999; }

/* A phone is the case this is built for; a desktop just gets the same column centred. */
@media (min-width: 700px) {
  .shop-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .shop-hero, .shop-hero img { height: 440px; }
  .auth-inner { max-width: 420px; margin: 0 auto; }
  .auth-tabs { margin-left: 0; margin-right: 0; padding: 0; }
}
