/* Exodus Marketing Workbench — design system.
   No frameworks, no web fonts, no network assets. Everything themes through the custom properties below.

   Themes: <html data-theme="auto|light|dark">. "auto" follows prefers-color-scheme; "light"/"dark" force it.
   The dark token block appears twice (forced dark + auto-in-dark-OS). Keep the two blocks identical.

   Brand: dark gray #3F3F3F, red #DD4542 (accent — sparingly), white. Brand red is used as-is only for
   decoration (logo slash, active-nav bar, accent rules). Red text and red button fills use darker/lighter
   variants so they meet WCAG AA (brand red on white is only 4.2:1).

   Templates: never hard-code colors inline; use the tokens (var(--border), var(--surface-sunken), …). */

/* ---------------------------------------------------------------- tokens */
:root {
  color-scheme: light;
  /* type */
  --font-body: "Source Sans 3", "Source Sans Pro", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-head: "Proxima Nova", "Montserrat", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;
  --fs-xs: .75rem;     /* 12px */
  --fs-sm: .84rem;     /* 13.4px */
  --fs-base: .9375rem; /* 15px */
  --fs-md: 1.0625rem;  /* 17px */
  --fs-lg: 1.25rem;    /* 20px */
  --fs-xl: 1.6rem;     /* 25.6px */
  --fs-2xl: 2rem;      /* 32px */
  --lh: 1.5;
  /* spacing scale */
  --s-1: .25rem; --s-2: .5rem; --s-3: .75rem; --s-4: 1rem; --s-5: 1.5rem; --s-6: 2rem; --s-7: 3rem;
  /* shape */
  --radius-sm: 4px; --radius: 6px; --radius-lg: 10px;
  --header-h: 3.5rem;
  --sticky-top: var(--header-h);
  --content-w: 1240px;
  --ease: 120ms ease-out;

  /* brand constants (theme independent) */
  --brand-gray: #3F3F3F;
  --brand-red: #DD4542;

  /* light theme */
  --bg: #f4f4f3;
  --surface: #ffffff;
  --surface-sunken: #f8f8f7;
  --surface-hover: #f0f0ef;
  --surface-raised: #ffffff;
  --header-bg: #ffffff;
  --text: #222222;
  --heading: #3F3F3F;
  --muted: #636363;          /* 6.0:1 on white, 5.5:1 on --bg */
  --border: #e1e1df;
  --border-strong: #cdcdcb;
  --control-border: #8f8f8f; /* 3.2:1 on white: meets 1.4.11 non-text contrast */
  --control-bg: #ffffff;
  --control-disabled: #f1f1f0;
  --link: #3F3F3F;
  --accent-text: #B23431;    /* red text: 6.1:1 on white */
  --accent-fill: #C43C39;    /* red buttons: white text 5.3:1 */
  --accent-fill-hover: #A93230;
  --on-accent: #ffffff;
  --primary-fill: #3F3F3F;   /* white text 10.5:1 */
  --primary-fill-hover: #2a2a2a;
  --on-primary: #ffffff;
  --secondary-fill: #ffffff;
  --secondary-text: #3F3F3F;
  --focus: #C43C39;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .05);
  --shadow-2: 0 6px 24px rgba(0, 0, 0, .12), 0 1px 3px rgba(0, 0, 0, .08);
  /* status: background / foreground / border */
  --neutral-bg: #ececeb; --neutral-fg: #3F3F3F;
  --info-bg: #e6edf7;    --info-fg: #2c4a78;    --info-bd: #b9cbe6;
  --warn-bg: #fdf1dc;    --warn-fg: #6f470a;    --warn-bd: #ecd09a;
  --high-bg: #fbe4e3;    --high-fg: #9c2724;    --high-bd: #efb9b7;
  --ok-bg: #e3f1e8;      --ok-fg: #1f5c38;      --ok-bd: #b5d9c2;
  --retired-bg: #ececeb; --retired-fg: #5e5e5e;
  --diff-old: #fbe1df; --diff-old-bar: #DD4542;
  --diff-new: #dcf0e2; --diff-new-bar: #2f7d4f;

  /* legacy names still used by inline styles in some templates */
  --gray: var(--heading); --red: var(--brand-red); --ink: var(--text); --line: var(--border); --card: var(--surface);
  --ok: var(--ok-fg); --warn: var(--warn-fg); --high: var(--high-fg); --info: var(--info-fg);
}

