*, *::before, *::after { box-sizing: border-box; }

/* ── TrigGuard-family palette (Quanta blue→teal) ──────────── */
:root {
  --serif: "Inter Tight", "Styrene B", -apple-system, BlinkMacSystemFont, sans-serif;
  --sans: "Inter Tight", "Styrene B", -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;

  --bg: #f6f8fa;
  --bg-soft: #eceff3;
  --surface: #ffffff;
  --text: #0c1218;
  --text-soft: #46535e;
  --text-muted: #7e8a94;
  --border: #dde3e9;
  --accent: #0796b4;            /* quanta cyan */
  --accent-2: #1e6bf2;          /* quanta blue */
  --accent-3: #19f2c3;          /* quanta mint */
  --accent-grad: linear-gradient(120deg, #1e6bf2 0%, #00bfd4 55%, #19f2c3 100%);
  --accent-soft: rgba(7, 150, 180, 0.10);
  --ok: #0e9f7e;
  --ok-bg: rgba(14, 159, 126, 0.11);
  --warn: #c2410c;
  --warn-bg: rgba(194, 65, 12, 0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(12, 18, 24, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0f15;
    --bg-soft: #0f1620;
    --surface: #101823;
    --text: #e8eef2;
    --text-soft: #a7b4bf;
    --text-muted: #66737e;
    --border: #1d2733;
    --accent: #22d3ee;
    --accent-2: #4d8df7;
    --accent-3: #2ce5c3;
    --accent-soft: rgba(34, 211, 238, 0.12);
    --ok: #2ce5a7;
    --ok-bg: rgba(44, 229, 167, 0.10);
    --warn: #f0925e;
    --warn-bg: rgba(240, 146, 94, 0.10);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  }
}

/* manual override via data-theme */
html[data-theme="light"] {
  --bg: #f6f8fa; --bg-soft: #eceff3; --surface: #ffffff;
  --text: #0c1218; --text-soft: #46535e; --text-muted: #7e8a94;
  --border: #dde3e9; --accent: #0796b4; --accent-2: #1e6bf2; --accent-3: #19f2c3;
  --accent-soft: rgba(7,150,180,.10);
  --ok: #0e9f7e; --ok-bg: rgba(14,159,126,.11);
  --warn: #c2410c; --warn-bg: rgba(194,65,12,.08);
  --shadow: 0 1px 3px rgba(12,18,24,.06);
}
html[data-theme="dark"] {
  --bg: #0a0f15; --bg-soft: #0f1620; --surface: #101823;
  --text: #e8eef2; --text-soft: #a7b4bf; --text-muted: #66737e;
  --border: #1d2733; --accent: #22d3ee; --accent-2: #4d8df7; --accent-3: #2ce5c3;
  --accent-soft: rgba(34,211,238,.12);
  --ok: #2ce5a7; --ok-bg: rgba(44,229,167,.10);
  --warn: #f0925e; --warn-bg: rgba(240,146,94,.10);
  --shadow: 0 1px 3px rgba(0,0,0,.4);
}

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 14.5px;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 1560px;
  margin: 0 auto;
  padding: 0 24px 40px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 4px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  height: 32px;
  width: auto;
  display: block;
  object-fit: contain;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; }
.brand-sub { font-size: 0.74rem; color: var(--text-muted); }

.topbar-status { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

.pill {
  font-family: var(--mono);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-soft);
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface);
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); }
.pill.ok::before { background: var(--ok); }
.pill.bad::before { background: var(--warn); }

