/* ===========================================================================
   Carddex Ledger — design system
   ---------------------------------------------------------------------------
   One paradigm: a dense ledger table + a fixed inspector. Every surface reads
   tokens, so a theme is only a token remap on :root[data-theme]. The chrome
   bars (top bar, status bar, footer hints) stay dark in every theme, like an
   IDE title bar — that is deliberate, not an oversight.
   =========================================================================== */

:root {
  /* Paper — the default warm sage-paper terminal */
  --paper: #E4E1D0;
  --paper-hi: #EDEAD9;
  --paper-lo: #D9D5C1;
  --paper-lo2: #CFCBB4;
  --ink: #1C1A14;
  --ink-soft: #4B4736;
  --ink-faint: #655F4A;
  --rule: rgba(28, 26, 20, .14);
  --rule-strong: rgba(28, 26, 20, .32);
  --accent: #C1560E;
  --accent-ink: #8C3D0A;
  --accent-soft: rgba(193, 86, 14, .13);
  --accent-soft2: rgba(193, 86, 14, .24);
  --pos: #3E6E49;
  --pos-soft: rgba(62, 110, 73, .14);
  --neg: #96392F;
  --neg-soft: rgba(150, 57, 47, .14);
  --warn: #8A6A1E;
  --warn-soft: rgba(138, 106, 30, .15);
  /* Gold — reserved for ONE thing: a declared first edition. Its own token
     rather than a reuse of --warn, which it is adjacent to in hue and must not
     be confused with: --warn marks a figure to read twice (DMG, OUT), and a
     first edition is not a caveat, it is the good itself. Sharing the token
     would make a scan for warnings stop on every first-edition row. */
  --gold: #B08D2E;
  --gold-ink: #6B5214;
  --gold-soft: rgba(176, 141, 46, .20);
  --seq: #51606E;
  /* Categorical series colours for multi-series charts. Verified with the
     dataviz palette validator against this surface -- all six checks pass
     (lightness band, chroma floor, CVD separation, normal-vision floor,
     contrast). The first guess (slate/orange/olive) FAILED at deltaE 1.0 under
     protanopia: olive and orange were the same colour. Extended to five slots
     2026-08-02 for the market dashboard's cross-TCG chart and re-validated
     (worst adjacent pair deltaE 8.6 deutan, all checks pass). Assign in fixed
     order, never cycled; a sixth series folds into "Other". Do not hand-tune
     these without re-running the validator. */
  --cat-1: #2E6DA4;
  --cat-2: #B85C10;
  --cat-3: #8B3A62;
  --cat-4: #3F7D46;
  --cat-5: #6B5CA8;
  --seq-rgb: 81, 96, 110;
  --veil: rgba(228, 225, 208, .55);

  --chrome-bg: #1C1A14;
  --chrome-fg: #F2EFE3;
  --chrome-muted: #C8C3AE;
  --chrome-kbd-bg: rgba(255, 255, 255, .1);
  --chrome-kbd-border: rgba(255, 255, 255, .22);
  --chrome-pos: #67C687;
  --chrome-neg: #E6786C;

  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  /* ── density tokens ──────────────────────────────────────────────────
     Compact is the default and the values below ARE compact — a density is
     only a token remap on :root[data-density], exactly like a theme, so
     switching is one attribute write with no re-render and no stylesheet
     swap. Anything that should grow in comfortable mode must read a token
     from here rather than hard-coding a px value. */
  --base-fs: 13px;
  --hdr-h: 44px;
  --rowh: 34px;
  --insp-w: 380px;
  --ledger-fs: 12px;
  --td-pad: 10px;
  --thumb-w: 20px;
  --thumb-h: 28px;
  --mark-w: 26px;
  --mark-h: 20px;
  --insp-mark-w: 58px;
  --insp-mark-h: 34px;
  --insp-art-w: 62px;
  --insp-art-h: 87px;
  --insp-name-fs: 15px;
  --insp-price-fs: 22px;
  --insp-stat-fs: 13px;
  --insp-pad: 12px 16px;
}

/* Comfortable — the same terminal, one step less dense. Roughly +35% row
   height and +24% inspector width: enough that the table reads as a list of
   products rather than a wall of figures, without giving up the
   many-rows-on-screen property the Ledger exists for. */
:root[data-density="comfortable"] {
  --base-fs: 14px;
  --hdr-h: 50px;
  --rowh: 46px;
  --insp-w: 470px;
  --ledger-fs: 13.5px;
  --td-pad: 14px;
  --thumb-w: 32px;
  --thumb-h: 45px;
  --mark-w: 34px;
  --mark-h: 26px;
  --insp-mark-w: 72px;
  --insp-mark-h: 42px;
  --insp-art-w: 92px;
  --insp-art-h: 129px;
  --insp-name-fs: 17px;
  --insp-price-fs: 26px;
  --insp-stat-fs: 15px;
  --insp-pad: 16px 20px;
}

/* Spacious — one more step for large displays and for reading at a distance.
   Still the same terminal: the columns, the inspector and the keyboard model
   are unchanged, only the scale. */
:root[data-density="spacious"] {
  --base-fs: 15px;
  --hdr-h: 56px;
  --rowh: 60px;
  --insp-w: 560px;
  --ledger-fs: 15px;
  --td-pad: 18px;
  --thumb-w: 44px;
  --thumb-h: 62px;
  --mark-w: 44px;
  --mark-h: 34px;
  --insp-mark-w: 88px;
  --insp-mark-h: 52px;
  --insp-art-w: 118px;
  --insp-art-h: 165px;
  --insp-name-fs: 19px;
  --insp-price-fs: 30px;
  --insp-stat-fs: 17px;
  --insp-pad: 20px 24px;
}

/* Extra-large — for a big display, a projector, or reading across a desk.
   The largest step that still fits the ledger's columns without wrapping. */
:root[data-density="xlarge"] {
  --base-fs: 17px;
  --hdr-h: 64px;
  --rowh: 76px;
  --insp-w: 660px;
  --ledger-fs: 17px;
  --td-pad: 22px;
  --thumb-w: 56px;
  --thumb-h: 79px;
  --mark-w: 56px;
  --mark-h: 42px;
  --insp-mark-w: 108px;
  --insp-mark-h: 64px;
  --insp-art-w: 148px;
  --insp-art-h: 207px;
  --insp-name-fs: 22px;
  --insp-price-fs: 36px;
  --insp-stat-fs: 20px;
  --insp-pad: 24px 28px;
}

:root[data-theme="ivory"] {
  --paper: #F4F2EA;
  --paper-hi: #FBFAF5;
  --paper-lo: #E9E6DB;
  --paper-lo2: #DEDACC;
  --rule: rgba(25, 24, 19, .13);
  --rule-strong: rgba(25, 24, 19, .3);
  --veil: rgba(244, 242, 234, .6);
}

:root[data-theme="slate"] {
  /* Own steps, not an inversion: the light set fails the lightness band on a
     dark surface. Validated separately against it (5 slots, 2026-08-02). */
  --cat-1: #4E96D2;
  --cat-2: #D8792B;
  --cat-3: #AE5C88;
  --cat-4: #61A048;
  --cat-5: #8E7FD8;
  --paper: #23211B;
  --paper-hi: #2B2921;
  --paper-lo: #1B1915;
  --paper-lo2: #141310;
  --ink: #ECE7D9;
  --ink-soft: #BCB49D;
  --ink-faint: #8E866F;
  --rule: rgba(236, 231, 217, .12);
  --rule-strong: rgba(236, 231, 217, .3);
  --accent: #E8863C;
  --accent-ink: #F2A366;
  --accent-soft: rgba(232, 134, 60, .16);
  --accent-soft2: rgba(232, 134, 60, .3);
  --pos: #67C687;
  --pos-soft: rgba(103, 198, 135, .15);
  --neg: #E5695C;
  --neg-soft: rgba(229, 105, 92, .15);
  --warn: #D9A83E;
  --warn-soft: rgba(217, 168, 62, .15);
  --gold: #E3C063;
  --gold-ink: #F2DA9B;
  --gold-soft: rgba(227, 192, 99, .18);
  --seq: #93A7BA;
  --seq-rgb: 147, 167, 186;
  --chrome-bg: #0F0E0B;
  --veil: rgba(35, 33, 27, .62);
}

:root[data-theme="terminal"] {
  /* Own steps, not an inversion: the light set fails the lightness band on a
     dark surface. Validated separately against it (5 slots, 2026-08-02). */
  --cat-1: #4E96D2;
  --cat-2: #D8792B;
  --cat-3: #AE5C88;
  --cat-4: #61A048;
  --cat-5: #8E7FD8;
  --paper: #0A0C10;
  --paper-hi: #12151B;
  --paper-lo: #171B23;
  --paper-lo2: #1D2230;
  --ink: #E7EAEF;
  --ink-soft: #96A0B0;
  --ink-faint: #5B6472;
  --rule: rgba(231, 234, 239, .1);
  --rule-strong: rgba(231, 234, 239, .28);
  --accent: #F97316;
  --accent-ink: #FB8A3C;
  --accent-soft: rgba(249, 115, 22, .14);
  --accent-soft2: rgba(249, 115, 22, .3);
  --pos: #16C784;
  --pos-soft: rgba(22, 199, 132, .13);
  --neg: #EA3943;
  --neg-soft: rgba(234, 57, 67, .13);
  --warn: #F0B90B;
  --warn-soft: rgba(240, 185, 11, .14);
  --gold: #E8C86A;
  --gold-ink: #F5E0A4;
  --gold-soft: rgba(232, 200, 106, .16);
  --seq: #3D7EC7;
  --seq-rgb: 61, 126, 199;
  --chrome-bg: #000000;
  --chrome-pos: #16C784;
  --chrome-neg: #EA3943;
  --veil: rgba(10, 12, 16, .66);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  /* Token, not a literal: density scales the whole document from here, so
     chrome, headings, chips and forms grow with the table instead of the
     ledger drifting out of proportion with everything around it. */
  font-size: var(--base-fs);
}

body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; z-index: 5; }
::selection { background: var(--accent-soft2); color: var(--ink); }

.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
.micro {
  font-size: 10px;
  letter-spacing: .07em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink-faint);
}
.spacer { flex: 1; }
.muted { color: var(--ink-faint); }

/* ── app header ─────────────────────────────────────────────────────────── */
.app-header {
  flex: 0 0 48px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 14px;
  background: var(--paper-hi);
  border-bottom: 1px solid var(--rule-strong);
  z-index: 40;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: .02em;
  flex: 0 0 auto;
  text-decoration: none;
  color: var(--ink);
}
.brand .mark {
  width: 16px;
  height: 16px;
  border: 1.5px solid currentColor;
  position: relative;
  flex: none;
}
.brand .mark::before,
.brand .mark::after { content: ""; position: absolute; background: currentColor; }
.brand .mark::before { left: 3px; top: 2px; width: 1.5px; height: 9px; }
.brand .mark::after { left: 6.5px; top: 5px; width: 1.5px; height: 6px; }

.nav { display: flex; gap: 2px; overflow-x: auto; flex: 1 1 auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-faint);
  text-decoration: none;
  border-radius: 3px;
  white-space: nowrap;
}
.nav a:hover { color: var(--ink); background: var(--paper-lo); }
.nav a.on { color: var(--ink); background: var(--paper-lo); }

.hdr-right { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.search-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 5px 8px 5px 10px;
  font-size: 11px;
  color: var(--ink-faint);
  cursor: pointer;
  min-width: 190px;
}
.search-hint:hover { border-color: var(--rule-strong); }
kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--paper-lo);
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  padding: 1px 5px;
  color: var(--ink-soft);
}

.theme-dots { display: flex; gap: 6px; align-items: center; }
.theme-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--rule-strong);
  cursor: pointer;
  padding: 0;
  flex: 0 0 auto;
}
.theme-dot:hover { border-color: var(--ink-soft); }
.theme-dot.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft2); }

/* ── subtabs ────────────────────────────────────────────────────────────── */
.subtabs {
  flex: 0 0 34px;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 14px;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  overflow-x: auto;
}
.subtab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 4px;
  margin-right: 18px;
  font-size: 12px;
  color: var(--ink-faint);
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
}
.subtab:hover { color: var(--ink-soft); }
.subtab.on { color: var(--ink); border-bottom-color: var(--accent); }

/* ── page scaffolding ───────────────────────────────────────────────────── */
main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--paper);
}
.panel { display: none; flex: 1; min-height: 0; flex-direction: column; }
.panel.on { display: flex; }
.workspace { flex: 1; min-height: 0; display: flex; }
.table-pane { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
 /* overflow-x is auto, not hidden: at the larger densities the ledger's
    columns legitimately exceed the pane, and hiding the overflow clipped
    figures with no way to reach them. The pane scrolls; the page body still
    never does. */
.doc-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: auto; }
.section-pad { padding: 18px 22px; }

