/* ===========================================================================
   viralgen-53 — built to the OBF brand kits in "Layouts and brand instructions".

   Colour is specified as ROLES, never as brand names, exactly as
   patterns/README.md requires. Each brand maps the roles to its own palette in
   the [data-brand] blocks below; every component below refers only to roles.

   Two rules from the kits that are easy to get wrong and are enforced here:

   1. Mira's brass (#c3a544) is a FILL colour. It measures 2.39:1 as text on
      white — unreadable. Text set in brass uses --brand-ink (#7a621b, 5.85:1).
      That is why --accent-fill and --accent-foreground are separate tokens
      rather than one accent.
   2. Text ON a brand fill is not always white. RedFish and OBF take white;
      Mira takes navy (#1f2e48 on brass = 5.70:1). Hence --accent-on.

   No dark mode. The RedFish kit states the palette has no dark variant and one
   must not be invented silently.
   =========================================================================== */

/* ── self-hosted faces ─────────────────────────────────────────────────────
   The kits require self-hosting — "never load from a third-party stylesheet at
   runtime". Latin subset only. Source Sans 3 and Inter ship as variable fonts,
   so one file each covers every weight the kits allow.                        */

@font-face {
  font-family: "Source Sans 3";
  src: url("fonts/sourcesans3-var.woff2") format("woff2-variations");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("fonts/inter-var.woff2") format("woff2-variations");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("fonts/poppins-500.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("fonts/poppins-600.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("fonts/poppins-700.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

/* The hidden attribute always wins over a component's own display rule. */
[hidden] { display: none !important; }

/* ── roles ─────────────────────────────────────────────────────────────────
   Defaults are RedFish; the other brands override in their own block.        */
:root {
  --surface: #ffffff;
  --surface-alt: #fbf9f9;
  --surface-raised: #f6f2f2;
  --surface-sunken: #f8f5f5;
  --border-subtle: #e6e0e0;
  --border-strong: #d4cbcb;

  --text-heading: #000000;
  --text-body: #505050;
  --text-muted: #767676;

  --accent-foreground: #aa0203;   /* accent as TEXT */
  --accent-fill: #aa0203;         /* accent as a FILL */
  --accent-fill-hover: #8c0102;
  --accent-on: #ffffff;           /* text ON the fill */
  --accent-surface: #f3eaea;      /* the tint behind hover/active */

  --success: #1a7f4b;      --success-bg: #e8f5ee;
  --attention: #b7791f;    --attention-bg: #fdf4e3;
  --warning: #c2410c;      --warning-bg: #fdece3;
  --danger-foreground: #aa0203;  --danger-surface: #f3eaea;
  --neutral: #767676;      --neutral-bg: #f2f2f2;

  --font-heading: "Source Sans 3", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Source Sans 3", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "Menlo", monospace;
  --eyebrow-tracking: 0.05em;
  --eyebrow-color: var(--text-muted);

  /* type scale — fixed sizes, absolute line heights */
  --text-h1: 52px;       --text-h1-line: 59.8px;  --text-h1-weight: 700;
  --text-h2: 36px;       --text-h2-line: 44px;    --text-h2-weight: 700;
  --text-h3: 26px;       --text-h3-line: 34px;    --text-h3-weight: 600;
  --text-h4: 20px;       --text-h4-line: 28px;    --text-h4-weight: 600;
  --text-body-size: 18px; --text-body-line: 32px; --text-body-weight: 400;
  --text-body-sm: 15px;  --text-body-sm-line: 24px;
  --text-caption: 13px;  --text-caption-line: 20px;
  --text-metric: 42px;   --text-metric-line: 48px; --text-metric-weight: 700;

  /* shape */
  --radius: 10px;
  --radius-sm: 8px;
  --border-width: 1px;
  --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);

  /* layout constants shared across the patterns */
  --nav-rail-width: 256px;
  --nav-brand-height: 72px;
  --nav-item-height: 44px;
  --nav-icon-size: 18px;
  --section-rail-width: 248px;
  --measure: 75ch;
}

[data-brand="mira"] {
  --surface: #ffffff;
  --surface-alt: #fbf9f3;
  --surface-raised: #f6f2e8;
  --surface-sunken: #f8f5ec;
  --border-subtle: #e4dfd1;
  --border-strong: #d5cdb8;

  --text-heading: #1f2e48;
  --text-body: #4a5468;
  --text-muted: #77808f;

  --accent-foreground: #7a621b;   /* brand-ink — the text-safe brass */
  --accent-fill: #c3a544;         /* brass — fills only */
  --accent-fill-hover: #a38729;
  --accent-on: #1f2e48;           /* navy on brass, 5.70:1 */
  --accent-surface: #f6efd9;

  --attention: #b7791f;    --attention-bg: #fdf4e3;
  --danger-foreground: #b3261e;  --danger-surface: #f7e9e8;
  --neutral: #77808f;      --neutral-bg: #f2f0ea;

  --font-heading: "Poppins", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --eyebrow-tracking: 0.16em;     /* the Mira signature */
  --eyebrow-color: var(--accent-foreground);
}

[data-brand="obf"] {
  --surface: #ffffff;
  --surface-alt: #f7f8fa;
  --surface-raised: #f5f6f8;
  --surface-sunken: #f7f8fa;
  --border-subtle: #e5e7eb;
  --border-strong: #d5d8de;

  --text-heading: #111827;
  --text-body: #374151;
  --text-muted: #6b7280;

  --accent-foreground: #2c6699;   /* the hover step — 6.06:1, safe as text */
  --accent-fill: #337ab7;
  --accent-fill-hover: #2c6699;
  --accent-on: #ffffff;
  --accent-surface: rgba(51, 122, 183, 0.10);

  --success: #1b7f4f;
  --attention: #a66a00;
  --danger-foreground: #c4322a;  --danger-surface: rgba(196, 50, 42, 0.12);

  --font-heading: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --eyebrow-tracking: 0.05em;
}

/* ── base ──────────────────────────────────────────────────────────────────*/

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--surface-alt); }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-body-sm);
  line-height: var(--text-body-sm-line);
  color: var(--text-body);
  background: var(--surface-alt);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent-foreground); }

h1, h2, h3, h4 { font-family: var(--font-heading); color: var(--text-heading); margin: 0; }
h1 { font-size: var(--text-h2); line-height: var(--text-h2-line); font-weight: var(--text-h2-weight); letter-spacing: -0.02em; }
h2 { font-size: var(--text-h3); line-height: var(--text-h3-line); font-weight: var(--text-h3-weight); }
h3 { font-size: var(--text-h3); line-height: var(--text-h3-line); font-weight: var(--text-h3-weight); }
h4 { font-size: var(--text-h4); line-height: var(--text-h4-line); font-weight: var(--text-h4-weight); }

:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent-fill) 50%, transparent); outline-offset: 2px; border-radius: var(--radius-sm); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; z-index: 99; background: var(--accent-fill); color: var(--accent-on); padding: 10px 16px; border-radius: var(--radius-sm); }

.eyebrow {
  font-family: var(--font-heading);
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: var(--eyebrow-tracking); color: var(--eyebrow-color);
}
.k { font-family: var(--font-mono); font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-muted); }
.tabular, .num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.card-surface, .card {
  background-color: var(--surface);
  border: var(--border-width) solid var(--border-subtle);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
}

/* ── app shell ─────────────────────────────────────────────────────────────*/

.shell { min-height: 100vh; }
.main {
  margin-left: var(--nav-rail-width);   /* inset by exactly the rail width */
  min-height: 100vh;
  min-width: 0;
}
.main__inner { max-width: 1240px; padding: 40px 48px 96px; }

/* ── left navigation rail ──────────────────────────────────────────────────
   Spec: patterns/left-nav.md. Every measurement below is from its
   "Verifying an implementation" table.                                       */

.rail {
  position: fixed; inset: 0 auto 0 0; z-index: 30;
  width: var(--nav-rail-width);
  height: 100vh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: var(--border-width) solid var(--border-subtle);
}