/* forced dark */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1b1b1b;
  --surface: #242424;
  --surface-sunken: #1e1e1e;
  --surface-hover: #2d2d2d;
  --surface-raised: #2b2b2b;
  --header-bg: #202020;
  --text: #e9e9e9;           /* 12.8:1 on surface */
  --heading: #f3f3f3;
  --muted: #a9a9a9;          /* 6.6:1 on surface */
  --border: #363636;
  --border-strong: #4a4a4a;
  --control-border: #7a7a7a; /* 3.6:1 on surface */
  --control-bg: #1e1e1e;
  --control-disabled: #2a2a2a;
  --link: #e9e9e9;
  --accent-text: #FF8581;    /* 6.6:1 on surface */
  --accent-fill: #C43C39;
  --accent-fill-hover: #A93230;
  --on-accent: #ffffff;
  --primary-fill: #e6e6e6;   /* dark text 12.6:1 */
  --primary-fill-hover: #ffffff;
  --on-primary: #1b1b1b;
  --secondary-fill: transparent;
  --secondary-text: #e9e9e9;
  --focus: #FF8581;
  --shadow-1: none;
  --shadow-2: 0 8px 28px rgba(0, 0, 0, .55), 0 0 0 1px #3a3a3a;
  --neutral-bg: #353535; --neutral-fg: #dedede;
  --info-bg: #1d2a3d;    --info-fg: #a9c5ee;    --info-bd: #34507a;
  --warn-bg: #362a12;    --warn-fg: #f2c879;    --warn-bd: #6b5223;
  --high-bg: #3e1f1e;    --high-fg: #ffa29e;    --high-bd: #74302d;
  --ok-bg: #18301f;      --ok-fg: #92d6ab;      --ok-bd: #2e5c3d;
  --retired-bg: #303030; --retired-fg: #a3a3a3;
  --diff-old: #4a2321; --diff-old-bar: #FF8581;
  --diff-new: #1c3a26; --diff-new-bar: #6cc28d;
}
/* auto + OS dark: identical copy of the block above */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    color-scheme: dark;
    --bg: #1b1b1b;
    --surface: #242424;
    --surface-sunken: #1e1e1e;
    --surface-hover: #2d2d2d;
    --surface-raised: #2b2b2b;
    --header-bg: #202020;
    --text: #e9e9e9;
    --heading: #f3f3f3;
    --muted: #a9a9a9;
    --border: #363636;
    --border-strong: #4a4a4a;
    --control-border: #7a7a7a;
    --control-bg: #1e1e1e;
    --control-disabled: #2a2a2a;
    --link: #e9e9e9;
    --accent-text: #FF8581;
    --accent-fill: #C43C39;
    --accent-fill-hover: #A93230;
    --on-accent: #ffffff;
    --primary-fill: #e6e6e6;
    --primary-fill-hover: #ffffff;
    --on-primary: #1b1b1b;
    --secondary-fill: transparent;
    --secondary-text: #e9e9e9;
    --focus: #FF8581;
    --shadow-1: none;
    --shadow-2: 0 8px 28px rgba(0, 0, 0, .55), 0 0 0 1px #3a3a3a;
    --neutral-bg: #353535; --neutral-fg: #dedede;
    --info-bg: #1d2a3d;    --info-fg: #a9c5ee;    --info-bd: #34507a;
    --warn-bg: #362a12;    --warn-fg: #f2c879;    --warn-bd: #6b5223;
    --high-bg: #3e1f1e;    --high-fg: #ffa29e;    --high-bd: #74302d;
    --ok-bg: #18301f;      --ok-fg: #92d6ab;      --ok-bd: #2e5c3d;
    --retired-bg: #303030; --retired-fg: #a3a3a3;
    --diff-old: #4a2321; --diff-old-bar: #FF8581;
    --diff-new: #1c3a26; --diff-new-bar: #6cc28d;
  }
}
/* The logo files are colored for one background each (gray ink on light, light ink on dark; the slash
   stays brand red). Show the one that matches the active theme. */
.logo-on-dark { display: none !important; }
:root[data-theme="dark"] .logo-on-light { display: none !important; }
:root[data-theme="dark"] .logo-on-dark { display: block !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) .logo-on-light { display: none !important; }
  :root:not([data-theme="light"]):not([data-theme="dark"]) .logo-on-dark { display: block !important; }
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--sticky-top) + var(--s-3)); }
body {
  margin: 0; font-family: var(--font-body); font-size: var(--fs-base); line-height: var(--lh);
  color: var(--text); background: var(--bg); overflow-wrap: break-word;
}
h1, h2, h3, h4 { font-family: var(--font-head); color: var(--heading); line-height: 1.25; letter-spacing: -.005em; }
h1 { font-size: var(--fs-xl); font-weight: 700; margin: var(--s-1) 0 var(--s-4); }
h2 { font-size: var(--fs-lg); font-weight: 650; margin: var(--s-5) 0 var(--s-3); }
h3 { font-size: var(--fs-md); font-weight: 650; margin: var(--s-4) 0 var(--s-2); }
h4 { font-size: var(--fs-base); font-weight: 650; margin: var(--s-3) 0 var(--s-1); }
p { margin: 0 0 var(--s-3); }
ul, ol { padding-left: 1.3rem; margin: 0 0 var(--s-3); }
li + li { margin-top: var(--s-1); }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--s-5) 0; }
img, svg { max-width: 100%; }
code, kbd, pre, .mono { font-family: var(--font-mono); font-size: .875em; }

pre { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--s-3); }
strong, b { font-weight: 650; }
small, .small { font-size: var(--fs-sm); }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-weight: 400; }
.lede { font-size: var(--fs-md); color: var(--muted); max-width: 70ch; }
.eyebrow { font-family: var(--font-head); font-size: var(--fs-xs); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 var(--s-1); }
.wrap-anywhere { overflow-wrap: anywhere; }

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { color: var(--accent-text); }

::selection { background: color-mix(in srgb, var(--brand-red) 28%, transparent); }

/* focus: visible for keyboard users, everywhere */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
summary:focus-visible { border-radius: var(--radius-sm); }

.visually-hidden, .sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--s-3); top: -100px; z-index: 100; padding: var(--s-2) var(--s-4);
  background: var(--primary-fill); color: var(--on-primary); border-radius: var(--radius-sm); font-weight: 650; text-decoration: none;
}
.skip-link:focus, .skip-link:focus-visible { top: var(--s-2); color: var(--on-primary); }
.print-only { display: none; }

/* ---------------------------------------------------------------- header */
header.top {
  position: sticky; top: 0; z-index: 20; min-height: var(--header-h);
  display: flex; align-items: center; gap: 0 var(--s-5); flex-wrap: wrap;
  padding: 0 var(--s-5); background: var(--header-bg); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-1);
}
header.top .brand { display: flex; align-items: center; gap: var(--s-3); text-decoration: none; color: var(--heading); flex: none; min-height: var(--header-h); }
header.top .brand img { height: 16px; width: auto; display: block; }
.brand .app-name { font-family: var(--font-head); font-weight: 600; font-size: var(--fs-base); color: var(--muted); padding-left: var(--s-3); border-left: 1px solid var(--border-strong); line-height: 1.2; white-space: nowrap; }
header.top a.brand:hover .app-name { color: var(--heading); }