.inspector {
  flex: 0 0 var(--insp-w);
  width: var(--insp-w);
  border-left: 1px solid var(--rule-strong);
  background: var(--paper-hi);
  overflow-y: auto;
  min-height: 0;
  /* The dismiss button is positioned against the rail, so the rail has to be
     the containing block — otherwise it anchors to the viewport and floats
     over the page while the rail scrolls underneath it. */
  position: relative;
}

/* ── dismissing the inspector ────────────────────────────────────────────
   A ledger has no "click the selected row again to deselect" gesture, so a
   rail that shows something else when nothing is selected (the portfolio's
   summary, the dashboard's market overview) needs an explicit way back.
   Sticky rather than absolute: the rail scrolls, and a control that leaves
   with the header is only usable from the top of a long panel. */
.insp-close {
  position: sticky;
  float: right;
  top: 6px;
  right: 6px;
  z-index: 2;
  width: 22px;
  height: 22px;
  margin: 6px 6px 0 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--paper-hi);
  color: var(--ink-faint);
  cursor: pointer;
}
.insp-close:hover { color: var(--ink); border-color: var(--rule-strong); background: var(--paper); }

/* ── filters row ────────────────────────────────────────────────────────── */
.filters {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--rule);
  flex-wrap: wrap;
  background: var(--paper);
}
.fr-input {
  background: var(--paper-hi);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 5px 8px;
  font-size: 11px;
  width: 108px;
}
.fr-search { width: 230px; }
.chip-row { display: flex; gap: 4px; flex-wrap: wrap; }
.chip {
  font-size: 11px;
  padding: 4px 9px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--paper-hi);
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
}
.chip:hover { border-color: var(--rule-strong); }
.chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip .n { opacity: .55; font-family: var(--font-mono); }

/* Horizontally scrolling chip row (the game filter: every TCG in the
   catalogue). See lib/ui/filters.js for the scroll wiring. */
.chip-scroll {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  max-width: min(38vw, 520px);
}
.chip-row--scroll {
  /* offset parent for centreScrollLeft()'s chip.offsetLeft reads */
  position: relative;
  flex-wrap: nowrap;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  padding: 1px 0;
  --fade-l: 0px;
  --fade-r: 0px;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent 100%);
}
.chip-row--scroll::-webkit-scrollbar { display: none; }
.chip-scroll.can-l .chip-row--scroll { --fade-l: 18px; }
.chip-scroll.can-r .chip-row--scroll { --fade-r: 18px; }
.chip-nav {
  flex: 0 0 auto;
  width: 15px;
  height: 21px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: none;
  color: var(--ink-faint);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
}
.chip-scroll.can-l .chip-nav[data-scroll="-1"],
.chip-scroll.can-r .chip-nav[data-scroll="1"] { opacity: 1; pointer-events: auto; }
.chip-nav:hover { color: var(--ink); background: var(--paper-hi); }
@media (prefers-reduced-motion: reduce) {
  .chip-row--scroll { scroll-behavior: auto; }
}

.btn {
  font-size: 11px;
  font-weight: 700;
  padding: 6px 11px;
  border-radius: 3px;
  border: 1px solid var(--rule-strong);
  background: var(--paper-hi);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--ink); color: var(--paper-hi); border-color: var(--ink); }
.btn.primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn.ghost { background: transparent; }
.btn.small { padding: 3px 8px; font-size: 10px; }
.btn[disabled] { opacity: .45; cursor: default; }

/* ── ledger table ───────────────────────────────────────────────────────── */
.tbl-wrap { flex: 1; min-height: 0; overflow: auto; }
table.ledger { width: 100%; border-collapse: collapse; font-size: var(--ledger-fs); }
table.ledger thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--paper-lo);
  text-align: left;
  padding: 6px 10px;
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 700;
  border-bottom: 1px solid var(--rule-strong);
  white-space: nowrap;
}
table.ledger thead th.sortable { cursor: pointer; user-select: none; }
table.ledger thead th.sortable:hover { color: var(--ink); }
table.ledger thead th .arrow { color: var(--accent-ink); margin-left: 3px; font-size: 9px; }
table.ledger thead th.right, table.ledger td.right { text-align: right; }
table.ledger tbody tr { height: var(--rowh); border-bottom: 1px solid var(--rule); cursor: pointer; }
table.ledger tbody tr:hover { background: var(--paper-hi); }
/* A losing position's left-edge tick. The cursor and selection bars own the
   lane while they are on the row (the red P&L cell still carries the loss) —
   encoded in the selector, not in source order, so moving this rule cannot
   silently flip the precedence. Row-mode only, like the mv-* edge stripes: a
   full-height red bar down a tile card is an artifact, not a signal. */
:root:not([data-view="tiles"]) table.ledger tbody tr.loss-row:not(.focused):not(.selected) {
  box-shadow: inset 2px 0 0 var(--neg);
}
/* A product you hold: a warm tick in the left lane and a wash across the row.
   Ownership is a property of the whole row, and the catalogue is scanned down
   its numbers rather than read along the name column, so a pill alone is only
   findable once you are already looking at the right cell.

   The cursor and selection bars own the left lane while they are on the row,
   and the wash yields to the hover tint for the same reason — encoded in the
   selectors, like .loss-row above, so moving these rules cannot silently flip
   the precedence. Nothing is lost when it yields: the HELD pill is still in
   the name cell and the rail is showing the position. --warn, never --accent:
   the accent means "open in the rail", and "I own this" must not be something
   the reader has to distinguish from "this is the row I clicked". */
:root:not([data-view="tiles"]) table.ledger tbody tr.held:not(.focused):not(.selected) {
  box-shadow: inset 2px 0 0 var(--warn);
}
:root:not([data-view="tiles"]) table.ledger tbody tr.held:not(.focused):not(.selected):not(:hover) {
  background: color-mix(in oklab, var(--warn) 6%, var(--paper));
}
/* A full-height bar down a tile card is an artifact rather than a signal (see
   the mv-* stripes), so tiles carry ownership on the card's own edge. */
:root[data-view="tiles"] table.ledger tbody tr.held:not(.selected) {
  border-color: color-mix(in oklab, var(--warn) 45%, var(--rule));
  background: color-mix(in oklab, var(--warn) 6%, var(--paper-hi));
}
table.ledger tbody tr.focused { box-shadow: inset 2px 0 0 var(--accent); background: var(--paper-hi); }
table.ledger tbody tr.selected { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
table.ledger td { padding: 0 var(--td-pad); white-space: nowrap; vertical-align: middle; }
/* The name column is the elastic one, and that is load-bearing.
   `width: 100%` makes it absorb every pixel of slack, so when the table is
   wider than its pane it is the FIRST thing to give — wrapping to a second
   line — instead of the numeric columns being pushed off the right edge. That
   was the clipping at the larger densities: a fixed 320px name column left the
   figures nowhere to go. Everything else sizes to its content and refuses to
   compress (see below). */
table.ledger td.name-cell,
table.ledger th.name-cell {
  white-space: normal;
  width: 100%;
  min-width: 140px;
  max-width: 0; /* with width:100% this makes the cell shrink-to-fit its pane */
  overflow-wrap: anywhere;
}
/* Numeric and short columns hold their content width and never wrap, so a
   figure is never broken across lines or truncated mid-number. */
table.ledger td:not(.name-cell),
table.ledger th:not(.name-cell) {
  white-space: nowrap;
  width: 1%;
}
.pname { overflow-wrap: anywhere; }

.pname { font-weight: 600; display: block; line-height: 1.25; }

/* ── product names are links ─────────────────────────────────────────────
   Browsing still never navigates — a row click loads the inspector in place,
   which is the whole paradigm. But the NAME was the one piece of text in the
   app that looked like a link, read like a link and did nothing, on every
   board that shows one. So the name text is an anchor and the rest of the row
   still selects; the two gestures do not fight because the anchor covers only
   the name.

   Inherits its colour rather than taking link blue: a ledger's name column is
   body text first, and 100 blue rows would read as a page of links rather than
   as a table. The affordance is the underline on hover. */
a.pname-link { color: inherit; text-decoration: none; }
a.pname-link:hover { color: var(--accent-ink); text-decoration: underline; }
a.pname-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 2px; }

/* The movers lists in the two market rails: the name takes the slack and
   truncates, the delta beside it never does. */
.mover-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mover-name a.pname-link { display: block; overflow: hidden; text-overflow: ellipsis; }
.pset { color: var(--ink-faint); font-size: 10.5px; }
.name-flex { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 3px 0; }
.name-stack { display: flex; flex-direction: column; min-width: 0; }
.tag {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .03em;
  color: var(--ink-soft);
  background: var(--paper-lo);
  border-radius: 2px;
  padding: 1px 5px;
  white-space: nowrap;
}
.delta { font-weight: 700; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.delta.pos { color: var(--pos); }
.delta.neg { color: var(--neg); }
.delta.flat { color: var(--ink-faint); }
/* Heat chips: an outsized move wears a box (fmt.js heatBand — tinted at |10%|,
   solid at |25%|). The solid chip recolours its text to the page ground, which
   every theme's --pos/--neg was picked to hold contrast against. The negative
   right margin gives the padding back, so a chipped numeral stays on the same
   right-aligned digit grid as the bare rows above and below it — the box
   overhangs into the cell's own padding instead of indenting the number. */
.delta.chip-tint, .delta.chip-solid { padding: 1px 7px; margin-right: -7px; border-radius: 4px; }
.delta.chip-tint.pos { background: color-mix(in oklab, var(--pos) 15%, transparent); }
.delta.chip-tint.neg { background: color-mix(in oklab, var(--neg) 15%, transparent); }
.delta.chip-solid.pos { background: var(--pos); color: var(--paper); }
.delta.chip-solid.neg { background: var(--neg); color: var(--paper); }
/* Reserved-width sub-slots for the holdings tape. Rendered on every row
   (empty where they do not apply) because they live in right-aligned cells: a
   slot that only appeared where it had content would push those rows'
   numerals left and break the decimal grid the column reads by. Widths cover
   the domain's real range (×99, +9999,9%); a rarer outlier grows its own row
   rather than truncating the figure. Type comes from `.num` at the call site;
   only layout and the annotation ink live here. */
.mult {
  display: inline-block;
  min-width: 3ch;
  margin-left: 6px;
  text-align: left;
  color: var(--ink-faint);
  font-size: 11px;
}
.pl-pct { display: inline-block; min-width: 8ch; margin-left: 8px; text-align: right; }
.pl-pct .delta { font-size: 11px; font-weight: 600; }
.rank-cell { color: var(--ink-faint); font-size: 11px; font-family: var(--font-mono); }
.locked {
  color: var(--ink-faint);
  font-size: 10.5px;
  font-style: italic;
  cursor: help;
}
.sig {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .03em;
  padding: 2px 6px;
  border-radius: 9px;
  text-transform: uppercase;
}
.sig.buy { background: var(--pos-soft); color: var(--pos); }
.sig.sell { background: var(--neg-soft); color: var(--neg); }
.sig.hold { background: var(--paper-lo); color: var(--ink-faint); }

/* card art (real image when available, deterministic SVG otherwise) */
.cardart { display: block; flex: 0 0 auto; border-radius: 2px; background: var(--paper-lo); }
/* Token-driven so switching density resizes artwork instantly, without
   re-rendering the table. The element's width/height attributes remain as
   aspect-ratio hints so rows do not jump while images load. */
.name-flex .cardart { width: var(--thumb-w); height: var(--thumb-h); }
.insp-title-row .cardart { width: var(--insp-art-w); height: var(--insp-art-h); }
img.cardart { object-fit: cover; }

/* skeleton loading rows */
.skel-row td { padding: 8px 10px; }
.skel {
  display: block;
  height: 9px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--paper-lo) 25%, var(--paper-lo2) 37%, var(--paper-lo) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } }
.skel.skel-block { height: 180px; }

.empty-state { padding: 40px 20px; text-align: center; color: var(--ink-faint); font-size: 12px; }
.error-state { padding: 16px 20px; color: var(--neg); font-size: 12px; }

/* ── footer hints + status bar ──────────────────────────────────────────── */
.footer-hints {
  flex: 0 0 26px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 12px;
  background: var(--chrome-bg);
  color: var(--chrome-muted);
  font-size: 10px;
}
.footer-hints .fh { display: flex; align-items: center; gap: 4px; }
.footer-hints kbd {
  background: var(--chrome-kbd-bg);
  border-color: var(--chrome-kbd-border);
  color: var(--chrome-muted);
}

