/* SAMSAARA_MFB design system — see docs/UI_STYLE.md.
   Plain CSS, light (warm paper tones) + dark, switchable from the top bar, mobile first (375px), no external fonts. */

/* ------------------------------------------------------------------ tokens */
:root {
  /* colour — light */
  --bg: #f4f2ec;          /* page */
  --panel: #fbfaf7;       /* cards, menus */
  --panel-2: #f1eee6;     /* quiet fills inside cards */
  --ink: #14171d;         /* primary text */
  --ink-2: #2e333c;       /* secondary text */
  --muted: #62656e;       /* labels, meta */
  --faint: #9a9c9f;       /* placeholders, dividers text */
  --line: #e3dfd4;        /* hairlines */
  --line-2: #d3cec1;      /* input borders */
  --accent: #2c5d8f;      /* links, primary buttons */
  --accent-ink: #ffffff;
  --accent-soft: #e3eaf2;
  --ok: #1f7a4d;   --ok-soft: #e3f3ea;
  --warn: #8f6200; --warn-soft: #fbf0d6;
  --bad: #b3261e;  --bad-soft: #fbe6e3;
  --info: #5b4b9a; --info-soft: #eeeaf8;
  --mark: #fff0a8;
  --chip: #ece9df;
  --focus: #2c5d8f55;
  /* status pills */
  --st-universe-bg: #e9e6dc; --st-universe-fg: #5f646b;
  --st-triage-bg: #fbf0d6;   --st-triage-fg: #7a5600;
  --st-research-bg: #e2edf9; --st-research-fg: #1d4f86;
  --st-own-bg: #ddf1e5;      --st-own-fg: #17613b;
  --st-monitor-bg: #ece6f8;  --st-monitor-fg: #54408a;
  --st-pass-bg: #f7e3e0;     --st-pass-fg: #8a2e25;
  /* type */
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs-xs: 0.75rem;   /* 12 */
  --fs-sm: 0.8125rem; /* 13 */
  --fs-md: 0.9375rem; /* 15 body */
  --fs-lg: 1.0625rem; /* 17 section titles */
  --fs-xl: 1.375rem;  /* 22 page titles (mobile) */
  --fs-2xl: 1.75rem;  /* 28 page titles (desktop) */
  /* space */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  /* shape */
  --radius: 12px; --radius-sm: 8px; --radius-pill: 999px;
  --shadow: 0 1px 2px rgba(20, 22, 26, 0.04), 0 1px 1px rgba(20, 22, 26, 0.02);
  --shadow-pop: 0 10px 30px rgba(20, 22, 26, 0.12), 0 2px 6px rgba(20, 22, 26, 0.06);
  --maxw: 1080px;
  color-scheme: light dark;
}
/* Theme: follows the system until a choice is made with the switch in the top bar
   (stored as data-theme="light|dark" on <html>). */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111316; --panel: #181b1f; --panel-2: #1d2025; --ink: #e8e9eb; --ink-2: #c9ccd1; --muted: #9aa0a8;
  --faint: #6d737b; --line: #262a30; --line-2: #343941; --accent: #86b1e3; --accent-ink: #0d1117;
  --accent-soft: #1c2a3a; --ok: #6cc596; --ok-soft: #16301f; --warn: #e2b451; --warn-soft: #33290f;
  --bad: #f0877d; --bad-soft: #3a1c19; --info: #b3a3ec; --info-soft: #2a2442; --mark: #5a4e12; --chip: #23272d;
  --focus: #86b1e366;
  --st-universe-bg: #23272d; --st-universe-fg: #a3a9b1;
  --st-triage-bg: #3a2f0e;   --st-triage-fg: #f0cf7c;
  --st-research-bg: #15304d; --st-research-fg: #a5cbf3;
  --st-own-bg: #133522;      --st-own-fg: #92dcb1;
  --st-monitor-bg: #2b2244;  --st-monitor-fg: #cdb9f3;
  --st-pass-bg: #3f1f1b;     --st-pass-fg: #f1a79f;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-pop: 0 12px 32px rgba(0, 0, 0, 0.5);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111316; --panel: #181b1f; --panel-2: #1d2025; --ink: #e8e9eb; --ink-2: #c9ccd1; --muted: #9aa0a8;
    --faint: #6d737b; --line: #262a30; --line-2: #343941; --accent: #86b1e3; --accent-ink: #0d1117;
    --accent-soft: #1c2a3a; --ok: #6cc596; --ok-soft: #16301f; --warn: #e2b451; --warn-soft: #33290f;
    --bad: #f0877d; --bad-soft: #3a1c19; --info: #b3a3ec; --info-soft: #2a2442; --mark: #5a4e12; --chip: #23272d;
    --focus: #86b1e366;
    --st-universe-bg: #23272d; --st-universe-fg: #a3a9b1;
    --st-triage-bg: #3a2f0e;   --st-triage-fg: #f0cf7c;
    --st-research-bg: #15304d; --st-research-fg: #a5cbf3;
    --st-own-bg: #133522;      --st-own-fg: #92dcb1;
    --st-monitor-bg: #2b2244;  --st-monitor-fg: #cdb9f3;
    --st-pass-bg: #3f1f1b;     --st-pass-fg: #f1a79f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-pop: 0 12px 32px rgba(0, 0, 0, 0.5);
  }
}

/* ------------------------------------------------------------------ base */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--ink); font: var(--fs-md)/1.55 var(--font);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
mark { background: var(--mark); color: inherit; padding: 0 2px; border-radius: 2px; }
code, .mono { font-family: var(--mono); font-size: 0.86em; }
h1, h2, h3 { color: var(--ink); line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: var(--fs-xl); font-weight: 650; margin: 0 0 var(--s2); }
h2 { font-size: var(--fs-lg); font-weight: 620; margin: var(--s6) 0 var(--s3); }
h3 { font-size: var(--fs-md); font-weight: 600; margin: var(--s4) 0 var(--s2); }
p { margin: 0 0 var(--s3); }
ul, ol { padding-left: 1.2em; margin: 0 0 var(--s3); }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s5) 0; }
q { quotes: "“" "”"; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: var(--fs-sm); }
.xs { font-size: var(--fs-xs); }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tnum { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------------ top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--panel) 92%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: var(--maxw); margin: 0 auto; display: flex; align-items: center; gap: var(--s3);
  padding: 10px var(--s4); flex-wrap: wrap; }
