/* cfpl admin UI. A working 2001-era web application: silver ground, XP-blue accents, 1px bevelled controls, 2px radii, tabular numerals.
   Gloss (a quiet two-stop vertical gradient with a top highlight) is allowed on buttons, the status lamp and the logo mark only; never on text,
   panels or backgrounds. Four themes are CSS variables on <html data-theme="...">: light, dark, gruvbox dark, gruvbox light.
   With no choice made the OS preference decides (light or dark). One system stack, no web fonts. */

:root, :root[data-theme="light"] {
  --ground: #e6e9ef; --bg: #ffffff; --surface: #f3f5f9; --surface-2: #e2e6ee; --fg: #141922; --muted: #48515f; --line: #7a8699; --hair: #cbd2dd;
  --accent: #1c4fc4; --accent-fg: #ffffff; --accent-soft: #dbe6fb; --head-fg: #0b2a77;
  --ok: #0b6b3a; --ok-bg: #d6f5e1; --warn: #a8201a; --warn-bg: #fde3e1; --caution: #8a4a00; --caution-bg: #fdefc8; --shadow: 0 1px 2px rgba(16,24,40,.08);
  --b1: #ffffff; --b2: #f1f3f7; --b3: #e1e5ec; --b4: #d2d8e2; --bhi: rgba(255,255,255,.9); --bfg: #141922;
  --p1: #4070ce; --p2: #2f68e4; --p3: #1f55cc; --p4: #2a62dc; --pb: #123a94; --pfg: #ffffff;
  --d1: #c54c41; --d2: #cf3a2d; --d3: #b52a1e; --d4: #c2352a; --db: #7d170f; --dfg: #ffffff;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --ground: #0f1115; --bg: #1a1d24; --surface: #20242c; --surface-2: #2a2f39; --fg: #e6e9ee; --muted: #a3acba; --line: #6b7587; --hair: #323845;
    --accent: #7db0ff; --accent-fg: #0b1220; --accent-soft: #1d2b44; --head-fg: #a9c8ff;
    --ok: #4ade80; --ok-bg: #12351f; --warn: #f87171; --warn-bg: #3b1818; --caution: #fbbf24; --caution-bg: #3a2c0c; --shadow: none;
    --b1: #3b414d; --b2: #31363f; --b3: #282c35; --b4: #20242c; --bhi: rgba(255,255,255,.14); --bfg: #e6e9ee;
    --p1: #4272c8; --p2: #3a6fd6; --p3: #2b58b8; --p4: #3463c6; --pb: #1c3f8a; --pfg: #ffffff;
    --d1: #c34b43; --d2: #c2392f; --d3: #a32a21; --d4: #b0302a; --db: #6d1710; --dfg: #ffffff; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #0f1115; --bg: #1a1d24; --surface: #20242c; --surface-2: #2a2f39; --fg: #e6e9ee; --muted: #a3acba; --line: #6b7587; --hair: #323845;
  --accent: #7db0ff; --accent-fg: #0b1220; --accent-soft: #1d2b44; --head-fg: #a9c8ff;
  --ok: #4ade80; --ok-bg: #12351f; --warn: #f87171; --warn-bg: #3b1818; --caution: #fbbf24; --caution-bg: #3a2c0c; --shadow: none;
  --b1: #3b414d; --b2: #31363f; --b3: #282c35; --b4: #20242c; --bhi: rgba(255,255,255,.14); --bfg: #e6e9ee;
  --p1: #4272c8; --p2: #3a6fd6; --p3: #2b58b8; --p4: #3463c6; --pb: #1c3f8a; --pfg: #ffffff;
  --d1: #c34b43; --d2: #c2392f; --d3: #a32a21; --d4: #b0302a; --db: #6d1710; --dfg: #ffffff; color-scheme: dark;
}
:root[data-theme="gruvbox-dark"] {
  --ground: #1d2021; --bg: #282828; --surface: #32302f; --surface-2: #3c3836; --fg: #ebdbb2; --muted: #bfb097; --line: #7c6f64; --hair: #403c39;
  --accent: #83a598; --accent-fg: #282828; --accent-soft: #3c3836; --head-fg: #8ec07c;
  --ok: #b8bb26; --ok-bg: #3a3b17; --warn: #fc6a59; --warn-bg: #4a2420; --caution: #fabd2f; --caution-bg: #483a14; --shadow: none;
  --b1: #544c47; --b2: #484340; --b3: #3d3936; --b4: #33302e; --bhi: rgba(251,241,199,.16); --bfg: #ebdbb2;
  --p1: #19768d; --p2: #0f7088; --p3: #076678; --p4: #0b6c80; --pb: #054452; --pfg: #fbf1c7;
  --d1: #bc4435; --d2: #b33a2b; --d3: #9d0006; --d4: #a91a15; --db: #5e0004; --dfg: #fbf1c7; color-scheme: dark;
}
:root[data-theme="gruvbox-light"] {
  --ground: #f0e3b6; --bg: #fbf1c7; --surface: #f4e8be; --surface-2: #ebdbb2; --fg: #3c3836; --muted: #5f5448; --line: #8a7a62; --hair: #d5c4a1;
  --accent: #076678; --accent-fg: #fbf1c7; --accent-soft: #ebdbb2; --head-fg: #055a6b;
  --ok: #66610c; --ok-bg: #e4e1a8; --warn: #9d0006; --warn-bg: #f2c9b8; --caution: #86550b; --caution-bg: #f3dca0; --shadow: none;
  --b1: #fdf6d6; --b2: #f5e9bc; --b3: #ebdbb2; --b4: #dccb9f; --bhi: rgba(255,255,255,.7); --bfg: #3c3836;
  --p1: #1c748a; --p2: #0f7088; --p3: #076678; --p4: #0a6a7e; --pb: #054452; --pfg: #fbf1c7;
  --d1: #bb4336; --d2: #b9332a; --d3: #9d0006; --d4: #a8140f; --db: #5e0004; --dfg: #fbf1c7; color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
/* One system stack everywhere (inputs, tables, code); nothing is downloaded. */
html, body, button, input, select, textarea, pre, kbd, samp, table, th, td { font-family: Verdana, Tahoma, "DejaVu Sans", sans-serif; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--line) var(--surface); }
body { margin: 0; font-size: 13px; line-height: 1.5; background: var(--ground); color: var(--fg); font-variant-numeric: tabular-nums; }
::selection { background: var(--accent); color: var(--accent-fg); }
input, textarea, select { caret-color: var(--accent); accent-color: var(--accent); }
code, pre, kbd, samp { font-size: .95em; background: var(--surface-2); padding: .05em .35em; border-radius: 2px; }
pre { padding: .7rem .9rem; overflow: auto; }
/* the exact text a person approves: wrapped at a readable measure, never clipped or scrolled sideways */
pre.msg { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 1rem; line-height: 1.55; background: var(--bg); border: 1px solid var(--line); border-radius: 2px; padding: .8rem 1rem; max-width: 70ch; box-shadow: inset 0 1px 2px rgba(0,0,0,.08); }
a { color: var(--accent); text-underline-offset: .15em; }
h1 { font-size: 1.45rem; line-height: 1.25; margin: .2rem 0 1rem; padding-bottom: .35rem; border-bottom: 2px solid var(--accent); font-weight: 700; color: var(--head-fg); text-wrap: balance; }
h2 { font-size: 1.1rem; margin: 1.6rem 0 .6rem; font-weight: 700; color: var(--head-fg); } h3 { font-size: 1rem; margin: 1.2rem 0 .4rem; font-weight: 700; }
p { max-width: 72ch; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; z-index: 50; background: var(--bg); padding: 6px 10px; border: 1px solid var(--line); border-radius: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 2px; }

