/* ==========================================================================
   Design system. Everything below reads these tokens. The dither
   (dither.css and dither.js) adds texture on top; it never restyles single
   pages. Names follow dither-ui's theme where one exists.
   One face for words, mono for figures; one height for controls and one for
   table rows; one label style (small capitals) for every caption.
   1 tokens · 2 base · 3 shell · 4 components
   Markup for every rule: KIT.md.
   ========================================================================== */
:root {
  /* Surfaces: page, raised panel, recessed well, hover and selected rows. */
  --bg: #101214; --panel: #15171a; --inset: #0c0e10; --raised: #1e2125; --hover: #1d2024; --sel: #16263c;
  --line: #2b2e32; --line-2: #41454b;
  /* Ink: body, secondary, muted. */
  --text: #e4e1d8; --text-2: #c4c1b8; --dim: #9c998f;
  /* One accent, and the four status tones (text, hairline, tinted ground). */
  --accent: #5aa5f7; --accent-line: #2f6ebd; --accent-bg: #111d2e; --accent-ink: #e3efff;
  --good: #28d26e; --good-text: #8eeab4; --good-line: #1e7a45; --good-bg: #0f2417;
  --warn: #ff9632; --warn-line: #7d4a1b; --warn-bg: #27180b;
  --bad: #f25f5f; --bad-text: #ffb5ae; --bad-line: #7d2c2c; --bad-bg: #2a1313;
  --info-text: #a9cdfb; --info-bg: #101c2c;
  --violet-text: #c9b8ff; --violet-line: #4b3c8c;
  --chip-bg: #202327;
  /* Money and item rarity: the game's own colours, the same in every look. */
  --gold: #e8c547; --silver: #c0c6cf; --copper: #c7834a;
  --q0: #9d9d9d; --q1: #ffffff; --q2: #1eff00; --q3: #4a9dff; --q4: #c06cff; --q5: #ff8000;
  /* Type: one readable face for words and titles; figures are set in mono so columns line up. */
  --font-ui: "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
  --font-display: var(--font-ui);
  --font-num: var(--font-mono);
  --fs-1: 10px; --fs-2: 11px; --fs-3: 12px; --fs-4: 13px; --fs-5: 14px; --fs-6: 16px; --fs-7: 20px;
  --track: .04em;
  /* Space on a 4px grid (2px for hairline nudges). */
  --s1: 2px; --s2: 4px; --s3: 6px; --s4: 8px; --s5: 12px; --s6: 16px; --s7: 24px;
  /* Shape. */
  --r-sm: 0px; --r: 0px; --r-lg: 0px; --r-pill: 0px;
  /* Controls and table rows: one height each. */
  --ctl: 26px; --ctl-sm: 22px; --row: 26px; --row-head: 28px;
  --shadow: 0 8px 24px #000b;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
  /* The sidebar's width. Measured by the page: the top bar's height (popovers hang under it) and a fixed footer bar's height. */
  --side: 236px; --head: 52px; --foot: 0px;
  /* The game's class colours (the kit's one addition to the source tokens). */
  --cls-warrior: #c69b6d; --cls-paladin: #f48cba; --cls-hunter: #aad372; --cls-rogue: #fff468; --cls-priest: #ffffff;
  --cls-shaman: #0070dd; --cls-mage: #3fc7eb; --cls-warlock: #8788ee; --cls-druid: #ff7c0a;
}

/* ---- 2 base ---- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: var(--fs-4)/1.35 var(--font-ui); overflow: hidden; -webkit-text-size-adjust: 100%;
       display: grid; grid-template-columns: var(--side) minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); grid-template-areas: "side top" "side alerts" "side view"; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--font-display); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.spacer { flex: 1; }
/* Captions: the one small-capitals label (sidebar groups, popover sections). */
.nav-h, .pop h3 { color: var(--dim); font: 600 var(--fs-1)/1.2 var(--font-ui); letter-spacing: .08em; text-transform: uppercase; }
[hidden] { display: none !important; }