.wordmark { font-weight: 700; letter-spacing: -0.01em; color: var(--ink); font-size: 1.05rem; flex: none; }
.wordmark:hover { text-decoration: none; }
.gsearch { position: relative; flex: 1 1 220px; min-width: 0; order: 3; width: 100%; }
.gsearch input { width: 100%; padding: 9px 12px 9px 34px; border: 1px solid var(--line-2); border-radius: var(--radius-pill);
  background: var(--panel-2) no-repeat 12px 50%/15px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa0a7' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  color: var(--ink); font-size: 16px; }
.gsearch input:focus { background-color: var(--panel); border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--focus); }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-pop); display: none; max-height: 60vh; overflow: auto; z-index: 30; }
.suggest:not(:empty) { display: block; }
.suggest a { display: block; padding: 9px 14px; color: var(--ink); border-bottom: 1px solid var(--line); }
.suggest a:last-child { border-bottom: 0; }
.suggest a:hover, .suggest a:focus { background: var(--chip); text-decoration: none; }

.nav { display: none; align-items: center; gap: 2px; }
.nav > a, .nav-more > summary { padding: 6px 10px; border-radius: var(--radius-sm); color: var(--ink-2); white-space: nowrap;
  font-size: var(--fs-sm); font-weight: 500; }
.nav > a:hover, .nav-more > summary:hover { background: var(--chip); color: var(--ink); text-decoration: none; }
.nav > a.on, .nav-more.on > summary { color: var(--ink); background: var(--chip); }
details.nav-more, details.nav-mobile { position: relative; }
details.nav-more > summary, details.nav-mobile > summary { list-style: none; cursor: pointer; user-select: none; }
details.nav-more > summary::-webkit-details-marker, details.nav-mobile > summary::-webkit-details-marker { display: none; }
.nav-more > summary::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 6px; vertical-align: 2px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); opacity: .6; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-pop); padding: var(--s3); z-index: 40;
  display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr)); gap: var(--s2) var(--s4); min-width: 520px; }
.menu-group { display: flex; flex-direction: column; min-width: 0; }
.menu-title { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em;
  padding: 6px 8px 4px; }
.menu a { padding: 6px 8px; border-radius: var(--radius-sm); color: var(--ink); font-size: var(--fs-sm); }
.menu a:hover { background: var(--chip); text-decoration: none; }
.menu a.on { background: var(--accent-soft); color: var(--accent); }
.topbar-inner { position: relative; }
details.nav-mobile { margin-left: auto; order: 2; position: static; }
.nav-mobile > summary { padding: 7px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-pill); font-size: var(--fs-sm);
  font-weight: 500; color: var(--ink-2); }
.nav-mobile[open] > summary { background: var(--chip); }
.nav-mobile .menu { position: absolute; left: var(--s3); right: var(--s3); top: calc(100% + 4px); min-width: 0; grid-template-columns: 1fr 1fr;
  max-height: calc(100vh - 130px); overflow: auto; }
.nav-mobile .menu-group:first-child { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
@media (min-width: 900px) {
  .topbar-inner { flex-wrap: nowrap; gap: var(--s4); }
  .gsearch { order: 0; width: auto; flex: 1 1 260px; max-width: 360px; }
  .nav { display: flex; margin-left: auto; }
  .nav-mobile { display: none; }
}

/* ------------------------------------------------------------------ layout */
.content { max-width: var(--maxw); margin: 0 auto; padding: var(--s5) var(--s4) var(--s6); }
.content > :first-child { margin-top: 0; }
.foot { max-width: var(--maxw); margin: 0 auto var(--s6); padding: 0 var(--s4); color: var(--faint); font-size: var(--fs-xs); }
.narrow { max-width: 720px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--s4); }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: var(--s4); }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-main { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--s5); } }
.row { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.spacer { flex: 1; }
.stack-s > * + * { margin-top: var(--s2); }
.stack-m > * + * { margin-top: var(--s4); }

/* page header */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s3) var(--s4); margin: 0 0 var(--s5); }
.page-head-text { flex: 1 1 320px; min-width: 0; }
.page-head h1 { margin: 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.eyebrow { font-size: var(--fs-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: var(--s1); }
.lede { color: var(--muted); margin: var(--s1) 0 0; font-size: var(--fs-md); }
@media (min-width: 700px) { h1 { font-size: var(--fs-2xl); } }

/* cards + sections */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s4) var(--s5);
  margin: 0 0 var(--s4); min-width: 0; overflow-wrap: break-word; box-shadow: var(--shadow); }
.card > h2:first-child, .card > h3:first-child, .card > .section-head:first-child h2 { margin-top: 0; }
.card.flat { box-shadow: none; background: var(--panel-2); }
.card.tablewrap { padding-left: 0; padding-right: 0; }
.card.tablewrap > h2, .card.tablewrap > h3, .card.tablewrap > p, .card.tablewrap > .section-head { padding-left: var(--s5); padding-right: var(--s5); }
.card.tablewrap th:first-child, .card.tablewrap td:first-child { padding-left: var(--s5); }
.card.tablewrap th:last-child, .card.tablewrap td:last-child { padding-right: var(--s5); }
.section { margin-bottom: var(--s4); }
.section-head { display: flex; align-items: baseline; gap: var(--s3); margin: var(--s6) 0 var(--s3); }
.card > .section-head { margin: 0 0 var(--s3); }
.section-head h2 { margin: 0; flex: 1; }
.section-link { font-size: var(--fs-sm); white-space: nowrap; }
.plain { background: none; border: 0; box-shadow: none; padding: 0; }

/* key/value */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px var(--s4); margin: 0; }
.kv dt { color: var(--muted); font-size: var(--fs-sm); padding-top: 1px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--s3); margin-bottom: var(--s4); }
.stat { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s3) var(--s4);
  color: var(--ink); box-shadow: var(--shadow); }