/* zone 1 — brand row: 72px INCLUDING its bottom border */
.rail__brand {
  flex: 0 0 auto;
  height: var(--nav-brand-height);
  padding: 0 20px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: var(--border-width) solid var(--border-subtle);
}
.rail__logo { height: 30px; width: auto; max-width: 150px; display: block; }
.rail__wordmark { font-family: var(--font-heading); font-size: 17px; font-weight: 600; color: var(--text-heading); letter-spacing: -0.01em; }

/* zone 2 — nav list: fills, scrolls */
.rail__nav { flex: 1 1 auto; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 2px; }

.navitem {
  display: flex; align-items: center; gap: 10px;
  height: var(--nav-item-height);
  padding: 10px 12px;
  border: 0; border-radius: var(--radius-sm);
  background: none; width: 100%; text-align: left; cursor: pointer;
  font-family: var(--font-body);
  font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); font-weight: 600;
  color: var(--text-body);
  /* colour only — never size, position or shadow */
  transition: color 120ms ease, background-color 120ms ease;
}
.navitem__icon { width: var(--nav-icon-size); height: var(--nav-icon-size); flex: none; display: block; }
.navitem__label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.navitem:hover { background: var(--accent-surface); color: var(--text-heading); }
/* hover and active share a background — only the text colour differs, so
   hovering the item you are already on produces no visible change */
.navitem[aria-current="page"] { background: var(--accent-surface); color: var(--accent-foreground); }

.navitem__badge {
  min-width: 22px; padding: 2px 6px; border-radius: 999px;
  font-family: var(--font-body); font-size: 11px; line-height: 16px; font-weight: 700;
  text-align: center;
  background: var(--accent-fill); color: var(--accent-on);
}
.navitem__dot { width: 8px; height: 8px; border-radius: 999px; background: var(--attention); flex: none; }

/* zone 3 — account footer */
.rail__account {
  flex: 0 0 auto;
  padding: 12px;
  border-top: var(--border-width) solid var(--border-subtle);
  display: flex; align-items: center; gap: 8px;
}
.rail__who { min-width: 0; flex: 1 1 auto; padding: 0 4px; }
.rail__name {
  font-size: var(--text-caption); line-height: var(--text-caption-line); font-weight: 600;
  color: var(--text-heading);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rail__email {
  font-size: var(--text-caption); line-height: var(--text-caption-line); font-weight: 400;
  color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rail__signout {
  width: 32px; height: 32px; flex: none;
  display: grid; place-items: center;
  border: 0; border-radius: 6px; background: none; cursor: pointer;
  color: var(--text-muted);
  transition: color 120ms ease, background-color 120ms ease;
}
.rail__signout:hover { background: var(--accent-surface); color: var(--text-heading); }
.rail__signout svg { width: 16px; height: 16px; display: block; }

/* brand switcher sits above the nav list, not in the footer — the footer
   answers only "who am I" and "how do I leave" */
.rail__brands { padding: 12px 12px 0; display: flex; flex-direction: column; gap: 2px; }
.brandpick { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--border-subtle); background: var(--surface);
  cursor: pointer; padding: 5px 10px; border-radius: 999px;
  font-size: var(--text-caption); line-height: var(--text-caption-line); font-weight: 600;
  color: var(--text-body);
  transition: color 120ms ease, background-color 120ms ease, border-color 120ms ease;
}
.chip i { width: 8px; height: 8px; border-radius: 999px; display: block; flex: none; }
.chip:hover { background: var(--accent-surface); color: var(--text-heading); }
.chip[aria-pressed="true"] { background: var(--accent-surface); color: var(--accent-foreground); border-color: var(--accent-fill); }
.chip__note { font-family: var(--font-mono); font-size: 9.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* ── page header ───────────────────────────────────────────────────────────
   Calm by construction: one title, one short line, then the work. Detail
   lives in tooltips and the How to use guide, not in paragraphs on screen.  */

.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; flex-wrap: wrap; margin-bottom: 28px; }
.pagehead h1 { margin-bottom: 2px; }
.pagehead__sub { margin: 0; font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-body); max-width: 70ch; }

.backlink {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 10px; padding: 0;
  border: 0; background: none; cursor: pointer;
  font-family: var(--font-body); font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); font-weight: 600;
  color: var(--text-body);
}
.backlink::before { content: ""; width: 7px; height: 7px; border-left: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(45deg); }
.backlink:hover { color: var(--text-heading); }

.section-title { margin: 0 0 16px; font-family: var(--font-heading); font-size: var(--text-h4); line-height: var(--text-h4-line); font-weight: 600; color: var(--text-heading); display: flex; align-items: baseline; }
.section-title__n { margin-left: 10px; font-family: var(--font-body); font-size: var(--text-body-sm); font-weight: 500; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ── buttons & quiet links ─────────────────────────────────────────────────*/

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-heading);
  cursor: pointer; padding: 9px 18px; border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); font-weight: 600;
  white-space: nowrap;
  transition: color 120ms ease, background-color 120ms ease, border-color 120ms ease;
}
.btn:hover { background: var(--surface-raised); }
.btn--primary { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--accent-on); }
.btn--primary:hover { background: var(--accent-fill-hover); border-color: var(--accent-fill-hover); }
.btn--ghost { background: none; border-color: transparent; color: var(--text-body); }
.btn--ghost:hover { background: var(--accent-surface); color: var(--text-heading); }
.btn--sm { padding: 6px 14px; font-size: var(--text-caption); line-height: var(--text-caption-line); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.linkbtn {
  display: inline; padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-weight: 600; color: var(--accent-foreground);
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
}
.linkbtn:hover { text-decoration-thickness: 2px; }
.linkbtn[disabled] { opacity: 0.5; cursor: default; }
.quietlink { display: inline-block; margin-top: 14px; font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); font-weight: 600; color: var(--accent-foreground); text-underline-offset: 3px; }
.quiet { margin: 18px 0 0; font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-body); }
.gen-progress { margin: 0; font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-body); }
.empty .gen-progress { margin-top: 12px; }

/* kept for the stat grid the guide screenshots may still show */
.strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat { background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--radius); padding: 16px 18px; }
.stat b { display: block; font-family: var(--font-heading); font-size: var(--text-h3); line-height: var(--text-h3-line); font-weight: 600; color: var(--text-heading); font-variant-numeric: tabular-nums; }
.stat span { display: block; margin-top: 2px; font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-muted); }

/* ── controls: audience switch, filters, one-line banners ──────────────────
   The audience switch is the one place the brand accent marks a choice on
   the page. Filters are compact selects that read as their own label
   ("All content types"); one that is set picks up the accent tint.         */

.seg {
  display: flex; flex-wrap: wrap; gap: 2px; width: fit-content; max-width: 100%;
  margin: 0 0 20px; padding: 4px;
  background: var(--surface); border: 1px solid var(--border-subtle); border-radius: 999px;
}
.seg--inline { margin: 0; }
.seg__opt {
  display: inline-flex; align-items: center; padding: 6px 16px; border: 0; border-radius: 999px;
  background: none; cursor: pointer;
  font-family: var(--font-body); font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); font-weight: 500;
  color: var(--text-body);
  transition: color 120ms ease, background-color 120ms ease;
}
.seg__opt:hover { color: var(--text-heading); }
.seg__opt[aria-pressed="true"] { background: var(--accent-surface); color: var(--accent-foreground); font-weight: 600; }
.seg__n { margin-left: 8px; font-size: var(--text-caption); font-weight: 500; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.seg__opt[aria-pressed="true"] .seg__n { color: var(--accent-foreground); }
.seg__draft { width: 6px; height: 6px; margin-left: 8px; border-radius: 999px; background: var(--attention); flex: none; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; margin: 0 0 14px; }
.toolbar__filters { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; }
.results { margin: 0; font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-body); font-variant-numeric: tabular-nums; }

