/* ===========================================================
   WAYPOINT — "Landfall"
   ===========================================================
   A theme about arriving. Deep sea-green for the passage, gold
   for the landfall, warm paper underneath both.

   Goals, unchanged from the sheet this replaces: clean, calm,
   readable, print-friendly. No frameworks. Designed to age well
   over 8+ years of use.

   Two hard constraints shaped every choice here:

   1. CSP. app.py sends `default-src 'self'` with no font-src
      directive, so font-src falls back to 'self': a Google Fonts
      <link> is blocked at the browser and fails SILENTLY to the
      fallback. Every face below therefore ships with the OS.
      If a webfont is ever wanted, it must be self-hosted under
      assets/fonts/ — adding a CDN host to the CSP is not worth it.

   2. Contrast. Gold is beautiful and it is WEAK: --gold on
      --surface is about 3.6:1. It is allowed on large text,
      borders, rules and icons, never on body copy. For gold-
      coloured small text use --gold-ink (about 6.3:1).

   Everything is a custom property. Change the twenty lines in
   :root and the whole app moves with them.
   =========================================================== */

:root {
  /* ---- Paper and ink -------------------------------------- */
  --bg:            #f6f3ea;   /* warm parchment                */
  --surface:       #fffcf5;   /* raised paper                  */
  --surface-alt:   #efeadd;   /* sunk paper, table zebra       */
  --surface-sunk:  #e8e2d2;   /* deepest recess                */

  --text:          #1d2e28;   /* deep green-black, ~14:1       */
  --text-muted:    #5a6b63;   /* ~5.5:1 — safe for body copy   */
  --text-subtle:   #78857d;   /* ~4.1:1 — meta only, 12px+     */

  --border:        #e2dac9;   /* hairline                      */
  --border-strong: #cfc4ac;   /* structural                    */

  /* ---- The passage: deep sea green ------------------------ */
  --accent:        #0e5c4a;
  --accent-ink:    #0a4438;   /* pressed / visited             */
  --accent-soft:   #d8e9e1;   /* tinted fill                   */

  /* ---- The landfall: gold --------------------------------- */
  --gold:          #b0812c;   /* rules, borders, large figures */
  --gold-bright:   #d4a440;   /* highlights, gradient stops    */
  --gold-ink:      #7a5a1a;   /* gold-flavoured SMALL text     */
  --gold-soft:     #f3e8ce;   /* tinted fill                   */

  /* ---- Verdict colours ------------------------------------ */
  /* Each verdict colour clears 4.5:1 against its own -soft fill, which is
     the only background it is ever painted on. --warn was 3.74:1 and
     --unknown 3.63:1 on first pass: both failed at the 10px pill size
     where they are used most. */
  --good:          #17734c;  --good-soft: #d9ede0;      /* 4.77:1 */
  --warn:          #8a5810;  --warn-soft: #f7e9cc;      /* 5.02:1 */
  --bad:           #a03a2c;  --bad-soft:  #f6ded9;      /* 5.22:1 */
  --unknown:       #5a655f;  --unknown-soft: #e6e3d8;   /* 4.72:1 */

  /* ---- Depth ---------------------------------------------- */
  --shadow:      0 1px 2px rgba(40,32,12,0.04), 0 2px 6px rgba(40,32,12,0.05);
  --shadow-lift: 0 2px 4px rgba(40,32,12,0.05), 0 8px 20px rgba(40,32,12,0.09);
  --ring:        0 0 0 3px rgba(176,129,44,0.35);

  --radius-sm: 5px;
  --radius:    9px;
  --radius-lg: 14px;

  /* ---- Type ------------------------------------------------
     Serif  — headings and money. macOS lands on New York,
              Windows 11 on Palatino Linotype, then Georgia.
     Sans   — UI and body. SF Pro / Segoe UI Variable.
     Mono   — code, snippets, pasted data.
     -------------------------------------------------------- */
  --font-serif: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype",
                Palatino, "Book Antiqua", Georgia, Cambria, serif;
  --font-sans:  -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text",
                "Segoe UI", ui-sans-serif, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono:  ui-monospace, "SF Mono", SFMono-Regular, "Cascadia Mono",
                Consolas, Menlo, monospace;

  /* ---- Type scale ------------------------------------------
     🔴 ADDED 2026-09-08 BECAUSE THE TEMPLATES WERE THE SCALE.
     Measured before writing this: 132 inline `style=` attributes
     across 32 templates, and 98 of them set a font-size — .8rem
     fifty times and .85rem forty-eight times, two values doing
     one job, picked by coin-flip. There was no name to reach
     for, so every author typed a number. These are the names.

     --fs-sm absorbs BOTH .8 and .85. That is the point: they
     were never distinguishable, and keeping both would rebuild
     the coin-flip with extra steps.
     -------------------------------------------------------- */
  --fs-sm:    .85rem;   /* meta, sub-lines, footnotes          */
  --fs-base:  1rem;     /* body                                */
  --fs-lg:    1.2rem;   /* a figure inside a card              */
  --fs-xl:    2rem;     /* the one headline figure on a page   */

  /* ---- Space scale -----------------------------------------
     Same measurement: .6rem used 39 times, .4rem 21 times, then
     one-offs at .2, .3, .45, .5 and 1rem that nobody could ever
     match on purpose. Four steps, and the one-offs round to a
     step rather than inventing a fifth.
     -------------------------------------------------------- */
  --space-1:  .2rem;
  --space-2:  .4rem;
  --space-3:  .6rem;
  --space-4:  1rem;

  --sidebar-w:   268px;
  /* Reading measure for PROSE only. The page itself is fluid — see .main.
     Nothing but the lede should use this. */
  --prose-max:   78ch;
}

