/* Signal Radar operator console. Restrained dark navy with cyan accents.
   Every colour is a token in :root; status colour is always paired with words. */
:root {
  --bg: #0a1220;
  --surface: #0f1a2c;
  --surface-2: #142238;
  --surface-3: #1a2b45;
  --border: #253a5a;
  --border-strong: #55729c; /* >=3:1 against bg, surface and surface-2 (control boundaries) */
  --text: #e6edf7;
  --text-soft: #c4d0e1;
  --muted: #9aabc4;
  --accent: #22d3ee;
  --accent-strong: #67e8f9;
  --accent-ink: #032530;
  --accent-wash: rgba(34, 211, 238, 0.12);
  --ok: #4ade80;
  --ok-wash: rgba(74, 222, 128, 0.12);
  --warn: #fbbf24;
  --warn-wash: rgba(251, 191, 36, 0.12);
  --bad: #f87171;
  --bad-wash: rgba(248, 113, 113, 0.13);
  --info: #7dd3fc;
  --info-wash: rgba(125, 211, 252, 0.12);
  --focus: #67e8f9;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sidebar-w: 268px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  min-height: 100vh;
}
body.drawer-open { overflow: hidden; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0; font-weight: 650; }
h1 { font-size: 1.55rem; }
p { margin: 0.35rem 0; }
a { color: var(--accent-strong); text-underline-offset: 2px; }
a:hover { color: #a5f3fc; }
code, .mono { font-family: var(--mono); font-size: 0.86em; }
code { background: var(--surface-3); padding: 0.05rem 0.35rem; border-radius: 4px; overflow-wrap: anywhere; }
pre.code {
  background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0.75rem; overflow-x: auto; font: 0.82rem/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere;
}
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 0.75rem; top: -3rem; z-index: 100; background: var(--accent);
  color: var(--accent-ink); padding: 0.5rem 0.9rem; border-radius: var(--radius-sm); font-weight: 650;
}
.skip-link:focus { top: 0.75rem; }
.muted { color: var(--muted); }
/* The hidden attribute must win over component display rules (.field, .field-check, ...). */
[hidden] { display: none !important; }
.small { font-size: 0.85rem; }
.hint { color: var(--muted); font-size: 0.84rem; display: block; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.topbar { display: none; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 1.1rem 1rem 1.5rem; display: flex; flex-direction: column; gap: 0.6rem;
}
.main { padding: 1.25rem clamp(1rem, 2.6vw, 2.25rem) 3rem; min-width: 0; }
.main:focus { outline: none; }
.side-brand { display: flex; align-items: center; gap: 0.65rem; margin-bottom: 0.6rem; }
.logo-mark {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  border: 2px solid var(--accent); position: relative;
  background: radial-gradient(circle at 50% 50%, var(--accent) 0 3px, transparent 4px),
              radial-gradient(circle at 50% 50%, transparent 0 8px, rgba(34, 211, 238, 0.35) 9px 10px, transparent 11px);
}
.logo { font-weight: 700; font-size: 1.05rem; letter-spacing: 0.01em; }
.logo-sub { color: var(--muted); font-size: 0.78rem; }
.side-label {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted);
  font-weight: 650; margin-top: 0.4rem;
}
.sidebar select { width: 100%; }
.nav { list-style: none; margin: 0.4rem 0; padding: 0; display: grid; gap: 2px; }
.nav-link {
  display: block; padding: 0.5rem 0.7rem; border-radius: var(--radius-sm); color: var(--text-soft);
  text-decoration: none; font-weight: 550; border-left: 3px solid transparent;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link[aria-current="page"] { background: var(--accent-wash); color: var(--text); border-left-color: var(--accent); }
.side-status {
  margin-top: 0.4rem; padding: 0.75rem; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); display: grid; gap: 0.45rem;
}
.side-status .side-label { margin: 0 0 0.1rem; }
.status-line { display: grid; grid-template-columns: 10px minmax(0, 1fr); column-gap: 0.5rem; font-size: 0.85rem; align-items: start; }
.status-line .dot { margin-top: 0.42rem; }
.status-label { color: var(--muted); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.05em; }
.status-value { grid-column: 2; color: var(--text); }
.side-user { margin-top: auto; padding-top: 0.9rem; border-top: 1px solid var(--border); display: grid; gap: 0.25rem; }
.user-name { font-weight: 650; overflow-wrap: anywhere; }
.user-meta { color: var(--muted); font-size: 0.8rem; overflow-wrap: anywhere; }
.side-user .btn { justify-self: start; margin-top: 0.3rem; }
.nav-scrim { display: none; }