a.stat:hover { text-decoration: none; border-color: var(--line-2); }
.stat-value { font-size: 1.5rem; font-weight: 650; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: var(--fs-sm); }
.stat-sub { color: var(--faint); font-size: var(--fs-xs); margin-top: 2px; }

/* ------------------------------------------------------------------ tables */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: var(--fs-xs); letter-spacing: .03em; white-space: nowrap; padding-top: 6px; padding-bottom: 8px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--chip) 55%, transparent); }
td .sub, td .ticker { display: inline; }
/* .table-stack: rows become little cards on phones. Give each td a data-label="Column". */
@media (max-width: 600px) {
  table.table-stack, .table-stack thead, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table-stack tr { padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); }
  .table-stack tbody tr:last-child { border-bottom: 0; }
  .table-stack td { border: 0; padding: 2px 0 !important; text-align: left; }
  .table-stack td.num { text-align: left; }
  .table-stack td[data-label] { position: relative; padding-left: 38% !important; min-height: 1.5em; }
  .table-stack td[data-label]::before { content: attr(data-label); position: absolute; left: 0; top: 2px; width: 36%;
    color: var(--muted); font-size: var(--fs-sm); line-height: 1.5; overflow-wrap: anywhere; }
  .table-stack td.cell-title { font-weight: 600; font-size: var(--fs-md); padding-bottom: 4px !important; padding-left: 0 !important; }
  .table-stack td.cell-title::before { display: none; }
  .table-stack td.cell-title .muted, .table-stack td.cell-title .small { font-weight: 400; }
  .table-stack td:empty { display: none; }
  .table-stack tbody tr:hover td { background: none; }
}

/* ------------------------------------------------------------------ pills, chips, badges */
.badge, .pill { display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px; border-radius: var(--radius-pill);
  font-size: var(--fs-xs); font-weight: 550; line-height: 1.6; background: var(--chip); color: var(--ink-2); white-space: nowrap;
  vertical-align: 1px; }
.badge.ok, .pill.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn, .pill.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad, .pill.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info, .pill.info { background: var(--info-soft); color: var(--info); }
.badge.accent, .pill.accent { background: var(--accent-soft); color: var(--accent); }
/* legacy: a raw method badge now reads as a quiet label */
.badge.method { background: transparent; color: var(--faint); font-family: var(--font); font-weight: 500; padding: 0; }
.st { font-weight: 600; }
.st-Universe { background: var(--st-universe-bg); color: var(--st-universe-fg); }
.st-Triage { background: var(--st-triage-bg); color: var(--st-triage-fg); }
.st-Research { background: var(--st-research-bg); color: var(--st-research-fg); }
.st-Own { background: var(--st-own-bg); color: var(--st-own-fg); }
.st-Monitor { background: var(--st-monitor-bg); color: var(--st-monitor-fg); }
.st-Pass { background: var(--st-pass-bg); color: var(--st-pass-fg); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-block; background: var(--chip); color: var(--ink-2); border-radius: var(--radius-pill); padding: 2px 10px; font-size: var(--fs-sm); }
a.chip:hover { text-decoration: none; background: color-mix(in srgb, var(--chip) 70%, var(--line-2)); }
.ticker { color: var(--muted); font-size: var(--fs-xs); font-weight: 500; letter-spacing: .02em; }
.co { color: var(--ink); }
.co:hover { text-decoration: none; }
.co:hover .co-name { color: var(--accent); }
.co-name { font-weight: 560; }

/* price moves */
.move { font-variant-numeric: tabular-nums; font-weight: 550; white-space: nowrap; }
.move.up { color: var(--ok); }
.move.down { color: var(--bad); }
.move.flat { color: var(--muted); }
.price { font-variant-numeric: tabular-nums; font-weight: 600; }

/* provenance */
.prov { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; border-radius: 50%;
  border: 1px solid var(--line-2); color: var(--faint); font: italic 600 10px/1 Georgia, serif; cursor: help; vertical-align: 1px;
  position: relative; margin-left: 2px; }
.prov:hover, .prov:focus { color: var(--accent); border-color: var(--accent); outline: none; }
.prov:hover::after, .prov:focus::after { content: attr(aria-label); position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%); background: var(--ink); color: var(--bg); font: 500 12px/1.3 var(--font); padding: 5px 8px;
  border-radius: 6px; white-space: nowrap; z-index: 50; pointer-events: none; }
.prov-label { color: var(--muted); font-size: var(--fs-xs); }
details.sources { margin-top: var(--s2); font-size: var(--fs-sm); color: var(--muted); }
details.sources > summary { cursor: pointer; color: var(--faint); font-size: var(--fs-xs); list-style: none; display: inline-flex;
  align-items: center; gap: 4px; user-select: none; }
details.sources > summary::-webkit-details-marker { display: none; }
details.sources > summary::before { content: ""; width: 5px; height: 5px; border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .15s; margin-right: 2px; }
details.sources[open] > summary::before { transform: rotate(45deg); }
details.sources > summary:hover { color: var(--accent); }
details.sources ul { list-style: none; padding: var(--s2) 0 0 var(--s3); margin: 0; border-left: 2px solid var(--line); }
details.sources li { margin-bottom: 4px; }
details.sources q { display: block; color: var(--ink-2); font-style: italic; margin-top: 2px; }

/* disclosure used for 'About this listing', 'Technical details' etc. */
details.more { border-top: 1px solid var(--line); padding-top: var(--s3); margin-top: var(--s3); }
details.more > summary, details.disclosure > summary { cursor: pointer; color: var(--muted); font-size: var(--fs-sm); font-weight: 500; }
details.more > summary:hover, details.disclosure > summary:hover { color: var(--accent); }
details.disclosure { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s3) var(--s5); margin-bottom: var(--s4); }
details.disclosure[open] > summary { margin-bottom: var(--s3); }

/* empty states */
.empty { color: var(--muted); margin: 0; padding: var(--s2) 0; }
.empty a { font-weight: 550; }

