/* euRedact bastion. One stylesheet, no framework. The CSP allows no inline
   style, so every visual state is a class here. Colours are euRedact's own:
   ink #082B33, teal #0E4F5C, sand #F1F5F5, yellow #FED766. */

:root {
  --bg: #f1f5f5; --surface: #ffffff; --surface-2: #f7fafa; --ink: #082b33; --ink-2: #3e5a62;
  --muted: #5b7780; --line: #dde6e8; --line-2: #c9d8db;
  --brand: #0e4f5c; --brand-2: #2a6b78; --brand-ink: #ffffff; --yellow: #fed766;
  --ok: #1d6b3a; --ok-bg: #e5f3ea; --warn: #8a5a00; --warn-bg: #fdf3d8;
  --bad: #a32020; --bad-bg: #fbe8e6; --info: #0e4f5c; --info-bg: #e3eff1;
  --shadow: 0 1px 2px rgba(8, 43, 51, .06), 0 4px 16px rgba(8, 43, 51, .06);
  --radius: 12px; --radius-sm: 8px;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
/* Dark: when the person chose it (the header's theme button, remembered per
   browser, applied by theme.js before the first paint), or when the system is
   dark and they did not choose light. */
:root[data-theme="dark"] {
    --bg: #071a1f; --surface: #0e252b; --surface-2: #122d34; --ink: #e8f0f2; --ink-2: #b8cbd0;
    --muted: #8fa8af; --line: #1f3d45; --line-2: #2a4f58;
    --brand: #7fc4d1; --brand-2: #9fd6e0; --brand-ink: #071a1f;
    --ok: #74d394; --ok-bg: #12301f; --warn: #f2c35e; --warn-bg: #33270b;
    --bad: #ff8f86; --bad-bg: #3a1614; --info: #8fd0dc; --info-bg: #123038;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #071a1f; --surface: #0e252b; --surface-2: #122d34; --ink: #e8f0f2; --ink-2: #b8cbd0;
    --muted: #8fa8af; --line: #1f3d45; --line-2: #2a4f58;
    --brand: #7fc4d1; --brand-2: #9fd6e0; --brand-ink: #071a1f;
    --ok: #74d394; --ok-bg: #12301f; --warn: #f2c35e; --warn-bg: #33270b;
    --bad: #ff8f86; --bad-bg: #3a1614; --info: #8fd0dc; --info-bg: #123038;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 2px; }
code, pre, kbd { font-family: var(--mono); font-size: .88em; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0; }
h3 { font-size: .9rem; margin: 0 0 6px; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.hidden, [hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* -- icons ------------------------------------------------------------------- */
.icon { width: 16px; height: 16px; flex: none; vertical-align: -3px; }
.icon.big { width: 28px; height: 28px; }

/* -- top bar ------------------------------------------------------------------ */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--surface);
  border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1560px; margin: 0 auto; padding: 10px 20px;
  display: flex; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink);
  flex: none; }
.brand-mark { width: 26px; height: 26px; color: var(--brand); }
.brand-name { font-size: 1.05rem; letter-spacing: -.01em; }
.brand-sub { font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted);
  padding: 2px 6px; border: 1px solid var(--line-2); border-radius: 6px; }
/* -- the menu, on the left and collapsible (bastion#26) ---------------------------- */
body.with-sidebar { display: flex; min-height: 100vh; }
.app-main { flex: 1; min-width: 0; }
.sidebar { position: sticky; top: 0; height: 100vh; flex: none; width: 232px; display: flex;
  flex-direction: column; gap: 14px; padding: 14px 10px; background: var(--surface);
  border-right: 1px solid var(--line); transition: width .15s ease; z-index: 25; }
.sidebar .brand { padding: 4px 8px 6px; }
.nav { display: flex; flex-direction: column; gap: 14px; flex: 1; overflow-y: auto;
  scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); padding: 0 10px 4px; }
.nav a { position: relative; display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: 8px; color: var(--ink-2); text-decoration: none; white-space: nowrap;
  font-weight: 500; }