.topbar-actions { display: flex; gap: 8px; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 16px;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.btn:active { transform: scale(.97); }
.btn.ghost { background: transparent; }
.btn.small { font-size: 0.75rem; padding: 5px 12px; }
.btn.send {
  background: var(--accent-grad, var(--accent));
  color: #fff;
  border-color: transparent;
  width: 38px; height: 38px;
  padding: 0;
  font-size: 1.05rem;
  flex-shrink: 0;
}
.btn.send:hover { filter: brightness(1.08); background: var(--accent); }
.btn-row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* ── Layout columns ──────────────────────────────────────── */
.columns {
  display: grid;
  grid-template-columns: minmax(250px, 23%) 1fr minmax(250px, 25%);
  gap: 20px;
  padding-top: 22px;
  flex: 1;
  align-items: start;
}

.pillar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 86px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  scrollbar-width: thin;
  padding-bottom: 8px;
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.card-head { display: flex; align-items: center; justify-content: space-between; }

.card-label {
  margin: 0 0 10px;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.card-label::before { content: "/ "; color: var(--accent); }

.card-sub-label {
  margin: 0.75rem 0 0.35rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.table-wrap { overflow-x: auto; margin: 0.5rem 0; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.data-table th,
.data-table td {
  text-align: left;
  padding: 0.4rem 0.55rem;
  border-bottom: 1px solid var(--border);
}
.data-table th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.data-table td.warn { color: var(--warn); font-weight: 600; }

.card-hint {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.card-hint.mono { font-family: var(--mono); font-size: 0.78rem; }

.loop-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.55rem;
  margin: 0.5rem 0;
}
.loop-metric { display: flex; flex-direction: column; gap: 0.15rem; }
.loop-label { font-size: 0.72rem; color: var(--text-muted); }
.loop-value { font-family: var(--mono); font-size: 0.88rem; font-weight: 500; }

.funnel-stages {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin: 0.5rem 0;
}
.funnel-stage {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
}
.funnel-label { font-size: 0.78rem; color: var(--text-muted); }
.funnel-count {
  font-family: var(--mono);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 2rem;
  text-align: right;
}
.funnel-drop {
  font-family: var(--mono);
  font-size: 0.72rem;
  min-width: 3rem;
  text-align: right;
  color: var(--text-muted);
}
.funnel-drop.warn { color: var(--warn, #c9a227); }
.funnel-arrow {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1;
  margin: -0.1rem 0;
}

.bars { display: flex; flex-direction: column; gap: 0.45rem; margin: 0.5rem 0; }
.bar-row { display: grid; grid-template-columns: 1fr 2fr auto; gap: 0.5rem; align-items: center; font-size: 0.82rem; }
.bar-label { color: var(--text-soft); }
.bar-track { height: 6px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent-grad); border-radius: 999px; }
.bar-num { font-family: var(--mono); font-size: 0.78rem; color: var(--text-muted); min-width: 2rem; text-align: right; }

.item-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  font-size: 0.82rem;
  color: var(--text-soft);
}
.item-list li { padding: 0.2rem 0; border-bottom: 1px solid var(--border); }
.item-list.mono { font-family: var(--mono); font-size: 0.78rem; }

.badge {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--text-muted);
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }

.warn-card { background: var(--warn-bg); border-color: transparent; }
.warn-card .card-label { color: var(--warn); }

#reality-layer-card { border-color: var(--accent); }
.loop-value.warn { color: var(--warn); font-weight: 600; }
.warn-metric .loop-label { color: var(--warn); }
.reality-orphan-warning { color: var(--warn); margin-top: 0.5rem; }

.strategic-action-card {
  margin-top: 0.75rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--surface) 0%, var(--accent-soft) 120%);
  box-shadow: var(--shadow);
}
.sa-header {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.sa-title { font-size: 1.15rem; font-weight: 600; margin-bottom: 0.5rem; }
.sa-scores { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-bottom: 0.55rem; }
.sa-pill {
  font-size: 0.78rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--text-soft);
}
.sa-pill strong { color: var(--text); margin-left: 0.2rem; }
.sa-evidence { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 0.45rem; }
.sa-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.82rem;
  color: var(--text-soft);
  margin: 0.45rem 0;
}
.sa-recommendation {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text);
  margin-top: 0.35rem;
}
.sa-details { margin-top: 0.35rem; font-size: 0.85rem; color: var(--text-soft); }
.sa-details summary { cursor: pointer; color: var(--accent); font-weight: 500; }
.sa-contributors { margin: 0.35rem 0 0 1rem; padding: 0; }
.sa-why { margin: 0.35rem 0 0; }