.statusbar {
  flex: 0 0 28px;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 14px;
  background: var(--chrome-bg);
  color: var(--chrome-muted);
  font-size: 10.5px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  border-top: 1px solid rgba(255, 255, 255, .08);
  z-index: 50;
}
.statusbar::-webkit-scrollbar { display: none; }
.sb-item { display: inline-flex; align-items: baseline; gap: 6px; flex: 0 0 auto; }
.sb-label { font-size: 9px; letter-spacing: .08em; font-weight: 700; text-transform: uppercase; }
.sb-val {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--chrome-fg);
  font-weight: 600;
  font-size: 11px;
}
.sb-delta { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 700; font-size: 10.5px; }
.sb-pos { color: var(--chrome-pos); }
.sb-neg { color: var(--chrome-neg); }
.sb-live {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--chrome-pos);
  display: inline-block;
  align-self: center;
}
.sb-live.stale { background: var(--warn); }
.sb-live.off { background: var(--chrome-neg); }
.sb-btn { background: none; border: none; color: inherit; cursor: pointer; padding: 0; font: inherit; }
.sb-btn:hover { color: var(--chrome-fg); }

/* ── inspector ──────────────────────────────────────────────────────────── */
.insp-empty { padding: 40px 20px; text-align: center; color: var(--ink-faint); font-size: 12px; line-height: 1.6; }
.insp-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--rule); }
.insp-eyebrow {
  font-size: 10px;
  letter-spacing: .07em;
  color: var(--ink-faint);
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  text-transform: uppercase;
}
.insp-title-row { display: flex; gap: 12px; align-items: flex-start; margin-top: 8px; }
.insp-name { font-size: var(--insp-name-fs); font-weight: 800; line-height: 1.25; }
.insp-sub { font-size: 11px; color: var(--ink-faint); margin-top: 2px; }
.insp-price-row { display: flex; align-items: baseline; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.insp-price { font-family: var(--font-mono); font-size: var(--insp-price-fs); font-weight: 700; }
.insp-actions { display: flex; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--rule); flex-wrap: wrap; }
.insp-section { padding: var(--insp-pad); border-bottom: 1px solid var(--rule); }
.insp-section:last-child { border-bottom: none; }
.insp-h {
  font-size: 10px;
  letter-spacing: .07em;
  color: var(--ink-faint);
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-transform: uppercase;
}
.insp-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
/* Three windows of one measure (24h / 7d / 30d) read as one trend, so they go
   on one line. In the two-column default the third wraps alone underneath and
   reads as a separate fact. */
.insp-stats--3 { grid-template-columns: repeat(3, 1fr); }
.insp-stat .k { font-size: 10px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .05em; }
.insp-stat .v { font-family: var(--font-mono); font-size: var(--insp-stat-fs); font-weight: 700; }

.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; font-size: 11px; }
.bar-code { width: 34px; font-weight: 700; color: var(--ink-soft); }
.bar-track { flex: 1; height: 6px; background: var(--paper-lo); border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--seq); }
.bar-pct { width: 40px; text-align: right; font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-soft); }
.bar-val { width: 66px; text-align: right; font-family: var(--font-mono); font-size: 10.5px; }

.grade-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px dashed var(--rule);
  gap: 8px;
}
.grade-row:last-child { border-bottom: none; }
.grade-name { font-size: 11.5px; font-weight: 600; }
.grade-mult { font-size: 9.5px; color: var(--ink-faint); margin-left: 5px; font-family: var(--font-mono); }
.grade-price { font-family: var(--font-mono); font-size: 12px; font-weight: 700; }

.reasons { font-size: 11px; line-height: 1.5; color: var(--ink-soft); }

/* ── charts ─────────────────────────────────────────────────────────────── */
.chart-note { font-size: 10px; color: var(--ink-faint); margin-top: 4px; font-style: italic; }
.legend { display: flex; gap: 12px; font-size: 10px; color: var(--ink-soft); margin-top: 6px; flex-wrap: wrap; }
.legend .lg { display: flex; align-items: center; gap: 4px; }
.legend .sw { width: 9px; height: 2px; display: inline-block; }
/* Overlay legend: three series, so it carries each one's real current value —
   indexing to 100 trades magnitude away and the reader must get it back. */
.legend-multi { gap: 10px; margin-top: 7px; }
.legend-multi .lg { font-weight: 600; }
.legend-multi .lg-v {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 400;
  color: var(--ink-faint);
}
.legend-multi .sw { height: 3px; width: 11px; border-radius: 1px; }
/* A dotted series gets a dotted swatch. The key has to look like the mark it
   stands for, or the reader has to work out which of two solid blocks belongs
   to the dotted line — which is the one thing a legend exists to save them. */
.legend .sw-dash {
  background: repeating-linear-gradient(
    to right,
    var(--sw-c) 0 2px,
    transparent 2px 4px
  );
  opacity: .75;
  border-radius: 0;
}
svg.chart { display: block; width: 100%; height: auto; }

/* ── stat tiles ─────────────────────────────────────────────────────────── */
.stat-grid { display: flex; border-bottom: 1px solid var(--rule); flex: 0 0 auto; overflow-x: auto; }
.stat-tile { flex: 1; min-width: 150px; padding: 12px 16px; border-right: 1px solid var(--rule); }
.stat-tile:last-child { border-right: none; }
.stat-tile .k { font-size: 10px; letter-spacing: .06em; color: var(--ink-faint); font-weight: 700; text-transform: uppercase; }
.stat-tile .v { font-family: var(--font-mono); font-size: 21px; font-weight: 700; margin-top: 4px; }
.stat-tile .d { font-size: 11px; margin-top: 2px; font-family: var(--font-mono); }

/* ── command palette ────────────────────────────────────────────────────── */
.palette-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 26, 20, .38);
  display: none;
  z-index: 100;
  padding-top: 8vh;
  justify-content: center;
}
.palette-overlay.on { display: flex; }
.palette {
  width: 560px;
  max-width: 92%;
  max-height: 70vh;
  background: var(--paper-hi);
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .3);
  display: flex;
  flex-direction: column;
}
.palette-input-row { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--rule); }
.palette-input-row input { flex: 1; border: none; background: transparent; font-size: 14px; outline: none; }
.palette-body { overflow-y: auto; padding: 6px 0; }
.palette-group {
  font-size: 10px;
  letter-spacing: .06em;
  color: var(--ink-faint);
  font-weight: 700;
  padding: 8px 14px 4px;
  text-transform: uppercase;
}
.palette-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  font-size: 12.5px;
  cursor: pointer;
}
.palette-item:hover, .palette-item.hl { background: var(--accent-soft); }
.palette-item .meta { color: var(--ink-faint); font-size: 11px; font-family: var(--font-mono); white-space: nowrap; }
/* The name takes the slack so the market slots stay pinned to the right edge,
   and a name too long for the 560px palette ellipses instead of shoving them
   off it. */
.palette-item .pi-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Floor + 24h move on a product row. Both slots keep their width when they are
   empty (a row whose quote has not arrived) so the digits above and below stay
   on one grid and the list does not reflow as answers land. Widths cover the
   domain's real range — a five-figure sealed floor, a four-figure percentage —
   and a rarer outlier grows its own row rather than truncating. */
.palette-item .pq { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.palette-item .pq-floor { min-width: 8ch; text-align: right; font-size: 11.5px; color: var(--ink-soft); }
.palette-item .pq-d1 { display: inline-block; min-width: 7ch; text-align: right; }
.palette-item .pq-d1 .delta { font-size: 11.5px; }
/* The product's own language, after the move. Fixed width like its
   neighbours so an unflagged row keeps the game column on the grid. */
.palette-item .pq-lang { display: inline-block; min-width: 2.4ch; text-align: center; font-size: 12px; line-height: 1; }
.palette-foot { border-top: 1px solid var(--rule); padding: 7px 14px; display: flex; gap: 14px; font-size: 10px; color: var(--ink-faint); }

/* ── help overlay (?) ───────────────────────────────────────────────────── */
.help-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 26, 20, .5);
  display: none;
  z-index: 110;
  align-items: center;
  justify-content: center;
}
.help-overlay.on { display: flex; }
.help-card {
  background: var(--paper-hi);
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  padding: 20px 24px;
  max-width: 460px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .3);
}
.help-card h2 { margin: 0 0 14px; font-size: 14px; text-transform: uppercase; letter-spacing: .05em; }
.help-grid { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 12px; align-items: center; }

/* ── hero (home) ────────────────────────────────────────────────────────── */
.hero { padding: 34px 22px 22px; border-bottom: 1px solid var(--rule); }
.hero h1 {
  font-size: 28px;
  margin: 0 0 8px;
  font-weight: 800;
  letter-spacing: -.01em;
  text-wrap: balance;
  max-width: 640px;
}
.hero p { font-size: 13.5px; color: var(--ink-soft); max-width: 580px; line-height: 1.55; margin: 0 0 16px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── cards / reports ────────────────────────────────────────────────────── */
.card { background: var(--paper-hi); border: 1px solid var(--rule); border-radius: 4px; padding: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
h2.h-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .04em;
  margin: 0 0 12px;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.h-title.h-title-gap { margin-top: 22px; }
/* A section heading's qualifier — what a board was ranked BY, beside the name
   of the board. Cased and weighted down from the heading so it reads as the
   caption it is rather than as a second heading. Empty until its page fills
   it, so a heading whose caption never arrives just renders bare. */
.h-title .h-note {
  margin-left: 8px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-faint);
}
.report-body { line-height: 1.6; font-size: 13px; }
.report-body h2, .report-body h3 { font-size: 14px; margin: 18px 0 8px; }

/* ── error pages ────────────────────────────────────────────────────────── */
.error-page {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  text-align: center;
  padding: 20px;
}
.error-code { font-family: var(--font-mono); font-size: 64px; font-weight: 800; color: var(--paper-lo2); line-height: 1; }
.error-page .hero-actions { justify-content: center; }

.error-preview > .muted { font-size: 12px; max-width: 60ch; }
.error-preview .grid-2 { margin-top: 18px; }
.error-preview .err-card { text-align: center; padding: 34px 16px; }
.error-preview .err-card h2 { margin: 6px 0; font-size: 16px; }
.error-preview .err-card .muted { font-size: 12.5px; }
.error-preview .h-title-2 { margin-top: 26px; }
.error-preview .fail-modes .muted { font-size: 12px; margin-top: 0; }
.error-preview .fail-modes ul { font-size: 12.5px; line-height: 1.7; }

/* ── narrow viewport advisory (mobile paradigm lands in v3) ─────────────── */
@media (max-width: 900px) {
  .inspector {
    position: fixed;
    right: 0;
    top: 48px;
    bottom: 54px;
    z-index: 20;
    box-shadow: -4px 0 16px rgba(0, 0, 0, .18);
    transform: translateX(100%);
    transition: transform .18s ease;
  }
  .inspector.open { transform: translateX(0); }
}
@media (prefers-reduced-motion: reduce) {
  .inspector { transition: none; }
}

/* ── account control + sign-in ──────────────────────────────────────────── */
.acct-slot { display: flex; align-items: center; }
.acct { display: flex; align-items: center; gap: 7px; }
.acct-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-soft2);
  color: var(--accent-ink);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .02em;
  flex: 0 0 auto;
}
/* Same footprint as the resolved chip so the header does not reflow when
   /auth/me answers. */
.acct-loading { opacity: .35; }
.acct-loading .acct-dot { background: var(--rule); }
.acct-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.acct-tier {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent-ink);
  border: 1px solid var(--accent-soft2);
  border-radius: 2px;
  padding: 1px 4px;
}

.auth-wrap {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 56px 22px;
  overflow-y: auto;
  flex: 1;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--paper-hi);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 26px 24px 22px;
}
.auth-card h1 {
  font-size: 22px;
  letter-spacing: -.01em;
  margin: 6px 0 8px;
}
.auth-sub { font-size: 12.5px; color: var(--ink-soft); line-height: 1.5; margin: 0 0 20px; }
.auth-label {
  display: block;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 5px;
}
.auth-input {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 13px;
  padding: 8px 10px;
  margin: 0 0 15px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
}
.auth-input:focus { outline: 2px solid var(--accent-soft2); outline-offset: 1px; border-color: var(--accent); }
.auth-error {
  display: none;
  font-size: 11.5px;
  color: var(--neg);
  background: var(--neg-soft, transparent);
  border-left: 2px solid var(--neg);
  padding: 6px 9px;
  margin: 0 0 14px;
  border-radius: 2px;
}
.auth-error.on { display: block; }
.auth-submit { width: 100%; padding: 9px 11px; font-size: 12px; }
.auth-foot {
  margin-top: 16px;
  font-size: 11px;
  color: var(--ink-faint);
  display: flex;
  gap: 8px;
  justify-content: center;
}
.auth-foot a { color: var(--ink-soft); }
.auth-foot .sep { opacity: .5; }
.auth-error.ok { color: var(--pos); background: var(--pos-soft, transparent); border-left-color: var(--pos); }
.auth-hint { font-size: 11px; color: var(--ink-faint); line-height: 1.45; margin: -9px 0 15px; }
.auth-optional { font-weight: 400; letter-spacing: 0; text-transform: none; }
.auth-outcome .auth-sub { margin-bottom: 16px; }
.auth-outcome a.auth-submit { display: block; text-align: center; text-decoration: none; box-sizing: border-box; }

