/* Wallet Ledger: "wallet & ledger".
   The one bold element is the wallet of card faces (ID-1 proportions, 85.60 x 53.98 mm).
   Everything else is quiet ledger typography: amounts in a ruled money column, losses in
   ledger red, gains in banknote green, and figures resting on estimates "pencilled in"
   (a dotted graphite underline) while checked figures are plain ink. */

@font-face {
  font-family: "Archivo";
  src: url("/fonts/archivo-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

/* Tokens: the values below mirror the Wallet Ledger design system (tokens.json). Change them there first. */
:root {
  color-scheme: light;
  --paper: #f2f4f0;       /* cool ruled-ledger paper, the page */
  --sheet: #ffffff;       /* a sheet laid on it; label colour on an ink fill */
  --ink: #1b2a44;         /* blue-black ink: text, checked figures */
  --ink-soft: #3f4c63;
  --pencil: #646b75;      /* graphite: secondary text, estimates */
  --rule: #cbd5cd;        /* the faint green ledger rule */
  --rule-strong: #9fb0a4;
  --red: #b03a2e;         /* ledger red: losses */
  --green: #2e6b4e;       /* banknote green: gains */
  --focus: #2f5da8;
  --on-green: #ffffff;
  --alert: #9e2f24;       /* error banner fill, the same in both themes */
  --on-alert: #ffffff;
  --scrim: rgba(12, 20, 34, 0.62);  /* behind modal dialogs */

  /* Cards: the seven plastics in the order cards are dealt, plus text and warning colour on them. */
  --card-text: #ffffff;
  --card-warn: #ffd7cf;
  --card-sapphire: #243b6b;
  --card-jade: #2d5e54;
  --card-garnet: #6b2737;
  --card-graphite: #3a3d42;
  --card-brass: #6e5626;
  --card-teal: #2f5664;
  --card-plum: #4a3558;
  --card-chip: #b8964e;

  --font: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --t-small: 0.8125rem;   /* 13 */
  --t-fine: 0.875rem;     /* 14 */
  --t-body: 1rem;         /* 16 */
  --t-lead: 1.125rem;     /* 18 */
  --t-h2: 1.3125rem;      /* 21 */
  --t-h1: 1.75rem;        /* 28 */
  --t-display: clamp(2.5rem, 6vw, 3.5rem); /* 40-56 */

  --space-1: 0.25rem;     /* 4 */
  --space-2: 0.5rem;      /* 8 */
  --space-3: 0.75rem;     /* 12 */
  --space-4: 1rem;        /* 16 */
  --space-5: 1.25rem;     /* 20 */
  --space-6: 1.75rem;     /* 28 */
  --space-7: 2.5rem;      /* 40 */
  --space-8: 3rem;        /* 48 */

  --r-input: 4px;
  --r-button: 6px;
  --r-panel: 10px;
  --r-card: 12px;
  --r-full: 999px;

  --shadow-card: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 12px 24px -16px rgba(10, 20, 40, 0.7);
  --shadow-float: 0 6px 24px rgba(0, 0, 0, 0.25);

  --shell: 72rem;
  --money-col: 7.5rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #152030;
    --sheet: #1c293b;
    --ink: #e7ecf3;
    --ink-soft: #b8c2d0;
    --pencil: #9aa5b3;
    --rule: #2e3d52;
    --rule-strong: #4a5d78;
    --red: #e8907f;
    --green: #7cc4a0;
    --focus: #8fb3f0;
    --on-green: #152030;
  }
}

/* --- base ------------------------------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--t-body)/1.5 var(--font);
  font-stretch: 100%;
  font-variant-numeric: tabular-nums lining-nums;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 650; }
h2 { font-size: var(--t-h2); }
h3 { font-size: var(--t-body); }
p { margin: 0 0 var(--space-3); }
a { color: inherit; text-decoration-color: var(--rule-strong); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-input); }
[hidden] { display: none !important; }
code, .key { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.95em; }

.shell { max-width: var(--shell); margin: 0 auto; padding: 0 var(--space-5); }
.muted { color: var(--pencil); font-size: var(--t-fine); }
.warn { color: var(--red); }
.err { color: var(--red); font-size: var(--t-fine); }
.err:empty { display: none; }
.section-lede { color: var(--pencil); font-size: var(--t-fine); max-width: 60ch; }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.skip-link { position: absolute; left: 0.5rem; top: -4rem; z-index: 10; padding: var(--space-2) var(--space-4); background: var(--sheet); color: var(--ink); border: 2px solid var(--ink); border-radius: var(--r-button); }
.skip-link:focus { top: 0.5rem; }
main:focus { outline: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* --- controls -------------------------------------------------------------------- */

button {
  font: 600 var(--t-fine)/1.2 var(--font);
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-button);
  padding: var(--space-2) var(--space-4);
  cursor: pointer;
}
button:hover { border-color: var(--ink); }
button:disabled { opacity: 0.45; cursor: not-allowed; border-color: var(--rule-strong); }
button.primary, #ob-save, #login-form button[type=submit], #signup-form button[type=submit],
#reset-form button[type=submit], #recovery-ack, #import-save, .update-offer .apply-update {
  background: var(--ink); color: var(--sheet); border-color: var(--ink);
}
button.primary:hover:not(:disabled), #ob-save:hover { background: var(--ink-soft); border-color: var(--ink-soft); }
button.link {
  border: 0; padding: 0; background: none; font-weight: 500; text-decoration: underline;
  text-decoration-color: var(--rule-strong); text-underline-offset: 0.18em;
}

/* Money is written on the line, the way you'd fill in a ledger. */
input, select, textarea { font: inherit; color: var(--ink); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input:not([type]) {
  background: transparent;
  border: 0;
  border-bottom: 1.5px solid var(--rule-strong);
  border-radius: 0;
  padding: var(--space-2) var(--space-1);
  min-width: 0;
}
input:focus { border-bottom-color: var(--focus); outline: none; box-shadow: 0 1.5px 0 var(--focus); }
input:focus-visible { outline: none; }
input::placeholder { color: var(--pencil); opacity: 0.8; }
select {
  background: var(--sheet); border: 1px solid var(--rule-strong); border-radius: var(--r-input);
  padding: var(--space-2) var(--space-2); max-width: 100%;
}
input[type=checkbox], input[type=radio] { accent-color: var(--ink); width: 1.05rem; height: 1.05rem; vertical-align: -0.15em; }
input[type=file] { font-size: var(--t-fine); }
form { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); align-items: flex-end; margin: var(--space-3) 0; }
.field { display: flex; flex-direction: column; gap: var(--space-1); font-size: var(--t-fine); color: var(--ink-soft); flex: 1 1 12rem; }
.field input { color: var(--ink); font-size: var(--t-body); }

/* --- tables (ruled like a ledger page) ---------------------------------------------- */