.nav a .nav-label { flex: 1; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.active { background: var(--info-bg); color: var(--brand); }
.nav a.active::before { content: ""; position: absolute; left: -10px; top: 6px; bottom: 6px;
  width: 3px; border-radius: 2px; background: var(--brand); }
.nav-toggle { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0;
  border-radius: 8px; background: none; color: var(--muted); font: inherit; cursor: pointer; }
.nav-toggle:hover { background: var(--surface-2); color: var(--ink); }
.nav-toggle .icon { transition: transform .15s ease; }
.topbar-title { font-weight: 600; color: var(--ink-2); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }

/* Collapsed: icons only, the labels in each link's title; badges become dots. */
.nav-collapsed .sidebar { width: 60px; }
.nav-collapsed .sidebar .brand-name, .nav-collapsed .sidebar .brand-sub,
.nav-collapsed .nav-label, .nav-collapsed .nav-group-label { display: none; }
.nav-collapsed .nav-group + .nav-group { border-top: 1px solid var(--line); padding-top: 12px; }
.nav-collapsed .nav a, .nav-collapsed .nav-toggle { justify-content: center; padding: 9px 0; }
.nav-collapsed .nav a .badge { position: absolute; top: 3px; right: 5px; min-width: 9px;
  width: 9px; height: 9px; padding: 0; font-size: 0; }
.nav-collapsed .nav-toggle .icon { transform: rotate(180deg); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--bad);
  color: #fff; font-size: .75rem; font-weight: 700; display: inline-flex; align-items: center;
  justify-content: center; }
.session { display: flex; gap: 8px; align-items: center; flex: none; margin-left: auto; }

/* pills and menus (details/summary: works without JS) */
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
.pill { display: flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2);
  font-size: .88rem; white-space: nowrap; user-select: none; }
.pill:hover { border-color: var(--brand-2); }
.live-menu.on .pill { border-color: var(--ok); color: var(--ok); background: var(--ok-bg); }
.live-menu .until { color: var(--muted); }
.live-menu.on .until { color: inherit; opacity: .85; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); }
.live-menu.on .dot { background: var(--ok); }
.dot.pulse { animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(29, 107, 58, .45); }
  70% { box-shadow: 0 0 0 7px rgba(29, 107, 58, 0); } 100% { box-shadow: 0 0 0 0 transparent; } }
details { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); width: 300px; z-index: 30;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px; }
.menu p { color: var(--ink-2); font-size: .88rem; }
.menu-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.user-menu .menu { width: 210px; padding: 6px; }
.user-menu .menu a, .user-menu .menu .link { display: flex; gap: 8px; align-items: center;
  width: 100%; padding: 8px 10px; border-radius: 8px; color: var(--ink); text-decoration: none;
  background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.user-menu .menu a:hover, .user-menu .menu .link:hover { background: var(--surface-2); }

/* -- page --------------------------------------------------------------------- */
.page { max-width: 1560px; margin: 0 auto; padding: 28px 20px 80px; min-width: 0; }
.section, .card { min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  flex-wrap: wrap; margin-bottom: 22px; }
.page-head .sub, .section .sub { color: var(--muted); margin: 4px 0 0; }
.back { display: inline-block; margin-bottom: 10px; text-decoration: none; color: var(--muted);
  font-size: .9rem; }
.back:hover { color: var(--brand); }
.section { margin-top: 28px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  margin-bottom: 12px; }
.split { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 20px;
  align-items: start; }
.split.even { grid-template-columns: 1fr 1fr; }
.col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* -- cards -------------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; }
.card-title { display: flex; align-items: center; gap: 8px; font-weight: 650; margin-bottom: 12px;
  color: var(--ink-2); font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; }
/* minmax(0, …): a long command scrolls inside its card instead of widening the page */
.cards { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.cards.two { grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); }

/* request cards */
.req { display: block; min-width: 0; color: inherit; text-decoration: none;
  border-left: 4px solid var(--line-2);
  transition: border-color .15s, transform .15s; }
.req:hover { border-color: var(--brand); transform: translateY(-1px); }
.req.risk-high { border-left-color: var(--bad); }
.req.risk-medium { border-left-color: var(--warn); }
.req-head { display: flex; justify-content: space-between; align-items: center; gap: 10px;
  flex-wrap: wrap; }