* { box-sizing: border-box; }

html {
  /* Anchors land below the sticky header on long pages. */
  scroll-padding-top: 24px;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ---------- Paper grain --------------------------------------
   A fixed, non-interactive film of noise over the whole page. It
   is what stops a flat cream background reading as "unstyled
   white". Data URI, so it costs no request and satisfies the
   `img-src 'self' data:` line in the CSP.
   ----------------------------------------------------------- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Skip link -----------------------------------------
   Off-screen until focused, then the first thing a keyboard lands
   on. Without it, reaching the content on any page means tabbing
   through 24 nav links.
   ----------------------------------------------------------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 10px 16px;
  background: var(--accent);
  color: #fffcf5;
  font-size: 14px;
  font-weight: 600;
  border-radius: 0 0 var(--radius) 0;
  text-decoration: none;
}

.skip-link:focus {
  left: 0;
  outline: 2px solid var(--gold);
  outline-offset: -4px;
}

/* The skip target must not draw a focus ring of its own. */
#main:focus { outline: none; }

/* ---------- Layout ---------- */
.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ---------- Sidebar ------------------------------------------
   A horizon: light at the top where the brand sits, settling
   into paper further down. The right edge is a gold hairline
   over a neutral one — the seam the whole app hangs from.
   ----------------------------------------------------------- */
.sidebar {
  background:
    linear-gradient(180deg,
      var(--surface) 0%,
      var(--surface) 38%,
      var(--bg) 100%);
  border-right: 1px solid var(--border);
  box-shadow: inset -3px 0 0 -2px var(--gold-soft);
  padding: 26px 16px 32px;
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

/* ---------- The bell ------------------------------------------
   One icon, one count: alerts + open caveats + overdue to-dos,
   computed on every request by alerts.assess — the same call the
   /alerts page renders, so the number cannot be stale.
   ----------------------------------------------------------- */
.sidebar .bell {
  position: absolute;
  top: 22px;
  right: 14px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 4px;
  border-radius: var(--radius-sm);
}
.sidebar .bell:hover { color: var(--text); background: var(--bg); }
.sidebar .bell.has { color: var(--warn); }
.sidebar .bell .badge {
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  min-width: 18px;
  padding: 3px 5px;
  border-radius: 999px;
  text-align: center;
  background: var(--warn);
  color: #fff;
}
.sidebar .bell .badge.unknown { background: var(--text-muted); }

/* The one-line bar above every page: how it works, and its caveats. */
.pagehelp {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  margin: -6px 0 6px;
  min-height: 1em;
}
.pagehelp a { color: var(--text-muted); text-decoration: none; border-bottom: 1px dotted var(--border-strong); }
.pagehelp a:hover { color: var(--text); }
.pagehelp .caveat-links a::before { content: "⚑ "; }
.pagehelp .caveat-links a + a { margin-left: 8px; }

/* Do-next steps: a number, an order, a reason. */
.row.step { align-items: flex-start; }
.row.step .n { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--gold-soft); color: var(--text); font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; margin-right: 12px; margin-top: 2px; }

