/* SovereignWatch — live intelligence workspace */

/* The workspace no longer carries its own palette. Every token below points at
 * the design system in landing.css, so the app inherits the institutional blue
 * *and* light/dark for free — rather than the two halves of one product
 * drifting apart every time either is touched.
 *
 * The gold accent is gone deliberately: it read as editorial warmth, and this
 * is a decision-support surface. Where it marked "the active mode", blue now
 * does, which is also what the landing uses for the same meaning. */
:root {
  --ink: var(--sw-ink);
  --ink-2: var(--sw-ink-2);
  --muted: var(--sw-muted);
  --line: var(--sw-line);
  --bg: var(--sw-bg-alt);
  --panel: var(--sw-surface);
  --gold: var(--sw-blue-500);
  --gold-soft: color-mix(in srgb, var(--sw-blue-500) 10%, var(--sw-surface));
  --navy: var(--sw-navy-800);
  --navy-2: var(--sw-navy-700);
  --accent: var(--sw-blue-500);
  --ok: var(--sw-ok);
  --ok-bg: color-mix(in srgb, var(--sw-ok) 12%, var(--sw-surface));
  --warn: var(--sw-warn);
  --warn-bg: color-mix(in srgb, var(--sw-warn) 12%, var(--sw-surface));
  --crit: var(--sw-risk);
  --crit-bg: color-mix(in srgb, var(--sw-risk) 12%, var(--sw-surface));
  --radius: var(--sw-radius-sm);
  --shadow: var(--sw-shadow);
  --font: var(--sw-font);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
em { font-style: normal; color: var(--muted); font-weight: 400; }

/* ───────────────────────────── onboarding ───────────────────────────── */

/* Its own dark band in both themes: this screen is a threshold, not a
   workspace surface. */
.onboarding {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 20px;
  background: linear-gradient(160deg, var(--navy) 0%, #24314e 100%);
}

.onboarding-inner { width: 100%; max-width: 880px; }

.onboarding-head { text-align: center; color: #fff; margin-bottom: 28px; }
.onboarding-head h1 { margin: 14px 0 8px; font-size: 30px; letter-spacing: -.02em; }
.onboarding-head .muted { color: #b3c0d6; max-width: 560px; margin: 0 auto; }

.brand-mark {
  font-size: 12px; font-weight: 800; letter-spacing: .14em;
  text-transform: uppercase; color: var(--gold);
}

.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

.mode-card {
  text-align: left; background: var(--panel); border: 2px solid transparent;
  border-radius: 16px; padding: 22px; cursor: pointer; display: flex;
  flex-direction: column; gap: 6px; font-family: var(--font);
  transition: transform .15s ease, border-color .15s ease;
}
.mode-card:hover { transform: translateY(-3px); border-color: var(--gold); }
.mode-card.selected { border-color: var(--gold); }
.mode-icon { font-size: 26px; }
.mode-title { font-size: 17px; font-weight: 700; color: var(--ink); }
.mode-sub { font-size: 13px; color: var(--muted); }
.mode-points { margin: 12px 0 0; padding-left: 18px; color: var(--ink-2); font-size: 13px; }
.mode-points li { margin-bottom: 5px; }

.onboard-form {
  background: var(--panel); border-radius: 16px; padding: 26px;
  margin-top: 22px; display: flex; flex-direction: column; gap: 16px;
}
.form-head { display: flex; justify-content: space-between; align-items: center; }
.form-foot {
  display: flex; justify-content: space-between; align-items: center;
  gap: 18px; border-top: 1px solid var(--line); padding-top: 16px; flex-wrap: wrap;
}
.form-foot .muted { max-width: 460px; margin: 0; }

.pill {
  background: var(--gold-soft); color: var(--gold); font-weight: 700;
  font-size: 12px; padding: 5px 12px; border-radius: 999px;
}

/* ─────────────────────────────── layout ─────────────────────────────── */

.layout { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--navy); color: #cfd8e8; padding: 22px 16px;
  display: flex; flex-direction: column; gap: 22px; position: sticky;
  top: 0; height: 100vh;
}
.brand-sub { font-size: 15px; font-weight: 700; color: #fff; margin-top: 6px; }
.mode-badge {
  display: inline-block; margin-top: 8px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; padding: 3px 9px;
  border-radius: 999px; background: color-mix(in srgb, var(--sw-blue-500) 22%, transparent); color: #cfe0ff;
}

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: flex; justify-content: space-between; align-items: center;
  background: none; border: 0; color: #a9b6cd; text-align: left;
  padding: 10px 12px; border-radius: 8px; cursor: pointer;
  font-size: 14px; font-family: var(--font);
}
.nav-item:hover { background: var(--navy-2); color: #fff; }
.nav-item.active { background: var(--navy-2); color: #fff; font-weight: 600; }
.nav-count {
  background: rgba(255, 255, 255, .1); border-radius: 999px;
  padding: 1px 8px; font-size: 11.5px; font-weight: 700;
}
.nav-count.warn { background: var(--gold); color: #fff; }

.sidebar-foot {
  border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 14px;
  display: flex; flex-direction: column; gap: 7px;
}
.kv { display: flex; justify-content: space-between; font-size: 12px; gap: 8px; }
.kv span { color: #8d9cb6; }
.kv b { color: #e7edf7; font-weight: 600; text-align: right; word-break: break-all; }

.main { padding: 26px 30px 60px; max-width: 1240px; }

.topbar {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 18px; margin-bottom: 22px; flex-wrap: wrap;
}
.topbar h1 { margin: 4px 0 0; font-size: 25px; letter-spacing: -.02em; }
.topbar-actions { display: flex; gap: 10px; }
.eyebrow {
  margin: 0; font-size: 11.5px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--gold);
}

/* ─────────────────────────────── panels ─────────────────────────────── */

.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.panel.danger { border-color: color-mix(in srgb, var(--crit) 40%, transparent); }
.panel-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; margin-bottom: 14px;
}
.panel-head h2 { margin: 0; font-size: 16px; }
.panel-head p { margin: 5px 0 0; max-width: 640px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}
.stat b { display: block; font-size: 25px; letter-spacing: -.02em; }
.stat span { color: var(--muted); font-size: 12.5px; }

/* ─────────────────────────────── forms ──────────────────────────────── */

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; align-items: end; }
.span-2 { grid-column: span 2; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field-action { justify-content: flex-end; }
.field-block {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}
.field-block legend { font-weight: 650; padding: 0 4px; }
.switch-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 8px 0;
  cursor: pointer;
}
.switch-row input { margin-top: 3px; }
.inline { display: flex; gap: 8px; }
.inline .input { width: 100%; }

.input {
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px;
  font-size: 14px; font-family: var(--font); background: var(--panel); color: var(--ink);
  width: 100%;
}
.input:focus { outline: 2px solid rgba(37, 99, 235, .35); border-color: var(--accent); }
textarea.input { resize: vertical; }

.check { display: flex; align-items: flex-start; gap: 9px; font-size: 13.5px; padding: 8px 0; }
.check input { margin-top: 2px; }

/* ─────────────────────────────── buttons ────────────────────────────── */

.btn {
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  border-radius: 9px; padding: 9px 15px; font-size: 13.5px; font-weight: 600;
  cursor: pointer; font-family: var(--font);
}
.btn:hover:not(:disabled) { background: var(--sw-surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-primary:hover:not(:disabled) { background: var(--sw-blue-600); }
.btn-danger { background: var(--crit); border-color: var(--crit); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }

/* ─────────────────────────── lists & cards ──────────────────────────── */

.list { display: flex; flex-direction: column; gap: 10px; }
.empty { color: var(--muted); font-size: 13px; padding: 8px 2px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }

.row {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 14px; border: 1px solid var(--line); border-radius: 10px; padding: 13px 15px;
}
.row-main { min-width: 0; flex: 1; }
.row-title { font-weight: 600; margin-bottom: 3px; }
.row-sub { color: var(--muted); font-size: 12.5px; word-break: break-all; }
.row-actions { display: flex; gap: 7px; flex-shrink: 0; align-items: center; }

.card {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
  cursor: pointer; background: var(--panel); transition: border-color .15s ease;
}
.card:hover { border-color: var(--gold); }
.card h3 { margin: 8px 0 6px; font-size: 15px; }
.card-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.badge {
  display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 9px;
  border-radius: 999px; text-transform: uppercase; letter-spacing: .04em;
  background: #eef1f6; color: var(--ink-2);
}
.badge.critical { background: var(--crit-bg); color: var(--crit); }
.badge.high { background: var(--warn-bg); color: var(--warn); }
.badge.medium { background: var(--gold-soft); color: var(--gold); }
.badge.low { background: #eef1f6; color: var(--muted); }
.badge.ok, .badge.ready, .badge.sent, .badge.diffused { background: var(--ok-bg); color: var(--ok); }
.badge.pending_review, .badge.outbox, .badge.queued { background: var(--warn-bg); color: var(--warn); }
.badge.error, .badge.failed, .badge.rejected { background: var(--crit-bg); color: var(--crit); }

/* ────────────────────────────── run steps ───────────────────────────── */

.steps { display: flex; flex-direction: column; gap: 8px; }
.step {
  display: grid; grid-template-columns: 26px 1fr auto; gap: 12px;
  align-items: start; padding: 10px 12px; border-radius: 9px;
  border: 1px solid var(--line);
}
.step.running { border-color: var(--accent); background: #f4f8ff; }
.step.done { border-color: #cfe9dd; background: #f7fdfa; }
.step.error { border-color: #f3c9c5; background: var(--crit-bg); }
.step.skipped { opacity: .6; }
.step-icon { font-size: 15px; text-align: center; }
.step-label { font-weight: 600; }
.step-detail { color: var(--muted); font-size: 12.5px; margin-top: 2px; word-break: break-word; }
.step-metrics { font-size: 11.5px; color: var(--muted); white-space: nowrap; text-align: right; }

/* ───────────────────────────── model lab ────────────────────────────── */

.model-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.model-chip {
  display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 13px; cursor: pointer;
}
.model-chip.on { border-color: var(--gold); background: var(--gold-soft); }
.model-chip b { display: block; font-size: 13.5px; }
.model-chip span { color: var(--muted); font-size: 12px; }
.lab-actions { display: flex; gap: 14px; align-items: center; margin: 16px 0; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 700px; }
th, td { text-align: left; padding: 9px 11px; border-bottom: 1px solid var(--line); }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.failed td { color: var(--crit); }

/* ─────────────────────────────── modal ──────────────────────────────── */

.modal {
  position: fixed; inset: 0; background: rgba(16, 21, 31, .55);
  display: grid; place-items: center; padding: 22px; z-index: 50;
}
.modal-card {
  background: #fff; border-radius: 16px; width: min(880px, 100%);
  max-height: 90vh; display: flex; flex-direction: column; overflow: hidden;
}
.modal-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 20px 24px; border-bottom: 1px solid var(--line);
}
.modal-head h2 { margin: 4px 0 0; font-size: 19px; }
.modal-body { padding: 22px 24px; overflow-y: auto; flex: 1; }
.modal-foot {
  border-top: 1px solid var(--line); padding: 15px 24px; display: flex;
  justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
}
.modal-buttons { display: flex; gap: 10px; }

.review-banner {
  background: var(--warn-bg); color: var(--warn); padding: 11px 24px;
  font-size: 13px; font-weight: 600; border-bottom: 1px solid #f3ddba;
}
.checklist { display: flex; gap: 16px; flex-wrap: wrap; }
.check-item { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.check-item .dot {
  width: 9px; height: 9px; border-radius: 50%; background: #d3dae5; display: inline-block;
}
.check-item.on { color: var(--ok); font-weight: 600; }
.check-item.on .dot { background: var(--ok); }

.summary-box {
  background: var(--gold-soft); border-left: 3px solid var(--gold);
  padding: 15px 17px; border-radius: 0 10px 10px 0; margin-bottom: 20px;
}

.finding {
  border: 1px solid var(--line); border-radius: 10px; padding: 15px;
  margin-bottom: 12px;
}
.finding h4 { margin: 8px 0 7px; font-size: 14.5px; }
.finding-line { margin: 6px 0; font-size: 13px; }
.finding-line b { color: var(--ink-2); }
.finding-chain {
  margin: 8px 0;
  padding: 8px 10px;
  border-left: 3px solid var(--gold);
  background: var(--gold-soft);
  font-size: 13px;
  line-height: 1.45;
}
.finding-chain b { color: var(--ink-2); }
.finding-src {
  margin-top: 10px; padding-top: 9px; border-top: 1px dashed var(--line);
  font-size: 12px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap;
}
.finding-src a { color: var(--accent); }

/* How far the desk stands behind a finding: corroboration, signal strength,
   where a rule stands, and whether anyone has denied it. */
.finding-trust {
  margin: 0 0 8px; font-size: 12px; color: var(--muted);
  display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline;
}
.trust-triangulated { color: var(--ok, #2f7d5a); font-weight: 600; }
.trust-partial { color: var(--ink-2); font-weight: 600; }
.trust-single { color: var(--muted); }
.trust-weak { color: var(--accent); font-weight: 600; }
.trust-denied { color: var(--danger, #b4432c); font-weight: 700; }

/* Why a member is on an alert — the part a manager can argue with. */
.impact-list { margin: 4px 0 8px; padding-left: 18px; font-size: 12.5px; color: var(--ink-2); }
.impact-list li { margin-bottom: 4px; }
.impact-direct { color: var(--crit); font-weight: 700; }
.impact-general { color: var(--muted); font-weight: 600; }

.trace-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px; margin-top: 10px;
}
.trace-cell { background: #f7f9fc; border-radius: 9px; padding: 10px 12px; }
.trace-cell b { display: block; font-size: 17px; }
.trace-cell span { font-size: 11.5px; color: var(--muted); }

/* ─────────────────────────────── toast ─────────────────────────────── */

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 10px;
  z-index: 100; box-shadow: var(--shadow); max-width: 620px; font-size: 13.5px;
}
.toast.error { background: var(--crit); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .grid-2, .grid-3, .grid-4, .mode-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .main { padding: 20px 16px 50px; }
}

/* A stated fact inside a form: same rhythm as a field label, no input. */
.field-note {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
  border-left: 2px solid var(--accent);
  padding-left: 13px;
}

.field-note strong { color: var(--ink); font-weight: 600; }