nav.primary { display: flex; align-items: stretch; gap: var(--s-1); flex: 1 1 auto; min-width: 0; align-self: stretch; }
nav.primary a {
  position: relative; display: inline-flex; align-items: center; gap: .4rem; padding: 0 var(--s-3); white-space: nowrap;
  text-decoration: none; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; border-top: 3px solid transparent;
}
nav.primary a:hover { color: var(--heading); border-bottom-color: var(--border-strong); }
nav.primary a.active, nav.primary a[aria-current="page"] { color: var(--heading); border-bottom-color: var(--brand-red); }
nav.primary a:focus-visible { outline-offset: -2px; }

.top-tools { display: flex; align-items: center; gap: var(--s-3); margin-left: auto; flex: none; }
.top-note { color: var(--muted); font-size: var(--fs-sm); margin-left: auto; padding: var(--s-2) 0; }

.badge {
  display: inline-block; min-width: 1.45em; padding: 0 .4em; border-radius: 1em; line-height: 1.45;
  background: var(--accent-fill); color: var(--on-accent); font-size: var(--fs-xs); font-weight: 700; text-align: center;
  font-variant-numeric: tabular-nums;
}
.badge.neutral { background: var(--neutral-bg); color: var(--neutral-fg); }

/* theme switch: a no-JS form with three submit buttons */
.theme-switch { display: inline-flex; padding: 2px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface-sunken); margin: 0; }
.theme-switch button {
  display: inline-flex; align-items: center; justify-content: center; width: 1.9rem; height: 1.6rem; min-height: 0; padding: 0;
  border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer;
}
.theme-switch button:hover { color: var(--heading); background: var(--surface-hover); }
.theme-switch button[aria-pressed="true"] { background: var(--surface-raised); color: var(--heading); box-shadow: 0 0 0 1px var(--control-border); }
.theme-switch button:active { transform: none; }
.theme-switch svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none; width: 1.9rem; height: 1.9rem; border-radius: 50%;
  background: var(--primary-fill); color: var(--on-primary); font-family: var(--font-head); font-size: var(--fs-xs); font-weight: 700; letter-spacing: .03em;
}

/* ---------------------------------------------------------------- menu (details-based dropdown, no JS needed) */
details.menu { position: relative; }
details.menu > summary {
  list-style: none; display: inline-flex; align-items: center; gap: var(--s-2); cursor: pointer; user-select: none;
  padding: .2rem .55rem .2rem .2rem; border-radius: 999px; border: 1px solid transparent; color: var(--text); font-weight: 600;
}
details.menu > summary::-webkit-details-marker { display: none; }
details.menu > summary::after { content: ""; width: .4rem; height: .4rem; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: translateY(-2px) rotate(45deg); opacity: .7; }
details.menu[open] > summary::after { transform: translateY(1px) rotate(-135deg); }
details.menu > summary:hover, details.menu[open] > summary { background: var(--surface-hover); border-color: var(--border); color: var(--heading); }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 15rem; max-width: calc(100vw - 2rem);
  padding: var(--s-2); background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-2);
}
.menu-panel.left { right: auto; left: 0; }
.menu-head { padding: var(--s-2) var(--s-3) var(--s-3); border-bottom: 1px solid var(--border); margin-bottom: var(--s-2); line-height: 1.35; }
.menu-head strong { display: block; color: var(--heading); }
.menu-head span { display: block; font-size: var(--fs-sm); color: var(--muted); overflow-wrap: anywhere; }
.menu-panel a, .menu-panel button.menu-item, .menu-item {
  display: flex; width: 100%; min-height: 2.2rem; align-items: center; justify-content: flex-start; gap: var(--s-2); padding: .4rem var(--s-3);
  border-radius: var(--radius-sm); color: var(--text); background: none; border: 0; font: inherit; font-weight: 500;
  text-align: left; text-decoration: none; cursor: pointer;
}
.menu-panel a:hover, .menu-panel button.menu-item:hover { background: var(--surface-hover); color: var(--heading); }
.menu-panel a[aria-current="page"] { font-weight: 650; color: var(--heading); }
.menu-panel form { margin: 0; }
.menu-panel hr, .menu-sep { border: 0; border-top: 1px solid var(--border); margin: var(--s-2) 0; }
.menu-label { display: block; padding: var(--s-1) var(--s-3); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }

/* ---------------------------------------------------------------- layout */
main { max-width: var(--content-w); margin: 0 auto; padding: var(--s-5) var(--s-5) var(--s-7); }
main:focus { outline: none; }
main.narrow { max-width: 760px; }
.grid { display: grid; gap: var(--s-4); }
.grid > *, .variants > *, .row > *, .spread > * { min-width: 0; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1000px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .g2, .g3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) { .g4 { grid-template-columns: minmax(0, 1fr); } }
.row { display: flex; gap: var(--s-2) var(--s-3); align-items: center; flex-wrap: wrap; }
.row > form { margin: 0; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: var(--s-2) var(--s-4); flex-wrap: wrap; }
.stack > * + * { margin-top: var(--s-3); }

/* page head: title + actions row */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s-3) var(--s-4); margin-bottom: var(--s-5); }
.page-head h1 { margin: 0; }
.page-head > :first-child { min-width: 0; flex: 1 1 22rem; }
.page-head p, .page-head .sub { margin: var(--s-1) 0 0; color: var(--muted); }
.page-head .actions, .actions { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }

/* breadcrumbs: <nav class="breadcrumbs" aria-label="Breadcrumb"><ol><li><a>…</a></li><li aria-current="page">…</li></ol></nav> */
.breadcrumbs { font-size: var(--fs-sm); color: var(--muted); margin: 0 0 var(--s-2); }
.breadcrumbs ol, .breadcrumbs ul { list-style: none; display: flex; flex-wrap: wrap; gap: var(--s-1); padding: 0; margin: 0; }
.breadcrumbs li { margin: 0; }
.breadcrumbs li + li::before { content: "/"; margin-right: var(--s-1); color: var(--border-strong); }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent-text); text-decoration: underline; }
.breadcrumbs [aria-current] { color: var(--text); }