.select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  height: 36px; max-width: 260px; padding: 0 34px 0 14px;
  background: var(--surface)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%23767676' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    no-repeat right 12px center;
  border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: var(--text-body-sm); color: var(--text-body);
  transition: border-color 120ms ease, background-color 120ms ease;
}
.select:hover { border-color: var(--border-strong); }
.select.is-set { border-color: var(--accent-fill); background-color: var(--accent-surface); color: var(--text-heading); }
.select:focus { outline: none; border-color: var(--accent-fill); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-fill) 30%, transparent); }

.banner {
  display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; width: fit-content; max-width: 100%;
  margin: 0 0 16px; padding: 8px 14px;
  background: var(--surface); border: 1px solid var(--border-subtle); border-radius: 999px;
  font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-body);
}
.banner::before { content: ""; width: 7px; height: 7px; border-radius: 999px; background: var(--attention); flex: none; }

.info {
  display: inline-grid; place-items: center; width: 18px; height: 18px; padding: 0; margin-left: 6px;
  border: 0; border-radius: 999px; background: none; cursor: pointer; color: var(--text-muted); vertical-align: middle;
}
.info:hover { color: var(--text-heading); }
.info svg, .row__reach svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; display: block; }

/* ── library list ──────────────────────────────────────────────────────────
   A list, not a grid of cards: hairlines between rows, one caption line,
   quiet tags. The multiple is the one number set large.                    */

.list, .card {
  background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--radius); overflow: hidden;
}

.row {
  display: grid; grid-template-columns: minmax(0, 1fr) 92px 172px 124px 84px;
  gap: 24px; align-items: center;
  padding: 16px 24px; border-top: 1px solid var(--border-subtle);
  background: var(--surface); cursor: pointer; width: 100%; text-align: left;
  transition: background-color 120ms ease;
}
.row:first-child { border-top: 0; }
.row:hover { background: color-mix(in srgb, var(--surface-raised) 65%, var(--surface)); }
.row:focus-visible { outline-offset: -3px; }
.row--head {
  padding-top: 12px; padding-bottom: 12px; cursor: default;
  font-size: var(--text-caption); line-height: var(--text-caption-line); font-weight: 500; color: var(--text-muted);
}
.row--head:hover { background: var(--surface); }
.row--head > div { white-space: nowrap; }
.row--head .row__num { font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-muted); }
.row--head + .row { border-top: 1px solid var(--border-subtle); }

.row__post { min-width: 0; }
.row__acct { display: flex; align-items: baseline; gap: 4px 14px; flex-wrap: wrap; }
.row__handle { font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); font-weight: 600; color: var(--text-heading); }
.row__tags { display: inline-flex; gap: 12px; flex-wrap: wrap; font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-muted); }
.row__done { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-caption); line-height: var(--text-caption-line); font-weight: 600; color: color-mix(in srgb, var(--success) 80%, #000); }
.row__done::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: var(--success); }
.row__cap {
  margin-top: 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-muted);
}
.row__num { text-align: right; font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-body); font-variant-numeric: tabular-nums; }
.row__x { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.row--head .row__x { flex-direction: row; align-items: center; gap: 0; }
.row__reach { display: flex; justify-content: flex-end; gap: 14px; }
.row__reach span { display: inline-flex; align-items: center; gap: 5px; }
.row__reach svg { color: var(--text-muted); }

.mult { font-family: var(--font-heading); font-size: 20px; line-height: 26px; font-weight: 600; letter-spacing: -0.01em; color: var(--text-heading); font-variant-numeric: tabular-nums; }

/* Library context: age, baseline, relevance, and the arithmetic behind a multiple. */
.row__age { font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-muted); }
.row__base { display: block; margin-top: 2px; font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.row__rel { display: inline-flex; align-items: center; gap: 5px; font-size: var(--text-caption); line-height: var(--text-caption-line); font-weight: 600; color: var(--text-body); }
.row__rel::before { content: ""; width: 7px; height: 7px; border-radius: 999px; border: 1.5px solid currentColor; }
.row__rel--high { color: var(--success); }
.row__rel--high::before { background: currentColor; }
.row__rel--medium::before { background: linear-gradient(90deg, currentColor 50%, transparent 50%); }
.row__rel--low { color: var(--text-muted); }
.mult--btn { padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer;
  text-decoration: underline dotted; text-decoration-color: var(--border-strong); text-underline-offset: 4px; }
.mult--btn:hover, .mult--btn[aria-expanded="true"] { text-decoration-color: currentColor; }
.row__calc { grid-column: 1 / -1; margin-top: 4px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-sunken);
  font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-heading); cursor: default; }
.calc__line { margin: 0; font-variant-numeric: tabular-nums; }
.calc__note { margin: 6px 0 0; font-size: var(--text-caption); line-height: var(--text-caption-line); color: color-mix(in srgb, var(--attention) 62%, #000); }
.metrics__sub { display: block; font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-muted); font-weight: 400; }
.srccard__rel { margin: 12px 0 0; font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-body); }
.row__post:focus-visible { outline-offset: 2px; border-radius: var(--radius-sm); }

/* Performance levels — always a word with a small dot; never colour alone. */
.lvl { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-body); font-size: var(--text-caption); line-height: 16px; font-weight: 600; white-space: nowrap; color: var(--text-body); }
.lvl::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; flex: none; }
.lvl--breakout { color: color-mix(in srgb, var(--success) 80%, #000); }
.lvl--above { color: color-mix(in srgb, var(--success) 80%, #000); }
.lvl--above::before { background: none; box-shadow: inset 0 0 0 1.5px currentColor; }
.lvl--low_volume { color: color-mix(in srgb, var(--attention) 62%, #000); }

/* ── why it worked ─────────────────────────────────────────────────────────
   The source on the left, the reasons on the right: one summary sentence, then
   seven one-line rows that open to their evidence. Nothing is open by default. */

.whypage { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 48px; align-items: start; }
.whypage__main { min-width: 0; }

.srccard { position: sticky; top: 24px; background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--radius); overflow: hidden; }
.srccard__cover { display: block; width: 100%; max-height: 320px; object-fit: cover; background: var(--surface-sunken); }
.srccard__body { padding: 22px 24px 24px; }
.srccard__acct { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: var(--text-caption); color: var(--text-muted); }
.srccard__acct b { font-family: var(--font-heading); font-size: var(--text-h4); line-height: var(--text-h4-line); font-weight: 600; color: var(--text-heading); }
.srccard__cap {
  margin: 12px 0 0; white-space: pre-wrap; font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-body);
  display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden;
}
.srccard__cap.is-open { display: block; -webkit-line-clamp: unset; }
.srccard__aud { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border-subtle); font-size: var(--text-caption); color: var(--text-muted); }
.metrics { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 12px; margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--border-subtle); }
.metrics dt { font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-muted); }
.metrics dd { margin: 2px 0 0; display: flex; flex-direction: column; gap: 2px; font-family: var(--font-heading); font-size: 18px; line-height: 24px; font-weight: 600; color: var(--text-heading); font-variant-numeric: tabular-nums; }

.why__summary { margin: 0 0 6px; max-width: 34ch; font-family: var(--font-heading); font-size: 24px; line-height: 33px; font-weight: 600; letter-spacing: -0.01em; color: var(--text-heading); }
.why__summary--waiting { color: var(--text-muted); font-weight: 500; }
.why__conf { display: inline-flex; align-items: center; gap: 8px; margin: 4px 0 0; font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-body); }
.why__conf-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--attention); flex: none; }
.why__error { margin: 8px 0 0; display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; font-size: var(--text-body-sm); color: var(--text-body); }
.why__error p { margin: 0; }

