/* Mula — the "Ledger" design system. Monochrome chrome; colour only where it
   means something: judgement, lane, provenance, future, charts.
   Served to the new UI only (templates/v2). No bare-element component rules:
   a <button> is nothing until it is a .btn. */

@font-face { font-family: 'IBM Plex Sans'; font-weight: 400; font-display: swap;
  src: local('IBM Plex Sans'), url('fonts/IBMPlexSans-Regular.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 500; font-display: swap;
  src: local('IBM Plex Sans Medium'), url('fonts/IBMPlexSans-Medium.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 600; font-display: swap;
  src: local('IBM Plex Sans SemiBold'), url('fonts/IBMPlexSans-SemiBold.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 400; font-display: swap;
  src: local('IBM Plex Mono'), url('fonts/IBMPlexMono-Regular.woff2') format('woff2'); }

/* Colour tokens. The light set is also pinned on a print document (.sheet-doc),
   which stays paper whatever the theme; the night set below re-declares the
   same names for the rest of the page. */
:root, :where(.sheet-doc) {
  color-scheme: light;
  /* Ground & ink */
  --ground: #F3F3EE; --surface: #FFFFFF; --surface-tint: #E6E6DF; --hover: #ECECE6;
  --ink: #111312; --ink-2: #2E3230; --muted: #434946; --faint: #6A706D;
  --rule: #CED1CB; --rule-strong: #AEB2AB; --rule-row: #E0E2DD; --track: #D9DCD6;

  /* Accent: charcoal fills, soft line for outlines. Never a status. */
  --accent: #3D4240; --accent-hover: #2E3230; --accent-line: #8F948E;

  /* Judgement: severity and the sign of money */
  --bad: #B3261E;  --bad-fill: #F8E3E0;  --bad-rule: #E3B4AE;  --bad-deep: #8A1F17;
  --warn: #9A6700; --warn-fill: #F5E7BF; --warn-rule: #DCC58A; --warn-deep: #6E4C00;
  --ok: #1E8A3C;   --ok-fill: #DCEFDF;   --ok-rule: #9FCDA8;   --ok-deep: #1F5C38;
  --info: #434946; --info-fill: #EEEEEA; --info-rule: #C9CCC6;

  /* Lane */
  --lane-pers: #55705C; --lane-pers-tint: #F1F4F0; --lane-pers-band: #E1E8E0;
  --lane-pers-rule: #D3DDD2; --lane-pers-head: #4A6450;
  --lane-biz: #3A5F86; --lane-biz-tint: #F1F2F5; --lane-biz-band: #E0E3EA;
  --lane-biz-rule: #D3D8E2; --lane-biz-head: #3A5F86; --lane-biz-edge: #C3CCDA;

  /* Provenance: one hue, varied by stroke */
  --how: #6A4C9C; --how-fill: #EAE3F3; --how-rule: #C1AEDB; --how-deep: #4E3478;

  /* Future: forecasts and projections */
  --future: #1D6E8A; --future-fill: #DFEBF0; --future-rule: #A4C6D3;

  /* Charts */
  --cat-1: #B3261E; --cat-2: #9A6700; --cat-3: #6E7E3C; --cat-4: #1D6E8A;
  --cat-5: #3A5F86; --cat-6: #6A4C9C; --cat-7: #A8653A; --cat-8: #8E9490;
  --seq-1: #EFEFEA; --seq-2: #CFD1CB; --seq-3: #9EA19B; --seq-4: #5F6663; --seq-5: #111312;

  /* Washes over whatever is beneath, and depth */
  --wash: rgba(17,19,18,.04); --wash-alt: rgba(17,19,18,.03); --scrim: rgba(17,19,18,.32);
  --shadow-open: 0 6px 24px rgba(17,19,18,.10);
  --shadow-float: 0 3px 14px rgba(17,19,18,.25);
}
/* Night. Every name above, re-declared; nothing else in this file knows the
   theme. The solid fills (accent, judgement, lane) turn pale here, so the
   text that sits on them stays var(--ground) and reads dark on light.
   <html data-theme> is set before first paint by v2/_theme.html. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #131514; --surface: #1B1E1C; --surface-tint: #2B2F2C; --hover: #242826;
  --ink: #ECEDE8; --ink-2: #CDD0CA; --muted: #A4AAA5; --faint: #8C938E;
  --rule: #343936; --rule-strong: #4C524E; --rule-row: #272B29; --track: #303532;

  --accent: #D9DBD5; --accent-hover: #ECEDE8; --accent-line: #6B716D;

  --bad: #F2867C;  --bad-fill: #3A1D1A;  --bad-rule: #6B322C;  --bad-deep: #FFB4AB;
  --warn: #E0AE4A; --warn-fill: #33290F; --warn-rule: #5E4A1C; --warn-deep: #F2CF85;
  --ok: #6CC485;   --ok-fill: #17301F;   --ok-rule: #2F5A3C;   --ok-deep: #A3DDB2;
  --info: #A4AAA5; --info-fill: #222624; --info-rule: #3A3F3C;

  --lane-pers: #8DB497; --lane-pers-tint: #171C19; --lane-pers-band: #243029;
  --lane-pers-rule: #2C3A31; --lane-pers-head: #A9CDB2;
  --lane-biz: #86AEDB; --lane-biz-tint: #171A1F; --lane-biz-band: #232C38;
  --lane-biz-rule: #2B3644; --lane-biz-head: #A9C8EA; --lane-biz-edge: #3B4A5E;

  --how: #B49BE0; --how-fill: #2A2238; --how-rule: #4D3E6B; --how-deep: #D3C2F2;

  --future: #6FBAD6; --future-fill: #152B34; --future-rule: #2C5262;

  --cat-1: #E8776D; --cat-2: #D9A441; --cat-3: #A9BB6A; --cat-4: #5FB0CC;
  --cat-5: #7FA6D6; --cat-6: #A98EDB; --cat-7: #D4946A; --cat-8: #8E9490;
  --seq-1: #232725; --seq-2: #3D423F; --seq-3: #6E7571; --seq-4: #A9AEA9; --seq-5: #ECEDE8;

  --wash: rgba(255,255,255,.05); --wash-alt: rgba(255,255,255,.025); --scrim: rgba(0,0,0,.6);
  --shadow-open: 0 6px 24px rgba(0,0,0,.5);
  --shadow-float: 0 3px 14px rgba(0,0,0,.6);
}
:root {
  /* Lane. --lane* resolve to the page's lane (body[data-lane]); personal is the default. */
  --lane: var(--lane-pers); --lane-tint: var(--lane-pers-tint); --lane-band: var(--lane-pers-band);
  --lane-rule: var(--lane-pers-rule); --lane-head: var(--lane-pers-head);

  /* Type & shape */
  --sans: 'IBM Plex Sans', -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --r-card: 8px; --r-ctl: 5px; --r-dialog: 10px; --r-check: 3px;
  --side: 32px; --nav-h: 48px; --row-h: 34px;
}
body[data-lane="business"] {
  --lane: var(--lane-biz); --lane-tint: var(--lane-biz-tint); --lane-band: var(--lane-biz-band);
  --lane-rule: var(--lane-biz-rule); --lane-head: var(--lane-biz-head);
}

/* ---- base ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--sans);
  font-size: 14.5px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--muted); }
::selection { background: var(--surface-tint); }
h1, h2, h3, h4, p { margin: 0; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
table { border-collapse: collapse; }
code, .mono { font-family: var(--mono); font-size: 12px; color: var(--faint); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
[hidden] { display: none !important; }

.muted { color: var(--muted); } .faint { color: var(--faint); } .ink2 { color: var(--ink-2); }
.sp { margin-left: auto; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.nowrap { white-space: nowrap; }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ---- money --------------------------------------------------------------- */
/* One amount = one text node inside .m, so veil can blur it and keep its width. */
.m, .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.num { text-align: right; }
.pos, .m.pos { color: var(--ok); }
.neg, .m.neg { color: var(--bad); }
body.veiled .m, .veil { filter: blur(max(5px, .42em)); user-select: none; }
body.veiled svg.chart, body.veiled .segbar, body.veiled .devbar, body.veiled .progress { filter: blur(5px); }

/* ---- navigation ---------------------------------------------------------- */
.nav { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 20px;
  height: var(--nav-h); padding: 0 24px; background: var(--surface);
  border-bottom: 1px solid var(--rule); white-space: nowrap; }
.nav-brand { font-weight: 600; letter-spacing: .01em; text-decoration: none; }
.nav-tabs { display: flex; gap: 18px; align-items: stretch; height: 100%; color: var(--ink-2); }
/* The page you are on is marked one way across the whole bar: the same tinted
   pill a menu label carries (the principal, 2026-10-06: tabs had a bold
   underline, menus a pill, for no reason a reader could see). */
.nav-tabs > a { display: flex; align-items: center; align-self: center; text-decoration: none;
  color: var(--ink-2); border-radius: var(--r-ctl); padding: 3px 8px; margin: 0 -8px; }
.nav-tabs > a:hover { color: var(--ink); }
.nav-tabs > a.on { color: var(--ink); background: var(--surface-tint); }
.nav-sep { width: 1px; background: var(--rule); margin: 12px 0; }
.nav-status { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; min-width: 0; }
.nav-status form { margin: 0; display: flex; }
.nav .nav-more { display: none; }
/* Seven daily tabs: between the phone fold and a full-width bar the tabs sit closer. */
@media (min-width: 901px) and (max-width: 1000px) { .nav-tabs { gap: 10px; } }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-tint);
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px;
  font-weight: 600; color: var(--ink-2); text-transform: uppercase; }

