/* ISMS Copilot design system.
 *
 * One stylesheet for the three pages. It is served from /static, which the
 * service's CSP allows as style-src 'self'. The CSP forbids style attributes
 * and third-party fonts, so everything here is class-based and the type is the
 * system UI face.
 *
 * Theme: follows the operating system by default; theme.js can pin a choice by
 * setting data-theme on <html>. The sidebar is midnight in both themes — it is
 * the product's identity, not a themed surface.
 */

:root {
  --bg: #f6f7fa;
  --surface: #ffffff;
  --raised: #f0f3f8;
  --line: #e2e7ef;
  --line-strong: #ccd4e0;
  --ink: #0e1626;
  --ink-2: #3a4558;
  --muted: #5e6a7e;
  --accent: #1f5fd8;
  --accent-hover: #184fb8;
  --accent-ink: #ffffff;
  --accent-soft: #eaf1fe;
  --accent-line: #bbd0f7;
  --teal: #0c8f84;
  --amber: #c98a12; --coral: #c8324f;
  --sev-crit: #8e1b33; --sev-high: #c8324f; --sev-med: #946306; --sev-low: #0c7f76;
  --warn-bg: #fdf5e6; --warn-line: #ebcf95; --warn-ink: #7a5300;
  --bad-bg: #fdeef0; --bad-line: #ebb0ba; --bad-ink: #8e1b33;
  --good-bg: #e9f6f1; --good-line: #a9d8c6; --good-ink: #12614a;
  --shadow-sm: 0 1px 2px rgba(14, 22, 38, .05);
  --shadow-md: 0 10px 30px -14px rgba(14, 22, 38, .22), 0 2px 6px rgba(14, 22, 38, .05);
  --glow: rgba(31, 95, 216, .10);
  --side-bg: #0b1324;
  --show-sun: none; --show-moon: block;

  --side-ink: #dde4f1;
  --side-muted: #8d9bb5;
  --side-line: #1a2540;
  --side-hover: #121c33;
  --side-active: #17233f;
  --side-accent: #6aa6ff;

  --r-sm: 8px; --r-md: 12px; --r-lg: 18px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --font: "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", Inter, system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0f1c; --surface: #101727; --raised: #172033;
    --line: #1e2a40; --line-strong: #2c3b57;
    --ink: #e8ecf4; --ink-2: #c3cbda; --muted: #93a0b7;
    --accent: #6aa6ff; --accent-hover: #8bbaff; --accent-ink: #06101f;
    --accent-soft: #132344; --accent-line: #274677; --teal: #45d4c2; --amber: #f3b55b; --coral: #ff9485; --sev-crit: #9c2440; --sev-high: #c2405a; --sev-med: #8f6412; --sev-low: #197a72;
    --warn-bg: #2a2212; --warn-line: #5f4c22; --warn-ink: #ebc47a;
    --bad-bg: #2c161c; --bad-line: #663040; --bad-ink: #f3a6b6;
    --good-bg: #10261f; --good-line: #255644; --good-ink: #86d9ba;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 14px 34px -14px rgba(0, 0, 0, .7), 0 2px 6px rgba(0, 0, 0, .35);
    --glow: rgba(106, 166, 255, .10);
    --side-bg: #070b15;
    --show-sun: block; --show-moon: none;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0f1c; --surface: #101727; --raised: #172033;
  --line: #1e2a40; --line-strong: #2c3b57;
  --ink: #e8ecf4; --ink-2: #c3cbda; --muted: #93a0b7;
  --accent: #6aa6ff; --accent-hover: #8bbaff; --accent-ink: #06101f;
  --accent-soft: #132344; --accent-line: #274677; --teal: #45d4c2; --amber: #f3b55b; --coral: #ff9485; --sev-crit: #9c2440; --sev-high: #c2405a; --sev-med: #8f6412; --sev-low: #197a72;
  --warn-bg: #2a2212; --warn-line: #5f4c22; --warn-ink: #ebc47a;
  --bad-bg: #2c161c; --bad-line: #663040; --bad-ink: #f3a6b6;
  --good-bg: #10261f; --good-line: #255644; --good-ink: #86d9ba;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 14px 34px -14px rgba(0, 0, 0, .7), 0 2px 6px rgba(0, 0, 0, .35);
  --glow: rgba(106, 166, 255, .10);
  --side-bg: #070b15;
  --show-sun: block; --show-moon: none;
}

/* ------------------------------------------------------------------ base */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: light dark; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent); }
code {
  font-family: var(--mono); font-size: .86em;
  background: var(--raised); border: 1px solid var(--line);
  padding: 1px 6px; border-radius: 6px;
}
.ico {
  width: 18px; height: 18px; flex: 0 0 auto;
  fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ----------------------------------------------------------------- shell */
.app { display: flex; height: 100vh; height: 100dvh; }

.sidebar {
  flex: 0 0 248px;
  background: var(--side-bg);
  color: var(--side-ink);
  border-right: 1px solid var(--side-line);
  display: flex; flex-direction: column;
  padding: 18px 12px 14px;
  gap: 22px;
}
.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 4px 8px; color: inherit; text-decoration: none;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: #12203f; border: 1px solid #24386a; color: var(--side-accent);
}
.brand-mark .ico { width: 19px; height: 19px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-name { font: 600 15px/1.25 var(--font-display); letter-spacing: -.01em; }
.brand-sub { font-size: 11.5px; color: var(--side-muted); letter-spacing: .02em; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--side-muted); padding: 0 10px 8px;
}
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  min-height: 40px; padding: 0 10px; border-radius: var(--r-sm);
  color: var(--side-muted); text-decoration: none;
  font-size: 13.5px; font-weight: 500;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.nav-item:hover { background: var(--side-hover); color: var(--side-ink); }