.dimlist { margin-top: 22px; border-top: 1px solid var(--border-subtle); }
.dim { border-bottom: 1px solid var(--border-subtle); }
.dim__row {
  display: grid; grid-template-columns: 136px minmax(0, 1fr) 18px; gap: 16px; align-items: baseline;
  width: 100%; padding: 13px 4px; border: 0; background: none; cursor: pointer; text-align: left;
  font: inherit; color: inherit; transition: background-color 120ms ease;
}
.dim__row:hover { background: color-mix(in srgb, var(--surface-raised) 55%, transparent); }
.dim__row--flat { cursor: default; }
.dim__row--flat:hover { background: none; }
.dim__label { font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-muted); }
.dim__value { min-width: 0; font-size: 16px; line-height: 24px; font-weight: 600; color: var(--text-heading); }
.dim__value--wait { color: var(--border-strong); font-weight: 400; }
.dim__fixed { margin-left: 8px; font-size: var(--text-caption); font-weight: 500; color: var(--text-muted); }
.why__basis { margin: 6px 0 0; font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-muted); }
.dim__inferred { margin-left: 6px; font-size: var(--text-caption); font-weight: 600; font-style: italic; color: var(--text-muted); }
.dim__chev { align-self: center; color: var(--text-muted); transition: transform 160ms ease; }
.dim__chev svg { width: 16px; height: 16px; display: block; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.dim__row[aria-expanded="true"] .dim__chev { transform: rotate(180deg); }
.dim__body { padding: 0 4px 16px 156px; }
.dim__quote { margin: 0 0 6px; font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-heading); max-width: 64ch; }
.dim__why { margin: 0; font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-body); max-width: 64ch; }
.dim__note { margin: 6px 0 0; font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-muted); }
.dim__fix { margin-top: 10px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: var(--text-caption); }
.dim__fixform { display: inline-flex; align-items: center; gap: 8px; }
.dim__body .anat { margin-top: 14px; }
.dim__body .split { margin-top: 4px; }

.anat { list-style: none; margin: 0; padding: 0 0 0 22px; border-left: 1px solid var(--border-subtle); }
.beat { position: relative; padding: 0 0 20px; }
.beat:last-child { padding-bottom: 2px; }
.beat::before { content: ""; position: absolute; left: -26px; top: 9px; width: 7px; height: 7px; border-radius: 999px; background: var(--accent-fill); box-shadow: 0 0 0 4px var(--surface-alt); }
.beat__head { display: flex; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; }
.beat__label { font-family: var(--font-heading); font-size: 15px; line-height: 22px; font-weight: 600; color: var(--text-heading); }
.beat__type { font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-muted); }
.beat__stamp { margin-left: auto; font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.beat__span { margin: 4px 0 0; font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-heading); }
.beat__note { margin: 2px 0 0; font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-body); max-width: 64ch; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.slab { padding: 16px 20px; background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--radius); }
.slab h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; font-family: var(--font-heading); font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); font-weight: 600; color: var(--text-heading); }
.slab h3::before { content: ""; width: 7px; height: 7px; border-radius: 999px; flex: none; }
.slab--yes h3::before { background: var(--success); }
.slab--no h3::before { background: var(--danger-foreground); }
.slab ul { margin: 0; padding: 0; list-style: none; }
.slab li { padding: 7px 0; border-top: 1px solid var(--border-subtle); font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-body); }
.slab li:first-child { border-top: 0; }

/* ── the test planner ─────────────────────────────────────────────────────
   One sentence of selects, then the variants it will write as chips a person
   can remove or add — the plan is visible and editable before anything is spent. */

.gen { margin-top: 28px; padding: 22px 24px; background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--radius); }
.gen--closed { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 18px; }
.gen__hint { font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-muted); }
.gen__sentence { margin: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; font-size: 16px; line-height: 26px; color: var(--text-heading); }
.select--inline { height: 34px; max-width: none; padding-right: 30px; font-weight: 600; color: var(--text-heading); }
.select--sm { height: 30px; padding: 0 28px 0 10px; font-size: var(--text-caption); background-position: right 9px center; }
.gen__arms { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.armchip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 6px 5px 12px; border-radius: 999px;
  background: var(--surface-alt); border: 1px solid var(--border-subtle);
  font-size: var(--text-caption); line-height: var(--text-caption-line); font-weight: 500; color: var(--text-heading);
}
.armchip--src { border-color: var(--accent-fill); }
.armchip__l { font-weight: 700; color: var(--accent-foreground); font-variant-numeric: tabular-nums; }
.armchip__src { color: var(--text-muted); font-weight: 400; }
.armchip__x { width: 22px; height: 22px; display: grid; place-items: center; border: 0; border-radius: 999px; background: none; cursor: pointer; font-size: 15px; line-height: 1; color: var(--text-muted); }
.armchip__x:hover { background: var(--accent-surface); color: var(--text-heading); }
.armchip:not(:has(.armchip__x)) { padding-right: 12px; }
.gen__go { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; margin-top: 18px; }
.gen__note { margin: 12px 0 0; font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-body); }

/* ── tests ────────────────────────────────────────────────────────────────
   A test reads as one unit: what it varies, what it keeps, its variants in
   letter order. Variants that did not surface wait behind one line. */

#td-tests > .section-title { margin-top: 56px; }
.test { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--border-subtle); }
.test:first-of-type { border-top: 0; padding-top: 0; }
.test__head { display: flex; align-items: baseline; gap: 6px 16px; flex-wrap: wrap; }
.test__title { margin: 0; font-family: var(--font-heading); font-size: var(--text-h4); line-height: var(--text-h4-line); font-weight: 600; color: var(--text-heading); }
.test__n { font-family: var(--font-body); font-size: var(--text-body-sm); font-weight: 500; color: var(--text-muted); }
.test__tally { margin-left: auto; font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-body); font-variant-numeric: tabular-nums; }
.test__toggle { font-size: var(--text-body-sm); }
.test--closed .test__tally { margin-left: 0; color: var(--text-muted); }
.test--closed .test__toggle { margin-left: auto; }
.test__line { margin: 6px 0 0; font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-body); }
.test__keep { margin: 6px 0 0; padding-left: 20px; font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-body); }
.test__q { margin: 4px 0 18px; font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-muted); max-width: 72ch; }
.test__hidden { margin-top: 16px; font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-muted); }
.test__hidden p { display: inline; margin: 0 10px 0 0; }
.test__hidden .vgrid { margin-bottom: 12px; }

/* ── variant cards ────────────────────────────────────────────────────────
   Read top-down like the post it proposes. The tested element is marked; the
   scores open to one shared reason line; one accent fill (Approve) per card. */

.group { margin-bottom: 44px; }
.group__head { margin: 0 0 16px; font-family: var(--font-heading); font-size: var(--text-h4); line-height: var(--text-h4-line); font-weight: 600; color: var(--text-heading); display: flex; align-items: baseline; }
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 20px; align-items: stretch; }