/* Demo mode: the bar itself changes colour and carries a DEMO mark, on every page, so it can't be missed. */
body.demo .nav { background: var(--warn-fill); border-bottom: 2px solid var(--warn); }
.demochip { font-weight: 600; letter-spacing: .04em; }

/* Click menus: <details class="menu"><summary>…</summary><div class="menu-list">…</div></details> */
.menu { position: relative; display: flex; align-items: center; }
.menu > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 4px;
  color: var(--ink-2); border-radius: var(--r-ctl); padding: 3px 8px; margin: 0 -8px; user-select: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary:hover { color: var(--ink); }
.menu > summary.on, .menu[open] > summary { color: var(--ink); background: var(--surface-tint); }
/* The two carets, drawn, never a font glyph: .caret opens a list; .chev unfolds in place and turns when open. */
.caret { display: inline-block; width: 0; height: 0; font-size: 0; margin-left: 3px;
  border-style: solid; border-width: 6px 5px 0 5px; border-color: currentColor transparent transparent transparent; }
.menu > summary.bare { padding: 0; margin: 0; background: none; }
.menu-list { position: absolute; top: calc(100% + 8px); left: 0; z-index: 50; min-width: 180px;
  display: flex; flex-direction: column; padding: 4px 0; background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--r-dialog); box-shadow: var(--shadow-open);
  font-size: 14px; font-weight: 400; color: var(--ink); white-space: nowrap; }
.menu-list.right { left: auto; right: 0; }
.menu-list > a, .menu-list > button, .menu-list > label { display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; text-decoration: none; color: var(--ink); text-align: left; width: 100%; cursor: pointer; }
.menu-list > a:hover, .menu-list > button:hover, .menu-list > label:hover,
.menu-list > a.on { background: var(--hover); color: var(--ink); }
.menu-list > form { display: contents; }
.menu-list > form > button { display: flex; align-items: center; gap: 8px; padding: 6px 12px; text-align: left;
  width: 100%; color: var(--ink); cursor: pointer; }
.menu-list > form > button:hover { background: var(--hover); }
.menu-list > hr { border: 0; border-top: 1px solid var(--rule); margin: 4px 0; width: 100%; }
.menu-list > .menu-h { padding: 6px 12px 2px; font-size: 11.5px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.menu-list > .menu-body { padding: 8px 12px; white-space: normal; }

/* ---- page frame ---------------------------------------------------------- */
.page { padding: 0 var(--side) 60px; }
.page.narrow { max-width: 1180px; margin: 0 auto; }
.phead { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; padding: 22px 0 16px; }
.ptitle { font-size: 28px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; }
.psub { color: var(--muted); }
.pactions { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sect { display: flex; align-items: baseline; gap: 10px; margin: 24px 0 10px; }
.sect h2, h2.sect { font-size: 16px; font-weight: 600; }
.sect .muted { font-size: 13.5px; }
.viewonly { display: none; }
body.readonly .viewonly { display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin: 0 0 14px;
  background: var(--info-fill); border: 1px solid var(--info-rule); border-radius: var(--r-ctl); font-size: 13.5px; }
/* Write controls carry .w; a viewer never sees them. */
body.readonly .w { display: none !important; }

/* Shell with a sidebar (Explorer, Teach) */
.shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: calc(100vh - var(--nav-h)); }
.side { background: var(--lane-tint); border-right: 1px solid var(--lane-rule); font-size: 13.5px;
  font-variant-numeric: tabular-nums; padding: 0 0 12px; min-width: 0; }
.side-h { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--rule); }
.side-h .lbl { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
/* The lane switch as the sidebar's heading: it fills the row, with the gear and the
   collapse button after it. While it is showing, the copy in the page header steps
   aside; a collapsed sidebar, or a phone (no sidebar), brings that copy back. */
.side-h .lanewrap { flex: 1; min-width: 0; display: flex; }
.side-h .lanewrap .seg { display: flex; flex: 1; min-width: 0; }
.side-h .lanewrap .seg > a { flex: 1; text-align: center; padding: 4px 6px; }
@media (min-width: 901px) { .shell.fixed:has(> .side:not(.collapsed) .lanewrap) .phead .seg.lane { display: none; } }
.side a.item { display: flex; justify-content: space-between; gap: 8px; padding: 5px 12px;
  text-decoration: none; color: var(--ink); white-space: nowrap; }
.side a.item:hover { background: var(--wash); }
.side a.item.on { background: var(--lane); color: var(--ground); }
.side a.item.on .neg, .side a.item.on .m { color: inherit; }
.side a.item > span:first-child { overflow: hidden; text-overflow: ellipsis; display: flex; gap: 5px; align-items: center; }
.side .total { display: flex; justify-content: space-between; gap: 8px; padding: 8px 12px 4px;
  border-top: 1px solid var(--rule-strong); margin-top: 6px; font-weight: 600; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--warn); display: inline-block; flex: none; }
.dot.bad { background: var(--bad); }

/* Group band: tinted, inset, caps label + subtotal */
.band { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 8px 8px 2px;
  padding: 4px 8px; border-radius: var(--r-ctl); background: var(--lane-band); color: var(--lane-head);
  font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; text-decoration: none; }
.band.neutral { background: var(--surface-tint); color: var(--muted); }
tr.band-row > td { background: var(--lane-band); color: var(--lane-head); font-size: 11.5px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; height: 26px; }
tr.band-row.neutral > td { background: var(--surface-tint); color: var(--muted); }
.tbl tbody tr.band-row:hover > td { background: var(--lane-band); }
.tbl tbody tr.band-row.neutral:hover > td { background: var(--surface-tint); }

/* A page with a lane switch says which lane it is in beyond the switch: a lane
   rule under the title row and lane-tinted column headers. */
body:has(.seg.lane) .phead { border-bottom: 2px solid var(--lane); margin-bottom: 16px; }
/* The lane switch sits LEFT, straight after the page title, on every page that has
   one in its header (the principal, 2026-10-09): the lane decides what the whole
   page shows, so it belongs beside the name of the page, not among the buttons.
   The header's action group dissolves into the row so the switch can be placed;
   whatever else was in it stays on the right. */
.phead > .pactions:has(> .seg.lane) { display: contents; }
.phead:has(> .pactions > .seg.lane) > .ptitle { order: -3; }
.phead > .pactions > .seg.lane { order: -2; }
.phead:has(> .pactions > .seg.lane) > .psub { order: -1; margin-right: auto; }
.phead:has(> .pactions > .seg.lane):not(:has(> .psub)) > .pactions > .seg.lane { margin-right: auto; }
body:has(.seg.lane) .tbl thead tr:not(.filters) > th { background: var(--lane-band); color: var(--lane-head); }
body:has(.seg.lane) .tbl thead tr:not(.filters) > th a { color: inherit; }

/* ---- buttons ------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 14px;
  border: 1px solid var(--accent-line); border-radius: var(--r-ctl); background: transparent; color: var(--ink);
  font-size: 14px; font-weight: 500; line-height: 1.35; white-space: nowrap; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--hover); color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--ground); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--ground); }
.btn.danger { border-color: var(--bad-rule); color: var(--bad); }
.btn.danger:hover { background: var(--bad-fill); }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: var(--ground); }
.btn.future { border-color: var(--future); color: var(--future); }
.btn.sm { padding: 3px 10px; font-size: 13px; }
.btn.icon { width: 28px; height: 28px; padding: 0; }
.btn.icon.sm { width: 22px; height: 22px; font-size: 12px; }
.btn.quiet { border-color: var(--rule); color: var(--muted); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: default; pointer-events: none; }
.btn.on { background: var(--accent); border-color: var(--accent); color: var(--ground); }
.link { text-decoration: underline; text-underline-offset: 2px; color: var(--ink); font-weight: 500; cursor: pointer; }
.link:hover { color: var(--muted); }
.link.sm { font-size: 13px; font-weight: 400; }
.spin { width: 10px; height: 10px; border: 1.5px solid currentColor; border-top-color: transparent;
  border-radius: 50%; display: inline-block; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Segmented control: tabs, period pickers, the lane switch */
