/*
 * The `hidden` attribute must actually hide.
 *
 * A bare `hidden` only sets `display: none` via the user-agent stylesheet, so
 * ANY author rule that sets display wins on specificity. `.tabbar` sets
 * `display: grid`, which meant $('#tabbar').hidden = true did nothing at all:
 * the tab bar stayed on screen for signed-out users and on the consent gate,
 * offering navigation into views the person cannot use yet.
 */
[hidden] { display: none !important; }

/* PoolFair — Material 3 surfaces, WCAG AA contrast, dark-mode safe.
   Big tappable rows: every interactive target is at least 48px tall. */

/* Palette sampled directly from the official logo — the blues of the four
   figures, the orange of the fourth, and the gold of the star. */
:root {
  --primary: #24589A;          /* deep blue from the logo ring */
  --on-primary: #FFFFFF;
  --primary-container: #CFE1F5;
  --on-primary-container: #0A2244;
  --accent: #EB7032;           /* the orange figure */
  --gold: #F5B547;             /* the star */
  --surface: #F7F9FC;
  --surface-container: #EBF0F7;
  --surface-container-high: #E0E7F1;
  --on-surface: #161A20;
  --on-surface-variant: #414852;
  --outline: #71798A;
  --outline-variant: #C1C9D6;
  --error: #A5282C;
  --success: #1E7A52;
  --radius: 16px;
  --radius-lg: 24px;
  --tap: 48px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary: #9CC6F2;
    --on-primary: #0A2244;
    --primary-container: #24589A;
    --on-primary-container: #DCE9FA;
    --accent: #F19035;
    --gold: #F5B547;
    --surface: #0D1117;
    --surface-container: #171D25;
    --surface-container-high: #212934;
    --on-surface: #DFE3EA;
    --on-surface-variant: #BFC7D4;
    --outline: #8A93A3;
    --outline-variant: #39414D;
    --error: #FFB4AB;
    --success: #7ED3A6;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--surface);
  color: var(--on-surface);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  padding-bottom: env(safe-area-inset-bottom);
}

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) 16px 12px;
  background: var(--surface-container);
  border-bottom: 1px solid var(--outline-variant);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; display: block; }

main { max-width: 720px; margin: 0 auto; padding: 16px; }

h1 { font-size: 1.6rem; line-height: 1.25; margin: 12px 0; letter-spacing: -0.01em; }
h2.section-title { font-size: 1.05rem; margin: 28px 0 10px; color: var(--on-surface-variant); }
h2.card-title { font-size: 1.05rem; margin: 0 0 12px; }
.lede { color: var(--on-surface-variant); margin: 0 0 20px; }

.card {
  background: var(--surface-container);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
}

.stack > * + * { margin-top: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.field { display: block; margin-bottom: 16px; }
.field-label {
  display: block; font-size: 0.8rem; font-weight: 600;
  color: var(--on-surface-variant); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
input, select {
  width: 100%; min-height: var(--tap);
  padding: 12px 14px; font-size: 1rem; font-family: inherit;
  color: var(--on-surface);
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: var(--radius);
}
input:focus-visible, select:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 3px solid var(--primary); outline-offset: 2px;
}
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0.12em; }

.btn {
  width: 100%; min-height: var(--tap);
  padding: 13px 20px; font-size: 1rem; font-weight: 600; font-family: inherit;
  color: var(--on-surface); background: var(--surface-container-high);
  border: 1px solid var(--outline); border-radius: 999px;
  cursor: pointer;
}
.btn.primary { background: var(--primary); color: var(--on-primary); border-color: transparent; }
.btn.small { width: auto; padding: 10px 18px; font-size: 0.9rem; }
.btn:active { transform: scale(0.985); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

.text-btn {
  min-height: var(--tap); padding: 8px 4px;
  background: none; border: none; color: var(--primary);
  font-size: 0.95rem; font-weight: 600; font-family: inherit; cursor: pointer;
}
.back { margin-bottom: 4px; }

.msg { min-height: 1.2em; margin: 10px 0 0; font-size: 0.9rem; }
.msg.error { color: var(--error); }
.msg.ok { color: var(--success); }

/* Law 7 — every actionable item tap-expands into What / Steps / Status. */
.explain {
  background: var(--surface-container);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.explain > summary {
  min-height: var(--tap);
  display: flex; align-items: center;
  padding: 12px 16px; cursor: pointer;
  font-weight: 600; font-size: 0.95rem; color: var(--primary);
}
.explain-body { padding: 0 16px 16px; color: var(--on-surface-variant); font-size: 0.92rem; }
.explain-body p { margin: 0 0 10px; }
.explain-body ol { margin: 0 0 10px; padding-left: 20px; }
.explain-body li { margin-bottom: 4px; }

.pool-row, .member-row, .ledger-row {
  background: var(--surface-container);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius);
  overflow: hidden;
}
.pool-row > summary, .member-row > summary {
  min-height: 64px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; cursor: pointer;
}
.pool-row .title, .member-row .title { font-weight: 600; }
.pool-row .sub, .member-row .sub { font-size: 0.85rem; color: var(--on-surface-variant); }
.row-main { min-width: 0; }
.row-side { text-align: right; white-space: nowrap; }

.pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.03em;
  background: var(--surface-container-high); color: var(--on-surface-variant);
}
.pill.paid { background: var(--primary-container); color: var(--on-primary-container); }
.pill.unpaid { background: transparent; color: var(--error); border: 1px solid var(--error); }