/* Severity dots on the Alerts page. */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: middle; background: var(--text-muted); }
.dot.bad { background: var(--bad); }
.dot.warn { background: var(--warn); }
details.card > summary { cursor: pointer; list-style: none; }
details.notes > summary { font-size: 12px; color: var(--text-muted); cursor: pointer; }
details.notes[open] > summary { margin-bottom: 6px; }
details.card > summary::-webkit-details-marker { display: none; }
details.card .how { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
details.card .how p { margin: 4px 0 0; font-size: .9rem; color: var(--text-muted); }

/* ---------- Brand --------------------------------------------
   WAYPOINT, set as a wide-tracked serif, over a gold rule that
   runs the width of the word. The diamond is the waypoint mark
   itself — the symbol a chart uses for "you are here".
   ----------------------------------------------------------- */
.sidebar .brand {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text);
  margin: 0 0 6px 2px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.sidebar .brand::before {
  content: "";
  width: 9px;
  height: 9px;
  flex: none;
  transform: rotate(45deg);
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  box-shadow: 0 0 0 3px var(--gold-soft);
}

.sidebar .brand-sub {
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0 0 22px 2px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

/* The gold rule under the brand — short, deliberate, decorative. */
.sidebar .brand-sub::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 54px;
  height: 1px;
  background: linear-gradient(90deg, var(--gold), transparent);
}

/* ---------- Mobile nav toggle --------------------------------
   Hidden entirely on a desktop, where the sidebar is a column and
   there is nothing to collapse.
   ----------------------------------------------------------- */
.nav-toggle { display: none; }

/* 🔴 NO JAVASCRIPT IS SERVED (CSP default-src 'none', static allowlist), so the
   toggle is a checkbox: `.nav-check:checked ~ .nav-groups` opens the menu. The
   first version of this stylesheet waited for a `.nav-open` class that nothing
   ever set, and on a phone every page had no links at all. The checkbox stays
   focusable (space toggles it) — visually hidden, never display:none. */
.nav-check {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.nav-check:focus-visible ~ .nav-toggle { outline: 2px solid var(--gold); outline-offset: 2px; }

.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  content: "";
}
.nav-toggle-bars { position: relative; }
.nav-toggle-bars::before { position: absolute; top: -5px; }
.nav-toggle-bars::after  { position: absolute; top: 5px; }

/* ---------- Nav ---------- */
.sidebar .nav-group { margin-bottom: 18px; }

.sidebar .nav-group-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-subtle);
  padding: 0 10px;
  margin-bottom: 7px;
}

.sidebar nav a {
  display: block;
  position: relative;
  padding: 6px 10px 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.45;
  transition: background-color 120ms ease, color 120ms ease;
}

.sidebar nav a:hover {
  background: var(--surface-alt);
  text-decoration: none;
}

/* The active page gets the gold mark. One page is "here"; the
   mark is the only gold in the nav, so it cannot be missed. */
.sidebar nav a.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 600;
}

.sidebar nav a.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 15px;
  margin-top: -7.5px;
  border-radius: 0 2px 2px 0;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
}

/* ---------- Countdown ----------------------------------------
   The emotional centre of the sidebar: the number of days left.
   Serif, gold, large. No progress ring — there is no honest
   denominator for "how far along" without inventing a start
   date, and this app does not invent numbers.
   ----------------------------------------------------------- */