.seg { display: inline-flex; border: 1px solid var(--accent-line); border-radius: var(--r-ctl);
  overflow: hidden; font-size: 13px; }
.seg > a, .seg > button, .seg > label { padding: 4px 12px; color: var(--muted); text-decoration: none;
  white-space: nowrap; cursor: pointer; }
.seg > a + a, .seg > button + button, .seg > label + label { border-left: 1px solid var(--rule); }
.seg > a:hover, .seg > button:hover, .seg > label:hover { background: var(--hover); color: var(--ink); }
.seg > .on, .seg > .on:hover { background: var(--accent); color: var(--ground); font-weight: 500; }
.seg.lane { border-color: var(--lane); }
.seg.lane > .on, .seg.lane > .on:hover { background: var(--lane); }
.seg.lane > .on[data-lane="personal"] { background: var(--lane-pers); }
.seg.lane > .on[data-lane="business"] { background: var(--lane-biz); }

/* Filter pills (entity pickers, toggles with a count) */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: 1px solid var(--rule);
  border-radius: var(--r-ctl); font-size: 13px; font-weight: 500; text-decoration: none; color: var(--ink);
  white-space: nowrap; cursor: pointer; background: var(--surface); }
.pill:hover { background: var(--hover); }
.pill.on { background: var(--accent); border-color: var(--accent); color: var(--ground); }
.pill.on.lane { background: var(--lane); border-color: var(--lane); }
.pill .n { font-weight: 400; opacity: .8; font-variant-numeric: tabular-nums; }

/* ---- chips --------------------------------------------------------------- */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border: 1px solid var(--rule);
  border-radius: var(--r-ctl); font-size: 12px; font-weight: 500; line-height: 16px; color: var(--ink-2);
  white-space: nowrap; text-decoration: none; }
/* A Coverage card's documents: the plan's booklet, schedule or guide, each a link into the archive. */
.cv-docs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 2px 0 14px; }
.cv-docs a.chip { text-decoration: none; }
.cv-docs a.chip:hover { border-color: var(--ink); }
.chip.bad  { background: var(--bad-fill);  border-color: var(--bad-rule);  color: var(--bad-deep); }
.chip.warn { background: var(--warn-fill); border-color: var(--warn-rule); color: var(--warn-deep); }
.chip.ok   { background: var(--ok-fill);   border-color: var(--ok-rule);   color: var(--ok-deep); }
.chip.info { background: var(--info-fill); border-color: var(--info-rule); color: var(--ink-2); }
.chip.muted { color: var(--muted); }
/* A chip that names which GROUP something belongs to (the news tags: holdings,
   custodians, spending, macro). It borrows the categorical chart palette, the one
   set of colours in the kit whose job is to tell groups apart, as a tint behind ink
   text; red, amber and grey are left out because they read as severity or as off. */
.chip.cat { background: color-mix(in srgb, var(--c) 22%, var(--surface));
  border-color: color-mix(in srgb, var(--c) 55%, var(--surface)); color: var(--ink); }
.chip.cat.k3 { --c: var(--cat-3); } .chip.cat.k4 { --c: var(--cat-4); } .chip.cat.k5 { --c: var(--cat-5); }
.chip.cat.k6 { --c: var(--cat-6); } .chip.cat.k7 { --c: var(--cat-7); }
.chip.dash { border-style: dashed; color: var(--muted); }
.chip.future { border-color: var(--future); color: var(--future); }
.chip.future.fill { background: var(--future-fill); border-color: var(--future-rule); }
.chip.pers { background: var(--lane-pers-band); border-color: var(--lane-pers-rule); color: var(--lane-pers-head); }
.chip.biz  { background: var(--lane-biz-band);  border-color: var(--lane-biz-edge); color: var(--lane-biz); }
.chip.solid.bad  { background: var(--bad);  border-color: var(--bad);  color: var(--ground); }
.chip.solid.warn { background: var(--warn); border-color: var(--warn); color: var(--ground); }
.chip.solid.ok   { background: var(--ok);   border-color: var(--ok);   color: var(--ground); }
/* Age: plain until 14 days, then filled bad */
.age { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: center; white-space: nowrap; }
.age.old { padding: 1px 5px; border-radius: var(--r-ctl); background: var(--bad); color: var(--ground); }

/* Provenance: who set the category */
.prov { display: inline-flex; align-items: center; padding: 0 6px; border-radius: var(--r-ctl); font-size: 12px;
  font-weight: 500; line-height: 18px; white-space: nowrap; border: 1px solid transparent; }
.prov.rule    { background: var(--how); color: var(--ground); }
.prov.learned { background: var(--how-fill); color: var(--how-deep); border-color: var(--how-rule); }
.prov.model   { border: 1px dashed var(--how); color: var(--how); }
.prov.you     { border: 1px dashed var(--muted); color: var(--ink); }
.prov.ref     { background: var(--warn-fill); color: var(--warn-deep); border-color: var(--warn-rule); }
.prov.missing { background: var(--bad-fill); color: var(--bad-deep); border-color: var(--bad-rule); }
.prov.none    { color: var(--faint); padding: 0; }

/* Status letter: 20px circle, the letter is the content */
.st { width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center;
  justify-content: center; font-size: 12px; font-weight: 600; line-height: 1; flex: none;
  border: 1.5px solid var(--accent); color: var(--ink); }
.st.reconciled { background: var(--accent); color: var(--ground); }
.st.cleared    { border-color: var(--accent); }
.st.uncleared  { border-color: var(--muted); color: var(--muted); }
.st.pending    { border: 1.5px dotted var(--faint); color: var(--faint); }
.st.future     { border-color: var(--future); color: var(--future); }
.st.overdue    { background: var(--bad); border-color: var(--bad); color: var(--ground); }
.st.other      { background: var(--warn); border-color: var(--warn); color: var(--ground); }
.st.mgr        { background: var(--lane-biz); border-color: var(--lane-biz); color: var(--ground); }
.st.manual     { border: 1.5px dashed var(--muted); color: var(--ink); }
.st.holding    { background: var(--info-fill); border-color: var(--info-rule); color: var(--muted); }  /* a position, not a bank line: quieter than any settle state */

/* Receipt mark: a drawn receipt (no emoji), read like the status letters.
   linked = filled ink · awaiting = ink outline · wanted = warn outline · none = pale outline */
.rc { width: 18px; height: 18px; display: inline-block; flex: none; vertical-align: middle; border: 0;
  background-color: var(--rule-strong);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 2.5v19l2.3-1.4 2.4 1.4 2.3-1.4 2.3 1.4 2.4-1.4 2.3 1.4v-19l-2.3 1.4-2.4-1.4-2.3 1.4-2.3-1.4-2.4 1.4z'/%3E%3Cpath d='M9 9h6M9 13h6'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 2.5v19l2.3-1.4 2.4 1.4 2.3-1.4 2.3 1.4 2.4-1.4 2.3 1.4v-19l-2.3 1.4-2.4-1.4-2.3 1.4-2.3-1.4-2.4 1.4z'/%3E%3Cpath d='M9 9h6M9 13h6'/%3E%3C/svg%3E") center / contain no-repeat; }
.rc.linked   { background-color: var(--ink);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' fill-rule='evenodd' d='M4 1.5v21l2.6-1.6 2.7 1.6 2.7-1.6 2.7 1.6 2.7-1.6 2.6 1.6v-21l-2.6 1.6-2.7-1.6-2.7 1.6-2.7-1.6-2.7 1.6zM8 7.9h8v2.2H8zM8 11.9h8v2.2H8z'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' fill-rule='evenodd' d='M4 1.5v21l2.6-1.6 2.7 1.6 2.7-1.6 2.7 1.6 2.7-1.6 2.6 1.6v-21l-2.6 1.6-2.7-1.6-2.7 1.6-2.7-1.6-2.7 1.6zM8 7.9h8v2.2H8zM8 11.9h8v2.2H8z'/%3E%3C/svg%3E"); }
.rc.awaiting { background-color: var(--ink); }
.rc.wanted   { background-color: var(--warn); }
.rc.none     { background-color: var(--rule-strong); }
/* Bill mark, on rows that need an itemized bill: a badge on the receipt's corner.
   ok = bill linked · wait = bill filed at, not in the archive yet · miss = no bill */
.rcw { position: relative; display: inline-block; line-height: 0; vertical-align: middle; }
/* How many receipts: a small figure at the top corner, so the bill mark keeps its place at the bottom one. */
/* How many receipts: a small badge over the upper-right corner, as the bill dot sits over the lower right. */
.rcw sub { position: absolute; top: -4px; right: -4px; min-width: 11px; height: 11px; padding: 0 2px; box-sizing: border-box;
  border-radius: 6px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--ink-2); color: var(--ink) !important;
  font-size: 8px; line-height: 11px; font-weight: 700; text-align: center; vertical-align: baseline; }
.rcb { position: absolute; right: -4px; bottom: -3px; width: 11px; height: 11px; border-radius: 50%;
  border: 1.5px solid var(--surface); box-sizing: border-box; }
.rcb.ok   { background: var(--ok); }
.rcb.ok::after { content: ""; position: absolute; left: 2.6px; top: 0.6px; width: 2.4px; height: 4.6px;
  border: solid var(--surface); border-width: 0 1.4px 1.4px 0; transform: rotate(45deg); }
.rcb.wait { background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--ink); }
.rcb.miss { background: var(--warn); }