.totals {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px; margin: 16px 0;
}
.total-box {
  background: var(--surface-container); border: 1px solid var(--outline-variant);
  border-radius: var(--radius); padding: 14px;
}
.total-box .k { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--on-surface-variant); }
.total-box .v { font-size: 1.35rem; font-weight: 700; margin-top: 4px; }

.code-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.joincode { font-size: 1.6rem; font-weight: 700; margin-top: 4px; }

.proof {
  margin-top: 16px; padding: 14px;
  background: var(--surface); border: 1px solid var(--outline-variant);
  border-radius: var(--radius); font-size: 0.9rem;
}
.proof table { width: 100%; border-collapse: collapse; }
.proof td { padding: 6px 0; border-bottom: 1px solid var(--outline-variant); }
.proof td:last-child { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.proof .balance { margin-top: 12px; font-weight: 700; color: var(--success); }

/* Ticket photo — the thing the whole group actually trusts, so it is shown
   large rather than as a thumbnail. Numbers on a lottery ticket are small. */
.ticket-card {
  background: var(--surface-container);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius);
  overflow: hidden;
}
.ticket-photo {
  display: block; width: 100%; height: auto;
  background: var(--surface-container-high);
  cursor: zoom-in;
}
.ticket-meta {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 16px; font-size: 0.85rem;
  color: var(--on-surface-variant);
}
.ticket-numbers {
  padding: 0 16px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.95rem; letter-spacing: 0.06em;
}
.ticket-missing { padding: 20px 16px; color: var(--on-surface-variant); font-size: 0.9rem; }

/* Full-screen photo viewer — pinch-zoom to read the small print. */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.92);
  padding: env(safe-area-inset-top) 8px env(safe-area-inset-bottom);
}
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox-close {
  position: absolute; top: calc(env(safe-area-inset-top) + 8px); right: 12px;
  min-width: var(--tap); min-height: var(--tap);
  border: none; border-radius: 999px;
  background: rgba(255, 255, 255, 0.15); color: #fff;
  font-size: 1.4rem; cursor: pointer;
}

.ledger-row { padding: 12px 16px; font-size: 0.88rem; }
.ledger-row .when { color: var(--on-surface-variant); font-size: 0.8rem; }

.legal {
  max-width: 720px; margin: 32px auto 0; padding: 20px 16px 32px;
  font-size: 0.78rem; color: var(--on-surface-variant);
  border-top: 1px solid var(--outline-variant); text-align: center;
}

.empty { padding: 24px; text-align: center; color: var(--on-surface-variant); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .btn:active { transform: none; }
}

/* ── Countdown ──────────────────────────────────────────────────────────
   The deadline is the most actionable thing in the app: money still to
   collect, ticket still to buy. It escalates in colour as time runs out. */