table { width: 100%; border-collapse: collapse; font-size: var(--t-fine); margin: var(--space-2) 0 var(--space-5); }
th {
  text-align: left; font-weight: 600; font-size: var(--t-small); color: var(--ink-soft);
  border-bottom: 1.5px solid var(--rule-strong); padding: var(--space-2) var(--space-2); vertical-align: bottom;
}
td { border-bottom: 1px solid var(--rule); padding: var(--space-2) var(--space-2); vertical-align: middle; }
.money { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* A note under a figure ("includes 10,945 from planned flying…") is prose, not a number: let it wrap instead of widening the column past the screen. */
#as-standing .money > .muted { display: block; white-space: normal; min-width: 11rem; max-width: 18rem; margin-left: auto; }
td.headline, .headline { font-weight: 650; }

/* --- masthead ---------------------------------------------------------------------- */

.masthead { border-bottom: 1px solid var(--rule); background: var(--paper); }
.masthead-inner { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); align-items: baseline; justify-content: space-between; padding-top: var(--space-4); padding-bottom: var(--space-4); }
.wordmark { font-size: var(--t-lead); font-weight: 760; font-stretch: 125%; letter-spacing: -0.005em; margin: 0; }
.masthead nav { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-5); align-items: baseline; font-size: var(--t-fine); }
.masthead nav .whoami { color: var(--pencil); }

/* --- notices ------------------------------------------------------------------------- */

#page-error {
  position: sticky; top: 0; z-index: 20; margin: 0; padding: var(--space-3) var(--space-5);
  background: var(--alert); color: var(--on-alert); font-size: var(--t-fine); /* fixed: must stay legible in both themes */
}
#page-error .muted { color: var(--on-alert); opacity: 0.85; }
#page-error button { margin-left: var(--space-3); color: var(--on-alert); border-color: var(--on-alert); }

.notice, #setup-banner, .update-offer, #ob-notice {
  background: var(--sheet); border: 1px solid var(--rule); border-left: 4px solid var(--ink);
  border-radius: var(--r-input); padding: var(--space-3) var(--space-4); margin: var(--space-5) 0 0;
}
#setup-banner { align-items: center; justify-content: space-between; gap: var(--space-3) var(--space-5); flex-wrap: wrap; }
#setup-banner .banner-text { flex: 1 1 24rem; }
#setup-banner .banner-actions { display: flex; gap: var(--space-4); align-items: center; flex: none; }
.update-offer { border-left-color: var(--green); }
#ob-notice { border-left-color: var(--green); margin: 0 0 var(--space-5); }
/* Hidden until the page knows who's logged in (checkSession) or has something to say. */
#app, #auth, #email-gate, #onboarding, #setup-banner, #catalog-updates, #default-changes, #ob-notice, #page-error { display: none; }
#updates[hidden] { display: none; }

/* --- dashboard: hero ----------------------------------------------------------------- */

.hero { padding: var(--space-7) 0 var(--space-5); }
/* The one-time note after setup: what to read first. Shown until it is dismissed; no entrance motion. */
.first-look { margin: 0 0 var(--space-6); padding: var(--space-4) var(--space-5); max-width: 44rem; border: 1px solid var(--rule-strong); border-left: 4px solid var(--ink); background: var(--sheet); }
.first-look[hidden] { display: none; }
.first-look h2 { margin: 0 0 var(--space-1); font-size: var(--t-lead); }
.first-look h2:focus { outline: none; }
.first-look p { margin: 0 0 var(--space-3); }
.yearly { font-size: var(--t-lead); color: var(--ink-soft); margin: 0; max-width: 46rem; }
.yearly-lead { display: block; margin-bottom: var(--space-1); }
.yearly strong {
  color: var(--ink);
  font-size: var(--t-display); font-weight: 760; font-stretch: 125%;
  letter-spacing: -0.015em; line-height: 1.05;
}
.yearly-per { font-size: var(--t-h2); font-weight: 600; font-stretch: 110%; color: var(--ink); margin-left: var(--space-2); white-space: nowrap; }
.pencil-key { display: block; margin-top: var(--space-2); font-size: var(--t-fine); color: var(--pencil); }

/* Figures resting on estimates are pencilled in. */
.pencilled {
  text-decoration: underline dotted var(--pencil);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

/* --- dashboard: layout ----------------------------------------------------------------- */

.advice-grid {
  display: grid; gap: 0 var(--space-8);
  grid-template-columns: minmax(0, 1fr) minmax(18rem, 22.5rem);
  grid-template-areas: "todo wallet" "fixes wallet";
  /* The wallet spans all three rows; without this a tall wallet stretches "What to do"
     and leaves a gap above "Double-check these". The last row takes the slack. */
  grid-template-rows: auto 1fr;
  align-items: start;
}
/* The page lists the wallet, the advice, then the double-checks: the order a phone shows them
   in, so keyboard and screen-reader order match what is on screen. The areas place them side by side on a desktop. */
.advice-todo { grid-area: todo; }
.advice-fixes { grid-area: fixes; padding-top: var(--space-5); }
.advice-wallet { grid-area: wallet; position: sticky; top: 1rem; }
.advice-grid h2 { margin-bottom: var(--space-2); }

/* On a wide screen the wallet gets two columns of cards, so a long wallet ends about where the advice beside it does. */
@media (min-width: 72rem) {
  .advice-grid { grid-template-columns: minmax(0, 1fr) minmax(30rem, 34rem); }
}

@media (max-width: 56rem) {
  .advice-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "wallet" "todo" "fixes"; grid-template-rows: none; }
  .advice-wallet { position: static; margin-bottom: var(--space-5); }
}

/* --- dashboard: ledger rows ------------------------------------------------------------- */

.rec {
  display: grid; grid-template-columns: var(--money-col) minmax(0, 1fr); column-gap: var(--space-5);
  padding: var(--space-4) 0; border-top: 1px solid var(--rule);
}
.rec:last-child { border-bottom: 1px solid var(--rule); }
.rec-amount {
  text-align: right; padding-right: var(--space-5); border-right: 1.5px solid var(--rule-strong);
  font-weight: 700; font-size: var(--t-lead); font-stretch: 112%; line-height: 1.25; white-space: nowrap;
}
.rec-amount .per { display: block; font-size: var(--t-small); font-weight: 450; font-stretch: 100%; color: var(--pencil); margin-top: var(--space-1); }
.rec.bad .rec-amount { color: var(--red); }
.rec.good .rec-amount { color: var(--green); }
.rec-body h3 { font-size: var(--t-body); font-weight: 650; margin: var(--space-1) 0 var(--space-1); }
.rec-body p { margin: 0 0 var(--space-2); color: var(--ink-soft); max-width: 62ch; }
.rec-body ul { margin: var(--space-1) 0 var(--space-2); padding-left: var(--space-4); font-size: var(--t-fine); color: var(--pencil); max-width: 62ch; }
.rec-body li { margin: var(--space-1) 0; }
.rec-action { margin: var(--space-1) var(--space-2) 0 0; }
#advice.no-cards .advice-wallet, #advice.no-cards .advice-todo, #advice.no-cards .advice-fixes { display: none; }
.rec-empty { padding: var(--space-4) 0; border-top: 1px solid var(--rule); color: var(--ink-soft); }
.more-row { padding: var(--space-3) 0 0; font-size: var(--t-fine); color: var(--pencil); }