/* ---- cards, KPI strip, exception rows ------------------------------------ */
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-card); }
.card.pad { padding: 16px 18px; }
.card-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  font-weight: 600; margin-bottom: 10px; }
.card-h .muted { font-weight: 400; font-size: 13px; }
.card hr, hr.rule { border: 0; border-top: 1px solid var(--rule); margin: 12px 0; }
.sub-h { font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 0 0 6px; display: flex; justify-content: space-between; gap: 10px; }
.cols2 { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 24px; align-items: start; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--r-card); font-variant-numeric: tabular-nums; }
.kpi { padding: 16px 20px; display: flex; flex-direction: column; gap: 3px; border-left: 1px solid var(--rule); min-width: 0; }
.kpi:first-child { border-left: 0; }
.kpi .lbl, .kpi .ctx { font-size: 13px; color: var(--muted); }
.kpi .fig { font-size: 30px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; }
.kpi .fig.hero { font-size: 40px; }
.kpi .fig.sm { font-size: 23px; }
.kpi .fig .pct { font-size: 15px; font-weight: 500; letter-spacing: 0; margin-left: 8px; color: var(--muted); }
.kpi .fig .pct.pos { color: var(--ok); }
.kpi .fig .pct.neg { color: var(--bad); }

.exc { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 9px 12px; border: 1px solid var(--info-rule); border-radius: var(--r-card);
  background: var(--info-fill); margin-bottom: 6px; }
.exc .t { font-weight: 600; }
.exc .d { color: var(--ink-2); }
.exc .verbs { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.exc .verbs form { margin: 0; display: flex; gap: 6px; }
/* The Snooze menu: its forms are menu rows, not a verbs row. */
.exc .verbs .snooze .menu-list { min-width: 100%; }   /* as wide as the button, no wider */
.exc .verbs .snooze .menu-list > form { display: contents; }
.exc .verbs .snooze .menu-list > form > button { width: 100%; font-size: 13px; justify-content: flex-end; text-align: right; white-space: nowrap; }
.exc .verbs a { font-size: 13px; white-space: nowrap; }
.exc.bad  { background: var(--bad-fill);  border-color: var(--bad-rule); }
.exc.warn { background: var(--warn-fill); border-color: var(--warn-rule); }
.exc.bad .t, .exc.bad .age:not(.old) { color: var(--bad-deep); }
.exc.warn .t, .exc.warn .age:not(.old) { color: var(--warn-deep); }

/* One-line context strips above a register (tie, statement, projection) */
.strip { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 8px 12px; margin-bottom: 8px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-card);
  font-variant-numeric: tabular-nums; }
.strip .lbl { font-weight: 600; }
.strip strong { font-weight: 600; }
.strip form { margin: 0; display: flex; gap: 6px; align-items: center; }

/* Page messages and toasts */
.msg { display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin: 0 0 12px; font-size: 13.5px;
  background: var(--info-fill); border: 1px solid var(--info-rule); border-radius: var(--r-ctl); }
.msg strong { font-weight: 600; }
.msg.ok   { background: var(--ok-fill);   border-color: var(--ok-rule); }   .msg.ok strong   { color: var(--ok-deep); }
.msg.bad  { background: var(--bad-fill);  border-color: var(--bad-rule); }  .msg.bad strong  { color: var(--bad-deep); }
.msg.warn { background: var(--warn-fill); border-color: var(--warn-rule); } .msg.warn strong { color: var(--warn-deep); }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: flex; flex-direction: column;
  gap: 8px; align-items: flex-end; }
.toast { display: flex; align-items: center; gap: 10px; padding: 10px 12px; max-width: 420px;
  background: var(--accent); color: var(--ground); border-radius: var(--r-ctl); font-size: 13.5px;
  box-shadow: var(--shadow-float); transition: opacity .5s; }
.toast.bad { background: var(--bad); }
.toast.out { opacity: 0; }
.toast .x { color: var(--seq-3); margin-left: 6px; }
.toast.bad .x { color: var(--ground); }

.empty { border: 1px dashed var(--rule-strong); border-radius: var(--r-card); padding: 28px 16px;
  text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 6px; align-items: center; }
.empty .sm { font-size: 13px; }
td.empty-cell { text-align: center; color: var(--muted); padding: 28px 16px; height: auto; }

/* ---- tables -------------------------------------------------------------- */
.tablewrap { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-card);
  overflow-x: auto; }
.tablewrap.scroll { max-height: 70vh; overflow-y: auto; padding-right: 14px; scrollbar-gutter: stable; }
/* Freeze: the header row stays under the nav while the PAGE scrolls. A plain
   .tablewrap scrolls sideways, which makes it the box its sticky header sticks
   to, so on a long table the header leaves with the top of the box. Wide
   screens have no need of the sideways scroll; narrow ones keep it. */
@media (min-width: 901px) {
  .tablewrap.freeze { overflow: visible; }
  .tablewrap.freeze > .tbl > thead th { top: var(--nav-h); }
  .tablewrap.freeze > .tbl > thead th:first-child { border-top-left-radius: var(--r-card); }
  .tablewrap.freeze > .tbl > thead th:last-child { border-top-right-radius: var(--r-card); }
}
/* The same for a table that must keep its sideways scroll (a column picker can
   make it wider than the page): the box becomes the height of the window and
   scrolls both ways, and the header pins to the top of the box. */
.tablewrap.freeze-box { max-height: calc(100vh - var(--nav-h) - 16px); overflow: auto; }
.tbl { width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
.tbl th { position: sticky; top: 0; z-index: 2; background: var(--surface); text-align: left; font-size: 13px;
  font-weight: 600; padding: 7px 10px; border-bottom: 1px solid var(--rule-strong); white-space: nowrap; }
.tbl th.num, .tbl td.num { text-align: right; }
.tbl th[data-sort], .tbl th a { cursor: pointer; text-decoration: none; color: var(--ink); user-select: none; }
.tbl th[data-dir="asc"]::after { content: " ↑"; } .tbl th[data-dir="desc"]::after { content: " ↓"; }
.tbl td { height: var(--row-h); padding: 0 10px; border-bottom: 1px solid var(--rule-row); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 340px; }
.tbl td.wrap { white-space: normal; max-width: none; padding-top: 6px; padding-bottom: 6px; }
.tbl tbody tr:last-child > td { border-bottom: 0; }
/* Faint banding (table[data-band]) so the eye can follow a row across a wide
   table. The script marks every other VISIBLE data row, so split legs, edit
   panels and filtered-out rows never throw the stripes off. */
:where(.tbl) tr.alt > td { background: var(--wash-alt); }
/* The hover wears the lane: sage on personal, slate on business. The neutral
   grey sat one shade off the banding and the two read as the same row. */
.tbl tbody tr:hover > td { background: var(--lane-band); }
.tbl tr.click { cursor: pointer; }
/* Selected wears the same lane colour as the hover; the bar on the left edge
   is what says "picked" once the pointer has moved on. */
.tbl tr.sel > td, .tbl tr.selected > td, .tbl tr.editing > td { background: var(--lane-band); }
.tbl tr.sel.lane > td { background: var(--lane-band); }
.tbl tr.sel.lane > td:first-child { box-shadow: inset 3px 0 0 var(--lane); }
.tbl tr.hl > td { background: var(--warn-fill); }
.tbl tr.leg > td { background: var(--ground); font-size: 13px; color: var(--ink-2); height: 28px; }
.tbl tr.faint > td, .tbl tr[data-status="pending"] > td { color: var(--faint); }
.tbl tr.future > td { color: var(--future); }
.tbl tr.off > td { opacity: .45; }
.tbl tr.filters > th { top: 0; background: var(--ground); font-weight: 400; padding: 6px 10px;
  border-bottom: 1px solid var(--rule); }
.tbl tr.panel > td { height: auto; white-space: normal; max-width: none; padding: 14px 12px 14px 46px;
  background: var(--surface); box-shadow: inset 3px 0 0 var(--accent); overflow: visible; }
.tbl tr.panel:hover > td { background: var(--surface); }
.tbl tfoot td { font-weight: 600; border-top: 1px solid var(--rule-strong); border-bottom: 0; }
.tbl .sub { display: block; font-size: 12.5px; color: var(--muted); }
.ref { font-family: var(--mono); font-size: 12px; color: var(--faint); user-select: all; }

/* Summary line above a register */
.sumline { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 4px 0 10px;
  font-variant-numeric: tabular-nums; }
.sumline strong { font-weight: 600; }

/* Bulk / match bar: floats bottom centre */
.floatbar { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 16px; background: var(--accent);
  color: var(--ground); border-radius: var(--r-card); font-size: 14px; box-shadow: var(--shadow-float); }
.floatbar .btn { border-color: var(--seq-3); color: var(--ground); }
.floatbar .btn:hover { background: var(--accent-hover); }
.floatbar .btn.primary { background: var(--ground); border-color: var(--ground); color: var(--ink); }
.floatbar .x { color: var(--seq-3); padding: 0 4px; }
.floatbar.light { background: var(--surface); color: var(--ink); border: 1px solid var(--rule); box-shadow: var(--shadow-open); }
.floatbar.light .btn { border-color: var(--accent-line); color: var(--ink); }
.floatbar.light .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--ground); }