/* ---------------------------------------------------------------- cards */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--s-4); margin: 0 0 var(--s-4); box-shadow: var(--shadow-1);
}
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.card.sunken, .card .card { background: var(--surface-sunken); box-shadow: none; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); flex-wrap: wrap; margin-bottom: var(--s-3); }
.card-head h2, .card-head h3 { margin: 0; }
a.card { display: block; color: inherit; text-decoration: none; }
a.card:hover { border-color: var(--border-strong); background: var(--surface-hover); }
details.card > summary { margin: calc(-1 * var(--s-4)); padding: var(--s-4); border-radius: var(--radius); }
details.card[open] > summary { margin-bottom: var(--s-2); border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; }
/* TEMP: campaign.html has an inline light background on its suggestions card; remove once the template uses .sunken */

/* empty state */
.empty {
  text-align: center; padding: var(--s-6) var(--s-4); color: var(--muted); background: var(--surface);
  border: 1px dashed var(--border-strong); border-radius: var(--radius); margin: 0 0 var(--s-4);
}
.empty > :last-child { margin-bottom: 0; }
.empty h2, .empty h3 { color: var(--heading); margin-top: 0; }
.empty .btn, .empty button { margin-top: var(--s-2); }
td.empty, .empty-cell { text-align: center; color: var(--muted); padding: var(--s-5) var(--s-3); border: 0; background: none; }

/* danger zone */
.danger-zone { border: 1px solid var(--high-bd); border-left: 4px solid var(--brand-red); border-radius: var(--radius); padding: var(--s-4); margin: var(--s-5) 0 var(--s-4); background: var(--surface); }
.danger-zone > h2, .danger-zone > h3 { color: var(--accent-text); margin-top: 0; }
.danger-zone > :last-child { margin-bottom: 0; }

/* stats: dashboard number tiles.
   <div class="stats"><a class="stat" href="…"><span class="value">12</span><span class="label">Waiting for review</span></a></div> */
.stats { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); margin: 0 0 var(--s-5); padding: 0; list-style: none; }
.stats > li { margin: 0; }
.stat {
  display: flex; flex-direction: column; gap: var(--s-1); padding: var(--s-3) var(--s-4); margin: 0; height: 100%;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-1);
  color: var(--text); text-decoration: none;
}
.stat .value { font-family: var(--font-head); font-size: var(--fs-2xl); font-weight: 700; line-height: 1.1; color: var(--heading); font-variant-numeric: tabular-nums; }
.stat .label { order: -1; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: var(--fs-xs); color: var(--muted); }
.stat .note { font-size: var(--fs-sm); color: var(--muted); }
a.stat:hover { border-color: var(--border-strong); background: var(--surface-hover); color: var(--text); }
a.stat:hover .value { color: var(--accent-text); }
.stat.attention, .stat.high { border-left: 4px solid var(--brand-red); }
.stat.warn { border-left: 4px solid var(--warn-bd); }
.stat.ok { border-left: 4px solid var(--ok-bd); }

/* checklist: getting-started list. <ol class="checklist"><li class="done">…</li><li class="todo">…</li></ol> */
.checklist { list-style: none; padding: 0; margin: 0 0 var(--s-4); counter-reset: step; }
.checklist li { position: relative; padding: var(--s-2) 0 var(--s-2) 2.4rem; margin: 0; border-bottom: 1px solid var(--border); counter-increment: step; min-height: 2.6rem; }
.checklist li:last-child { border-bottom: 0; }
.checklist li::before {
  content: counter(step); position: absolute; left: 0; top: var(--s-2); width: 1.6rem; height: 1.6rem; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: var(--fs-xs); font-weight: 700;
  border: 1.5px solid var(--control-border); color: var(--muted); background: var(--surface);
}
.checklist li.done::before { content: "\2713"; border-color: var(--ok-fg); background: var(--ok-bg); color: var(--ok-fg); font-size: var(--fs-sm); }
.checklist li.done > strong:first-child, .checklist li.done > a:first-child, .checklist li.done > .title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--border-strong); }
.checklist li.current::before, .checklist li.next::before { border-color: var(--brand-red); color: var(--accent-text); }
.checklist li .small, .checklist li p { display: block; margin: var(--s-1) 0 0; color: var(--muted); }

/* filter bar: <form class="filters"><div class="grow"><label>Search</label><input type=search></div><div><label>Kind</label><select>…</select></div><button>…</button></form> */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s-2) var(--s-3); padding: var(--s-3); margin: 0 0 var(--s-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.filters > * { margin: 0; }
.filters label { margin: 0 0 .15rem; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.filters label.check, .filters label:has(> input[type=checkbox]) { display: inline-flex; align-items: center; gap: var(--s-2); text-transform: none; letter-spacing: 0; font-size: var(--fs-sm); color: var(--text); align-self: center; margin: 0; }
.filters input[type=text], .filters input[type=search], .filters select { width: auto; min-width: 10rem; }
.filters .grow { flex: 1 1 14rem; }
.filters .grow input, .filters .grow select { width: 100%; }

/* pager: <nav class="pager" aria-label="Pages"><a rel="prev">…</a><span class="info">Page 2 of 5</span><a aria-current="page">2</a>…</nav> */
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1); margin: var(--s-4) 0; list-style: none; padding: 0; font-size: var(--fs-sm); }
.pager li { margin: 0; }
.pager a, .pager > span, .pager li > span, .pager strong { display: inline-flex; align-items: center; justify-content: center; min-width: 2.1rem; height: 2.1rem; padding: 0 var(--s-2); border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); text-decoration: none; color: var(--text); }
.pager a:hover { border-color: var(--control-border); color: var(--heading); }
.pager .current, .pager [aria-current] { background: var(--primary-fill); border-color: var(--primary-fill); color: var(--on-primary); font-weight: 700; }
.pager .disabled, .pager [aria-disabled="true"] { color: var(--muted); opacity: .6; pointer-events: none; }
.pager .info { border: 0; background: none; color: var(--muted); }