/* ── density toggle ─────────────────────────────────────────────────────── */
.density-toggle { display: flex; gap: 2px; }
.density-opt {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--paper);
  color: var(--ink-faint);
  cursor: pointer;
}
.density-opt:hover { border-color: var(--rule-strong); color: var(--ink); }
.density-opt.on { background: var(--ink); color: var(--paper-hi); border-color: var(--ink); }

/* ── artwork lightbox ───────────────────────────────────────────────────── */
.cardart.zoomable { cursor: zoom-in; }
.cardart.zoomable:hover { outline: 1px solid var(--accent); outline-offset: 1px; }
.cardart.zoomable:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, .72);
  cursor: zoom-out;
  padding: 40px;
  overflow: auto;
}
.lightbox.on { display: flex; align-items: center; justify-content: center; }
.lightbox-fig { margin: 0; text-align: center; max-width: 100%; }
.lightbox-img {
  max-width: min(560px, 90vw);
  max-height: 82vh;
  width: auto;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .55);
  background: var(--paper-lo);
}
.lightbox-cap {
  margin-top: 12px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
}
@media (prefers-reduced-motion: no-preference) {
  .lightbox.on .lightbox-img { animation: lb-in .12s ease-out; }
  @keyframes lb-in { from { transform: scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
}

/* ── the figure strip ────────────────────────────────────────────────────
   One row of figures across the top of a board, so the table keeps the
   height. Both the portfolio band and the dashboard header are this: a band
   of `.stat-tile`s said the same things at three times the height, which on
   a laptop cost the ledger below it most of its rows.

   `.pf-*` are the portfolio's original names, kept as aliases so the two
   surfaces cannot drift apart — one definition, two vocabularies. */
.pf-band { flex: 0 0 auto; }
.pf-strip, .stat-strip {
  display: flex;
  align-items: baseline;
  gap: 28px;
  flex-wrap: wrap;
  padding: 10px 22px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper-hi);
}
.stat-strip { flex: 0 0 auto; }
/* Inside a document panel rather than at the head of a board: no full-bleed
   rule under it, and it sits on the page ground. */
.stat-strip--inline {
  padding: 0 0 12px;
  background: none;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 14px;
}
.pf-stat, .st-stat { display: flex; align-items: baseline; gap: 7px; }
.pf-k, .st-k {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.pf-v, .st-v { font-family: var(--font-mono); font-size: 14px; font-weight: 700; }
/* The first figure is the headline; the rest are context. */
.pf-stat:first-child .pf-v, .st-stat:first-child .st-v { font-size: 19px; }

/* Two columns for a document panel with no ledger to give the width to (the
   graded panel). Collapses to one before the charts inside it would have to
   scale below their design size.

   `align-items: stretch` plus the column flex below is what levels the two
   cards: side by side, a 210px chart against a ten-row bar list read as two
   unrelated blocks with a ragged bottom edge. Their notes stay pinned under
   their own card rather than floating up with it. */
.dash-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(430px, 1fr));
  gap: 22px;
  align-items: stretch;
}
.dash-cols > section { display: flex; flex-direction: column; min-width: 0; }
.dash-cols > section > .card { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.dash-cols .h-title { margin-top: 0; }
.dash-cols .chart-note { margin-bottom: 0; }

/* ── the momentum board's heat cells ─────────────────────────────────────
   /dashboard's performance board is scanned for shape before any one figure
   is read, so direction and magnitude have to land as colour. Banded (three
   steps a reader can tell apart) rather than a gradient that only ever says
   "some green" — the same `moveBand` vocabulary the tiles layout uses, here
   on the cell instead of the row. */
.heat {
  display: inline-block;
  min-width: 58px;
  padding: 1px 5px;
  border-radius: 2px;
  text-align: right;
}
.heat.mv-up-1 { background: color-mix(in oklab, var(--pos) 8%, transparent); }
.heat.mv-up-2 { background: color-mix(in oklab, var(--pos) 15%, transparent); }
.heat.mv-up-3 { background: color-mix(in oklab, var(--pos) 24%, transparent); }
.heat.mv-down-1 { background: color-mix(in oklab, var(--neg) 8%, transparent); }
.heat.mv-down-2 { background: color-mix(in oklab, var(--neg) 15%, transparent); }
.heat.mv-down-3 { background: color-mix(in oklab, var(--neg) 24%, transparent); }
/* Supply flow is deliberately UNTINTED: green-for-up is a market convention
   meaning "good", and stock arriving is not good news — the same colour on
   both columns would assert a direction the figure does not have. */
.flow { color: var(--ink-soft); }

/* The 30d price/supply read, as a tag. Accent and warn rather than pos/neg:
   it names a market condition, not a gain or a loss. */
.read-tag {
  display: inline-block;
  padding: 1px 4px;
  border-radius: 2px;
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: .05em;
  border: 1px solid transparent;
}
.read-tight { color: var(--accent-ink); border-color: var(--accent-soft2); background: var(--accent-soft); }
.read-flood { color: var(--ink-faint); border-color: var(--rule-strong); }

/* The sealed/singles split, drawn inside its own table cell. The bar is
   scanned down the column and the figure is read off one row, so both are
   present and the bar takes the slack. */
.split-cell { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.split-cell .bar-track { width: 54px; flex: 0 0 auto; }
.pf-alloc { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.pf-alloc-row { display: flex; align-items: center; gap: 8px; font-size: 11px; }
.pf-alloc-label { width: 78px; font-weight: 700; text-transform: capitalize; flex: 0 0 auto; }
.pf-alloc-track { flex: 1; height: 8px; background: var(--paper-lo); border-radius: 1px; overflow: hidden; }
.pf-alloc-bar { display: block; height: 100%; background: var(--seq); opacity: .85; }
.pf-alloc-val { width: 62px; text-align: right; font-family: var(--font-mono); flex: 0 0 auto; }
.pf-alloc-pct { width: 44px; text-align: right; color: var(--ink-faint); font-family: var(--font-mono); flex: 0 0 auto; }
/* Total gains per game, right of the share. Tabular like the two figures
   before it so the column reads as a column, and given its own width rather
   than sharing the bar's flex so a five-digit P&L cannot squeeze the track. */
.pf-alloc-gain { width: 66px; text-align: right; font-family: var(--font-mono); flex: 0 0 auto; }
.pf-notes { font-size: 12px; color: var(--ink-soft); line-height: 1.5; white-space: pre-wrap; }

/* ── 24h movers ─────────────────────────────────────────────────────────────
   Sits under the value chart and explains it. Four columns on one line: what
   moved, what it did to the total in EUR, what a unit costs now, and the
   percentage that produced it. The name is the elastic one — the three figures
   are tabular and must not be pushed off the rail by a long card name. */
.pf-movers { display: flex; flex-direction: column; gap: 1px; margin-top: 8px; }
.pf-mover {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 8px;
  align-items: baseline;
  padding: 4px 4px;
  border-radius: 2px;
  font-size: 11px;
  color: inherit;
  text-decoration: none;
}
.pf-mover:hover { background: var(--paper-lo); }
.pf-mover-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pf-mover-val {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.pf-mover-price {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  min-width: 56px;
  text-align: right;
}
.pf-mover-pct { font-family: var(--font-mono); font-variant-numeric: tabular-nums; min-width: 52px; text-align: right; }

/* ── holding transactions ───────────────────────────────────────────────────
   The position summary above is a fold over exactly these rows, so the log
   turns a P&L figure into the trades that produced it. */
.pf-txns { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 11px; }
.pf-txns td { padding: 3px 0; border-bottom: 1px solid var(--rule); }
.pf-txns tr:last-child td { border-bottom: 0; }
.pf-txn-type { font-weight: 800; font-size: 9px; letter-spacing: .05em; width: 34px; }
.pf-txn-qty { font-family: var(--font-mono); font-variant-numeric: tabular-nums; width: 42px; }
.pf-txn-unit { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; }
.pf-txn-date { font-family: var(--font-mono); color: var(--ink-faint); text-align: right; white-space: nowrap; }
.pf-txn-empty { font-size: 11.5px; color: var(--ink-faint); padding: 4px 0; }

/* Secondary series under the floor chart — context, not headline. */
.insp-h-sub { margin-top: 14px; }
/* Manual-override marker: this figure is hand-entered, not market-derived. */
.ovr {
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .05em;
  color: var(--accent-ink);
  border: 1px solid var(--accent-soft2);
  border-radius: 2px;
  padding: 0 3px;
  margin-left: 4px;
  vertical-align: middle;
}

/* A price that is real but not live: the product's own language is sold out,
   so the last observed floor is shown with the date it was observed. Sits at
   the same weight as .ovr — both say "this number is not a live market quote"
   — but muted rather than accented, because unlike an override it is not
   something the user did. */
.stale-price {
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--ink-faint);
  border: 1px dashed var(--rule-strong);
  border-radius: 2px;
  padding: 0 3px;
  margin-left: 4px;
  vertical-align: middle;
  white-space: nowrap;
}

/* A floor read in a language that is not the product's own — the SAME chip
   shape as the carried-price badge, because both qualify the number they ride
   after, but tinted with --warn and given a solid edge so the two can never be
   read as one marker. A row can carry both (sold out in its own language AND
   quoted in another): the dashed grey one prints a date, this one prints a
   language, and side by side they say "old, and foreign". --warn rather than
   the accent for the same reason the held pill uses it: the accent is
   selection, and a reader scanning for qualified prices must not have to tell
   "this price needs reading twice" from "this row is open in the rail". */
.basis-price {
  border-style: solid;
  border-color: var(--warn);
  color: var(--warn);
}

/* The holder's own print-run declaration — IDENTITY, so it rides the name cell
   and the inspector eyebrow beside the grade slab, never the price. Same chip
   geometry as .stale-price/.basis-price so the portfolio's markers read as one
   family, but neutral-inked and solid-edged: the two above qualify a NUMBER
   ("read this price twice"), while this one states what the lot IS, and a
   reader scanning for qualified prices must not stop on it.
   First edition takes the gold token, matching the 1ST ED chip in the listings
   table (.lst-run--first) — one lot's declared run has to look the same on both
   surfaces or they read as two different facts. Reprint stays neutral: it is
   the ordinary case, and what a holder needs picked out of a list of positions
   is the scarce printing. */
.run-badge {
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--ink-faint);
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  padding: 0 3px;
  margin-left: 4px;
  vertical-align: middle;
  white-space: nowrap;
}
.run-badge--first {
  color: var(--gold-ink);
  border-color: var(--gold);
  background: var(--gold-soft);
}

/* Which supply bucket actually priced a declared holding. Rides the NOW figure
   because it qualifies THAT number, unlike .run-badge above.

   Two tones, and the split is the feature's whole honesty argument. `--run`
   means the declared run priced this position: accent-inked, because it is a
   live basis the reader chose and got. `--pooled` means the API fell back to
   the normal page floor — too few asks carry that run, or none do — and it is
   deliberately MUTED rather than warned: nothing is wrong, nothing is stale,
   the marking is recorded and will apply the moment that run's supply appears.
   Painting the fallback as a warning would read as an error the reader has to
   fix, when the correct behaviour on thin supply is exactly this. The tooltip
   carries the reason and, under `--pooled`, names the refused ask as an ask. */
.basis-run {
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: .04em;
  border: 1px solid transparent;
  border-radius: 2px;
  padding: 0 3px;
  margin-left: 4px;
  vertical-align: middle;
  white-space: nowrap;
}
.basis-run--run { color: var(--accent-ink); border-color: var(--accent-soft2); }
.basis-run--pooled { color: var(--ink-faint); border-color: var(--rule-strong); }

/* What the product last cost in its OWN language, under the headline price.
   Sized and coloured as context deliberately: the live floor is the number a
   buyer can act on today and has to stay the headline, so this reads as the
   footnote that makes it legible rather than as a second price competing with
   it. */
.own-floor {
  font-size: 10.5px;
  color: var(--ink-faint);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 900px) {
  .pf-strip, .stat-strip { gap: 16px; }
}

/* ── cross-market parity badge ───────────────────────────────────────────────
   /product's US-versus-EU read. Built by lib/ui/parity-badge.js, which reuses
   .card, .bar-row/.bar-code/.bar-val and .chart-note wholesale -- the two price
   rows are deliberately the same shape as the inspector's Source block, because
   they are the same two figures and a second vocabulary for them would mean a
   reader learning two layouts to be told one thing.

   No direction colour anywhere in here. Which market is cheaper is not good or
   bad news -- it depends which way you are trading -- so the chip states it in
   words on the neutral --paper-lo / --ink-soft pair rather than borrowing
   --pos/--neg, which would also be the one colour pairing a colour-blind reader
   cannot separate (see the --cat-* note at the top of this file). The one
   coloured figure is the spread, which is money with a real direction, and the
   leg it belongs to is written out beside it.

   Nothing here is interactive and nothing animates, so there is no focus state
   to define and nothing for prefers-reduced-motion to reduce. */
/* The muted states report an ABSENCE -- no twin, or no paired prices -- so they
   drop to the page ground rather than sitting on the raised --paper-hi card
   surface every populated card uses. A reader scanning the page reads "nothing
   here" off the weight before reading the sentence.

   Written `.card.parity--muted`, not `.parity--muted`: the declaration it
   overrides is `.card`, one class, so a bare single-class modifier ties on
   specificity and wins only by sitting later in the file. That is the
   `.ledger--dense` failure in this same stylesheet, which spent two rounds of
   edits applying to nothing. */
.card.parity--muted { background: transparent; }
.parity-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.parity-ratio { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
/* Which market is cheaper, in words. Shaped like .sig.hold -- the same neutral
   chip the signal block uses when it has no direction to assert. */
.parity-cheaper {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  background: var(--paper-lo);
  color: var(--ink-soft);
  border-radius: 2px;
  padding: 2px 5px;
  white-space: nowrap;
}
/* Fills the gap between the row's code and its figure, so the two price rows
   align on the same right edge as the inspector's. */
.parity-label { flex: 1; color: var(--ink-faint); min-width: 0; }
/* The cheaper market's two figures. Green ONLY -- the dearer side stays plain
   ink, never red: green-against-red is the one pairing a colour-blind reader
   cannot separate, and the "EU cheaper" chip already says which side it is in
   words, so the colour is a second channel rather than the only one. */
.parity-cheap { color: var(--pos); }
/* The twin's picture at the end of the US row. Fixed box on every row -- the EU
   row and an unmirrored twin both render the empty one -- so a missing picture
   never shortens a row or shifts the money columns. */
.parity-thumb {
  width: 22px;
  height: 30px;
  flex: none;
  display: block;
  border-radius: 2px;
  overflow: hidden;
}
.parity-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
a.parity-thumb:hover { outline: 1px solid var(--accent); outline-offset: 1px; }
/* The twin's page on TCGplayer. Styled like .pname-link -- inheriting the
   label's muted colour until hover -- because it sits inside .parity-label,
   which is --ink-faint: an --accent-ink link there would be the loudest thing
   in a card whose whole point is the two figures on the right. */
a.parity-link { color: inherit; text-decoration: none; }
a.parity-link:hover { color: var(--accent-ink); text-decoration: underline; }
a.parity-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-radius: 2px;
}
/* The converted figure. Carries .bar-val's 66px and right alignment so the two
   money cells form two fixed columns -- euros left, dollars right, on every row
   -- and is muted and one step smaller because it is this page's arithmetic
   rather than a market's own quote. The two classes alternate between the
   columns rather than owning one, so the emphasis runs diagonally: Cardmarket's
   euro and TCGplayer's dollar are the quotes. */
.parity-alt {
  width: 66px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-faint);
}
/* The external-link mark. `currentColor` + no own colour so it travels with the
   link's hover state; -1px lifts it off the text baseline onto the cap height. */
.parity-ext {
  width: 9px;
  height: 9px;
  margin-left: 3px;
  vertical-align: -1px;
}
.parity-spread {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--rule);
  font-size: 11.5px;
  color: var(--ink-soft);
}
.parity-spread--none { color: var(--ink-faint); }
.parity-none { font-size: 11.5px; color: var(--ink-faint); line-height: 1.5; }
/* A single-sided read still prints its one row under the sentence, so it needs
   the gap the populated card gets from .parity-head's margin. Written as an
   adjacent sibling, NOT `.bar-row:first-of-type` -- :first-of-type counts
   elements of the same TAG, and .parity-none is a div too, so the row is never
   the first div in that card and the rule would have applied to nothing. */