.countdown {
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 16px;
  border: 1px solid var(--outline-variant);
  background: var(--surface-container);
}
.countdown .cd-label {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--on-surface-variant);
}
.countdown .cd-value {
  font-size: 1.7rem; font-weight: 700; margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.countdown .cd-when { font-size: 0.85rem; color: var(--on-surface-variant); margin-top: 4px; }

.countdown.soon { border-color: var(--primary); }
.countdown.critical {
  border-color: var(--error); border-width: 2px;
}
.countdown.critical .cd-value { color: var(--error); }
.countdown.drawn { opacity: 0.75; }

/* ── Next up ─────────────────────────────────────────────────────────── */
.nextup {
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  background: var(--primary-container);
  color: var(--on-primary-container);
  border: 1px solid transparent;
}
.nextup .nu-tag {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; opacity: 0.75;
}
.nextup .nu-name { font-size: 1.3rem; font-weight: 700; margin: 6px 0 2px; }
.nextup .nu-cd { font-size: 1.1rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.nextup .nu-money { font-size: 0.9rem; margin-top: 8px; opacity: 0.9; }
.nextup button {
  margin-top: 14px; width: 100%; min-height: var(--tap);
  border: none; border-radius: 999px; cursor: pointer;
  background: var(--on-primary-container); color: var(--primary-container);
  font-size: 1rem; font-weight: 600; font-family: inherit;
}

/* ── Payout statistics ───────────────────────────────────────────────── */
.stats {
  background: var(--surface-container);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-lg);
  padding: 18px 20px; margin-bottom: 16px;
}
.stats h2 { font-size: 1rem; margin: 0 0 14px; }
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 14px;
}
.stat .sk {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--on-surface-variant);
}
.stat .sv { font-size: 1.25rem; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .sv.neg { color: var(--error); }
.stat .sv.pos { color: var(--success); }
.stats-note {
  margin: 14px 0 0; font-size: 0.8rem; color: var(--on-surface-variant);
  padding-top: 12px; border-top: 1px solid var(--outline-variant);
}

/* Contribution bar — how much of the pot each member holds. */
.share-bar {
  height: 6px; border-radius: 999px; margin-top: 8px;
  background: var(--surface-container-high); overflow: hidden;
}
.share-bar > span { display: block; height: 100%; background: var(--primary); }

/* ── Payment confirmation ────────────────────────────────────────────────
   "Says sent" is its own state, not a shade of unpaid. It is the member's
   word on record, waiting on the captain — the disagreement made visible. */
.pill.awaiting {
  background: transparent;
  color: var(--on-surface);
  border: 1px dashed var(--outline);
}

.row-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 16px; }
.row-actions .btn { width: auto; flex: 1 1 auto; }

/* Bottom sheet — reachable one-handed on a phone, unlike a centred dialog. */
.sheet {
  width: 100%; max-width: 420px;
  background: var(--surface-container);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex; flex-direction: column; gap: 10px;
  max-height: 90vh; overflow-y: auto;
}
.sheet-title { font-size: 1.15rem; margin: 0 0 4px; }
.sheet-warn {
  margin: 0 0 6px; padding: 12px 14px;
  background: var(--surface); border-left: 3px solid var(--error);
  border-radius: 8px; font-size: 0.9rem; color: var(--on-surface);
}
.btn.danger { background: var(--error); color: var(--surface); border-color: transparent; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 20px); z-index: 200;
  max-width: 90vw; padding: 14px 18px;
  background: var(--on-surface); color: var(--surface);
  border-radius: var(--radius); font-size: 0.9rem;
}

/* Disputed — member says sent, captain says it never arrived. The loudest
   state in the app, because it is the one that needs a human conversation. */
.pill.disputed {
  background: var(--error); color: var(--surface); border: none;
}

/* Consent — must be visibly unticked and deliberately tickable. Never
   pre-checked, never buried: this is the record that a text was asked for. */
.consent {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px; margin-bottom: 16px;
  background: var(--surface); border: 1px solid var(--outline-variant);
  border-radius: var(--radius);
  font-size: 0.85rem; color: var(--on-surface-variant); line-height: 1.45;
}
.consent input[type="checkbox"] {
  width: 22px; height: 22px; min-height: 22px; flex: 0 0 auto; margin-top: 1px;
  accent-color: var(--primary);
}
.consent a { color: var(--primary); }

/* Sits at the bottom of every page — the platform mark, distinct from the
   legal disclaimer above it. */
.legal p { margin: 0 0 10px; }
.powered-by {
  margin: 14px 0 0;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  color: var(--on-surface-variant);
}
.powered-by strong { color: var(--primary); font-weight: 700; }

/* ── Tab bar ─────────────────────────────────────────────────────────────
   Bottom-anchored because that is where a thumb reaches on a phone, and it
   is the native pattern on both iOS and Android. Fixed, so switching never
   costs a scroll. */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface-container);
  border-top: 1px solid var(--outline-variant);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; min-height: 58px; padding: 8px 4px;
  background: none; border: none; cursor: pointer;
  color: var(--on-surface-variant); font-family: inherit;
}
.tab-ico { font-size: 1.15rem; line-height: 1; }
.tab-label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em; }
.tab[aria-current="page"] { color: var(--primary); }
.tab[aria-current="page"] .tab-ico {
  background: var(--primary-container); color: var(--on-primary-container);
  border-radius: 999px; padding: 3px 14px;
}