/* ------------------------------------------------------------------ lists */
.list { margin: 0; padding: 0; list-style: none; }
.list-row { display: flex; align-items: center; gap: var(--s3); padding: 10px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.list-row:last-child { border-bottom: 0; }
.list-main { flex: 1; min-width: 0; }
.list-title { font-weight: 520; overflow-wrap: anywhere; }
.list-meta { color: var(--muted); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.list-side { flex: none; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.card > .list-row:first-child, .card > .list > .list-row:first-child { padding-top: 0; }
.card > .list-row:last-child, .card > .list > .list-row:last-child { padding-bottom: 0; }

/* 'Needs you' action list */
.needs { display: grid; grid-template-columns: 1fr; gap: var(--s2); }
@media (min-width: 640px) { .needs { grid-template-columns: 1fr 1fr; } }
.need { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); color: var(--ink); box-shadow: var(--shadow); }
.need:hover { text-decoration: none; border-color: var(--accent); }
.need-n { font-size: 1.35rem; font-weight: 680; min-width: 2.2ch; font-variant-numeric: tabular-nums; color: var(--accent); }
.need-text { flex: 1; min-width: 0; }
.need-text small { display: block; color: var(--muted); font-size: var(--fs-sm); }
.need::after { content: ""; width: 7px; height: 7px; border-right: 1.5px solid var(--faint); border-top: 1.5px solid var(--faint); transform: rotate(45deg); }
.all-clear { padding: var(--s4); background: var(--ok-soft); color: var(--ok); border-radius: var(--radius); font-weight: 520; }

/* feed ('What changed') */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 1fr auto; gap: 2px var(--s3); padding: 10px 0; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: 0; }
.feed .when { color: var(--faint); font-size: var(--fs-xs); white-space: nowrap; padding-top: 3px; }
.feed .what { overflow-wrap: anywhere; }
.feed .kind { font-size: var(--fs-xs); color: var(--muted); }

/* company hero */
.hero { margin: 0 0 var(--s5); }
.hero-top { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--s3) var(--s5); }
.hero-id { flex: 1 1 320px; min-width: 0; }
.hero h1 { margin: 0 0 var(--s1); }
.hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; color: var(--muted); font-size: var(--fs-sm); }
.hero-price { text-align: right; }
.hero-price .price { font-size: 1.6rem; line-height: 1.1; display: block; }
.hero-price .muted { font-size: var(--fs-xs); }
.hero-next { margin-top: var(--s3); padding: var(--s3) var(--s4); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  font-size: var(--fs-sm); color: var(--ink-2); }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin-top: var(--s4); }
.dot-sep::before { content: "·"; color: var(--faint); margin-right: 10px; }

/* ask box */
.askbox { display: flex; gap: var(--s2); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-pill);
  padding: 6px 6px 6px 18px; box-shadow: var(--shadow); margin-bottom: var(--s5); }
.askbox input { border: 0; background: transparent; padding: 8px 0; flex: 1; }
.askbox input:focus { outline: none; box-shadow: none; }
.askbox:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }

/* tabs + filters */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: var(--s4); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 8px 12px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-size: var(--fs-sm); font-weight: 520; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); }
.filters { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin-bottom: var(--s4); }
.filters select, .filters input { width: auto; min-width: 140px; }

/* ------------------------------------------------------------------ buttons + forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius-pill);
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); font: inherit; font-size: var(--fs-sm);
  font-weight: 560; cursor: pointer; white-space: nowrap; line-height: 1.3; }
.btn:hover { text-decoration: none; filter: brightness(1.07); }
.btn:active { transform: translateY(1px); }
.btn.ghost, .btn.secondary { background: var(--panel); color: var(--ink); border-color: var(--line-2); }
.btn.ghost:hover, .btn.secondary:hover { border-color: var(--accent); color: var(--accent); filter: none; }
.btn.quiet { background: transparent; border-color: transparent; color: var(--accent); padding-left: 8px; padding-right: 8px; }
.btn.quiet:hover { background: var(--accent-soft); filter: none; }
.btn.danger { background: var(--panel); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line-2)); }
.btn.small { padding: 4px 11px; font-size: var(--fs-xs); }
.btn.wrap { white-space: normal; text-align: left; max-width: 100%; }
form { max-width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
form.stack { display: grid; gap: var(--s4); }
label { display: grid; gap: 5px; font-size: var(--fs-sm); color: var(--ink-2); font-weight: 520; }
label.req > span::after { content: " *"; color: var(--bad); font-weight: 400; }
.help, label .help { display: block; color: var(--muted); font-size: var(--fs-xs); font-weight: 400; }
input, select, textarea { font: inherit; font-size: 16px; padding: 9px 11px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--panel); color: var(--ink); width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--focus); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--accent); }
input[type=file] { padding: 7px; background: var(--panel-2); }
textarea { min-height: 84px; resize: vertical; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s3) var(--s4) var(--s4); margin: 0; min-width: 0; }
legend { color: var(--ink); font-size: var(--fs-sm); font-weight: 600; padding: 0 6px; }
.fields2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--s3); }
.exprow { display: grid; grid-template-columns: 2fr 0.8fr 1fr 0.8fr 1.3fr; gap: 6px; margin-bottom: var(--s2); }
.exprow .full { grid-column: 1 / -1; }
.check-row { display: flex; align-items: center; gap: var(--s2); font-weight: 450; color: var(--ink); }
.form-actions { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.errors { border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent); color: var(--bad); border-radius: var(--radius);
  padding: var(--s3) var(--s4); background: var(--bad-soft); margin-bottom: var(--s4); }
.errors ul { margin: 4px 0 0; }
.flash { border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent); color: var(--ok); background: var(--ok-soft);
  border-radius: var(--radius); padding: var(--s3) var(--s4); margin-bottom: var(--s4); font-weight: 520; }
.note-box { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s3) var(--s4); color: var(--ink-2); font-size: var(--fs-sm); }

/* ------------------------------------------------------------------ timeline (decisions) */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 var(--s4) 22px; margin: 0; overflow-wrap: anywhere; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 7px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--panel); border: 2px solid var(--accent); }
.timeline li::after { content: ""; position: absolute; left: 8px; top: 20px; bottom: 2px; width: 1px; background: var(--line-2); }
.timeline li:last-child::after { display: none; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li.void, .timeline li.corrected { opacity: 0.6; }
.timeline .when { color: var(--muted); font-size: var(--fs-xs); }
.timeline .what { font-weight: 560; }
.hash { font-family: var(--mono); font-size: var(--fs-xs); color: var(--faint); overflow-wrap: anywhere; }
pre.manifest { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--s3); overflow-x: auto;
  font-size: var(--fs-xs); max-height: 420px; }