/* ---------- banners and page heads ---------- */
.boundary {
  border: 1px solid rgba(34, 211, 238, 0.45); background: var(--accent-wash); color: var(--text);
  padding: 0.6rem 0.9rem; border-radius: var(--radius); font-size: 0.9rem; margin-bottom: 1.1rem;
}
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.page-sub { color: var(--muted); margin-top: 0.2rem; }
.page-actions, .row-actions, .panel-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.row-actions { margin-top: 0.6rem; }
.view { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; min-width: 0; }
.view > * { min-width: 0; }
.view > .hint { margin-top: -0.5rem; }

/* ---------- panels and cards ---------- */
.panel, .card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem 1.1rem; min-width: 0;
}
.panel-head, .card-head { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.panel-title { font-size: 1.05rem; }
.card-title { font-size: 1rem; overflow-wrap: anywhere; }
.panel-intro { color: var(--muted); font-size: 0.88rem; margin: -0.15rem 0 0.7rem; }
.sub { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-soft); margin: 0.9rem 0 0.45rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.notice {
  border: 1px solid var(--border); border-left-width: 4px; border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem; font-size: 0.9rem; background: var(--surface-2);
}
.notice-info { border-left-color: var(--info); background: var(--info-wash); }
.notice-ok { border-left-color: var(--ok); background: var(--ok-wash); }
.notice-warn { border-left-color: var(--warn); background: var(--warn-wash); }
.notice-bad { border-left-color: var(--bad); background: var(--bad-wash); }
.notice details { margin-top: 0.4rem; }
.empty {
  border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 1rem 1.1rem;
  color: var(--text-soft); background: rgba(20, 34, 56, 0.5);
}
.empty-title { font-weight: 650; color: var(--text); }
.empty .row-actions { margin-top: 0.7rem; }
.error-box {
  border: 1px solid var(--bad); border-radius: var(--radius); padding: 1rem 1.1rem; background: var(--bad-wash);
}
.error-box .btn { margin-top: 0.5rem; }
.loading { color: var(--muted); padding: 1.2rem 0.2rem; }
.loading::before {
  content: ""; display: inline-block; width: 0.8rem; height: 0.8rem; margin-right: 0.55rem; vertical-align: -1px;
  border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- badges and chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.1rem 0.5rem; border-radius: 999px;
  font-size: 0.76rem; font-weight: 600; border: 1px solid var(--border-strong); background: var(--surface-3);
  color: var(--text-soft); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.badge-ok { color: var(--ok); border-color: rgba(74, 222, 128, 0.5); background: var(--ok-wash); }
.badge-warn { color: var(--warn); border-color: rgba(251, 191, 36, 0.5); background: var(--warn-wash); }
.badge-bad { color: var(--bad); border-color: rgba(248, 113, 113, 0.55); background: var(--bad-wash); }
.badge-info { color: var(--info); border-color: rgba(125, 211, 252, 0.45); background: var(--info-wash); }
.badge-muted { color: var(--muted); }
.chip {
  display: inline-block; padding: 0.1rem 0.55rem; border-radius: var(--radius-sm); background: var(--surface-3);
  border: 1px solid var(--border); font-size: 0.82rem; overflow-wrap: anywhere;
}
.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.3rem 0; align-items: center; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--muted); flex: none; }
.dot-ok { background: var(--ok); }
.dot-warn { background: var(--warn); }
.dot-bad { background: var(--bad); }
.dot-info { background: var(--info); }

/* ---------- metrics ---------- */
.metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0.75rem; }
.metric { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.8rem 0.9rem; }
.metric-label { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 650; }
.metric-value { font-size: 1.75rem; font-weight: 700; font-variant-numeric: tabular-nums; margin: 0.1rem 0; }
.metric-unknown .metric-value { color: var(--warn); font-size: 1.2rem; }
.metric-help { color: var(--muted); font-size: 0.8rem; margin: 0; }