@media (max-width: 30rem) {
  .rec { grid-template-columns: minmax(0, 1fr); row-gap: var(--space-1); }
  .rec-amount { text-align: left; border-right: 0; padding: 0; display: flex; gap: var(--space-2); align-items: baseline; }
  .rec-amount .per { display: inline; margin: 0; }
  .masthead nav .whoami { display: none; }
}

/* --- dashboard: the wallet ---------------------------------------------------------------- */

.wallet-stack { display: flex; flex-direction: column; gap: var(--space-4); padding-top: var(--space-2); }
@media (min-width: 72rem) { .wallet-stack { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } }
/* The card is its own size container, so its corner radius can be a true 3.7% of its width. */
.wallet-card { position: relative; container-type: inline-size; }
.card-face {
  /* ID-1: 85.60 x 53.98 mm; corner radius 3.18 mm, i.e. 3.7% of the width. */
  aspect-ratio: 85.6 / 53.98;
  border-radius: var(--r-card);
  display: flex; flex-direction: column; justify-content: space-between; gap: var(--space-2);
  padding: var(--space-4) var(--space-4) var(--space-4);
  color: var(--card-text);
  background:
    radial-gradient(120% 90% at 100% 0%, rgb(255 255 255 / 0.14), transparent 55%),
    linear-gradient(160deg, var(--plastic), color-mix(in oklab, var(--plastic) 72%, #000));
  box-shadow: var(--shadow-card);
  overflow: hidden;
  position: relative;
}
.wallet-card .card-face { border-radius: 3.7cqw; }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-3); }
.card-name { font-size: var(--t-body); font-weight: 700; font-stretch: 118%; line-height: 1.15; letter-spacing: 0.005em; }
.card-chip {
  flex: none; width: 2.1rem; height: 1.55rem; border-radius: var(--r-input); margin-top: var(--space-1);
  background:
    linear-gradient(90deg, transparent 32%, rgb(0 0 0 / 0.18) 33% 35%, transparent 36% 64%, rgb(0 0 0 / 0.18) 65% 67%, transparent 68%),
    linear-gradient(0deg, transparent 45%, rgb(0 0 0 / 0.18) 46% 54%, transparent 55%),
    linear-gradient(135deg, #e4cf8f, var(--card-chip));
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.2) inset;
}
.card-uses { font-size: var(--t-body); font-weight: 620; font-stretch: 104%; line-height: 1.3; }
.card-uses .lbl { display: block; font-size: var(--t-small); font-weight: 450; font-stretch: 100%; margin-bottom: var(--space-1); }
.card-uses .none { font-size: var(--t-fine); font-weight: 450; font-style: italic; }
.card-foot { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); }
.card-foot .edit-card { margin-left: auto; }
.card-more { background: none; border: 0; padding: 0; font: inherit; font-size: var(--t-small); font-weight: 450; color: var(--card-text); text-decoration: underline; text-decoration-color: rgb(255 255 255 / 0.5); cursor: pointer; }
.card-more-panel {
  position: absolute; inset: 0; z-index: 1; overflow: auto; box-sizing: border-box;
  display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4) var(--space-4) var(--space-4);
  background: color-mix(in oklab, var(--plastic) 78%, #000); font-size: var(--t-small); line-height: 1.35;
}
.card-more-panel[hidden] { display: none; }
.card-more-panel .lbl { font-weight: 450; opacity: 0.85; }
.card-more-close { align-self: flex-end; margin-top: auto; background: none; border: 1px solid rgb(255 255 255 / 0.6); border-radius: var(--r-button); color: var(--card-text); font: inherit; padding: var(--space-1) var(--space-3); cursor: pointer; }
.card-worth { font-size: var(--t-fine); font-weight: 650; font-stretch: 112%; }
.card-worth.bad { color: var(--card-warn); }
.card-face .edit-card { color: var(--card-text); font-size: var(--t-small); text-decoration-color: rgb(255 255 255 / 0.5); }
.card-face .pencilled { text-decoration-color: rgb(255 255 255 / 0.6); }

/* Card plastics: deep, distinct, assigned per card. */
.plastic-0 { --plastic: var(--card-sapphire); }  /* sapphire */
.plastic-1 { --plastic: var(--card-jade); }  /* jade */
.plastic-2 { --plastic: var(--card-garnet); }  /* garnet */
.plastic-3 { --plastic: var(--card-graphite); }  /* graphite */
.plastic-4 { --plastic: var(--card-brass); }  /* brass */
.plastic-5 { --plastic: var(--card-teal); }  /* teal */
.plastic-6 { --plastic: var(--card-plum); }  /* plum */

/* Narrow cards (the phone strip) tighten their type rather than overflow their proportions. */
@container (max-width: 20rem) {
  .card-face { padding: var(--space-3) var(--space-4) var(--space-3); gap: var(--space-1); }
  .card-name { font-size: var(--t-fine); }
  .card-uses { font-size: var(--t-fine); }
  .card-worth, .card-uses .none { font-size: var(--t-small); }
  .card-chip { width: 1.75rem; height: 1.3rem; }
}

.wallet-slot {
  border: 1.5px dashed var(--rule-strong); border-radius: var(--r-card); padding: var(--space-4) var(--space-4);
  color: var(--ink-soft); font-size: var(--t-fine);
}

/* Cards are dealt into the wallet once, on load. Nothing else on the page moves by itself. */
@media (prefers-reduced-motion: no-preference) {
  .wallet-card.deal { animation: deal 420ms cubic-bezier(0.2, 0.7, 0.2, 1) both; animation-delay: calc(var(--i, 0) * 70ms); }
  @keyframes deal {
    from { opacity: 0; transform: translateY(-14px) rotate(-1.5deg); }
    to { opacity: 1; transform: none; }
  }
}

@media (max-width: 56rem) {
  /* On a phone the wallet is a strip you swipe through, right under the total. */
  .wallet-stack {
    flex-direction: row; overflow-x: auto; scroll-snap-type: x mandatory; gap: var(--space-3);
    padding: var(--space-2) var(--space-5) var(--space-3); margin: 0 calc(var(--space-5) * -1); scroll-padding: 0 var(--space-5);
  }
  .wallet-stack > * { flex: 0 0 min(82%, 21rem); scroll-snap-align: start; }
}

/* Long notes collapse to their first sentence. */
.collapsible .more-toggle { white-space: nowrap; }

/* --- dashboard: the math ----------------------------------------------------------------- */