/* tabs */
.tabs { display: flex; gap: var(--s-1); flex-wrap: wrap; margin: 0 0 var(--s-4); }
.tabs a { padding: .3rem .75rem; border-radius: 999px; text-decoration: none; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-size: var(--fs-sm); font-weight: 600; }
.tabs a:hover { border-color: var(--control-border); color: var(--heading); }
.tabs a.active, .tabs a[aria-current] { background: var(--primary-fill); color: var(--on-primary); border-color: var(--primary-fill); }

/* ---------------------------------------------------------------- buttons */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; vertical-align: middle;
  min-height: 2.25rem; padding: .4rem .95rem; border-radius: var(--radius-sm); border: 1px solid var(--primary-fill);
  background: var(--primary-fill); color: var(--on-primary); font: inherit; font-weight: 650; line-height: 1.2;
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: background-color var(--ease), border-color var(--ease), color var(--ease);
}
button:hover, .btn:hover { background: var(--primary-fill-hover); border-color: var(--primary-fill-hover); color: var(--on-primary); }
button:active, .btn:active { transform: translateY(1px); }
button.secondary, .btn.secondary { background: var(--secondary-fill); color: var(--secondary-text); border-color: var(--control-border); }
button.secondary:hover, .btn.secondary:hover { background: var(--surface-hover); color: var(--heading); border-color: var(--heading); }
button.red, .btn.red, button.accent, .btn.accent { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); }
button.red:hover, .btn.red:hover, button.accent:hover, .btn.accent:hover { background: var(--accent-fill-hover); border-color: var(--accent-fill-hover); color: var(--on-accent); }
button.danger, .btn.danger { background: transparent; color: var(--accent-text); border-color: currentColor; }
button.danger:hover, .btn.danger:hover { background: var(--high-bg); color: var(--high-fg); border-color: var(--high-fg); }
button.ghost, .btn.ghost { background: transparent; border-color: transparent; color: var(--link); }
button.ghost:hover, .btn.ghost:hover { background: var(--surface-hover); border-color: transparent; color: var(--heading); }
button.link, .btn.link { min-height: 0; padding: 0; background: none; border: 0; color: var(--link); font-weight: 500; text-decoration: underline; text-underline-offset: .18em; }
button.link:hover, .btn.link:hover { background: none; color: var(--accent-text); }
button.small, .btn.small { min-height: 1.85rem; padding: .2rem .6rem; font-size: var(--fs-sm); }
button.large, .btn.large { min-height: 2.75rem; padding: .55rem 1.3rem; font-size: var(--fs-md); }
button.block, .btn.block { display: flex; width: 100%; }
button:disabled, button[aria-disabled="true"], .btn[aria-disabled="true"], .btn.disabled {
  opacity: .5; cursor: not-allowed; transform: none; pointer-events: none;
}
.btn-group { display: inline-flex; flex-wrap: wrap; gap: var(--s-2); }

/* ---------------------------------------------------------------- forms */
form { margin: 0; }
label { display: block; font-weight: 600; margin: var(--s-3) 0 var(--s-1); font-size: var(--fs-sm); color: var(--text); }
label .hint { font-weight: 400; }
.field-hint, .help { display: block; font-size: var(--fs-sm); color: var(--muted); margin-top: var(--s-1); }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s-3) var(--s-4) var(--s-4); margin: 0 0 var(--s-4); min-width: 0; }
legend { font-weight: 650; padding: 0 var(--s-2); color: var(--heading); }
input:not([type]), input[type=text], input[type=url], input[type=date], input[type=email], input[type=search], input[type=password],
input[type=number], input[type=tel], input[type=time], input[type=datetime-local], input[type=month], select, textarea {
  width: 100%; min-height: 2.25rem; padding: .42rem .6rem; border: 1px solid var(--control-border); border-radius: var(--radius-sm);
  font: inherit; color: var(--text); background: var(--control-bg); transition: border-color var(--ease), box-shadow var(--ease);
}
input:hover:not(:disabled):not([readonly]):not([type=checkbox]):not([type=radio]), select:hover:not(:disabled), textarea:hover:not(:disabled):not([readonly]) { border-color: var(--heading); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
input[type=checkbox]:focus-visible, input[type=radio]:focus-visible { outline-offset: 2px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .9; }
select { cursor: pointer; }
textarea { min-height: 5rem; resize: vertical; line-height: 1.45; }
textarea.post { min-height: 9rem; font-size: 1rem; line-height: 1.5; }
@supports (field-sizing: content) { textarea.post { field-sizing: content; max-height: 40rem; } }
input:disabled, select:disabled, textarea:disabled { background: var(--control-disabled); color: var(--muted); cursor: not-allowed; border-style: dashed; }
input[readonly], textarea[readonly] { background: var(--surface-sunken); border-style: dashed; }
input:user-invalid, textarea:user-invalid, select:user-invalid { border-color: var(--accent-text); }
input[type=checkbox], input[type=radio] {
  width: 1.05rem; height: 1.05rem; margin: 0; flex: none; accent-color: var(--primary-fill); cursor: pointer; vertical-align: -.15em;
}
input[type=checkbox]:disabled, input[type=radio]:disabled { cursor: not-allowed; opacity: .6; }
label:has(> input[type=checkbox]), label:has(> input[type=radio]) { font-weight: 400; cursor: pointer; }
label.check, .check { display: inline-flex; align-items: center; gap: var(--s-2); font-weight: 400; margin: var(--s-1) var(--s-3) var(--s-1) 0; font-size: var(--fs-base); }
input[type=file] { max-width: 100%; font: inherit; font-size: var(--fs-sm); color: var(--muted); padding: .25rem 0; }
input[type=file]::file-selector-button {
  margin-right: var(--s-3); padding: .35rem .8rem; border-radius: var(--radius-sm); border: 1px solid var(--control-border);
  background: var(--secondary-fill); color: var(--secondary-text); font: inherit; font-weight: 650; cursor: pointer;
}
input[type=file]::file-selector-button:hover { background: var(--surface-hover); border-color: var(--heading); }
input[type=range] { accent-color: var(--accent-fill); width: 100%; }
.row label { margin: 0; }
.form-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; margin-top: var(--s-4); }

