/* ============================================================
   Vorion Mission Control — brand-accurate dark theme
   Palette pulled from vorion-marketing/tailwind.config.mjs
   ============================================================ */
:root {
  --vorion-400: #818cf8; --vorion-500: #6366f1; --vorion-600: #4f46e5;
  --vorion-700: #4338ca; --vorion-900: #312e81; --vorion-950: #1e1b4b;
  --secondary: #8b5cf6; --cyan: #06b6d4; --emerald: #22c55e;
  --amber: #f59e0b; --rose: #f43f5e; --purple: #a855f7;
  /* trust ladder (autonomy) */
  --t-sandbox: #ef4444; --t-provisional: #f97316; --t-standard: #eab308;
  --t-trusted: #3b82f6; --t-certified: #8b5cf6; --t-autonomous: #22c55e;
  --bg: #0b1020; --bg-2: #0f172a; --bg-3: #161f38; --elevated: #1c2542;
  --border: #25304f; --border-2: #303c63;
  --text: #e8edf9; --muted: #94a3c4; --faint: #64748b;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: Inter, system-ui, sans-serif;
  background: radial-gradient(1200px 700px at 80% -10%, #1a2348 0%, var(--bg) 55%) fixed;
  color: var(--text); font-size: 14px; line-height: 1.45;
  display: flex; flex-direction: column; min-height: 100vh;
}
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .07em; margin: 0; color: var(--text); font-weight: 700; }
button, input, select { font-family: inherit; }
a { color: var(--vorion-400); text-decoration: none; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: rgba(15,23,42,.85); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; place-items: center; filter: drop-shadow(0 2px 8px rgba(99,102,241,.5)); }
.brand-name { font-weight: 800; font-size: 18px; letter-spacing: .02em; }
.brand-name span { color: var(--vorion-400); font-weight: 600; }
.brand-tag { color: var(--muted); font-size: 11.5px; }
.topbar-controls { display: flex; align-items: center; gap: 14px; }
.provider-pick { display: flex; flex-direction: column; gap: 2px; }
.provider-pick label { font-size: 9px; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); }
#provider-select {
  background: var(--bg-3); color: var(--text); border: 1px solid var(--border-2);
  border-radius: 8px; padding: 6px 10px; font-size: 12.5px; min-width: 230px;
}
.btn {
  border: 1px solid var(--border-2); background: var(--bg-3); color: var(--text);
  padding: 9px 16px; border-radius: 9px; font-weight: 600; font-size: 13px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px; transition: all .15s;
}
.btn:hover { border-color: var(--vorion-500); transform: translateY(-1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(135deg, var(--vorion-500), var(--secondary)); border: none; box-shadow: 0 4px 16px rgba(99,102,241,.35); }
.btn-ghost { background: transparent; }
.btn-mini { padding: 6px 11px; font-size: 11.5px; font-weight: 600; border-radius: 7px; }
.btn-warn { border-color: #5a3030; color: #fca5a5; }
.btn-warn:hover { border-color: var(--rose); }
.dot-live { width: 8px; height: 8px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 0 rgba(255,255,255,.6); animation: pulse 1.8s infinite; display: inline-block; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.6); } 70% { box-shadow: 0 0 0 8px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
.conn { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--muted); }
.conn-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); }
.conn.live .conn-dot { background: var(--emerald); box-shadow: 0 0 8px var(--emerald); }
.conn.down .conn-dot { background: var(--rose); }