.parity-none + .bar-row { margin-top: 8px; }

/* ── locked chart teaser ────────────────────────────────────────────────── */
.locked-chart { position: relative; margin-top: 8px; border-radius: 3px; overflow: hidden; }
.locked-chart-svg {
  display: block;
  width: 100%;
  height: 96px;
  filter: blur(5px);
  opacity: .55;
}
.locked-chart-veil {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
@media (prefers-reduced-motion: reduce) {
  .locked-chart-svg { filter: blur(4px); }
}

/* ── settings ───────────────────────────────────────────────────────────── */
.settings-wrap { display: flex; justify-content: center; padding: 40px 22px; overflow-y: auto; flex: 1; }
.settings-card { width: 100%; max-width: 640px; }
.settings-card h1 { font-size: 24px; margin: 6px 0 20px; letter-spacing: -.01em; }
.set-section { border-top: 1px solid var(--rule); padding: 18px 0 6px; }
.set-section h2 { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); margin: 0 0 4px; }
.set-note { font-size: 12px; color: var(--ink-soft); margin: 0 0 14px; line-height: 1.5; }
.set-row { display: flex; align-items: center; gap: 16px; padding: 7px 0; }
.set-label { flex: 1; font-size: 12.5px; font-weight: 600; display: flex; flex-direction: column; }
.set-hint { font-size: 11px; font-weight: 400; color: var(--ink-faint); margin-top: 1px; }
.set-control { flex: 0 0 210px; }
.set-input { margin: 0; }
.set-actions { display: flex; align-items: center; gap: 10px; padding: 20px 0 0; border-top: 1px solid var(--rule); margin-top: 18px; }
.set-status { font-size: 11.5px; color: var(--ink-faint); }
@media (max-width: 620px) {
  .set-row { flex-direction: column; align-items: stretch; gap: 6px; }
  .set-control { flex: 1 1 auto; }
}

/* ── account page (/account) ────────────────────────────────────────────
   Built on the settings layout above (.settings-card, .set-section,
   .set-row); these are only the pieces settings has no use for. */
.account-nav { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 18px; font-size: 12px; }
.account-nav a { color: var(--ink-soft); }
.account-nav-out { margin-left: auto; }
.set-section.account-target h2 { color: var(--accent-ink); }
.set-section { scroll-margin-top: calc(var(--hdr-h, 48px) + 12px); }
.account-sub { font-size: 12px; margin: 18px 0 4px; }
.account-email { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.account-badge {
  font-size: 9px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--neg); border: 1px solid var(--neg); border-radius: 2px; padding: 1px 5px;
}
.account-badge--ok { color: var(--pos); border-color: var(--pos); }
.account-tier { font-size: 14px; }
.account-inline { display: flex; gap: 8px; }
.account-cycle { display: flex; gap: 4px; margin: 14px 0 10px; }
.account-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 0 0 12px; }
.account-plan {
  border: 1px solid var(--rule); border-radius: 4px; padding: 12px; background: var(--paper-hi);
  display: flex; flex-direction: column; gap: 6px; font-size: 12px;
}
.account-plan--current { border-color: var(--accent); }
.account-plan-name { font-weight: 700; font-size: 13px; }
.account-plan-price { font-size: 18px; font-weight: 700; }
.account-plan-price small { font-size: 11px; font-weight: 400; color: var(--ink-faint); }
.account-plan-note { font-size: 11px; color: var(--ink-faint); }
.account-plan-features { margin: 0; padding-left: 16px; color: var(--ink-soft); flex: 1; }
.account-plan .btn, .account-plan .account-badge { align-self: flex-start; }
#dangerHost .set-control { display: flex; flex-direction: column; gap: 6px; }

/* ── game marks ─────────────────────────────────────────────────────────── */
.tcg-cell { display: inline-flex; align-items: center; gap: 8px; }
.tcg-name { font-weight: 700; }

/* ── clickable account chip ─────────────────────────────────────────────── */
.acct-link {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 2px 5px 2px 2px;
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
}
.acct-link:hover { background: var(--paper-lo); }
.acct-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }


/* ── direction colour ───────────────────────────────────────────────────────
   `.delta.pos` covered the pill form only, so a bare `.pos` — which is what a
   signed money figure emits — fell back to body ink and a profit read the same
   as a loss. Money is the one place direction has to be visible at a glance. */
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.flat { color: var(--ink-faint); }
td .pos, td .neg { font-weight: 700; }

/* ── listings table ─────────────────────────────────────────────────────── */
.lst-seller { font-weight: 600; }
.lst-rating { margin-left: 6px; font-size: 10px; color: var(--ink-faint); font-family: var(--font-mono); }
.lst-flag {
  display: inline-block;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .04em;
  padding: 1px 4px;
  border-radius: 2px;
  border: 1px solid var(--rule-strong);
  color: var(--ink-soft);
  margin-right: 3px;
}
.lst-flag.lst-warn { color: var(--neg); border-color: var(--neg); }
.lst-flag.lst-grade { color: var(--accent-ink); border-color: var(--accent-soft2); }
/* The seller's print-run declaration. Weight drops to 600, matching .run-badge
   in the portfolio, against the chip's 700: DMG / NON-EU / OUT are alarms and
   should shout, a run is a fact and should not. Same family, lower voice.
   REPRINT keeps the base chip's neutral ink and edge — it is the ordinary case,
   and most sealed supply on a reprinted page is reprint.
   1ST ED is GOLD, on its own token (see --gold). This is a deliberate reversal
   of the "both declarations look alike" rule the chip shipped with: they are
   not alike to a reader of this table. A first edition is the scarce printing —
   on Frieren it is 1 of 10 listings and asks 4.6x the page floor — and the
   whole reason this column exists is that such a row otherwise reads as a
   mispriced outlier. Gold is the one thing on the row that says "this is a
   different good, not a bad price". It stays clear of --warn (adjacent in hue,
   but that means "read this figure twice") and of --accent (selection), so
   neither scan picks it up by mistake. */
.lst-flag.lst-run { font-weight: 600; }
/* Comment facts — what the seller said the offer contains. The run chip's
   weight and the base chip's neutral ink, for the run chip's reason: these
   state what comes in the box, not that a price needs reading twice, so they
   must not join the DMG / NON-EU / OUT scan. The letter-spacing goes back to
   normal because these labels are words ("Acrylic incl."), not the tracked-out
   three-letter codes the rest of the family uses, and tracking makes a word
   harder to read at 8.5px rather than easier. They are also the only chips on
   the row derived from free text rather than an API field, and the lower voice
   is the honest rendering of that. */
.lst-flag.lst-fact { font-weight: 600; letter-spacing: 0; }
.lst-flag.lst-run--first {
  color: var(--gold-ink);
  border-color: var(--gold);
  background: var(--gold-soft);
}

/* ── real publisher marks ───────────────────────────────────────────────── */
/* Token-driven, like the card art above it: a density switch is a token
   remap with no re-render, so a hard-coded px size here simply would not
   respond — and a 26px mark beside 79px artwork at the xlarge density reads
   as a rendering bug rather than a choice. */
.tcg-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--mark-w);
  height: var(--mark-h);
  flex: 0 0 auto;
}
.tcg-mark img, .tcg-mark svg { max-width: 100%; max-height: 100%; display: block; }
/* Detail-panel size. The marks are mixed-aspect — a Pokémon wordmark is wide
   and flat, a Lorcana glyph square — so both axes are capped and `max-width /
   max-height: 100%` above letterboxes each one inside the same box rather than
   distorting it. That is what keeps a column of marks optically level. */
.tcg-mark--lg { width: var(--insp-mark-w); height: var(--insp-mark-h); }
/* Parks a mark in the bottom-right of a flex head block: the auto margin eats
   the free space, and flex-end overrides the row's own alignment (the title
   row aligns to flex-start, the price row to baseline) so it sits ON the
   bottom edge in both. */
.tcg-mark--corner { margin-left: auto; align-self: flex-end; opacity: .92; }
/* Single-colour black artwork has to invert on a dark ground or it vanishes. */
:root[data-theme="slate"] .tcg-mark--mono img,
:root[data-theme="terminal"] .tcg-mark--mono img { filter: invert(1); }
.tcg-fallback { color: var(--ink-faint); font-weight: 700; }