/* ---------------------------------------------------------------- tables */
table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); font-size: var(--fs-base);
  border: 1px solid var(--border); border-radius: var(--radius); margin: 0 0 var(--s-4); }
.card table { border: 0; border-radius: 0; margin-bottom: 0; background: transparent; }
th, td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--border); vertical-align: top; }
td { overflow-wrap: break-word; }
td a[href^="http"], td .wrap-anywhere { overflow-wrap: anywhere; }
td .tag { white-space: nowrap; }
tr:last-child > td { border-bottom: 0; }
/* sticky header row (works without <thead>; tables scroll with the page under the sticky site header) */
th {
  font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  background: var(--surface); position: sticky; top: var(--sticky-top); z-index: 2; white-space: nowrap;
  border-bottom-color: var(--border-strong);
}
table:not(.card table) tr:first-child > th:first-child { border-top-left-radius: var(--radius); }
table:not(.card table) tr:first-child > th:last-child { border-top-right-radius: var(--radius); }
tr:hover > td { background: var(--surface-hover); }
table.zebra tr:nth-child(even) > td { background: var(--surface-sunken); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions { white-space: nowrap; text-align: right; }
.table-wrap { overflow-x: auto; margin: 0 0 var(--s-4); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.table-wrap > table { border: 0; margin: 0; }
.table-wrap th { position: static; }

/* ---------------------------------------------------------------- flash messages */
.flash {
  padding: .65rem .9rem; border-radius: var(--radius-sm); margin: 0 0 var(--s-3); border: 1px solid var(--info-bd);
  border-left-width: 4px; border-left-color: var(--info-fg); background: var(--info-bg); color: var(--text);
}
.flash.ok, .flash.success { background: var(--ok-bg); border-color: var(--ok-bd); border-left-color: var(--ok-fg); }
.flash.error, .flash.danger { background: var(--high-bg); border-color: var(--high-bd); border-left-color: var(--accent-text); }
.flash.warn, .flash.warning { background: var(--warn-bg); border-color: var(--warn-bd); border-left-color: var(--warn-fg); }
.flash > :last-child { margin-bottom: 0; }
.flash a { color: inherit; }

/* ---------------------------------------------------------------- tags */
.tag {
  display: inline-block; padding: .05rem .5rem; border-radius: var(--radius-sm); font-size: var(--fs-xs); font-weight: 700;
  line-height: 1.55; letter-spacing: .01em; background: var(--neutral-bg); color: var(--neutral-fg); vertical-align: .08em;
  max-width: 100%; overflow-wrap: anywhere;
}
.tag.info { background: var(--info-bg); color: var(--info-fg); }
.tag.warn, .tag.pending, .tag.draft, .tag.candidate { background: var(--warn-bg); color: var(--warn-fg); }
.tag.high, .tag.error, .tag.failed { background: var(--high-bg); color: var(--high-fg); }
.tag.approved, .tag.ok, .tag.done, .tag.current, .tag.active { background: var(--ok-bg); color: var(--ok-fg); }
.tag.retired, .tag.rejected, .tag.superseded, .tag.disabled, .tag.skipped { background: var(--retired-bg); color: var(--retired-fg); }
.tag.running, .tag.queued { background: var(--info-bg); color: var(--info-fg); }
.tag.fixture { background: var(--accent-fill); color: var(--on-accent); letter-spacing: .06em; }
.tag.outline { background: transparent; box-shadow: inset 0 0 0 1px var(--border-strong); }

.fixture-banner { background: var(--accent-fill); color: var(--on-accent); padding: .4rem var(--s-5); font-weight: 650; font-size: var(--fs-sm); }

/* ---------------------------------------------------------------- content pieces */
.post-body {
  display: block; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-sunken); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .75rem .9rem; font-size: 1rem; line-height: 1.55;
}
.variants { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)); }
.variants > .card { margin: 0; }
.variants > .card > * + * { margin-top: var(--s-2); }
.flags { list-style: none; padding: 0; margin: var(--s-2) 0; }
.flags li { margin: var(--s-1) 0; font-size: var(--fs-sm); line-height: 1.45; }
.flags .tag { margin-right: .3rem; }
.steps { display: flex; gap: var(--s-1); flex-wrap: wrap; }
.steps .tag.done { background: var(--ok-bg); color: var(--ok-fg); }
.steps .tag.running { background: var(--warn-bg); color: var(--warn-fg); }
.steps .tag.failed { background: var(--high-bg); color: var(--high-fg); }

details > summary { cursor: pointer; font-weight: 650; color: var(--heading); }
details > summary:hover { color: var(--accent-text); }

.diff-old, .diff-new { border-radius: 2px; }
.diff-old { background: var(--diff-old); box-shadow: inset 3px 0 0 var(--diff-old-bar); padding-left: .45rem; }
.diff-new { background: var(--diff-new); box-shadow: inset 3px 0 0 var(--diff-new-bar); padding-left: .45rem; }
del.diff-old, span.diff-old { box-shadow: none; padding: 0 .1rem; text-decoration-color: var(--diff-old-bar); }
ins.diff-new, span.diff-new { box-shadow: none; padding: 0 .1rem; text-decoration: none; }

.kv { display: grid; grid-template-columns: minmax(7rem, 160px) minmax(0, 1fr); gap: .35rem var(--s-3); font-size: var(--fs-base); margin: 0 0 var(--s-3); }
.kv dt { color: var(--muted); font-size: var(--fs-sm); padding-top: .1rem; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 560px) { .kv { grid-template-columns: minmax(0, 1fr); gap: 0; } .kv dt { margin-top: var(--s-2); } }