/* layout: fixed left menu + content */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 1rem .65rem; gap: .25rem; }
.side .brand { display: block; padding: .25rem .5rem .6rem; }
.brand-logo { display: block; width: 84px; aspect-ratio: 240 / 150; background: url(/logo.png) no-repeat left center / contain; }
.env-badge { align-self: flex-start; margin: 0 .5rem .4rem; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 1px 8px; border-radius: 2px; background: var(--ok); color: var(--bg); }
.env-staging .env-badge { background: var(--caution); } .env-development .env-badge { background: var(--muted); }
.side nav { display: flex; flex-direction: column; gap: .1rem; }
.nav-group { margin: .9rem .5rem .25rem; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.side nav a { display: block; padding: .4rem .6rem; border-radius: 2px; color: var(--fg); text-decoration: none; font-weight: 400; }
.side nav a:hover { background: var(--surface-2); }
.side nav a[aria-current="page"] { background: var(--accent); color: var(--accent-fg); font-weight: 700; }
.side-foot { margin-top: auto; padding-top: 1rem; display: flex; flex-direction: column; gap: .6rem; border-top: 1px solid var(--hair); }
.side-foot label { display: flex; flex-direction: column; gap: .2rem; font-size: 12px; color: var(--muted); margin: 0; }
.side-foot select { width: 100%; }
.who { font-size: 12px; color: var(--muted); padding: 0 .25rem; } .who strong { color: var(--fg); font-weight: 700; }
.side-foot form { margin: 0; } .side-foot button { width: 100%; }
.content { min-width: 0; display: flex; flex-direction: column; }
.menu-toggle { display: none; }
main { width: 100%; max-width: 1120px; margin: 0 auto; padding: 1.2rem 1.6rem 2rem; flex: 1; }
.foot { color: var(--muted); text-align: center; padding: 1rem; font-size: 12px; }
.banner { padding: .55rem 1.5rem; color: #fff; font-weight: 700; } .banner-kill { background: #a8201a; } .banner-throttle { background: #8a4a00; }

/* the safety lamp: gloss is allowed here; the words beside it carry the meaning, the colour only backs them up */
.lamp { display: inline-block; flex: none; width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0,0,0,.5); box-shadow: 0 1px 2px rgba(0,0,0,.35), inset 0 1px 1px rgba(255,255,255,.5); vertical-align: -2px; background: radial-gradient(circle at 35% 30%, #ffffff 0, #d4d8df 30%, #9aa3b0 70%, #6b7587 100%); }
.lamp-live { background: radial-gradient(circle at 35% 30%, #e1ffd9 0, #4cd964 30%, #1c9a38 65%, #0e6a24 100%); }
.lamp-idle, .lamp-hold { background: radial-gradient(circle at 35% 30%, #fff4cc 0, #ffc83d 30%, #e09100 65%, #9a6200 100%); }
.lamp-stop { background: radial-gradient(circle at 35% 30%, #ffdad5 0, #ff6a5c 30%, #d62c1f 65%, #8f1a10 100%); }
.lamp-chip { display: flex; align-items: center; gap: .45rem; margin: 0 .5rem .6rem; font-size: 12px; font-weight: 700; color: var(--fg); text-decoration: none; }
.lamp-chip:hover { text-decoration: underline; }
.menu-sending { display: none; }
main:focus { outline: none; }

/* components */
.panel { background: var(--bg); border: 1px solid var(--line); border-radius: 2px; margin: 0 0 1rem; box-shadow: var(--shadow); scroll-margin-top: 3.5rem; }
.panel-head { margin: 0; padding: .35rem .8rem; font-size: 1rem; background: var(--surface-2); border-bottom: 2px solid var(--accent); color: var(--head-fg); }
.panel-body { padding: .8rem 1rem 1rem; }
.panel-body > :first-child { margin-top: 0; }
table.data { border-collapse: collapse; width: 100%; background: var(--bg); }
.data th, .data td { border-bottom: 1px solid var(--hair); padding: .4rem .65rem; text-align: left; vertical-align: top; }
.data thead th { font-size: 12px; font-weight: 700; color: var(--head-fg); background: var(--surface-2); border-bottom: 2px solid var(--accent); white-space: nowrap; }
.data tbody th { font-weight: 700; }
.data tbody tr:hover { background: var(--surface); }
caption { text-align: left; color: var(--muted); font-size: 12px; padding: .3rem 0; }
.scroll { position: relative; overflow-x: auto; max-width: 100%; margin: .4rem 0 .8rem; border: 1px solid var(--hair); }
.scroll > table.data { min-width: 28rem; } .scroll:focus-visible { outline-offset: -2px; }
.badge { display: inline-block; padding: 0 7px; border-radius: 2px; border: 1px solid var(--hair); background: var(--surface-2); color: var(--fg); font-size: 12px; font-weight: 700; }
.badge-approved, .badge-verified, .badge-submitted, .badge-replied, .badge-active, .badge-ok, .badge-healthy { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
.badge-paused, .badge-warn, .badge-degraded, .badge-quarantined, .badge-at_risk { background: var(--caution-bg); color: var(--caution); border-color: var(--caution); }
.badge-submit_failed, .badge-qa_failed, .badge-rejected, .badge-suppressed, .badge-over, .badge-unhealthy { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }
.flash { padding: .55rem .9rem; border-radius: 2px; margin: 0 0 1rem; border: 1px solid; position: sticky; top: 0; z-index: 20; max-width: none; font-weight: 700; }
.flash-notice { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); } .flash-error { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }
.empty, .muted, .note { color: var(--muted); } .note { font-size: 13px; } .muted { opacity: 1; }
.pager { display: flex; gap: 1rem; margin-top: 1rem; }

/* forms */
form label { display: block; margin: .5rem 0; font-weight: 700; }
input, select, textarea, button { font-size: inherit; color: var(--fg); }
input:not([type=checkbox]):not([type=radio]), select, textarea { background: var(--bg); border: 1px solid var(--line); border-radius: 2px; padding: .32rem .5rem; max-width: 100%; box-shadow: inset 0 1px 2px rgba(0,0,0,.12); }
input:not([type=checkbox]):not([type=radio]):focus, select:focus, textarea:focus { border-color: var(--accent); }
a.button { display: inline-block; text-decoration: none; }
button, .button { cursor: pointer; color: var(--bfg); background: linear-gradient(to bottom, var(--b1), var(--b2) 48%, var(--b3) 52%, var(--b4)); border: 1px solid var(--line); border-radius: 2px; padding: .32rem .9rem; font-weight: 700; box-shadow: inset 0 1px 0 var(--bhi); }
button:hover { border-color: var(--accent); filter: brightness(1.04); }
button:active { background: linear-gradient(to top, var(--b1), var(--b2) 48%, var(--b3) 52%, var(--b4)); box-shadow: inset 0 1px 2px rgba(0,0,0,.25); }
button:disabled { opacity: .55; cursor: not-allowed; filter: none; }
button.primary, a.button.primary { color: var(--pfg); background: linear-gradient(to bottom, var(--p1), var(--p2) 48%, var(--p3) 52%, var(--p4)); border-color: var(--pb); text-shadow: 0 -1px 0 rgba(0,0,0,.3); }
button.primary:active, a.button.primary:active { background: linear-gradient(to top, var(--p1), var(--p2) 48%, var(--p3) 52%, var(--p4)); }
button.danger { color: var(--dfg); background: linear-gradient(to bottom, var(--d1), var(--d2) 48%, var(--d3) 52%, var(--d4)); border-color: var(--db); text-shadow: 0 -1px 0 rgba(0,0,0,.3); }
button.quiet { background: transparent; box-shadow: none; font-weight: 400; color: var(--accent); border-color: var(--hair); }
.side form button.secondary { background: transparent; box-shadow: none; font-weight: 400; color: var(--muted); }
.field { margin: 0 0 .85rem; min-width: 0; }
.field > label { margin: 0 0 .2rem; }
.field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea { width: 100%; max-width: 28rem; }
.field input.narrow { width: 5rem; }
.field textarea { max-width: 36rem; min-height: 5.5rem; }
.field .hint, .hint { margin: .2rem 0 0; color: var(--muted); font-size: 12px; max-width: 60ch; }
.field-error { margin: .25rem 0 0; color: var(--warn); font-size: 12px; max-width: 60ch; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--warn); border-width: 2px; }
.field.check label { display: flex; gap: .5rem; align-items: center; font-weight: 400; margin: 0; }
fieldset { border: 1px solid var(--hair); border-radius: 2px; margin: 0 0 1rem; padding: .6rem 1rem .2rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); column-gap: 1.6rem; }
legend { padding: 0 .4rem; font-weight: 700; color: var(--head-fg); }
details.advanced { margin: 0 0 1rem; border: 1px solid var(--hair); border-radius: 2px; padding: .4rem 1rem 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); column-gap: 1.6rem; }
details.advanced > summary { grid-column: 1 / -1; cursor: pointer; font-weight: 700; color: var(--head-fg); padding-bottom: .4rem; }
.actions { margin: 1rem 0 0; }
.inline-fields { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: end; }
.inline-fields .hint { flex-basis: 100%; }
form.filter { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: end; margin: 1rem 0; padding: .7rem 1rem; background: var(--surface); border: 1px solid var(--hair); border-radius: 2px; }
form.filter label { display: flex; flex-direction: column; gap: .2rem; font-size: 12px; margin: 0; color: var(--muted); }
ul.stats { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .75rem; }
ul.stats li { background: var(--bg); border: 1px solid var(--line); border-radius: 2px; padding: .6rem .9rem; box-shadow: var(--shadow); }
meter { width: 8rem; vertical-align: middle; accent-color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* campaign page: status, readiness, section links */
.lampline { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; margin: 0 0 .5rem; font-size: 1.05rem; }
.lamp-label { color: var(--head-fg); } .why, .meta { margin: .25rem 0; color: var(--muted); } .why q { color: var(--fg); }
.ready-head { margin: 1rem 0 .3rem; }
ul.ready { list-style: none; margin: 0 0 1rem; padding: 0; }
ul.ready li { display: flex; gap: .6rem; align-items: baseline; padding: .15rem 0; }
.ready-tag { display: inline-block; min-width: 3.4rem; text-align: center; font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 2px; border: 1px solid; }
.ready-ok .ready-tag { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); } .ready-todo .ready-tag { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }
form.golive { margin-top: 1rem; padding-top: .2rem; border-top: 1px solid var(--hair); } form.golive h3 { margin-top: .8rem; }
dl.summary { display: grid; grid-template-columns: 8rem minmax(0, 1fr); gap: .25rem 1rem; margin: 0 0 1rem; max-width: 60rem; }
dl.summary dt { font-weight: 700; color: var(--muted); } dl.summary dd { margin: 0; }
/* review: the undo line, the queue cue, what blocks an approval, the decision panel */
nav.crumb { margin: 0 0 .3rem; font-size: 12px; color: var(--muted); }
.queue-cue { margin: 0 0 .6rem; font-size: 12px; }
form.undo-form { margin: 0; display: flex; flex-wrap: wrap; gap: .4rem .8rem; align-items: center; }
ul.blocks { margin: 0; padding-left: 1.1rem; } ul.blocks li { margin: 0 0 .6rem; } ul.blocks .inline-form { display: block; margin: .3rem 0 0; }
.decide .field { margin: 0 0 .5rem; } .decide form { margin: 0 0 1rem; }
/* costs: the unpriced and over-budget chips; the shared status line, key numbers and crumb styles are defined with the other analytics screens */
.badge-unpriced, .badge-blown { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }
.statusline { margin: 0 0 .6rem; } .statusline p { margin: 0 0 .3rem; }
.presets { margin: .2rem 0 .8rem; font-size: 12px; } .presets a { margin-left: .6rem; } .presets a[aria-current] { font-weight: 700; text-decoration: none; color: var(--fg); }
.takeaway { margin: 0 0 .8rem; max-width: 62ch; font-weight: 600; }
dl.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: .6rem .9rem; margin: 0 0 .8rem; }
dl.kpis .kpi { border: 1px solid var(--hair); background: var(--surface); border-radius: 2px; padding: .4rem .7rem; }
dl.kpis dt { font-size: 12px; color: var(--muted); margin: 0; } dl.kpis dd { margin: 0; } dl.kpis strong { display: block; font-size: 1.5rem; line-height: 1.2; color: var(--head-fg); } dl.kpis small { display: block; color: var(--muted); font-size: 12px; }
form.pause { display: flex; flex-wrap: wrap; gap: .4rem .7rem; align-items: end; margin-top: .8rem; }
form.pause label { flex-basis: 100%; margin: 0; } form.pause input { width: min(100%, 22rem); }
.secnav { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1rem; }
.secnav a { padding: .25rem .8rem; border: 1px solid var(--line); border-radius: 2px; background: var(--surface); color: var(--head-fg); text-decoration: none; font-weight: 700; }
.secnav a:hover { background: var(--accent-soft); }
/* analytics: status line, KPI strip, text trend lines, verdict chips, the hour-of-day grid */
nav.crumb { margin: 0 0 .3rem; font-size: 12px; color: var(--muted); }
.statusline { margin: 0 0 .6rem; } .statusline p { margin: 0; } .statusline form.inline { display: inline; margin: 0 0 0 .5rem; }
.presets { margin: .2rem 0 .8rem; font-size: 12px; } .presets a { margin-left: .6rem; } .presets a[aria-current] { font-weight: 700; text-decoration: none; color: var(--fg); }
.spark { font-size: 1.1rem; letter-spacing: .05em; color: var(--accent); } .trend { margin: .2rem 0 .6rem; }
.badge-v-ahead { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); } .badge-v-behind { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }
.badge-v-insufficient { background: var(--caution-bg); color: var(--caution); border-color: var(--caution); }
table.heat { min-width: 52rem; } table.heat th, table.heat td { text-align: center; padding: .15rem .2rem; font-size: 11px; white-space: nowrap; } table.heat tbody th { text-align: left; padding-left: .5rem; }
table.heat td.heat-low { color: var(--muted); font-style: italic; background: repeating-linear-gradient(135deg, transparent 0 4px, var(--hair) 4px 5px); }
table.heat td.heat-1 { background: color-mix(in srgb, var(--accent) 10%, var(--bg)); } table.heat td.heat-2 { background: color-mix(in srgb, var(--accent) 18%, var(--bg)); }
table.heat td.heat-3 { background: color-mix(in srgb, var(--accent) 26%, var(--bg)); } table.heat td.heat-4 { background: color-mix(in srgb, var(--accent) 34%, var(--bg)); } table.heat td.heat-5 { background: color-mix(in srgb, var(--accent) 42%, var(--bg)); font-weight: 700; }
.first-reply form { margin: 0; } .first-reply button { margin-left: .6rem; }
ol.steps { padding-left: 1.4rem; }
.error-list { margin: .3rem 0 0; padding-left: 1.2rem; font-weight: 400; } .error-list a { color: inherit; }

/* set-up sections: collapsible panels with a one-line summary of the current value; pickers for windows and steps */
details.panel > summary.panel-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .9rem; cursor: pointer; }
details.panel > summary.panel-head::marker { color: var(--head-fg); }
details.panel:not([open]) > summary.panel-head { border-bottom: 0; }
.panel-head h2 { display: inline; margin: 0; font-size: 1rem; color: inherit; }
.panel-note { margin-left: auto; font-weight: 400; font-size: 12px; color: var(--muted); }
fieldset.windows, fieldset.steps-edit { display: block; }
.window-row, .step-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; padding: .45rem 0; border-bottom: 1px solid var(--hair); }
.window-row:last-of-type, .step-row:last-of-type { border-bottom: 0; }
.days { display: flex; flex-wrap: wrap; gap: .25rem; }
.daybox { display: inline-flex; align-items: center; gap: .3rem; margin: 0; padding: .15rem .55rem; font-weight: 400; background: var(--surface); border: 1px solid var(--line); border-radius: 2px; cursor: pointer; }
.daybox:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); font-weight: 700; }
.timebox, .step-row > label { display: inline-flex; align-items: center; gap: .4rem; margin: 0; font-weight: 700; }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; }
.badge-open { background: var(--caution-bg); color: var(--caution); border-color: var(--caution); }
.badge-done { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
/* replies: label chips, unread rows, the one-line message preview, in-page confirm steps, the inbox-clear panel */
.badge-interested { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
.badge-unsubscribe { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }
.badge-unsure { background: var(--caution-bg); color: var(--caution); border-color: var(--caution); }
nav.crumb { margin: 0 0 .3rem; font-size: 12px; color: var(--muted); }
.secnav a[aria-current] { background: var(--accent-soft); border-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem .6rem; align-items: center; margin: .2rem 0 .8rem; }
.chip { padding: .1rem .6rem; border: 1px solid var(--hair); border-radius: 2px; text-decoration: none; } .chip[aria-current] { background: var(--accent-soft); border-color: var(--accent); font-weight: 700; }
tr.unread th.reply-main a { font-weight: 700; } tr.unread th.reply-main { background: var(--surface); } .dot { color: var(--accent); margin-right: .3rem; }
th.reply-main { font-weight: 400; text-align: left; } .snippet { color: var(--fg); overflow-wrap: anywhere; } .lede { max-width: 60rem; margin: .3rem 0 .8rem; }
.label-buttons { display: flex; flex-wrap: wrap; gap: .4rem; margin: .3rem 0 .6rem; } .label-buttons button[disabled] { opacity: 1; background: var(--accent-soft); border-color: var(--accent); }
.inline-form { display: block; margin: 0 0 .4rem; }
details.confirm-step { margin: .4rem 0; } details.confirm-step > summary { display: inline-block; list-style: none; cursor: pointer; } details.confirm-step > summary::-webkit-details-marker { display: none; }
details.confirm-step[open] { padding: .5rem .7rem; border: 1px solid var(--warn); background: var(--warn-bg); } details.confirm-step p { margin: .3rem 0 .5rem; }
.confirm-form .field { margin: 0 0 .4rem; }
.inbox-clear { max-width: 36rem; }
.row-actions { white-space: nowrap; } .row-actions form { display: inline-block; margin: 0 .4rem 0 0; }
td .lamp { margin-right: .15rem; }

/* dashboard: sending status, what needs a person, where every lead is */
ul.reasons { margin: .3rem 0 .5rem; padding-left: 1.2rem; }
ul.needs { list-style: none; margin: 0; padding: 0; }
ul.needs li { display: grid; grid-template-columns: minmax(0, 24rem) 13rem minmax(0, 1fr); gap: .15rem 1rem; align-items: baseline; padding: .5rem 0; border-bottom: 1px solid var(--hair); }
ul.needs li:last-child { border-bottom: 0; }
.needs-link { font-size: 1.05rem; } .num { display: inline-block; min-width: 2.4rem; font-size: 1.35rem; }
.needs-age { color: var(--muted); } ul.needs .hint { margin: 0; }
table.stages { max-width: 36rem; } .num-cell { text-align: right; width: 6rem; font-variant-numeric: tabular-nums; }
.data .group th { background: var(--surface-2); color: var(--head-fg); font-size: 12px; border-bottom: 1px solid var(--line); }
.data .group th.group-needs-fixing { background: var(--warn-bg); color: var(--warn); }
@media (pointer: coarse) { .foot .linklike { display: none; } }

/* admin pages: the kill switch is the one control that stops everything, so its panel is red and its steps are in the page */
.danger-panel { border-color: var(--warn); }
.danger-panel .panel-head { background: var(--warn-bg); color: var(--warn); border-bottom-color: var(--warn); }
.danger-panel .panel-head .panel-note { color: var(--warn); font-weight: 700; }
ul.effects { margin: .2rem 0 1rem; padding-left: 1.2rem; max-width: 60ch; }
details.ks-step { margin-top: .6rem; }
details.ks-step > summary.button { display: inline-block; list-style: none; cursor: pointer; padding: .4rem 1rem; border-radius: 2px; font-weight: 700; border: 1px solid var(--line); }
details.ks-step > summary.button::-webkit-details-marker { display: none; }
details.ks-step > summary.button.danger { color: var(--dfg); background: linear-gradient(to bottom, var(--d1), var(--d2) 48%, var(--d3) 52%, var(--d4)); border-color: var(--db); text-shadow: 0 -1px 0 rgba(0,0,0,.3); box-shadow: inset 0 1px 0 var(--bhi); }
details.ks-step > summary.button.primary { color: var(--pfg); background: linear-gradient(to bottom, var(--p1), var(--p2) 48%, var(--p3) 52%, var(--p4)); border-color: var(--pb); text-shadow: 0 -1px 0 rgba(0,0,0,.3); box-shadow: inset 0 1px 0 var(--bhi); }
details.ks-step[open] > summary.button { margin-bottom: .8rem; }
dl.links { display: grid; grid-template-columns: minmax(12rem, 16rem) minmax(0, 1fr); gap: .35rem 1.2rem; margin: 0; }
dl.links dt { font-weight: 700; } dl.links dd { margin: 0; color: var(--muted); max-width: 70ch; }
dl.roles { margin-top: 1rem; }
.err { color: var(--warn); font-weight: 700; }
.role-form { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
th .meta, .data .meta { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
/* approval queue: the message is the centre of each row; tabs say which list you are on; the bulk bar and its confirmation */
.tabs { display: flex; flex-wrap: wrap; gap: .3rem; margin: 0 0 .8rem; }
.tabs a { display: inline-block; padding: .3rem .9rem; border: 1px solid var(--line); background: var(--surface); color: var(--fg); text-decoration: none; font-weight: 700; }
#status .lampline { flex-wrap: nowrap; align-items: flex-start; } #status .lampline .lamp { margin-top: .35rem; } #status span.lamp-label { flex: 1 1 auto; min-width: 0; }
.tabs a .lamp { width: 10px; height: 10px; margin-right: .25rem; vertical-align: -1px; }
.tabs a[aria-current="page"] { background: var(--bg); color: var(--head-fg); box-shadow: inset 0 -3px 0 var(--accent); }
table.queue td.sel { width: 2.6rem; text-align: center; }
table.queue th.who { width: 15rem; font-weight: 400; }
.selbox { display: inline-flex; align-items: center; justify-content: center; margin: 0; }
.who .domain { display: block; font-weight: 700; white-space: nowrap; }
.who .meta { display: block; color: var(--muted); font-size: 12px; }
.who .chips { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .35rem; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 70ch; }
tr[data-href] { cursor: pointer; }
fieldset.bulk { margin: 0 0 1rem; display: block; }
.selectall-bar { display: none; }
.selectall { display: inline-flex; align-items: center; gap: .5rem; margin: 0; font-weight: 700; }
th.sel .selbox { display: inline-flex; }
fieldset.bulk .quiet { margin-left: .5rem; }
.approve-dialog { max-width: min(46rem, 96vw); }
.bad-list { max-height: 50vh; overflow: auto; padding: 0 .4rem 0 1.4rem; margin: .5rem 0 1rem; }
.bad-list li { margin: 0 0 .9rem; } .bad-list li strong { display: block; margin-bottom: .15rem; }
.bad-list .msg-text { background: var(--surface); border: 1px solid var(--hair); padding: .5rem .7rem; }

/* lead list check */
ul.found { margin: 0; padding-left: 1.2rem; } ul.found li { margin: .15rem 0; } ul.found li.flag { color: var(--caution); font-weight: 700; }
.flag-panel { border-color: var(--caution); } .flag-panel .panel-head { background: var(--caution-bg); color: var(--caution); border-bottom-color: var(--caution); }
ul.in-campaigns, ul.plain { margin: 0; padding-left: 1.1rem; } ul.in-campaigns { list-style: none; padding: 0; }

/* small screens: the menu slides in; controls grow to a thumb-sized target and inputs stop triggering browser zoom */
@media (max-width: 860px) {
  .shell { display: block; }
  .menu-toggle { display: inline-flex; align-items: center; position: sticky; top: 0; z-index: 30; width: 100%; min-height: 44px; justify-content: flex-start; border-radius: 0; border: 0; border-bottom: 1px solid var(--line); background: var(--surface); padding: .7rem 1rem; }
  /* closed: offscreen AND removed from tab order and the accessibility tree (visibility is delayed so the slide-out still animates) */
  .side { position: fixed; z-index: 40; left: 0; top: 0; bottom: 0; width: 270px; transform: translateX(-102%); visibility: hidden; transition: transform .18s ease, visibility 0s linear .18s; box-shadow: 0 0 40px rgba(0,0,0,.35); }
  body.menu-open .side { transform: none; visibility: visible; transition: transform .18s ease, visibility 0s; }
  main { padding: 1rem; }
  .flash { top: 44px; }
  button, .button, input:not([type=checkbox]):not([type=radio]), select, textarea { min-height: 44px; font-size: 16px; }
  button, .button { padding-inline: 1rem; }
  input[type=checkbox], input[type=radio] { width: 24px; height: 24px; flex: none; }
  .field.check label { min-height: 44px; }
  dl.links { grid-template-columns: 1fr; gap: 0; } dl.links dd { margin-bottom: .7rem; } dl.links dt a { display: inline-flex; align-items: center; min-height: 44px; }
  details.ks-step > summary.button { min-height: 44px; display: inline-flex; align-items: center; }
  /* the queue becomes one card per draft, message first, with a bulk bar that appears only while something is selected */
  .scroll > table.queue { min-width: 0; }
  table.queue, table.queue tbody, table.queue th, table.queue td, table.queue caption { display: block; }
  table.queue thead { position: absolute; left: -9999px; }
  table.queue tr { display: flex; flex-direction: column; position: relative; padding: .6rem .7rem .7rem 3.4rem; border-bottom: 2px solid var(--hair); }
  table.queue td.sel { position: absolute; left: .2rem; top: .2rem; padding: 0; border: 0; }
  table.queue .selbox { width: 44px; height: 44px; }
  table.queue td.sel input { width: 24px; height: 24px; }
  .tabs a { min-height: 44px; display: inline-flex; align-items: center; }
  table.queue td.msg { order: -1; border: 0; padding: 0 0 .5rem; } table.queue th.who { width: auto; border: 0; padding: 0; }
  table.queue .domain { white-space: normal; overflow-wrap: anywhere; }
  .selectall-bar { display: block; padding: .2rem 1rem; border: 1px solid var(--hair); border-bottom: 0; background: var(--surface); margin: 0 0 -1px; }
  .selectall { min-height: 44px; } .selectall input { width: 24px; height: 24px; }
  form[data-bulk] fieldset.bulk { display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; background: var(--surface); margin: 0; padding: .6rem 1rem; border-radius: 0; max-height: 70vh; overflow: auto; box-shadow: 0 -2px 8px rgba(0,0,0,.25); }
  form[data-bulk].has-selection::after { content: ''; display: block; height: 13rem; }
  form[data-bulk].has-selection fieldset.bulk { display: block; }
  fieldset.bulk .muted { display: none; }
  fieldset.bulk .quiet { margin: .4rem 0 0; }
  .menu-toggle { justify-content: space-between; }
  .menu-sending { display: inline-flex; align-items: center; gap: .4rem; font-size: 12px; }
  ul.needs li { grid-template-columns: 1fr; padding: .4rem 0; }
  .needs-link { display: flex; align-items: center; gap: .4rem; min-height: 44px; }
  a.button { display: inline-flex; align-items: center; min-height: 44px; }
  .secnav a, .side nav a { min-height: 44px; display: inline-flex; align-items: center; }
  details.panel > summary, details.advanced > summary { min-height: 44px; align-content: center; }
  .ready-link { display: inline-flex; align-items: center; min-height: 44px; }
  ul.ready li { align-items: center; }
  .daybox { min-width: 44px; min-height: 44px; justify-content: center; }
  .timebox, .step-row > label { flex: 1 1 100%; }
  .row-actions { white-space: normal; }
  /* a table that stacks into cards on a phone, so the row's actions stay in view instead of off to the right */
  .scroll > table.stack { min-width: 0; }
  table.stack, table.stack tbody, table.stack tr, table.stack th, table.stack td { display: block; }
  table.stack thead { position: absolute; left: -9999px; }
  table.stack caption { display: block; padding: .4rem .7rem; }
  table.stack tr { padding: .5rem .7rem; border-bottom: 2px solid var(--hair); }
  table.stack th, table.stack td { border: 0; padding: .15rem 0; }
  table.stack td[data-label]::before { content: attr(data-label) ": "; font-weight: 700; color: var(--muted); }
  .row-actions { display: flex; gap: .5rem; margin-top: .4rem; }
  .panel-note { margin-left: 0; flex-basis: 100%; }
  .side nav a { display: flex; }
  fieldset, details.advanced { display: block; }
  dl.summary { grid-template-columns: 1fr; gap: 0; } dl.summary dd { margin-bottom: .5rem; }
  .panel-body { padding: .7rem .8rem .9rem; }
  /* scrim behind the open menu, and no background scrolling while it is open */
  body.menu-open::after { content: ''; position: fixed; inset: 0; z-index: 35; background: rgba(0,0,0,.45); }
  body.menu-open { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) { .side, body.menu-open .side { transition: none; } }
@media print { .side, .menu-toggle { display: none; } .shell { display: block; } }

/* keyboard shortcuts, command palette, help */
kbd { display: inline-block; min-width: 1.4em; text-align: center; padding: .05em .4em; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 2px; background: var(--surface); font-size: .8em; line-height: 1.5; }
.side nav a { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.side nav a kbd.hint { opacity: .55; font-size: .7em; }
.side nav a:hover kbd.hint, .side nav a:focus kbd.hint { opacity: 1; }
button.linklike { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 500; cursor: pointer; text-decoration: underline; }
tr.kb-row { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--accent-soft); }
.kb-armed { outline: 3px solid var(--caution); outline-offset: 2px; }
#kb-toast { position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%); z-index: 90; background: var(--fg); color: var(--bg); padding: .5rem .9rem; border-radius: 2px; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .15s; max-width: 90vw; }
#kb-toast.show { opacity: .95; }
dialog.kb-dialog { border: 1px solid var(--line); border-radius: 3px; background: var(--bg); color: var(--fg); padding: 1.1rem 1.3rem; max-width: min(40rem, 94vw); max-height: 85vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog.kb-dialog::backdrop { background: rgba(0,0,0,.45); }
dialog.kb-dialog h2 { margin: 0 0 .5rem; } dialog.kb-dialog h3 { margin: 1rem 0 .3rem; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.kb-table { width: 100%; border-collapse: collapse; } .kb-table td { padding: .2rem .4rem; border: 0; vertical-align: top; } .kb-table td:first-child { white-space: nowrap; width: 9rem; }
.kb-pref { display: block; margin: 1rem 0 .6rem; }
#kb-palette { width: min(36rem, 94vw); padding: .6rem; position: fixed; top: 12vh; margin: 0 auto; }
#kb-palette input { width: 100%; font-size: 16px; padding: .6rem .7rem; }
#kb-list { list-style: none; margin: .5rem 0 0; padding: 0; max-height: 50vh; overflow: auto; }
#kb-list li { display: flex; gap: .6rem; align-items: baseline; padding: .4rem .6rem; border-radius: 2px; cursor: pointer; }
#kb-list li[aria-selected=true] { background: var(--accent-soft); outline: 1px solid var(--accent); }
#kb-list .kb-group { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); min-width: 5.5rem; }
#kb-list .kb-label { flex: 1; } #kb-list .kb-detail { color: var(--muted); font-size: 13px; } #kb-list .kb-empty { color: var(--muted); cursor: default; }
@media print { #kb-toast, dialog.kb-dialog { display: none; } }
@media (prefers-reduced-motion: reduce) { #kb-toast { transition: none; } }
.side nav a[aria-current="page"] kbd.hint { background: transparent; color: inherit; border-color: currentColor; opacity: .8; }

/* saved views */
details.views { margin: .4rem 0 .8rem; }
details.views summary { cursor: pointer; font-weight: 600; }
ul.view-list { list-style: none; padding: 0; margin: .4rem 0; }
ul.view-list li { padding: .15rem 0; }
form.inline { display: inline; margin-left: .5rem; }
.muted { color: var(--muted); font-size: 13px; }
form.view-save { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: end; margin: .5rem 0; }

/* learning: placeholder chips, effect chips, the purge form, the history list */
.tok { display: inline-block; padding: 0 .4rem; border: 1px solid var(--hair); background: var(--surface-2); border-radius: 2px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; margin: 0 .1rem; }
.badge-v-improved { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); } .badge-v-worse { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }
.badge-v-not_enough_data, .badge-v-confounded { background: var(--caution-bg); color: var(--caution); border-color: var(--caution); } .badge-v-no_clear_change { background: var(--surface-2); color: var(--fg); }
.badge-rolled_back { background: var(--surface-2); color: var(--muted); }
/* API tokens screen (#9626): the two rights a token can hold are shown with the same colours as caution and warning elsewhere, and always with their words */
.badge-learning { background: var(--caution-bg); color: var(--caution); border-color: var(--caution); } .badge-live { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }
table.tokens td .badge { margin: 0 .35rem .3rem 0; white-space: normal; }
th.pattern { font-weight: 400; text-align: left; }
ol.timeline { margin: 0; padding-left: 1.2rem; } ol.timeline li { margin: 0 0 .25rem; }
.verdict p { margin: 0 0 .4rem; }
/* ==== learning pages: overflow, filters, danger zone, next step, delight (BEGIN; kept in one block to ease merges) ==== */
.learning-page { min-width: 0; }
.learning-page h1, .learning-page .panel-head, .learning-page th, .learning-page td { overflow-wrap: anywhere; }
.learning-page select, .learning-page input:not([type=checkbox]):not([type=radio]) { max-width: 100%; min-width: 0; }
.learning-page form.filter label { min-width: 0; max-width: 100%; }
.learning-page form.filter select { max-width: min(100%, 24rem); }
.learning-page .link-row a, .learning-page th a, .learning-page .next-step a, .learning-page .panel-sub a, .learning-page #how-measured a { display: inline-block; padding: 3px 0; }
.learning-page p.link-row { margin: 0 0 .8rem; }
.panel-sub { margin: 0; padding: .35rem .8rem; border-bottom: 1px solid var(--hair); font-size: 12px; }
.next-step { margin: 0 0 .8rem; padding: .45rem .8rem; border: 1px solid var(--accent); background: var(--accent-soft); border-radius: 2px; }
details.more-actions { margin: .2rem 0 .4rem; }
details.more-actions > summary { cursor: pointer; font-weight: 700; color: var(--head-fg); padding: 3px 0; }
.purge-counts { margin: .3rem 0 .6rem; } .purge-counts li { margin: 0 0 .2rem; }
form.purge-form { margin: 0; }
/* the filters sit in a details: always open on a wide screen (where the browser supports ::details-content), folded away on a phone */
details.filter-fold { margin: 1rem 0; }
details.filter-fold > summary { cursor: pointer; font-weight: 700; color: var(--head-fg); padding: 3px 0; }
details.filter-fold > form.filter { margin: .4rem 0 0; }
@supports selector(::details-content) {
  @media (min-width: 861px) {
    details.filter-fold > summary { display: none; }
    details.filter-fold::details-content { content-visibility: visible; display: block; }
    details.filter-fold > form.filter { margin-top: 0; }
  }
}
/* "How this fills in": a checklist that ticks from real counts */
ol.steps { list-style: none; padding-left: 0; }
ol.steps li { position: relative; padding-left: 1.7rem; margin: 0 0 .55rem; }
ol.steps li::before { content: ''; position: absolute; left: 0; top: .12rem; width: .95rem; height: .95rem; border: 1px solid var(--line); background: var(--bg); border-radius: 2px; box-sizing: border-box; }
ol.steps li.done::before { background: var(--ok-bg); border-color: var(--ok); }
ol.steps li.done::after { content: ''; position: absolute; left: .33rem; top: .2rem; width: .27rem; height: .52rem; border: solid var(--ok); border-width: 0 2px 2px 0; transform: rotate(45deg); }
/* the suggestion just decided is the one you land on */
section.suggestion:target { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
/* before and after, only shown for an "improved" verdict whose ranges do not overlap */
ul.beforeafter { list-style: none; margin: .5rem 0; padding: 0; }
ul.beforeafter li { display: flex; flex-wrap: wrap; gap: .2rem .8rem; align-items: center; margin: 0 0 .4rem; }
.ba-name { font-weight: 700; min-width: 9rem; } .ba-pair { white-space: nowrap; }
.learning-page meter { width: 7rem; height: .8rem; vertical-align: middle; background: var(--surface-2); border: 1px solid var(--hair); border-radius: 2px; }
.learning-page meter::-webkit-meter-bar { background: var(--surface-2); border: 0; height: .8rem; }
.learning-page meter::-webkit-meter-optimum-value, .learning-page meter::-webkit-meter-suboptimum-value, .learning-page meter::-webkit-meter-even-less-good-value { background: var(--muted); }
.learning-page meter::-moz-meter-bar { background: var(--muted); }
.learning-page meter.ba-after::-webkit-meter-optimum-value, .learning-page meter.ba-after::-webkit-meter-suboptimum-value, .learning-page meter.ba-after::-webkit-meter-even-less-good-value { background: var(--ok); }
.learning-page meter.ba-after::-moz-meter-bar { background: var(--ok); }
@media (prefers-reduced-motion: no-preference) {
  ol.steps li.done::after { animation: step-tick .35s cubic-bezier(.2, .8, .2, 1) backwards; }
  ol.steps li:nth-child(2).done::after { animation-delay: .08s; } ol.steps li:nth-child(3).done::after { animation-delay: .16s; } ol.steps li:nth-child(4).done::after { animation-delay: .24s; } ol.steps li:nth-child(5).done::after { animation-delay: .32s; }
  section.suggestion:target { animation: suggestion-landed 1.4s cubic-bezier(.2, .8, .2, 1); }
}
@keyframes step-tick { from { transform: rotate(45deg) scale(0); opacity: 0; } }
@keyframes suggestion-landed { from { background-color: var(--accent-soft); } }
@media (max-width: 860px) {
  .learning-page .link-row a, .learning-page th a, details.more-actions > summary, details.filter-fold > summary { display: inline-flex; align-items: center; min-height: 44px; padding: 0; }
  details.filter-fold { margin: .6rem 0; }
  .learning-page form.filter select { max-width: 100%; }
  .learning-page form.filter label { flex: 1 1 100%; }
  .ba-name { flex-basis: 100%; }
}
/* ==== learning pages (END) ==== */
/* review screen */
.review-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(16rem, 1.4fr); gap: 1.5rem; align-items: start; }
.review-facts { background: var(--surface); border: 1px solid var(--line); border-radius: 2px; padding: .8rem 1rem; position: sticky; top: 1rem; }
.review-facts h2 { margin-top: 0; font-size: 1rem; } .review-facts dt { font-weight: 600; margin-top: .6rem; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; } .review-facts dd { margin: .1rem 0 0; }
@media (max-width: 960px) { .review-grid { grid-template-columns: 1fr; } .review-facts { position: static; } }
p.diff { white-space: pre-wrap; background: var(--surface); border: 1px solid var(--line); border-radius: 2px; padding: .6rem .8rem; }
p.diff ins { background: var(--ok-bg); color: var(--ok); text-decoration: underline; border-radius: 3px; } p.diff del { background: var(--warn-bg); color: var(--warn); border-radius: 2px; }
#live-qa { margin: .4rem 0; } #live-qa.live-ok strong { color: var(--ok); } #live-qa.live-bad strong { color: var(--warn); }
#queue-pos { margin: -.4rem 0 .8rem; } .advance-pref { white-space: nowrap; }
/* secrets: the one box per key, the how-to, the status lamp */
.sec-status .lampline { flex-wrap: nowrap; align-items: flex-start; } .sec-status .lampline .lamp { margin-top: .35rem; } .sec-status .lamp-label { flex: 1 1 auto; min-width: 0; }
table.secrets td.keycell { min-width: 22rem; } table.secrets .keyform { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: 0 0 .3rem; }
table.secrets .keyform input[type=password] { flex: 1 1 14rem; min-width: 0; } table.secrets .keyform .hint { flex-basis: 100%; margin: 0; }
details.how { margin: .4rem 0 0; } details.how > summary { cursor: pointer; color: var(--accent); } pre.how { white-space: pre-wrap; word-break: break-all; margin: .3rem 0; }
a.secret-hint { margin-left: .4rem; }
@media (max-width: 860px) { table.secrets td.keycell { min-width: 0; } }
table.secrets td[data-label=Status] { min-width: 9rem; }

/* sign-in: a centred panel, the environment named in the header, a show-password toggle */
.anon-head { display: flex; align-items: center; gap: .8rem; padding: 1rem 1.5rem; }
.anon-head .env-badge { align-self: center; margin: 0; }
.anon-themes { margin-left: auto; min-width: 11rem; }
.login-panel { max-width: 26rem; margin: 1.5rem auto; }
.login-panel .panel-head { margin: 0; padding: .35rem .8rem; font-size: 1rem; }
.login-panel .field input:not([type=checkbox]) { max-width: none; }
.login-panel form > button.primary { margin-top: .2rem; }
.pw { display: flex; gap: .4rem; align-items: center; } .pw input { flex: 1 1 auto; min-width: 0; }
@media (max-width: 860px) { .anon-head { flex-wrap: wrap; padding: .8rem 1rem; } .anon-themes { min-width: 0; flex: 1 1 100%; margin-left: 0; } .login-panel { margin: .8rem 0; max-width: none; } }

/* manual bucket: the row you are on (after an action, or with j/k), what needs reading first */
.mrow:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
tr.kb-row.mrow { background: var(--surface-2); }
.mrow-urgent > th, .mrow-urgent > td { background: var(--warn-bg); }
table[data-manual] .row-actions { white-space: normal; } table[data-manual] .row-actions form { margin: 0 .35rem .3rem 0; }
dialog.kb-dialog textarea { width: 100%; box-sizing: border-box; }
/* firm detail: breadcrumb, action row (the destructive one set apart) */
nav.crumb { margin: 0 0 .3rem; font-size: 12px; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: .5rem .6rem; align-items: center; }
.actions form { margin: 0; }
.actions .apart { margin-left: auto; }
a.button.danger { color: var(--dfg); background: linear-gradient(to bottom, var(--d1), var(--d2) 48%, var(--d3) 52%, var(--d4)); border-color: var(--db); text-shadow: 0 -1px 0 rgba(0,0,0,.3); }
th[aria-sort] a::after { content: " \25B2"; font-size: 10px; } th[aria-sort="descending"] a::after { content: " \25BC"; }
@media (max-width: 860px) { .actions .apart { margin-left: 0; } }
/* events: day strips, the one-line story, the active filters, the record */
tr.dayrow > th { background: var(--surface-2); text-align: left; font-size: 12px; letter-spacing: .03em; color: var(--head-fg); padding: .3rem .7rem; }
table.events th[scope=row] { font-weight: 400; } table.events th[scope=row] a { font-weight: 700; }
table.events td.sel, table.events th.sel { width: 2.4rem; text-align: center; }
.chips { margin: .2rem 0 .8rem; color: var(--muted); }
details.more-filters { display: inline-block; margin-left: .6rem; vertical-align: top; } details.more-filters > summary { cursor: pointer; padding: .2rem 0; } details.more-filters label { display: block; margin: .3rem 0; }
pre.json { white-space: pre-wrap; word-break: break-word; margin: 0; }
.crumbs { margin: 0 0 .4rem; color: var(--muted); }
@media (max-width: 860px) { table.events td.sel, table.events th.sel { width: auto; text-align: left; } .pager a { display: inline-block; min-height: 44px; line-height: 44px; margin-right: 1rem; } }
.ev-status .lampline { flex-wrap: nowrap; align-items: flex-start; } .ev-status .lampline .lamp { margin-top: .35rem; } .ev-status .lamp-label { flex: 1 1 auto; min-width: 0; }
.lim-status .lampline { flex-wrap: nowrap; align-items: flex-start; } .lim-status .lampline .lamp { margin-top: .35rem; } .lim-status .lamp-label { flex: 1 1 auto; min-width: 0; }

/* follow-up tasks: the lede, the quoted message a person is following up on, and Dismiss as a disclosure set apart from Done */
.lede { max-width: 60rem; margin: .3rem 0 .6rem; }
blockquote.quoted { margin: .3rem 0; padding: .4rem .8rem; border-left: 3px solid var(--hair); background: var(--surface); white-space: pre-wrap; overflow-wrap: anywhere; }
td details summary { cursor: pointer; color: var(--accent); }
/* each task is two rows: the task itself, then (full width, so a reply is readable) what we sent and what they wrote back */
table.tasks tr.task > th, table.tasks tr.task > td { border-bottom: 0; padding-bottom: .1rem; }
table.tasks tr.task-ctx > td { padding-top: .1rem; padding-bottom: .6rem; }
table.tasks tr.late > :first-child, table.tasks tr.late + tr.task-ctx > td { box-shadow: inset 3px 0 0 var(--caution); }
table.tasks tr.kb-row + tr.task-ctx > td { background: var(--accent-soft); }
table.tasks td.waiting { white-space: nowrap; }
table.tasks td.addr { min-width: 15rem; }
table.tasks td.waiting .lamp { margin-right: .3rem; }
a.button.addr-btn { white-space: normal; overflow-wrap: anywhere; min-width: 0; max-width: 100%; text-align: left; }
.addr-plain { overflow-wrap: anywhere; font-weight: 700; } .addr-note { display: block; margin-top: .25rem; font-size: 12px; }
.ctx { display: flex; flex-wrap: wrap; gap: .1rem 1.6rem; align-items: flex-start; }
.ctx details { flex: 0 1 auto; } .ctx details[open] { flex: 1 1 24rem; }
blockquote.quoted { max-width: 70ch; }
.task-actions { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: flex-start; }
.task-actions form { margin: 0; }
td.row-actions { white-space: normal; min-width: 11rem; }
details.dismiss > summary { display: inline-block; list-style: none; cursor: pointer; } details.dismiss > summary::-webkit-details-marker { display: none; }
details.dismiss[open] { flex: 1 1 100%; min-width: 15rem; max-width: 24rem; padding: .4rem .6rem; border: 1px solid var(--warn); background: var(--warn-bg); } details.dismiss p { margin: .3rem 0; max-width: none; overflow-wrap: anywhere; }
details.dismiss[open] > summary { margin-bottom: .2rem; }
tr.just-closed th, tr.just-closed td { background: var(--caution-bg); }
.task-filter { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; margin: .5rem .8rem; } .task-filter select { max-width: 100%; }
.flash .undo-in-flash { margin-left: .8rem; vertical-align: middle; }
.note.view-only { max-width: 60rem; }
.outcome { display: block; font-size: 12px; }
@media (max-width: 860px) {
  table.tasks tr.task { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 .8rem; padding-bottom: 0; border-bottom: 0; }
  table.tasks tr.task > th { grid-column: 1; min-width: 0; overflow-wrap: anywhere; } table.tasks tr.task > td.waiting { grid-column: 2; text-align: right; }
  table.tasks tr.task > td.addr, table.tasks tr.task > td.row-actions { grid-column: 1 / -1; min-width: 0; }
  table.tasks tr.task-ctx { padding-top: 0; } table.tasks tr.task-ctx > td { padding: 0 0 .2rem; box-shadow: none; }
  table.tasks tr.late > :first-child { box-shadow: inset 3px 0 0 var(--caution); padding-left: .5rem; }
  table.tasks tr.late + tr.task-ctx > td { box-shadow: none; }
  table.tasks th[scope=row] a { display: inline-flex; align-items: center; min-height: 44px; }
  table.tasks td.addr { display: flex; flex-wrap: wrap; align-items: stretch; gap: .3rem .5rem; } table.tasks td.addr::before { flex: 1 1 100%; }
  table.tasks td.addr a.button.addr-btn { display: flex; flex: 1 1 12rem; }
  table.tasks td.addr .addr-plain { flex: 1 1 10rem; align-self: center; } table.tasks td.addr .addr-note { flex: 1 1 100%; margin-top: 0; }
  .task-filter label { flex: 1 1 100%; } .task-filter select { width: 100%; }
  td details summary { display: inline-flex; align-items: center; min-height: 44px; }
  .ctx details[open] { flex-basis: 100%; }
  .task-actions { gap: .5rem; }
  .task-actions > form, details.dismiss:not([open]) { flex: 1 1 40%; min-width: 0; }
  .task-actions > form > button, details.dismiss > summary { width: 100%; justify-content: center; text-align: center; }
  details.dismiss[open] { flex-basis: 100%; max-width: none; }
  details.dismiss > summary.button { display: inline-flex; }
  .flash .undo-in-flash { margin: .3rem 0 0 0; display: block; }
}

/* review screen (/approvals/:id): one glossy primary, flat secondaries, the Reject disclosure, the phone decision bar, the undo hold, the queue receipt.
   Gloss stays on buttons, the lamp and the logo; the hold bar and the panels are flat. */
button.secondary, a.button.secondary { color: var(--fg); background: var(--surface); box-shadow: none; font-weight: 600; text-shadow: none; border-color: var(--line); }
button.secondary:hover, a.button.secondary:hover, .reject-box > summary.secondary:hover { background: var(--surface-2); border-color: var(--accent); filter: none; }
button.secondary:active, a.button.secondary:active { background: var(--surface-2); box-shadow: inset 0 1px 2px rgba(0,0,0,.25); }
.reject-box > summary.secondary { display: inline-block; list-style: none; cursor: pointer; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 2px; padding: .32rem .9rem; font-weight: 600; }
.reject-box > summary.secondary::-webkit-details-marker { display: none; }
.reject-box[open] > summary.secondary { margin-bottom: .7rem; }
.reject-box:target > summary.secondary { border-color: var(--accent); }
.reject-form { margin: 0; }
.decide-actions { display: flex; align-items: center; gap: .6rem; margin: 0 0 .6rem; } .decide-actions form { margin: 0; } a.button.reject-open { display: none; }
.decide-help { margin: .3rem 0; color: var(--warn); font-size: 12px; font-weight: 700; } .decide-help:empty { display: none; }
ul.decide-warn { margin: 0 0 .7rem; padding: .4rem .7rem .4rem 1.6rem; background: var(--caution-bg); color: var(--caution); border: 1px solid var(--caution); border-radius: 2px; font-weight: 700; }
.tip { margin: .4rem 0 .6rem; padding: .3rem .6rem; border: 1px solid var(--hair); border-radius: 2px; background: var(--surface); color: var(--muted); font-size: 12px; } .tip[hidden] { display: none; }
/* shortcut hints: only where a keyboard is likely (a fine pointer); aria-hidden in the markup, so they never change a control's name */
.review-main kbd.hint { display: none; margin-left: .55em; font-weight: 400; font-size: .75em; text-shadow: none; }
@media (pointer: fine) { .review-main kbd.hint { display: inline-block; } }
.decide-bar kbd.hint { background: rgba(0,0,0,.2); color: var(--pfg); border-color: rgba(255,255,255,.7); }
.decide-bar .reject-open kbd.hint, .decide-bar .secondary kbd.hint { color: inherit; background: var(--surface-2); border-color: var(--line); }
#live-qa.live-wait { color: var(--muted); }
/* banners above the draft: grouped, and only the undo strip may stick */
.banners { display: grid; gap: .5rem; margin: 0; } .banners:has(.flash:not([hidden])) { margin-bottom: 1rem; } .banners .flash { margin: 0; position: static; }
/* the undo hold: lamp, countdown, a bevelled bar, and the line announced when the hold ends */
.undo-strip { top: 0; }
.undo-end { font-weight: 700; } .undo-end:empty { display: none; }
progress.hold-bar { -webkit-appearance: none; appearance: none; width: 7rem; height: 12px; border: 1px solid var(--line); border-radius: 2px; background: var(--surface-2); box-shadow: inset 0 1px 2px rgba(0,0,0,.25); color: var(--accent); vertical-align: middle; overflow: hidden; }
progress.hold-bar::-webkit-progress-bar { background: var(--surface-2); } progress.hold-bar::-webkit-progress-value { background: var(--accent); } progress.hold-bar::-moz-progress-bar { background: var(--accent); }
progress.hold-bar[hidden], [data-undo-line][hidden] { display: none; }
@keyframes lamp-lit { from { filter: brightness(1.8) saturate(.6); transform: scale(1.3); } to { filter: none; transform: none; } }
@media (prefers-reduced-motion: no-preference) { .lamp-lit { animation: lamp-lit .6s cubic-bezier(.16, 1, .3, 1); } }
/* queue cleared: the receipt */
.queue-clear { max-width: 36rem; } .queue-clear .receipt { font-size: 1.05rem; margin-top: 0; }
@media (max-width: 960px) {
  /* the decision stays in reach: Approve and Reject in a bar fixed to the bottom edge (no script needed), with room left under the content */
  .decide-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; padding: .5rem 1rem calc(.5rem + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -2px 4px rgba(0,0,0,.15); }
  .decide-bar .decide-help { margin: 0 0 .4rem; }
  .decide-actions { margin: 0; gap: .6rem; } .decide-actions form { flex: 1 1 0; } .decide-actions a.button.reject-open { flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; }
  .decide-actions button, .decide-actions .button { width: 100%; min-height: 44px; }
  main:has(.decide-bar) { padding-bottom: calc(6.5rem + env(safe-area-inset-bottom)); }
  .reject-box > summary.secondary { min-height: 44px; display: inline-flex; align-items: center; }
  /* of the stacked strips, only the undo strip sticks */
  main:has([data-queue-item]) .flash:not(.undo-strip) { position: static; }
}
@media (max-width: 860px) { nav.crumb a { display: inline-flex; align-items: center; min-height: 44px; } .undo-strip { top: 44px; } }
@media print { .decide-bar { position: static; box-shadow: none; } }

/* replies screens (/replies/:id and /replies/unmatched): hierarchy among the label buttons, a state notice, the phone order, and the unmatched table that fits at 1280 */
.state-note { margin: 0 0 1rem; padding: .5rem .8rem; background: var(--surface); border: 1px solid var(--line); border-radius: 2px; color: var(--fg); max-width: 60rem; }
.badge-lead { margin-left: .5rem; vertical-align: middle; font-size: 11px; letter-spacing: .06em; background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
.label-buttons button.quiet { color: var(--fg); border-color: var(--line); }
.label-buttons button[disabled].quiet { color: var(--fg); }
.label-buttons kbd.hint, .review-facts kbd.hint { display: none; margin: 0 0 0 .3rem; padding: 0 .3rem; font-size: 11px; font-weight: 400; background: var(--surface-2); color: var(--muted); border: 1px solid var(--hair); }
button.primary kbd.hint { background: rgba(0,0,0,.25); color: var(--pfg); border-color: rgba(255,255,255,.35); }
@media (pointer: fine) { .label-buttons kbd.hint { display: inline-block; } }
ul.label-does { margin: .2rem 0 .8rem; padding: 0; list-style: none; font-size: 12px; color: var(--muted); } ul.label-does li { margin: 0 0 .15rem; } ul.label-does strong { color: var(--fg); font-weight: 700; }
details.more { margin: 1rem 0 0; border-top: 1px solid var(--hair); padding-top: .5rem; } details.more > summary { cursor: pointer; color: var(--accent); font-weight: 700; padding: .2rem 0; }
details.more h3:first-of-type { margin-top: .6rem; }
details.confirm-step > summary.button.danger { display: inline-block; }
.undo-form + .review-grid, .undo-form { margin-bottom: 1rem; }
/* the phone order: their reply, then the label block, then what we sent, notes and history */
@media (max-width: 960px) {
  .review-grid { display: flex; flex-direction: column; gap: 1rem; }
  .review-main { display: contents; }
  .review-main > .r-first { order: 1; } .review-facts { order: 2; } .review-main > .r-rest { order: 3; }
  .label-buttons button { min-height: 44px; min-width: 44px; }
  .review-facts a.firm-link, details.more > summary { display: inline-flex; align-items: center; min-height: 44px; }
  details.confirm-step > summary { min-height: 44px; display: inline-flex; align-items: center; }
}
@media (pointer: coarse) { .label-buttons button, details.confirm-step > summary { min-height: 44px; } }
@keyframes lead-in { from { background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-soft); } to { background: var(--ok-bg); box-shadow: none; } }
@media (prefers-reduced-motion: no-preference) { .badge-lead.lead-new { animation: lead-in 1.2s cubic-bezier(.16, 1, .3, 1); } }
/* unmatched: wrap long senders and snippets, keep the action column in view, one best guess per row */
tr[id^="row-"] { scroll-margin-top: 4rem; }
th.reply-main { min-width: 0; overflow-wrap: anywhere; } th.reply-main .sender { overflow-wrap: anywhere; word-break: break-word; }
table.unmatched th.reply-main .snippet { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 400; color: var(--muted); }
@media (min-width: 861px) {
  table.unmatched { table-layout: fixed; }
  table.unmatched thead th:nth-child(1) { width: 32%; } table.unmatched thead th:nth-child(2) { width: 16%; } table.unmatched thead th:nth-child(3) { width: 9%; } table.unmatched thead th:nth-child(4) { width: 43%; }
  table.unmatched td { overflow-wrap: anywhere; }
}
table.unmatched .guess { margin: 0 0 .2rem; font-size: 12px; font-weight: 700; color: var(--head-fg); }
table.unmatched .inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .6rem; }
table.unmatched .inline-form button { max-width: 100%; white-space: normal; text-align: left; }
.cand-meta { font-size: 12px; }
table.unmatched details.find { margin: .3rem 0 .6rem; } table.unmatched .find-form { display: flex; flex-wrap: wrap; gap: .4rem; align-items: end; margin: 0 0 .5rem; }
form.dismiss-form p { margin: .4rem 0 .2rem; font-size: 12px; }
ul.dismiss-list { list-style: none; margin: 0; padding: 0; font-size: 12px; } ul.dismiss-list li { margin: 0 0 .25rem; display: flex; flex-wrap: wrap; gap: .1rem .6rem; align-items: baseline; }
button.dismiss { background: transparent; box-shadow: none; border: 1px solid var(--hair); color: var(--fg); font-weight: 400; padding: .1rem .6rem; }
@media (max-width: 860px) { button.dismiss { min-height: 44px; } table.unmatched th.reply-main a { display: inline-block; padding: .6rem 0; } }
.keys-line kbd { font-size: 11px; }
.unmatched-clear .panel-head { display: flex; align-items: center; gap: .5rem; }
@keyframes unmatched-lit { from { filter: brightness(1.8) saturate(.6); transform: scale(1.3); } to { filter: none; transform: none; } }
@media (prefers-reduced-motion: no-preference) { .unmatched-clear .lamp-lit { animation: unmatched-lit .6s cubic-bezier(.16, 1, .3, 1); } }
/* firm page: the first pointer-sized fix is padding on the small links, the second is long snapshot URLs wrapping instead of clipping */
.lamp-text a { font-weight: 700; }
.panel-note a.touch { display: inline-block; padding: .55rem .15rem; }
td[data-label=Evidence] a, table.events th a { display: inline-block; padding: .3rem .2rem; }
.panel-body code { overflow-wrap: anywhere; }
@media (max-width: 860px) { .lamp-text a, td[data-label=Submission] a { display: inline-block; min-height: 44px; line-height: 44px; } }
/* campaign page: the short bold lamp label keeps its width and the sentence beside it wraps (a label squeezed to 0 overprinted its text at 390px) */
.lampline > strong.lamp-label, #status .lampline > strong.lamp-label { flex: none; max-width: 100%; }
.lampline > .lamp-text { flex: 1 1 12rem; min-width: 0; }
#status .lampline > .lamp-text { flex: 1 1 0; }

/* status: the readiness list, and the one weighty action. Weight comes from the glossy button and a boxed footer, not from decoration on text. */
.ready-done { margin: 0 0 .4rem; font-weight: 700; color: var(--ok); }
ul.ready.ready-complete { border-left: 1px solid var(--ok); padding-left: .6rem; }
.status-panel > form.golive { margin: 0; padding: .8rem 1rem 1rem; border-top: 2px solid var(--accent); background: var(--surface); }
form.golive h3 { margin: 0 0 .5rem; }
form.golive dl.summary { margin-bottom: .8rem; }
form.golive dl.summary dt { color: var(--fg); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding-top: .1rem; }
form.golive .field.check { margin: 0 0 .8rem; }
.golive-act { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin: 0; }
.golive-act .hint { margin: 0; }
button.golive-btn { font-size: 1.1rem; padding: .55rem 2.2rem; }
form.pause .hint { flex-basis: 100%; margin: 0; }

/* sticky section nav: sits under the mobile menu bar, and under a flash message when one is showing; one scrolling row on a phone */
.secnav-sticky { position: sticky; top: 0; z-index: 15; margin: 0 0 1rem; padding: .4rem 0; background: var(--ground); }
main:has(.flash) .secnav-sticky { top: 2.6rem; }
.panel { scroll-margin-top: 5rem; }
details.results-quiet:not([open]) > summary.panel-head { padding-top: .2rem; padding-bottom: .2rem; font-weight: 400; background: var(--surface); }
details.results-quiet:not([open]) > summary h2 { font-size: .95rem; }

/* results tables: grouped columns, numerals right-aligned in tabular figures */
table.data th.n, table.data td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.stats thead th.grp { text-align: center; border-bottom: 1px solid var(--line); }
table.stats thead th.grp + th.grp, table.stats tbody td.n:nth-child(6), table.stats tbody td.n:nth-child(10) { border-left: 1px solid var(--hair); }
table.data td.empty { padding: .7rem .6rem; }
.tap, .panel-body a.ready-link { display: inline-block; padding: .2rem 0; min-height: 24px; }
.panel-body a.ready-link { display: inline-flex; align-items: center; }

/* set-up controls: 24px minimum targets on a desktop pointer (44px on touch widths is handled in the 860px block) */
.daybox { min-height: 24px; }
.daybox input { margin: 0; }
.timebox input, .window-row select { min-height: 24px; }
button.quiet { min-height: 24px; }

/* delight: after going live, the lamp warms from amber to green once. Without motion the lamp is simply green. */
@media (prefers-reduced-motion: no-preference) {
  @keyframes lamp-warm { from { filter: hue-rotate(-85deg) brightness(1.08); } to { filter: none; } }
  .lamp-warm { animation: lamp-warm 1.4s cubic-bezier(.16, 1, .3, 1) 1 both; }
}
@media (max-width: 860px) {
  .secnav-sticky { top: 44px; flex-wrap: nowrap; overflow-x: auto; padding: .3rem 1rem; margin-inline: -1rem; }
  .secnav-sticky a { flex: none; }
  main:has(.flash) .secnav-sticky { top: calc(44px + 2.6rem); }
  .tap { min-height: 44px; display: inline-flex; align-items: center; }
  .daybox, .timebox input, .window-row select, button.quiet { min-height: 44px; }
  button.golive-btn { width: 100%; }
  /* the results table stacks as cards, its figures two to a row */
  table.stats.stack tr { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .8rem; }
  table.stats.stack th[scope=row], table.stats.stack td[data-label=Variant] { grid-column: 1 / -1; }
  table.stats.stack td.n { text-align: left; border-left: 0; }
  table.stack td.empty { grid-column: 1 / -1; }
}
/* suggestions page */
nav.crumb a.sg-link, a.sg-link { display: inline-block; min-height: 24px; line-height: 24px; }
.suggestion .panel-head { overflow-wrap: anywhere; } .suggestion .panel-head .lamp { margin-right: .25rem; }
.suggestion .rule { overflow-wrap: anywhere; }
.sg-left, .sg-last { margin-left: .5rem; } .sg-last { margin-left: 0; }
.sg-reload { margin-left: .5rem; }
.sg-snooze { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0 .6rem; margin-top: .4rem; } .sg-snooze .field { margin: 0; }
.sg-snooze button { margin-bottom: 0; }
details.decided { margin: 0 0 1rem; } details.decided > summary { cursor: pointer; font-weight: 700; color: var(--head-fg); padding: .2rem 0; min-height: 24px; }
details.decided > summary + .panel { margin-top: .6rem; }
meter.sg-meter { -webkit-appearance: none; appearance: none; width: 8rem; height: 14px; vertical-align: -3px; margin-left: .5rem; border: 1px solid var(--line); border-radius: 2px; background: var(--surface-2); box-shadow: inset 0 1px 2px rgba(0,0,0,.3), 0 1px 0 var(--bhi); }
meter.sg-meter::-webkit-meter-bar { height: 100%; background: var(--surface-2); border: 0; border-radius: 1px; box-shadow: inset 0 1px 2px rgba(0,0,0,.3); }
meter.sg-meter::-webkit-meter-optimum-value { background: var(--ok); box-shadow: inset 0 1px 0 var(--bhi), inset 0 -1px 0 rgba(0,0,0,.25); }
meter.sg-meter::-webkit-meter-suboptimum-value { background: var(--caution); box-shadow: inset 0 1px 0 var(--bhi), inset 0 -1px 0 rgba(0,0,0,.25); }
meter.sg-meter::-webkit-meter-even-less-good-value { background: var(--warn); box-shadow: inset 0 1px 0 var(--bhi), inset 0 -1px 0 rgba(0,0,0,.25); }
meter.sg-meter::-moz-meter-bar { background: var(--ok); }
meter.sg-meter:-moz-meter-sub-optimum::-moz-meter-bar { background: var(--caution); } meter.sg-meter:-moz-meter-sub-sub-optimum::-moz-meter-bar { background: var(--warn); }
@media (max-width: 860px) {
  nav.crumb a.sg-link, a.sg-link { display: inline-flex; align-items: center; min-height: 44px; line-height: 1.3; }
  table.stack td.none { display: none; }
  .sg-left { display: block; margin: .3rem 0 0; }
  details.decided > summary { min-height: 44px; display: flex; align-items: center; }
  .sg-snooze { align-items: stretch; } .sg-snooze .field { flex: 1 1 8rem; }
  .sg-reload { margin: .4rem 0 0; }
}
form[action$="/learning/suggest"] { margin-bottom: .8rem; }

/* the notification bell (#9646): a slim bar above the page, the badge colour says the worst open severity and the words in each item say it too */
.topbar { display: flex; justify-content: flex-end; align-items: center; padding: .3rem 1.2rem; background: var(--bg); border-bottom: 1px solid var(--hair); position: sticky; top: 0; z-index: 25; }
.bell { position: relative; }
.bell-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 36px; padding: .25rem .5rem; background: transparent; color: var(--fg); border: 1px solid transparent; border-radius: 2px; cursor: pointer; }
.bell-btn:hover, .bell.open .bell-btn { background: var(--surface-2); border-color: var(--line); }
.bell-badge { position: absolute; top: -2px; right: -2px; min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box; border-radius: 9px; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; background: var(--muted); color: var(--bg); }
.bell-badge[hidden] { display: none; }
.bell-badge.bell-critical { background: var(--warn); color: var(--bg); } .bell-badge.bell-warning { background: var(--caution); color: var(--bg); } .bell-badge.bell-info { background: var(--muted); color: var(--bg); }
.bell-panel { position: absolute; right: 0; top: calc(100% + 4px); z-index: 40; width: min(26rem, calc(100vw - 1.5rem)); max-height: min(32rem, 75vh); overflow-y: auto; background: var(--bg); color: var(--fg); border: 1px solid var(--line); border-radius: 3px; box-shadow: 0 12px 36px rgba(0,0,0,.28); }
.bell-panel[hidden] { display: none; }
.bell-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .5rem .8rem; background: var(--surface-2); border-bottom: 2px solid var(--accent); position: sticky; top: 0; }
.bell-list { list-style: none; margin: 0; padding: 0; }
.bell-item { display: flex; justify-content: space-between; gap: .75rem; padding: .55rem .8rem; border-bottom: 1px solid var(--hair); border-left: 4px solid var(--muted); }
.bell-item.bell-sev-critical { border-left-color: var(--warn); } .bell-item.bell-sev-warning { border-left-color: var(--caution); }
.bell-item.bell-health { background: var(--surface); }
.bell-unread .bell-link { font-weight: 700; }
.bell-link { color: var(--fg); overflow-wrap: anywhere; }
.bell-main { min-width: 0; } .bell-meta { display: flex; flex-wrap: wrap; gap: .2rem .7rem; font-size: 12px; color: var(--muted); margin-top: .15rem; }
.bell-tag { font-weight: 700; text-transform: uppercase; letter-spacing: .04em; font-size: 11px; color: var(--head-fg); }
.bell-sev-critical .bell-sev { color: var(--warn); font-weight: 700; } .bell-sev-warning .bell-sev { color: var(--caution); font-weight: 700; }
.bell-acts { display: flex; flex-direction: column; align-items: flex-end; gap: .2rem; flex: none; font-size: 12px; }
.bell-empty, .bell-error { margin: 0; padding: .9rem .8rem; color: var(--muted); } .bell-error { color: var(--warn); }
.bell-empty[hidden], .bell-error[hidden], .bell-head [hidden] { display: none; }
@media (max-width: 860px) { .topbar { top: 44px; padding: .2rem .6rem; } .bell-btn { min-width: 44px; min-height: 44px; } .bell-acts button { min-height: 44px; } .bell-panel { position: fixed; left: .5rem; right: .5rem; top: 92px; width: auto; max-height: calc(100vh - 110px); } }
@media print { .topbar { display: none; } }
/* ==== purge page, receipt and purge log (BEGIN; kept in one block to ease merges) ==== */
.dom { overflow-wrap: anywhere; word-break: break-word; }
td.wrap, .data .wrap { overflow-wrap: anywhere; min-width: 0; }
.purge-h1 { overflow-wrap: anywhere; text-wrap: wrap; }
.purge-h1 .dom { font-weight: 700; }
.consequence { max-width: 70ch; }
.purge-page-note, p.purge-note { max-width: 70ch; }
.purge-scroll { max-width: 42rem; }
.scroll > table.purge-table { min-width: 0; }
.purge-table caption { padding: .3rem .65rem; }
.purge-table tr.group > th { background: var(--surface-2); font-size: 12px; color: var(--head-fg); border-bottom: 1px solid var(--hair); padding: .25rem .65rem; }
.purge-table th[scope=row] { font-weight: 400; }
.purge-table .how { color: var(--muted); font-size: 12px; }
.purge-table td.num-cell { width: 4.5rem; text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.purge-table thead th.num-cell { text-align: right; }
.purge-zero { margin: .4rem 0 0; }
ul.purge-stays { margin: .2rem 0 .6rem; padding-left: 1.1rem; max-width: 70ch; } ul.purge-stays li { margin: 0 0 .3rem; }
.hold-panel { border-color: var(--caution); } .hold-panel .panel-head { background: var(--caution-bg); color: var(--caution); border-bottom-color: var(--caution); }
form.purge-form { margin: 1.2rem 0 0; padding-top: .2rem; border-top: 1px solid var(--hair); }
form.purge-form .field input:not([type=checkbox]) { max-width: 28rem; min-height: 30px; }
form.purge-form .hint .copy { margin-left: .3rem; padding: .1rem .6rem; }
.purge-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin: 1rem 0 0; }
.purge-actions button.danger { white-space: normal; overflow-wrap: anywhere; text-align: center; max-width: 100%; }
.purge-actions .cancel { display: inline-flex; align-items: center; }
.receipt-detail, .purge-files { max-width: 70ch; }
dl.receipt-facts { grid-template-columns: 9rem minmax(0, 1fr); } dl.receipt-facts dd { overflow-wrap: anywhere; }
details.receipt-text { margin: 1rem 0 0; } details.receipt-text > summary { cursor: pointer; font-weight: 700; color: var(--head-fg); padding: 3px 0; }
pre.summary-text { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg); border: 1px solid var(--line); border-radius: 2px; padding: .6rem .8rem; max-width: 70ch; font-size: 12px; }
table.purge-log td.wrap { max-width: 18rem; }
@media (max-width: 860px) {
  .purge-h1 { font-size: 1.15rem; }
  .purge-table td.num-cell { width: 3.5rem; }
  .purge-actions .cancel, .receipt .purge-actions a.button, form.purge-form .hint .copy { min-height: 44px; }
  .purge-actions .cancel { padding: 0 .4rem; }
  form.purge-form .field input:not([type=checkbox]) { max-width: none; min-height: 44px; }
  dl.receipt-facts { grid-template-columns: 1fr; }
  table.purge-log.stack th[scope=row] { font-size: 1rem; }
  .data.stack td.wrap { max-width: none; }
}
/* ==== purge (END) ==== */
/* Prompts (list and prompt page). Flat, tokenised; gloss stays on the buttons and lamps. */
.prompts-page .lede { max-width: 70ch; color: var(--muted); margin: 0 0 1rem; }
.prompts-page .crumb { margin: 0 0 .2rem; font-size: 12px; }
.prompts-page .flash { position: static; max-width: 70ch; }
.empty-start { border: 1px solid var(--hair); background: var(--surface); padding: .8rem 1rem; margin: 0 0 1rem; max-width: 70ch; }
.empty-start .empty { margin: 0 0 .4rem; font-weight: 700; color: var(--fg); }
.prompts-table th.pname { overflow-wrap: anywhere; min-width: 10rem; }
.prompts-table td { overflow-wrap: anywhere; }
.prompts-page .badge-published { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
.prompts-page .badge-draft { background: var(--caution-bg); color: var(--caution); border-color: var(--caution); }
.prompts-page .badge-retired { background: var(--surface-2); color: var(--muted); border-color: var(--line); }
.vars-panel code { overflow-wrap: anywhere; }
.varchip { font-size: 12px; padding: .05rem .5rem; margin-left: .3rem; }
.varchip[hidden] { display: none; }
.varstate { display: inline-block; margin-left: .4rem; font-size: 12px; font-weight: 700; color: var(--ok); }
.vars th[scope=row] { white-space: nowrap; }
.varstate:empty { display: none; }
.vstrip { display: flex; gap: .6rem; align-items: flex-start; border: 1px solid var(--hair); background: var(--surface); padding: .5rem .8rem; margin: 0 0 .9rem; max-width: 60rem; }
.vstrip .lamp { margin-top: .2rem; }
.vstrip-list { margin: .25rem 0 .2rem; padding-left: 1.2rem; }
.vstrip .hint { margin-top: .2rem; }
.prompt-text textarea { width: 100%; max-width: 60rem; min-height: 15rem; resize: vertical; line-height: 1.5; }
.prompt-text .hint { max-width: 60rem; }
ul.field-error { padding-left: 1.2rem; }
.saved-copy { margin: .5rem 0 0; } .saved-copy h4 { margin: 0 0 .25rem; font-size: 12px; color: var(--muted); }
.saved-copy pre.msg { max-width: 60rem; background: var(--surface); }
.merge-note { max-width: 70ch; margin: 0 0 .8rem; }
details.fold { margin: .6rem 0; max-width: 60rem; border: 1px solid var(--hair); padding: .2rem .8rem; }
details.fold > summary { cursor: pointer; font-weight: 700; color: var(--head-fg); padding: .3rem 0; }
details.fold h3 { font-size: 13px; margin: .6rem 0 .25rem; }
pre.diff { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg); border: 1px solid var(--line); padding: .4rem 0; margin: 0 0 .5rem; max-width: 70ch; line-height: 1.5; }
pre.diff .dk, pre.diff .da, pre.diff .dr { display: block; padding: 0 .8rem; }
pre.diff .da { background: var(--ok-bg); color: var(--ok); } pre.diff .dr { background: var(--warn-bg); color: var(--warn); }
.version h3 { font-size: 13px; margin: .8rem 0 .25rem; color: var(--head-fg); }
ul.uses { margin: 0 0 .5rem; padding-left: 1.2rem; }
ul.pinlist { list-style: none; margin: 0 0 .5rem; padding: 0; max-width: 40rem; }
ul.pinlist li { display: flex; gap: .8rem; align-items: center; justify-content: space-between; padding: .3rem 0; border-bottom: 1px solid var(--hair); }
ul.pinlist form { margin: 0; flex: none; } .pin-name { overflow-wrap: anywhere; min-width: 0; }
button[aria-pressed="true"]:disabled { opacity: 1; background: var(--ok-bg); color: var(--ok); border-color: var(--ok); box-shadow: none; cursor: default; }
.retire-zone { margin-top: 1.4rem; padding-top: .8rem; border-top: 1px solid var(--hair); } .retire-zone form { margin: 0; }
.prompts-page .draft-form .actions { display: flex; flex-wrap: wrap; gap: .5rem .8rem; align-items: center; }
@media (pointer: coarse), (max-width: 860px) {
  .prompts-table a.rowlink { display: inline-flex; align-items: center; min-height: 44px; }
  .prompts-page .crumb a { display: inline-flex; align-items: center; min-height: 44px; }
  details.fold > summary, .vars-panel > summary { min-height: 44px; display: flex; align-items: center; }
  ul.pinlist li { flex-wrap: wrap; }
}
.prompts-table td[data-label="Status"] { white-space: nowrap; }

/* ==== form review (templates/forms/*): see public/forms_review.js ==== */
/* placeholder text reads at 4.5:1 on the input background in all four themes (the browser's own grey does not) */
::placeholder { color: var(--muted); opacity: 1; }
code.url { overflow-wrap: anywhere; } .formlist td, .formlist th, .formmap th, .formmap td, .facts dd { overflow-wrap: break-word; } .formlist td[data-label=LLM], .formlist td[data-label=Vendor] { word-break: normal; overflow-wrap: normal; }
.facts dd code.url { display: inline; } .facts dd button.quiet { margin-left: .4rem; }
.reasons, .cands { margin: 0; padding-left: 1.1rem; } .reasons li, .cands li { margin: 0 0 .35rem; } .reasons .hint { display: block; }
.scroll > table.formmap { min-width: 40rem; } .formmap td select { max-width: 100%; } .formmap td input { width: 100%; max-width: 14rem; }
.formmap tr.differs > th { box-shadow: inset 4px 0 0 var(--caution); }
.formmap tr[hidden], .map-tools[hidden], .scope-effects li[hidden], details.preview[hidden] { display: none; }
.formmap .badge { display: inline-block; margin-top: .3rem; white-space: normal; } .formmap .hint { margin: .2rem 0 0; }
.badge-llm { background: var(--accent-soft); color: var(--head-fg); border-color: var(--accent); }
.badge-differs { background: var(--caution-bg); color: var(--caution); border-color: var(--caution); }
.formmap td .field-error { margin: .25rem 0 0; font-weight: 700; } .formmap [aria-invalid="true"] { border-color: var(--warn); border-width: 2px; }
.form-errors ul { margin: .3rem 0 0; padding-left: 1.2rem; font-weight: 400; } .form-errors a { color: inherit; }
.unset-status { margin: .3rem 0 .6rem; } .map-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; margin: 0 0 .5rem; } .map-tools label { display: inline-flex; align-items: center; gap: .4rem; font-weight: 400; }
.scope-box { border: 1px solid var(--hair); border-radius: 2px; margin: 1rem 0; padding: .5rem .9rem .8rem; } .scope-box legend { font-weight: 700; color: var(--head-fg); padding: 0 .3rem; }
.scope-effects { list-style: none; margin: .4rem 0 0; padding: 0; max-width: 62ch; } .scope-effects li { display: flex; gap: .5rem; align-items: flex-start; margin: 0 0 .4rem; } .scope-effects .lamp { margin-top: .2rem; }
.preview-list { margin: .4rem 0 0; padding-left: 1.1rem; } .preview-list li { margin: 0 0 .25rem; overflow-wrap: anywhere; }
input.wide { width: 100%; max-width: 40rem; }
.apart { margin-top: 1.6rem; } .readonly-note { font-weight: 700; }
.llm-panel .panel-head .lamp { margin-right: .35rem; vertical-align: -2px; } .llm-panel .flash { position: static; }
@media (max-width: 860px) {
  .scroll > table.formmap { min-width: 0; } .formmap td input, .formmap td select { max-width: none; width: 100%; }
  .map-tools label { min-height: 44px; } .map-tools input[type=checkbox] { width: 24px; height: 24px; }
  .llm-panel .inline-form .hint { display: block; margin-top: .4rem; }
  .facts dd button.quiet { margin: .4rem 0 0; } .form-errors a { display: inline-block; min-height: 44px; line-height: 44px; }
}