/* Money: gold, silver and copper keep their colours and never wrap or jitter in a column. */
.money { white-space: nowrap; font-variant-numeric: tabular-nums; }
.g { color: var(--gold); } .s { color: var(--silver); } .c { color: var(--copper); }
.q0 { color: var(--q0); } .q1 { color: var(--q1); } .q2 { color: var(--q2); } .q3 { color: var(--q3); } .q4 { color: var(--q4); } .q5 { color: var(--q5); }
.cls-warrior { color: var(--cls-warrior); } .cls-paladin { color: var(--cls-paladin); } .cls-hunter { color: var(--cls-hunter); }
.cls-rogue { color: var(--cls-rogue); } .cls-priest { color: var(--cls-priest); } .cls-shaman { color: var(--cls-shaman); }
.cls-mage { color: var(--cls-mage); } .cls-warlock { color: var(--cls-warlock); } .cls-druid { color: var(--cls-druid); }
.profit { color: var(--good); } .neg { color: var(--bad); }
.pc-up { color: var(--good); } .pc-dn { color: var(--bad); }
.rate-hi { color: var(--good); } .rate-lo { color: var(--bad); }
.note { color: var(--dim); font-size: var(--fs-2); }
.note.warn { color: var(--warn); }
.id { color: var(--dim); font-size: var(--fs-1); margin-left: var(--s2); }

/* ---- 3 shell: sidebar (identity, status, pages, data) · top bar (the open page, the account) · alerts · the open page ---- */
#side { grid-area: side; display: flex; flex-direction: column; min-height: 0; overflow-y: auto; overscroll-behavior: contain; background: var(--inset); border-right: 1px solid var(--line); font-size: var(--fs-3); }
/* The brand is not a heading: a page's own title is its one h1. */
.sd-brand { flex: none; display: flex; align-items: center; min-height: var(--head); padding: 0 var(--s5); border-bottom: 1px solid var(--line); }
#side .sd-name { display: inline-flex; align-items: center; gap: var(--s4); margin: 0; font: 600 var(--fs-4)/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; cursor: pointer; }
.sd-block { flex: none; display: flex; flex-direction: column; gap: var(--s2); padding: var(--s4) var(--s5) var(--s5); border-bottom: 1px solid var(--line); }
.stat { color: var(--dim); }
.stat b { color: var(--text); font-weight: 600; }
#side .stat { display: flex; align-items: center; gap: var(--s3); min-width: 0; white-space: nowrap; }
#dot { flex: none; width: 8px; height: 8px; background: var(--good); }
#dot:not(.on) { background: var(--bad); }
/* Pages, in groups. The open one carries the marker. */
.tabs { flex: none; display: flex; flex-direction: column; padding: var(--s4) var(--s3); }
.nav-h { display: block; margin: 5px var(--s4) var(--s1); }
.tab { flex: none; display: flex; align-items: center; height: 23px; padding: 0 var(--s4); background: none; border: 0; border-left: 2px solid transparent; border-radius: 0; color: var(--text-2);
       font: inherit; font-size: var(--fs-4); text-align: left; white-space: nowrap; cursor: pointer; text-decoration: none; }
.tab:hover { color: var(--text); background: var(--hover); }
.tab.on { color: var(--text); font-weight: 600; background: var(--raised); border-left-color: var(--accent); }
/* Data: where the figures come from and how old each source is, one line each. */
.sd-data { flex: none; margin-top: auto; display: flex; flex-direction: column; gap: var(--s1); padding: 0 var(--s5) var(--s5); border-top: 1px solid var(--line); }
.sd-data .nav-h { margin-left: 0; margin-right: 0; }
.sd-data .stat { justify-content: space-between; min-height: 20px; }
.sd-data .stat > b { min-width: 0; overflow: hidden; text-overflow: ellipsis; text-align: right; font: 400 var(--fs-2)/1.3 var(--font-num); font-variant-numeric: tabular-nums; }
.sd-data select { flex: 1 1 0; min-width: 0; height: var(--ctl-sm); margin: 1px 0; font-size: var(--fs-2); }
.sd-data label { display: inline-flex; align-items: center; gap: var(--s3); }