/* Keep the tab bar from covering the end of a page. */
body.has-tabs main { padding-bottom: 84px; }

.draw-row {
  background: var(--surface-container); border: 1px solid var(--outline-variant);
  border-radius: var(--radius); padding: 14px 16px;
}
.draw-row .when { font-size: 0.8rem; color: var(--on-surface-variant); }
.draw-nums { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.ball {
  width: 38px; height: 38px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.95rem;
  background: var(--surface); border: 2px solid var(--primary);
  color: var(--on-surface); font-variant-numeric: tabular-nums;
}
.ball.bonus { background: var(--gold); border-color: var(--gold); color: #3B2A00; }

/* ── Share gauge ────────────────────────────────────────────────────────── */
.gauge {
  display: flex; align-items: center; gap: 18px;
  background: var(--surface-container); border: 1px solid var(--outline-variant);
  border-radius: var(--radius-lg); padding: 18px 20px; margin: 16px 0;
}
.gauge svg { width: 118px; height: 118px; flex: 0 0 auto; }
.gauge-track { fill: none; stroke: var(--surface-container-high); stroke-width: 13; }
.gauge-fill {
  fill: none; stroke: var(--primary); stroke-width: 13; stroke-linecap: round;
  transition: stroke-dasharray 400ms ease;
}
.gauge-pct {
  font-size: 25px; font-weight: 700; text-anchor: middle;
  fill: var(--on-surface); font-family: inherit;
}
.gauge-cap {
  font-size: 10px; text-anchor: middle; fill: var(--on-surface-variant);
  font-family: inherit; letter-spacing: 0.04em; text-transform: uppercase;
}
.gauge-note { min-width: 0; }
.gauge-line { font-weight: 700; font-size: 1.05rem; }
.gauge-sub { font-size: 0.85rem; color: var(--on-surface-variant); margin-top: 6px; }
.sheet-hint { margin: 0 0 8px; font-size: 0.85rem; color: var(--on-surface-variant); }
@media (prefers-reduced-motion: reduce) { .gauge-fill { transition: none; } }

/* ── Countdown clock ────────────────────────────────────────────────────
   Tabular figures so digits do not shift width as they tick. */
.cd-clock {
  display: flex; align-items: flex-start; gap: 6px;
  margin: 10px 0 6px;
}
.cd-unit { display: flex; flex-direction: column; align-items: center; min-width: 46px; }
.cd-num {
  font-size: 2rem; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}
.cd-u {
  font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--on-surface-variant); margin-top: 4px;
}
.cd-sep {
  font-size: 1.6rem; font-weight: 700; line-height: 1.1;
  color: var(--outline);
}
.countdown.critical .cd-num { color: var(--error); }
.countdown.drawn .cd-num { color: var(--on-surface-variant); }

/* Milliseconds sit smaller — present for precision, not competing with the
   numbers a person actually acts on. */
.cd-ms { min-width: 40px; }
.cd-ms .cd-num { font-size: 1.15rem; opacity: 0.7; padding-top: 9px; }
@media (max-width: 360px) { .cd-ms { display: none; } }

/* ── Select control ──────────────────────────────────────────────────────
   Replaces the native <select> popup, which the OS draws over the field in
   the top-left corner and which no CSS can move. The trigger is styled to be
   indistinguishable from a text input, and the list matches its width and
   font exactly — a picker that changes size or typeface reads as a different
   app appearing on top of yours. */
.native-select-hidden {
  position: absolute; width: 1px; height: 1px;
  opacity: 0; pointer-events: none; margin: 0; padding: 0; border: 0;
}
.sel { position: relative; display: block; }

.sel-trigger {
  /* Deliberately identical to `input, select` above. */
  width: 100%; min-height: var(--tap);
  padding: 12px 14px;
  font-size: 1rem; font-family: inherit; font-weight: 400;
  text-align: left;
  color: var(--on-surface);
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: var(--radius);
  cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.sel-trigger[aria-expanded="true"] { border-color: var(--primary); }
.sel-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel-caret { color: var(--on-surface-variant); font-size: 1.1rem; line-height: 1; flex: 0 0 auto; }

/* Fixed, and positioned in JS from the trigger's own rect, so a card with
   overflow can never clip it and it always belongs to its field. */
.sel-list {
  position: fixed; z-index: 300;
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface-container);
  border: 1px solid var(--outline);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  padding: 6px;
}
.sel-option {
  /* Same font and size as the trigger — the value must not appear to change
     shape between the closed and open states. */
  min-height: var(--tap);
  display: flex; align-items: center;
  padding: 11px 14px;
  font-size: 1rem; font-family: inherit;
  color: var(--on-surface);
  border-radius: 10px;
  cursor: pointer;
}
.sel-option:hover, .sel-option.active { background: var(--surface-container-high); }
.sel-option[aria-selected="true"] {
  background: var(--primary-container);
  color: var(--on-primary-container);
  font-weight: 600;
}
@media (prefers-reduced-motion: reduce) { .sel-list { box-shadow: none; } }

/* ── Draw date picker ────────────────────────────────────────────────────
   Real draws as tappable rows. An open calendar would accept a Tuesday for
   Powerball, which does not draw on Tuesdays. */
.schedule-note {
  margin: 0 0 10px; font-size: 0.85rem; color: var(--on-surface-variant);
}
.draw-picker { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.draw-chip {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: var(--tap); padding: 12px 16px;
  font-family: inherit; font-size: 1rem; text-align: left;
  color: var(--on-surface); background: var(--surface);
  border: 1px solid var(--outline); border-radius: var(--radius);
  cursor: pointer;
}
.draw-chip .chip-day { font-weight: 600; }
.draw-chip .chip-rel { font-size: 0.85rem; color: var(--on-surface-variant); white-space: nowrap; }
.draw-chip.chosen {
  background: var(--primary-container); border-color: var(--primary);
  color: var(--on-primary-container);
}
.draw-chip.chosen .chip-rel { color: var(--on-primary-container); opacity: 0.8; }

/* ── Trial banner ────────────────────────────────────────────────────────
   Dismissible, and it uses the app's own colours rather than an alarm-red
   gradient. A banner a captain cannot get rid of does not convert them — it
   teaches them to stop opening the app. */
.trial-banner {
  position: sticky; top: 0; z-index: 60;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center; gap: 10px;
  padding: 12px 14px 14px;
  background: var(--primary-container);
  color: var(--on-primary-container);
  border-bottom: 1px solid var(--outline-variant);
  font-size: 0.88rem; line-height: 1.4;
}
.trial-banner.urgent {
  background: var(--gold);
  color: #3B2A00;
}
.tb-main { min-width: 0; }
.tb-cta {
  min-height: 38px; padding: 8px 16px;
  border: none; border-radius: 999px; cursor: pointer;
  background: var(--on-primary-container); color: var(--primary-container);
  font-family: inherit; font-size: 0.85rem; font-weight: 700; white-space: nowrap;
}
.trial-banner.urgent .tb-cta { background: #3B2A00; color: var(--gold); }
.tb-close {
  min-width: 34px; min-height: 34px;
  background: none; border: none; cursor: pointer;
  color: inherit; opacity: 0.6; font-size: 1rem;
}
.tb-close:hover { opacity: 1; }
.tb-track {
  grid-column: 1 / -1; height: 3px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.15); overflow: hidden;
}
.tb-track > span { display: block; height: 100%; background: currentColor; opacity: 0.55; }

/* ── Upgrade sheet ─────────────────────────────────────────────────────── */
.upgrade-sheet { gap: 14px; }
.upg-price { text-align: center; padding: 6px 0 2px; }
.upg-amount { font-size: 2.4rem; font-weight: 800; line-height: 1; }
.upg-per { font-size: 0.9rem; color: var(--on-surface-variant); margin-top: 6px; }
.upg-save {
  display: inline-block; margin-top: 10px; padding: 5px 12px;
  border-radius: 999px; font-size: 0.8rem; font-weight: 700;
  background: var(--primary-container); color: var(--on-primary-container);
}
.upg-list { list-style: none; padding: 0; margin: 0; font-size: 0.92rem; }
.upg-list li { padding: 7px 0 7px 22px; position: relative; }
.upg-list li::before { content: '✓'; position: absolute; left: 0; color: var(--primary); font-weight: 700; }
.sheet-warn {
  margin: 0; padding: 11px 13px; border-radius: 8px; font-size: 0.85rem;
  background: var(--surface); border-left: 3px solid var(--gold);
  color: var(--on-surface-variant);
}

/* ── paper import review ─────────────────────────────────────────────── */
.paper-table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.paper-table td { padding: 7px 4px; border-bottom: 1px solid var(--outline-variant); }
.paper-table input[type="text"] { width: 100%; padding: 8px; font-size: 16px;
  border: 1px solid var(--outline); border-radius: 8px; background: var(--surface);
  color: var(--on-surface); }
.paper-table td.amount { width: 34%; }
.paper-table tr.review input { border-color: var(--gold); }
.paper-flag { font-size: 0.72rem; color: var(--on-surface-variant); display: block; margin-top: 3px; }