.math-toggle { margin: var(--space-7) 0 0; padding-top: var(--space-5); border-top: 1px solid var(--rule); }
#math { padding: var(--space-2) 0 var(--space-4); }
#math h2, #admin-invites h2 { margin: var(--space-6) 0 var(--space-2); }
#math h3 { margin: var(--space-5) 0 var(--space-1); font-size: var(--t-body); }
#math ul { padding-left: var(--space-4); }
#math li { margin: var(--space-1) 0; }
.verify-form { display: inline-flex; margin: 0 0 0 var(--space-2); gap: var(--space-2); align-items: baseline; }
.verify-form input { width: 7rem; }
#admin-invites { margin: var(--space-6) 0 var(--space-8); padding-top: var(--space-2); border-top: 1px solid var(--rule); }
#new-invite { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
#new-invite .key { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-input); padding: var(--space-2) var(--space-3); word-break: break-all; }
#app main { padding-bottom: var(--space-8); }

/* --- auth ---------------------------------------------------------------------------------- */

#auth { min-height: 100vh; }
.auth-grid {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: var(--space-8);
  align-items: center; min-height: 100vh; padding-top: var(--space-6); padding-bottom: var(--space-6);
}
.auth-pitch h1 { font-size: var(--t-display); font-weight: 760; font-stretch: 125%; letter-spacing: -0.015em; line-height: 1.02; }
.auth-pitch .lead { font-size: var(--t-lead); color: var(--ink-soft); margin: var(--space-4) 0 0; max-width: 32rem; }
.auth-pitch .promise { font-size: var(--t-fine); color: var(--pencil); margin-top: var(--space-4); max-width: 30rem; }
.auth-fan { position: relative; height: 11rem; margin: var(--space-7) 0 var(--space-7); max-width: 22rem; }
.auth-fan .card-face { position: absolute; width: 15rem; aspect-ratio: 85.6 / 53.98; padding: 0; border-radius: 0.55rem; }
.auth-fan .card-face:nth-child(1) { left: 0; top: 1.4rem; transform: rotate(-7deg); }
.auth-fan .card-face:nth-child(2) { left: 3.2rem; top: 0.5rem; transform: rotate(-1deg); }
.auth-fan .card-face:nth-child(3) { left: 6.4rem; top: 1.6rem; transform: rotate(6deg); }
.auth-fan .card-chip { position: absolute; left: 1.1rem; top: 1.4rem; }
.auth-panel { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-panel); padding: var(--space-6); }
.auth-panel h2 { margin-bottom: var(--space-1); }
.auth-panel form { flex-direction: column; align-items: stretch; gap: var(--space-4); margin-top: var(--space-4); }
.auth-panel .field { flex: none; }
.auth-panel form button[type=submit] { align-self: flex-start; margin-top: var(--space-1); }
.auth-switch { margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--rule); font-size: var(--t-fine); color: var(--ink-soft); }

@media (max-width: 48rem) {
  .auth-grid { grid-template-columns: minmax(0, 1fr); gap: var(--space-6); align-items: start; min-height: 0; }
  .auth-fan { height: 8.5rem; }
  .auth-fan .card-face { width: 11rem; }
  .auth-fan .card-face:nth-child(2) { left: 2.4rem; }
  .auth-fan .card-face:nth-child(3) { left: 4.8rem; }
}

/* --- recovery key dialog ------------------------------------------------------------------ */

#recovery-modal { display: none; position: fixed; inset: 0; z-index: 30; background: var(--scrim); align-items: center; justify-content: center; padding: var(--space-4); }
#recovery-modal .box { background: var(--sheet); color: var(--ink); max-width: 34rem; width: 100%; border-radius: var(--r-panel); padding: var(--space-6); max-height: 100%; overflow: auto; }
#recovery-modal h2 { margin-bottom: var(--space-2); }
#recovery-modal .key {
  display: block; font-size: var(--t-body); letter-spacing: 0.01em; word-break: break-all;
  background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-input); padding: var(--space-3) var(--space-4); margin: var(--space-4) 0;
}
#recovery-modal .actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin-bottom: var(--space-4); }
#recovery-confirm { width: 100%; margin-bottom: var(--space-4); }

/* --- setup guide ---------------------------------------------------------------------------- */

.setup { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: var(--space-7); padding-top: var(--space-6); padding-bottom: var(--space-8); align-items: start; }
.setup-rail { position: sticky; top: 1rem; }
.setup-rail .rail-intro { font-size: var(--t-fine); color: var(--pencil); }

/* The steps really are a sequence, least effort first, so they're numbered. */
#ob-steps { display: flex; flex-direction: column; gap: var(--space-1); counter-reset: step; margin-top: var(--space-3); }
.ob-step {
  counter-increment: step;
  display: grid; grid-template-columns: 1.75rem 1fr; column-gap: var(--space-2); align-items: start;
  text-align: left; border: 0; border-radius: var(--r-button); padding: var(--space-2) var(--space-2);
  font-weight: 500; font-size: var(--t-fine); color: var(--ink-soft); background: none;
}
.ob-step::before {
  content: counter(step);
  grid-row: span 2;
  width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center;
  border: 1.5px solid var(--rule-strong); font-size: var(--t-small); font-weight: 650; color: var(--ink-soft);
}
.ob-step.done::before { content: "\2713"; background: var(--green); border-color: var(--green); color: var(--on-green); }
.ob-step.current { background: var(--sheet); color: var(--ink); font-weight: 650; box-shadow: 0 0 0 1px var(--rule); }
.ob-step.current::before { border-color: var(--ink); color: var(--ink); }
.ob-step.done.current::before { color: var(--on-green); }
.ob-step .step-meta { font-size: var(--t-small); font-weight: 400; color: var(--pencil); }
.ob-step[data-key="finish"]::before { content: "\2605"; }
.ob-check { display: none; }

.setup-main { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-panel); padding: var(--space-6) var(--space-6) 0; min-width: 0; }
#ob-heading { font-size: var(--t-h1); font-weight: 720; font-stretch: 112%; letter-spacing: -0.01em; }
#ob-unlocks { color: var(--ink-soft); margin: var(--space-2) 0 var(--space-5); max-width: 62ch; }
#ob-body h3 { font-size: var(--t-lead); margin: var(--space-6) 0 var(--space-1); }
#ob-body h3:first-child { margin-top: 0; }
#ob-body > p, #ob-body .ob-card > p { max-width: 64ch; }
#ob-body table { margin: var(--space-1) 0 var(--space-3); }
.ob-footer {
  position: sticky; bottom: 0; background: var(--sheet); border-top: 1px solid var(--rule);
  display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; margin: var(--space-6) calc(var(--space-6) * -1) 0; padding: var(--space-4) var(--space-6);
  border-radius: 0 0 var(--r-panel) var(--r-panel);
}
#ob-error { margin: var(--space-4) 0 0; }