.vcard { display: flex; flex-direction: column; padding: 20px 22px 18px; background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--radius); min-width: 0; }
.vcard[aria-busy="true"] { opacity: 0.72; }
.vcard__head { display: flex; align-items: baseline; gap: 6px 12px; flex-wrap: wrap; }
.vcard__arm { font-family: var(--font-heading); font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); font-weight: 600; color: var(--accent-foreground); text-decoration: none; }
a.vcard__arm:hover { text-decoration: underline; text-underline-offset: 3px; }
.vcard__src { font-family: var(--font-body); font-weight: 400; color: var(--text-muted); }
.vcard__format { margin-left: auto; font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-muted); }
.vstate { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-caption); line-height: var(--text-caption-line); font-weight: 600; color: var(--text-body); }
.vstate::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: var(--text-muted); flex: none; }
.vstate--held, .vstate--edited { color: color-mix(in srgb, var(--attention) 62%, #000); }
.vstate--held::before, .vstate--edited::before { background: var(--attention); }
.vstate--blocked { color: var(--danger-foreground); }
.vstate--blocked::before { background: var(--danger-foreground); }
.vstate--approved, .vstate--posted { color: color-mix(in srgb, var(--success) 80%, #000); }
.vstate--approved::before, .vstate--posted::before { background: var(--success); }
.vstate--rejected { color: var(--text-muted); }

.scorebar { display: flex; align-items: center; gap: 4px; margin-top: 14px; flex-wrap: wrap; }
.schip {
  display: inline-flex; flex-direction: column; align-items: flex-start; gap: 0; min-width: 0;
  padding: 4px 8px; border: 1px solid transparent; border-radius: var(--radius-sm); background: none; cursor: pointer;
  font: inherit; color: inherit; text-align: left; transition: background-color 120ms ease, border-color 120ms ease;
}
.schip:hover { background: var(--surface-alt); }
.schip[aria-expanded="true"] { border-color: var(--border-strong); background: var(--surface-alt); }
.schip__k { font-size: 12px; line-height: 16px; color: var(--text-muted); }
.schip__v { font-size: var(--text-body-sm); line-height: 20px; font-weight: 600; color: var(--text-heading); font-variant-numeric: tabular-nums; }
.schip--ring { padding: 2px; margin-right: 6px; border-radius: 999px; }
.ring { position: relative; width: 40px; height: 40px; display: block; }
.ring svg { display: block; }
.ring__val { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-heading); font-size: 13px; font-weight: 600; color: var(--text-heading); font-variant-numeric: tabular-nums; }
.vcard__why { margin: 10px 0 0; padding: 9px 12px; border-radius: var(--radius-sm); background: var(--surface-alt); font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-body); }
.vcard__why b { font-weight: 600; color: var(--text-heading); }

.vcard__overlay { margin: 16px 0 0; font-family: var(--font-heading); font-size: 18px; line-height: 26px; font-weight: 600; color: var(--text-heading); }
.vtabs { display: flex; gap: 2px; margin-top: 14px; border-bottom: 1px solid var(--border-subtle); }
.vtab {
  margin-bottom: -1px; padding: 6px 12px 8px; border: 0; border-bottom: 2px solid transparent; background: none; cursor: pointer;
  font-family: var(--font-body); font-size: var(--text-caption); line-height: var(--text-caption-line); font-weight: 600; color: var(--text-muted);
}
.vtab:hover { color: var(--text-heading); }
.vtab[aria-selected="true"] { color: var(--text-heading); border-bottom-color: var(--accent-fill); }
.vpanel-tab { min-width: 0; }
.vcard__caption {
  margin: 12px 0 0; white-space: pre-wrap; overflow-wrap: anywhere;
  font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-body);
  display: -webkit-box; -webkit-line-clamp: 7; -webkit-box-orient: vertical; overflow: hidden;
}
.vcard__caption.is-open { display: block; -webkit-line-clamp: unset; }
.cap__hook { font-family: var(--font-heading); font-weight: 600; color: var(--text-heading); }
.cap__cta { display: inline; box-shadow: inset 0 -0.45em 0 var(--accent-surface); color: var(--text-heading); }
.vcard__more { align-self: flex-start; margin-top: 6px; font-size: var(--text-caption); line-height: var(--text-caption-line); }
.vcard__tagrow { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-top: 12px; }
.vcard__tags { margin: 0; min-width: 0; font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-muted); word-spacing: 3px; overflow-wrap: anywhere; }
.copybtn {
  display: inline-flex; align-items: center; gap: 6px; flex: none; padding: 3px 8px; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
  background: var(--surface); cursor: pointer; font-family: var(--font-body); font-size: 12px; line-height: 18px; font-weight: 600; color: var(--text-body);
}
.copybtn:hover { border-color: var(--border-strong); color: var(--text-heading); }
.copybtn svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.vis { padding-top: 12px; font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-body); }
.vis__head { margin: 0 0 6px; font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-muted); }
.vis__steps { margin: 0; padding-left: 20px; }
.vis__steps li { margin-bottom: 6px; }
.vis__screen { display: block; color: var(--text-heading); }
.vis__cover { margin: 10px 0 10px; }
.vis__k { font-size: var(--text-caption); font-weight: 600; color: var(--text-muted); }
.vis__plain, .vis__none { margin: 0 0 10px; }
.vis__none { color: var(--text-muted); }

.vcard__source { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 12px 0 0; font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-muted); }
.vcard__note { margin: 12px 0 0; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--surface-raised); font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-heading); }
.vcard__note--held { background: var(--attention-bg); }
.vcard__note--blocked { background: var(--danger-surface); }
.vcard__result { margin: 8px 0 0; width: 100%; font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-body); }
.vcard__result b { color: var(--text-heading); }
.vcard__raw { margin-left: 6px; color: var(--text-muted); }
.vcard__busy { margin: 0; font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-body); }

.vcard__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px 12px; flex-wrap: wrap; margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border-subtle); }
.vcard__body + .vcard__foot, .vcard > .vcard__foot { margin-top: 16px; }
.vfoot__left { display: flex; gap: 14px; }
/* A held card can carry three buttons (Link evidence, Rewrite as general advice, Check facts): they wrap on a phone. */
.vcard__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-left: auto; min-width: 0; }
.vfoot__state { display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; width: 100%; font-size: var(--text-body-sm); }
.vfoot__state--ask { justify-content: space-between; }
.vfoot__end { margin-left: auto; }
.linkbtn--quiet { font-size: var(--text-caption); color: var(--text-body); text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); }
.linkbtn--quiet:hover { color: var(--text-heading); }
.decided { font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); font-weight: 600; }
.decided--approved { color: color-mix(in srgb, var(--success) 80%, #000); }
.decided--rejected { color: var(--text-muted); font-weight: 500; }

/* Reject / regenerate / posted panels take the footer's place. */
.vpanel { width: 100%; }
.rchips { margin: 0; padding: 0; border: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.rchips legend { width: 100%; margin: 0 0 8px; padding: 0; font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); font-weight: 600; color: var(--text-heading); }
.vpanel__opt { font-weight: 400; color: var(--text-muted); }
.rchip { position: relative; display: inline-flex; cursor: pointer; }
.rchip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rchip span {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border: 1px solid var(--border-subtle); border-radius: 999px;
  font-size: var(--text-caption); line-height: var(--text-caption-line); font-weight: 500; color: var(--text-body); background: var(--surface);
}
.rchip input:checked + span { border-color: var(--accent-fill); color: var(--text-heading); font-weight: 600; }
.rchip input:checked + span::before { content: "✓"; font-weight: 700; color: var(--accent-foreground); }
.rchip input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent-fill) 50%, transparent); outline-offset: 2px; }
.vpanel__notefield { display: block; margin-top: 10px; }
.vpanel__label { display: block; margin: 0 0 6px; font-size: var(--text-body-sm); font-weight: 600; color: var(--text-heading); }
.vpanel__foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.numgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.numfield { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--text-muted); }
.numfield .inp { height: 34px; }

/* ── facts ─────────────────────────────────────────────────────────────────*/

.fact { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) 190px; gap: 20px; align-items: center; padding: 14px 24px; border-top: 1px solid var(--border-subtle); background: var(--surface); }
.fact:first-child { border-top: 0; }
.fact__main { min-width: 0; }
.fact__claim { font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); font-weight: 600; color: var(--text-heading); }
.fact__src { margin-top: 2px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-muted); }
.fact__aud { margin-right: 10px; font-weight: 600; color: var(--text-body); }
.fact__input, .inp {
  width: 100%; height: 38px; padding: 0 12px;
  background: var(--surface-sunken); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: var(--text-body-sm); color: var(--text-heading);
}
.fact__input:focus, .inp:focus { border-color: var(--accent-fill); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-fill) 30%, transparent); }
.fact__action { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
/* Real jobs (Brand facts) and evidence on cards. */
.jobs__lead { margin-top: 28px; }
.job__summary { margin: 6px 0 0; font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-body); }
.job__links { margin: 4px 0 0; display: flex; gap: 12px; flex-wrap: wrap; }
.job__links .quietlink { margin-top: 0; }
.job .fact__action { flex-direction: column; align-items: flex-end; gap: 8px; }
.vcard__evidence { margin: 8px 0 0; font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-body); }
.vcard__evidence a { font-weight: 600; color: var(--accent-foreground); }
.drawer__quote { margin: 0; padding: 10px 12px; border-left: 3px solid var(--border-strong); background: var(--surface-sunken);
  font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-heading); }