/* search hits */
.hits { list-style: none; padding: 0; margin: 0; }
.hits li { padding: 10px 0; border-bottom: 1px solid var(--line); margin: 0; }
.hits li:last-child { border-bottom: 0; }
.snippet { color: var(--muted); font-size: var(--fs-sm); overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ phones */
@media (max-width: 600px) {
  .content { padding: var(--s4) var(--s4) var(--s6); }
  .card { padding: var(--s4); border-radius: 10px; }
  .card.tablewrap > h2, .card.tablewrap > h3, .card.tablewrap > p, .card.tablewrap > .section-head { padding-left: var(--s4); padding-right: var(--s4); }
  .card.tablewrap th:first-child, .card.tablewrap td:first-child { padding-left: var(--s4); }
  .card.tablewrap th:last-child, .card.tablewrap td:last-child { padding-right: var(--s4); }
  th, td { padding: 8px 8px; }
  .exprow { grid-template-columns: 1fr 1fr; }
  .hide-sm { display: none; }
  .badge { white-space: normal; max-width: 100%; }
  .hero-price { text-align: left; }
  .kv { grid-template-columns: 1fr; gap: 0; }
  .kv dd { margin-bottom: var(--s2); }
  .menu { min-width: 0; }
  .section-head { margin-top: var(--s5); }
}
@media print {
  .topbar, .foot, .hero-actions, .page-actions { display: none; }
  body { background: #fff; }
  .card { box-shadow: none; }
}

/* ------------------------------------------------------------------ theme switch */
.theme-toggle { flex: none; width: 34px; height: 34px; display: inline-grid; place-items: center; cursor: pointer;
  border: 1px solid var(--line-2); border-radius: var(--radius-pill); background: var(--panel-2); color: var(--ink-2);
  padding: 0; font: inherit; line-height: 1; }
.theme-toggle:hover { background: var(--chip); color: var(--ink); }
.theme-toggle svg { width: 17px; height: 17px; display: block; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
}
@media print { .theme-toggle { display: none; } }

/* ------------------------------------------------------------------ reminders: the bell and the daily alert */
details.bell { position: relative; flex: none; }
details.bell > summary { list-style: none; cursor: pointer; user-select: none; position: relative; width: 34px; height: 34px;
  display: inline-grid; place-items: center; border: 1px solid var(--line-2); border-radius: var(--radius-pill);
  background: var(--panel-2); color: var(--ink-2); }
details.bell > summary::-webkit-details-marker { display: none; }
details.bell > summary:hover, details.bell[open] > summary { background: var(--chip); color: var(--ink); }
details.bell > summary svg { width: 17px; height: 17px; display: block; }
details.bell.has > summary { color: var(--ink); border-color: var(--warn); }
.bell-n { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-pill);
  background: var(--warn); color: var(--panel); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
  font-variant-numeric: tabular-nums; }
.bell-panel { position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; width: 340px; max-width: calc(100vw - 24px);
  max-height: calc(100vh - 90px); overflow: auto; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-pop); padding: var(--s3); color: var(--ink); }
.bell-list { list-style: none; margin: 0; padding: 0; }
.bell-list li { display: grid; gap: 4px; padding: var(--s2) 8px var(--s3); border-bottom: 1px solid var(--line); }
.bell-name { font-weight: 600; color: var(--ink); }
.bell-why { color: var(--ink-2); font-size: var(--fs-sm); }
.bell-acts { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: 2px; }
.bell-foot { margin: var(--s2) 8px 2px; color: var(--muted); font-size: var(--fs-xs); }
.bell-said { margin: 0 8px var(--s2); }
.bell-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 2px var(--s1); color: var(--muted); font-size: var(--fs-xs); }
.bell-quick .btn.small.quiet { padding: 4px 6px; }
/* The daily alert. It is part of the page at every width: a row under the bar, as wide as the page's own column,
   with the alert at its right end. It pushes the page down and so never lies over anything on it. */
.ping-row { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--s4); display: flex; justify-content: flex-end; }
.ping { display: flex; align-items: center; gap: var(--s2); width: 100%; margin-top: var(--s3); background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); border-left: 3px solid var(--warn); border-radius: var(--radius);
  padding: var(--s2) var(--s2) var(--s2) var(--s3); font-size: var(--fs-sm); overflow-anchor: none; }
.ping[hidden] { display: none; }
.ping-text { flex: 1 1 auto; min-width: 0; }
.ping-close { flex: none; width: 30px; height: 30px; border: 0; border-radius: var(--radius-pill); background: transparent;
  color: var(--muted); font-size: 1.2rem; line-height: 1; cursor: pointer; }
.ping-close:hover { background: var(--chip); color: var(--ink); }
@media (min-width: 900px) { .ping { width: 420px; max-width: 100%; } }
/* Phones: the bell sits at the right beside "Menu"; its panel spans the bar like the menu does. Buttons are
   tall enough for a thumb. */
@media (max-width: 899px) {
  details.bell { order: 1; margin-left: auto; position: static; }
  .theme-toggle { order: 1; }
  details.bell ~ details.nav-mobile { margin-left: 0; }
  .bell-panel { left: var(--s3); right: var(--s3); top: calc(100% + 4px); width: auto; max-width: none; max-height: calc(100vh - 130px); }
  .ping .btn.small, .bell-panel .btn.small { min-height: 36px; }
  .ping-close { width: 36px; height: 36px; }
}
/* Narrow phones: tighter, so the bell does not push "Menu" onto a second row. */
@media (max-width: 359px) {
  .topbar-inner { gap: var(--s2); }
  .wordmark { font-size: .95rem; }
  .nav-mobile > summary { padding: 7px 10px; }
}
/* Just above the phone layout the bar is at its tightest: give back the room the bell takes. */
@media (min-width: 900px) and (max-width: 1099px) {
  .topbar-inner { gap: var(--s3); }
  .nav > a, .nav-more > summary { padding: 6px 7px; }
}
@media print { details.bell, .ping-row { display: none; } }