.ob-card { border: 1px solid var(--rule); border-radius: var(--r-panel); margin: var(--space-4) 0; padding: var(--space-2) var(--space-4) var(--space-4); min-width: 0; }
.ob-card legend { font-weight: 700; font-stretch: 112%; padding: 0 var(--space-2); margin-left: calc(var(--space-2) * -1); }
.ob-card label { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1); margin: var(--space-2) var(--space-5) var(--space-2) 0; color: var(--ink-soft); }
.ob-card label input { color: var(--ink); }
.ob-card label.check { display: flex; margin-top: var(--space-3); color: var(--ink); }
.ob-card h3 { margin: var(--space-4) 0 var(--space-1); font-size: var(--t-fine); }
.ob-card details { margin: var(--space-2) 0; }
.ob-how { margin: 0 0 var(--space-3); }
.ob-result { font-size: var(--t-lead); line-height: 1.45; max-width: 36rem; }
/* A link inside a sentence reads as part of it: same size, on the line, no button box. */
button.link.ob-later-step { display: inline; min-height: 0; margin: 0; padding: 0; font: inherit; font-weight: 500; line-height: inherit; vertical-align: baseline; }
.ob-card summary { cursor: pointer; color: var(--ink-soft); font-size: var(--t-fine); }
.hint { background: var(--paper); border-left: 3px solid var(--rule-strong); padding: var(--space-3) var(--space-4); margin: var(--space-3) 0; font-size: var(--t-fine); color: var(--ink-soft); max-width: 70ch; }

.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-2) 0; }
.chip { display: inline-flex; align-items: center; gap: var(--space-1); border: 1px solid var(--rule-strong); border-radius: var(--r-full); padding: var(--space-1) var(--space-2) var(--space-1) var(--space-3); font-size: var(--t-fine); background: var(--sheet); }
.chip a { text-decoration: none; color: var(--pencil); width: 1.35rem; height: 1.35rem; display: grid; place-items: center; border-radius: 50%; }
.chip a:hover { background: var(--paper); color: var(--red); }
.add-cat { border-style: dashed; margin: 0 var(--space-1) var(--space-1) 0; }

#rate-grid { font-size: var(--t-fine); }
#rate-grid thead th { font-size: var(--t-small); min-width: 5.5rem; }
#rate-grid tbody th { position: sticky; left: 0; background: var(--sheet); font-weight: 650; font-size: var(--t-fine); color: var(--ink); border-bottom: 1px solid var(--rule); min-width: 9rem; }
#rate-grid thead th:first-child { position: sticky; left: 0; background: var(--sheet); }
#rate-grid input { width: 4.25rem; text-align: right; }
#rate-grid tbody th, #rate-grid td { vertical-align: middle; }

#import-map tr.needs-choice td { background: color-mix(in oklab, var(--red) 9%, var(--sheet)); }
.import-cols { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-5); margin: var(--space-3) 0; }
.import-cols label { display: flex; flex-direction: column; gap: var(--space-1); font-size: var(--t-fine); color: var(--ink-soft); }
.import-columns { margin: var(--space-4) 0; }
.import-columns summary { cursor: pointer; font-size: var(--t-fine); color: var(--ink-soft); }

@media (max-width: 56rem) {
  .setup { grid-template-columns: minmax(0, 1fr); gap: var(--space-5); padding-top: var(--space-5); }
  .setup-rail { position: static; }
  #ob-steps { flex-direction: row; flex-wrap: wrap; gap: var(--space-1); }  /* all the steps in view, not a strip to scroll sideways */
  .ob-step { flex: none; display: inline-flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-2); border: 1px solid var(--rule); }
  .ob-step.current { border-color: var(--ink-soft); }
  .ob-step .step-meta { display: none; }
  .ob-step::before { grid-row: auto; }
  .setup-main { padding: var(--space-5) var(--space-4) 0; border-radius: var(--r-panel); }
  .ob-footer { margin: var(--space-5) calc(var(--space-4) * -1) 0; padding: var(--space-3) var(--space-4); }
}

/* Asking for a catalog entry or reporting one: a quiet disclosure, so it never competes with the step itself. */
.feedback { margin: var(--space-1) 0; }
.feedback-form { max-width: 32rem; }
.feedback-form textarea { flex: 1 1 100%; padding: var(--space-2) var(--space-2); border: 1px solid var(--rule-strong); border-radius: var(--r-input); background: var(--sheet); }
.feedback-form .muted { flex-basis: 100%; margin: 0; }
td .feedback summary { white-space: nowrap; }

.reminder-pref { margin: var(--space-3) 0 var(--space-4); }
.reminder-pref label { display: inline-flex; gap: var(--space-2); align-items: center; font-weight: 500; }
.reminder-pref .muted { margin: var(--space-1) 0 0; max-width: 40rem; }
/* On the dashboard it's its own small box under the wallet cards, where it's hard to miss. */

/* --- confirm your email --------------------------------------------------------------------- */

#email-gate { min-height: 100vh; }
.gate { max-width: 38rem; padding-top: 6vh; padding-bottom: var(--space-8); }
.gate h1 { font-size: var(--t-h1); font-weight: 760; letter-spacing: -0.015em; }
.gate .lead { font-size: var(--t-lead); color: var(--ink-soft); }
.gate h1 { margin-bottom: var(--space-3); }
#gate-change-link { margin-left: var(--space-3); }
.inline-form { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-4); align-items: flex-end; margin: var(--space-3) 0; max-width: 40rem; }
#email-nudge:not([hidden]) { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3) var(--space-5); flex-wrap: wrap; }
#email-nudge .banner-text { flex: 1 1 24rem; }
#email-nudge .banner-actions { display: flex; gap: var(--space-4); align-items: center; flex: none; }
#account-panel h2 { margin-top: 0; }

/* --- touch: every control is at least 44px to tap (WCAG 2.5.5); links inside a sentence are exempt ------------------ */

@media (pointer: coarse) {
  button, select, summary, .masthead nav a, #ob-later, td a, .banner-actions a, .ob-step { min-height: 44px; }
  button, select { padding-block: var(--space-2); }
  button.link, summary, .masthead nav a, #ob-later, td a, .banner-actions a { display: inline-flex; align-items: center; }
  button.link, td a { padding-inline: var(--space-1); }
  input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=url], input:not([type]) {
    min-height: 44px; padding-block: var(--space-2);
  }
  /* Links in the admin console's lists (not in a table cell, so `td a` doesn't reach them). */
  .admin li a, .admin-jump a { display: inline-flex; align-items: center; min-height: 44px; }  /* the section links at the top of the console too */
  input[type=checkbox], input[type=radio] { width: 1.4rem; height: 1.4rem; }
  label:has(> input[type=checkbox]), label:has(> input[type=radio]) { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 44px; }
  input[type=file] { min-height: 44px; }
  td a, .banner-actions a, .card-foot a { min-width: 44px; justify-content: center; }
  .card-foot a { display: inline-flex; align-items: center; min-height: 44px; }
  /* The chip stays compact: the 44px tap area overhangs its padding. */
  label.tap { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; }
  .chip a { width: 44px; height: 44px; margin: calc(var(--space-3) * -1) calc(var(--space-2) * -1) calc(var(--space-3) * -1) calc(var(--space-1) * -1); }
}