.sidebar .countdown {
  margin-top: 26px;
  padding: 16px 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 13px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.sidebar .countdown::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg,
    transparent, var(--gold-bright), var(--gold), transparent);
}

.sidebar .countdown .days {
  display: block;
  font-family: var(--font-serif);
  font-size: 34px;
  font-weight: 600;
  line-height: 1.05;
  color: var(--gold-ink);
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums lining-nums;
}

.sidebar .countdown .label {
  display: block;
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ---------- Main content -------------------------------------
   FLUID. Was capped at --content-max (920px), which on a wide
   screen left the right half empty while wide tables wrapped
   inside the narrow column — the worst of both.

   The cap survives in ONE place: the lede under each h1. A single
   intro paragraph running 200 characters across a 27" monitor is
   genuinely hard to read, and that block is prose, not data.
   Tables, cards, charts and stat grids now take the full width.
   ----------------------------------------------------------- */
.main {
  padding: 44px 52px 96px;
  max-width: none;
  width: 100%;
  min-width: 0;          /* lets grid/flex children shrink instead of overflowing */
}

/* Wide content scrolls inside itself rather than pushing the page
   sideways. A horizontally scrolling BODY hides the nav. */
.main table { min-width: 0; }

/* h1 carries the gold rule. It is the page's landfall mark. */
.main h1 {
  font-family: var(--font-serif);
  font-size: 38px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
  padding-bottom: 14px;
  position: relative;
}

.main h1::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 72px;
  height: 2px;
  border-radius: 1px;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
}

.main h1 + .lede {
  color: var(--text-muted);
  font-size: 16.5px;
  line-height: 1.6;
  margin: 0 0 34px;
  max-width: var(--prose-max);
}

.main h2 {
  font-family: var(--font-serif);
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.012em;
  margin: 42px 0 12px;
}

.main h3 {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin: 28px 0 8px;
}

.main p { margin: 0 0 12px; }
.main ul, .main ol { margin: 0 0 16px; padding-left: 22px; }
.main li { margin-bottom: 5px; }
.main li::marker { color: var(--gold); }

a {
  color: var(--accent);
  text-decoration-color: var(--accent-soft);
  text-underline-offset: 2px;
}
a:hover { text-decoration: underline; text-decoration-color: var(--gold); }
a:visited { color: var(--accent-ink); }

strong, b { font-weight: 650; color: var(--text); }

hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 28px 0;
}

/* Keyboard focus is gold and unmissable, on everything. */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ---------- Card ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 26px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-family: var(--font-serif);
  font-size: 17.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

.card-meta {
  font-size: 11.5px;
  color: var(--text-subtle);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ---------- Stat tiles ---------------------------------------
   The money. Serif numerals, tabular so columns of them line up,
   with a gold rule that surfaces on hover.
   ----------------------------------------------------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(184px, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}

.stat {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 17px 16px;
  overflow: hidden;
  transition: box-shadow 160ms ease, transform 160ms ease;
}

.stat::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  opacity: 0;
  transition: opacity 160ms ease;
}

.stat:hover {
  box-shadow: var(--shadow-lift);
  transform: translateY(-1px);
}
.stat:hover::before { opacity: 1; }

.stat .stat-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.stat .stat-value {
  font-family: var(--font-serif);
  font-size: 27px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin-top: 4px;
  font-variant-numeric: tabular-nums lining-nums;
}

.stat .stat-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.45;
}

/* ---------- Placeholder cue ---------- */
.placeholder {
  border: 1px dashed var(--border-strong);
  background: var(--surface-alt);
  border-radius: var(--radius);
  padding: 14px 16px;
  color: var(--text-muted);
  font-size: 14px;
  margin: 12px 0;
}

.placeholder strong {
  color: var(--text);
  display: block;
  margin-bottom: 4px;
  font-weight: 650;
}

/* ---------- Tables -------------------------------------------
   Ledger rules: hairlines only, tabular figures everywhere,
   the row you are reading tinted as you pass over it.
   ----------------------------------------------------------- */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 10px 0 18px;
}