/* Top bar: the open page and what it is for, then the account, then help. */
#hdr { grid-area: top; position: relative; z-index: 7; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s5); min-height: 44px; padding: var(--s3) var(--s5);
       background: var(--inset); border-bottom: 1px solid var(--line); }
.hd-page { flex: 1 1 200px; min-width: 0; display: flex; align-items: baseline; gap: var(--s5); }
#pageTitle { flex: none; margin: 0; font: 600 var(--fs-6)/1.2 var(--font-display); white-space: nowrap; }
#pageSub { flex: 1 1 0; min-width: 0; margin: 0; color: var(--dim); font-size: var(--fs-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-group { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s4); }
.hd-group + .hd-group { padding-left: var(--s5); border-left: 1px solid var(--line); }
#hdr .stat { display: inline-flex; align-items: center; gap: var(--s3); white-space: nowrap; font-size: var(--fs-3); }
#navToggle { display: none; margin-right: auto; }

/* Alerts sit in the page flow under the top bar: they push content down, they never cover it. */
#alerts { grid-area: alerts; display: flex; flex-direction: column; gap: var(--s2); padding: var(--s5) var(--s5) 0; }
#alerts:not(:has(> :not(:empty))) { display: none; }
.alert:empty { display: none; }
.alert { position: relative; display: block; padding: var(--s3) 34px var(--s3) var(--s5); border: 1px solid var(--line-2); border-left-width: 3px; border-radius: var(--r);
          background: var(--raised); color: var(--text); font-size: var(--fs-3); line-height: 1.4; }
/* The source's three toned notices (#error, #scanNotes, #houseNote) as tones of .alert. */
.alert.bad { border-color: var(--bad-line); background: var(--bad-bg); color: var(--bad-text); }
.alert.warn { border-color: var(--warn-line); background: var(--warn-bg); color: var(--warn); }
.alert.info { border-color: var(--accent-line); background: var(--info-bg); color: var(--info-text); }
.alert div + div { margin-top: 2px; }
.alert .close { position: absolute; top: 3px; right: 4px; }

/* The open page: a filter bar, then panels, 12px apart. main.view is a 2 by 2 grid of panels;
   main.view.flow is one scrolling column (the source's full-page views). */
main { padding: var(--s5); display: grid; gap: var(--s5); grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
main.view { grid-area: view; display: none; min-height: 0; min-width: 0; }
main.view.on { display: grid; }
/* A flowing page is as tall as its content: every block keeps its own height (rows are sized
   to their content, never squeezed into the window) and the page scrolls. */
main.view.flow.on { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-auto-rows: max-content; align-content: start; overflow: auto; }
main.view.flow .panel { max-height: none; }
main.view.flow .scroll { overflow-x: auto; }
@media (max-width: 1100px) {
  body { display: block; overflow: auto; }
  #hdr { position: sticky; top: 0; }
  main { height: auto; grid-template-columns: minmax(0, 1fr); grid-template-rows: none; }
  .panel { max-height: 70vh; }
  /* The sidebar becomes a drawer behind one button that names the open page. */
  #navToggle { display: inline-flex; }
  .hd-page { display: none; }
  #side { display: none; position: fixed; inset: 0 auto 0 0; z-index: 30; width: min(300px, 88vw); box-shadow: 0 0 0 100vmax #000a; }
  #side:has(#nav.open) { display: flex; }
  .sd-brand { min-height: 44px; }
  .tab { height: 32px; }
  .hd-group + .hd-group { padding-left: 0; border-left: 0; }
}
@media (max-width: 700px) {
  /* Not sticky here, but still the positioning box for the dithered band on its lower edge (#dzField). */
  #hdr { position: relative; top: auto; gap: var(--s3) var(--s4); padding: var(--s3) var(--s4); }
  main { padding: var(--s4); gap: var(--s4); }
  #alerts { padding: var(--s4) var(--s4) 0; }
}

/* ---- 4 components ---- */
/* Buttons: .btn (default), .cta (the one primary action), .hbtn (quiet), .x (icon), .mini / .big sizes. */
.btn, .cta, .hbtn, .csubs button { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); height: var(--ctl); padding: 0 10px; border: 1px solid var(--line);
       border-radius: var(--r); background: none; color: var(--dim); font: inherit; font-size: var(--fs-3); line-height: 1; white-space: nowrap; cursor: pointer; text-decoration: none; }