.field--check { flex-direction: row; align-items: center; gap: 8px; font-size: var(--text-body-sm); color: var(--text-heading); }
.state { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-body); font-size: var(--text-caption); line-height: var(--text-caption-line); font-weight: 600; }
.state::before { content: ""; width: 6px; height: 6px; border-radius: 999px; }
.state--approved { color: color-mix(in srgb, var(--success) 80%, #000); } .state--approved::before { background: var(--success); }
.state--pending { color: color-mix(in srgb, var(--attention) 62%, #000); } .state--pending::before { background: var(--attention); }
.state--blocked { color: var(--text-muted); } .state--blocked::before { background: var(--text-muted); }

/* ── performance ───────────────────────────────────────────────────────────*/

.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin: 0 0 24px; background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--radius); overflow: hidden; }
.figures > div { padding: 20px 24px; border-left: 1px solid var(--border-subtle); }
.figures > div:first-child { border-left: 0; }
.figures dt { font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-muted); }
.figures dd { margin: 4px 0 0; font-family: var(--font-heading); font-size: 28px; line-height: 34px; font-weight: 600; color: var(--text-heading); font-variant-numeric: tabular-nums; }
.figures__of { font-family: var(--font-body); font-size: var(--text-body-sm); font-weight: 500; color: var(--text-muted); }
.teardown__read + *, .tablewrap + .section-title { margin-top: 40px; }

.acct { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 24px; border-top: 1px solid var(--border-subtle); }
.acct:first-child { border-top: 0; }
.acct__name { display: flex; align-items: baseline; gap: 10px; font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); font-weight: 600; color: var(--text-heading); }
.acct__name span { font-weight: 400; color: var(--text-muted); }
.acct__why { font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-muted); }
.acct__why--fix { font-weight: 600; color: color-mix(in srgb, var(--attention) 62%, #000); }

/* ── tables, empty states, toasts ──────────────────────────────────────────*/

.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--radius); }
.ttable { width: 100%; border-collapse: collapse; min-width: 520px; font-size: var(--text-body-sm); }
.ttable th {
  text-align: left; padding: 12px 16px 12px 24px;
  font-size: var(--text-caption); line-height: var(--text-caption-line); font-weight: 500; color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
}
.ttable td { padding: 12px 16px 12px 24px; vertical-align: top; border-bottom: 1px solid color-mix(in srgb, var(--border-subtle) 55%, transparent); color: var(--text-body); }
.ttable tr:last-child td { border-bottom: 0; }
.ttable td:first-child { font-weight: 600; color: var(--text-heading); }
/* Performance: the period, where the numbers come from, and each account's status. */
.perf-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.perf-period { margin: 0; font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-body); font-variant-numeric: tabular-nums; }
.perf-from { margin: 10px 0 18px; font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-muted); }
.ttable td.is-missing { color: var(--text-muted); }
.acct-table { margin-bottom: 8px; }
.acct-status { font-weight: 600; color: var(--text-heading); }
.acct-reason { min-width: 200px; font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-body); }
.ttable td.num, .ttable th.num { text-align: right; font-variant-numeric: tabular-nums; }
.ttable__empty { color: var(--text-muted); font-weight: 400 !important; }

.callout { margin-top: 20px; padding: 16px 20px; background: var(--surface); border: 1px solid var(--border-subtle); border-left: 4px solid var(--accent-fill); border-radius: var(--radius-sm); font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-body); max-width: var(--measure); }
.callout b { color: var(--text-heading); }
.callout--warn { border-left-color: var(--attention); background: var(--attention-bg); }

.empty { padding: 56px 24px; text-align: center; background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--radius); color: var(--text-body); font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); }
.empty__title { margin: 0 0 6px; font-family: var(--font-heading); font-size: 18px; line-height: 26px; font-weight: 600; color: var(--text-heading); }
.empty__text { margin: 0 auto 20px; max-width: 48ch; color: var(--text-body); }
.empty__title + .btn { margin-top: 14px; }
.footnote { margin: 18px 0 0; font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-body); max-width: var(--measure); }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 80; max-width: 380px; padding: 12px 18px; background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08); font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-heading); display: flex; align-items: center; gap: 10px; }
.toast::before { content: ""; width: 7px; height: 7px; border-radius: 999px; background: var(--accent-fill); flex: none; }
.toast--bad::before { background: var(--danger-foreground); }
.toast--good::before { background: var(--success); }

/* ── docs tab ──────────────────────────────────────────────────────────────
   Spec: patterns/docs-tab.md — 248px rail, 20px gap, sticky 32px.           */

.docs { display: grid; grid-template-columns: var(--section-rail-width) minmax(0, 1fr); gap: 20px; align-items: start; }
.docs__rail {
  position: sticky; top: 32px;
  background: var(--surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius); box-shadow: var(--card-shadow);
  padding: 8px; display: flex; flex-direction: column; gap: 2px;
}
.docs__entry {
  display: block; width: 100%; text-align: left;
  padding: 8px 12px;                    /* 8 + 24 line box + 8 = 40px */
  border: 0; border-radius: var(--radius-sm); background: none; cursor: pointer;
  font-family: var(--font-body); font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); font-weight: 600;
  color: var(--text-body);
  transition: color 120ms ease, background-color 120ms ease;
}
.docs__entry:hover { background: var(--accent-surface); color: var(--text-heading); }
.docs__entry[aria-current="true"] { background: var(--accent-surface); color: var(--accent-foreground); }

.docs__panel { background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--radius); box-shadow: var(--card-shadow); padding: 24px; min-width: 0; }
.docs__title { font-size: var(--text-h3); line-height: var(--text-h3-line); font-weight: 600; color: var(--text-heading); }
.docs__summary { margin: 4px 0 0; font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-body); max-width: 70ch; }
.docs__divider { border: 0; border-top: 1px solid var(--border-subtle); margin: 16px 0 0; }
.docs__blocks { display: flex; flex-direction: column; gap: 16px; margin-top: 16px; }

/* the six block kinds, and no more */
.blk-heading { font-family: var(--font-heading); font-size: var(--text-h4); line-height: var(--text-h4-line); font-weight: 600; color: var(--text-heading); margin: 8px 0 0; }
.blk-paragraph { margin: 0; font-size: var(--text-body-size); line-height: var(--text-body-line); color: var(--text-body); max-width: var(--measure); }
.blk-list, .blk-steps { margin: 0; padding-left: 20px; max-width: var(--measure); font-size: var(--text-body-size); line-height: var(--text-body-line); color: var(--text-body); }
.blk-list li, .blk-steps li { margin-bottom: 6px; }
.blk-list li:last-child, .blk-steps li:last-child { margin-bottom: 0; }
.blk-table { overflow-x: auto; }
.blk-table table { width: 100%; min-width: 520px; border-collapse: collapse; font-size: var(--text-body-sm); }
.blk-table th { text-align: left; padding: 8px 16px 8px 0; font-size: var(--text-caption); line-height: var(--text-caption-line); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); border-bottom: 1px solid var(--border-subtle); }
.blk-table td { padding: 8px 16px 8px 0; vertical-align: top; border-bottom: 1px solid color-mix(in srgb, var(--border-subtle) 55%, transparent); color: var(--text-body); }
.blk-table td:first-child { font-weight: 600; color: var(--text-heading); }
.blk-note { padding: 14px 18px; border-radius: var(--radius-sm); border: 1px solid var(--border-subtle); border-left: 4px solid var(--text-muted); background: var(--surface-raised); max-width: var(--measure); }
.blk-note__title { font-family: var(--font-heading); font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); font-weight: 600; color: var(--text-heading); margin-bottom: 4px; }
.blk-note__body { margin: 0; font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-body); }
.blk-note--info { border-left-color: var(--accent-fill); background: var(--accent-surface); }
.blk-note--caution { border-left-color: var(--attention); background: var(--attention-bg); }
.blk-note--danger { border-left-color: var(--danger-foreground); background: var(--danger-surface); }
.blk-note--success { border-left-color: var(--success); background: var(--success-bg); }
.blk-figure { margin: 0; }
.blk-figure img { display: block; width: 100%; height: auto; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); background: var(--surface-sunken); }
.blk-figure figcaption { margin-top: 8px; font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-muted); }

/* ── drawer (edit a variant, add a post) ─────────────────────────────────── */