thead th {
  text-align: left;
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  border-bottom: 1.5px solid var(--border-strong);
  padding: 9px 10px;
  white-space: nowrap;
}

tbody td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tbody tr { transition: background-color 100ms ease; }
tbody tr:hover { background: var(--gold-soft); }
tbody tr:last-child td { border-bottom: none; }

tfoot td {
  padding: 10px;
  border-top: 1.5px solid var(--border-strong);
  font-weight: 650;
}

/* Any number, anywhere, lines up with the number above it. */
td.num, th.num, .num {
  text-align: right;
  font-variant-numeric: tabular-nums lining-nums;
}
th.num { text-align: right; }

/* ---------- Pills / status -----------------------------------
   Each verdict carries a dot as well as a colour, so the state
   survives a greyscale print and colour-blind vision.
   ----------------------------------------------------------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2.5px 9px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid transparent;
  white-space: nowrap;
}

.pill::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.pill.good { background: var(--good-soft); color: var(--good); border-color: rgba(23,115,76,0.22); }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: rgba(165,106,18,0.22); }
.pill.bad  { background: var(--bad-soft);  color: var(--bad);  border-color: rgba(160,58,44,0.22); }
.pill.todo { background: var(--unknown-soft); color: var(--unknown); border-color: rgba(107,119,112,0.22); }

/* The refusal states are first-class citizens of this app, so
   they get a look of their own: hollow, hatched, unmistakably
   "no answer" rather than a quiet grey that reads as "fine".  */
.pill.unknown, .pill.unevaluable, .pill.unmeasured,
.pill.undated, .pill.monitor, .pill.infeasible {
  background: repeating-linear-gradient(
    -45deg,
    var(--unknown-soft) 0 5px,
    var(--surface-alt) 5px 10px);
  color: var(--text-muted);
  border-color: var(--border-strong);
}

/* ---------- Age chip -----------------------------------------
   States an age. Makes no claim about whether that age is
   acceptable — see the note in app.js. The only variant that
   carries alarm is `undated`, because a balance with no as-of
   date is a defect by this project's own rule, and it borrows
   the hatched refusal treatment to say so.
   ----------------------------------------------------------- */
.age-chip {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.03em;
  white-space: nowrap;
  background: var(--surface-alt);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  vertical-align: 1px;
}

.age-chip.undated {
  background: repeating-linear-gradient(
    -45deg,
    var(--unknown-soft) 0 5px,
    var(--surface-alt) 5px 10px);
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
}

/* ---------- Deltas ---------- */
.delta-up   { color: var(--good); font-variant-numeric: tabular-nums; font-weight: 600; }
.delta-down { color: var(--bad);  font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------- Small shared utilities ---------------------------
   These class names are used across the pages but were never in
   the shared sheet, so each page redefined them locally. Defined
   here they theme centrally; page-local blocks still win, which
   is why those blocks are being moved onto these tokens.
   ----------------------------------------------------------- */
.muted  { color: var(--text-muted); }
.dim,
.subtle { color: var(--text-subtle); }
/* 🔴 THE FOOTNOTE COMPONENT, AND IT WAS USED BY NOTHING. Measured 2026-09-08:
   `.note` was defined here at 13px and ZERO templates used it, while 97 sites
   wrote `<p class="muted" style="font-size:.8rem">` or `.85rem` by hand — two
   values doing one job because nobody knew this existed. It now takes the
   scale, and the sweep on 2026-09-10 pointed those 97 sites at it. */
.note {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  line-height: 1.55;
}
/* ⚠️ ONE SPACING MODIFIER, NOT TWO. The templates used .6rem 39 times and .4rem
   21 times for the identical job — a footnote sitting under the block above it.
   Keeping both would rebuild the coin-flip the scale exists to end. */
.note.stacked,
.sub.stacked,
.row.stacked { margin: var(--space-3) 0 0; }
/* The mirror of `.stacked`: a line that introduces the block BELOW it. */
.note.lead,
.sub.lead,
.muted.lead { margin: 0 0 var(--space-3); }
/* An inline qualifier inside a heading — small, and not bold like its <h2>. */
.muted.qualifier { font-size: var(--fs-sm); font-weight: 400; }
.stat-value.sm { font-size: var(--fs-lg); }
/* A figure inside a card rather than the one headline figure on a page.
   `.headline` is 2rem; eight templates overrode it to 1.2rem inline. */
.headline.sm { font-size: var(--fs-lg); }
.kicker {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-ink);
}