.nav-item.active { background: var(--side-active); color: #fff; }
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--side-accent);
}
.nav-item.active .ico { color: var(--side-accent); }

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.side-status {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 10px; border-radius: var(--r-sm);
  border: 1px solid var(--side-line);
  font-size: 12px; line-height: 1.45; color: var(--side-muted);
}
.side-status b { color: var(--side-ink); font-weight: 600; }
.side-status .dot {
  flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; margin-top: 5px;
  background: #45d4c2; box-shadow: 0 0 0 3px rgba(69, 212, 194, .16);
}
.user { display: flex; align-items: center; gap: 10px; padding: 0 6px; min-width: 0; }
.user-avatar {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: #17233f; border: 1px solid #2a3c66; color: #fff;
  font-size: 13px; font-weight: 600; text-transform: uppercase;
}
/* Role marks.
   Two of the three actors are teams rather than individuals, so the chip
   carries a monogram in the role's own colour instead of a portrait. A face
   would assert that a particular person exists, which is the one thing this
   system is careful never to do elsewhere — and an org chart would use a
   monogram for a team anyway.
   These are fixed values, like the rest of the sidebar: that panel is dark in
   both themes, so there is nothing for a theme to redefine. */
.user-avatar.role-head_of_it { background: #16305c; border-color: #2f5fa8; color: #cfe0ff; }
.user-avatar.role-it_team    { background: #0e3b38; border-color: #1d6b63; color: #9fe3d8; }
.user-avatar.role-governance { background: #3c2d0c; border-color: #7a5c18; color: #f0cf8a; }
.user-avatar.role-risk_owner { background: #3a1b2c; border-color: #74365a; color: #f2bcd8; }
/* Three letters do not fit at the single-initial size. */
.user-avatar.mark-3 { font-size: 9.5px; letter-spacing: -.2px; }
.user-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.user-name {
  font-size: 13px; font-weight: 600; color: var(--side-ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-role { font-size: 11.5px; color: var(--side-muted); text-transform: capitalize; }
.side-actions { display: flex; gap: 6px; }
.side-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 36px; padding: 0 10px; border-radius: var(--r-sm);
  background: transparent; border: 1px solid var(--side-line);
  color: var(--side-muted); font: 500 12.5px var(--font); cursor: pointer;
  transition: background .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease);
}
.side-btn:hover { background: var(--side-hover); color: var(--side-ink); border-color: #2a3c66; }
.side-btn.grow { flex: 1; }
.side-btn .ico { width: 16px; height: 16px; }
.ico-sun { display: var(--show-sun); }
.ico-moon { display: var(--show-moon); }

.stage { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }

.demo-banner {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 7px 20px; font-size: 12px; letter-spacing: .01em;
  color: var(--warn-ink); background: var(--warn-bg);
  border-bottom: 1px solid var(--warn-line); text-align: center;
}
.demo-banner b { font-weight: 600; }

/* ------------------------------------------------------- buttons, inputs */
button { font: inherit; }
.btn, .stage button:not(.send):not(.chip) {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 36px; padding: 0 14px; border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong);
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: background .16s var(--ease), border-color .16s var(--ease),
              transform .08s var(--ease), box-shadow .16s var(--ease);
}
.btn:hover, .stage button:not(.send):not(.chip):hover { border-color: var(--accent); background: var(--raised); }
.btn:active, .stage button:not(.send):not(.chip):active { transform: translateY(1px); }
.btn.primary, .stage button.primary:not(.send) {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
  box-shadow: var(--shadow-sm);
}
.btn.primary:hover, .stage button.primary:not(.send):hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.stage button.danger { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad-ink); }
.stage button.danger:hover { background: var(--bad-bg); border-color: var(--bad-ink); }
button:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin: 12px 0 6px; }
input[type=text], input[type=password], input[type=date], select, .field, .card textarea {
  width: 100%; font: inherit; font-size: 13.5px; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line-strong);
  border-radius: var(--r-sm); padding: 9px 11px;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
input[type=text]:focus, input[type=password]:focus, input[type=date]:focus, select:focus, .card textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.card textarea { resize: vertical; }
input[type=file] { width: 100%; font-size: 12.5px; color: var(--muted); }
input[type=file]::file-selector-button {
  font: inherit; font-weight: 600; margin-right: 10px; padding: 7px 12px;
  border-radius: var(--r-sm); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); cursor: pointer;
}

/* -------------------------------------------------------------- composer */
.composer {
  display: flex; align-items: flex-end; gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  padding: 10px 10px 10px 18px;
  box-shadow: var(--shadow-md);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.composer:focus-within { border-color: var(--accent); box-shadow: var(--shadow-md), 0 0 0 4px var(--accent-soft); }
.composer textarea {
  flex: 1; min-width: 0; resize: none; border: 0; outline: 0; background: transparent;
  color: var(--ink); font: inherit; line-height: 1.5;
  padding: 7px 0; max-height: 160px;
}
.composer textarea { scrollbar-width: thin; }
/* One line, ellipsised: a wrapped placeholder would be clipped by the
   single-row field on a phone. */
.composer textarea::placeholder {
  color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.send {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 12px; border: 0;
  display: grid; place-items: center; cursor: pointer;
  background: var(--accent); color: var(--accent-ink);
  transition: background .16s var(--ease), transform .12s var(--ease);
}
.send:hover { background: var(--accent-hover); transform: translateY(-1px); }
.send:active { transform: translateY(0); }
.hint { font-size: 11.5px; color: var(--muted); text-align: center; margin: 10px auto 0; max-width: 640px; }

/* ------------------------------------------------- knowledge assistant */
#main { flex: 1; min-height: 0; overflow-y: auto; padding: 28px 24px 8px; scroll-behavior: smooth; }
.wrap { max-width: 780px; margin: 0 auto; }
.dock { flex: 0 0 auto; padding: 12px 24px 18px; }
.dock > * { max-width: 780px; margin-left: auto; margin-right: auto; }

.stage.landing { overflow-y: auto; }
.stage.landing::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 460px; pointer-events: none;
  background: radial-gradient(60% 100% at 50% 0%, var(--glow), transparent 70%);
}
.stage.landing #main { flex: 0 0 auto; overflow: visible; margin-top: auto; padding-top: 40px; padding-bottom: 0; position: relative; }
.stage.landing .dock { margin-bottom: auto; padding-bottom: 40px; position: relative; }
.stage:not(.landing) .hero,
.stage:not(.landing) .chips,
.stage:not(.landing) .scope { display: none; }

.hero { text-align: center; padding: 0 0 26px; animation: rise .5s var(--ease) both; }
.hero .avatar {
  width: 60px; height: 60px; border-radius: 50%; margin: 0 auto 20px; overflow: hidden;
  border: 1px solid var(--line-strong); background: var(--raised);
  box-shadow: 0 0 0 5px var(--surface), 0 0 0 6px var(--line), var(--shadow-md);
}
.hero .avatar img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; display: block; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 14px;
}
.eyebrow::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--teal); }
.hero h1 {
  margin: 0; font: 600 38px/1.15 var(--font-display); letter-spacing: -.025em; color: var(--ink);
}
.hero h1 .name { color: var(--accent); }
.hero .lede { margin: 12px auto 0; max-width: 520px; font-size: 16px; color: var(--muted); }

.chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.chip {
  position: relative; text-align: left; cursor: pointer;
  background: var(--surface); color: var(--ink-2);
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 13px 40px 13px 15px; font-size: 13.5px; line-height: 1.45;
  box-shadow: var(--shadow-sm);
  transition: border-color .18s var(--ease), transform .18s var(--ease), box-shadow .18s var(--ease), color .18s var(--ease);
}
.chip::after {
  content: ""; position: absolute; right: 16px; top: 50%; width: 7px; height: 7px;
  border-top: 1.75px solid var(--muted); border-right: 1.75px solid var(--muted);
  transform: translateY(-50%) rotate(45deg); transition: border-color .18s var(--ease), right .18s var(--ease);
}
.chip:hover { border-color: var(--accent-line); color: var(--ink); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.chip:hover::after { border-color: var(--accent); right: 13px; }
.scope {
  margin-top: 22px; font-size: 12.5px; line-height: 1.6; color: var(--muted); text-align: center;
  max-width: 660px;
}
.scope b { color: var(--ink-2); font-weight: 600; }

/* -------------------------------------------------------------- messages */
.msg { display: flex; flex-direction: column; gap: 6px; max-width: 780px; margin: 0 auto 26px; animation: rise .32s var(--ease) both; }
.msg .who {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.msg.bot .who::before {
  content: ""; width: 18px; height: 18px; border-radius: 6px;
  background: var(--accent-soft); border: 1px solid var(--accent-line);
  box-shadow: inset 0 0 0 4px var(--accent-soft), inset 0 0 0 9px var(--accent);
}
.msg .body { min-width: 0; color: var(--ink); overflow-wrap: anywhere; }
.msg .body.pre { white-space: pre-wrap; }
.msg .body p { margin: 0 0 12px; }
.msg .body p:last-child { margin-bottom: 0; }
.msg .body ul { margin: 0 0 12px; padding-inline-start: 22px; }
.msg .body li { margin: 4px 0; }
.msg .body li::marker { color: var(--accent); }
.msg .body strong { font-weight: 650; }
.msg.user { align-items: flex-end; }
.msg.user .who { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.msg.user .body {
  max-width: 86%;
  background: var(--accent-soft); border: 1px solid var(--accent-line);
  border-radius: 16px 16px 5px 16px; padding: 10px 15px;
}
.flag {
  margin-top: 12px; padding: 9px 12px; border-radius: var(--r-sm);
  background: var(--raised); border: 1px solid var(--line);
  font-size: 12px; line-height: 1.55; color: var(--muted);
}

/* Waiting: three dots while empty, a caret while text is streaming in. */
.cursor:empty { min-height: 24px; display: flex; align-items: center; }
.cursor:empty::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; margin-left: 2px;
  color: var(--accent); background: currentColor;
  box-shadow: 11px 0 0 currentColor, 22px 0 0 currentColor;
  animation: dots 1.1s infinite linear;
}
.cursor:not(:empty)::after {
  content: ""; display: inline-block; width: 2px; height: 1.05em; margin-left: 3px;
  vertical-align: text-bottom; background: var(--accent); animation: blink 1s steps(2, start) infinite;
}
@keyframes blink { to { visibility: hidden; } }
@keyframes dots {
  0%   { background: var(--accent); box-shadow: 11px 0 0 var(--accent-line), 22px 0 0 var(--accent-line); }
  33%  { background: var(--accent-line); box-shadow: 11px 0 0 var(--accent), 22px 0 0 var(--accent-line); }
  66%  { background: var(--accent-line); box-shadow: 11px 0 0 var(--accent-line), 22px 0 0 var(--accent); }
  100% { background: var(--accent); box-shadow: 11px 0 0 var(--accent-line), 22px 0 0 var(--accent-line); }
}
/* Movement only, never opacity: if a browser pauses animations (a background
   tab, a throttled preview) the content must still be fully readable. */
@keyframes rise { from { transform: translateY(8px); } to { transform: none; } }
[dir="rtl"] { text-align: right; }

/* ---------------------------------------------------- cards, tables, etc */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 18px; box-shadow: var(--shadow-sm);
}
.card h2 {
  margin: 0 0 12px; font-size: 11.5px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.card h3, .approval h3 { margin: 0 0 4px; font: 600 15px/1.35 var(--font-display); letter-spacing: -.005em; }
.msg .card { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; padding: 8px 10px; white-space: nowrap;
  font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); border-bottom: 1px solid var(--line-strong);
}
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
td strong { white-space: nowrap; }
/* The target-date column of the risk table only; not the approval diff. */
.msg .card td:last-child { white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .14s var(--ease); }
tbody tr:hover { background: var(--raised); }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.open { background: var(--warn-bg); color: var(--warn-ink); border: 1px solid var(--warn-line); }
.pill.closed { background: var(--good-bg); color: var(--good-ink); border: 1px solid var(--good-line); }
.badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600; padding: 4px 11px; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--accent-line); background: var(--accent-soft); color: var(--accent);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.note {
  font-size: 13px; line-height: 1.55; padding: 10px 13px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--raised);
}
.note.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.note.bad { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad-ink); }
.note.good { background: var(--good-bg); border-color: var(--good-line); color: var(--good-ink); }
.muted { color: var(--muted); font-size: 12.5px; }
.approval {
  margin-top: 12px; padding: 20px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow-md);
}
/* Evidence references and file paths are long unbroken strings. They wrap
   inside the card rather than pushing it into a horizontal scroll. */
