/* Citewarden control room.
   Light theme by default; dark via the toggle. Only plain hex/rgba colours are used (no color-mix,
   no backdrop-filter dependence), so Chrome, Edge, Firefox and Safari render the same colours. */
:root, [data-theme="light"] {
  --page: #f2f4f8; --card: #ffffff; --card-2: #f7f8fb; --elev: #ffffff;
  --ink: #0f172a; --ink-2: #334155; --muted: #64748b; --line: #e3e8ef; --line-2: #cbd5e1;
  --accent: #0d9488; --accent-strong: #0f766e; --accent-soft: #ccfbf1; --accent-line: #5eead4; --accent-ink: #ffffff;
  --accent-2: #4f46e5;
  --ok: #15803d; --ok-bg: #dcfce7; --ok-line: #86efac;
  --warn: #b45309; --warn-bg: #fef3c7; --warn-line: #fcd34d;
  --bad: #b91c1c; --bad-bg: #fee2e2; --bad-line: #fca5a5;
  --violet: #7e22ce; --violet-bg: #f3e8ff; --violet-line: #d8b4fe;
  --info: #1d4ed8; --info-bg: #dbeafe; --info-line: #93c5fd;
  --hover: #f1f5f9;
  /* the three layers: brand header, navigation bar, workspace */
  --hdr-bg: #0b1324; --hdr-bg-2: #12203b; --hdr-ink: #f8fafc; --hdr-muted: #94a3b8; --hdr-line: #1f2d48; --hdr-chip: #16233f;
  --nav-bg: #ffffff; --nav-line: #e3e8ef; --nav-ink: #475569;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 6px 18px rgba(15, 23, 42, .06);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, .10);
  --paper: #fffdf7; --paper-line: #ebe5d6;
  color-scheme: light;
}
[data-theme="dark"] {
  --page: #0a0f1d; --card: #111a2c; --card-2: #16213a; --elev: #1a2742;
  --ink: #e6ebf5; --ink-2: #c3cbdb; --muted: #8a97b1; --line: #223049; --line-2: #33435f;
  --accent: #2dd4bf; --accent-strong: #14b8a6; --accent-soft: #0f3b39; --accent-line: #1f7a72; --accent-ink: #04201c;
  --accent-2: #818cf8;
  --ok: #4ade80; --ok-bg: #11301f; --ok-line: #1f6b3e;
  --warn: #fbbf24; --warn-bg: #3a2c0b; --warn-line: #7a5b12;
  --bad: #f87171; --bad-bg: #3b1518; --bad-line: #7f2a2f;
  --violet: #c084fc; --violet-bg: #2c1a40; --violet-line: #5b3a85;
  --info: #60a5fa; --info-bg: #13284a; --info-line: #2c4f86;
  --hover: #1a2742;
  --hdr-bg: #050915; --hdr-bg-2: #0b1428; --hdr-ink: #f1f5f9; --hdr-muted: #8a97b1; --hdr-line: #18233a; --hdr-chip: #101b33;
  --nav-bg: #0e1629; --nav-line: #1f2b44; --nav-ink: #9aa8c2;
  --shadow: 0 1px 0 rgba(255, 255, 255, .02) inset, 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-lg: 0 14px 34px rgba(0, 0, 0, .45);
  --paper: #fbf8f0; --paper-line: #e6dfcf;
  color-scheme: dark;
}
:root {
  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, "Courier New", monospace;
  --r: 14px; --r-sm: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--page); color: var(--ink); font: 14px/1.55 var(--sans); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { min-height: 100vh; }
a { color: var(--accent-strong); text-decoration: none; } a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; color: inherit; }
input { font: inherit; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); } .small { font-size: 12px; }
* { scrollbar-color: var(--line-2) transparent; scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 10px; } ::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 9px; border: 2px solid var(--page); }

/* ================================================================== 1. BRAND HEADER (navy bar) */
header.top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 20px; padding: 0 28px; height: 68px;
  background: linear-gradient(90deg, var(--hdr-bg), var(--hdr-bg-2)); color: var(--hdr-ink);
  border-bottom: 1px solid var(--hdr-line); }