.what { font-size: 1.05rem; }
.verb { font-weight: 700; }
.on { color: var(--muted); margin: 0 6px; }
.target { font-weight: 600; color: var(--brand); }
h1 .on { margin: 0 8px; font-weight: 400; }
.cmd { display: block; margin: 10px 0; padding: 9px 12px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--radius-sm); overflow-x: auto;
  white-space: nowrap; color: var(--ink); }
.reason { display: flex; gap: 8px; color: var(--ink-2); font-style: italic; }
.reason .icon { margin-top: 3px; color: var(--muted); }
.req-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px;
  font-size: .88rem; }
.req-foot .meta { color: var(--muted); }
.req-foot .go { margin-left: auto; color: var(--brand); font-weight: 600; }
.countdown.soon { color: var(--bad); font-weight: 600; }

/* chips */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px;
  font-size: .78rem; font-weight: 600; line-height: 1.6; background: var(--surface-2);
  color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.chip .icon { width: 13px; height: 13px; }
.chip.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.chip.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.chip.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.chip.info { background: var(--info-bg); color: var(--info); border-color: transparent; }
.chip.muted { color: var(--muted); }
.chip.plain { background: transparent; }
.chip.where { background: var(--info-bg); color: var(--brand); border-color: transparent;
  font-family: var(--mono); font-weight: 600; }
.filter { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* -- buttons ------------------------------------------------------------------ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; position: relative;
  transition: background .15s, border-color .15s, opacity .15s; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: .88rem; }