/* ---------- pipeline strip ---------- */
.pipeline {
  display: flex; align-items: center; gap: 6px; padding: 10px 20px; flex-wrap: wrap;
  background: rgba(15,23,42,.5); border-bottom: 1px solid var(--border); font-size: 12px;
}
.pipe-stage {
  display: flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 20px;
  background: var(--bg-3); border: 1px solid var(--border); color: var(--muted); transition: all .25s;
}
.pipe-stage small { color: var(--faint); font-size: 10px; }
.pipe-stage.active { border-color: var(--vorion-500); color: var(--text); background: rgba(99,102,241,.14); box-shadow: 0 0 14px rgba(99,102,241,.25); }
.pipe-num { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--bg); color: var(--vorion-400); font-size: 10px; font-weight: 700; }
.pipe-stage.active .pipe-num { background: var(--vorion-500); color: #fff; }
.pipe-arrow { color: var(--faint); }

/* ---------- grid ---------- */
.grid { display: grid; grid-template-columns: 320px 1fr 380px; gap: 16px; padding: 16px 20px; flex: 1; align-items: start; }
.col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.panel { background: linear-gradient(180deg, var(--bg-2), var(--bg-3)); border: 1px solid var(--border); border-radius: 14px; padding: 14px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.panel-sub { font-size: 11px; color: var(--faint); display: flex; align-items: center; gap: 6px; }

/* ---------- fleet ---------- */
.fleet { display: flex; flex-direction: column; gap: 9px; }
.agent {
  display: grid; grid-template-columns: 38px 1fr auto; gap: 10px; align-items: center;
  padding: 10px; border-radius: 11px; background: var(--bg-3); border: 1px solid var(--border); transition: all .2s;
}
.agent.busy { border-color: var(--vorion-500); box-shadow: 0 0 0 1px var(--vorion-700) inset, 0 0 16px rgba(99,102,241,.18); }
.agent-av { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 16px; }
.agent-name { font-weight: 700; font-size: 13px; }
.agent-role { font-size: 11px; color: var(--muted); }
.agent-meta { font-size: 10px; color: var(--faint); font-family: var(--mono); margin-top: 2px; }
.agent-status { text-align: right; }
.status-badge { font-size: 9.5px; text-transform: uppercase; letter-spacing: .05em; padding: 3px 8px; border-radius: 20px; font-weight: 700; }
.s-idle { background: #1e293b; color: var(--faint); }
.s-thinking { background: rgba(245,158,11,.16); color: var(--amber); }
.s-working { background: rgba(99,102,241,.18); color: var(--vorion-400); }
.s-review { background: rgba(168,85,247,.16); color: var(--purple); }
.s-blocked { background: rgba(244,63,94,.16); color: var(--rose); }
.s-done { background: rgba(34,197,94,.16); color: var(--emerald); }
.agent-spark { font-size: 10px; color: var(--faint); margin-top: 3px; min-height: 13px; font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }

/* ---------- memory ---------- */
.mem-tabs { display: flex; gap: 5px; margin-bottom: 10px; }
.mem-tab { flex: 1; background: var(--bg-3); border: 1px solid var(--border); color: var(--muted); padding: 6px 4px; border-radius: 8px; font-size: 11px; font-weight: 600; cursor: pointer; }
.mem-tab.active { background: rgba(99,102,241,.16); border-color: var(--vorion-500); color: var(--text); }
.mem-body { max-height: 240px; overflow-y: auto; display: flex; flex-direction: column; gap: 7px; }
.mem-item { background: var(--bg); border: 1px solid var(--border); border-radius: 9px; padding: 8px 10px; font-size: 11.5px; }
.mem-item .mk { font-size: 9px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; padding: 2px 6px; border-radius: 5px; margin-right: 6px; }
.mk-exemplar { background: rgba(34,197,94,.16); color: var(--emerald); }
.mk-rule { background: rgba(245,158,11,.16); color: var(--amber); }
.mk-fact, .mk-positioning { background: rgba(99,102,241,.16); color: var(--vorion-400); }
.mk-banned-term { background: rgba(244,63,94,.16); color: var(--rose); }
.mem-item .mtext { color: var(--text); }
.mem-item .mmeta { color: var(--faint); font-size: 10px; margin-top: 3px; font-family: var(--mono); }
.mem-query { display: flex; gap: 6px; margin-top: 9px; }
.mem-query input { flex: 1; background: var(--bg); border: 1px solid var(--border-2); border-radius: 8px; color: var(--text); padding: 7px 10px; font-size: 12px; }

/* ---------- board ---------- */
.board { display: grid; grid-template-columns: repeat(5, 1fr); gap: 9px; }
.bcol { background: var(--bg); border: 1px solid var(--border); border-radius: 11px; padding: 8px; min-height: 90px; }
.bcol-head { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin-bottom: 8px; display: flex; justify-content: space-between; }
.bcol-head .cnt { color: var(--faint); }
.bcard {
  background: var(--bg-3); border: 1px solid var(--border-2); border-radius: 9px; padding: 8px; margin-bottom: 7px;
  cursor: pointer; transition: all .15s; border-left: 3px solid var(--vorion-600);
}
.bcard:hover { border-color: var(--vorion-500); transform: translateY(-1px); }
.bcard.flash { animation: flash .8s; }
@keyframes flash { from { background: rgba(99,102,241,.4); } to { background: var(--bg-3); } }
.bcard-type { font-size: 9px; text-transform: uppercase; letter-spacing: .05em; color: var(--vorion-400); font-weight: 700; }
.bcard-title { font-size: 11.5px; font-weight: 600; margin: 3px 0; line-height: 1.3; }
.bcard-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 5px; }
.bcard-agent { font-size: 9.5px; color: var(--faint); }
.tier-chip { font-size: 8.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; padding: 2px 6px; border-radius: 5px; color: #06121f; }

/* ---------- activity ---------- */
.activity { max-height: 420px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
.act {
  display: grid; grid-template-columns: 64px 20px 1fr; gap: 8px; padding: 5px 6px; border-radius: 7px; align-items: baseline;
}
.act:hover { background: var(--bg); }
.act-time { font-family: var(--mono); font-size: 9.5px; color: var(--faint); }
.act-ico { font-size: 13px; text-align: center; }
.act-body { min-width: 0; }
.act-agent { font-weight: 700; }
.act-text { color: var(--muted); }
.act-stream { font-family: var(--mono); font-size: 11px; color: #c7d2fe; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 7px 9px; margin: 3px 0 5px; white-space: pre-wrap; max-height: 130px; overflow-y: auto; }
.act-tool { color: var(--cyan); }
.act-handoff { color: var(--purple); }
.act-policy { color: var(--amber); }
.act-trust { color: var(--vorion-400); }
.act-ledger { color: var(--emerald); }
.tag { font-family: var(--mono); font-size: 10px; padding: 1px 5px; border-radius: 4px; background: var(--bg); border: 1px solid var(--border); }

/* ---------- HITL approvals ---------- */
.panel-hitl { border-color: var(--vorion-700); box-shadow: 0 0 0 1px rgba(99,102,241,.12) inset; }
.hitl-intro { font-size: 11px; color: var(--muted); margin-bottom: 11px; }
.badge { font-size: 10px; font-weight: 700; padding: 3px 9px; border-radius: 20px; }
.badge-pending { background: rgba(245,158,11,.16); color: var(--amber); }
.approvals { display: flex; flex-direction: column; gap: 11px; }
.approval { background: var(--bg); border: 1px solid var(--border-2); border-radius: 12px; padding: 12px; }
.approval.high { border-color: #5a3030; }
.ap-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.ap-type { font-size: 9.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--vorion-400); font-weight: 700; }
.ap-title { font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.ap-preview { font-size: 11.5px; color: var(--muted); background: var(--bg-3); border: 1px solid var(--border); border-radius: 8px; padding: 8px; max-height: 110px; overflow-y: auto; white-space: pre-wrap; }
.ap-gov { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.gov-chip { font-size: 9.5px; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: var(--bg-3); border: 1px solid var(--border); color: var(--muted); }
.gov-chip b { color: var(--text); }
.risk-low { color: var(--emerald); } .risk-medium { color: var(--amber); } .risk-high { color: var(--rose); }
.ap-findings { margin: 8px 0; }
.finding { font-size: 11px; padding: 6px 8px; border-radius: 7px; background: rgba(244,63,94,.07); border: 1px solid rgba(244,63,94,.22); margin-bottom: 5px; }
.finding.sev-info { background: rgba(99,102,241,.07); border-color: rgba(99,102,241,.22); }
.finding.sev-low { background: rgba(245,158,11,.06); border-color: rgba(245,158,11,.2); }
.finding .fq { color: var(--rose); font-style: italic; }
.finding .fs { color: var(--emerald); display: block; margin-top: 3px; }
.finding .sev { font-size: 8.5px; font-weight: 800; text-transform: uppercase; padding: 1px 5px; border-radius: 4px; margin-right: 5px; }
.sev-high .sev { background: var(--rose); color: #fff; } .sev-medium .sev { background: var(--amber); color: #1a1205; }
.sev-low .sev { background: #3a3320; color: var(--amber); } .sev-info .sev { background: var(--vorion-700); color: #fff; }
.two-person { font-size: 10px; color: var(--amber); margin: 6px 0; display: flex; align-items: center; gap: 6px; }
.ap-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 9px; }
.ap-actions .btn { justify-content: center; padding: 8px; font-size: 12px; }
.btn-approve { background: rgba(34,197,94,.16); border-color: rgba(34,197,94,.4); color: #86efac; }
.btn-approve:hover { border-color: var(--emerald); }
.btn-reject { background: rgba(244,63,94,.12); border-color: rgba(244,63,94,.36); color: #fca5a5; }
.btn-changes { background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.34); color: #fcd34d; grid-column: span 1; }
.btn-edit { background: var(--bg-3); }
.empty { color: var(--faint); font-size: 12px; text-align: center; padding: 18px; font-style: italic; }

/* ---------- ledger ---------- */
.ledger-actions { display: flex; gap: 6px; margin-bottom: 9px; }
.ledger-verdict { font-size: 11.5px; padding: 8px 10px; border-radius: 8px; margin-bottom: 9px; display: none; font-family: var(--mono); }
.ledger-verdict.ok { display: block; background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.35); color: #86efac; }
.ledger-verdict.bad { display: block; background: rgba(244,63,94,.1); border: 1px solid rgba(244,63,94,.4); color: #fca5a5; }
.ledger { max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 5px; }
.lentry { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 7px 9px; font-size: 11px; }
.lentry.broken { border-color: var(--rose); background: rgba(244,63,94,.08); }
.lentry-head { display: flex; justify-content: space-between; align-items: center; }
.lentry-act { font-weight: 700; font-size: 11.5px; }
.lentry-seq { font-family: var(--mono); color: var(--faint); font-size: 9.5px; }
.lentry-hash { font-family: var(--mono); font-size: 9.5px; color: var(--cyan); margin-top: 3px; word-break: break-all; }
.lentry-hash .lbl { color: var(--faint); }
.lentry-meta { font-size: 10px; color: var(--muted); margin-top: 2px; }

/* ---------- outlets / channels ---------- */
.outlets-intro { font-size: 11px; color: var(--muted); margin-bottom: 11px; }
.outlets { display: flex; flex-direction: column; gap: 7px; }
.outlet { display: grid; grid-template-columns: 26px 1fr 84px; gap: 9px; align-items: center; padding: 8px 9px; border-radius: 9px; background: var(--bg-3); border: 1px solid var(--border); border-left: 3px solid var(--border-2); }
.outlet.ctrl-auto { border-left-color: var(--emerald); }
.outlet.ctrl-review { border-left-color: var(--amber); }
.outlet.ctrl-locked { border-left-color: var(--rose); }
.outlet-ico { font-size: 16px; text-align: center; font-weight: 700; }
.outlet-name { font-size: 12.5px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.outlet-note { font-size: 10px; color: var(--faint); }
.outlet-scope { font-size: 8px; text-transform: uppercase; letter-spacing: .05em; padding: 1px 5px; border-radius: 4px; font-weight: 700; }
.scope-external { background: rgba(245,158,11,.16); color: var(--amber); }
.scope-internal { background: rgba(34,197,94,.16); color: var(--emerald); }
.outlet-ctrl { background: var(--bg); border: 1px solid var(--border-2); border-radius: 7px; color: var(--text); padding: 5px 6px; font-size: 11px; font-weight: 600; }
.chan-chips { display: inline-flex; gap: 3px; margin-left: 4px; }
.chan-chip { font-size: 10px; padding: 0 4px; border-radius: 4px; background: var(--bg); border: 1px solid var(--border-2); font-weight: 700; }

/* ---------- conformance ---------- */
.conformance { margin-top: 10px; display: flex; flex-direction: column; gap: 5px; }
.conf-summary { font-size: 12px; font-weight: 700; padding: 8px 10px; border-radius: 8px; margin-bottom: 4px; }
.conf-summary.pass { background: rgba(34,197,94,.12); color: #86efac; border: 1px solid rgba(34,197,94,.35); }
.conf-summary.fail { background: rgba(244,63,94,.12); color: #fca5a5; border: 1px solid rgba(244,63,94,.35); }
.conf-case { display: flex; align-items: center; gap: 8px; font-size: 11px; padding: 5px 7px; border-radius: 6px; background: var(--bg); }
.conf-case .ci { font-weight: 800; }
.conf-case.ok .ci { color: var(--emerald); } .conf-case.no .ci { color: var(--rose); }
.conf-case .cid { font-family: var(--mono); font-size: 10px; color: var(--faint); }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(5,8,18,.7); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 50; }
.modal-backdrop[hidden] { display: none; }  /* the `hidden` attribute must win over the class's display:grid */
.modal { background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 16px; padding: 20px; width: min(640px, 92vw); max-height: 86vh; overflow-y: auto; box-shadow: 0 24px 80px rgba(0,0,0,.6); }
.modal h3 { margin: 0 0 4px; font-size: 17px; }
.modal textarea { width: 100%; background: var(--bg); border: 1px solid var(--border-2); border-radius: 9px; color: var(--text); padding: 10px; font-size: 13px; font-family: var(--mono); min-height: 180px; resize: vertical; }
.modal-row { display: flex; gap: 8px; margin-top: 12px; justify-content: flex-end; }
.modal label { font-size: 11px; color: var(--muted); display: block; margin: 10px 0 4px; }
.modal input[type=text] { width: 100%; background: var(--bg); border: 1px solid var(--border-2); border-radius: 8px; color: var(--text); padding: 9px; font-size: 13px; }

/* ---------- footer ---------- */
.footer { display: flex; justify-content: space-between; padding: 10px 20px; border-top: 1px solid var(--border); color: var(--faint); font-size: 11px; }

/* scrollbars */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 1240px) { .grid { grid-template-columns: 1fr; } .board { grid-template-columns: repeat(5, minmax(110px,1fr)); overflow-x: auto; } }