/* ⚠️ NO SHARED `.big` RULE. It was here as a serif money figure and it
   collided: plan.html, lifestyle.html and upgrade.html all use `.big` as
   a LAYOUT container, and a shared font-family/size leaked into their
   stat tiles. A utility class name this generic belongs to whichever
   page claimed it first. Use .stat-value for money.

   `.tag/.badge/.chip` deliberately set no `border` for the same reason:
   payment-audit.html overrides background, colour, padding and radius
   but not border, so a border here appears on tags that never had one. */
.tag, .badge, .chip {
  display: inline-block;
  padding: 1.5px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  background: var(--surface-alt);
  color: var(--text-muted);
}
.pos  { color: var(--good); }
.neg  { color: var(--bad); }
.good { color: var(--good); }
.warn { color: var(--warn); }
.bad  { color: var(--bad); }

/* ---------- Banners ---------- */
.banner, .notice, .alert {
  border-radius: var(--radius);
  padding: 13px 16px;
  margin: 14px 0;
  font-size: 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  background: var(--gold-soft);
  color: var(--text);
}

/* ---------- Pillar dividers in sidebar ---------- */
.pillar-divider {
  height: 1px;
  background: var(--border);
  margin: 14px 8px;
}

/* ---------- Progress bars ---------- */
.bar-track {
  height: 7px;
  border-radius: 999px;
  background: var(--surface-sunk);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--good));
  transition: width 400ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.bar-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  margin: 7px 0;
}

.bar-label { font-size: 13px; color: var(--text-muted); }
.bar-value { font-size: 13px; font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------- Buttons ---------- */
.import-btn, .more-btn, .copy-btn, button.btn {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease,
              box-shadow 120ms ease;
}

.import-btn:hover, .more-btn:hover, .copy-btn:hover, button.btn:hover {
  background: var(--surface-alt);
  border-color: var(--gold);
}

.import-btn-primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-ink));
  color: #fffcf5;
  border-color: var(--accent-ink);
  box-shadow: var(--shadow);
}

.import-btn-primary:hover {
  background: linear-gradient(180deg, var(--accent-ink), var(--accent-ink));
  border-color: var(--accent-ink);
}

/* ---------- Import widget ---------- */
.import-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}

.import-tab {
  background: none;
  border: none;
  padding: 8px 14px;
  font: inherit;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.import-tab.active {
  color: var(--accent);
  border-bottom-color: var(--gold);
  font-weight: 650;
}

.import-help {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

#import-input {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-alt);
  color: var(--text);
  resize: vertical;
  line-height: 1.5;
}

#import-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: var(--ring);
}

.import-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.import-status { font-size: 13px; color: var(--text-muted); }
.import-status.good { color: var(--good); }
.import-status.warn { color: var(--warn); }
.import-status.bad  { color: var(--bad);  }

.import-table { font-size: 13px; }

.import-table select,
.import-table input[type="text"] {
  font: inherit;
  font-size: 12px;
  padding: 5px 7px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  width: 100%;
  max-width: 200px;
}

.import-table tfoot td {
  border-top: 1.5px solid var(--border-strong);
  padding-top: 10px;
}

/* ---------- Code / snippets ---------- */
code, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}

.snippet-block {
  margin: 14px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.snippet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface-alt);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.snippet-block pre {
  margin: 0;
  padding: 13px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre;
  background: var(--surface);
  color: var(--text);
}

.snippet-block code {
  background: none;
  border: none;
  padding: 0;
}

.copy-btn { font-size: 11.5px; padding: 3px 10px; }