/* --- card status switch ------------------------------------------------------------------------------------------ */

.status-switch { display: inline-flex; border: 1px solid var(--rule-strong); border-radius: var(--r-button); padding: 0; margin: 0; overflow: hidden; }
.status-switch label { display: block; margin: 0; }
.status-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.status-switch span { display: block; padding: var(--space-2) var(--space-3); font-size: var(--t-small); font-weight: 600; color: var(--ink-soft); cursor: pointer; white-space: nowrap; border-left: 1px solid var(--rule); }
.status-switch label:first-of-type span { border-left: 0; }
.status-switch input:checked + span { background: var(--ink); color: var(--sheet); }
.status-switch input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: -2px; }
tr.canceled td { color: var(--pencil); }
tr.canceled + tr:not(.canceled), tr:not(.canceled) + tr.canceled td { border-top: 1px solid var(--rule-strong); }
.card-status { margin: var(--space-2) 0 0; }
.card-status .status-switch { max-width: 100%; flex-wrap: wrap; }

/* Says what a status change did; empty most of the time, but kept in the page so screen readers hear it. */
#card-status-live { position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); z-index: 25; max-width: min(32rem, calc(100vw - 2rem));
  background: var(--ink); color: var(--sheet); border-radius: var(--r-input); padding: var(--space-3) var(--space-4); font-size: var(--t-fine); box-shadow: var(--shadow-float); }
#card-status-live button.link { color: var(--sheet); margin-left: var(--space-2); }
#card-status-live:empty { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); padding: 0; box-shadow: none; }

@media (pointer: coarse) {
  .status-switch span { padding: var(--space-3) var(--space-3); min-height: 44px; display: flex; align-items: center; }
}

/* In a phone-width table cell the three choices wrap onto a second line rather than run off the edge. */
@media (max-width: 40rem) {
  .status-switch { flex-wrap: wrap; max-width: 15rem; }
  .status-switch label { flex: 1 1 100%; }
  .status-switch span { padding: var(--space-2) var(--space-2); text-align: center; border-left: 0; border-top: 1px solid var(--rule); }
  .status-switch label:first-of-type span { border-top: 0; }
}
@media (pointer: coarse) and (max-width: 40rem) {
  .status-switch span { padding: var(--space-3) var(--space-2); justify-content: center; }
}

/* "Work through these" and the maintainer's "Defaults to review": one item at a time. */
#work-through h2, #review-panel h3 { margin: var(--space-1) 0 var(--space-1); }
#work-through h2:focus, #review-panel h3:focus { outline: none; }
#work-through .link + .link, #review-panel .link + .link { margin-left: var(--space-5); }
.wt-choices { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* A link that looks like the primary button (setup's pointer to the Airline status page). */
a.button {
  display: inline-block; padding: var(--space-2) var(--space-4); border: 1px solid var(--ink); border-radius: var(--r-input);
  background: var(--ink); color: var(--sheet); font-weight: 600; text-decoration: none;
}
a.button:hover { background: var(--ink-soft); border-color: var(--ink-soft); }

/* The Airline status page: breathing room between its sections. */
.airline { padding-bottom: var(--space-8); }
.airline h1 { margin: var(--space-5) 0 var(--space-1); }
.airline h2 { margin: var(--space-7) 0 var(--space-2); }
.airline #as-notice { margin: var(--space-4) 0; }
/* The routes table has nine columns; keep its controls compact so it fits a desktop width and scrolls on a phone. */
.airline #as-routes select { width: 8.5rem; max-width: 100%; }
.airline #as-routes select.route-credit { width: 10.5rem; }
.airline #as-routes input.fare { width: 5.5rem; }
.airline #as-routes input.route-override { width: 7.5rem; }
.airline #as-routes td:last-child { white-space: nowrap; }

/* Spending import: room around the paste box and the results, which used to run straight into it. */
#paste-box { margin: var(--space-4) 0; }
#import-result { margin-top: var(--space-5); }
#import-result .import-cols { margin: var(--space-2) 0; }
.preset-pick { border: 1px solid var(--rule-strong); padding: var(--space-2) var(--space-4) var(--space-1); margin: var(--space-3) 0; max-width: 70ch; }
.preset-pick legend { font-size: var(--t-fine); padding: 0 var(--space-1); }

/* --- Which card page -------------------------------------------------------------- */
.which-card { padding-bottom: var(--space-8); }
.which-card h1 { margin: var(--space-5) 0 var(--space-1); }
.wc-list { list-style: none; margin: var(--space-4) 0 0; padding: 0; display: grid; gap: var(--space-2); align-items: start; }
.wc-row { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-button); }
.wc-row summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: var(--space-1) var(--space-3); align-items: center; min-height: 3.5rem; padding: var(--space-2) var(--space-4); }
.wc-row summary::-webkit-details-marker { display: none; }
.wc-sit { font-weight: 600; display: flex; flex-direction: column; }
.wc-hint { font-weight: 400; font-size: var(--t-small); color: var(--pencil); }
.wc-best { display: flex; flex-direction: column; align-items: flex-end; text-align: right; color: var(--green); }
.wc-best strong { font-size: var(--t-lead); line-height: 1.2; }
.wc-rate { font-size: var(--t-fine); font-variant-numeric: tabular-nums; }
.wc-sub { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: var(--space-1) var(--space-2); }
.wc-next { font-size: var(--t-small); color: var(--pencil); }
#as-so-far .so-far-form label.field { flex-direction: row; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); }
#as-so-far input[type=number] { width: 7rem; flex: none; }
#goal-limit-form label.field { flex-direction: row; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); }
#goal-limit-form input[type=number] { width: 4.5rem; flex: none; }
.goal-form fieldset { border: 1px solid var(--rule-strong); border-radius: var(--r-button); margin: 0 0 var(--space-4); padding: var(--space-3) var(--space-4); min-width: 0; width: 100%; max-width: 44rem; box-sizing: border-box; }
.goal-form .goal-cards { margin: var(--space-2) 0; }
/* One row per card: checkbox, name, rate, "status points per $", then the optional "(from the card list)" note. The rows share one grid, so the rate boxes line up whatever the names. */
.goal-form .goal-cards { display: grid; grid-template-columns: auto minmax(8rem, 1fr) 4.5rem auto auto; column-gap: var(--space-2); align-items: center; }
.goal-form .goal-cards label.field { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; align-items: center; margin: var(--space-1) 0; flex: none; }
.goal-form .goal-cards input[type=number] { width: 4.5rem; flex: none; }
/* On a phone the rows wrap instead of sharing columns, so the note doesn't get squeezed into a sliver. */
@media (max-width: 600px) {
  .goal-form .goal-cards { display: block; }
  .goal-form .goal-cards label.field { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); padding: var(--space-2) 0; border-bottom: 1px solid var(--rule); }
}
.wc-why { white-space: normal; }
.wc-badge { font-size: var(--t-small); color: var(--pencil); border: 1px solid var(--rule-strong); border-radius: var(--r-full); padding: 0 var(--space-2); white-space: nowrap; }
@media (max-width: 30rem) { .wc-hint { display: none; } .wc-row summary { padding: var(--space-2) var(--space-3); min-height: 3rem; } }
.wc-all { margin: 0; padding: var(--space-1) var(--space-4) var(--space-3); list-style: none; border-top: 1px solid var(--rule); }
.wc-all li { display: grid; grid-template-columns: 1fr auto; gap: 0 var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--rule); }
.wc-all li:last-child { border-bottom: 0; }
.wc-channel { padding: var(--space-2) var(--space-4) 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-4); font-size: var(--t-small); color: var(--pencil); }
.wc-channel select { font: inherit; margin: 0 var(--space-1); }
.wc-pay { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); border: 0; margin: 0; padding: 0; min-width: 0; }
.wc-way { display: flex; align-items: center; gap: var(--space-1); cursor: pointer; }
.wc-foot { margin-top: var(--space-4); }
.wc-note { grid-column: 1 / -1; font-size: var(--t-small); color: var(--pencil); }
@media (min-width: 48rem) { .wc-list { grid-template-columns: 1fr 1fr; } }