.btn.wide { width: 100%; }
.btn.primary { background: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-2); }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn.secondary:hover { border-color: var(--brand); color: var(--brand); }
.btn.ghost { background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger { background: var(--surface); color: var(--bad); border-color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn.busy span { visibility: hidden; }
.btn.busy::after { content: ""; position: absolute; width: 16px; height: 16px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* -- forms -------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; }
.field > span { font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.field em { font-weight: 400; color: var(--muted); font-style: normal; }
.field.inline { flex-direction: row; align-items: center; margin: 0; }
input, textarea, select { font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 10px 12px; width: 100%; }
textarea { resize: vertical; font-family: var(--mono); font-size: .88rem; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--info-bg); }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 14px; cursor: pointer; }
.check input { width: auto; margin-top: 4px; }
.check.bad { color: var(--bad); font-weight: 600; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.preview { display: flex; gap: 10px; align-items: center; padding: 12px 14px; margin-bottom: 14px;
  border-radius: var(--radius-sm); background: var(--info-bg); color: var(--info); font-weight: 500; }
.fine { color: var(--muted); font-size: .84rem; margin: 10px 0 0; }

/* -- alerts ------------------------------------------------------------------- */
.alert { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius);
  border: 1px solid transparent; margin-bottom: 14px; }
.alert .icon { margin-top: 2px; }
.alert p { margin: 4px 0 0; }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.alert.bad { background: var(--bad-bg); color: var(--bad); }
.alert.info { background: var(--info-bg); color: var(--info); margin-top: 20px; }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
.alert p, .alert code { color: var(--ink-2); }

/* -- request detail ----------------------------------------------------------- */
.code-block { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden;
  margin: 10px 0; background: var(--surface-2); }
.code-head { display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 4px 6px 4px 12px; border-bottom: 1px solid var(--line); font-size: .8rem;
  color: var(--muted); font-family: var(--mono); }
.code-block pre { margin: 0; padding: 12px; overflow-x: auto; color: var(--ink); }
pre.wrap { white-space: pre-wrap; word-break: break-all; }
pre.output { max-height: 480px; overflow-y: auto; font-size: .82rem; line-height: 1.45; }
/* A long command scrolls inside its card, so the decision stays near. */
pre.cmd-scroll { max-height: min(55vh, 520px); overflow-y: auto; scroll-behavior: smooth; }
.code-tools { display: inline-flex; gap: 4px; align-items: center; }
.ln { display: inline-block; min-width: 100%; border-radius: 3px; }
.ln.flag { background: var(--warn-bg); }
.ln.severe { background: var(--bad-bg); color: var(--bad); font-weight: 600;
  box-shadow: inset 3px 0 0 var(--bad); }
.ln.severe.current { outline: 2px solid var(--bad); outline-offset: -1px; }
.card-title .spacer { flex: 1; }
.kvp.link { display: inline-flex; align-items: center; gap: 4px; font-weight: 600;
  color: var(--brand); text-decoration: none; }
.quote { margin: 0; padding: 12px 16px; border-left: 3px solid var(--line-2);
  background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  white-space: pre-wrap; }
.verdict { display: flex; gap: 12px; padding: 14px; border-radius: var(--radius-sm);
  margin-bottom: 14px; }
.verdict b { font-size: 1.05rem; }
.verdict p { margin: 2px 0 0; color: var(--ink-2); }
.verdict.ok { background: var(--ok-bg); color: var(--ok); }
.verdict.warn { background: var(--warn-bg); color: var(--warn); }
.verdict.bad { background: var(--bad-bg); color: var(--bad); }
.opinion.ok { border-top: 3px solid var(--ok); }
.opinion.warn { border-top: 3px solid var(--warn); }
.opinion.bad { border-top: 3px solid var(--bad); }
.kvs { margin: 0; }
.kv { display: grid; grid-template-columns: 9.5rem 1fr; gap: 10px; padding: 9px 0;
  border-top: 1px solid var(--line); }
.kv dt { color: var(--muted); font-size: .88rem; }
.kv dd { margin: 0; }
.kv dd p { margin: 4px 0 0; color: var(--ink-2); font-size: .9rem; }
.checks { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
.checks ul, .list { margin: 0; padding: 0; list-style: none; }
.checks li { display: flex; gap: 8px; padding: 4px 0; color: var(--ink-2); }
.checks .icon { color: var(--ok); margin-top: 3px; }
.list li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.decide { border: 2px solid var(--brand); }
.decide-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 12px; padding-bottom: 14px; position: relative; }
.timeline li:not(:last-child)::before { content: ""; position: absolute; left: 13px; top: 28px;
  bottom: 0; width: 2px; background: var(--line); }
.tl-dot { width: 28px; height: 28px; border-radius: 50%; flex: none; display: flex;
  align-items: center; justify-content: center; background: var(--info-bg); color: var(--info); }
.timeline li.bad .tl-dot { background: var(--bad-bg); color: var(--bad); }
.timeline li.skip .tl-dot { background: var(--surface-2); color: var(--muted); }
.timeline li.done .tl-dot { background: var(--ok-bg); color: var(--ok); }
.cell-sub { color: var(--muted); font-size: .82rem; margin-top: 2px; }

/* -- empty states ------------------------------------------------------------ */
.empty { text-align: center; padding: 34px 20px; color: var(--muted); background: var(--surface);
  border: 1px dashed var(--line-2); border-radius: var(--radius); }
.card .empty { border: 0; padding: 18px 10px; background: none; }
.empty .icon { color: var(--line-2); margin-bottom: 6px; }
.empty-title { color: var(--ink-2); font-weight: 650; margin-bottom: 2px; }

/* -- tables ------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 650; padding: 10px 14px; background: var(--surface-2);
  border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table a { text-decoration: none; color: inherit; }
.table a:hover .verb { color: var(--brand); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
code.rule { background: var(--surface-2); padding: 2px 7px; border-radius: 6px;
  border: 1px solid var(--line); }
.kvps { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.kvp { font-size: .84rem; color: var(--ink-2); word-break: break-word; }
.kvp b { color: var(--muted); font-weight: 600; }

/* tabs */
.tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.tab { padding: 5px 12px; border-radius: 8px; text-decoration: none; color: var(--ink-2);
  font-size: .88rem; font-weight: 500; }
.tab.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }

/* -- allowlist ------------------------------------------------------------------ */
.rec-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.rec p { color: var(--ink-2); }
.rec-actions { display: flex; gap: 8px; margin-top: 10px; }
.form-card { max-width: 760px; }

/* -- metrics ------------------------------------------------------------------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; }
.tile-top { display: flex; align-items: center; gap: 7px; color: var(--muted); }
.tile-label { font-size: .8rem; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
.tile-value { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; margin: 6px 0 2px;
  font-variant-numeric: tabular-nums; }
.tile-sub { color: var(--muted); font-size: .82rem; }
.tile.bad .tile-value { color: var(--bad); }
svg.bars, svg.stack { display: block; width: 100%; height: auto; }
.bar-label { fill: var(--ink-2); font-size: 13px; }
.bar-value { fill: var(--ink); font-size: 13px; font-weight: 600; }
.bar-track { fill: var(--surface-2); }
.bar-fill { fill: var(--brand); }
.bar-row:hover .bar-fill { fill: var(--brand-2); }
.seg.ok { fill: var(--ok); } .seg.warn { fill: var(--warn); } .seg.bad { fill: var(--bad); }
.legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; }
.legend-item { display: flex; align-items: center; gap: 8px; }

/* -- shell steps ------------------------------------------------------------------ */
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px;
  max-width: 820px; }