/* ---- forms --------------------------------------------------------------- */
.in, :is(.page, .main) input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=range]):not([type=file]),
:is(.page, .main) select, :is(.page, .main) textarea, dialog input:not([type=checkbox]):not([type=radio]):not([type=hidden]),
dialog select, dialog textarea {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--surface); height: 32px; padding: 0 8px;
  border: 1px solid var(--rule); border-radius: var(--r-ctl); min-width: 0; max-width: 100%; }
:is(.page, .main) textarea, dialog textarea { height: auto; padding: 6px 8px; }
.in:focus, :is(.page, .main) input:focus, :is(.page, .main) select:focus, :is(.page, .main) textarea:focus,
dialog input:focus, dialog select:focus, dialog textarea:focus { outline: none; border-color: var(--ink); }
.in.sm, :is(.page, .main) input.sm, :is(.page, .main) select.sm { height: 26px; font-size: 13px; padding: 0 6px; }
.in.money, input.money { text-align: right; font-variant-numeric: tabular-nums; }
.in.bad, input.bad { border-color: var(--bad); }
::placeholder { color: var(--faint); opacity: 1; }
.full { width: 100%; }

input[type=checkbox], input[type=radio] { appearance: none; -webkit-appearance: none; width: 14px; height: 14px;
  margin: 0; flex: none; border: 1px solid var(--accent-line); background: var(--surface); vertical-align: middle;
  display: inline-grid; place-content: center; cursor: pointer; }
input[type=checkbox] { border-radius: var(--r-check); }
input[type=radio] { border-radius: 50%; }
input[type=checkbox]:checked { background: var(--accent); border-color: var(--accent); }
input[type=checkbox]:checked::after { content: "✓"; color: var(--ground); font-size: 11px; line-height: 1; font-weight: 600; }
input[type=radio]:checked::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
input[type=checkbox]:disabled, input[type=radio]:disabled { opacity: .45; cursor: default; }
label.chk { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; min-width: 0; }
.field > span, .field > label { color: var(--muted); }
.field.req > span { color: var(--bad); }
.field .hint { color: var(--faint); font-size: 12.5px; }
.fgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.fgrid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fgrid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.fgrid .wide { grid-column: 1 / -1; }
.fgrid input:not([type=checkbox]):not([type=radio]), .fgrid select, .fgrid textarea { width: 100%; }
.frow { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.search { min-width: 200px; }

/* Split / leg editor: rows that must sum to a total */
.legs { display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.legs-h { display: flex; justify-content: space-between; align-items: baseline; font-weight: 600; }
.legs-h .tally { font-weight: 400; font-variant-numeric: tabular-nums; }
.legs-h .tally.ok { color: var(--ok-deep); } .legs-h .tally.bad { color: var(--bad); }
.leg-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 110px 24px; gap: 8px; align-items: center; }
.leg-row.c2 { grid-template-columns: minmax(0, 1fr) 110px 24px; }
.leg-row input { width: 100%; }
.leg-x { color: var(--muted); text-align: center; }
.leg-x:hover { color: var(--bad); }

/* ---- dialogs ------------------------------------------------------------- */
dialog.dlg { width: min(460px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--rule);
  border-radius: var(--r-dialog); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-open);
  font-size: 14px; }
dialog.dlg.wide { width: min(560px, calc(100vw - 32px)); }
dialog.dlg.xwide { width: min(760px, calc(100vw - 32px)); }
dialog.dlg.confirm { width: min(360px, calc(100vw - 32px)); }
dialog.dlg::backdrop { background: var(--scrim); }
.dlg-h { padding: 14px 16px; border-bottom: 1px solid var(--rule); }
.dlg-h .t { font-weight: 600; font-size: 16px; }
.dlg-h .s { color: var(--muted); font-size: 13px; }
.dlg.confirm .dlg-h { border-bottom: 0; padding-bottom: 12px; }
.dlg.confirm .dlg-h .s { color: var(--ink-2); font-size: 14px; margin-top: 4px; }
.dlg-b { padding: 14px 16px; max-height: 70vh; overflow-y: auto; }
.dlg-f { padding: 12px 16px; border-top: 1px solid var(--rule); display: flex; align-items: center; gap: 8px; }
.dlg-f .sp { margin-left: auto; }

/* ---- charts -------------------------------------------------------------- */
.segbar { display: flex; height: 12px; border-radius: var(--r-ctl); overflow: hidden; gap: 2px; background: var(--track); }
.segbar.bare { background: transparent; }
.segbar > span, .segbar > a { display: block; min-width: 2px; }
.legend { display: grid; grid-template-columns: 12px minmax(0, 1fr) 40px 76px; gap: 4px 8px; align-items: center;
  font-size: 13.5px; font-variant-numeric: tabular-nums; }
.legend.c2 { grid-template-columns: repeat(2, 12px minmax(0, 1fr) 40px 76px); column-gap: 8px; }
.legend .sw, .sw { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.legend .pct { text-align: right; color: var(--muted); }
.legend .amt { text-align: right; }
.legend a, .legend button { text-decoration: none; text-align: left; }
.c-1 { background: var(--cat-1); } .c-2 { background: var(--cat-2); } .c-3 { background: var(--cat-3); }
.c-4 { background: var(--cat-4); } .c-5 { background: var(--cat-5); } .c-6 { background: var(--cat-6); }
.c-7 { background: var(--cat-7); } .c-8 { background: var(--cat-8); }
.c-ink { background: var(--accent); } .c-soft { background: var(--seq-3); } .c-pale { background: var(--seq-2); }
.c-lane { background: var(--lane); } .c-ok { background: var(--ok); } .c-warn { background: var(--warn); }
.c-bad { background: var(--bad); } .c-info { background: var(--muted); } .c-future { background: var(--future); }

/* Deviation bar around a centre line: style="--v: 12" (percent of half-width, signed via .over/.under) */
.devlist { display: grid; grid-template-columns: minmax(70px, auto) minmax(0, 1fr) 48px; gap: 6px 10px;
  align-items: center; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.devbar { height: 8px; background: var(--track); border-radius: var(--r-ctl); position: relative; }
.devbar::before { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--accent); }
.devbar > i { position: absolute; top: 0; bottom: 0; width: calc(var(--v, 0) * 1%); max-width: 50%; }
.devbar.over > i { left: 50%; background: var(--bad); border-radius: 0 var(--r-ctl) var(--r-ctl) 0; }
.devbar.under > i { right: 50%; background: var(--ok); border-radius: var(--r-ctl) 0 0 var(--r-ctl); }

/* Progress bar: style="--v: 62" */
.progress { height: 8px; background: var(--track); border-radius: var(--r-ctl); position: relative; overflow: hidden; }
.progress > i { position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--v, 0) * 1%); max-width: 100%;
  background: var(--ok); border-radius: var(--r-ctl); }
.progress.warn > i { background: var(--warn); } .progress.bad > i { background: var(--bad); }
.progress.info > i { background: var(--muted); } .progress.ink > i { background: var(--accent); }

/* ---- list rows inside cards (Home's Ahead / Operations, report lists) ----- */
.lines > .line { display: grid; grid-template-columns: var(--lc, 96px 88px minmax(0, 1fr)); gap: 12px;
  align-items: baseline; padding: 5px 0; font-variant-numeric: tabular-nums; text-decoration: none; color: var(--ink); }
.lines > a.line:hover { background: var(--hover); color: var(--ink); }
.lines .sm, .sm { font-size: 13px; }
.lines form { display: inline; margin: 0 0 0 6px; }
.note { font-size: 13px; color: var(--muted); margin-top: 10px; }
.gauge { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
/* Plan-progress rows: name · bar · actual and plan */
.wf-h { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); margin: 12px 0 2px; }
.wf-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 5px 0;
  font-variant-numeric: tabular-nums; }