/* ---------- Scroll containers ---------- */
.scroll {
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

/* ===========================================================
   Night passage — opt-in dark mode.
   ===========================================================
   Deliberately NOT wired to prefers-color-scheme. Thirteen pages
   still carry inline <style> blocks with hardcoded light colours;
   until those are moved onto the tokens above, an automatic dark
   mode would half-apply and look broken on a machine whose owner
   never asked for it. Switch it on with:

       <html data-theme="dark">

   ...once the inline blocks are swept.
   =========================================================== */
[data-theme="dark"] {
  --bg:            #0c1512;
  --surface:       #12201b;
  --surface-alt:   #182b24;
  --surface-sunk:  #0a1210;

  --text:          #e9e4d6;
  --text-muted:    #a3b0a8;
  --text-subtle:   #7d8a83;

  --border:        #24382f;
  --border-strong: #33503f;

  --accent:        #4fb394;
  --accent-ink:    #7fcfb4;
  --accent-soft:   #123028;

  --gold:          #d4a440;
  --gold-bright:   #eccb7a;
  --gold-ink:      #e8c473;
  --gold-soft:     #2a2110;

  --good: #4caf80;  --good-soft: #12301f;
  --warn: #d9a441;  --warn-soft: #322510;
  --bad:  #d97a63;  --bad-soft:  #341c17;
  --unknown: #8b978f; --unknown-soft: #1d2a24;

  --shadow:      0 1px 2px rgba(0,0,0,0.4), 0 2px 8px rgba(0,0,0,0.3);
  --shadow-lift: 0 2px 6px rgba(0,0,0,0.45), 0 10px 26px rgba(0,0,0,0.45);
}

[data-theme="dark"] body::before { opacity: 0.05; }

[data-theme="dark"] .import-btn-primary { color: #0c1512; }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .stat:hover { transform: none; }
}

/* ---------- Mobile ---------- */
@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    max-height: none;
    border-right: none;
    box-shadow: none;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    padding: 14px 16px 16px;
    display: grid;
    grid-template-columns: 1fr auto auto;
    grid-template-areas: "brand bell toggle" "sub bell toggle" "countdown countdown countdown" "groups groups groups";
    align-items: center;
    gap: 0 12px;
  }

  .sidebar .brand     { grid-area: brand; margin-bottom: 2px; }
  .sidebar .bell      { grid-area: bell; position: static; justify-self: end; }
  .sidebar .brand-sub { grid-area: sub; margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
  .sidebar .brand-sub::after { display: none; }
  .sidebar .nav-groups { grid-area: groups; }

  /* The countdown is the one thing worth its vertical space on a
     phone, so it stays visible while the 24 links collapse. */
  .sidebar .countdown {
    grid-area: countdown;
    margin-top: 14px;
  }

  .nav-toggle {
    grid-area: toggle;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font: inherit;
    font-size: 13px;
    font-weight: 650;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
  }

  /* Collapsed by default: content first, nav on request. Opened by the
     checkbox above the toggle — see `.nav-check` in the desktop block. */
  .nav-groups { display: none; }
  .nav-check:checked ~ .nav-groups {
    display: block;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
  }

  .main { padding: 30px 20px 64px; }
  .main h1 { font-size: 30px; }
  .main h2 { font-size: 20px; }
  .stat .stat-value { font-size: 23px; }
}

/* ---------- Print ---------------------------------------------
   Gold does not print. Everything resolves to ink on white, the
   grain comes off, and the verdict dots carry the states that
   colour was carrying on screen.
   ------------------------------------------------------------ */