/* Routes: below a wide desktop the nine-column table is wider than the page (the last column was clipped, and a phone
   scrolled sideways inside it), so each route becomes a small card: its cells are labelled by the header they sit under. */
@media (max-width: 90rem) {
  .airline #as-routes thead, .airline #pp-table thead, .airline #as-flight-table thead, .airline #as-planned-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .airline #as-routes, .airline #as-routes tbody, .airline #pp-table, .airline #as-flight-table, .airline #as-planned-table, .airline #pp-table tbody, .airline #as-flight-table tbody, .airline #as-planned-table tbody { display: block; }
  .airline #as-routes tr, .airline #pp-table tr, .airline #as-flight-table tr, .airline #as-planned-table tr { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: var(--space-2) var(--space-5); padding: var(--space-4) 0; border-top: 1px solid var(--rule-strong); }
  .airline #as-routes td, .airline #pp-table td, .airline #as-flight-table td, .airline #as-planned-table td { display: block; border-bottom: 0; padding: 0; text-align: left; white-space: normal; }
  .airline #as-routes td::before, .airline #pp-table td::before, .airline #as-flight-table td::before, .airline #as-planned-table td::before { content: attr(data-label); display: block; font-size: var(--t-small); color: var(--pencil); }
  .airline #as-routes td:first-child, .airline #pp-table td, .airline #as-flight-table td:first-child, .airline #as-planned-table td:first-child { font-weight: 650; }
  .airline #as-routes td:first-child::before, .airline #as-routes td:last-child::before, .airline #pp-table td, .airline #as-flight-table td:first-child::before, .airline #as-planned-table td:first-child::before { content: none; }
  .airline #as-routes select, .airline #as-routes select.route-credit { width: 100%; }
}
}

/* A brief "Saved." confirmation, pinned to the bottom of the screen. */
.toast { position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); margin: 0; padding: var(--space-2) var(--space-4); background: var(--ink); color: var(--sheet); border-radius: var(--r-button); opacity: 0; pointer-events: none; }
.toast.on { opacity: 1; }
@media (prefers-reduced-motion: no-preference) { .toast { transition: opacity 0.15s; } }

/* Each program's own actions (remove, report, link) sit under its name in the status table, so they stay in view on a phone. */
.as-program-actions { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1) var(--space-4); margin-top: var(--space-1); }
.as-program-actions details { min-width: 0; }
/* "Remove" is a small text link; WCAG 2.2 wants a target of at least 24px (2.5.8), and the phone rule above gives 44px. */
:where(a.rm-flight, a.rm-program) { display: inline-block; min-height: 24px; line-height: 24px; }  /* :where so the phone rule (44px) still wins */

.as-fold > summary { cursor: pointer; margin: var(--space-5) 0 var(--space-2); }
.as-fold > summary > h2 { display: inline; margin: 0; }
.as-fold > summary { list-style: none; }
.as-fold > summary::-webkit-details-marker { display: none; }
.as-fold > summary::before { content: "\25B8"; display: inline-block; width: 1.1rem; color: var(--ink-soft); }
.as-fold[open] > summary::before { content: "\25BE"; }
.as-fold > summary .muted { margin-left: var(--space-2); }
.as-answers { list-style: none; margin: var(--space-2) 0 var(--space-4); padding: 0; display: grid; gap: var(--space-2); font-size: var(--t-lead); }
.as-columns { margin: 0 0 var(--space-4); }

/* "Is the next tier in reach?": a ladder of tiers with a bar for the likely total. The picture is for a glance; the table beside
   it says every figure in words, so no meaning rests on colour alone (the "most you could reach" stretch is hatched). */
.so-band { margin: 0 0 var(--space-6); }
.so-toggle { display: flex; gap: var(--space-2); margin: var(--space-3) 0 var(--space-4); flex-wrap: wrap; }
.so-year[aria-pressed="true"] { background: var(--ink); color: var(--sheet); border-color: var(--ink); }
.so-program { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-input); padding: var(--space-4) var(--space-4) var(--space-4); margin: 0 0 var(--space-4); max-width: 46rem; }
.so-program h3 { font-size: var(--t-lead); }
.so-program h3 .muted { font-weight: 400; margin-left: var(--space-2); }
.so-program h4 { font-size: var(--t-body); margin: var(--space-4) 0 var(--space-1); }
.so-verdict { font-size: var(--t-lead); margin: var(--space-2) 0 var(--space-6); }
.so-ladder { margin: 0 var(--space-2) var(--space-7) 0; }
.so-track { position: relative; height: 0.9rem; background: var(--paper); border: 1px solid var(--rule-strong); border-radius: var(--r-input); }
.so-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ink); }
.so-ceiling { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(135deg, var(--pencil) 0 2px, transparent 2px 6px); }
.so-tick { position: absolute; top: -0.35rem; bottom: -0.35rem; border-left: 2px solid var(--ink-soft); }
.so-tick-label { position: absolute; top: 100%; right: 0; margin-top: var(--space-1); text-align: right; white-space: nowrap; font-size: var(--t-small); color: var(--ink-soft); }
.so-tick-start .so-tick-label, .so-tick-label.so-flip { right: auto; left: 0; text-align: left; }
/* Labels are opaque and a shallower row sits above the leader lines of deeper ones, so a line never runs through a name. */
.so-tick-label { background: var(--sheet); }
/* A label moved down a row keeps a dotted line up to its tick, so it is still plain which tier it names. */
.so-tick-label.so-lifted::before { content: ""; position: absolute; right: 0; top: calc(-0.15rem - var(--so-lift, 0rem)); height: calc(0.15rem + var(--so-lift, 0rem)); border-right: 1px dotted var(--ink-soft); }
.so-tick-start .so-tick-label.so-lifted::before, .so-tick-label.so-flip.so-lifted::before { right: auto; left: 0; border-right: 0; border-left: 1px dotted var(--ink-soft); }
.so-split, .so-method-bars { display: flex; height: 0.6rem; margin: 0 0 var(--space-2); background: var(--paper); border: 1px solid var(--rule); }
.so-part-flying { background: var(--ink); }
.so-part-spending { background: var(--rule-strong); }
.so-part-bonus { background: repeating-linear-gradient(135deg, var(--ink-soft) 0 2px, transparent 2px 5px); }
.so-method-bars { display: grid; gap: var(--space-1); height: auto; border: 0; background: none; }
.so-method-bar { display: block; height: 0.5rem; background: var(--ink); }
.so-method-bar:nth-child(n+2) { background: var(--rule-strong); }
.so-parts { border-collapse: collapse; font-size: var(--t-fine); margin: 0 0 var(--space-2); }
.so-parts th { text-align: left; font-weight: 400; padding: var(--space-1) var(--space-5) var(--space-1) 0; }
.so-parts td { text-align: right; padding: var(--space-1) 0; }
.so-total th, .so-total td { font-weight: 650; border-top: 1px solid var(--rule); }
.so-notes { margin: var(--space-2) 0 0; padding-left: var(--space-4); }
@media (max-width: 40rem) {
  .so-program { padding: var(--space-3) var(--space-3); }
  .so-tick-label { font-size: var(--t-small); }
}