.wf-row .amt { text-align: right; white-space: nowrap; }
.wf-row .amt strong { font-weight: 600; }
.progress.over { overflow: visible; }
.progress.over::after { content: ""; position: absolute; right: -2px; top: -2px; bottom: -2px; width: 3px;
  border-radius: 2px; background: var(--bad); }
.news-g { padding: 6px 0; border-top: 1px solid var(--rule-row); }
.news-g:first-of-type { border-top: 0; }
.news-s { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.news-i { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; }
.news-i.quiet { color: var(--faint); }
.catrow { display: grid; grid-template-columns: minmax(0, 1fr) 40px 80px; gap: 10px; align-items: center; padding: 5px 0;
  position: relative; font-variant-numeric: tabular-nums; }
.catrow > i { position: absolute; left: 0; top: 2px; bottom: 2px; width: calc(var(--v, 0) * 1%); opacity: .14; border-radius: 3px; }
.catrow > span { position: relative; }

/* ---- Explorer: viewport-locked shell, the register scrolls inside it -------- */
.shell.fixed { display: flex; height: calc(100vh - var(--nav-h)); min-height: 0; }
.shell.fixed > .side { width: 250px; flex: none; overflow-y: auto; }
.shell.fixed > .side.collapsed { width: 40px !important; overflow: hidden; }
.side.collapsed .side-body, .side.collapsed .side-h .lbl, .side.collapsed .side-h .hide-c { display: none; }
.side.collapsed .side-h { justify-content: center; padding: 10px 4px; }
.side a.item.sub { padding-left: 30px; }
.side a.item.dim { opacity: .55; }
.side a.item.dim:hover { opacity: 1; }
/* A subgroup sits visibly INSIDE its group: indented, lighter and unbanded, so it never reads as a group of its own. */
.side .subband { display: block; padding: 5px 12px 0 22px; font-size: 11.5px; font-weight: 500; letter-spacing: .04em;
  text-transform: uppercase; color: var(--faint); text-decoration: none; }
.side a.subband:hover, .side a.band:hover { color: var(--ink); }
.side a.band.on, .side a.subband.on { background: var(--lane); color: var(--ground); }
.side .hidtog { cursor: pointer; user-select: none; padding: 6px 12px; font-size: 12px; color: var(--muted); }
.side .hidbody { display: none; } .side .hidbody.open { display: block; }
.grip { width: 6px; flex: none; cursor: col-resize; margin-left: -3px; z-index: 3; }
.grip:hover, .grip.live { background: var(--lane); }
.side.collapsed + .grip { display: none; }
.shell.fixed > .main { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 0 24px 14px; }
.shell.fixed > .main > form.regform { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.shell.fixed .tablewrap { flex: 1; min-height: 0; overflow: auto; }
.exc.noage { grid-template-columns: minmax(0, 1fr) auto; }
.toolbar { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; margin: 0 0 10px; font-variant-numeric: tabular-nums; }
.toolbar strong { font-weight: 600; }
.toolbar .vr { width: 1px; height: 16px; background: var(--rule); }
.drawer { margin: 0 0 10px; padding: 8px 0; max-width: 620px; background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--r-card); }
.drawer .line { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 12px; padding: 3px 14px; }
/* The register: fixed layout so columns hold their widths and can be dragged */
.tbl.reg { table-layout: fixed; }   /* its width is set by the page script: the sum of the visible columns */
.tbl.reg td { max-width: none; }

.tbl.reg th { position: sticky; }
.tbl.reg tr.filters > th { top: 0; z-index: 6; height: 38px; vertical-align: middle; overflow: visible; }
.tbl.reg tr.hdr > th { top: 38px; z-index: 3; }
.tbl.reg tr.filters input:not([type=checkbox]), .tbl.reg tr.filters select, .tbl.reg tr.filters .dd > summary {
  width: 100%; height: 26px !important; font-size: 13px; padding: 0 6px; }
.tbl.reg .duo { display: flex; gap: 4px; } .tbl.reg .duo input { min-width: 0; }
.tbl.reg tbody tr[data-id] { cursor: pointer; }
.tbl.reg td .cellflex { display: flex; align-items: center; gap: 6px; min-width: 0; }
.tbl.reg td .cellflex .ctxt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tbl.reg td .cellflex .chip { flex: none; }
.tbl.reg td.balcell.blank > * { visibility: hidden; }
.tbl.reg tr.jumped > td { background: var(--lane-band); transition: background 1.2s ease; }
.tbl.reg tr.leg > td { height: auto; padding: 0; }
/* A split's legs line up under the register's own columns: the memo under
   Payee / Narration, the category or account under its column, the amount
   under Amount. The page script publishes the column edges as --c1..--c4. */
.legline { display: grid; grid-template-columns: var(--c1, 46px) calc(var(--c2, 300px) - var(--c1, 46px))
  calc(var(--c3, 500px) - var(--c2, 300px)) calc(var(--c4, 620px) - var(--c3, 500px)); align-items: center;
  min-height: 28px; border-top: 1px solid var(--rule-row); }
.legline > span { padding: 0 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legline > .lg-tag { text-align: right; color: var(--faint); font-size: 12px; }
.rz { position: absolute; right: 0; top: 0; bottom: 0; width: 7px; cursor: col-resize; z-index: 8; }
.splittoggle { cursor: pointer; }
/* Checkbox dropdown used as a column filter */
.dd { position: relative; }
.dd > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between;
  gap: 4px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-ctl); color: var(--muted);
  white-space: nowrap; overflow: hidden; font-weight: 400; }
.dd > summary::-webkit-details-marker { display: none; }
.dd > summary::after { content: ""; flex: none; width: 0; height: 0; border-style: solid;
  border-width: 6px 5px 0 5px; border-color: currentColor transparent transparent transparent; }
.dd-menu { position: fixed; z-index: 60; min-width: 190px; max-height: 60vh; overflow-y: auto; padding: 4px 0;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-dialog); box-shadow: var(--shadow-open);
  font-size: 14px; font-weight: 400; }
.dd-menu label { display: flex; align-items: center; gap: 8px; padding: 5px 12px; cursor: pointer; white-space: nowrap; }
.dd-menu label:hover { background: var(--hover); }
.dd-menu .grp-h { padding: 6px 12px 2px; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); }
/* Inline edit panel */
.ep-wrap { display: flex; flex-direction: column; gap: 12px; max-width: 980px; position: sticky; left: 46px; }
.ep-legrow { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 110px 24px; gap: 8px; align-items: center;
  margin-bottom: 6px; }
.ep-legrow input { width: 100%; } .ep-legrow input.amt { text-align: right; }
.ep-legsum.ok { color: var(--ok-deep); } .ep-legsum.bad { color: var(--bad); }
.ep-note { font-size: 13.5px; color: var(--warn-deep); }

/* ---- phone (iPhone landscape is 844 wide) -------------------------------- */
@media (max-width: 900px) {
  :root { --side: 16px; --row-h: 44px; }
  .nav { gap: 14px; padding: 0 16px; }
  .nav-tabs > a:not(.on):not(.home), .nav-tabs > .menu, .nav-sep { display: none; }
  .nav .nav-more { display: flex; }
  .nav-status .wide-only { display: none; }
  .phead { padding: 14px 0 10px; }
  .ptitle { font-size: 22px; }
  .cols2 { grid-template-columns: minmax(0, 1fr); }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .shell > .side { display: none; }
  .btn, .pill, .seg > * { min-height: 34px; }
  .exc .verbs .btn { min-height: 34px; }
  .shell.fixed { display: block; height: auto; }
  .shell.fixed > .side, .grip { display: none; }
  .shell.fixed > .main { padding: 0 16px 14px; display: block; }
  .shell.fixed .tablewrap { overflow-x: auto; max-height: none; }
  .tbl.reg { table-layout: auto; width: 100%; }
  .tbl.reg [data-col]:not([data-phone]) { display: none !important; }
  .tbl.reg tr.filters { display: none; }
  .legline { display: flex; justify-content: space-between; gap: 10px; }
  .legline > .lg-tag { display: none; }
  .tbl.reg tr.hdr > th { top: 0; }
  .wide-only, .exc .d { display: none !important; }
  .exc { grid-template-columns: 36px minmax(0, 1fr) auto; }
  .fgrid.c3, .fgrid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 901px) { .phone-only { display: none !important; } }
/* Portrait phone: the bar closes up so its buttons (exception pill, night, veil, avatar) all stay on
   the screen. The wordmark goes: the Home tab beside it is the same link. */
@media (max-width: 480px) {
  .nav { gap: 8px; padding: 0 10px; }
  .nav-brand { display: none; }
  .nav-tabs { gap: 10px; }
  .nav-status { gap: 6px; }
}
/* Portrait phone: rows that put a fixed-width column beside running text stack instead.
   An exception's three verbs plus its link, and a news row's "source · age" label, do not
   shrink; on a 375px screen they left the title a few pixels wide (one word per line) and ran
   the verbs off the right edge. Landscape (844) still fits them side by side. */