/* ── dense listings table ───────────────────────────────────────────────────
   A busy product carries >1,000 listings, so this table is deliberately
   tighter than the product ledger: half the row height, no artwork column and
   a smaller face. It still grows with density, just from a lower base. */
/* EVERY selector in this block is tag-qualified (`table.ledger.ledger--dense`,
   not `.ledger--dense`) and that is load-bearing, not style. The base rules it
   overrides are written `table.ledger tbody tr` and `table.ledger td` — one
   class plus three and two type selectors — so a bare `.ledger--dense tbody tr`
   is LESS specific and silently loses. Measured 2026-08-05: the dense table
   computed to the base 34px row, 10px padding and 12px face, i.e. the whole
   modifier had never applied to anything. Do not drop the `table.ledger`
   prefix from any rule here. */
table.ledger.ledger--dense { font-size: calc(var(--ledger-fs) - 2px); }
table.ledger.ledger--dense tbody tr { height: calc(var(--rowh) * 0.6); }
table.ledger.ledger--dense td { padding: 0 calc(var(--td-pad) * 0.55); }
table.ledger.ledger--dense thead th { padding: 2px calc(var(--td-pad) * 0.55); }
/* Line-height, not just row height: at this ratio the default leading is what
   stops the row from actually getting shorter. */
table.ledger.ledger--dense tbody td { line-height: 1.1; }
/* The elastic column (the seller's comment) is the only one allowed to take
   the slack; every other cell is tabular and must keep its own width. */
table.ledger.ledger--dense td, table.ledger.ledger--dense thead th { white-space: nowrap; }
.lst-comment {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
  color: var(--ink-soft);
  font-size: .95em;
}
/* Completed-sales count, folded into the seller cell rather than taking a
   column of its own — it is read as part of "who is this", not as a measure. */
.lst-sales {
  margin-left: 6px;
  font-family: var(--font-mono);
  font-size: .88em;
  color: var(--ink-faint);
}
/* Names what the row's highlight actually claims. Unqualified, "FLOOR" on a
   twelve-language table reads as "cheapest on the page", which for eleven of
   them is wrong — so the tag carries the language it is the floor for. */
.lst-floor-tag {
  display: inline-block;
  margin-right: 5px;
  padding: 0 3px;
  border-radius: 2px;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .04em;
  vertical-align: 1px;
  color: var(--accent-ink);
  background: var(--accent-soft2, var(--accent-soft));
}

/* The listings pane is the page's tallest element and scrolls on its own,
   rather than growing the document to a thousand rows. */
.lst-card { padding: 0; max-height: min(62vh, 640px); overflow: auto; }
.lst-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 0 8px;
}
.lst-bar .spacer { flex: 1; }
/* One filter group — its caption and its chips on a line. The bar carries two
   of these (language, grade), so each has to be a box of its own rather than
   loose children of the bar: without this the two captions and two chip rows
   interleave into whatever order the flex line happens to wrap into. */
.lst-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lst-floor-note { color: var(--accent-ink); font-weight: 700; margin-left: 10px; }
.chip-n {
  margin-left: 5px;
  font-size: 9px;
  opacity: .65;
  font-family: var(--font-mono);
}
/* A bucket the OTHER filter has emptied. Dimmed rather than dropped: the chip
   rows are counted against each other, so "PSA 10 · 0" on a German board is a
   fact worth showing — the tier exists on this product, just not in German —
   and a control that reshuffled as the reader worked would move the chip they
   were reaching for. Still clickable, and the count says what it will return. */
.chip.chip-empty { opacity: .45; }
.chip.chip-empty.on { opacity: 1; }

/* Highlights: the row that sets the floor, and the rows excluded from it. */
table.ledger.ledger--dense tbody tr.lst-is-floor {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}
table.ledger.ledger--dense tbody tr.lst-is-floor td:first-child { font-weight: 800; }
table.ledger.ledger--dense tbody tr.lst-is-muted { opacity: .5; }

/* Non-default languages are dimmed rather than hidden: still there to scan,
   but the reader's own language reads first. Muted rows (outliers, damaged)
   already carry their own de-emphasis and must not be dimmed twice. */
table.ledger.ledger--dense tbody tr.lst-off-lang { opacity: .62; }
table.ledger.ledger--dense tbody tr.lst-off-lang:hover { opacity: 1; }
table.ledger.ledger--dense tbody tr.lst-is-floor.lst-off-lang { opacity: .85; }

/* ── price ladder ───────────────────────────────────────────────────────────
   How far a listing sits above ITS OWN language's floor, as a tint on the price
   cell. A price in isolation does not tell you whether it is a good one — €240
   is the bargain of the page on one product and robbery on another — so the
   premium is encoded and the table becomes scannable for value.

   The tint sits on the cell, never on the figure: the price stays in ink so it
   keeps full contrast, and the colour reads as a mark beside it. Steps run
   green (at the floor) → neutral → red (well above), which is the direction a
   trader already reads and matches the app's own --pos / --neg vocabulary.

   Deliberately low alpha: this runs down a thousand-row table, and anything
   stronger turns a dense ledger into a heat map nobody can read past. */
table.ledger.ledger--dense tbody tr.lst-step-0 td:first-child { background: color-mix(in srgb, var(--pos) 16%, transparent); }
table.ledger.ledger--dense tbody tr.lst-step-1 td:first-child { background: color-mix(in srgb, var(--pos) 8%, transparent); }
table.ledger.ledger--dense tbody tr.lst-step-2 td:first-child { background: color-mix(in srgb, var(--neg) 6%, transparent); }
table.ledger.ledger--dense tbody tr.lst-step-3 td:first-child { background: color-mix(in srgb, var(--neg) 14%, transparent); }

/* The floor row already carries the strongest treatment on the page — accent
   bar plus accent field — and a cell background paints OVER its row
   background, so the step-0 tint landed on top and turned both to mud. The
   floor is step 0 by definition, so clearing the tint loses no information.
   Must stay after the step rules: equal specificity, later wins. */
table.ledger.ledger--dense tbody tr.lst-is-floor td:first-child { background: transparent; }

.lst-price { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--rule-strong); }
.lst-price:hover { color: var(--accent-ink); border-bottom-color: var(--accent); }

/* Seller origin. The flag is decorative — the ISO code carries the meaning,
   because several EU flags are indistinguishable at this size and unreadable
   to a colour-blind reader entirely. */