@media print {
  :root {
    --surface: #fff;
    --surface-alt: #fff;
    --bg: #fff;
    --text: #000;
    --text-muted: #333;
    --text-subtle: #555;
    --border: #bbb;
    --border-strong: #888;
  }
  body::before { display: none; }
  .sidebar { display: none; }
  .skip-link, .nav-toggle { display: none !important; }
  .app { grid-template-columns: 1fr; }
  .main { padding: 0; max-width: none; }
  .main h1 { font-size: 22pt; }
  .main h1::after { background: #000; }
  .card { box-shadow: none; break-inside: avoid; }
  .stat { break-inside: avoid; }
  .stat::before { display: none; }
  body { background: #fff; font-size: 11pt; }
  a { color: #000; text-decoration: none; }
  .placeholder { background: #fff; }
  .pill { border-color: #888 !important; background: #fff !important; color: #000 !important; }
  table { break-inside: auto; }
  tr { break-inside: avoid; }
  tbody tr:hover { background: none; }
}

/* A roadmap task may be a checklist (move-logins-to-john-at-john-madden-com,
   2026-09-05): the record's newlines are the structure, so keep them. */
.roadmap .name { white-space: pre-line; }

/* ---------- Account warnings ---------------------------------
   One line on the account row; the full explanation lives at the
   matching anchor on /alerts (John, 2026-09-07). Deliberately NOT
   a .pill — a pill is an uppercase status token that must not
   wrap, and these are sentences carrying money and dates.
   ----------------------------------------------------------- */
.warnings { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin-top: .45rem; }
.warnings .warning {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
  text-decoration: none;
  color: var(--warn);
  border-bottom: 1px dotted currentColor;
}
.warnings .warning::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
  transform: translateY(-2px);
}
.warnings .warning.bad { color: var(--bad); }
.warnings .warning:hover, .warnings .warning:focus { border-bottom-style: solid; }

/* The account name links to its own page; it should not look like
   body-copy link furniture inside a dense list of rows. */
.row .name > a { color: inherit; text-decoration: none; }
.row .name > a:hover, .row .name > a:focus { text-decoration: underline; }

/* ---------- Accounts: one card per account -------------------
   John, 2026-09-08: "individual accounts in their own defined
   cards ... the sections could be better labeled with totals",
   then, seeing the first attempt: "not sure why you chose to go
   vertical when you have the entire card. Go horizontal and fill
   the card."

   The figures are a GRID that fills the card's width, label over
   value, not a list read down one edge. `auto-fit` means a card
   with four figures uses four columns and one with eleven wraps
   to two rows — the same rule at every card width, no breakpoint
   per account type.
   ----------------------------------------------------------- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 2rem 0 .75rem;
  padding-bottom: .45rem;
  border-bottom: 1px solid var(--border);
}
.section-head h2 { margin: 0; }
.section-head h2::after { display: none; }
.section-total { text-align: right; }
.section-amount {
  font-variant-numeric: tabular-nums;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.2;
}

.accounts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 14px;
  align-items: start;
}
.account-card { padding: 15px 18px 13px; }

.account-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}
.account-head .grow { flex: 1; min-width: 0; }
.account-head .name { font-weight: 600; line-height: 1.3; }
.account-head .sub { margin-top: 1px; }
.account-amount {
  font-variant-numeric: tabular-nums;
  font-size: 1.2rem;
  font-weight: 700;
  white-space: nowrap;
  flex: none;
}

/* Label over value, flowing across the full width. Tabular
   numerals so a column of money lines up when the grid happens
   to put two cards' figures side by side.                       */
.figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: 9px 14px;
  margin: .8rem 0 0;
  padding: .7rem 0 .1rem;
  border-top: 1px solid var(--border);
}
.figures .figure { min-width: 0; }
.figures dt {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.figures dd {
  margin: 1px 0 0;
  font-size: 13.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
}
/* A note under a figure is the date or the qualifier it needs to
   be read honestly, so it sits under the number rather than
   competing with it on the same line.                           */
.figures dd .muted {
  display: block;
  font-size: 10.5px;
  font-weight: 400;
  line-height: 1.3;
}

.account-card .warnings { margin-top: .75rem; padding-top: .65rem; border-top: 1px solid var(--border); }
.account-card .warnings .warning { font-size: 11.5px; }
.account-card > details.record { margin-top: .7rem; }
.account-card > details.record > summary { font-size: 12px; }
.account-card > .sub { margin-top: .6rem; }

@media (max-width: 560px) {
  .accounts-grid { grid-template-columns: 1fr; }
  .figures { grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); }
}