.btn { background: var(--accent-bg); border-color: var(--accent-line); color: var(--accent-ink); }
.btn:hover { background: color-mix(in srgb, var(--accent-bg) 82%, var(--accent)); text-decoration: none; }
.btn.dim { opacity: .55; }
.btn.mini { height: var(--ctl-sm); padding: 0 var(--s4); font-size: var(--fs-2); margin-right: var(--s3); text-transform: none; letter-spacing: 0; font-weight: 400; }
.btn.big { height: 30px; padding: 0 var(--s6); font-weight: 600; font-size: var(--fs-4); }
.cta { background: var(--good-bg); border-color: var(--good); color: #eafff1; font-weight: 600; }
.cta:hover, .cta.on { background: color-mix(in srgb, var(--good-bg) 80%, var(--good)); text-decoration: none; }
.hbtn:hover, .hbtn.on { color: var(--text); border-color: var(--accent); text-decoration: none; }
button:disabled, .btn:disabled { opacity: .45; cursor: default; }
button.x, .close { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 var(--s2); background: none; border: 1px solid transparent;
            border-radius: var(--r-sm); color: var(--dim); cursor: pointer; font: inherit; font-size: var(--fs-2); line-height: 1; }
button.x:hover { border-color: var(--line); color: var(--bad); }
.close:hover { border-color: var(--line-2); color: var(--text); }
/* The help mark: a span, so the name "info" on anything else (an .alert's tone, a page's own class) is untouched. */
span.info { cursor: help; color: var(--dim); border: 1px solid var(--line); width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; font-size: var(--fs-2); }

/* Fields. */
input[type=text], input[type=search], input[type=number], input[type=email], input[type=password], select, textarea { height: var(--ctl); padding: 0 var(--s3); background: var(--inset); color: var(--text); border: 1px solid var(--line-2);
       border-radius: var(--r); font: inherit; font-size: var(--fs-3); min-width: 0; }
select { padding-right: 2px; max-width: 100%; cursor: pointer; }
textarea { height: auto; padding: var(--s2) var(--s3); line-height: 1.4; }
input[type=text] { width: 80px; }
input[type=search] { width: 180px; }
input[type=number] { width: 64px; }
input:hover, select:hover, textarea:hover { border-color: var(--dim); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--dim); opacity: .85; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 14px; height: 14px; margin: 0; flex: none; }
label { cursor: default; }
label:has(> input[type=checkbox]) { cursor: pointer; }
select.charsel { max-width: 220px; }
textarea.list { width: 100%; height: 48px; font: var(--fs-2) var(--font-mono); }

/* Segmented choice: sub-views, a two- or three-way switch. */
.csubs { display: inline-flex; flex-wrap: wrap; gap: 0; }
.csubs button { border-radius: 0; margin-left: -1px; }
.csubs button:first-child { border-radius: var(--r) 0 0 var(--r); margin-left: 0; }
.csubs button:last-child { border-radius: 0 var(--r) var(--r) 0; }
.csubs button:only-child { border-radius: var(--r); }
.csubs button:hover { color: var(--text); }
.csubs button.on { color: var(--text); border-color: var(--accent); background: var(--accent-bg); position: relative; z-index: 1; font-weight: 600; }

/* Sub-tabs: a row of a page's own views, the open one underlined (the source's Farming tab row). */
.fsubs { display: flex; gap: 2px; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.fsub { flex: none; white-space: nowrap; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--dim); padding: 6px 12px 5px; cursor: pointer; font: inherit; font-size: 13px; }
.fsub:hover { color: var(--text); }
.fsub.on { color: var(--text); border-bottom-color: var(--accent); }
/* A page, sub-tab or button written as a link is not underlined on hover. */
a.tab:hover, a.fsub:hover, a.btn:hover, a.cta:hover, a.hbtn:hover { text-decoration: none; }