.lst-origin { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.lst-flag-emoji { font-size: 1.05em; line-height: 1; }
.lst-cc {
  font-family: var(--font-mono);
  font-size: .92em;
  letter-spacing: .02em;
  color: var(--ink-faint);
}
.lst-seller-type {
  margin-left: 6px;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .04em;
  padding: 1px 3px;
  border-radius: 2px;
  color: var(--accent-ink);
  background: var(--accent-soft);
}

/* ── beta pill ───────────────────────────────────────────────────────────
   The floating beta indicator, rendered once by the shell (lib/ui/shell.js)
   on every page. Sits just above the status bar in the bottom-right corner;
   z-index 60 keeps it over the table chrome (statusbar 50) and under the
   palette/help overlays (100). Uses the warn tokens, not the accent: it is
   an advisory, not a call to action. */
.beta-pill {
  position: fixed;
  right: 12px;
  bottom: 38px;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--warn);
  background: var(--paper-hi);
  border: 1px solid var(--warn);
  border-radius: 999px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .18);
  transition: background .15s, color .15s;
}
.beta-pill:hover { background: var(--warn); color: var(--paper-hi); }
.beta-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: beta-pulse 2.2s ease-out infinite;
}
@keyframes beta-pulse {
  0% { box-shadow: 0 0 0 0 var(--warn-soft); }
  70% { box-shadow: 0 0 0 6px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@media (prefers-reduced-motion: reduce) { .beta-dot { animation: none; } }
@media print { .beta-pill { display: none; } }

/* ── alerts page ─────────────────────────────────────────────────────────
   Merged from the alerts-page build. */

/* Alerts page — styles genuinely new to this page. Everything else (stat-grid,
   filters/chip-row, tbl-wrap, workspace, insp-head/insp-section/insp-stats,
   .tag, .btn, .delta) is reused as-is from the existing design system. */

/* Distance column: a price alert within NEAR_TRIGGER_PCT of firing gets a
   soft warn-coloured highlight so it reads at a glance down the column,
   distinct from the plain pos/neg colouring every other delta cell uses. */
.delta.near-trigger {
  background: var(--warn-soft);
  color: var(--warn);
  padding: 1px 5px;
  border-radius: 2px;
}

/* Status column pill — same box model as .sig (buy/sell/hold), a distinct
   class because the vocabulary (active/paused) is not a market signal. */
.alert-status {
  padding: 2px 6px;
  border-radius: 9px;
  text-transform: uppercase;
}
.alert-status.on { background: var(--pos-soft); color: var(--pos); }
.alert-status.off { background: var(--paper-lo); color: var(--ink-faint); }

/* Inspector: the plain-language condition sentence ("Fires when the floor
   drops below €80,00."). */
.cond-sentence { font-size: 12px; line-height: 1.5; color: var(--ink-soft); }

/* Inspector: the transient result of Pause/Resume/Test/Delete, e.g. the
   429 cooldown message or a mapped error. Reserves no layout space when
   empty (no min-height) so it never shows a blank gap between visits. */
.insp-note { padding: 0 16px 12px; font-size: 11px; color: var(--ink-faint); }

/* Delete button armed for its second confirming click. */
.btn.confirm { background: var(--neg-soft); color: var(--neg); border-color: var(--neg); }

/* New-alert form fields, stacked one per row inside the inspector's
   .insp-section (which already supplies the section padding/border). */
.nap-field { margin-bottom: 10px; }
.nap-field > .micro { display: block; margin-bottom: 4px; }
.nap-field .fr-input { width: 100%; box-sizing: border-box; }
.nap-check { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; margin-right: 12px; font-weight: 600; }

/* Product-search suggestion dropdown. Positioned as a simple stacked list
   rather than an absolutely-positioned overlay: the inspector is a narrow,
   already-scrollable rail, and an overlay here would either clip against
   its edge or need its own scroll-lock — a pushed-down list costs one
   reflow and has neither problem. */
.nap-suggest {
  max-height: 160px;
  overflow-y: auto;
  border: 1px solid var(--rule);
  border-radius: 3px;
  margin-top: 4px;
}
.nap-suggest:empty { border: none; margin-top: 0; }
.nap-sugg-row {
  padding: 6px 8px;
  font-size: 11.5px;
  cursor: pointer;
  border-bottom: 1px solid var(--rule);
}
.nap-sugg-row:last-child { border-bottom: none; }
.nap-sugg-row:hover { background: var(--paper-lo); }
.nap-sugg-empty { padding: 6px 8px; font-size: 11px; }
.nap-picked { font-size: 11px; margin-top: 4px; min-height: 14px; }
.nap-limit { font-size: 11px; margin-top: 6px; }
.nap-error { font-size: 11px; color: var(--neg); margin-top: 6px; min-height: 14px; }


/* ── beta page ───────────────────────────────────────────────────────────
   Merged from the beta-page build. */

/* Header block: eyebrow + title + lead paragraph. Scoped h1 sizing to this
   page, matching the existing .hero h1 / .settings-card h1 / .auth-card h1
   convention — there is no generic top-level h1 rule in this file. */
.beta-head { margin-bottom: 20px; }
.beta-head h1 {
  font-size: 26px;
  margin: 6px 0 10px;
  font-weight: 800;
  letter-spacing: -.01em;
}
.beta-lead { max-width: 640px; color: var(--ink-soft); font-size: 13.5px; line-height: 1.55; margin: 0; }

/* Promo card: claim row + status message. Tone mirrors .delta's pos/neg
   vocabulary, but this copy is informational rather than a price move, so it
   gets its own ok/info/warn classes instead of reusing .delta directly. */
.beta-claim-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.beta-claim-msg { font-size: 12px; font-weight: 600; }
.beta-claim-msg.ok { color: var(--pos); }
.beta-claim-msg.info { color: var(--ink-soft); }
.beta-claim-msg.warn { color: var(--warn); }
.beta-promo-closed { color: var(--ink-faint); font-size: 12px; margin-top: 10px; }

/* Journey timeline: a rule down the left edge with one dot per stage. The one
   genuinely new shape on this page — everything else reuses .card,
   .stat-grid, .bar-track and .grade-row. */
.beta-timeline { position: relative; padding-left: 22px; margin-top: 4px; }
.beta-timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: var(--rule-strong);
}
.beta-stage { position: relative; padding-bottom: 18px; }
.beta-stage:last-child { padding-bottom: 0; }
.beta-stage-dot {
  position: absolute;
  left: -22px;
  top: 3px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid var(--ink-faint);
  background: var(--paper);
}
/* Shipped stages read as done (pos); "now" is the one stage that should draw
   the eye, using --warn like the beta pill it was reached from; next/beyond
   stay muted rule-strong — they have not happened yet. */
.beta-stage--shipped .beta-stage-dot { border-color: var(--pos); background: var(--pos-soft); }
.beta-stage--now .beta-stage-dot {
  border-color: var(--warn);
  background: var(--warn-soft);
  box-shadow: 0 0 0 3px var(--warn-soft);
}
.beta-stage--next .beta-stage-dot,
.beta-stage--beyond .beta-stage-dot { border-color: var(--rule-strong); background: transparent; }
.beta-stage-label { font-size: 10px; letter-spacing: .07em; font-weight: 700; text-transform: uppercase; color: var(--ink-faint); }
.beta-stage--now .beta-stage-label { color: var(--warn); }
.beta-stage-title { font-size: 13px; font-weight: 700; margin: 3px 0 2px; }
.beta-stage-desc { font-size: 12px; color: var(--ink-soft); line-height: 1.5; max-width: 640px; }

/* "A few things to know" disclaimer list. */
.beta-disclaimers { margin: 0; padding-left: 18px; }
.beta-disclaimers li { margin-bottom: 6px; font-size: 12px; color: var(--ink-soft); line-height: 1.5; }
.beta-disclaimers li:last-child { margin-bottom: 0; }


/* ── market dashboard ────────────────────────────────────────────────────
   Merged from the dashboard rework. */

/* Time-series chart cards render at their intrinsic 920px design width and
   never balloon to the full viewport: at 1680px wide a scaled-up SVG chart
   becomes a hero image that pushes the actual ledger below the fold. Bars
   (the ladder) keep the default full card width — rows, not a canvas. */
#perfChart, #compHistoryChart, .graded-history-card { max-width: 980px; }

/* Sealed-vs-singles split bar (composition panel) — two segments in one
   track with a 2px gap, reusing .bar-row's layout. Only the wide label and
   the two-segment track are new; .bar-track/.bar-pct are the existing
   inspector bar-chart primitives. */
.bar-label {
  width: 88px;
  flex: 0 0 auto;
  font-weight: 600;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bar-track.split {
  display: flex;
  gap: 2px;
  background: transparent;
}
.bar-seg { height: 100%; }
.bar-seg.sealed { background: var(--cat-2); border-radius: 3px 0 0 3px; }
.bar-seg.single { background: var(--cat-1); border-radius: 0 3px 3px 0; }

/* Investor-tier veil (403: signed in, below the Investor tier). Same blurred
   teaser shell as .locked-chart (lib/ui/locked-chart.js's synthetic curve),
   but with its own copy and an upgrade link instead of a sign-in prompt — an
   already-authenticated visitor must never be told to sign in again. */
.locked-chart-msg {
  max-width: 240px;
  text-align: center;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--ink-soft);
}
.locked-chart-msg .btn {
  margin-top: 8px;
  display: inline-block;
}


/* ── chart range chips ───────────────────────────────────────────────────
   The 7D/30D/90D/1Y/All row above a history chart. Deliberately the same
   .chip primitive as the filter row rather than a bespoke segmented control:
   a range IS a filter over the series, and inventing a second control shape
   for it would make the rail look like two different apps. Only the spacing
   and the tighter type are new — inside the 380px inspector the filter row's
   default chip padding wraps five chips onto two lines. */
.range-chips { margin: 2px 0 8px; gap: 3px; }
.range-chips .chip {
  padding: 2px 7px;
  font-size: 10px;
  letter-spacing: .03em;
}


/* ── reports ─────────────────────────────────────────────────────────────
   The article takes the main pane and the archive takes the rail, the reverse
   of every other page here. That is not an inconsistency for its own sake:
   this is the one surface whose payload is prose, and a 2,000-word note in a
   380px rail is a column eleven words wide. */
.rpt-rail { display: flex; flex-direction: column; padding: 0; }
.rpt-list { flex: 1; min-height: 0; overflow-y: auto; }
.rpt-more { flex: 0 0 auto; padding: 8px 12px; border-top: 1px solid var(--rule); }
.rpt-more .btn { width: 100%; }

/* The reading measure is capped rather than filling the pane: at 1680px a
   full-width paragraph runs past 180 characters, which is unreadable no
   matter how good the prose is. */
.report { max-width: 760px; }
.report-head { border-bottom: 1px solid var(--rule); padding-bottom: 14px; margin-bottom: 18px; }
.report-title { font-size: 22px; font-weight: 800; line-height: 1.25; margin: 6px 0 0; }
.report-lede { font-size: 13.5px; color: var(--ink-soft); line-height: 1.6; margin: 10px 0 0; }

/* The archive rail is 380px, so the summary is a one-line hint under the title
   rather than a wrapped paragraph: three lines per row turns a seven-issue
   archive into a scroll. The title itself still wraps — it is the identity. */
.rpt-rail .pset { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── chart controls: the range chips and what the range DID ──────────────
   One row above the charts it scopes, never a control per card. The change
   figures sit on the trailing edge because the chips are the input and the
   deltas are the answer — reading order is left to right. */
.chart-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 2px 0 8px;
}
.chart-controls .range-chips { margin: 0; }
.chart-change { display: flex; gap: 10px; align-items: baseline; margin-left: auto; }
.chg { display: inline-flex; gap: 4px; align-items: baseline; font-size: 10px; }
.chg-k { color: var(--ink-faint); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
/* The move in its own unit, ahead of the percentage. Tabular and a shade
   heavier than the percentage beside it: it is the concrete figure, and the
   percentage only says how big it was relative to where the window opened. */
.chg-v { font-family: var(--font-mono); font-weight: 700; }

/* ── small multiples ─────────────────────────────────────────────────────
   Floor, stock and cap each get their OWN value axis in their own unit,
   stacked on a shared time axis. Not a dual-axis overlay: two y-scales on one
   plot align arbitrarily, which invents a correlation the data does not have.
   Indexing them to a common base was the previous attempt, and a supply that
   goes 1 -> 95 indexes to 9,500% and presses the floor flat along the bottom. */
.chart-panel + .chart-panel { margin-top: 6px; }
.chart-panel-h {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 10px;
  margin-bottom: 2px;
}
.chart-panel-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  color: var(--ink-soft);
}
.chart-panel-v {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
/* The colour swatch that carries series identity next to its name, so identity
   never rests on the line colour alone. */
.sw { width: 11px; height: 3px; border-radius: 1px; display: inline-block; flex: 0 0 auto; }

/* ── ranked bars (HTML, not a scaled SVG) ────────────────────────────────
   Length is value against the largest row; the figure on the right is share of
   the total. One hue for every bar — these categories have no order, and
   darker-where-bigger would double-encode the length the bar already shows. */
.rb { display: flex; flex-direction: column; gap: 5px; }
.rb-row { display: flex; align-items: center; gap: 10px; font-size: 11.5px; }
.rb-label {
  width: 132px;
  flex: 0 0 auto;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rb-track { flex: 1; min-width: 0; height: 10px; background: var(--paper-lo); border-radius: 2px; }
.rb-fill { display: block; height: 100%; background: var(--seq); border-radius: 2px; }
.rb-val {
  width: 78px;
  flex: 0 0 auto;
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.rb-pct {
  width: 52px;
  flex: 0 0 auto;
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink-faint);
}


/* Stacked segments inside a ranked bar. The 2px surface gap separates the two
   fills without a stroke — a border would add a third colour to a two-colour
   comparison — and the rounding stays on the outer fill so the bar still reads
   as one length. */
.rb-fill--split { display: flex; gap: 2px; background: transparent; }
.rb-seg { height: 100%; }
.rb-seg:first-child { border-radius: 2px 0 0 2px; }
.rb-seg:last-child { border-radius: 0 2px 2px 0; }
.rb-seg:only-child { border-radius: 2px; }
.rb-legend { margin: 0 0 10px; }

/* Which axis a series is read against, in the legend of the one dual-scale
   chart in the app. Without it, two scales are a guess. */
.lg-side {
  font-size: 9px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ── tiles ───────────────────────────────────────────────────────────────
   The same <table class="ledger"> re-laid as cards by ONE attribute on :root,
   exactly like density and theme. No second component, no re-render, and no
   page has to know about it — so selection, j/k focus and the inspector all
   keep working on markup that never changed.

   The card is artwork-forward: these products ARE pictures, and a tile that
   shrinks the art to the table's 20px thumbnail is a worse table rather than a
   different view. Two attributes make that possible without touching any
   render function — `data-label` supplies the column name a card has no header
   to carry, and `data-key` names each cell's role so the layout can promote the
   artwork and pin the rank and game marks as badges. */
:root[data-view="tiles"] { --tile-w: 250px; --tile-art-w: 138px; --tile-art-h: 193px; --tile-mark-h: 34px; }
:root[data-view="tiles"][data-density="comfortable"] { --tile-w: 280px; --tile-art-w: 158px; --tile-art-h: 221px; --tile-mark-h: 40px; }
:root[data-view="tiles"][data-density="spacious"] { --tile-w: 310px; --tile-art-w: 178px; --tile-art-h: 249px; --tile-mark-h: 46px; }
:root[data-view="tiles"][data-density="xlarge"] { --tile-w: 350px; --tile-art-w: 200px; --tile-art-h: 280px; --tile-mark-h: 54px; }

:root[data-view="tiles"] table.ledger { display: block; border-collapse: separate; }

/* The header becomes a strip of sort chips: hiding it outright would take
   sorting away with the layout, which is a different feature. */
:root[data-view="tiles"] table.ledger thead { display: block; }
:root[data-view="tiles"] table.ledger thead tr {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 8px;
  height: auto;
}
:root[data-view="tiles"] table.ledger thead th { display: none; }
:root[data-view="tiles"] table.ledger thead th.sortable {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  position: static;
  width: auto;
  padding: 2px 8px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--paper);
  text-align: left;
}
:root[data-view="tiles"] table.ledger thead th.sortable:hover { border-color: var(--rule-strong); }

:root[data-view="tiles"] table.ledger tbody {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--tile-w), 1fr));
  gap: 10px;
  padding: 10px;
}
:root[data-view="tiles"] table.ledger tbody tr {
  position: relative;
  display: flex;
  flex-direction: column;
  height: auto;
  gap: 1px;
  padding: 0 0 10px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--paper-hi);
  overflow: hidden;
  transition: border-color .12s ease;
}
:root[data-view="tiles"] table.ledger tbody tr:hover { border-color: var(--rule-strong); }
:root[data-view="tiles"] table.ledger tbody tr.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
:root[data-view="tiles"] table.ledger tbody tr.focused { border-color: var(--rule-strong); }

/* An empty state, an error or a skeleton is about the whole set, not one card —
   it spans the grid instead of pretending to be a tile. */
:root[data-view="tiles"] table.ledger tbody tr.state-row {
  grid-column: 1 / -1;
  border: 0;
  background: none;
  padding: 0;
}

/* ── the hero: artwork, then the name ─────────────────────────────────────
   `order: -1` promotes the elastic column above the rank and game cells that
   precede it in the table's column order, so the picture leads the card
   without a single change to how a row is rendered. */
:root[data-view="tiles"] table.ledger td.name-cell {
  order: -1;
  display: block;
  max-width: none;
  margin: 0 0 7px;
  padding: 15px 12px 10px;
  border-bottom: 1px solid var(--rule);
  background:
    radial-gradient(120% 90% at 50% 0%, var(--paper-lo), transparent 70%);
  text-align: center;
}
:root[data-view="tiles"] table.ledger td.name-cell::before { content: none; }
:root[data-view="tiles"] table.ledger td.name-cell .name-flex {
  flex-direction: column;
  align-items: center;
  gap: 11px;
  padding: 0;
}
/* Both the real image and the deterministic placeholder carry `.cardart`, so
   one rule sizes whichever a product has.

   `object-fit: contain` is load-bearing at this size: the frame is a card's
   5:7, and a sealed box or a landscape promo forced into it stretches visibly —
   invisible at the table's 20px thumbnail, not at 138px. Letterboxing reads as
   deliberate against the tinted plate behind it. */
:root[data-view="tiles"] table.ledger .name-flex .cardart {
  width: var(--tile-art-w);
  height: var(--tile-art-h);
  object-fit: contain;
  border-radius: 5px;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .18));
}
:root[data-view="tiles"] table.ledger .name-flex .name-stack { align-items: center; width: 100%; }
:root[data-view="tiles"] table.ledger .name-cell .pname {
  font-size: calc(var(--ledger-fs) + 1px);
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  /* Two lines, always. A one-line name next to a two-line one would start its
     figures a row higher, and a grid of cards whose labels do not line up
     across is the thing that makes a tile view feel untidy. Longer names
     ellipsis rather than pushing the card taller than its neighbours. */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  min-height: calc(2 * 1.3em);
}
:root[data-view="tiles"] table.ledger .name-cell .pset { text-align: center; }
/* A board with no artwork column (markets, reports) still gets a title band —
   the plate and the rule are what make it read as the card's head rather than
   the first of the figures. */