body.has-drawer { overflow: hidden; }
.drawer-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(15, 18, 24, 0.28); }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 71; width: min(560px, 100vw);
  display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--border-subtle);
  box-shadow: -18px 0 48px rgba(0, 0, 0, 0.10);
}
.drawer__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 24px; border-bottom: 1px solid var(--border-subtle); }
.drawer__head h2 { font-size: var(--text-h4); line-height: var(--text-h4-line); font-weight: 600; }
.drawer__x { width: 32px; height: 32px; border: 0; border-radius: 6px; background: none; cursor: pointer; font-size: 22px; line-height: 1; color: var(--text-muted); }
.drawer__x:hover { background: var(--accent-surface); color: var(--text-heading); }
.drawer__body { flex: 1 1 auto; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.drawer__foot { padding: 14px 24px 18px; border-top: 1px solid var(--border-subtle); }
.drawer__warn { margin: 0 0 10px; font-size: var(--text-caption); line-height: var(--text-caption-line); color: color-mix(in srgb, var(--attention) 62%, #000); }
.drawer__error { margin: 0 0 10px; font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--danger-foreground); }
.drawer__actions, .drawer__confirm { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; font-size: var(--text-body-sm); color: var(--text-heading); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); font-weight: 600; color: var(--text-heading); }
.field__hint { font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-muted); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; }
.field-row .select { max-width: none; width: 100%; }
.field-group { border-top: 1px solid var(--border-subtle); padding-top: 12px; }
.field-group > summary { cursor: pointer; font-size: var(--text-body-sm); font-weight: 600; color: var(--text-heading); }
.field-group[open] > summary { margin-bottom: 12px; }
.field-group > .field + .steps-edit { margin-top: 14px; }
.inp--area { height: auto; padding: 10px 12px; line-height: var(--text-body-sm-line); resize: vertical; }
.steps-edit { display: flex; flex-direction: column; gap: 12px; margin-bottom: 8px; }
.step-edit { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: start; }
.step-edit__n { padding-top: 9px; font-size: var(--text-caption); font-weight: 700; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.step-edit__fields { display: flex; flex-direction: column; gap: 6px; }
.step-edit .inp { height: auto; min-height: 36px; padding: 8px 10px; }
.step-edit .linkbtn { padding-top: 8px; font-size: var(--text-caption); }

/* ── what works ───────────────────────────────────────────────────────────
   Rows, not tables: a word, the numbers, a bar beside them — never a rate
   without its count. */

.works { margin-top: 32px; }
.works:first-of-type { margin-top: 8px; }
.works__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.works__head .section-title { margin-bottom: 10px; }
.works__n { font-size: var(--text-body-sm); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.works__sub { margin: 14px 0 6px; font-family: var(--font-body); font-size: var(--text-caption); line-height: var(--text-caption-line); font-weight: 600; color: var(--text-muted); }
.wlist { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--radius); }
.wrow { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 120px; gap: 6px 16px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--border-subtle); }
.wrow:first-child { border-top: 0; }
.wrow__label { font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); font-weight: 600; color: var(--text-heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wrow__label--wide { font-weight: 500; }
.wrow__val { font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-body); font-variant-numeric: tabular-nums; }
.wrow__val--muted { color: var(--text-muted); }
.wrow__note { grid-column: 1 / -1; margin-top: -4px; font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-muted); }
.bar { display: block; height: 6px; border-radius: 999px; background: var(--surface-raised); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: var(--accent-fill); }
.works__line { margin: 12px 0 0; font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-body); }
.works__fine { margin: 8px 0 0; font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-muted); }
.works__cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* Library: what has been done with a post, and the hand-added route. */
.toolbar__end { display: flex; align-items: center; gap: 14px; }
.row__analyzed { font-size: var(--text-caption); line-height: var(--text-caption-line); font-weight: 600; color: var(--text-body); }
.empty__actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
a.navitem { text-decoration: none; }

/* ── welcome and guided tour ───────────────────────────────────────────────
   tour.js. Both sit above everything, the drawer included. The tour's
   spotlight is one element whose shadow dims the rest of the screen; its glide
   from one target to the next is the only motion. */

.welcome-backdrop {
  position: fixed; inset: 0; z-index: 90; overflow-y: auto;
  display: grid; place-items: center; padding: 16px;
  background: rgba(15, 18, 24, 0.5);
}
.welcome {
  width: min(500px, 100%);
  padding: 30px 32px 24px;
  background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--radius);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
  animation: tour-rise 220ms ease-out;
}
.welcome__mark { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; font-family: var(--font-heading); font-size: 17px; line-height: 24px; font-weight: 600; color: var(--text-heading); }
.welcome__logo { display: block; height: 28px; width: auto; }
.welcome__title { font-size: var(--text-h3); line-height: var(--text-h3-line); font-weight: var(--text-h3-weight); }
.welcome__lead { margin: 6px 0 18px; color: var(--text-body); }
.welcome__loop { list-style: none; margin: 0 0 18px; padding: 0; border-bottom: 1px solid var(--border-subtle); }
.welcome__loop li { display: grid; grid-template-columns: 108px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-top: 1px solid var(--border-subtle); }
.welcome__loop b { font-weight: 600; color: var(--text-heading); }
.welcome__nb, .tour__nb { white-space: nowrap; }
.welcome__guide { margin: 0; color: var(--text-body); }
.welcome__guide a { font-weight: 600; text-underline-offset: 3px; }
.welcome__foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 16px; margin-top: 26px; }
.welcome__time { font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-muted); }
.welcome__actions { display: flex; gap: 10px; margin-left: auto; }

.tour { --tour-ease: cubic-bezier(0.2, 0.7, 0.2, 1); position: fixed; inset: 0; z-index: 90; }
.tour__shield { position: absolute; inset: 0; }
.tour__spot {
  position: fixed; left: 50%; top: 50%; width: 0; height: 0;
  border-radius: var(--radius); pointer-events: none;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 5px color-mix(in srgb, var(--accent-fill) 85%, transparent),
    0 0 0 200vmax rgba(15, 18, 24, 0.5);
}
.tour__spot--none { box-shadow: 0 0 0 200vmax rgba(15, 18, 24, 0.5); }
.tour__card {
  position: fixed; left: 0; top: 0;
  width: min(380px, calc(100vw - 32px));
  padding: 18px 20px 14px;
  background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--radius);
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.24);
  animation: tour-rise 220ms ease-out;
}
.tour--glide .tour__spot { transition: left 280ms var(--tour-ease), top 280ms var(--tour-ease), width 280ms var(--tour-ease), height 280ms var(--tour-ease); }
.tour--glide .tour__card { transition: left 280ms var(--tour-ease), top 280ms var(--tour-ease); }
.tour__meta { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: var(--text-caption); line-height: var(--text-caption-line); }
.tour__chapter { font-weight: 600; color: var(--accent-foreground); }
.tour__count { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.tour__progress { height: 2px; margin: 8px 0 14px; border-radius: 999px; background: var(--surface-raised); overflow: hidden; }
.tour__progress > span { display: block; width: 0; height: 100%; border-radius: 999px; background: var(--accent-fill); transition: width 280ms ease; }
.tour__title { font-size: var(--text-h4); line-height: var(--text-h4-line); font-weight: 600; }
.tour__body { margin-top: 6px; font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-body); }
.tour__body p { margin: 0; }
.tour__steps { margin: 2px 0 0; padding-left: 20px; }
.tour__steps li + li { margin-top: 4px; }
.tour__body .tour__fine { margin-top: 10px; font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-muted); }
.tour__card[aria-busy="true"] .tour__title, .tour__card[aria-busy="true"] .tour__body { opacity: 0.55; }
.tour__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.tour__nav { display: flex; gap: 8px; }
/* Phones: the card is a sheet along the bottom, and the spotlight sits above it. */
.tour__card--sheet { left: 12px; right: 12px; top: auto; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); width: auto; max-height: 56vh; overflow-y: auto; }
@keyframes tour-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (max-width: 480px) {
  .welcome { padding: 24px 20px 20px; }
  .welcome__loop li { grid-template-columns: 96px minmax(0, 1fr); }
}