/* Badges: a hairline and a tint. Tone classes are shared with plain text (.warn, .ok). */
.badge, .exit { display: inline-flex; align-items: center; height: 15px; padding: 0 var(--s2); margin-left: var(--s2); border: 1px solid var(--line); border-radius: var(--r-sm);
         font: 500 var(--fs-1)/1 var(--font-ui); letter-spacing: .01em; white-space: nowrap; vertical-align: 1px; color: var(--dim); }
.exit { margin-left: 0; text-transform: uppercase; letter-spacing: .04em; }
.warn { border: 1px solid var(--warn-line); color: var(--warn); }
.ok { border: 1px solid var(--good-line); color: var(--good); }
.new { border: 1px solid var(--line); color: var(--dim); }
.plan { border: 1px solid var(--accent-line); color: var(--info-text); }
.intel { border: 1px solid var(--violet-line); color: var(--violet-text); }
.badge.warn { background: color-mix(in srgb, var(--warn-bg) 70%, transparent); }
.badge.ok { background: color-mix(in srgb, var(--good-bg) 60%, transparent); }
.badge.gone { border-color: var(--bad-line); color: var(--bad-text); background: color-mix(in srgb, var(--bad-bg) 60%, transparent); }
.badge.quiet { border-style: dashed; border-color: var(--line-2); color: var(--dim); cursor: help; }
td .badge:first-child, td.item > .badge:first-child { margin-left: 0; }
/* Chips: a row of small facts, each a label and its figure in bold. */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 4px; }
.chip { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 3px 10px; font-size: 12px; color: var(--dim); }
.chip b { color: var(--text); }
.kpi { display: inline-block; margin-right: var(--s6); color: var(--dim); }
.kpi b { color: var(--text); font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.kpi.warn { border: 0; color: var(--warn); } .kpi.warn b { color: var(--warn); }
/* Stat cards: a figure under its label, then what explains it: a note, a meter, a sparkline. */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s4); min-width: 0; }
.stat-c { min-width: 0; display: flex; flex-direction: column; gap: 3px; padding: var(--s4) var(--s5) var(--s4); background: var(--inset); border: 1px solid var(--line); }
.stat-c .k { color: var(--dim); font: 600 var(--fs-1)/1.3 var(--font-ui); letter-spacing: .08em; text-transform: uppercase; }
.stat-c .v { font: 600 var(--fs-6)/1.25 var(--font-num); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-c .n { color: var(--dim); font-size: var(--fs-2); line-height: 1.4; }
.stat-c .n b { color: var(--text-2); font-family: var(--font-num); font-weight: 400; }
.stat-c .meter { margin: 3px 0 2px; }
.stat-c.warn { border-color: var(--warn-line); } .stat-c.warn .k, .stat-c.warn .v { color: var(--warn); }
.stat-c.wide { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: var(--s2) var(--s5); }
.stat-c.wide .n { font-size: var(--fs-3); color: var(--text-2); }
.stats > .note { grid-column: 1 / -1; margin: 0 !important; }
.bar > .stats { flex: 1 1 100%; }
/* A meter: how far along, as a bar. --v is 0 to 1. */
.meter { display: block; position: relative; height: 6px; background: var(--line); overflow: hidden; }
.meter > i { display: block; height: 100%; width: calc(var(--v, 0) * 100%); background: var(--good); }
.meter > canvas { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
/* A change since last time: an arrow and the size of the move, in a hairline box. */
.dl { display: inline-block; padding: 0 4px; border: 1px solid var(--line-2); color: var(--dim); font: var(--fs-2)/1.45 var(--font-num); font-variant-numeric: tabular-nums; white-space: nowrap; vertical-align: 1px; }
.dl.up { color: var(--good); border-color: var(--good-line); } .dl.dn { color: var(--bad); border-color: var(--bad-line); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Panels: a framed region with a title bar; .scroll is its body. */
.panel { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
.panel > h2 { flex: none; display: flex; align-items: center; gap: var(--s5); min-height: 34px; margin: 0; padding: var(--s1) var(--s5); border-bottom: 1px solid var(--line);
            font: 600 var(--fs-4)/1.2 var(--font-display); color: var(--text); white-space: nowrap; }
.panel > h2 .sub { flex: 1 1 0; min-width: 0; color: var(--dim); font: 400 var(--fs-3)/1.3 var(--font-ui); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel > h2 .count { display: inline-flex; align-items: center; gap: var(--s2); flex: none; margin-left: auto; color: var(--dim); font: 400 var(--fs-3)/1 var(--font-num); font-variant-numeric: tabular-nums; }
.panel > h2 .note { white-space: normal; font-weight: 400; }
.panel > h2 .count .btn { font-family: var(--font-ui); margin-right: var(--s2); }
/* Fine print: a paragraph that explains a panel shows its first line; body.notes-open shows
   them all in full. A paragraph marked .warn is never folded. */
:is(.panel > p.note, .panel > .scroll > p.note):not(.warn) { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; overflow: hidden; cursor: pointer; }
.panel > p.note, .panel > .scroll > p.note { margin: var(--s3) var(--s5); line-height: 1.45; }
body.notes-open :is(.panel > p.note, .panel > .scroll > p.note) { display: block; overflow: visible; }
@media (max-width: 700px) {
  .panel > h2 { flex-wrap: wrap; white-space: normal; row-gap: var(--s1); }
  .panel > h2 .sub { flex: 1 1 100%; white-space: normal; }
  .panel > h2 .count { flex-wrap: wrap; margin-left: 0; max-width: 100%; }
}
.scroll { flex: 1; overflow: auto; min-height: 0; }
.flash { animation: flash 1.6s ease-out; }
@keyframes flash { from { background: var(--sel); } to { background: var(--panel); } }
@media (prefers-reduced-motion: reduce) { .flash { animation: none; } }

/* Cards: free-standing surfaces. Same frame as a panel, roomier inside. */
.card { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s5) var(--s5); }
.card h3 { margin: 0; font-size: var(--fs-5); font-weight: 600; line-height: 1.25; }
.card.rec { border-color: var(--good-line); }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 900px) { .cards { grid-template-columns: 1fr; } }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* A page of text: its heading (the page's one h1) with the kit's art beside it, a lead line, then sections (h2,
   and h3 inside them, both in the sections' size). */
.sp { max-width: 1060px; margin: 0 auto; }
.sp h1 { font-size: 22px; margin: 0 0 4px; }
.sp h2, .sp h3 { font-size: 15px; margin: 22px 0 8px; }
.sp p, .sp li { color: var(--text-2); line-height: 1.5; }
.sp .lead { font-size: 14px; color: var(--dim); margin: 0 0 14px; }
.sp .card :is(h2, h3) { margin-top: 0; }

/* Toolbars: a page's own filters. Controls wrap; they never scroll out of reach. */
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s5); }
.bar { padding: var(--s4) var(--s5); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); font-size: var(--fs-3); }
.bar label { color: var(--dim); display: inline-flex; gap: var(--s2); align-items: center; white-space: nowrap; }
.bar > b { font: 600 var(--fs-4)/1 var(--font-display); }
.bar .note { white-space: normal; }
.bar > .note { flex: 1 1 280px; min-width: 0; margin-left: auto; text-align: right; }
.bar > .note:not(:has(*)) { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.bar > .note:has(div, p, button, br) { flex: 1 1 100%; margin-left: 0; text-align: left; }
.bar > .note:empty { display: none; }
/* "How this works": the long explanation of a page, one click away instead of always on screen. */
details.about { margin-left: auto; font-size: var(--fs-2); color: var(--dim); }
details.about > summary { display: inline-flex; align-items: center; height: var(--ctl-sm); padding: 0 var(--s4); border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; list-style: none; white-space: nowrap; user-select: none; }
details.about > summary::-webkit-details-marker { display: none; }
details.about > summary::before { content: '?'; display: inline-flex; align-items: center; justify-content: center; width: 12px; margin-right: var(--s2); font-weight: 700; color: var(--accent); }
details.about > summary:hover, details.about[open] > summary { color: var(--text); border-color: var(--accent); }
details.about[open] { flex-basis: 100%; margin-left: 0; }
details.about > div, details.about > p { margin: var(--s3) 0 var(--s1); max-width: 150ch; color: var(--text-2); font-size: var(--fs-3); line-height: 1.5; white-space: normal; }
details.about b { color: var(--text); }
.bar .note + details.about { margin-left: 0; }

/* Tables: 26px rows, figures right-aligned in tabular numerals, names first. The outer cells line up with the panel's title. */
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-3); font-variant-numeric: tabular-nums; }
th, td { height: var(--row); padding: 0 var(--s4); border-bottom: 1px solid var(--line); white-space: nowrap; text-align: left; }
thead th { position: sticky; top: 0; z-index: 1; height: var(--row-head); background: var(--panel); color: var(--dim); font: 600 var(--fs-1)/1.1 var(--font-display); letter-spacing: .05em;
           text-transform: uppercase; cursor: pointer; user-select: none; box-shadow: inset 0 -1px 0 var(--line-2); border-bottom: 0; }
thead th:hover { color: var(--text); }
thead th.sort-down::after { content: ' \25BC'; color: var(--accent); }
thead th.sort-up::after { content: ' \25B2'; color: var(--accent); }
/* (Any .scroll inside a panel: its direct child, or one a level deeper, in a block of the panel's body.) */
.panel .scroll > table > * > tr > :first-child { padding-left: var(--s5); }
.panel .scroll > table > * > tr > :last-child { padding-right: var(--s5); }
td.num, th.num { text-align: right; }
td.num { font-family: var(--font-num); font-size: var(--fs-2); }
/* A badge in a figure column is written before the figure, so the figures still line up. */
td.num > .badge { margin: 0 var(--s3) 0 0; }
td.item { min-width: 150px; max-width: 360px; overflow: hidden; text-overflow: ellipsis; }
td.bad { color: var(--bad); } td.step { color: var(--dim); }
tbody tr:hover > td { background: var(--hover); }
tbody tr.click { cursor: pointer; }
tr.sel > td { background: var(--sel) !important; }
tr.poor > td { opacity: .45; }
tr.reason td { color: var(--dim); font-size: var(--fs-2); white-space: normal; height: auto; padding-bottom: var(--s2); }
tr.main.has-reason td { border-bottom: none; }
/* Wide tables keep their columns: the panel scrolls sideways and the name column stays put. */
table.t-fix { table-layout: fixed; }
table.t-fix td.item { max-width: none; }
table.t-pin th:first-child, table.t-pin td:first-child { position: sticky; left: 0; z-index: 1; background: var(--panel); }
table.t-pin thead th:first-child { z-index: 3; }
table.t-pin td:first-child, table.t-pin th:first-child { box-shadow: inset -1px 0 0 var(--line); }
table.t-pin thead th:first-child { box-shadow: inset -1px 0 0 var(--line), inset 0 -1px 0 var(--line-2); }
@media (max-width: 700px) { table.t-pin th:first-child, table.t-pin td:first-child { position: static; } }
table.t-pin tbody tr:hover > td:first-child { background: var(--hover); }
ol.steps { margin: 2px 0 0 18px; padding: 0; } ol.steps li { margin: 1px 0; }

/* Empty states say what is missing in one centred line; they never fake a table. */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s2); min-height: 72px; padding: var(--s6) var(--s5); color: var(--dim); font-size: var(--fs-3); text-align: center; line-height: 1.5; }
.empty::before { content: ''; width: 28px; height: 4px; border-radius: 2px; background: var(--line-2); opacity: .8; }