/* ---------- bars and score ---------- */
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 38%) minmax(0, 1fr) 3rem; gap: 0.6rem; align-items: center; font-size: 0.86rem; }
.bar-label { color: var(--text-soft); overflow-wrap: anywhere; }
.bar-track { height: 9px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 999px; background: var(--info); min-width: 3px; }
.bar-ok { background: var(--ok); }
.bar-warn { background: var(--warn); }
.bar-bad { background: var(--bad); }
.bar-muted { background: var(--muted); }
.bar-count { text-align: right; font-variant-numeric: tabular-nums; }
.score { display: grid; gap: 0.25rem; min-width: 84px; }
.score-num { font-weight: 700; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.score-bar { display: block; height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.score-fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

/* ---------- queue ---------- */
.queue { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.qcard {
  display: grid; grid-template-columns: 2.6rem minmax(0, 1fr) auto; gap: 0.75rem; align-items: start;
  border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem 0.85rem; background: var(--surface-2);
}
.qrank { font-weight: 700; color: var(--accent-strong); font-variant-numeric: tabular-nums; padding-top: 0.1rem; }
.qhead { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.qbody { min-width: 0; }
.why { color: var(--text); overflow-wrap: anywhere; }
.ev-line { font-size: 0.85rem; color: var(--text-soft); overflow-wrap: anywhere; }
.qgroup + .qgroup { margin-top: 0.6rem; }
.activity { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.activity li { border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; overflow-wrap: anywhere; }
.act-what { font-weight: 600; }
.cap-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.cap-item { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.cap-name { font-weight: 600; margin-right: 0.2rem; }

/* ---------- buttons and forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
  min-height: 2.35rem; padding: 0.4rem 0.95rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface-3); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.2;
}
.btn:hover { border-color: var(--accent); color: var(--text); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn-sm { min-height: 2rem; padding: 0.25rem 0.7rem; font-size: 0.86rem; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-strong); color: var(--accent-ink); }
.btn-danger { border-color: rgba(248, 113, 113, 0.7); color: #fecaca; background: var(--bad-wash); }
.btn-danger:hover { border-color: var(--bad); color: #fee2e2; }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; }
.linkish {
  background: none; border: 0; padding: 0; font: inherit; font-weight: 650; color: var(--accent-strong);
  cursor: pointer; text-align: left; text-decoration: underline; text-decoration-color: rgba(103, 232, 249, 0.4);
  text-underline-offset: 3px; overflow-wrap: anywhere;
}
.linkish:hover { color: #a5f3fc; text-decoration-color: currentColor; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 0.45rem 0.6rem; min-height: 2.35rem; width: 100%; max-width: 100%;
}
textarea { resize: vertical; line-height: 1.5; }
input[type="checkbox"] { width: 1.1rem; height: 1.1rem; min-height: 0; accent-color: var(--accent); margin: 0.15rem 0 0; flex: none; }
input[type="file"] { padding: 0.35rem; }
input::placeholder, textarea::placeholder { color: #7486a1; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--accent); }
label { font-weight: 600; font-size: 0.88rem; color: var(--text-soft); }
.req { color: var(--muted); font-weight: 500; font-size: 0.8rem; }
.field { display: grid; gap: 0.3rem; min-width: 0; align-content: start; }
fieldset.field { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.6rem 0.75rem; margin: 0; }
fieldset.field legend { font-weight: 600; font-size: 0.88rem; color: var(--text-soft); padding: 0 0.3rem; }
.field-check { display: flex; gap: 0.5rem; align-items: flex-start; flex-wrap: wrap; }
.field-check label { font-weight: 500; color: var(--text); }
.field-check .hint { flex-basis: 100%; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.8rem 1rem; align-items: start; }
.form-grid .field-wide, .form-grid .form-actions, .form-grid .form-error, .form-grid .field-check, .form-grid > .hint { grid-column: 1 / -1; }
.form-inline { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; }
.form-inline .field { min-width: 180px; flex: 1 1 180px; }
.form-inline .form-error { flex-basis: 100%; }
.form-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.form-error {
  color: #fecaca; background: var(--bad-wash); border: 1px solid rgba(248, 113, 113, 0.6);
  border-radius: var(--radius-sm); padding: 0.45rem 0.65rem; font-size: 0.88rem; margin: 0;
}
.form-error[hidden] { display: none; }
.search-form { display: flex; gap: 0.6rem; align-items: flex-end; flex-wrap: wrap; }
.search-form .field { flex: 1 1 280px; }
.filters-wrap > summary { cursor: pointer; font-weight: 650; color: var(--text-soft); padding: 0.2rem 0; }
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0.6rem 0.8rem; align-items: end; margin-top: 0.4rem; }
.filters-reset { align-self: end; }
.count-line { color: var(--text-soft); font-size: 0.88rem; }
details > summary { cursor: pointer; }
details > summary:focus-visible { outline: 3px solid var(--focus); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { padding: 0.6rem 0.7rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.table th { color: var(--muted); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 650; background: var(--surface-2); white-space: nowrap; }
.table tbody tr:hover { background: rgba(26, 43, 69, 0.55); }
.table-compact th, .table-compact td { padding: 0.4rem 0.55rem; font-size: 0.85rem; }
.cell-why { min-width: 24ch; max-width: 42ch; overflow-wrap: break-word; }
.table td { overflow-wrap: break-word; }
.table .badge {
  white-space: normal; text-align: left; display: inline-block; overflow: visible;
  border-radius: var(--radius-sm); line-height: 1.3; padding: 0.15rem 0.45rem;
}
.table td .score { min-width: 90px; }
@media (min-width: 761px) {
  .table td[data-label="Company"] { min-width: 17ch; }
  .table td[data-label="Buyer"], .table td[data-label="Readiness"] { min-width: 16ch; }
  .table td[data-label="Latest evidence"] { min-width: 22ch; }
  .table td[data-label="Status"] { min-width: 18ch; }
}
.run-row td { background: var(--surface-2); }

/* ---------- key/value ---------- */
.kv { display: grid; grid-template-columns: minmax(120px, 30%) minmax(0, 1fr); gap: 0.3rem 0.8rem; margin: 0.4rem 0; }
.kv dt { color: var(--muted); font-size: 0.84rem; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv-tight { font-size: 0.87rem; }
.kv-items { margin: 0; padding-left: 1.1rem; }
.notes, .warnings { margin: 0.3rem 0; padding-left: 1.2rem; }
.warnings li { color: var(--warn); }
.receipt { border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem 0.9rem; background: var(--surface-2); margin-top: 0.8rem; }
.kv.counters { grid-template-columns: repeat(auto-fill, minmax(150px, max-content) minmax(3rem, 1fr)); }
.kv.counters dd { font-variant-numeric: tabular-nums; font-weight: 650; }
.per-source { border-top: 1px solid var(--border); margin-top: 0.6rem; padding-top: 0.5rem; overflow-wrap: anywhere; }
.per-source h5 { font-size: 0.78rem; margin: 0.5rem 0 0.25rem; }
.kind-info { border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 0.5rem 0.7rem; background: var(--surface-2); overflow-wrap: anywhere; }
.onboarding { display: grid; gap: 0.3rem; margin: 0.4rem 0; }
.onboarding .btn { justify-self: start; }
.link-withheld { color: var(--text-soft); overflow-wrap: anywhere; }
a.ext { overflow-wrap: anywhere; }

/* ---------- drawer ---------- */
.drawer-scrim { position: fixed; inset: 0; background: rgba(3, 8, 16, 0.6); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(780px, 100vw); z-index: 41;
  background: var(--bg); border-left: 1px solid var(--border-strong); box-shadow: var(--shadow);
  overflow-y: auto; padding: 0 1.25rem 3rem; overscroll-behavior: contain;
}
.drawer-head {
  position: sticky; top: 0; z-index: 2; background: var(--bg); display: flex; justify-content: space-between;
  align-items: center; gap: 1rem; padding: 1rem 0 0.75rem; border-bottom: 1px solid var(--border); margin-bottom: 0.8rem;
}
.drawer-head h2 { font-size: 1.25rem; overflow-wrap: anywhere; }
.drawer-head h2:focus { outline: none; }
/* minmax(0, 1fr): a wide child (long URL, table) must not widen the single implicit column past the drawer. */
.drawer-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.9rem; }
.drawer-body > * { min-width: 0; }
.dsummary { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.4rem 1rem; align-items: center; }
.dsummary > :first-child, .dsummary > .chips { grid-column: 1; }
.dsummary > .score { grid-column: 2; grid-row: 1 / span 2; }
.dsec { border-top: 1px solid var(--border); padding-top: 0.8rem; }
.dsec > h3 { font-size: 1rem; margin-bottom: 0.4rem; }
.signals { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.signal { border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem; background: var(--surface); }
.signal-head { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.signal-title { font-weight: 650; margin-top: 0.4rem; overflow-wrap: anywhere; }
.excerpt {
  margin: 0.4rem 0; padding: 0.45rem 0.75rem; border-left: 3px solid var(--accent); background: var(--surface-2);
  color: var(--text); font-size: 0.9rem; white-space: pre-wrap; overflow-wrap: anywhere; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.drafts { display: grid; gap: 0.8rem; margin-top: 0.8rem; }
.draft { border: 1px solid var(--border); border-radius: var(--radius); padding: 0.8rem; background: var(--surface); display: grid; gap: 0.4rem; }
.draft-approved { border-color: rgba(74, 222, 128, 0.55); }
.draft-head { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.draft-body { min-height: 9rem; font-size: 0.95rem; }
.timeline { list-style: none; margin: 0.4rem 0 1rem; padding: 0; display: grid; gap: 0.6rem; }
.tl-item { border-left: 3px solid var(--border-strong); padding: 0.35rem 0 0.35rem 0.75rem; }
.tl-reply { border-left-color: var(--ok); }
.tl-opt_out { border-left-color: var(--bad); }
.tl-new_signal { border-left-color: var(--info); }
.tl-head { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.event-form { margin-top: 0.6rem; border: 1px solid var(--border); border-radius: var(--radius); padding: 0.8rem; background: var(--surface); }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.25rem; }
.center-card {
  width: min(440px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 1.6rem 1.5rem; box-shadow: var(--shadow); display: grid; gap: 0.8rem; margin: 2rem auto;
}
.eyebrow { color: var(--accent-strong); text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.74rem; font-weight: 700; margin: 0; }
.lead-text { color: var(--text-soft); }
.login-form { display: grid; gap: 0.85rem; }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 60; display: grid; gap: 0.5rem; width: min(420px, calc(100vw - 2rem)); }
.toast {
  background: var(--surface-3); border: 1px solid var(--border-strong); border-left: 4px solid var(--info);
  color: var(--text); border-radius: var(--radius-sm); padding: 0.65rem 0.85rem; box-shadow: var(--shadow); font-size: 0.9rem;
}
.toast-ok { border-left-color: var(--ok); }
.toast-warn { border-left-color: var(--warn); }
.toast-bad { border-left-color: var(--bad); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .topbar {
    display: flex; align-items: center; gap: 0.75rem; position: sticky; top: 0; z-index: 30;
    background: var(--surface); border-bottom: 1px solid var(--border); padding: 0.55rem 0.9rem;
  }
  .topbar-title { font-weight: 700; }
  .topbar-brand { color: var(--muted); font-size: 0.86rem; margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 45vw; }
  .menu-btn {
    font: inherit; font-weight: 650; color: var(--text); background: var(--surface-3); border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm); min-height: 2.5rem; padding: 0.3rem 0.85rem; cursor: pointer;
  }
  .sidebar {
    position: fixed; z-index: 50; top: 0; left: 0; bottom: 0; width: min(300px, 86vw); height: auto;
    transform: translateX(-105%); transition: transform 0.18s ease; box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); }
  .nav-scrim { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(3, 8, 16, 0.6); }
  .nav-scrim[hidden] { display: none; }
  .main { padding: 1rem 0.9rem 3rem; }
}
@media (max-width: 760px) {
  .table.responsive thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td { display: block; width: 100%; }
  .table.responsive tr { border-bottom: 1px solid var(--border-strong); padding: 0.5rem 0; }
  .table.responsive td { border: 0; padding: 0.3rem 0.75rem; display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 0.6rem; }
  .table.responsive td::before { content: attr(data-label); grid-column: 1; grid-row: 1 / span 6; color: var(--muted); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 650; padding-top: 0.15rem; }
  .table.responsive td > * { grid-column: 2; }
  .table.responsive td[colspan] { grid-template-columns: minmax(0, 1fr); }
  .table.responsive td[colspan]::before { grid-row: auto; }
  .table.responsive td[colspan] > * { grid-column: 1; }
  .cell-why { max-width: none; }
  .qcard { grid-template-columns: 2rem minmax(0, 1fr); }
  .qscore { grid-column: 2; }
  .kv { grid-template-columns: minmax(0, 1fr); }
  .kv dt { margin-top: 0.3rem; }
  .bar-row { grid-template-columns: minmax(90px, 40%) minmax(0, 1fr) 2.5rem; }
  .dsummary { grid-template-columns: minmax(0, 1fr); }
  .dsummary > .score { grid-column: 1; grid-row: auto; }
  .drawer { padding: 0 0.9rem 3rem; }
  h1 { font-size: 1.3rem; }
  .metric-value { font-size: 1.45rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .badge, .btn, .dot { border: 1px solid CanvasText; }
}