@media (max-width: 560px) {
  .exc { grid-template-columns: 36px minmax(0, 1fr); row-gap: 8px; }
  .exc.noage { grid-template-columns: minmax(0, 1fr); }
  .exc .verbs { grid-column: 1 / -1; flex-wrap: wrap; row-gap: 6px; }
  .news-i { flex-direction: column; gap: 2px; padding: 4px 0; }
  .news-i .nowrap { white-space: normal; }
  /* The Home tiles: two per row at this width, so the net-worth figure overflowed its tile.
     The first tile gets the row to itself; the rest pair up beneath it. */
  .kpi { padding: 14px 16px; }
  #hometiles .kpi:first-child { grid-column: 1 / -1; }
  #hometiles .kpi:nth-child(even) { border-left: 0; }
  /* The spending legend's two side-by-side columns do not fit; one column does. */
  .legend.c2 { grid-template-columns: 12px minmax(0, 1fr) 40px 76px; }
}

@media print {
  .nav, .toasts, .floatbar, .noprint, .pactions { display: none !important; }
  body { background: #fff; }
  .page { padding: 0; }
}

/* ==========================================================================
   Patterns lifted out of the pages. Each began as one page's own <style>; a
   page now keeps only layout that exists on that page alone. This section sits
   after the phone and print blocks on purpose: these rules were written to
   load after everything above, and their own phone rules close the section.
   Every one has an example on the component page (/ui/kit).
   ========================================================================== */

/* ---- text ---------------------------------------------------------------- */
/* Lead paragraph under a page or section head, at reading width.
   .ink = body voice · .sm = small muted note (13px, 12px below). */
.lede { color: var(--muted); max-width: 86ch; margin: 0 0 18px; }
.lede.ink { color: var(--ink-2); }
.lede.sm { font-size: 13px; margin-bottom: 12px; }
/* Faint aside beside or under a control (inside a .field it is the field's 12.5px hint). .blk = on its own line. */
.hint { font-size: 13px; color: var(--faint); }
.hint.blk { display: block; }
/* Rendered long-form text (a synced report): headings, lists and tables at a readable measure. */
.prose > * { max-width: 76ch; }
.prose h1 { font-size: 18px; font-weight: 600; letter-spacing: -.01em; margin: 18px 0 6px; }
.prose h2 { font-size: 16px; font-weight: 600; margin: 18px 0 6px; }
.prose h3, .prose h4 { font-size: 14.5px; font-weight: 600; margin: 14px 0 4px; }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 6px 0; color: var(--ink-2); text-wrap: pretty; }
.prose ul, .prose ol { margin: 6px 0; padding-left: 20px; color: var(--ink-2); }
.prose li { margin: 3px 0; }
.prose code { background: var(--surface-tint); color: var(--ink-2); padding: 1px 5px; border-radius: var(--r-check); }
.prose table { font-size: 13.5px; font-variant-numeric: tabular-nums; margin: 8px 0; }
.prose th, .prose td { text-align: left; padding: 4px 10px 4px 0; border-bottom: 1px solid var(--rule-row); }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 12px 0; }
/* Question-and-answer list: <dl class="qa"><dt>question</dt><dd>answer</dd></dl> */
.qa { margin: 0; }
.qa dt { font-weight: 600; margin-top: 12px; }
.qa dt:first-child { margin-top: 0; }
.qa dd { margin: 3px 0 0; color: var(--muted); line-height: 1.6; }

/* ---- figures ------------------------------------------------------------- */
/* A headline figure outside a KPI strip. .hero = 40px (30px on a phone). */
.bigfig { font-size: 28px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; }
.bigfig.hero { font-size: 40px; }
/* A KPI standing alone (a page's hero), without the strip's padding and divider. */
.kpi.bare { padding: 0; border: 0; }
/* A chart drawn by a page script fills its card. */
svg.chart { display: block; width: 100%; }
/* A wrapping run of chips. */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
/* Chart key: swatch + label pairs in a wrapping row. .dash = the dashed line of a projected series. */
.keys { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; font-weight: 400; color: var(--muted); }
.keys > span { display: inline-flex; align-items: center; gap: 6px; }
.keys .sw { border-radius: 3px; }
.keys .dash { width: 14px; border-top: 2px dashed var(--future); }

/* ---- layout and cards ---------------------------------------------------- */
/* Main column + a fixed 320px side column that folds under it on a phone.
   .stick-top pins the side column below the nav while the main column scrolls. */