:root[data-view="tiles"] table.ledger td.name-cell .tcg-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}
:root[data-view="tiles"] table.ledger td.name-cell .tcg-mark {
  display: inline-flex;
  justify-content: center;
  width: auto;
  height: var(--tile-mark-h);
}
/* On a board with no artwork the game mark IS the picture, so it is sized like
   one rather than left at the table's inline glyph size. */
:root[data-view="tiles"] table.ledger td.name-cell .tcg-mark img,
:root[data-view="tiles"] table.ledger td.name-cell .tcg-mark svg {
  width: auto;
  height: var(--tile-mark-h);
  max-width: 100%;
  object-fit: contain;
}
:root[data-view="tiles"] table.ledger td.name-cell .tcg-name {
  display: block;
  margin-top: 7px;
  font-size: calc(var(--ledger-fs) + 2px);
  font-weight: 800;
}

/* ── directional tint (markets) ──────────────────────────────────────────
   A tile is scanned, so direction lands before any number does. Three steps,
   not a gradient: a gradient only ever says "some green". The tint is on the
   card's surface and its border, never on the figures — those keep their own
   pos/neg colours, which must stay readable against it. */
:root[data-view="tiles"] table.ledger tbody tr.mv-up-1 { background: color-mix(in oklab, var(--pos) 5%, var(--paper-hi)); }
:root[data-view="tiles"] table.ledger tbody tr.mv-up-2 { background: color-mix(in oklab, var(--pos) 10%, var(--paper-hi)); }
:root[data-view="tiles"] table.ledger tbody tr.mv-up-3 {
  background: color-mix(in oklab, var(--pos) 17%, var(--paper-hi));
  border-color: color-mix(in oklab, var(--pos) 38%, var(--rule));
}
:root[data-view="tiles"] table.ledger tbody tr.mv-down-1 { background: color-mix(in oklab, var(--neg) 5%, var(--paper-hi)); }
:root[data-view="tiles"] table.ledger tbody tr.mv-down-2 { background: color-mix(in oklab, var(--neg) 10%, var(--paper-hi)); }
:root[data-view="tiles"] table.ledger tbody tr.mv-down-3 {
  background: color-mix(in oklab, var(--neg) 17%, var(--paper-hi));
  border-color: color-mix(in oklab, var(--neg) 38%, var(--rule));
}
/* In rows mode the same classes are a hairline on the row's leading edge —
   the tint would fight the zebra and the selection highlight at row height. */
:root:not([data-view="tiles"]) table.ledger tbody tr[class*="mv-up"] { box-shadow: inset 2px 0 0 color-mix(in oklab, var(--pos) 55%, transparent); }
:root:not([data-view="tiles"]) table.ledger tbody tr[class*="mv-down"] { box-shadow: inset 2px 0 0 color-mix(in oklab, var(--neg) 55%, transparent); }
:root:not([data-view="tiles"]) table.ledger tbody tr.selected[class*="mv-"] { box-shadow: inset 3px 0 0 var(--accent); }

/* Rank and game ride the artwork as badges rather than spending a labelled
   line each on two glyphs.

   `:not(.name-cell)` is not defensive — on /markets the game column IS the
   elastic one, so without it that cell matched both this rule and the hero
   above, absolutely positioned itself out of the card, and left the tile
   headed by whatever figure came next. A cell is a badge only when it is not
   already the title. */
:root[data-view="tiles"] table.ledger td[data-key="rank"]:not(.name-cell),
:root[data-view="tiles"] table.ledger td[data-key="tcg"]:not(.name-cell) {
  position: absolute;
  top: 8px;
  z-index: 2;
  display: block;
  width: auto;
  padding: 0;
  overflow: visible;
}
:root[data-view="tiles"] table.ledger td[data-key="rank"]:not(.name-cell) { left: 9px; }
:root[data-view="tiles"] table.ledger td[data-key="tcg"]:not(.name-cell) { right: 9px; }
:root[data-view="tiles"] table.ledger td[data-key="rank"]:not(.name-cell)::before,
:root[data-view="tiles"] table.ledger td[data-key="tcg"]:not(.name-cell)::before { content: none; }
/* The portfolio's holdings board has no game column to promote — its mark
   rides the name cell's set line. In tiles it takes the same corner post as
   the game column does on every other board, at the mark's inline size: the
   picture-size rule above is for boards where the mark IS the artwork, and a
   34px game logo under 138px card art reads as a rendering bug. The extra
   .pset class out-specifies both tile mark rules regardless of order. */
:root[data-view="tiles"] table.ledger td.name-cell .pset .tcg-mark {
  position: absolute;
  top: 8px;
  right: 9px;
  z-index: 2;
  width: var(--mark-w);
  height: var(--mark-h);
}
:root[data-view="tiles"] table.ledger td.name-cell .pset .tcg-mark img,
:root[data-view="tiles"] table.ledger td.name-cell .pset .tcg-mark svg {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
}
:root[data-view="tiles"] table.ledger td[data-key="rank"] .rank-cell {
  display: inline-block;
  min-width: 19px;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--rule);
  font-size: 10px;
  text-align: center;
}

/* ── the figures ─────────────────────────────────────────────────────────
   Two columns, label stacked over value. A single column of label-dots-value
   rows made a tile twice as tall as it needed to be and spent most of each
   line on whitespace between the two; stacked pairs put twice as many figures
   in the same height and give every value a full column to itself, so nothing
   is squeezed by a long label opposite it.

   The tile itself is the grid — `display: contents` on the row's cells is not
   an option here (the tr IS the card), so the figures live in their own grid
   laid over the flex column via `grid-column`-free auto-flow. */
:root[data-view="tiles"] table.ledger tbody tr {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-content: start;
  gap: 7px 10px;
  padding: 0 12px 11px;
}
/* The hero spans both columns and bleeds to the card's edges. */
:root[data-view="tiles"] table.ledger td.name-cell { grid-column: 1 / -1; margin: 0 -12px 3px; }

:root[data-view="tiles"] table.ledger td {
  display: block;
  /* `width: auto` undoes the table rule's `width: 1%`, which is a shrink-wrap
     trick against a table's own layout algorithm and resolves against the GRID
     AREA here — 1% of a 116px column is a 1px cell, and every figure vanished
     into it. */
  width: auto;
  padding: 0;
  white-space: normal;
  text-align: left;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
:root[data-view="tiles"] table.ledger td::before {
  content: attr(data-label);
  display: block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-faint);
  line-height: 1.35;
}
/* A cell whose label is blank (an icon-only column) would leave a dangling
   gap; collapse it to just its value. */
:root[data-view="tiles"] table.ledger td[data-label=""]::before { content: none; }

/* A segment's own share, printed inside it — but only where it fits (see
   IN_BAR_LABEL_MIN in ui/bars.js). Below that width the figure is on the
   segment's hover title instead of clipped against its neighbour. */
.rb-seg-pct {
  display: block;
  padding: 0 5px;
  font-size: 9px;
  font-weight: 700;
  line-height: 10px;
  color: var(--paper);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
}

/* ── portfolio in the catalogue ──────────────────────────────────────────
   Ownership marking and the rail's add form. The pill is deliberately --warn
   and never --accent: the accent means "selected / open in the rail", and a
   reader scanning for their own holdings must not have to tell the two apart.
   ───────────────────────────────────────────────────────────────────────── */

/* Keeps the pill on the name's own line, so it rides with the title rather
   than wrapping under it or pushing the set line sideways. */
.name-line { display: flex; align-items: baseline; gap: 5px; min-width: 0; }
.name-line .pname { min-width: 0; }

.held-pill {
  flex: none;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--warn);
  border: 1px solid var(--warn);
  border-radius: 2px;
  padding: 0 3px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* The add form. Three fields across on one row because a buy is one thought —
   how many, at what, when — and stacking them turns it into three. */
.pf-form .pf-row { display: flex; gap: 6px; }
.pf-field { margin-bottom: 8px; min-width: 0; flex: 1; }
.pf-field > .micro { display: block; margin-bottom: 3px; }
.pf-field .fr-input { width: 100%; box-sizing: border-box; }
.pf-row .pf-qty { flex: 0 0 52px; }
.pf-row .pf-date { flex: 0 0 118px; }
.pf-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.pf-hint { font-size: 10.5px; line-height: 1.4; margin-top: 6px; }
.pf-error { font-size: 11px; color: var(--neg); margin-top: 6px; min-height: 14px; }
.pf-error:empty { min-height: 0; }
.pf-note { padding: 8px 0 0; color: var(--pos); font-weight: 600; }
.pf-position .pf-qty-v { color: var(--warn); }
.pf-position .pf-pct { font-size: 10.5px; color: var(--ink-faint); }
.pf-position .insp-h a { color: var(--accent-ink); text-decoration: none; letter-spacing: .04em; }
.pf-position .insp-h a:hover { text-decoration: underline; }

/* The print-run control in the holding rail. Select and Save share one line —
   this is a one-decision section and a stacked button would imply a form.

   The note under it is the part that earns the section its space, so it is
   given real line-height and full-width prose rather than the 10.5px footnote
   the hints elsewhere use: on a `pooled` basis it is carrying the entire
   explanation of why a holding the reader just marked as a first edition is
   still showing the same price. `--pooled` stays muted for the reason given at
   .basis-run — a fallback on thin supply is correct behaviour, not a fault. */
.pf-run .pf-run-row { display: flex; gap: 6px; align-items: center; }
.pf-run .pf-run-row .fr-input { flex: 1; min-width: 0; }
.pf-run .pf-run-note { font-size: 11px; line-height: 1.45; margin-top: 7px; color: var(--ink-faint); }
.pf-run .pf-run-note--run { color: var(--accent-ink); }
.pf-run .pf-run-msg { font-size: 11px; margin-top: 5px; }
.pf-run .pf-run-msg:empty { display: none; }

/* ── catalogue hits ─────────────────────────────────────────────────────────
   Cards the search matched that no scraper has ever visited. Deliberately
   tiles rather than ledger rows: every market column would be an em dash, and
   a table of dashes reads as broken data instead of "not priced yet". */
.catalogue-hits {
  flex: 0 0 auto;
  border-top: 1px solid var(--rule);
  padding: 10px 12px 14px;
  background: var(--paper-lo);
}
.ch-title {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.ch-count { color: var(--ink-faint); font-weight: 400; }
.ch-note {
  margin: 2px 0 8px;
  font-size: 11px;
  color: var(--ink-faint);
}
.ch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 8px;
}
.ch-card {
  display: grid;
  grid-template-columns: 44px 1fr;
  grid-template-rows: auto auto auto;
  column-gap: 8px;
  align-items: start;
  padding: 6px;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: inherit;
  text-decoration: none;
  overflow: hidden;
}
a.ch-card:hover { border-color: var(--accent); background: var(--accent-soft); }
a.ch-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ch-art { grid-row: 1 / 4; line-height: 0; }
.ch-name {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  /* Two lines, then ellipsis: card names run long and a tile that grows with
     its title breaks the grid's rhythm. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ch-set, .ch-from { font-size: 10px; color: var(--ink-faint); }
.ch-set { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-from { color: var(--ink-soft); }


/* ── privacy policy (/privacy) ───────────────────────────────────────────
   Long-form legal prose in privacy.html. A readable measure (~72ch) and the
   paper/ink tokens, so it follows every theme like the rest of the app. */
.legal { max-width: 760px; color: var(--ink-soft); font-size: 13.5px; line-height: 1.6; }
.legal h1 { font-size: 26px; margin: 6px 0 4px; font-weight: 800; letter-spacing: -.01em; color: var(--ink); }
.legal h2 { font-size: 16px; margin: 26px 0 8px; font-weight: 700; color: var(--ink); }
.legal h3 { font-size: 13.5px; margin: 18px 0 6px; font-weight: 700; color: var(--ink); }
.legal p { margin: 0 0 10px; }
.legal ul { margin: 0 0 10px; padding-left: 20px; }
.legal li { margin-bottom: 6px; }
.legal code { font-family: var(--font-mono); font-size: 12px; }
.legal-meta { color: var(--ink-faint); font-size: 12px; }
/* Owner-removable review banner — deliberately loud so a draft is never
   mistaken for the published policy. */
.legal-draft {
  border: 1px solid var(--warn);
  background: var(--paper-hi);
  color: var(--ink);
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 4px;
  margin-bottom: 18px;
}