.step { display: flex; gap: 16px; }
.step-n { width: 32px; height: 32px; border-radius: 50%; flex: none; display: flex;
  align-items: center; justify-content: center; background: var(--info-bg); color: var(--brand);
  font-weight: 700; }
.step-body { flex: 1; min-width: 0; }
.step-body h2 { margin-bottom: 6px; }

/* -- sign-in -------------------------------------------------------------------- */
body.focus .page { display: flex; justify-content: center; padding-top: 9vh; }
.focus-card { width: 100%; max-width: 420px; text-align: center; padding: 32px 28px; }
.focus-card h1 { margin: 8px 0 6px; }
.focus-card .sub { color: var(--muted); margin-bottom: 22px; }
.focus-card .field { text-align: left; }
.focus-icon { width: 60px; height: 60px; margin: 0 auto; border-radius: 16px; display: flex;
  align-items: center; justify-content: center; background: var(--info-bg); color: var(--brand); }

/* -- toasts --------------------------------------------------------------------- */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 50;
  display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100% - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px;
  border-radius: var(--radius); background: var(--ink); color: var(--bg); box-shadow: var(--shadow);
  animation: rise .2s ease-out; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

/* -- small screens ------------------------------------------------------------- */
@media (max-width: 860px) {
  .split, .split.even { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .topbar-inner { flex-wrap: wrap; gap: 8px 12px; padding: 8px 16px; }
  /* A phone: the menu is its icons, always; no toggle. */
  .sidebar { width: 56px; padding: 12px 6px; }
  .sidebar .brand-name, .sidebar .brand-sub, .nav-label, .nav-group-label, .nav-toggle
  { display: none; }
  .nav-group + .nav-group { border-top: 1px solid var(--line); padding-top: 12px; }
  .nav a { justify-content: center; padding: 9px 0; }
  .nav a .badge { position: absolute; top: 3px; right: 3px; min-width: 9px; width: 9px;
    height: 9px; padding: 0; font-size: 0; }
  .topbar-title { display: none; }
  .session { margin-left: auto; }
  .page { padding: 18px 16px 90px; }
  h1 { font-size: 1.35rem; }
  .menu { position: fixed; left: 16px; right: 16px; width: auto; top: 110px; }
  .decide-actions .btn { flex: 1; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .req-foot .go { margin-left: 0; }
  /* tables become stacked rows: each row a block, its cells flowing */
  .table thead { display: none; }
  .table, .table tbody, .table tr { display: block; }
  .table tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .table tr:last-child { border-bottom: 0; }
  .table td { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 3px 8px 3px 0;
    border: 0; }
  .table td:nth-child(2) { display: block; }
  .table .cell-sub code { word-break: break-all; }
  .right { text-align: left; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile-value { font-size: 1.6rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* metrics: trends, series, cards that wrap (2026-11-07) */
.tile-sub { overflow-wrap: anywhere; }
.trend { font-size: .82rem; font-weight: 600; margin-left: 10px; color: var(--muted);
  white-space: nowrap; vertical-align: middle; }
.trend.good { color: var(--ok); }
.trend.bad { color: var(--bad); }
svg.series { width: 100%; height: auto; display: block; }
svg.series .col { fill: var(--info); }
svg.series .line { fill: none; stroke: var(--info); stroke-width: 2; stroke-linejoin: round;
  stroke-linecap: round; }
svg.series .dot { fill: var(--info); }
svg.series .hit { fill: transparent; }
svg.series .hit:hover { fill: var(--info-bg); fill-opacity: .55; }
svg.series .axis { stroke: var(--line-2); stroke-width: 1; }
svg.series .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; }
.series-top, .series-axis { color: var(--muted); font-size: .78rem; font-family: var(--mono); }
.series-top { margin-bottom: 4px; }
.series-axis { display: flex; justify-content: space-between; gap: 12px; margin-top: 4px; }
svg.series .line { vector-effect: non-scaling-stroke; }
svg.series .axis, svg.series .grid { vector-effect: non-scaling-stroke; }
.tiles > * { min-width: 0; }
.tile-value { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 10px; row-gap: 2px; }
.tile-value .trend { margin-left: 0; }

/* the theme button: Auto, Light, Dark */
.theme-toggle { display: inline-flex; align-items: center; gap: 6px; }
.theme-toggle .icon { width: 16px; height: 16px; }
.theme-toggle .t-light, .theme-toggle .t-dark { display: none; }
:root[data-theme="light"] .theme-toggle .t-auto, :root[data-theme="dark"] .theme-toggle .t-auto { display: none; }
:root[data-theme="light"] .theme-toggle .t-light, :root[data-theme="dark"] .theme-toggle .t-dark { display: inline; }

/* Mistral's suggestions: Use / Decline / Later, signed once at the bottom (#193) */
.suggestion { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.sug-note { font-style: italic; }
.choices { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.choice span { display: inline-block; padding: 6px 14px; border: 1px solid var(--line-2);
  border-radius: 99px; font-size: 14px; color: var(--ink-2); }
.choice input:checked + span { background: var(--brand); border-color: var(--brand);
  color: var(--brand-ink); font-weight: 600; }
.choice input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
details.cases { margin: 12px 0; }
details.cases > summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
details.cases > summary::before { content: "▸"; display: inline-block; width: 1em;
  color: var(--muted); transition: transform .15s; }
details.cases[open] > summary::before { transform: rotate(90deg); }
td.why { font-size: .8rem; color: var(--muted); min-width: 260px; max-width: 520px; }

/* The Deploy page (bastion#26): one row per thing deployed, test then production. */
.pipeline { margin: 0 0 28px; }
.pipeline > .card-title { margin: 0 0 10px; }
.pipeline-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 12px; align-items: stretch; }
.pipeline-arrow { display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; font-size: 12px; color: var(--muted); }
.env-card { margin: 0; }
.env-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.env-head h2 { margin: 0; font-size: 1.1rem; }
.env-card.test { border-left: 4px solid var(--warn, #b45309); }
.env-card.production { border-left: 4px solid var(--bad, #b91c1c); }
.env-card.off { opacity: .55; border-left: 4px dashed var(--line, #c8ccd2); background: transparent;
  box-shadow: none; }
.skip-test { margin-top: 12px; }
.skip-test summary { cursor: pointer; color: var(--bad, #b91c1c); font-weight: 600; }
@media (max-width: 960px) {
  .pipeline-row { grid-template-columns: 1fr; }
  .pipeline-arrow { flex-direction: row; }
  .pipeline-arrow .icon { transform: rotate(90deg); }
}
.env-link { margin-left: auto; font-size: .82rem; color: var(--muted); text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.env-link:hover { color: var(--brand); text-decoration: underline; }
.kvs.compact .kv { padding: 5px 0; }
.env-suite { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.env-flag { display: flex; align-items: flex-start; gap: 6px; margin: 6px 0; font-size: .9rem; }
.env-flag.bad { color: var(--bad, #b91c1c); }
.env-flag.warn { color: var(--warn, #b45309); }
.no-expiry { color: var(--muted); }

/* E2E (bastion#26): the trend, then every case in collapsible groups.
   Outcomes take the status tokens, always beside a label. */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }
svg.series .seg-ok, .swatch.seg-ok { fill: var(--ok); background: var(--ok); }
svg.series .seg-bad, .swatch.seg-bad { fill: var(--bad); background: var(--bad); }
svg.series .seg-skip, .swatch.seg-skip { fill: var(--line-2); background: var(--line-2); }
/* A failure with a cause on file (euredact-inference#353): amber, labelled "known". */
svg.series .seg-known, .swatch.seg-known { fill: var(--warn); background: var(--warn); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px;
  margin-right: 6px; vertical-align: -1px; }
details.e2e-group { margin: 12px 0; padding: 0; }
details.e2e-group > summary { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; padding: 14px 16px; }
details.e2e-group > summary::before { content: "▸"; color: var(--muted); margin-right: 4px; }
details.e2e-group[open] > summary::before { content: "▾"; }
details.e2e-group[open] > summary { border-bottom: 1px solid var(--line); }
.e2e-group-name { font-weight: 600; margin-right: auto; }
.e2e-group-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.e2e-table td.why { color: var(--muted); font-size: .85rem; max-width: 36ch;
  overflow-wrap: anywhere; }
.e2e-table td.num, table td.num { text-align: right; white-space: nowrap;
  font-variant-numeric: tabular-nums; }
.h-strip { display: inline-flex; gap: 2px; vertical-align: middle; }
.h-cell { width: 8px; height: 14px; border-radius: 2px; background: var(--line); }
.h-cell.h-ok { background: var(--ok); }
.h-cell.h-bad { background: var(--bad); }
.h-cell.h-muted { background: var(--line-2); }
.h-cell.h-warn { background: var(--warn); }
.h-cell.h-none { background: transparent; border: 1px dashed var(--line-2); }
.e2e-table td:first-child code { white-space: nowrap; }

/* The Deploy page's "Checked … · Check now" (bastion#52). */
.page-head .checked { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* E2E: a run under way, the revision tested, screenshots of failures (bastion#54). */
.e2e-live { border-color: var(--line-2); margin-bottom: 16px; }
.e2e-bar { display: block; width: 100%; height: 14px; border-radius: 4px; margin: 6px 0 10px; }
.e2e-bar .e2e-bar-rest { fill: var(--line); }
.e2e-live-fails { margin: 8px 0 0; padding-left: 18px; }
.e2e-live code { overflow-wrap: anywhere; }
.e2e-live-fails li { margin: 4px 0; }
.e2e-live-fails .why { display: block; color: var(--muted); font-size: .86rem; overflow-wrap: anywhere; }
.rev-tile { min-width: 0; }
.rev-value code { font-size: 1.5rem; }
.rev-value a { text-decoration: none; }
.rev-subject { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.e2e-shot { display: block; width: max-content; margin-top: 6px; }
.e2e-shot img { display: block; max-width: 220px; max-height: 140px; border: 1px solid var(--line-2);
  border-radius: 4px; }
.e2e-target { white-space: nowrap; }
.e2e-target .icon { width: 14px; height: 14px; }

/* Deploy: commits behind on the arrows, the compare page (bastion#57). */
a.pipeline-arrow.lag { text-decoration: none; color: var(--ink); border-radius: var(--radius-sm);
  padding: 8px 10px; border: 1px solid var(--line-2); }
a.pipeline-arrow.lag:hover, a.pipeline-arrow.lag:focus-visible { background: var(--surface-2); }
.pipeline-arrow .lag-n { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.pipeline-arrow .lag-open { font-size: .8rem; color: var(--muted); }
.pipeline-arrow.in-step { color: var(--muted); }
.lag-line { margin: 0 0 10px; }
.lag-line a { text-decoration: none; }
.lag-line .icon { width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; }
.commits { list-style: none; margin: 0; padding: 0; }
.commit { padding: 10px 0; border-top: 1px solid var(--line); }
.commit:first-child { border-top: 0; }
.commit-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.commit-head b { overflow-wrap: anywhere; }
.commit-body { white-space: pre-wrap; overflow-wrap: anywhere; margin: 6px 0 0; font-size: .86rem;
  color: var(--muted); }
.diff-file { border-top: 1px solid var(--line); }
.diff-file > summary { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0;
  cursor: pointer; }
.diff-file > summary code { overflow-wrap: anywhere; }
.d-count { white-space: nowrap; font-size: .86rem; }
pre.diff { margin: 0 0 10px; overflow-x: auto; font-size: .8rem; line-height: 1.45; }
pre.diff .d-add, .d-count .d-add { color: var(--ok); }
pre.diff .d-del, .d-count .d-del { color: var(--bad); }
pre.diff .d-hunk { color: var(--muted); }
.suggest h3 { font-size: .95rem; margin: 14px 0 6px; }
.suggest-list { list-style: none; padding: 0; margin: 0; }
.suggest-new { padding: 10px 0; border-top: 1px solid var(--line); }
.suggest-new p { margin: 6px 0 0; }
.tile.warn .tile-value { color: var(--warn); }