/* Popovers hang under the header and stop above a footer bar. */
.pop { display: none; position: fixed; right: var(--s4); top: calc(var(--head) + var(--s2)); z-index: 8; width: min(760px, calc(100vw - 16px)); max-height: calc(100vh - var(--head) - var(--foot) - 16px);
       overflow: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: var(--s3); }
.pop.open { display: block; }
.pop h3 { margin: var(--s4) var(--s2) var(--s2); }
.pop .note { white-space: normal; }
/* A popover used as a menu: .pop.menu is the narrower width, .item one row of it. */
.pop.menu { width: min(520px, calc(100vw - 16px)); }
.pop .item { display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--text); padding: var(--s3) var(--s4); font: inherit; cursor: pointer; border-radius: var(--r-sm); text-decoration: none; }
.pop .item:hover { background: var(--accent-bg); }
.pop .item.on::after { content: ' (on)'; color: var(--good); }
.pop pre { white-space: pre-wrap; font: var(--fs-3)/1.45 var(--font-ui); color: var(--dim); margin: var(--s3) var(--s4); }

/* Tooltip: one styled bubble for every title, readable at length and reachable by keyboard. */
#uiTip { display: none; position: fixed; z-index: 10001; max-width: min(440px, calc(100vw - 16px)); padding: var(--s3) var(--s4); background: var(--inset); color: var(--text); border: 1px solid var(--line-2);
         border-radius: var(--r); box-shadow: var(--shadow); font: var(--fs-3)/1.45 var(--font-ui); white-space: pre-line; overflow-wrap: anywhere; pointer-events: none; }