/* Admin console: sections that fold away, and a row of links to them */
.admin-jump { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-5); margin: 0 0 var(--space-4); font-size: var(--t-fine); }
.admin details > summary { cursor: pointer; }
.admin details > summary > h2, .admin details > summary > h3 { display: inline; }
.admin section > details { margin-top: var(--space-5); }
.admin details > summary > h2 { margin: 0; }
.admin details[open] > summary { margin-bottom: var(--space-2); }

.d-table .d-value { width: 5.5rem; }
.d-table .d-note { min-width: 16rem; width: 100%; resize: vertical; field-sizing: content; }
.d-table .d-url { min-width: 10rem; }

/* Admin defaults tables: a row is six columns, too wide for a phone (Save sat off to the right of a sideways scroll), so each
   row becomes a small card whose cells are labelled by their header, like the routes on Airline status. */
@media (max-width: 56rem) {
  .admin .d-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .admin .d-table, .admin .d-table tbody { display: block; }
  .admin .d-table tr { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: var(--space-2) var(--space-5); padding: var(--space-4) 0; border-top: 1px solid var(--rule-strong); }
  .admin .d-table td { display: block; border-bottom: 0; padding: 0; text-align: left; white-space: normal; }
  .admin .d-table td[data-label]::before { content: attr(data-label); display: block; font-size: var(--t-small); color: var(--pencil); }
  .admin .d-table td:first-child { font-weight: 650; }
  .admin .d-table td:first-child .muted { font-weight: 400; }
  .admin .d-table .d-value { width: 6rem; }
  .admin .d-table .d-note, .admin .d-table .d-url { width: 100%; min-width: 0; box-sizing: border-box; }
}

/* Focus: what the person says the app is for. Hiding only; nothing is removed from their data. */
html[data-focus="flights"] #advice > .hero, html[data-focus="flights"] #first-look, html[data-focus="flights"] .advice-wallet, html[data-focus="flights"] .advice-todo, html[data-focus="flights"] .advice-fixes,
html[data-focus="flights"] .math-toggle, html[data-focus="flights"] #math,
html[data-focus="flights"] #which-card-link, html[data-focus="cards"] #airline-link { display: none; }
.rail-focus { margin: var(--space-4) 0 0; }
.rail-focus .muted { display: block; font-size: var(--t-fine); margin-top: var(--space-1); }
#flights-home { margin: var(--space-5) 0; }
.wc-why { white-space: normal; border-radius: var(--r-panel); }
.wc-goal-note { font-size: var(--t-small); color: var(--pencil); margin: 0 0 var(--space-4); max-width: 60ch; }
.wc-approx { font-size: var(--t-small); color: var(--pencil); margin: 0; padding: 0 var(--space-4) var(--space-2); }

/* The Account page: one block per setting group. */
.account h1 { margin-top: var(--space-5); }
.account section { margin: var(--space-6) 0 0; }
.account h2 { margin-bottom: var(--space-2); }
#export-link { display: inline-block; padding: var(--space-3) 0; }

/* The one-card editor: the card's name is the page heading, so the fieldset legends and the single-row rates header say nothing new. */
.ob-card-top { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-5); margin: 0 0 var(--space-5); }
.one-card section > h3 { margin: var(--space-5) 0 var(--space-2); }
.one-card .ob-card > legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.one-card .ob-card { margin-top: 0; }
#ob-card-remove { display: inline-block; padding: var(--space-2) 0; }

/* Best to fly, by airline: a quiet fold under the top program. */
.by-airline { margin-top: var(--space-2); font-size: var(--t-fine); }
.by-airline summary { cursor: pointer; color: var(--ink-soft); }
.by-airline ul { margin: var(--space-2) 0; padding-left: var(--space-4); }
.by-airline li { margin-bottom: var(--space-1); }

/* Under a goal: the routes that would close it. */
.goal-routes, .goal-spend { margin: var(--space-2) 0; font-size: var(--t-fine); }
.goal-routes summary, .goal-spend summary { cursor: pointer; color: var(--ink-soft); }
.goal-routes ol, .goal-spend ol { margin: var(--space-2) 0; padding-left: var(--space-5); }
.goal-routes li, .goal-spend li { margin-bottom: var(--space-1); }

/* The dashboard's updates, folded: one line while there is a pile of them. */
.updates { margin: 0 0 var(--space-5); }
.updates > summary { cursor: pointer; font-weight: 600; color: var(--ink-soft); padding: var(--space-2) 0; }
.updates > #default-changes, .updates > #catalog-updates { margin-top: var(--space-2); }
.wordmark a { color: inherit; text-decoration: none; }
.masthead nav a[aria-current="page"] { font-weight: 650; }
.pay-by-card { margin: var(--space-1) 0 0; font-size: var(--t-small); }
.pay-by-card > summary { cursor: pointer; }
.pay-by-card label { display: flex; gap: var(--space-2); align-items: center; margin: var(--space-2) 0 0; }
.pay-by-card .muted { display: block; margin-top: var(--space-2); max-width: 34rem; }

/* Airline status: the band's "Ways to close it" and the fold under each verdict */
.so-plan { margin: 0 0 var(--space-3); }
.so-gap { font-weight: 600; margin: 0 0 var(--space-2); }
.so-ways { margin: 0 0 var(--space-2); padding-left: var(--space-5); display: grid; gap: var(--space-2); }
.so-way-when { margin-left: var(--space-1); }
.so-more { margin-top: var(--space-3); }
.so-more > summary { cursor: pointer; }