/* desk page */
/* the new stock page: header, jump bar, the seven sections, the record (templates/desk/company.html and its parts) */
.jump { position: sticky; top: var(--jump-top, 52px); z-index: 15; background: var(--bg); margin: 0 0 var(--s4); padding-top: 2px; }
.sec, .sec-record, .sub-panel, details.rec, .blk, #cover-head, #owed { scroll-margin-top: calc(var(--jump-top, 52px) + 48px); }
details.sec > summary.sec-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px var(--s3); cursor: pointer; list-style: none; }
details.sec > summary.sec-head::-webkit-details-marker { display: none; }
details.sec > summary.sec-head h2 { margin: 0; }
details.sec > summary.sec-head::after { content: ""; width: 7px; height: 7px; margin-left: auto; align-self: center; border-right: 1.5px solid var(--faint);
  border-bottom: 1.5px solid var(--faint); transform: rotate(-45deg); transition: transform .15s; flex: none; }
details.sec[open] > summary.sec-head::after { transform: rotate(45deg); }
details.sec[open] > summary.sec-head { margin-bottom: var(--s3); }
.sec-digest { color: var(--muted); font-size: var(--fs-sm); min-width: 0; overflow-wrap: anywhere; }
.sec-digest:empty { display: none; }
.sec-lede { margin: 0 0 var(--s3); }
.blk { margin: 0 0 var(--s4); min-width: 0; }
.sub-panel + .blk { border-top: 1px solid var(--line); padding-top: var(--s3); margin-top: var(--s4); }
.sub-panel > .form-actions { margin-top: var(--s3); }
.blk-head { display: flex; align-items: baseline; gap: var(--s3); margin: 0 0 var(--s2); }
.blk-head h3 { margin: 0; flex: 1; }
.blk h4 { font-size: var(--fs-sm); font-weight: 600; color: var(--muted); margin: var(--s3) 0 var(--s1); }
.blk-actions { margin-top: var(--s3); }
.blk-foot { margin-top: var(--s3); }
.blk-foot details.hist { border-top: 0; padding-top: 0; margin-top: 2px; }
.blk .flash, .blk .errors, #cover-head > .flash, #cover-head > .errors { margin-bottom: var(--s3); }
.own-words p { margin: 0 0 var(--s2); white-space: pre-line; }
.sub-panel { border-top: 1px solid var(--line); padding-top: var(--s3); margin-top: var(--s3); min-width: 0; }
.sub-panel > h3 { margin-top: 0; }
.sub-panel.plain-panel { border-top: 0; padding-top: 0; margin-top: 0; }
details.sub-panel > summary { font-size: var(--fs-md); font-weight: 600; color: var(--ink); }
details.sub-panel[open] > summary { margin-bottom: var(--s3); }
form.inline { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.inline-label { display: inline-flex; align-items: center; gap: var(--s2); }
.inline-label input { width: auto; padding: 5px 8px; }
.quiet-link, .act-link { font-size: var(--fs-sm); white-space: nowrap; }
.warn-text { color: var(--warn); }
.working-as { margin-left: auto; }
.glance { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.glance a { color: var(--ink); }
.glance a:hover { color: var(--accent); }
.stars { color: var(--accent); letter-spacing: 1px; font-weight: 600; white-space: nowrap; }
/* header: covered chip, the "Change" forms, conviction, row 4 */
details.cover-change > summary { cursor: pointer; color: var(--accent); font-size: var(--fs-sm); list-style: none; }
details.cover-change > summary::-webkit-details-marker { display: none; }
/* "Cover it after all" on a not-covered company is a filled button; the quiet link colour above must not win */
details.cover-change > summary.btn { color: var(--accent-ink); font-size: var(--fs-sm); padding: 5px 14px; }
details.cover-change[open] { flex: 1 0 100%; }
.cover-forms { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); align-items: start; gap: var(--s4); margin-top: var(--s2); padding: var(--s3) var(--s4);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); }
.head-form { max-width: 460px; gap: var(--s3); align-content: start; }
.look-again-on { white-space: nowrap; }
.head-hint { margin: var(--s2) 0 0; }
.conviction { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4); margin-top: var(--s3); }
.stars-form { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.stars-label { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); margin-right: var(--s1); }
.star-pick { display: flex; flex-wrap: wrap; gap: var(--s2); }
.star-opt { display: inline-flex; position: relative; }
.star-opt input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.star-opt span { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--panel); color: var(--ink-2); font-weight: 520; white-space: nowrap; }
.star-opt input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.star-opt input:focus-visible + span { box-shadow: 0 0 0 3px var(--focus); }
.stars-more { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s2); flex: 1 0 100%; }
.stars-more label { flex: 1 1 220px; max-width: 420px; }
@supports selector(:has(*)) {
  .stars-form:not(.show) .stars-more { display: none; }
  .stars-form:has(input[name="n"]:checked:not(.cur)) .stars-more { display: flex; }
}
.owed.undecided { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--s2) var(--s3); margin-top: var(--s3); padding: var(--s3) var(--s4);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.owed.undecided > b { align-self: center; }
/* small disclosures that hold one action's form */
details.act { display: inline-block; vertical-align: top; }
details.act > summary { cursor: pointer; list-style: none; color: var(--accent); font-size: var(--fs-sm); white-space: nowrap; }
details.act > summary.btn { color: inherit; }
details.act > summary.btn.quiet { color: var(--accent); }
details.act > summary::-webkit-details-marker { display: none; }
details.act[open] { display: block; flex: 1 0 100%; width: 100%; }
details.act[open] > summary { margin-bottom: var(--s2); }
.act-form { gap: var(--s3); padding: var(--s3) var(--s4); background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); max-width: 520px; }
.row-acts { display: flex; flex-wrap: wrap; gap: 4px var(--s3); align-items: flex-start; }
.row-acts form.inline { display: inline-flex; }
.row-acts .btn.quiet.small { padding: 0; font-size: var(--fs-sm); }
.row-acts { min-width: 150px; }
.choice-row { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); }
details.add-row > summary { color: var(--accent); }
details.add-row[open] > summary { margin-bottom: var(--s3); }
.fig-fields { display: grid; grid-template-columns: 2fr 1fr 1.2fr 1fr 1fr 2fr; gap: var(--s2); }
.nothing-row { margin-top: var(--s3); }
.offers { display: grid; gap: var(--s2); margin-top: var(--s3); }
.offer { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); }
.offer-text { flex: 1 1 260px; min-width: 0; font-size: var(--fs-sm); }
.alt-offers, .named-in { margin: var(--s3) 0 0; }
.alt-facts { display: inline-flex; gap: 6px; align-items: center; margin-left: 6px; }
.cat-passed td { background: var(--warn-soft); }
/* valuation */
.val-stats { margin-bottom: var(--s3); }
.val-stats .case-base { border-color: var(--accent); }
.range-bar { position: relative; height: 40px; margin: 0 6px var(--s3); }
.range-line { position: absolute; left: 0; right: 0; top: 12px; height: 4px; border-radius: 2px;
  background: linear-gradient(90deg, var(--bad-soft), var(--chip) 50%, var(--ok-soft)); border: 1px solid var(--line); }