#uiTip.on { display: block; }

/* Dialog: .modal is the dimmed page, the .card inside it is the dialog (the source's wizard card). */
.modal { display: none; position: fixed; inset: 0; z-index: 20; background: #000a; align-items: center; justify-content: center; padding: var(--s4); }
.modal.open { display: flex; }
.modal > .card { width: min(620px, 94vw); max-height: 88vh; overflow: auto; box-shadow: 0 10px 40px #000a; padding: 18px 20px; }
.modal > .card h2 { margin: 0 0 4px; font-size: 16px; }
.modal > .card p { color: var(--text); margin: 8px 0; line-height: 1.45; }
.modal > .card .step { color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.modal > .card .q { margin: 12px 0; }
.modal > .card .q > label { display: block; color: var(--text); margin-bottom: 4px; font-weight: 600; }
.modal > .card .q .help { color: var(--dim); font-size: 11px; margin-top: 3px; }
.modal > .card .err { color: var(--bad); min-height: 16px; font-size: 12px; }
.modal > .card .nav { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; align-items: center; }
.modal > .card .nav .skip { margin-right: auto; background: none; border: none; color: var(--dim); cursor: pointer; font: inherit; }

/* Consent bar: fixed to the window's foot, the brand's gold rule on top, until a choice is made.
   The page sets --foot to its height and body.has-foot keeps that much free, so it never covers content:
   the body's padding where the view scrolls inside the grid, the open view's padding where the document
   scrolls (≤1100px: the body's own box ends at the window there, so its padding would not). */
.consent { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--s4) var(--s7);
           padding: var(--s5) var(--s6); background: var(--inset); border-top: 2px solid var(--gold); box-shadow: 0 -8px 24px #0009; }
.consent p { flex: 0 1 auto; margin: 0; max-width: 64ch; color: var(--text); font-size: var(--fs-5); line-height: 1.45; }
.consent p a { color: var(--info-text); text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; }
.consent .acts { display: flex; gap: var(--s4); }
.consent .acts .cta, .consent .acts .btn { height: 38px; padding: 0 var(--s7); font-size: var(--fs-5); }
.consent .acts .cta { min-width: 132px; }
body.has-foot { padding-bottom: var(--foot); }
@media (max-width: 1100px) {
  body.has-foot { padding-bottom: 0; }
  body.has-foot main.view.on { padding-bottom: calc(var(--s5) + var(--foot)); }
}
@media (max-width: 700px) {
  .consent { justify-content: stretch; padding: var(--s5) var(--s4) calc(var(--s5) + env(safe-area-inset-bottom, 0px)); }
  .consent .acts { flex: 1 1 100%; }
  .consent .acts .cta { flex: 2 1 0; } .consent .acts .btn { flex: 1 1 0; }
}

/* Disclosure rows used inside panels. */
details > summary { cursor: pointer; }
.setup { padding: var(--s5) 14px; line-height: 1.6; color: var(--text); }
.setup code { background: var(--chip-bg); padding: 0 var(--s2); border-radius: var(--r-sm); }
details.setup { padding: var(--s3) var(--s5); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); font-size: var(--fs-3); }
details.setup > summary { color: var(--text-2); }
details.setup > p { margin: var(--s3) 0 0; max-width: 150ch; color: var(--text-2); }