.approval .diff { table-layout: fixed; }
.approval .diff th:first-child { width: 26%; }
.approval td, .approval .note { overflow-wrap: anywhere; }
.approval td strong { white-space: normal; }
.approval .diff td.from { color: var(--muted); text-decoration: line-through; }
.approval .diff td.to { font-weight: 650; color: var(--accent); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mt0 { margin-top: 0; } .mt6 { margin-top: 6px; } .mt8 { margin-top: 8px; }
.mt10 { margin-top: 10px; } .mb10 { margin-bottom: 10px; } .my8 { margin: 8px 0; }

/* ----------------------------------------------------- risk closure page */
.topbar {
  flex: 0 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
  padding: 16px 28px; border-bottom: 1px solid var(--line); background: var(--surface);
}
.topbar h1 { margin: 0; font: 600 19px/1.25 var(--font-display); letter-spacing: -.015em; }
.topbar .sub { font-size: 12.5px; color: var(--muted); }
.topbar .spacer { flex: 1; }
#layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 408px; }
#chatcol { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
#thread.scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 28px 24px 8px; }
#side {
  overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px;
  border-left: 1px solid var(--line); background: var(--bg);
}
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tile { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; background: var(--bg); }
.tile .n { font: 600 24px/1.1 var(--font-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile .l { font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin-top: 3px; }
.tile.open .n { color: var(--warn-ink); }
.tile.closed .n { color: var(--good-ink); }
#registerlist { max-height: 300px; overflow-y: auto; margin-inline: -6px; }

/* ------------------------------------------------- executive summary */
.summary { flex: 1; min-height: 0; overflow-y: auto; padding: 28px; }
.summary-inner { max-width: 1240px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }
.posture { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat { padding: 20px 22px; transition: border-color .18s var(--ease), transform .18s var(--ease), box-shadow .18s var(--ease); }
.stat:hover { border-color: var(--line-strong); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.stat .k { font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.stat .v { margin-top: 8px; font: 600 38px/1.1 var(--font-display); letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.stat .v.amber { color: var(--amber); }
.stat .v.blue { color: var(--accent); }
.stat .d { margin-top: 6px; font-size: 13px; color: var(--muted); }
.section { padding: 26px; }
.section-eyebrow { font-size: 11.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.section-eyebrow.bad { color: var(--coral); }
.section h2 {
  margin: 6px 0 4px; font: 600 26px/1.2 var(--font-display); letter-spacing: -.02em;
  text-transform: none; color: var(--ink);
}
.section .lede { margin: 0 0 20px; max-width: 700px; color: var(--muted); font-size: 14px; }
.pipe { overflow-x: auto; }
.pipe-grid { min-width: 1040px; display: flex; flex-direction: column; gap: 2px; }
.pipe-row {
  display: grid; grid-template-columns: minmax(270px, 1.7fr) repeat(6, minmax(0, 1fr));
  gap: 14px; padding: 13px 12px; border-radius: var(--r-sm); border: 1px solid transparent;
  align-items: start; transition: background .14s var(--ease);
}
.pipe-row:not(.pipe-head):hover { background: var(--raised); }
.pipe-row.focus { background: var(--accent-soft); border-color: var(--accent-line); }
.pipe-head { border-bottom: 1px solid var(--line-strong); border-radius: 0; padding-bottom: 12px; font-size: 12.5px; }
.pipe-risk-h { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.stage-name { font-weight: 600; }
.pipe-id { font-weight: 600; }
.lvl {
  margin-left: 8px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--line-strong); color: var(--muted);
}
.ctls { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 7px; }
.ctl-k { font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-right: 3px; }
.ctl {
  font: 600 11.5px var(--mono); padding: 1px 7px; border-radius: 6px;
  background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent);
}
.bar { height: 6px; border-radius: 3px; background: var(--line-strong); }
.bar.done { background: var(--accent); }
.bar.current { background: var(--amber); }
.bar.flagged { background: var(--coral); }
.bar-note { margin-top: 7px; font-size: 12px; line-height: 1.4; }
.bar-note.current { color: var(--warn-ink); }
.bar-note.flagged { color: var(--bad-ink); }
.bar-note.done { color: var(--accent); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 18px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend .bar { display: inline-block; width: 20px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.closure { padding-top: 18px; margin-top: 18px; border-top: 1px solid var(--line); }
.closure:first-child { padding-top: 0; margin-top: 0; border-top: 0; }
.closure-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.tl { display: flex; gap: 14px; }
.tl-rail { display: flex; flex-direction: column; align-items: center; }
.tl-dot { flex: 0 0 auto; width: 11px; height: 11px; border-radius: 50%; margin-top: 6px; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tl-line { flex: 1; width: 2px; margin-top: 3px; background: var(--line-strong); }
.tl-body { padding-bottom: 14px; min-width: 0; overflow-wrap: anywhere; }
.tl-what { font-weight: 600; }
.guard-row { display: flex; gap: 16px; align-items: flex-start; padding: 13px 0; border-top: 1px solid var(--line); }
.guard-row:first-child { border-top: 0; padding-top: 0; }
.guard-n { flex: 0 0 44px; font: 600 24px/1.2 var(--font-display); letter-spacing: -.02em; color: var(--coral); font-variant-numeric: tabular-nums; }

/* Severity ramp. Each band differs in lightness as well as hue, so the order
   survives for a reader who cannot tell the colours apart. */
.sev-crit { --sev: var(--sev-crit); }
.sev-high { --sev: var(--sev-high); }
.sev-med { --sev: var(--sev-med); }
.sev-low { --sev: var(--sev-low); }
.sev-none { --sev: var(--muted); }
.two-col.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sevbar { display: flex; flex-wrap: wrap; gap: 4px; min-height: 64px; }
.seg {
  flex: 1 1 0; min-width: 76px; padding: 10px 12px; border-radius: var(--r-sm);
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 1px;
  background: var(--sev); color: #fff; border: 2px solid transparent; cursor: pointer; text-align: left;
  transition: transform .16s var(--ease), box-shadow .16s var(--ease), opacity .16s var(--ease);
}
/* The doubled class outranks the general button rule for the content area. */
.stage .sevbar button.seg.seg {
  background: var(--sev); color: #fff; border: 2px solid transparent;
  min-height: 64px; align-items: flex-start; justify-content: center;
}
.stage .sevbar button.seg.seg:hover { background: var(--sev); border-color: transparent; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.stage .sevbar button.seg.seg.on { border-color: var(--ink); box-shadow: 0 0 0 3px var(--accent-soft); }
.sevbar:has(.seg.on) .seg:not(.on) { opacity: .45; }
.seg-n { font: 600 24px/1.1 var(--font-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.seg-l { font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.sevgrid { margin-top: 10px; min-width: 460px; }
.sevgrid th.num, .sevgrid td.num { text-align: center; }
.sevgrid th { white-space: normal; line-height: 1.35; vertical-align: bottom; }
.sevgrid td { vertical-align: middle; font-weight: 600; white-space: nowrap; }
.sevkey { margin: 12px 0 0; font-size: 12px; line-height: 1.6; color: var(--muted); }
.headline { margin: 10px 0 20px; font-size: 16px; line-height: 1.5; color: var(--ink); max-width: 640px; }
.subhead { margin: 22px 0 0; font: 600 13.5px/1.4 var(--font); color: var(--ink-2); }
.sevgrid th { text-transform: none; letter-spacing: 0; font-size: 12.5px; }
.sevgrid th .wl { display: block; color: var(--ink); font-weight: 600; }
.sevgrid th .wo { display: block; margin-top: 2px; font-size: 11.5px; font-weight: 500; color: var(--muted); }
.sevgrid td.zero { color: var(--muted); font-weight: 400; }
.sev-dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 9px; background: var(--sev); }
.cell {
  display: inline-grid; place-items: center; min-width: 30px; height: 26px; padding: 0 8px;
  border-radius: 7px; background: var(--sev); color: #fff; font-variant-numeric: tabular-nums;
}
.lvl.sev-crit, .lvl.sev-high, .lvl.sev-med, .lvl.sev-low { border-color: var(--sev); background: var(--sev); color: #fff; }
.res-row { padding: 13px 0; border-top: 1px solid var(--line); }
.res-row:first-child { border-top: 0; padding-top: 0; }
.res-id { font-weight: 600; margin-bottom: 8px; }
.res-line { display: flex; align-items: center; gap: 12px; margin-top: 5px; font-size: 12.5px; }
.res-k { flex: 0 0 62px; color: var(--muted); }
.res-track { flex: 1; height: 8px; border-radius: 4px; background: var(--raised); overflow: hidden; }
.res-fill { display: block; height: 100%; width: 0; border-radius: 4px; background: var(--sev); transition: width .5s var(--ease); }
.res-fill.res { background: var(--accent); }
.res-v { flex: 0 0 38px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ sign-in */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-brand {
  position: relative; overflow: hidden;
  background: #0b1324; color: #dde4f1;
  padding: 44px 52px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
}
.auth-brand::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(70% 55% at 20% 0%, rgba(106, 166, 255, .16), transparent 70%);
}
.auth-brand > * { position: relative; }
.auth-brand h2 { margin: 0 0 16px; max-width: 460px; font: 600 40px/1.12 var(--font-display); letter-spacing: -.028em; color: #fff; }
.auth-brand h2 em { font-style: normal; color: #6aa6ff; }
.auth-brand p { margin: 0; max-width: 430px; font-size: 15.5px; color: #8d9bb5; }
.facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; max-width: 440px; }
.facts li { display: flex; gap: 12px; align-items: flex-start; font-size: 13.5px; color: #b9c4d8; line-height: 1.5; }
.facts .ico { color: #6aa6ff; margin-top: 2px; }
.auth-form { display: grid; place-items: center; padding: 32px 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 380px; animation: rise .5s var(--ease) both; }
.auth-card h1 { margin: 0 0 6px; font: 600 26px/1.2 var(--font-display); letter-spacing: -.02em; }
.auth-card .sub { color: var(--muted); margin-bottom: 26px; }
.auth-card input { padding: 11px 13px; font-size: 14.5px; background: var(--surface); }
.auth-card .btn { width: 100%; min-height: 44px; margin-top: 22px; font-size: 14.5px; }
.error {
  display: none; margin-bottom: 4px; padding: 10px 13px; border-radius: var(--r-sm); font-size: 13px;
  background: var(--bad-bg); border: 1px solid var(--bad-line); color: var(--bad-ink);
}
.error.show { display: block; }
.auth-card .banner {
  margin-top: 26px; padding: 10px 13px; border-radius: var(--r-sm); font-size: 12px; font-weight: 600; text-align: center;
  background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-ink);
}
.auth-card .fineprint { margin-top: 12px; font-size: 12px; color: var(--muted); text-align: center; }
.auth-brand .brand { padding: 0; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1120px) {
  .posture { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col, .two-col.even { grid-template-columns: minmax(0, 1fr); }
  #layout { grid-template-columns: 1fr; overflow-y: auto; }
  #chatcol { min-height: 70vh; }
  #side { border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
}
@media (max-width: 880px) {
  .app { flex-direction: column; }
  .sidebar {
    flex: 0 0 auto; flex-direction: row; align-items: center; gap: 10px;
    padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--side-line);
  }
  .brand { padding: 0; }
  .brand-sub, .nav-label, .side-status, .user-meta, .nav-item span, .side-btn span { display: none; }
  .nav { flex-direction: row; margin-left: auto; }
  .nav-item { width: 40px; justify-content: center; padding: 0; }
  .nav-item.active::before { left: 10px; right: 10px; top: auto; bottom: -9px; width: auto; height: 3px; border-radius: 3px 3px 0 0; }
  .side-foot { margin: 0; flex-direction: row; align-items: center; gap: 8px; }
  .user { padding: 0; }
  .side-btn.grow { flex: 0 0 auto; }
  .hero h1 { font-size: 29px; }
  .hero .lede { font-size: 15px; }
  .chips { grid-template-columns: 1fr; }
  #main, #thread.scroll { padding-left: 16px; padding-right: 16px; }
  .dock { padding-left: 16px; padding-right: 16px; }
  .topbar { padding: 12px 16px; }
  .summary { padding: 16px; }
  .section { padding: 18px; }
  .auth { grid-template-columns: 1fr; }
  .auth-brand { padding: 28px 24px; gap: 24px; }
  .auth-brand h2 { font-size: 28px; }
  .facts { display: none; }
}
@media (max-width: 480px) {
  .posture { grid-template-columns: 1fr; }
  .brand-text, .user { display: none; }
  .msg.user .body { max-width: 94%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ===========================================================================
   Command centre — the assistant surface only
   ===========================================================================
   Scoped under .cmd so the executive summary and the closure console keep the
   sober instrument styling. The reasoning is the same one that kept motion out
   of the console: an audit record that glows is less believable to an auditor,
   while the surface where the agent actually lives should feel like an
   intelligence. One product, two registers.

   Everything here sits on the existing tokens, so both themes work. The dark
   theme is the showcase; the light theme stays legible rather than being an
   afterthought.
   ========================================================================= */
.cmd { --core-cyan: #38e8ff; --core-blue: #4da3ff; --core-violet: #8b5cf6; }

.cmd .core-stage {
  position: relative; width: 100%; display: flex; flex-direction: column;
  align-items: center; padding: 8px 0 18px; isolation: isolate;
}

/* The glow behind the core. Sized in ems of the host so it tracks the orb. */
.cmd .core-host {
  position: relative; width: min(340px, 62vw); aspect-ratio: 1; margin: 0 auto;
  display: grid; place-items: center;
}
.cmd .core-host::after {
  content: ""; position: absolute; inset: -18%; border-radius: 50%; z-index: -1;
  background:
    radial-gradient(circle at 50% 50%,
      color-mix(in srgb, var(--core-cyan) 26%, transparent) 0%,
      color-mix(in srgb, var(--core-violet) 16%, transparent) 42%,
      transparent 68%);
  filter: blur(14px); opacity: .85;
  transition: background .6s var(--ease), opacity .6s var(--ease);
}
.cmd .core-host[data-state="approval"]::after {
  background: radial-gradient(circle at 50% 50%,
    color-mix(in srgb, #ffb020 30%, transparent) 0%,
    color-mix(in srgb, #ff7a3d 16%, transparent) 44%, transparent 70%);
}
.cmd .core-host[data-state="error"]::after {
  background: radial-gradient(circle at 50% 50%,
    color-mix(in srgb, #ff5c7a 28%, transparent) 0%, transparent 66%);
}
.cmd .core-host[data-state="complete"]::after {
  background: radial-gradient(circle at 50% 50%,
    color-mix(in srgb, #2ee6a8 26%, transparent) 0%,
    color-mix(in srgb, var(--core-cyan) 14%, transparent) 46%, transparent 70%);
}

.cmd .core-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

/* Shown only when WebGL is unavailable or the context is lost. */
.cmd .core-fallback { display: none; width: 58%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 36% 32%,
    color-mix(in srgb, var(--core-cyan) 85%, transparent),
    color-mix(in srgb, var(--core-violet) 70%, transparent) 62%, transparent 72%);
  box-shadow: 0 0 60px color-mix(in srgb, var(--core-cyan) 35%, transparent);
  animation: corebreathe 5.5s var(--ease) infinite;
}
.cmd .core-host.core-css .core-fallback { display: block; }
/* !important because Three.js writes display:block inline on its own
   canvas, and an inline declaration beats any class rule. */
.cmd .core-host.core-css .core-canvas { display: none !important; }
@keyframes corebreathe {
  0%, 100% { transform: scale(1); opacity: .88; }
  50%      { transform: scale(1.055); opacity: 1; }
}

/* The state caption under the core. Never says more than the page knows. */
.cmd .core-state {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 2px;
  font: 600 11px/1 var(--font); letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted);
}
.cmd .core-state .led {
  width: 7px; height: 7px; border-radius: 50%; background: var(--core-blue);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--core-blue) 20%, transparent);
  transition: background .4s var(--ease), box-shadow .4s var(--ease);
}
.cmd .core-host[data-state="thinking"]  ~ .core-state .led,
.cmd .core-host[data-state="executing"] ~ .core-state .led { background: var(--core-cyan);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--core-cyan) 22%, transparent); }
.cmd .core-host[data-state="approval"]  ~ .core-state .led { background: #ffb020;
  box-shadow: 0 0 0 3px color-mix(in srgb, #ffb020 22%, transparent); }
.cmd .core-host[data-state="complete"]  ~ .core-state .led { background: #2ee6a8;
  box-shadow: 0 0 0 3px color-mix(in srgb, #2ee6a8 22%, transparent); }
.cmd .core-host[data-state="error"]     ~ .core-state .led { background: #ff5c7a;
  box-shadow: 0 0 0 3px color-mix(in srgb, #ff5c7a 22%, transparent); }

/* ---- The pipeline: what the agent is actually doing, step by step -------- */
.cmd .pipeline {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
  gap: 6px; margin: 14px auto 0; padding: 8px 12px; width: fit-content;
  max-width: 100%;
  border: 1px solid var(--line); border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
}
.cmd .pipeline[hidden] { display: none; }
.cmd .step {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px;
  border-radius: 999px; font: 500 11.5px/1 var(--font); color: var(--muted);
  white-space: nowrap; transition: color .3s var(--ease), background .3s var(--ease);
}
.cmd .step .pip {
  width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong);
  transition: background .3s var(--ease), box-shadow .3s var(--ease);
}
.cmd .step.on { color: var(--ink); background: var(--accent-soft); }
.cmd .step.on .pip { background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.cmd .step.done { color: var(--ink-2); }
.cmd .step.done .pip { background: #2ee6a8; }
.cmd .step.fail { color: var(--bad-ink); }
.cmd .step.fail .pip { background: #ff5c7a; }
.cmd .step .arrow { color: var(--line-strong); }

/* ---- Glass composer ----------------------------------------------------- */
.cmd .composer {
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.cmd .chip {
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}

@media (max-width: 720px) {
  .cmd .core-host { width: min(240px, 58vw); }
  .cmd .pipeline { gap: 2px; padding: 6px 8px; }
  .cmd .step { padding: 4px 7px; font-size: 11px; }
}

/* The core must not disappear the moment a conversation starts — it is the
   assistant, not a splash graphic. In conversation it docks: the greeting and
   prompts go, the core shrinks and sticks to the top of the thread, and it
   keeps reporting state while answers stream beneath it. One canvas, one
   WebGL context, two sizes. */
.cmd.stage:not(.landing) .hero { display: block; padding: 0; animation: none; }
.cmd.stage:not(.landing) .hero > .eyebrow,
.cmd.stage:not(.landing) .hero > h1,
.cmd.stage:not(.landing) .hero > .lede { display: none; }
.cmd.stage:not(.landing) .core-stage {
  position: sticky; top: 0; z-index: 3;
  flex-direction: row; align-items: center; justify-content: flex-start;
  gap: 12px; padding: 6px 0 12px;
  background: linear-gradient(to bottom, var(--bg) 62%,
              color-mix(in srgb, var(--bg) 0%, transparent));
}
.cmd.stage:not(.landing) .core-host { width: 72px; }
.cmd.stage:not(.landing) .core-host::after { inset: -8%; filter: blur(9px); }
.cmd.stage:not(.landing) .core-state { margin-top: 0; }

/* Floating data panels around the core.
   The reference art has decorative rectangles; these carry the real register
   numbers, fetched from the same endpoint the console uses. If the signed-in
   role cannot read the register the fetch fails and they simply never appear,
   which is why nothing here has placeholder text. */
.cmd .core-cards { position: absolute; inset: 0; pointer-events: none; }
.cmd .core-card {
  position: absolute; min-width: 124px; padding: 10px 13px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: color-mix(in srgb, var(--surface) 62%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-md);
  opacity: 0; transform: translateY(6px);
  animation: cardin .7s var(--ease) forwards;
}
.cmd .core-card:nth-child(2) { animation-delay: .10s; }
.cmd .core-card:nth-child(3) { animation-delay: .20s; }
@keyframes cardin { to { opacity: 1; transform: translateY(0); } }
.cmd .core-card .k {
  display: block; font: 600 9.5px/1 var(--font); letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 5px;
}
.cmd .core-card .v {
  display: block; font: 600 21px/1 var(--font); color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.cmd .core-card .s { display: block; font-size: 10.5px; color: var(--muted); margin-top: 3px; }
.cmd .core-card.high .v { color: var(--sev-high); }
/* Inside the content column, not outside it: negative offsets pushed these
   under the sidebar and gave the page a horizontal scrollbar. */
.cmd .core-card.c1 { left: 0; top: 6%; }
.cmd .core-card.c2 { right: 0; top: 32%; }
.cmd .core-card.c3 { left: 5%; bottom: 14%; }

/* They need room either side of the core; below that width the composition
   has none, so they are not shown rather than being stacked awkwardly. */
@media (max-width: 1100px) { .cmd .core-cards { display: none; } }
/* Only on the landing composition: once a conversation starts the core docks
   to 72px and there is nothing to float around. */
.cmd.stage:not(.landing) .core-cards { display: none; }

/* ===========================================================================
   Agent orchestration graph — closure console
   ===========================================================================
   Five actors and the hand-offs between them, lit from the risk's real
   workflow_status. Nothing here animates on a timer: an edge is only live
   because that hand-off has actually happened, and the amber authorisation
   pulse only runs while a single-use key is genuinely outstanding.
   ========================================================================= */
.flowcard { margin-bottom: 14px; }
.flowhead { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.flowhead h2 { margin: 0; flex: 1; min-width: 0; }
.flowhead select { max-width: 320px; }

.flow { display: block; width: 100%; height: auto; margin: 6px 0 2px; overflow: visible; }

.flow .fedge {
  fill: none; stroke: var(--line-strong); stroke-width: 2;
  stroke-dasharray: 5 6; opacity: .55;
  transition: stroke .35s var(--ease), opacity .35s var(--ease);
}
.flow .fedge.is-done { stroke: var(--teal); stroke-dasharray: none; opacity: .9; }
.flow .fedge.is-active { stroke: var(--accent); stroke-dasharray: none; opacity: 1; }
.flow .fedge.is-amber { stroke: var(--amber); stroke-dasharray: none; opacity: 1; }
.flow .fedge.is-alert { stroke: var(--coral); stroke-dasharray: none; opacity: 1; }
.flow .fedge.feedback { opacity: 0; }
.flow .fedge.feedback.is-alert { opacity: 1; }

.flow .fnode circle {
  fill: var(--raised); stroke: var(--line-strong); stroke-width: 2;
  transition: fill .35s var(--ease), stroke .35s var(--ease);
}
.flow .fnode text {
  text-anchor: middle; font: 600 13px var(--font); fill: var(--muted);
  transition: fill .35s var(--ease);
}
.flow .fnode .sub { font: 500 11px var(--font); fill: var(--line-strong); }
.flow .fnode.is-done circle { fill: var(--good-bg); stroke: var(--teal); }
.flow .fnode.is-done text { fill: var(--ink-2); }
.flow .fnode.is-active circle { fill: var(--accent-soft); stroke: var(--accent); }
.flow .fnode.is-active text { fill: var(--ink); }
.flow .fnode.is-alert circle { fill: var(--bad-bg); stroke: var(--coral); }
.flow .fnode.is-alert text { fill: var(--bad-ink); }
.flow .fnode.is-amber circle { fill: var(--warn-bg); stroke: var(--amber); }
.flow .fnode.is-amber text { fill: var(--warn-ink); }

/* The only thing on this page that moves, and only while an authorisation is
   genuinely outstanding. */
.flow .fnode.is-amber circle { animation: flowpulse 1.9s var(--ease) infinite; }
@keyframes flowpulse {
  0%, 100% { stroke-width: 2; }
  50%      { stroke-width: 5; }
}
@media (prefers-reduced-motion: reduce) {
  .flow .fnode.is-amber circle { animation: none; stroke-width: 4; }
}

.flowstate { margin-top: 4px; font-size: 12.5px; }
.flowstate b { color: var(--ink); }

/* The mark inside each node. Colour alone cannot carry the state — that fails
   WCAG 1.4.1, and a printed screenshot or a colour-blind reader loses the
   graph entirely. The mark, the hover title and the solid-versus-dashed edge
   all say the same thing without it. */
.flow .fnode .gly {
  text-anchor: middle; font: 700 15px var(--font); fill: var(--line-strong);
  pointer-events: none; transition: fill .35s var(--ease);
}
.flow .fnode.is-done .gly  { fill: var(--teal); }
.flow .fnode.is-active .gly { fill: var(--accent); }
.flow .fnode.is-amber .gly { fill: var(--amber); }
.flow .fnode.is-alert .gly { fill: var(--coral); }

.flowkey {
  display: flex; flex-wrap: wrap; gap: 6px 18px;
  margin: 2px 0 6px; padding: 0; list-style: none;
  font-size: 11.5px; color: var(--muted);
}
.flowkey li { display: inline-flex; align-items: center; gap: 6px; }
.flowkey .kk {
  display: inline-grid; place-items: center; width: 17px; height: 17px;
  border-radius: 50%; border: 1.5px solid var(--line-strong);
  font: 700 10px var(--font); color: var(--muted);
}
.flowkey .kk.done   { border-color: var(--teal);   color: var(--teal);   background: var(--good-bg); }
.flowkey .kk.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.flowkey .kk.amber  { border-color: var(--amber);  color: var(--warn-ink); background: var(--warn-bg); }
.flowkey .kk.alert  { border-color: var(--coral);  color: var(--bad-ink);  background: var(--bad-bg); }
.flowkey .kkline { width: 22px; height: 0; border-top: 2px solid var(--teal); }
.flowkey .kkline.dash { border-top-style: dashed; border-top-color: var(--line-strong); }

/* --------------------------------------------------------------------------
   Closure readiness. Every row carries a mark and a sentence; the colour is
   a third signal, never the only one. Read before a review is opened, so it
   sits with the orchestration graph rather than in a role pane.
   -------------------------------------------------------------------------- */
.readiness { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.rdy-head { font-weight: 600; margin-bottom: 6px; }
ul.rdy { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
ul.rdy li {
  font-size: 13px; line-height: 1.45; color: var(--ink-soft);
  padding-left: 22px; text-indent: -22px;
}
ul.rdy b { color: var(--ink); font-weight: 600; }
.rdy-mark {
  display: inline-block; width: 16px; text-indent: 0; margin-right: 6px;
  text-align: center; font-weight: 700;
}
.rdy-pass    .rdy-mark { color: var(--teal); }
.rdy-warn    .rdy-mark { color: var(--amber); }
.rdy-block   .rdy-mark { color: var(--coral); }
.rdy-unknown .rdy-mark { color: var(--ink-soft); }
.rdy-block b { color: var(--bad-ink); }