.range-mark { position: absolute; top: 6px; width: 3px; height: 16px; margin-left: -1px; border-radius: 2px; background: var(--muted); }
.range-mark.mark-bear { background: var(--bad); }
.range-mark.mark-base { background: var(--accent); }
.range-mark.mark-bull { background: var(--ok); }
.range-price { position: absolute; top: 4px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 1px; }
.range-price i { width: 10px; height: 10px; border-radius: 50%; background: var(--ink); border: 2px solid var(--panel); margin-top: 5px; }
.range-price b { font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.val-facts { margin: 0 0 var(--s2); }
.cases { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); }
.cases .case { display: grid; gap: var(--s2); align-content: start; }
.cases .case-base { border-color: var(--accent); }
.val-form h3 { margin: 0; }
.model-note { margin: var(--s2) 0 0; }
.from-memo ul { margin: 4px 0 var(--s2); padding-left: var(--s4); }
table.beside th.grp { text-align: center; border-bottom: 1px solid var(--line); color: var(--muted); font-weight: 550; }
/* the record */
.rec-title { margin: var(--s6) 0 var(--s3); }
details.rec > summary { font-size: var(--fs-md); font-weight: 600; color: var(--ink); }
details.rec > summary + .sub-panel { border-top: 0; padding-top: 0; margin-top: 0; }
details.rec > .sub-panel { margin-top: var(--s4); }
.rec-head { margin: var(--s3) 0 var(--s2); }
.rec-head h3 { margin: 0; flex: 1; }
.hist-list .when { color: var(--faint); font-size: var(--fs-xs); }
.hist-list .what { font-weight: 520; }
@media (max-width: 700px) {
  .cases { grid-template-columns: 1fr; }
  .fig-fields { grid-template-columns: 1fr 1fr; }
  .head-form, .act-form { max-width: none; }
  .cover-forms { grid-template-columns: 1fr; }
  .working-as { margin-left: 0; flex-basis: 100%; }
  .row-acts { min-width: 0; }
  .stars-more label { max-width: none; }
}
@media (max-width: 600px) { .fig-fields { grid-template-columns: 1fr; } .val-stats { grid-template-columns: 1fr; } }
@media (max-width: 700px) {
  /* a row's own forms (It happened / Move the date / Remove ...) take the full width of the card, not the value column */
  .sec .table-stack td[data-label=""] { padding-left: 0 !important; }
  .sec .table-stack td[data-label=""]::before { display: none; }
}
.numbers-warn { color: var(--warn); margin: 2px 0; }
.numbers-file, .numbers-shares { margin: var(--s2) 0 2px; }
.sure-row { margin-top: var(--s2); }
.who-banner { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); margin: 0 0 var(--s3); }
.who-banner .who-list { gap: var(--s2); }
@media print { .jump, .row-acts, .blk-actions, details.add-row, .conviction, details.cover-change { display: none; } }

/* desk board */
/* the "Still to do" strip (stock-page header, row 4), the brief panel, /desk, /desk/setup, /desk/who */
.owed.owed-covered { margin-top: var(--s3); padding: var(--s3) var(--s4); background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius); font-size: var(--fs-sm); }
.owed.owed-none { display: none; }
.owed .owed-head { display: inline-block; margin: 0; font-weight: 600; color: var(--ink); }
.owed .owed-clear { font-weight: 450; color: var(--ink-2); }
.owed .owed-toggle { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.owed .owed-narrow { display: none; }
.owed .owed-who { font-weight: 450; color: var(--muted); }
.owed .owed-as { margin-left: var(--s3); }
.owed .owed-body { margin-top: var(--s2); }
.owed-lines { list-style: none; margin: 0; padding: 0; }
.owed-line { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s1) var(--s3);
  padding: 6px 0; border-top: 1px solid var(--line); }
.owed-lines > .owed-line:first-child { border-top: 0; }
.owed-line .owed-what { flex: 1 1 260px; min-width: 0; overflow-wrap: anywhere; }
.owed-line .owed-what a { color: var(--ink); text-decoration: none; }
.owed-line .owed-what a:hover { text-decoration: underline; }
.owed-line .owed-due { color: var(--muted); white-space: nowrap; }
.owed-line.warn .owed-due { color: var(--warn); font-weight: 600; }
.owed-line.bad .owed-what a, .owed-line.bad .owed-due { color: var(--bad); }
.owed-line form { margin: 0; }
.owed-notnow > summary, .owed-more > summary { cursor: pointer; color: var(--muted); font-size: var(--fs-xs); min-height: 28px;
  display: inline-flex; align-items: center; }