.cols-side { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.stick-top { position: sticky; top: calc(var(--nav-h) + 14px); }
/* Grid of cards. Default: as many as fit at 300px each. .c2 / .c3 = fixed columns.
   Every card grid is one column on a phone. */
.cardgrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.cardgrid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cardgrid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* Launcher tile: a card that is one link (title with a categorical mark · description · call to action).
   .still = a tile that is not a link. */
.tile { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; min-height: 96px;
  text-decoration: none; color: var(--ink); }
a.tile:hover { background: var(--hover); color: var(--ink); }
.tile .t { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.tile .sw { border-radius: 2px; width: 8px; height: 8px; }
.tile .d { color: var(--ink-2); font-size: 13.5px; }
.tile .go { margin-top: auto; font-size: 13px; text-decoration: underline; text-underline-offset: 2px; }
.tile.still { background: transparent; border-style: dashed; }
/* Pane: a card of full-bleed rows (header · rows · footer total), e.g. a balance sheet.
   .pane-h is the one panel header: label on the left in 600, figures or actions on the right, a rule below. */
.pane { overflow: hidden; }
.pane-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 16px;
  border-bottom: 1px solid var(--rule); font-variant-numeric: tabular-nums; }
.pane-h > :first-child { font-weight: 600; }
.pane-h .muted { font-weight: 400; }
.pane-h form { margin: 0; }
.pane-f { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 16px;
  font-weight: 600; border-top: 1px solid var(--rule-strong); margin-top: -1px; background: var(--surface); position: relative; }
/* Ruled line in a card: content on the left, an action on the right, a hairline between lines. */
.rline { display: flex; align-items: baseline; gap: 12px; padding: 8px 14px; border-top: 1px solid var(--rule-row); }
.rline:first-child { border-top: 0; }
.rline form { margin: 0; }
/* Section band inside a pane. It carries judgement, not lane: .ok = owned or earned · .bad = owed or spent. */
.jband { display: flex; justify-content: space-between; gap: 12px; padding: 6px 16px; font-size: 11.5px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; }
.jband .m { letter-spacing: 0; font-size: 13px; }
.jband.ok { background: var(--ok-fill); color: var(--ok-deep); }
.jband.bad { background: var(--bad-fill); color: var(--bad-deep); }
/* Figure rows inside a card (.fig-card): label (.al) · input (.fv) or read-out (.ro) · unit, ruled between rows. */
.fig-card { padding: 12px 14px; }
.fig-card .card-h { margin-bottom: 4px; }
.figrow { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; padding: 6px 0; border-top: 1px solid var(--rule-row); font-size: 13.5px; }
.card-h + .figrow { border-top: 0; }
.figrow .al { flex: 1; min-width: 0; }
.figrow .al .prov { margin-left: 4px; }
.figrow input.fv { width: 110px; text-align: right; font-variant-numeric: tabular-nums; }
.figrow input.fv.short { width: 70px; }
.figrow .unit { color: var(--faint); font-size: 13px; min-width: 14px; }
.figrow .ro { font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Disclosure: <details class="disc"> with its own summary row and no browser marker.
   A .chev inside the summary turns when it opens. */
.disc > summary { list-style: none; cursor: pointer; }
.disc > summary::-webkit-details-marker { display: none; }
.chev { display: inline-block; width: 0; height: 0; font-size: 0; vertical-align: middle;
  border-style: solid; border-width: 5.5px 0 5.5px 9px; border-color: transparent transparent transparent var(--muted);
  transition: transform .12s; }
.disc[open] .chev, .chev.open { transform: rotate(90deg); }
.caret { transition: transform .12s; } .caret.up { transform: rotate(180deg); }
/* Every other fold gets the same chevron without asking: a plain <details> on any page draws it
   before its summary, so no page carries its own marker. Menus and .dd filters keep their caret. */
details:not(.menu):not(.dd):not(.disc) > summary { list-style: none; cursor: pointer; }
details:not(.menu):not(.dd):not(.disc) > summary::-webkit-details-marker { display: none; }
details:not(.menu):not(.dd):not(.disc) > summary::before { content: ""; display: inline-block; flex: none;
  width: 0; height: 0; margin: 0 8px 1px 2px; vertical-align: middle; border-style: solid;
  border-width: 5.5px 0 5.5px 9px; border-color: transparent transparent transparent var(--muted);
  transition: transform .12s; }
details[open]:not(.menu):not(.dd):not(.disc) > summary::before { transform: rotate(90deg); }

/* ---- controls ------------------------------------------------------------ */
/* Text tones outside money: a warning and an error (.pos / .neg stay the sign of money). */
.warnt { color: var(--warn-deep); }
.badt { color: var(--bad); }
/* Shown to a read-only viewer in place of a write control (the opposite of .w). */
.ro-only { display: none; }
body.readonly .ro-only { display: inline-flex; }
/* A field that spans two columns of a .fgrid (one on a phone). */
.fgrid .s2 { grid-column: span 2; }
/* Filter pill whose "on" is the lane's own colour family, not a solid fill: for toggles where several
   can be on at once. Off stays plain white, so the one that is on is the one that stands out. */
.pill.on.tint { background: var(--lane-band); border-color: var(--lane); color: var(--lane-head);
  font-weight: 600; box-shadow: inset 0 0 0 1px var(--lane); }
.pill.on.tint:hover { background: var(--lane-band); }
/* One form per row, in columns: the grid lives on the row (.xrow) and the <form class="xf"> is
   transparent to it, so every row of a .xgrid lines up. The page sets the columns: .xgrid { --xcols: …; min-width: …; }
   .xh = header row · .add = the add-a-row form · .xnone = empty line · .xscroll = sideways scroll on a phone. */
.xscroll { overflow-x: auto; }
.xrow { display: grid; grid-template-columns: var(--xcols); gap: 6px 8px; align-items: center; padding: 4px 0; }
.xrow > form.xf { display: contents; }
.xrow input, .xrow select { width: 100%; }
.xrow.xh { font-size: 13px; font-weight: 600; padding-bottom: 6px; border-bottom: 1px solid var(--rule-strong); margin-bottom: 4px; }
.xrow.add { border-top: 1px solid var(--rule); margin-top: 6px; padding-top: 10px; }
.xnone { color: var(--muted); font-size: 13.5px; padding: 8px 0; }

/* ---- sidebar as a rail of queues (Teach) ---------------------------------- */
/* .side.rail: padded, rounded items with a count badge (.n); .known = a quiet count. */
.side.rail { padding: 14px 8px 12px; }
.side.rail .seg { display: flex; margin: 0 4px 10px; }
.side.rail .seg > a { flex: 1; text-align: center; }
.side.rail .subband { padding: 10px 10px 4px; color: var(--lane-head); }
.side.rail a.item { align-items: center; padding: 6px 10px; border-radius: var(--r-ctl); }
.side.rail a.item .n { flex: none; padding: 0 7px; border-radius: 9px; font-size: 12px; line-height: 18px; background: var(--lane-band); color: var(--ink-2); }
.side.rail a.item.on { font-weight: 600; }
.side.rail a.item.on .n { background: var(--ground); color: var(--lane-head); }
.side.rail a.item.known .n { background: none; color: var(--muted); }
.side.rail a.item.known.on .n { color: var(--ground); }
/* A rail folds to a thin strip (Teach, Review, Proof): <div class="shell" data-rail="name">.
   mula2.js adds the « / » button and remembers the choice per page. Controls that
   repeat the rail's carry .raildup and show only while the rail is folded, or on a
   phone, where there is no rail. */
.side.rail .railtog { display: flex; justify-content: flex-end; margin: -8px -2px 4px; }
.shell.rail-c { grid-template-columns: 40px minmax(0, 1fr); }
.shell.rail-c > .side.rail { padding: 10px 4px; }
.shell.rail-c > .side.rail > :not(.railtog) { display: none; }
.shell.rail-c > .side.rail .railtog { justify-content: center; margin: 0; }
@media (min-width: 901px) { .shell[data-rail]:not(.rail-c) .raildup { display: none !important; } }
/* Tick lists (mula2.js bulkList): a ticked item wears the lane tint; the bar wraps on a narrow screen. */
[data-bulk-item].picked, tr[data-bulk-item].picked > td { background: var(--lane-tint); }
[data-bulk-bar] { flex-wrap: wrap; max-width: min(980px, 94vw); }
[data-bulk-bar] input[data-bulk-set] { width: 210px; }
.bulkchk { display: inline-flex; align-items: center; margin-right: 8px; }

/* ---- tables -------------------------------------------------------------- */
/* The count or subtotal at the right of a group band row: band size and weight family, not caps-spaced.
   .bandline lays a band cell out as label left, count right. */
.bandn { float: right; letter-spacing: 0; text-transform: none; font-weight: 500; }
.bandline { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
/* Total row inside a table body. */
.tbl tr.tot > td { font-weight: 600; border-top: 1px solid var(--rule-strong); }
/* A small table inside a card (class="tbl tbl-card"): no sticky header, cells may wrap, flush with the card's padding. */
.tbl-card { width: 100%; margin-top: 10px; }
.tbl-card th { position: static; }
.tbl-card td { white-space: normal; max-width: none; height: auto; padding-top: 6px; padding-bottom: 6px; vertical-align: top; }
.tbl-card td.num { white-space: nowrap; }
.tbl-card th:first-child, .tbl-card td:first-child { padding-left: 0; }
.tbl-card th:last-child, .tbl-card td:last-child { padding-right: 0; }

/* ---- print documents on screen ------------------------------------------- */
/* A document (statement, schedule, minutes) sits in .sheet-doc and keeps its own palette and type,
   set in its page and scoped under .sheet-doc. Shared: the element reset the documents were written
   against, the paper sheet, the parameter bar above it, and what print leaves out. */
:where(.sheet-doc) * { margin: 0; }
:where(.sheet-doc) table { width: 100%; border-collapse: collapse; font-size: 14px; }
:where(.sheet-doc) tr:last-child td { border-bottom: 0; }
:where(.sheet-doc) { color: var(--ink); }
.paper { background: #fff; border: 1px solid var(--rule); border-radius: 4px; }
.params { margin-bottom: 16px; }
@media print {
  body:has(.sheet-doc) :is(.phead, .viewonly, .params) { display: none !important; }
}

/* ---- phone, for the patterns above ---------------------------------------- */
@media (max-width: 900px) {
  .bigfig.hero { font-size: 30px; }
  .cardgrid.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }   /* a landscape phone still fits two cards */
  .cols-side { grid-template-columns: minmax(0, 1fr); }
  .stick-top { position: static; }
  .fgrid .s2 { grid-column: auto; }
}
@media (max-width: 560px) { .cardgrid, .cardgrid.c2, .cardgrid.c3 { grid-template-columns: minmax(0, 1fr); } }

/* suggestions under an input (mula2.js replaces the browser's datalist popup) */
.suggest { position: fixed; z-index: 400; max-height: 280px; overflow-y: auto; max-width: 420px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--rule);
  border-radius: var(--r-ctl); box-shadow: var(--shadow-open); padding: 4px 0; font-size: 14px; }
.suggest > div { padding: 6px 12px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest > div:hover, .suggest > div.on { background: var(--hover); }

/* Lifecycle pill (shared, money/lifecycle.py): one stage on the row, the whole track on hover.
   The track is placed on the page by mula2.js, so a scrolling table never clips it. */
.lc { display: inline-flex; max-width: 100%; vertical-align: middle; outline: none; }
.lc-pill { cursor: default; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Done with nothing to claim: the grey of the nav's highlight pill, not a blank. */
.chip.gry { background: var(--surface-tint); border-color: var(--rule-strong); color: var(--ink-2); }
.lc:focus-visible .lc-pill { box-shadow: 0 0 0 2px var(--accent-line); }
.lc-pop { display: none; position: fixed; z-index: 60; width: 340px; max-width: calc(100vw - 24px); padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; box-shadow: 0 8px 22px rgba(0,0,0,.18);
  flex-direction: column; gap: 7px; white-space: normal; font-size: 12.5px; line-height: 1.35; color: var(--ink);
  text-align: left; font-weight: 400; }
.lc.open .lc-pop { display: flex; }
.lc-s { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 6px; align-items: baseline; }
.lc-m { text-align: center; color: var(--faint); font-weight: 600; }
.lc-n { display: block; color: var(--ink-2); }
.lc-s.done .lc-m { color: var(--ok); }
.lc-s.wait .lc-l { font-weight: 600; }
.lc-s.wait.yours .lc-m, .lc-s.wait.yours .lc-l, .lc-s.wait.yours .lc-w { color: var(--bad); }
.lc-s.wait.theirs .lc-m, .lc-s.wait.theirs .lc-w { color: var(--warn); }
.lc-s.late .lc-m { color: var(--warn); }
.lc-s.side.yours .lc-m, .lc-s.side.yours .lc-w { color: var(--bad); }
.lc-s.side.theirs .lc-m, .lc-s.side.theirs .lc-w { color: var(--warn); }
.lc-s.next, .lc-s.next .lc-n { color: var(--muted); }
.lc-s.na, .lc-s.na .lc-n { color: var(--faint); }
.lc-s.na .lc-l { text-decoration: line-through; }