.count { font-variant-numeric: tabular-nums; color: var(--muted); }
.count.over { color: var(--accent-text); font-weight: 700; }
blockquote, .quote { margin: var(--s-1) 0; padding: .1rem 0 .1rem var(--s-3); border-left: 3px solid var(--brand-red); color: var(--text); }
.comment { padding: var(--s-2) 0; border-bottom: 1px solid var(--border); }
.comment:last-child { border-bottom: 0; }

/* ---------------------------------------------------------------- page-specific helpers used by templates */
.breadcrumb { font-size: var(--fs-sm); margin: 0 0 var(--s-2); }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent-text); text-decoration: underline; }
.empty-state { text-align: center; color: var(--muted); border-style: dashed; border-color: var(--border-strong); box-shadow: none; padding: var(--s-5) var(--s-4); }
.empty-state strong { color: var(--heading); }
td.empty-state { border: 0; background: none; padding: var(--s-5) var(--s-3); }
tr:hover > td.empty-state { background: none; }
.next-step { border-left: 4px solid var(--brand-red); }
.getting-started .checklist { margin: var(--s-3) 0 0; }
.getting-started .checklist li::before { display: none; }
.getting-started .checklist li { padding-left: 0; }
.attention-list { list-style: none; padding: 0; margin: 0 0 var(--s-3); }
.attention-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s-1) var(--s-2); padding: .35rem 0; margin: 0; border-bottom: 1px solid var(--border); }
.attention-list li:last-child { border-bottom: 0; }
.attention-list li > a:first-child { font-weight: 600; }
.tab-count { display: inline-block; min-width: 1.4em; padding: 0 .35em; margin-left: .15rem; border-radius: 1em; font-size: var(--fs-xs); font-weight: 700; text-align: center; background: var(--neutral-bg); color: var(--neutral-fg); font-variant-numeric: tabular-nums; }
.tabs a.active .tab-count, .tabs a[aria-current] .tab-count { background: color-mix(in srgb, var(--on-primary) 22%, transparent); color: var(--on-primary); }
.review-filters { gap: var(--s-2) var(--s-4); align-items: flex-end; }
.review-filters label { display: flex; flex-direction: column; gap: .15rem; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.review-filters label.row { flex-direction: row; text-transform: none; letter-spacing: 0; font-size: var(--fs-sm); color: var(--text); align-self: center; }
.review-filters select { text-transform: none; letter-spacing: 0; font-size: var(--fs-base); color: var(--text); }
.bulk-bar { position: sticky; top: calc(var(--sticky-top) + var(--s-2)); z-index: 5; box-shadow: var(--shadow-2); }
.review-item:target, .card:target { box-shadow: 0 0 0 2px var(--focus); }
.confirm-step { max-width: 46rem; border-left: 4px solid var(--warn-bd); }
.confirm-items { max-height: 18rem; overflow: auto; padding: var(--s-2) var(--s-2) var(--s-2) 1.8rem; background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: var(--fs-sm); }
.error-page { max-width: 40rem; margin: var(--s-6) auto; padding: var(--s-5) var(--s-5); }
.error-page h1 { margin-top: 0; }
/* .noscript-only: shown only without JavaScript; .js-only: shown only with it (app.js adds html.js) */
.js .noscript-only { display: none !important; }
html:not(.js) .js-only { display: none !important; }

/* ---------------------------------------------------------------- sign-in page */
.auth { max-width: 32rem; margin: var(--s-7) auto var(--s-6); padding: 0 var(--s-4); }
.auth-brand { display: flex; justify-content: center; margin-bottom: var(--s-5); }
.auth-brand img { height: 52px; width: auto; }
.auth-title { text-align: center; margin: 0 0 var(--s-1); font-size: var(--fs-xl); }
.auth-sub { text-align: center; color: var(--muted); margin: 0 0 var(--s-5); }
.auth .card { padding: var(--s-4) var(--s-5) var(--s-5); border-top: 3px solid var(--heading); }
.auth-note .tag { white-space: nowrap; }
.auth-note { display: flex; gap: var(--s-2); align-items: baseline; font-size: var(--fs-sm); color: var(--muted); margin-bottom: var(--s-2); }
.auth-group { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: var(--s-4) 0 var(--s-2); }
.user-pick { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.user-pick li { margin: 0; }
.user-btn {
  display: flex; width: 100%; justify-content: flex-start; gap: var(--s-3); padding: .5rem .75rem; min-height: 3.2rem; text-align: left; white-space: normal;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); font-weight: 400;
}
.user-btn:hover { background: var(--surface-hover); border-color: var(--heading); color: var(--text); }
.user-btn .who { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.3; }
.user-btn .who strong { color: var(--heading); }
.user-btn .who span { font-size: var(--fs-sm); color: var(--muted); overflow-wrap: anywhere; }
.user-btn .tag { align-self: center; }
.auth-foot { text-align: center; font-size: var(--fs-sm); color: var(--muted); margin-top: var(--s-4); }

/* ---------------------------------------------------------------- public voting pages */
.public-main { max-width: 1100px; }
.public-main h1 { margin-bottom: var(--s-2); }
.name-card { max-width: 26rem; }
.name-card label { margin-top: 0; }
.comment-card { margin-top: var(--s-5); }
.ballot-group { border: 0; padding: 0; margin: var(--s-5) 0 0; }
.ballot-group > legend { padding: 0; margin-bottom: var(--s-1); font-family: var(--font-head); font-size: var(--fs-lg); font-weight: 650; }
.ballot-group > .hint { margin: 0 0 var(--s-3); font-size: var(--fs-sm); }
.choice {
  display: flex; flex-direction: column; gap: var(--s-2); margin: 0; padding: var(--s-3) var(--s-4) var(--s-4); cursor: pointer;
  font-weight: 400; font-size: var(--fs-base); background: var(--surface); border: 1.5px solid var(--border-strong); border-radius: var(--radius);
  transition: border-color var(--ease), box-shadow var(--ease);
}
.choice:hover { border-color: var(--control-border); }
.choice:has(input:checked) { border-color: var(--heading); box-shadow: 0 0 0 1px var(--heading); }
.choice:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.choice-head { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.choice-head input[type=radio] { width: 1.25rem; height: 1.25rem; }
.choice-head strong { font-family: var(--font-head); color: var(--heading); }
.choice-meta { margin-left: auto; font-size: var(--fs-sm); color: var(--muted); }
.choice .picked { display: none; }
.choice:has(input:checked) .picked { display: inline-block; }
.choice .post-body { margin: 0; }
.vote-submit {
  position: sticky; bottom: 0; z-index: 10; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-4);
  margin: var(--s-5) calc(-1 * var(--s-5)) 0; padding: var(--s-3) var(--s-5);
  background: var(--bg); border-top: 1px solid var(--border);
}
.vote-submit p { margin: 0; }
.closed { max-width: 32rem; margin: 12vh auto var(--s-6); text-align: center; padding: 0 var(--s-4); }
.closed .card { padding: var(--s-6) var(--s-5); border-top: 3px solid var(--heading); }
.closed .logo { display: block; height: 44px; width: auto; margin: 0 auto var(--s-5); }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .brand .app-name:not(.keep) { display: none; }
  nav.primary a { padding: 0 var(--s-2); }
}
@media (max-width: 1024px) {
  :root { --sticky-top: 0px; }
  header.top { position: static; padding: 0 var(--s-4); gap: 0 var(--s-3); }
  header.top .brand { min-height: 3.25rem; }
  nav.primary {
    order: 3; flex: 1 0 100%; margin: 0 calc(-1 * var(--s-4)); padding: 0 var(--s-2);
    overflow-x: auto; scrollbar-width: none; border-top: 1px solid var(--border); min-height: 2.75rem;
  }
  nav.primary::-webkit-scrollbar { display: none; }
  nav.primary a { padding: 0 var(--s-3); }
  .user-menu .user-name { display: none; }
  main { padding: var(--s-4) var(--s-4) var(--s-6); }
  .vote-submit { margin-left: calc(-1 * var(--s-4)); margin-right: calc(-1 * var(--s-4)); padding: var(--s-3) var(--s-4); }
}
@media (max-width: 700px) {
  table:not(.keep) { display: block; overflow-x: auto; }
  th { position: static; }
  h1 { font-size: 1.4rem; }
  .page-head { margin-bottom: var(--s-4); }
  .card { padding: var(--s-3); }
  details.card > summary { margin: calc(-1 * var(--s-3)); padding: var(--s-3); }
  .auth { margin-top: var(--s-6); }
  .auth .card { padding: var(--s-3) var(--s-4) var(--s-4); }
}
@media (max-width: 640px) {
  /* 16px stops iOS from zooming into focused fields */
  input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea { font-size: 16px; }
  .top-note { flex: 1 0 100%; margin: 0; padding: 0 0 var(--s-2); }
  .vote-submit button { flex: 1 1 100%; }
  .choice { padding: var(--s-3); }
}
@media (pointer: coarse) {
  button, .btn { min-height: 2.6rem; }
  button.small, .btn.small { min-height: 2.25rem; }
  .theme-switch button { width: 2.3rem; height: 2rem; min-height: 0; }
}