header.top::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, #14b8a6, #6366f1 60%, transparent); opacity: .9; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--hdr-ink); text-decoration: none !important; flex: none; }
.mark { width: 40px; height: 40px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand .name { font: 700 22px var(--display); letter-spacing: .1px; color: #ffffff; }
.brand .name em { font-style: normal; color: #5eead4; }
.brand .tag { font-size: 11px; color: var(--hdr-muted); letter-spacing: .4px; margin-top: 2px; }
.status-cluster { display: flex; align-items: center; gap: 4px; margin-left: 18px; padding-left: 18px; border-left: 1px solid var(--hdr-line); height: 40px; }
.kpi-mini { display: inline-flex; flex-direction: column; padding: 0 12px; line-height: 1.2; }
.kpi-mini + .kpi-mini { border-left: 1px solid var(--hdr-line); }
.kpi-mini small { font-size: 9.5px; text-transform: uppercase; letter-spacing: 1.1px; color: var(--hdr-muted); font-weight: 600; }
.kpi-mini b { font: 600 13.5px var(--mono); color: #ffffff; }
.brand, .brand-text, .kpi-mini, .kpi-mini small, .kpi-mini b, .pill, .mode-chip { white-space: nowrap; }
.status-cluster { flex-wrap: nowrap; min-width: 0; overflow: hidden; }
/* smaller screens / zoomed browsers: drop the least important header items instead of wrapping */
@media (max-width: 1500px) { .mode-chip { display: none; } }
@media (max-width: 1320px) { .brand .tag { display: none; } .kpi-mini.k2 { display: none; } }
@media (max-width: 1120px) { .kpi-mini { display: none; } .status-cluster { border-left: 0; padding-left: 0; } }
@media (max-width: 860px) { .hbtn span, .kill span:not(.kill-ring) { display: none; } .hbtn, .kill { padding: 0 12px; } }
.mode-chip { font: 500 11.5px var(--mono); color: var(--hdr-muted); padding: 4px 10px; margin-left: 8px; border: 1px solid var(--hdr-line); border-radius: 999px; background: var(--hdr-chip); }
.actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px; font-size: 11.5px; font-weight: 800;
  letter-spacing: .6px; text-transform: uppercase; background: var(--hdr-chip); color: var(--hdr-muted); border: 1px solid var(--hdr-line); margin-right: 6px; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.running { color: #5eead4; border-color: #1f7a72; background: #0c2f30; } .pill.running .dot { animation: pulse 1.1s infinite; }
.pill.completed { color: #86efac; border-color: #1f6b3e; background: #0f2a1b; }
.pill.killed, .pill.failed { color: #fca5a5; border-color: #7f2a2f; background: #35141a; }
.pill.stopped { color: #fcd34d; border-color: #7a5b12; background: #33270b; }
@keyframes pulse { 50% { opacity: .25; } }
.icon-btn { width: 36px; height: 36px; flex: none; display: inline-grid; place-items: center; border-radius: 50%; border: 1px solid var(--hdr-line);
  background: var(--hdr-chip); color: var(--hdr-ink); padding: 0; }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { border-color: #5eead4; }
header .btn { background: var(--hdr-chip); border-color: var(--hdr-line); color: var(--hdr-ink); }
header .btn.primary { background: linear-gradient(135deg, #14b8a6, #0d9488); color: #ffffff; border: 0; box-shadow: 0 4px 14px rgba(20, 184, 166, .35); }
/* header buttons: icon + label on ONE line, same height */
.hbtn, .kill { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; white-space: nowrap; flex: none; line-height: 1; }
.hbtn svg, .kill svg { width: 15px; height: 15px; flex: none; }
.hbtn[hidden] { display: none; }
.kill { position: relative; border: 0; border-radius: 11px; font: 800 12.5px var(--sans); letter-spacing: .9px; text-transform: uppercase; color: #fff;
  background: linear-gradient(180deg, #ef4444, #b91c1c); box-shadow: 0 0 0 1px rgba(255, 255, 255, .12) inset, 0 6px 18px rgba(239, 68, 68, .40); }
.kill:hover { filter: brightness(1.08); } .kill:active { transform: translateY(1px); }
.kill-ring { position: absolute; inset: -4px; border-radius: 14px; border: 2px solid rgba(239, 68, 68, .45); pointer-events: none; opacity: 0; }
body.running .kill-ring { animation: ring 1.4s infinite; }
@keyframes ring { 0% { transform: scale(.98); opacity: .9; } 100% { transform: scale(1.12); opacity: 0; } }

/* ================================================================== 2. NAVIGATION BAR (white strip) */
nav.tabs { position: sticky; top: 68px; z-index: 25; display: flex; gap: 2px; padding: 0 22px; overflow-x: auto;
  background: var(--nav-bg); border-bottom: 1px solid var(--nav-line); box-shadow: 0 2px 8px rgba(15, 23, 42, .04); }
nav.tabs button { position: relative; display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 15px 16px 14px;
  color: var(--nav-ink); font-weight: 600; white-space: nowrap; }
nav.tabs button::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: transparent; }
nav.tabs button:hover { color: var(--ink); }
nav.tabs button.active { color: var(--accent-strong); }
nav.tabs button.active::after { background: var(--accent); }
[data-theme="dark"] nav.tabs button.active { color: var(--accent); }
nav.tabs .ti { width: 22px; height: 22px; display: inline-grid; place-items: center; border-radius: 7px; background: var(--card-2); font-size: 12px; }
nav.tabs button.active .ti { background: var(--accent-soft); }
.count { min-width: 20px; padding: 1px 6px; border-radius: 999px; font-size: 11px; font-weight: 800; text-align: center; background: var(--bad-bg); color: var(--bad); }
.count.warn { background: var(--warn-bg); color: var(--warn); } .count.violet { background: var(--violet-bg); color: var(--violet); }
.count.zero { display: none; }

/* ================================================================== 3. WORKSPACE */
main { padding: 26px 28px 60px; max-width: 1560px; margin: 0 auto; }
section.view { display: none; } section.view.active { display: block; animation: fadein .2s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(3px); } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--line);
  background: var(--card-2); font: 700 11.5px var(--sans); letter-spacing: 1px; text-transform: uppercase; color: var(--ink-2); }
.card-h .muted { text-transform: none; letter-spacing: 0; font-weight: 500; }
.body { padding: 16px; }
.btn { border: 1px solid var(--line-2); background: var(--card); color: var(--ink); padding: 8px 15px; border-radius: var(--r-sm); font-weight: 600; }
.btn:hover { border-color: var(--accent); } .btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { background: transparent; } .btn.small { padding: 5px 11px; font-size: 12.5px; }
.btn.ok { color: var(--ok); border-color: var(--ok-line); background: var(--ok-bg); }
.btn.bad { color: var(--bad); border-color: var(--bad-line); background: var(--card); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.grid { display: grid; gap: 18px; }
.grid.control { grid-template-columns: minmax(0, 1fr) 360px; margin-top: 18px; align-items: stretch; }
/* the activity panel grows to end exactly where the right-hand column ends */
.feed-card { display: flex; flex-direction: column; }
.feed-card .feed { flex: 1 1 auto; height: 0; min-height: 560px; }
.grid.two { grid-template-columns: 1fr 1fr; margin: 18px 0; align-items: stretch; }
.grid.two > .card { display: flex; flex-direction: column; }
.grid.two > .card > .body { flex: 1; }
@media (max-width: 1150px) { .grid.control, .grid.two { grid-template-columns: 1fr; } }
.side { display: grid; gap: 14px; align-content: start; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 0 0 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.page-head h2 { margin: 0; font: 600 30px/1.15 var(--display); letter-spacing: -.2px; }
.page-head p { margin: 6px 0 0; max-width: 820px; }
.stack { display: grid; gap: 14px; }

/* ------------------------------------------------------------------ hero */
.hero { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 22px 26px; border-left: 4px solid var(--accent); }
.eyebrow { font: 800 11px var(--sans); letter-spacing: 1.4px; text-transform: uppercase; color: var(--accent-strong); }
[data-theme="dark"] .eyebrow { color: var(--accent); }
.eyebrow .muted { margin-left: 8px; font: 500 11.5px var(--mono); letter-spacing: 0; text-transform: none; }
.hero h1 { margin: 6px 0 4px; font: 600 32px/1.12 var(--display); letter-spacing: -.3px; }
.lead { margin: 0; color: var(--ink-2); font-size: 15px; max-width: 820px; }
.flags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.flags:empty { display: none; }
.ring { position: relative; width: 110px; height: 110px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; }
.ring-bg { stroke: var(--line); }
.ring-fg { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 327; stroke-dashoffset: 327; transition: stroke-dashoffset .5s ease; }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.1; }
.ring-label b { font: 700 30px var(--display); } .ring-label small { color: var(--muted); font-size: 11px; }

/* ------------------------------------------------------------------ stepper */
.stepper { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 1100px) { .stepper { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stepper li { position: relative; padding: 12px 13px 13px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; }
.stepper li::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 0; background: var(--accent); transition: width .4s; }
.stepper .num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font: 700 11px var(--mono); color: var(--muted); background: var(--card-2); border: 1px solid var(--line); }
.stepper .nm { font-weight: 700; text-transform: capitalize; margin-top: 8px; }
.stepper .nt { font-size: 12px; color: var(--muted); margin-top: 2px; height: 36px; overflow: hidden; }
.stepper .ms { position: absolute; top: 14px; right: 12px; font: 500 11px var(--mono); color: var(--muted); }
.stepper li.active { border-color: var(--accent-line); background: var(--accent-soft); }
.stepper li.active .num { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); animation: pulse 1.1s infinite; }
.stepper li.active::after { animation: load 1.2s ease-in-out infinite alternate; }
@keyframes load { from { width: 15%; } to { width: 85%; } }
.stepper li.done::after { width: 100%; background: var(--ok); }
.stepper li.done .num { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.stepper li.fail::after { width: 100%; background: var(--bad); } .stepper li.fail .num { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-line); }
.stepper li.skip { opacity: .6; border-style: dashed; }

/* ------------------------------------------------------------------ tiles */
.tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.tiles.small { grid-template-columns: repeat(8, minmax(0, 1fr)); margin: 0 0 14px; }
a.chip { text-decoration: none !important; }
@media (max-width: 1100px) { .tiles, .tiles.small { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tile { position: relative; padding: 14px 16px 14px 18px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.tile::before { content: ""; position: absolute; top: 12px; bottom: 12px; left: 0; width: 4px; border-radius: 0 4px 4px 0; background: var(--accent-2); }
.tile.ok::before { background: var(--ok); } .tile.bad::before { background: var(--bad); } .tile.warn::before { background: var(--warn); } .tile.violet::before { background: var(--violet); }
.tile small { display: block; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; font-weight: 700; }
.tile b { display: block; font: 600 28px/1.25 var(--display); margin-top: 2px; }
.tile .tile-sub { font-size: 11.5px; color: var(--muted); }

/* ------------------------------------------------------------------ segmented control */
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--card-2); border: 1px solid var(--line); }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 7px; font: 600 12px var(--sans); color: var(--muted); text-transform: none; letter-spacing: 0; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(15, 23, 42, .15); }
[data-theme="dark"] .seg button.on { background: var(--elev); }
.seg.wide { margin-bottom: 16px; flex-wrap: wrap; }

/* ------------------------------------------------------------------ feed */
.feed { height: 640px; overflow: auto; padding: 6px 0; font-size: 13.2px; }
.feed.tall { height: 600px; }
.ev { display: grid; grid-template-columns: 58px 26px minmax(0, 1fr) auto; gap: 8px; align-items: start; padding: 7px 16px; border-left: 3px solid transparent; }
.ev:hover { background: var(--hover); }
.ev .t { font: 11.5px var(--mono); color: var(--muted); padding-top: 3px; }
.ev .k { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font-size: 12px; background: var(--card-2); border: 1px solid var(--line); color: var(--ink-2); }
.ev .what { min-width: 0; overflow-wrap: anywhere; color: var(--ink-2); padding-top: 2px; }
.ev .what b { color: var(--ink); }
.ev .args { color: var(--muted); font: 12px/1.45 var(--mono); margin-top: 2px; }
.ev.step { border-left-color: var(--accent); background: var(--accent-soft); }
.ev.step .k { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 800; }
.ev.decision { border-left-color: var(--info); } .ev.decision .k { color: var(--info); background: var(--info-bg); border-color: var(--info-line); }
.ev.deny { border-left-color: var(--bad); background: var(--bad-bg); } .ev.deny .k { color: var(--bad); }
.ev.approval { border-left-color: var(--warn); background: var(--warn-bg); } .ev.approval .k { color: var(--warn); }
.ev.quarantine { border-left-color: var(--violet); background: var(--violet-bg); } .ev.quarantine .k { color: var(--violet); }
.ev.cancel { border-left-color: var(--bad); background: var(--bad-bg); } .ev.cancel .what { color: var(--bad); font-weight: 700; }
.ev.err { border-left-color: var(--bad); } .ev.err .k { color: var(--bad); }
.ev.done .k { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-line); }
.ev.end { border-left-color: var(--ok); background: var(--ok-bg); }

.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font: 700 10.5px var(--sans);
  letter-spacing: .5px; text-transform: uppercase; white-space: nowrap; border: 1px solid transparent; }
.chip.allow, .chip.clean, .chip.ok, .chip.completed, .chip.executed { color: var(--ok); background: var(--ok-bg); }
.chip.needs_approval, .chip.warn, .chip.corrected, .chip.concern, .chip.needs-review, .chip.pending { color: var(--warn); background: var(--warn-bg); }
.chip.deny, .chip.retracted, .chip.bad, .chip.not_found, .chip.killed, .chip.failed, .chip.blocked { color: var(--bad); background: var(--bad-bg); }
.chip.quarantine, .chip.injection { color: var(--violet); background: var(--violet-bg); }
.chip.new_version, .chip.info, .chip.running { color: var(--info); background: var(--info-bg); }
.chip.unchecked, .chip.muted, .chip.rejected { color: var(--muted); background: var(--card-2); border-color: var(--line); }
.chip.live { color: var(--ok); border-color: var(--ok-line); background: transparent; }
.chip.sim { color: var(--warn); border-color: var(--warn-line); background: transparent; }

/* ------------------------------------------------------------------ meters & side lists */
.meters { padding: 14px 16px; display: grid; gap: 13px; }
.meter label { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.meter label span:last-child { font-family: var(--mono); color: var(--ink-2); }
.meter .bar { height: 8px; border-radius: 9px; background: var(--card-2); overflow: hidden; border: 1px solid var(--line); }
.meter .bar i { display: block; height: 100%; width: 0; border-radius: 9px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .4s; }
.list { max-height: 260px; overflow: auto; }
.item { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item .title { font-weight: 650; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.item .meta { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.item .actions { display: flex; gap: 8px; margin-top: 10px; }
.empty { padding: 26px 18px; color: var(--muted); text-align: center; font-size: 13.5px; }
.empty-ico { font-size: 26px; opacity: .6; margin-bottom: 6px; }

/* ------------------------------------------------------------------ library */
.search { min-width: 300px; padding: 10px 14px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--card); color: var(--ink); }
.search::placeholder { color: var(--muted); }
.search:focus { outline: 2px solid var(--accent-line); outline-offset: 0; border-color: var(--accent); }
.paper-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.pc { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 16px 18px; border-radius: var(--r); background: var(--card);
  border: 1px solid var(--line); box-shadow: var(--shadow); transition: transform .12s, box-shadow .15s; }
.pc:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.pc.clickable { cursor: pointer; }
.pc.alert-retracted { border-color: var(--bad-line); border-top: 4px solid var(--bad); }
.pc.alert-new_version { border-color: var(--info-line); border-top: 4px solid var(--info); }
.pc.alert-not_found { border-color: var(--bad-line); border-top: 4px solid var(--bad); }
.pc .top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.pc h3 { margin: 0; font: 600 16.5px/1.3 var(--display); }
.pc .ids { font: 12px var(--mono); color: var(--muted); }
.pc .why { font-size: 13px; color: var(--ink-2); }
.pc .foot { display: flex; align-items: center; gap: 10px; margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 12px; color: var(--muted); }
.score { display: inline-flex; align-items: center; gap: 6px; font: 600 12px var(--mono); color: var(--ink-2); }
.score i { display: inline-block; width: 60px; height: 6px; border-radius: 9px; background: var(--card-2); border: 1px solid var(--line); overflow: hidden; position: relative; }
.score i::after { content: ""; position: absolute; inset: 0; width: var(--w); background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.flag { font-size: 12px; color: var(--warn); }

/* ------------------------------------------------------------------ split pages (brief, runs) */
.split { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 950px) { .split { grid-template-columns: 1fr; } }
.side-list { position: sticky; top: 140px; max-height: calc(100vh - 170px); display: flex; flex-direction: column; }
.side-list > div:last-child { overflow: auto; }
.side-list button { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 12px 16px; }
.side-list button:hover { background: var(--hover); }
.side-list button.active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.side-list .s { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.side-list .r1 { font: 600 13px var(--mono); }

/* brief reading view: a printed newsletter, centred, same colours in every theme */
article.paper { background: var(--paper); border-color: var(--paper-line); }
.md { padding: 36px 48px 48px; font-size: 15px; line-height: 1.7; color: #2a2722; }
article.paper .md { max-width: 880px; margin: 0 auto; }
.md h1 { font: 650 32px/1.2 var(--display); margin: 0 0 6px; letter-spacing: -.3px; color: #15130f; }
.md h2 { font: 600 20px var(--display); margin: 30px 0 10px; padding-top: 18px; border-top: 1px solid #e6dfcf; color: #15130f; }
.md p { margin: 8px 0; }
.md em { color: #6b665c; font-style: normal; font-size: 13px; }
.md ul, .md ol { padding-left: 22px; } .md li { margin: 6px 0; }
.md ol > li { margin: 18px 0; } .md ol > li::marker { font: 700 15px var(--display); color: #0f766e; }
.md .li-h { font-size: 15.5px; }
.md .li-c { color: #4a463e; margin: 4px 0 6px; }
.md ul.sub { margin: 6px 0 0; padding-left: 18px; } .md ul.sub li { margin: 8px 0 2px; color: #2a2722; }
.md blockquote { margin: 6px 0 8px 2px; padding: 6px 14px; border-left: 3px solid #16a34a; background: #ecf7ee; color: #2d4a35; border-radius: 0 8px 8px 0; font-size: 14px; }
.md code { font: 12.5px var(--mono); background: #efe9dc; padding: 1px 6px; border-radius: 5px; color: #3b3326; }
.md hr { border: 0; border-top: 1px solid #e6dfcf; margin: 26px 0; }
.md a { color: #0f766e; } .md b { color: #15130f; }
.md .k-retracted { color: #b91c1c; } .md .k-version { color: #1d4ed8; } .md .k-conflict { color: #a16207; }

/* ------------------------------------------------------------------ approvals & quarantine cards */
.ac { padding: 18px 20px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.ac.pending { border-color: var(--warn-line); border-left: 4px solid var(--warn); }
.ac .row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.ac h3 { margin: 0; font: 600 18px var(--display); }
.ac .meta { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.ac details { margin-top: 12px; } .ac summary { cursor: pointer; color: var(--accent-strong); font-weight: 600; font-size: 13px; }
.ac .preview { margin-top: 10px; max-height: 360px; overflow: auto; border-radius: 10px; border: 1px solid var(--paper-line); background: var(--paper); }
.ac .preview .md { padding: 18px 26px; font-size: 13.5px; }
.qc { padding: 18px 20px; border-radius: var(--r); background: var(--card); border: 1px solid var(--violet-line); border-left: 4px solid var(--violet); box-shadow: var(--shadow); }
.qc .row { display: flex; justify-content: space-between; gap: 14px; align-items: center; }
.qc h3 { margin: 0; font: 600 16px var(--mono); }
.sev { display: flex; align-items: center; gap: 10px; font: 700 12px var(--mono); color: var(--violet); }
.sev i { display: block; width: 140px; height: 8px; border-radius: 9px; background: var(--card-2); overflow: hidden; position: relative; border: 1px solid var(--line); }
.sev i::after { content: ""; position: absolute; inset: 0; width: var(--w); background: linear-gradient(90deg, #f59e0b, #ef4444, #a855f7); }
.did { margin: 12px 0; padding: 10px 14px; border-radius: 10px; background: var(--ok-bg); border: 1px solid var(--ok-line); color: var(--ink-2); font-size: 13px; }
.did b { color: var(--ok); }
.finds { display: grid; gap: 8px; }
.find { display: grid; grid-template-columns: minmax(200px, 280px) 90px minmax(0, 1fr); gap: 14px; align-items: start; padding: 10px 12px; border-radius: 9px; background: var(--card-2); border: 1px solid var(--line); }
.find .rules { display: flex; flex-wrap: wrap; gap: 4px; }
.find .ex { font: 12px/1.55 var(--mono); color: var(--ink-2); overflow-wrap: anywhere; }
.find .ch { font: 600 11px var(--mono); color: var(--muted); padding-top: 3px; }

/* ------------------------------------------------------------------ replay */
.player { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--card-2); }
.player input[type=range] { flex: 1; accent-color: var(--accent); }
.rp-stages { display: flex; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.rp-stages button { border: 1px solid var(--line); background: var(--card); padding: 4px 11px; border-radius: 8px; font: 600 12px var(--sans); color: var(--muted); text-transform: capitalize; }
.rp-stages button.seen { color: var(--accent-strong); border-color: var(--accent-line); background: var(--accent-soft); }
[data-theme="dark"] .rp-stages button.seen { color: var(--accent); }
.rp-meta { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 0; border-bottom: 1px solid var(--line); }
.rp-meta span { padding: 10px 14px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; font-weight: 700; border-right: 1px solid var(--line); }
.rp-meta span:last-child { border-right: 0; }
.rp-meta b { display: block; color: var(--ink); font: 600 15px var(--mono); text-transform: none; letter-spacing: 0; margin-top: 2px; }
.rp-meta:empty { display: none; }

/* ------------------------------------------------------------------ about */
.rule-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1100px) { .rule-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.rule { padding: 16px 18px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.rule .id { display: inline-block; font: 700 11.5px var(--mono); color: var(--accent-strong); background: var(--accent-soft); padding: 2px 8px; border-radius: 6px; }
[data-theme="dark"] .rule .id { color: var(--accent); }
.rule h4 { margin: 8px 0 6px; font: 600 16px var(--display); }
.rule p { margin: 0; font-size: 13px; color: var(--ink-2); }
.rule .test { margin-top: 10px; font: 11.5px var(--mono); color: var(--ok); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 10px 16px; align-items: center; }
.kv > div:nth-child(odd) { color: var(--muted); text-transform: capitalize; }
.checks { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 8px; }
.checks li::before { content: "✓"; color: var(--ok); font-weight: 800; margin-right: 10px; }

/* ------------------------------------------------------------------ one-click samples */
.try-card { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.try-body { display: grid; gap: 8px; }
.try { box-sizing: border-box; display: flex; align-items: center; gap: 12px; width: 100%; min-width: 0; text-align: left; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card-2); color: var(--ink); cursor: pointer; font: inherit;
  transition: border-color .15s, background .15s, transform .15s; }
.try:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); }
.try:disabled { opacity: .55; cursor: not-allowed; }
.try-ico { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 10px; font-weight: 800; font-size: 16px; }
.try-ico.r { background: var(--bad-bg); color: var(--bad); border: 1px solid var(--bad-line); }
.try-ico.d { background: var(--info-bg); color: var(--info); border: 1px solid var(--info-line); }
.try-ico.t { background: var(--violet-bg); color: var(--violet); border: 1px solid var(--violet-line); }
.try-txt { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; flex: 1; }
.try-txt b { font-weight: 650; }
.try-txt small { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.try-go { flex: none; font-size: 12px; font-weight: 700; color: var(--accent-strong); }
[data-theme="dark"] .try-go { color: var(--accent); }
.try-watch { font-size: 12px; color: var(--ink-2); background: var(--card-2); border: 1px dashed var(--line-2); border-radius: 10px; padding: 8px 10px; }
.try-watch.on { border-style: solid; border-color: var(--accent-line); background: var(--accent-soft); color: var(--ink); }

/* ------------------------------------------------------------------ add input card, topics, demo banner */
.add-body { display: grid; gap: 12px; }
.drop { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1.5px dashed var(--line-2); border-radius: 12px;
  cursor: pointer; background: var(--card-2); color: var(--ink-2); transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop-ico { width: 34px; height: 34px; flex: none; padding: 7px; border-radius: 10px; background: var(--card); color: var(--accent-strong);
  border: 1px solid var(--line); }
[data-theme="dark"] .drop-ico { color: var(--accent); }
.drop-txt { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.drop-txt b { font-weight: 650; color: var(--ink); }
.drop-txt small { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .9px; font-weight: 700; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.row-in { display: flex; gap: 8px; align-items: center; }
.field { flex: 1; min-width: 0; padding: 8px 12px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--card); color: var(--ink); }
.field::placeholder { color: var(--muted); }
.field:focus { outline: 2px solid var(--accent-line); border-color: var(--accent); }
.hint { color: var(--muted); font-size: 11.5px; margin-top: -4px; }
.hint code { font: 11px var(--mono); background: var(--card-2); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line); }
.topics { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--card); color: var(--ink);
  font: 13px/1.6 var(--sans); resize: vertical; }
.topics:focus { outline: 2px solid var(--accent-line); border-color: var(--accent); }
.demo-banner { background: var(--warn-bg); color: var(--warn); border-bottom: 1px solid var(--warn-line); text-align: center;
  padding: 7px 16px; font-size: 12.5px; font-weight: 600; }

/* ------------------------------------------------------------------ modal & toast */
.modal { position: fixed; inset: 0; background: rgba(2, 6, 23, .55); display: none; place-items: center; z-index: 50; padding: 24px; }
.modal.open { display: grid; }
.modal .card { width: min(900px, 100%); max-height: 88vh; overflow: auto; background: var(--paper); }
.modal .card-h { background: #f3eee3; color: #3b3326; border-bottom-color: var(--paper-line); }
.modal .btn { background: #ffffff; color: #1f2937; border-color: #d6d0c1; }
.toast { position: fixed; right: 22px; bottom: 22px; padding: 12px 18px; border-radius: 12px; background: #0f172a; color: #f8fafc; border: 1px solid #1f2d48;
  box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(10px); transition: .25s; z-index: 60; max-width: 420px; }
.toast.show { opacity: 1; transform: none; }

/* ================================================================== MOBILE & TABLET */
.paper-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
@media (max-width: 950px) {
  .side-list { position: static; max-height: none; }
  .side-list > div:last-child { max-height: 260px; }
  .rp-meta { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .rp-meta span:nth-child(4n) { border-right: 0; }
  .find { grid-template-columns: 1fr; gap: 6px; }
  .tiles.small { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  header.top { padding: 0 12px; gap: 10px; height: 60px; }
  nav.tabs { top: 60px; padding: 0 6px; }
  nav.tabs button { padding: 12px 10px 11px; font-size: 13px; }
  nav.tabs .ti { display: none; }
  .status-cluster { margin-left: 0; padding-left: 0; border-left: 0; }
  .actions { gap: 6px; }
  .hbtn, .kill { height: 36px; padding: 0 11px; }
  .icon-btn { width: 34px; height: 34px; }
  .mark { width: 34px; height: 34px; }
  .brand .name { font-size: 19px; }
  main { padding: 16px 12px 40px; }
  .hero { padding: 16px; gap: 12px; }
  .hero h1 { font-size: 24px; }
  .lead { font-size: 13.5px; }
  .ring { width: 76px; height: 76px; }
  .ring-label b { font-size: 22px; } .ring-label small { font-size: 9.5px; }
  .stepper { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stepper .nt { height: auto; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tiles.small { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile { padding: 12px 12px 12px 15px; }
  .tile b { font-size: 24px; }
  .card-h { flex-wrap: wrap; }
  .feed { font-size: 12.8px; }
  .feed-card .feed { min-height: 420px; }
  .ev { grid-template-columns: 24px minmax(0, 1fr); gap: 8px; padding: 7px 12px; }
  .ev .t { display: none; }
  .ev > span:last-child { grid-column: 2; justify-self: start; }
  .ev > span:last-child:empty { display: none; }
  .seg { flex-wrap: wrap; }
  .page-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .page-head h2 { font-size: 24px; }
  .search { min-width: 0; width: 100%; }
  .md { padding: 22px 18px 28px; font-size: 14.5px; }
  .md h1 { font-size: 24px; }
  .ac .row, .qc .row { flex-direction: column; align-items: flex-start; }
  .sev i { width: 100px; }
  .player { flex-wrap: wrap; }
  .player input[type=range] { order: 3; flex-basis: 100%; }
  .rp-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rp-meta span:nth-child(2n) { border-right: 0; }
  .rule-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 110px minmax(0, 1fr); }
  .kv .mono { overflow-wrap: anywhere; }
  .modal { padding: 8px; }
  .demo-banner { font-size: 11.5px; padding: 6px 10px; }
  .toast { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}
@media (max-width: 560px) {
  .kpi-mini, .mode-chip { display: none !important; }
  .brand-text { display: none; }
  .hbtn span, .kill span:not(.kill-ring) { display: none; }
  .hbtn, .kill { width: 38px; padding: 0; justify-content: center; }
  .pill { padding: 4px 10px; font-size: 10.5px; margin-right: 0; }
  .status-cluster { flex: 1; justify-content: flex-start; }
}
@media (max-width: 760px) {
  /* stages: one row you can swipe */
  .stepper { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; }
  .stepper li { flex: 0 0 150px; scroll-snap-align: start; }
  /* the input box and side panels come before the long activity feed on phones */
  .grid.control > aside { order: -1; }
}