.owed-more > summary { font-size: var(--fs-sm); margin-top: var(--s1); }
.owed-notnow[open], .owed-all[open] { flex-basis: 100%; }
.owed-notnow-form { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin: var(--s1) 0 var(--s2); }
.owed-notnow-form .owed-choices { display: inline-flex; flex-wrap: wrap; gap: var(--s1); }
.owed-notnow-form input[type=text] { flex: 1 1 160px; min-width: 0; max-width: 320px; }
.owed .owed-all { margin-top: var(--s2); }
.owed .owed-error { color: var(--bad); margin: var(--s2) 0 0; }
.owed-ask { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); }
.owed-ask form { margin: 0; }
.owed-brief { font-size: var(--fs-sm); }
@media (max-width: 700px) {
  .owed .owed-wide { display: none; }
  .owed .owed-narrow { display: inline; }
  .owed .owed-head { cursor: pointer; }
  .owed .owed-head::after { content: " ▾"; color: var(--muted); }
  .owed .owed-toggle ~ .owed-body { display: none; }
  .owed .owed-toggle:checked ~ .owed-body { display: block; }
  .owed .owed-toggle:focus-visible + .owed-head { outline: 2px solid var(--focus); outline-offset: 2px; }
  .owed .owed-as { display: block; margin: var(--s1) 0 0; }
  .owed-line .owed-due { white-space: normal; }
}
.desk-stars { color: var(--accent); letter-spacing: 1px; white-space: nowrap; }
.desk-note { white-space: pre-line; font-size: var(--fs-sm); color: var(--ink-2); }
.desk-lines > summary { cursor: pointer; }
.desk-lines .owed-lines { margin-top: var(--s2); font-size: var(--fs-sm); }
.desk-late { color: var(--warn); font-weight: 600; }
.desk-names { list-style: none; margin: var(--s3) 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--s1) var(--s4); }
.desk-foot { margin-top: var(--s5); }
.desk-tg { margin-top: var(--s2); }
.setup-tools .row { flex-wrap: wrap; gap: var(--s2) var(--s3); margin: var(--s2) 0; align-items: center; }
.setup-spread label { display: inline-flex; align-items: center; gap: var(--s2); white-space: nowrap; margin: 0; }
.setup-spread input.setup-weeks { width: 4.5em; flex: 0 0 4.5em; }
.setup-group { margin-top: var(--s5); align-items: baseline; }
.setup-choice { display: inline-flex; flex-wrap: wrap; gap: var(--s1) var(--s4); }
.setup-choice .check-row { min-height: 32px; }
.setup-table input[type=date], .setup-table select { max-width: 11em; }
.setup-save { position: sticky; bottom: 0; background: var(--bg); padding: var(--s3) 0; margin-top: var(--s4); border-top: 1px solid var(--line);
  flex-wrap: wrap; }
.who-list { display: flex; flex-wrap: wrap; gap: var(--s2); }
.who-btn { min-height: 44px; min-width: 120px; }
.owed-said { margin: var(--s2) 0 0; }
.desk-not-started { margin: calc(-1 * var(--s2)) 0 var(--s3); }
@media (max-width: 600px) {
  .setup-table input[type=date], .setup-table select { max-width: 100%; }
  .setup-choice { gap: var(--s1) var(--s3); }
}

/* peers */
.peers .peers-order { margin: 0 0 var(--s2); }
.peers .peer-acts { flex-direction: row; align-items: flex-start; gap: var(--s1); flex-wrap: wrap; justify-content: flex-end; max-width: 60%; }
.peers details.notpeer > summary { list-style: none; cursor: pointer; }
.peers details.notpeer > summary::-webkit-details-marker { display: none; }
.peers details.notpeer[open] { flex: 1 1 100%; text-align: right; }
.peers .notpeer-why { display: flex; flex-wrap: wrap; gap: var(--s1); justify-content: flex-end; align-items: center; margin-top: var(--s1); }
.peers .peers-rest { margin-top: var(--s3); text-align: right; }
@media (max-width: 700px) {
  .peers .peer-sug { flex-wrap: wrap; }
  .peers .peer-acts { max-width: 100%; flex: 1 1 100%; justify-content: flex-start; }
  .peers details.notpeer[open], .peers .notpeer-why { text-align: left; justify-content: flex-start; }
  .peers .peer-acts .btn { min-height: 44px; }
}

/* "Open elsewhere": links out to TradingView and StockScans, and the text to copy into them by hand */
.ew { margin: 0 0 var(--s4); display: grid; gap: var(--s2); scroll-margin-top: 132px; }   /* clear of the top bar, wrapped or not */
.ew-row { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); align-items: baseline; }
.ew-title { font-weight: 600; }
.ew-note, .ew-said, .ew-refused { margin: 0; }
.ew-said { color: var(--ok); }
.ew-refused { color: var(--bad); }
.ew-copy, .ew-form, .ew-drift { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s2); align-items: center; }
.ew-copy, .ew-form { position: relative; }
.ew-copy .ew-text, .ew-form input[type=url] { flex: 1 1 220px; min-width: 0; width: auto; font-size: var(--fs-xs); padding: 4px 8px; }
.ew-copy .ew-text { font-family: var(--mono); color: var(--ink-2); background: var(--panel-2); }
.ew-copy .btn { flex: none; }
.ew-drift { padding: var(--s2) var(--s3); background: var(--warn-soft); border-radius: var(--radius-sm); }
.ew-drift span { flex: 1 1 260px; }
.ew-yours { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); align-items: baseline; }
.ew-yours form { margin: 0; }
.ew-change > summary { cursor: pointer; color: var(--accent); list-style: none; padding: 4px 0; }
.ew-change > summary::-webkit-details-marker { display: none; }
.ew-yours .ew-change[open] { flex: 1 1 100%; order: 2; }
.ew-change .ew-form { margin-top: var(--s1); }
.ew-co { display: flex; flex-wrap: wrap; gap: 0 var(--s3); margin-top: 2px; font-weight: 400; }
.ew-co a { color: var(--muted); white-space: nowrap; }
.ew-co a:hover { color: var(--accent); }
@media (max-width: 600px) {
  .ew-copy .ew-text { flex: 1 1 7em; }                       /* the field and its button share one line */
  .ew-form input[type=url] { flex: 1 1 100%; }
  .ew-co { gap: 0 var(--s4); }
  .ew-co a { padding: 6px 0; }                               /* a taller target for a thumb */
}