/* ---------------------------------------------------------------- motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  button:active, .btn:active { transform: none; }
}

/* ---------------------------------------------------------------- forced colors (Windows High Contrast) */
@media (forced-colors: active) {
  .tag, .badge, .theme-switch button[aria-pressed="true"], .choice:has(input:checked) { border: 1px solid CanvasText; }
  nav.primary a.active, nav.primary a[aria-current="page"] { border-bottom-color: Highlight; }
}

/* ---------------------------------------------------------------- print: content only, always light */
@media print {
  :root, :root[data-theme] {
    color-scheme: light;
    --bg: #fff; --surface: #fff; --surface-sunken: #fff; --surface-hover: #fff; --text: #000; --heading: #000; --muted: #444;
    --border: #bbb; --border-strong: #999; --link: #000;
    --neutral-bg: #fff; --info-bg: #fff; --warn-bg: #fff; --high-bg: #fff; --ok-bg: #fff; --retired-bg: #fff;
    --neutral-fg: #000; --info-fg: #000; --warn-fg: #000; --high-fg: #000; --ok-fg: #000; --retired-fg: #444;
    --diff-old: #fff; --diff-new: #fff; --diff-old-bar: #000; --diff-new-bar: #000; --sticky-top: 0px;
  }
  .logo-on-dark { display: none !important; }
  .logo-on-light { display: block !important; }
  @page { margin: 16mm 14mm; }
  body { font-size: 11pt; background: #fff; color: #000; }
  header.top, nav, .skip-link, .theme-switch, .menu, .flash, .filters, .pager, .vote-submit, .no-print,
  button, .btn, input, select, form > label, .tabs, .actions, .danger-zone { display: none !important; }
  .print-only { display: block !important; }
  main { max-width: none; padding: 0; }
  .card, .stat, table, .empty { box-shadow: none; border-color: #bbb; break-inside: avoid; }
  .variants { display: block; }
  .variants > .card { margin-bottom: 8mm; }
  details:not([open]) { display: none; }
  textarea { border: 0; padding: 0; resize: none; overflow: visible; font: inherit; background: none; color: #000; }
  textarea:not(.post) { display: none; }
  textarea.post { field-sizing: content; height: auto; min-height: 0; max-height: none; }
  .post-body { background: none; border: 0; border-left: 2pt solid #000; border-radius: 0; padding: 0 0 0 4mm; font-size: 11pt; }
  .tag { border: 1px solid #777; }
  .tag.fixture { background: #fff; color: #000; }
  th { position: static; color: #000; }
  a { color: #000; text-decoration: none; }
  main a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #444; overflow-wrap: anywhere; }
  h1, h2, h3 { break-after: avoid; }
}

/* Hashtag recommendations under X drafts */
.hashtag-recs { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-top: .45rem; }
.hashtag-recs strong { margin-right: .2rem; }