/* ── responsive ────────────────────────────────────────────────────────────*/

@media (max-width: 1180px) {
  .whypage { grid-template-columns: 1fr; gap: 28px; }
  .srccard { position: static; }
  .split { grid-template-columns: 1fr; }
  .vgrid { grid-template-columns: 1fr; }
  /* Rows stack from here: the post takes the full width, the numbers sit
     beneath it in two columns, and the header row no longer lines up. */
  .row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; }
  .row__post { grid-column: 1 / -1; }
  .row--head { display: none; }
  .row__num { text-align: left; }
  .row__reach { justify-content: flex-start; }
}

@media (max-width: 960px) {
  /* The rail does not collapse or change width — below the breakpoint it
     becomes a normal block at the top of the document instead. */
  .rail { position: static; width: 100%; height: auto; border-right: 0; border-bottom: 1px solid var(--border-subtle); }
  .rail__nav { flex-direction: row; overflow-x: auto; gap: 4px; }
  .navitem { width: auto; flex: 0 0 auto; }
  .rail__account { border-top: 1px solid var(--border-subtle); }
  .main { margin-left: 0; }
  .main__inner { padding: 24px 18px 80px; }
  .docs { grid-template-columns: 1fr; }
  .docs__rail { position: static; flex-direction: row; overflow-x: auto; }
  .docs__entry { white-space: nowrap; }
  .fact { grid-template-columns: 1fr; gap: 10px; }
  .fact__action { justify-content: flex-start; }
  /* The source shrinks to a thumbnail strip above the reasons. */
  .srccard { display: grid; grid-template-columns: 64px minmax(0, 1fr); }
  .srccard__cover { width: 64px; height: 64px; max-height: none; margin: 18px 0 0 18px; border-radius: var(--radius-sm); }
  .srccard:not(:has(.srccard__cover)) { grid-template-columns: 1fr; }
  .srccard__body { padding: 16px 18px 18px; }
  .srccard__cap { -webkit-line-clamp: 3; }
  .why__summary { font-size: 20px; line-height: 28px; }
  .dim__row { grid-template-columns: 104px minmax(0, 1fr) 18px; gap: 12px; }
  .dim__body { padding-left: 4px; }
  .vcard__foot { flex-direction: column; align-items: stretch; }
  .vcard__actions { margin-left: 0; justify-content: flex-end; }
  .wrow { grid-template-columns: minmax(0, 1fr) auto; }
  .wrow .bar { grid-column: 1 / -1; }
  .works__cols { grid-template-columns: 1fr; }
  .drawer { width: 100vw; border-left: 0; }
  .test__tally { margin-left: 0; width: 100%; }
  .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .figures > div { border-left: 0; border-top: 1px solid var(--border-subtle); }
  .figures > div:nth-child(-n+2) { border-top: 0; }
  .figures > div:nth-child(even) { border-left: 1px solid var(--border-subtle); }
  .seg { border-radius: var(--radius); }
  .banner { border-radius: var(--radius); }
  .select { max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.001ms !important; animation-duration: 0.001ms !important; }
}

/* ── the Ask panel (assistant.js) ───────────────────────────────────────────
   Desktop: a 400px column at the right, and the page reflows beside it.
   Phones (≤760px): a full-screen sheet. The button sits in the rail, between
   the menu and the account footer, so it never covers the page.             */
.rail__ask { flex: 0 0 auto; padding: 0 12px 12px; }
.askbtn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  height: var(--nav-item-height); padding: 10px 12px;
  border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer;
  font-family: var(--font-body); font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); font-weight: 600;
  color: var(--text-heading);
  transition: color 120ms ease, background-color 120ms ease, border-color 120ms ease;
}
.askbtn svg { width: var(--nav-icon-size); height: var(--nav-icon-size); flex: none; display: block; }
.askbtn:hover, .askbtn[aria-expanded="true"] { background: var(--accent-surface); border-color: transparent; color: var(--accent-foreground); }

body.has-assistant .main { margin-right: 400px; }
.asst {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 40; width: 400px;
  display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--border-subtle); box-shadow: -12px 0 32px rgba(0, 0, 0, 0.06);
}
.asst__head {
  flex: none; display: flex; align-items: center; gap: 8px;
  height: var(--nav-brand-height); padding: 0 12px 0 20px; border-bottom: 1px solid var(--border-subtle);
}
.asst__title {
  flex: 1 1 auto; min-width: 0; font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.asst__tools { flex: none; display: flex; align-items: center; gap: 2px; }

.asst__chats { flex: none; max-height: 45%; overflow-y: auto; padding: 8px 12px; background: var(--surface-alt); border-bottom: 1px solid var(--border-subtle); }
.asst__chatlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.asst__chat { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; padding: 8px 10px; border-radius: var(--radius-sm); }
.asst__chat--on { background: var(--accent-surface); }
.asst__chatopen {
  grid-column: 1; border: 0; background: none; padding: 0; text-align: left; cursor: pointer;
  font-family: var(--font-body); font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); font-weight: 600; color: var(--text-heading);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.asst__chatwhen { grid-column: 2; font-size: var(--text-caption); line-height: var(--text-body-sm-line); color: var(--text-muted); }
.asst__chatacts { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; font-size: var(--text-caption); line-height: var(--text-caption-line); }
.asst__ask { color: var(--text-heading); }
.asst__rename { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; }
.asst__rename .inp { flex: 1 1 auto; min-width: 0; }
.asst__chatacts .linkbtn { color: var(--text-muted); }
.asst__chatacts .linkbtn:hover { color: var(--text-heading); }
.asst__chatacts .linkbtn--danger { color: var(--danger-foreground); }

.asst__log { flex: 1 1 auto; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; }
.asst__msg { font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-body); overflow-wrap: anywhere; }
.asst__msg p, .asst__msg ul, .asst__msg ol { margin: 0 0 8px; }
.asst__msg > :last-child { margin-bottom: 0; }
.asst__msg ul, .asst__msg ol { padding-left: 20px; }
.asst__msg strong { color: var(--text-heading); }
.asst__msg a { color: var(--accent-foreground); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.asst__msg--user { align-self: flex-end; max-width: 85%; padding: 8px 12px; border-radius: var(--radius); background: var(--surface-raised); color: var(--text-heading); white-space: pre-wrap; }
.asst__note { margin: 8px 0 0; font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-muted); }
.asst__busy { margin: 0; display: flex; align-items: center; gap: 8px; font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-muted); }
.asst__dots { width: 8px; height: 8px; border-radius: 999px; background: var(--accent-fill); animation: asst-pulse 1s ease-in-out infinite; }
@keyframes asst-pulse { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }
.asst__error { margin: 0; font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--danger-foreground); }
.asst__empty p { margin: 0 0 12px; font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-body); }
.asst__ideas { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.asst__idea {
  padding: 6px 12px; border: 1px solid var(--border-subtle); border-radius: 999px; background: var(--surface); cursor: pointer; text-align: left;
  font-family: var(--font-body); font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-heading);
}
.asst__idea:hover { background: var(--accent-surface); border-color: transparent; }

.asst__composer { flex: none; display: flex; align-items: flex-end; gap: 8px; padding: 12px 20px 6px; border-top: 1px solid var(--border-subtle); }
.asst__composer .inp { flex: 1 1 auto; min-width: 0; min-height: 44px; max-height: 160px; resize: none; }
.asst__fine { flex: none; margin: 0; padding: 2px 20px calc(12px + env(safe-area-inset-bottom, 0px)); font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-muted); }

/* A draft opened from an answer wears a ring for three seconds. */
.vcard--focus { outline: 3px solid color-mix(in srgb, var(--accent-fill) 60%, transparent); outline-offset: 3px; }

@media (max-width: 760px) {
  body.has-assistant { overflow: hidden; }
  body.has-assistant .main { margin-right: 0; }
  .asst { inset: 0; width: auto; z-index: 75; border-left: 0; box-shadow: none; }
}