.agent-kpi .kpi-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.72rem;
  margin-top: 0.25rem;
}
.agent-kpi .kpi-label { color: var(--text-muted); }
.agent-kpi .kpi-value { font-weight: 600; color: var(--text); }

.badge {
  font-size: 0.7rem; font-weight: 600;
  background: var(--accent-soft); color: var(--accent);
  padding: 2px 9px; border-radius: 999px;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }

/* ── Lists ───────────────────────────────────────────────── */
.item-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.item-list li {
  font-size: 0.82rem;
  color: var(--text-soft);
  padding-left: 14px;
  position: relative;
}
.item-list li::before {
  content: "";
  position: absolute; left: 0; top: 8px;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent);
}
.item-list li.empty { color: var(--text-muted); font-style: italic; }
.item-list li.empty::before { background: var(--text-muted); }
.item-list.mono li { font-family: var(--mono); font-size: 0.72rem; }
.item-list li strong { color: var(--text); font-weight: 600; }

.item-list li .row-btn {
  margin-left: 8px;
  font-size: 0.68rem;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
}
.item-list li .row-btn:hover { background: var(--accent); color: #fff; }

/* ── Health ──────────────────────────────────────────────── */
.health-list { display: flex; flex-direction: column; gap: 6px; }
.health-item {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.8rem;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}
.health-item .dot { width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; flex-shrink: 0; }
.health-item.ok .dot { background: var(--ok); }
.health-item.bad .dot { background: var(--warn); }
.health-item .name { font-weight: 600; display: flex; align-items: center; flex: 1; }
.health-item .detail { color: var(--text-muted); font-size: 0.7rem; max-width: 55%; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Agents ──────────────────────────────────────────────── */
.agent-list { display: flex; gap: 8px; margin-bottom: 12px; }
.agent-chip {
  flex: 1;
  text-align: center;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  padding: 9px 4px;
}
.agent-chip .label { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.agent-chip .value { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; color: var(--accent); }

.stat-rows { display: flex; flex-direction: column; gap: 5px; }
.stat-row { display: flex; justify-content: space-between; font-size: 0.78rem; }
.stat-row span { color: var(--text-muted); }
.stat-row strong { font-weight: 600; }

/* ── Center / hero ───────────────────────────────────────── */
.center { display: flex; flex-direction: column; min-height: calc(100vh - 130px); }

.hero { padding: 26px 6px 18px; }

.hero-title {
  margin: 0 0 6px;
  font-family: var(--sans);
  font-weight: 650;
  font-size: clamp(1.9rem, 3.2vw, 2.6rem);
  letter-spacing: -0.03em;
}

.hero-sub { margin: 0; color: var(--text-soft); font-size: 0.95rem; max-width: 640px; }

/* ── Chat ────────────────────────────────────────────────── */
.chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  overflow: hidden;
  min-height: 420px;
}

.chat-thread {
  flex: 1;
  overflow-y: auto;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
}

.chat-msg { max-width: 88%; }
.chat-msg p { margin: 0; white-space: pre-wrap; word-break: break-word; }

.chat-msg.user {
  align-self: flex-end;
  background: var(--accent-soft);
  border-radius: 16px 16px 4px 16px;
  padding: 10px 16px;
  font-size: 0.9rem;
}

.chat-msg.bot {
  align-self: flex-start;
  font-size: 0.92rem;
  color: var(--text);
  line-height: 1.65;
}
.chat-msg.bot::before {
  content: "/ QUANTA";
  display: block;
  font-family: var(--mono);
  font-size: 0.64rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 4px;
}

.chat-msg.system { align-self: center; color: var(--text-muted); font-size: 0.85rem; text-align: center; }

.chat-msg.thinking p::after {
  content: "…";
  animation: pulse 1.2s infinite;
}
@keyframes pulse { 0%,100% { opacity: .3; } 50% { opacity: 1; } }

.chat-suggestions {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 0 22px 12px;
}
.chat-suggestions .chip {
  font-size: 0.74rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-soft);
  padding: 5px 13px;
  cursor: pointer;
}
.chat-suggestions .chip:hover { border-color: var(--accent); color: var(--accent); }

.chat-inputbar {
  display: flex; align-items: center; gap: 10px;
  border-top: 1px solid var(--border);
  padding: 14px 18px;
  background: var(--bg-soft);
}

.chat-inputbar input {
  flex: 1;
  font-family: var(--sans);
  font-size: 0.95rem;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
}
.chat-inputbar input::placeholder { color: var(--text-muted); }

/* ── Graphs ──────────────────────────────────────────────── */
.graph-block { margin-bottom: 14px; }
.graph-block:last-child { margin-bottom: 0; }
.graph-title { margin: 0 0 8px; font-size: 0.8rem; font-weight: 600; }

.bars { display: flex; flex-direction: column; gap: 5px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 24px; align-items: center; gap: 8px; font-size: 0.7rem; }
.bar-row .bar-label { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .bar-track { background: var(--bg-soft); border-radius: 99px; height: 8px; overflow: hidden; }
.bar-row .bar-fill { height: 100%; background: var(--accent-grad, var(--accent)); border-radius: 99px; transition: width .4s ease; }
.bar-row .bar-num { text-align: right; font-weight: 600; }

.deploy-status { margin: 0 0 6px; font-size: 0.8rem; color: var(--text-soft); }
.eng-autonomy {
  margin: 0 0 12px;
  font-size: 0.68rem;
  color: var(--warn);
  line-height: 1.4;
  cursor: help;
}

.eng-projects { display: flex; flex-direction: column; gap: 14px; }
.eng-project {
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.eng-project:first-child { padding-top: 0; border-top: none; }
.eng-project-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.eng-project-name {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-soft);
}
.eng-project-status {
  font-size: 0.62rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.eng-project-status.healthy { background: var(--ok-bg); color: var(--ok); }
.eng-project-status.failing { background: var(--warn-bg); color: var(--warn); }
.eng-project-status.in_progress { background: var(--accent-soft); color: var(--accent); }
.eng-project-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.eng-item {
  font-size: 0.74rem;
  line-height: 1.35;
  color: var(--text-soft);
  padding-left: 0;
}
.eng-item-type {
  display: inline-block;
  min-width: 58px;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}
.eng-item-fail .eng-item-type { color: var(--warn); }
.eng-item-clear { color: var(--text-muted); font-style: italic; }
.eng-empty { margin: 0; font-size: 0.74rem; color: var(--text-muted); font-style: italic; }

/* ── Control Center ──────────────────────────────────────── */
.control-center-card { border: 1px solid var(--accent-soft); background: linear-gradient(180deg, var(--surface) 0%, var(--bg-soft) 100%); }
.control-actions { flex-wrap: wrap; gap: 6px; }
.control-progress { list-style: none; margin: 10px 0 0; padding: 0; max-height: 180px; overflow-y: auto; }
.control-step { font-size: 0.72rem; padding: 6px 8px; border-radius: var(--radius-sm); margin-bottom: 4px; background: var(--bg-soft); color: var(--text-soft); }
.control-queued { opacity: 0.7; }
.control-running { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.control-success { background: var(--ok-bg); color: var(--ok); }
.control-failed { background: var(--warn-bg); color: var(--warn); }
.control-skipped { opacity: 0.55; font-style: italic; }
.subsystem-meta { font-size: 0.72rem; color: var(--text-soft); line-height: 1.4; margin-bottom: 0.5rem; }
.subsystem-meta span { white-space: nowrap; }
.control-idle { font-style: italic; color: var(--text-muted); }
.btn.primary { background: var(--accent-grad); color: #fff; border: none; }
.btn:disabled,
.btn.primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(0.35);
}
.btn:disabled:hover,
.btn.primary:disabled:hover {
  border-color: var(--border);
  background: var(--surface-2);
  filter: grayscale(0.35);
}
.inspect-gate-banner {
  margin: 8px 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.45;
}
.inspect-gate-banner.warn {
  background: rgba(255, 193, 7, 0.12);
  border: 1px solid rgba(255, 193, 7, 0.35);
  color: var(--text);
}
.pill.self-draft {
  background: rgba(148, 163, 184, 0.18);
  color: var(--muted);
  border: 1px solid rgba(148, 163, 184, 0.35);
}

/* ── Footer ──────────────────────────────────────────────── */
.footer {
  display: flex; justify-content: space-between;
  padding: 22px 6px 0;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1100px) {
  .columns { grid-template-columns: 1fr 1fr; }
  .center { grid-column: 1 / -1; order: -1; min-height: 60vh; }
  .pillar { position: static; max-height: none; }
}
@media (max-width: 700px) {
  .columns { grid-template-columns: 1fr; }
  .topbar-status { display: none; }
}

.loading .app { opacity: 0.65; }

/* ── Founder cockpit ─────────────────────────────────────── */
.founder-status-card .system-status-line {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0.25rem 0;
}
.system-status-line.status-healthy { color: var(--ok); }
.system-status-line.status-warning { color: var(--warn); }
.system-status-line.status-critical { color: #dc2626; }
.system-status-detail {
  margin: 0 0 0.75rem;
  color: var(--text-soft);
  font-size: 0.85rem;
}
.waiting-block { margin-bottom: 0.85rem; }
.waiting-label {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.today-card { margin-bottom: 1rem; }
.today-list {
  margin: 0;
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 0.65rem;
}
.today-list li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.65rem;
  align-items: baseline;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.today-rank {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}
.today-title { font-weight: 500; }
.today-confidence {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}
.pipeline-mini { margin-top: 0.75rem; }
.live-action-item {
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}
.live-action-item:last-child { border-bottom: none; }
.live-action-title { margin-bottom: 0.25rem; }
.live-action-why, .live-action-due, .live-action-draft {
  font-size: 0.82rem;
  color: var(--text-soft);
}
.live-action-buttons {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.45rem;
}
.pill.warn { background: var(--warn-bg); color: var(--warn); }

.lineage-explorer {
  margin-top: 0.75rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}
.lineage-title {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.lineage-grid {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 0.25rem 0.75rem;
  margin: 0;
  font-size: 0.86rem;
}
.lineage-grid dt {
  margin: 0;
  color: var(--text-muted);
  font-weight: 500;
}
.lineage-grid dd {
  margin: 0;
  color: var(--text);
  font-weight: 600;
}

.inspect-modal[hidden] { display: none; }
.inspect-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.inspect-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}
.inspect-modal-panel {
  position: relative;
  width: min(820px, 96vw);
  max-height: 90vh;
  overflow: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.approval-preview-panel .inspect-modal-head h4 {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.inspect-head-copy {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-width: 0;
}
.approval-status-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.status-step {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--bg-soft);
}
.status-step.complete {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}
.status-step.active {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  background: color-mix(in srgb, var(--accent) 12%, var(--bg-soft));
}
.approval-preview-pane {
  margin: 0.75rem 0 1rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  background: var(--bg-soft);
  overflow: hidden;
}
.email-preview {
  padding: 1.25rem 1.35rem 1.5rem;
}
.email-preview-row {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 0.65rem 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  font-size: 0.95rem;
}
.email-preview-row:last-of-type {
  border-bottom: none;
}
.email-preview-label {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-top: 0.15rem;
}
.email-preview-value {
  color: var(--text);
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.email-preview-body {
  padding-top: 1rem;
  margin-top: 0.35rem;
  border-top: 1px solid var(--border);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
}
.email-preview-body a {
  color: var(--accent);
  text-decoration: underline;
}
.preview-card {
  padding: 1.15rem 1.25rem;
}
.preview-card h5 {
  margin: 0 0 0.85rem;
  font-size: 1.05rem;
  font-weight: 600;
}
.preview-field {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 0.5rem;
  padding: 0.4rem 0;
  font-size: 0.92rem;
}
.preview-field-label {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
}
.preview-placeholder {
  margin: 0.75rem 0 0;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--warn-bg) 65%, var(--bg-soft));
  color: var(--text-muted);
  font-size: 0.82rem;
}
.approval-preview-actions {
  position: sticky;
  bottom: 0;
  padding-top: 0.75rem;
  margin-top: 0.25rem;
  background: linear-gradient(to top, var(--bg) 75%, transparent);
}
.approval-preview-actions .btn.danger {
  color: var(--danger, #e5484d);
}
.approval-preview-edit {
  margin: 0 0 0.75rem;
  padding: 0.85rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}
.approval-preview-edit label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0.55rem 0 0.25rem;
}
.approval-preview-edit input,
.approval-preview-edit textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.approval-preview-edit textarea {
  min-height: 9rem;
  resize: vertical;
  line-height: 1.5;
}
.inspect-dev-details {
  margin-top: 1rem;
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
}
.inspect-dev-details summary {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.82rem;
  user-select: none;
}
.inspect-dev-tools {
  margin: 0.5rem 0;
}
.inspect-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.inspect-modal-head h4 {
  margin: 0;
  font-size: 1rem;
}
.inspect-modal-summary {
  margin: 0 0 0.5rem;
  color: var(--text);
  font-size: 0.92rem;
}
.inspect-modal-meta {
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.inspect-json {
  margin: 0.75rem 0 0;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 42vh;
  overflow: auto;
}
.live-approval-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.live-approval-row .live-action-buttons {
  margin-top: 0;
}
.pill.proposed {
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  display: inline-block;
  width: fit-content;
}
.pill.not-created {
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  display: inline-block;
  width: fit-content;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pill.created {
  background: var(--ok-bg);
  color: var(--ok);
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  display: inline-block;
  width: fit-content;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.reality-validation-banner {
  margin-bottom: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.4;
}
.reality-validation-banner.warn {
  background: rgba(255, 180, 0, 0.12);
  border: 1px solid var(--warn);
  color: var(--warn);
}
.reality-validation-banner.ok {
  background: rgba(0, 180, 120, 0.1);
  border: 1px solid var(--accent);
  color: var(--text);
}
.reality-badge {
  display: inline-block;
  margin-bottom: 0.5rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.reality-badge.ok {
  background: rgba(0, 180, 120, 0.15);
  border: 1px solid var(--accent);
  color: var(--accent);
}
.reality-badge.warn {
  background: rgba(255, 180, 0, 0.12);
  border: 1px solid var(--warn);
  color: var(--warn);
}
.reality-badge.fail {
  background: rgba(220, 60, 60, 0.12);
  border: 1px solid var(--danger, #dc3c3c);
  color: var(--danger, #dc3c3c);
}
.reality-missing-list {
  margin: 0.35rem 0 0 1.1rem;
  padding: 0;
  font-size: 0.85rem;
}
.reality-validation-header {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}
.reality-validation-header.pass { color: var(--ok); }
.reality-validation-header.fail { color: var(--danger, #c44); }
.reality-validation-header.partial { color: var(--warn); }
.reality-validation-meta {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.35rem;
}
.reality-score {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.25rem;
}
#reality-grounding-card { border-color: var(--accent); }
#reality-grounding-card .loop-value.warn { color: var(--warn); }
  margin: 0.15rem 0;
}
