/* ==========================================================
   CLAIMFAST — Agentic claim auditor
   Dark glass console. No framework, no build step.
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg-dark: #090d16;
  --bg-card: rgba(17, 24, 39, .7);
  --bg-solid: #111827;
  --bg-raise: rgba(255, 255, 255, .03);
  --border-color: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .16);
  --primary: #4f46e5;
  --primary-glow: rgba(79, 70, 229, .15);
  --secondary: #06b6d4;
  --accent: #f43f5e;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;
  --success: #10b981;
  --info: #38bdf8;
  --warning: #f59e0b;
  --danger: #fb7185;
  --critical: #f43f5e;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --radius: 16px;
  --radius-sm: 10px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Plus Jakarta Sans', ui-sans-serif, system-ui, sans-serif;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

/* Class-based display rules below outrank the UA sheet, so `hidden` needs teeth. */
[hidden] { display: none !important; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong); border-radius: 8px;
  border: 3px solid transparent; background-clip: content-box;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  background-image:
    radial-gradient(circle at 10% 20%, rgba(79, 70, 229, .12) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(6, 182, 212, .1) 0%, transparent 45%);
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.55;
  font-size: 14px;
  padding: 20px;
}

.shell { max-width: 1240px; margin: 0 auto; }

/* ── header ────────────────────────────────────────────── */

.masthead {
  display: flex; flex-wrap: wrap; gap: 16px;
  align-items: center; justify-content: space-between;
  padding-bottom: 18px; margin-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 40px; height: 40px; flex: none; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  box-shadow: 0 8px 24px var(--primary-glow);
  font-weight: 800; font-size: 18px; color: #fff;
}
.brand h1 {
  font-size: 20px; font-weight: 800; letter-spacing: -.02em;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.brand p { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

.pill {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; padding: 3px 8px; border-radius: 6px;
  background: rgba(79, 70, 229, .16); color: #a5b4fc;
  border: 1px solid rgba(79, 70, 229, .4);
}

.health { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.health-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 11px; color: var(--text-muted);
  background: var(--bg-solid); border: 1px solid var(--border-color);
  padding: 5px 10px; border-radius: 999px;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-dim); flex: none; }
.dot.on { background: var(--success); box-shadow: 0 0 8px rgba(16, 185, 129, .7); }
.dot.off { background: var(--accent); }

/* ── nav ───────────────────────────────────────────────── */

.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 20px; }
.tab {
  appearance: none; cursor: pointer;
  background: transparent; border: 1px solid transparent;
  color: var(--text-muted); font-size: 13px; font-weight: 600;
  padding: 8px 14px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; gap: 8px;
  transition: all .18s ease;
}
.tab:hover { color: var(--text-main); background: var(--bg-raise); }
.tab.active { color: #fff; background: rgba(79, 70, 229, .18); border-color: rgba(79, 70, 229, .45); }
.tab .count {
  font-family: var(--mono); font-size: 10px; padding: 1px 6px;
  border-radius: 999px; background: rgba(255, 255, 255, .1);
}

.view { display: none; }
.view.active { display: block; animation: rise .25s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── panels ────────────────────────────────────────────── */

.panel {
  background: var(--bg-card);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, .37);
  padding: 20px;
  margin-bottom: 16px;
}
.panel-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.panel-head h2 { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.panel-head .sub { font-size: 12px; color: var(--text-muted); }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ── controls ──────────────────────────────────────────── */

.btn {
  appearance: none; cursor: pointer; font: inherit; font-weight: 600; font-size: 13px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-color); background: var(--bg-raise); color: var(--text-main);
  display: inline-flex; align-items: center; gap: 8px;
  transition: all .18s ease;
}
.btn:hover:not(:disabled) { border-color: var(--border-strong); background: rgba(255, 255, 255, .07); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(135deg, var(--primary), #6366f1);
  border-color: transparent; color: #fff;
  box-shadow: 0 6px 20px var(--primary-glow);
}
.btn.primary:hover:not(:disabled) { filter: brightness(1.1); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: rgba(244, 63, 94, .35); }
.btn.small { padding: 5px 10px; font-size: 12px; }

.form-row { display: flex; flex-direction: column; gap: 5px; }
.form-row label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.form-input, .form-select {
  width: 100%; font: inherit; font-size: 13px; color: var(--text-main);
  background: var(--bg-solid); border: 1px solid var(--border-color);
  border-radius: 8px; padding: 8px 10px;
}
.form-input:focus, .form-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.form-select option { background: var(--bg-solid); }
.hint { font-size: 11px; color: var(--text-dim); }

.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input {
  appearance: none; width: 38px; height: 21px; border-radius: 999px;
  background: rgba(255, 255, 255, .12); position: relative; cursor: pointer;
  transition: background .2s; flex: none;
}
.switch input::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 15px; height: 15px; border-radius: 50%; background: #fff; transition: transform .2s;
}
.switch input:checked { background: var(--primary); }
.switch input:checked::after { transform: translateX(17px); }
.switch span { font-size: 13px; }

/* ── upload ────────────────────────────────────────────── */

.dropzone {
  border: 2px dashed var(--border-strong); border-radius: var(--radius);
  padding: 44px 24px; text-align: center; cursor: pointer;
  transition: all .2s ease; background: rgba(255, 255, 255, .015);
}
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: var(--primary-glow); }
.dropzone h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.dropzone p { font-size: 13px; color: var(--text-muted); }
.dropzone .icon { font-size: 30px; display: block; margin-bottom: 10px; }

.filelist { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.fileitem {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--bg-solid); border: 1px solid var(--border-color);
}
.fileitem .name { font-weight: 600; font-size: 13px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fileitem .meta { font-family: var(--mono); font-size: 11px; color: var(--text-muted); flex: none; }
.fileicon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: rgba(79, 70, 229, .16); font-size: 14px; flex: none; }

/* ── document tray ─────────────────────────────────────── */

.traygrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.traycard {
  background: var(--bg-solid); border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); padding: 14px;
}
.traycard.warn { border-color: rgba(245, 158, 11, .45); }
.traycard h4 { font-size: 13px; font-weight: 700; margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.traycard .sub { font-size: 11px; color: var(--text-muted); margin-bottom: 10px; font-family: var(--mono); }
.traycard .summary { font-size: 12px; color: var(--text-muted); margin-top: 8px; }

.meter { height: 4px; border-radius: 999px; background: rgba(255, 255, 255, .08); overflow: hidden; margin-top: 8px; }
.meter i { display: block; height: 100%; border-radius: 999px; background: var(--secondary); }

/* ── live console ──────────────────────────────────────── */

.console {
  font-family: var(--mono); font-size: 12px; line-height: 1.75;
  background: #05070d; border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); padding: 14px 16px;
  height: 420px; overflow-y: auto;
}
.logline { display: flex; gap: 10px; padding: 1px 0; }
.logline .ts { color: var(--text-dim); flex: none; }
.logline .tag { flex: none; font-weight: 700; min-width: 92px; }
.logline .msg { color: var(--text-muted); word-break: break-word; }
.logline.info .tag { color: var(--secondary); }
.logline.good .tag { color: var(--success); }
.logline.warn .tag { color: var(--warning); }
.logline.bad .tag { color: var(--accent); }
.logline.stage .tag { color: #fff; }
.logline.stage .msg { color: #fff; font-weight: 600; }

.stagelist { display: flex; flex-direction: column; gap: 6px; }
.stagerow {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 8px;
  background: var(--bg-solid); border: 1px solid var(--border-color);
  font-size: 12px;
}
.stagerow .label { flex: 1; }
.stagerow .status { font-family: var(--mono); font-size: 11px; color: var(--text-dim); }
.stagerow.running { border-color: rgba(79, 70, 229, .5); }
.stagerow.running .status { color: var(--secondary); }
.stagerow.done .status { color: var(--success); }
.stagerow.failed { border-color: rgba(244, 63, 94, .4); }
.stagerow.failed .status { color: var(--accent); }
.spin {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .15); border-top-color: var(--secondary);
  animation: spin .7s linear infinite; flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── score ─────────────────────────────────────────────── */

.verdictgrid { display: grid; gap: 20px; grid-template-columns: minmax(220px, 260px) 1fr; align-items: center; }
@media (max-width: 720px) { .verdictgrid { grid-template-columns: 1fr; } }

.gauge { position: relative; width: 100%; max-width: 240px; margin: 0 auto; }
.gauge svg { width: 100%; height: auto; display: block; transform: rotate(-90deg); }
.gauge .readout { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.gauge .rate { font-size: 44px; font-weight: 800; line-height: 1; letter-spacing: -.03em; }
.gauge .rate sup { font-size: 20px; font-weight: 700; margin-left: 2px; }
.gauge .caption { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; margin-top: 6px; }

.tone-success { color: var(--success); }
.tone-info { color: var(--info); }
.tone-warning { color: var(--warning); }
.tone-danger { color: var(--danger); }
.tone-critical { color: var(--critical); }

.bandlabel { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.stats { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin-top: 16px; }
.stat { background: var(--bg-solid); border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 12px; }
.stat .k { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); }
.stat .v { font-size: 19px; font-weight: 700; margin-top: 2px; }
.stat .v small { font-size: 12px; font-weight: 500; color: var(--text-muted); }

/* ── findings ──────────────────────────────────────────── */

.finding {
  background: var(--bg-solid); border: 1px solid var(--border-color);
  border-left: 3px solid var(--text-dim);
  border-radius: var(--radius-sm); padding: 14px; margin-bottom: 10px;
}
.finding.sev-low { border-left-color: var(--info); }
.finding.sev-medium { border-left-color: var(--warning); }
.finding.sev-high { border-left-color: var(--danger); }
.finding.sev-blocker { border-left-color: var(--critical); }
.finding.resolved { opacity: .55; }

.finding-head { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.finding-head .title { font-weight: 700; font-size: 14px; flex: 1; min-width: 200px; }
.finding-head .rid { font-family: var(--mono); font-size: 11px; color: var(--text-dim); }
.badge {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  padding: 2px 7px; border-radius: 5px; border: 1px solid currentColor; flex: none;
}
.badge.low { color: var(--info); }
.badge.medium { color: var(--warning); }
.badge.high { color: var(--danger); }
.badge.blocker { color: var(--critical); background: rgba(244, 63, 94, .1); }
.badge.neutral { color: var(--text-muted); }

.evidence {
  font-family: var(--mono); font-size: 11.5px; color: var(--text-muted);
  background: rgba(0, 0, 0, .35); border-radius: 8px; padding: 9px 11px; margin-top: 10px;
  overflow-x: auto; white-space: pre-wrap; word-break: break-word;
}
.finding .why, .finding .fix { font-size: 12.5px; color: var(--text-muted); margin-top: 8px; }
.finding .fix { color: var(--text-main); }
.finding .fix b, .finding .why b { color: var(--text-muted); font-weight: 700; }
.finding-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; align-items: center; }
.verdict-mark { font-size: 12px; font-weight: 700; }
.verdict-mark.confirmed { color: var(--success); }
.verdict-mark.dismissed { color: var(--text-dim); }

/* ── tables ────────────────────────────────────────────── */

.tablewrap { overflow-x: auto; border: 1px solid var(--border-color); border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 640px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border-color); }
th { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); background: rgba(255, 255, 255, .02); font-weight: 700; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255, 255, 255, .02); }
td.num, th.num { text-align: right; font-family: var(--mono); }
tfoot td { font-weight: 700; border-top: 1px solid var(--border-strong); }

/* ── knowledge base ────────────────────────────────────── */

.kbfilters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.rulecard {
  background: var(--bg-solid); border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); padding: 13px; margin-bottom: 8px;
}
.rulecard.proposed { border-color: rgba(6, 182, 212, .4); }
.rulecard h4 { font-size: 13px; font-weight: 700; }
.rulecard .rid { font-family: var(--mono); font-size: 11px; color: var(--text-dim); }
.rulecard .q { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.rulestats { display: flex; gap: 12px; flex-wrap: wrap; font-family: var(--mono); font-size: 11px; color: var(--text-dim); margin-top: 8px; }
.rulestats b { color: var(--text-muted); }

/* ── settings ──────────────────────────────────────────── */

.agentrow {
  display: grid; gap: 10px; align-items: end;
  grid-template-columns: minmax(150px, 1.3fr) minmax(110px, .8fr) minmax(160px, 1.2fr) 92px 100px;
  padding: 12px; border-radius: var(--radius-sm);
  background: var(--bg-solid); border: 1px solid var(--border-color); margin-bottom: 8px;
}
@media (max-width: 900px) { .agentrow { grid-template-columns: 1fr 1fr; } }
.agentrow .who h4 { font-size: 13px; font-weight: 700; }
.agentrow .who p { font-size: 11px; color: var(--text-muted); }

/* ── misc ──────────────────────────────────────────────── */

.notice {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 12.5px; padding: 11px 14px; border-radius: var(--radius-sm);
  background: rgba(56, 189, 248, .08); border: 1px solid rgba(56, 189, 248, .28);
  color: #bae6fd; margin-bottom: 14px;
}
.notice.warn { background: rgba(245, 158, 11, .09); border-color: rgba(245, 158, 11, .32); color: #fde68a; }
.notice.bad { background: rgba(244, 63, 94, .09); border-color: rgba(244, 63, 94, .32); color: #fecdd3; }
.notice b { font-weight: 700; }

.empty { text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: 13px; }
.empty .icon { font-size: 28px; display: block; margin-bottom: 8px; opacity: .7; }

.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast {
  background: var(--bg-solid); border: 1px solid var(--border-strong);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm); padding: 11px 15px; font-size: 13px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .5); animation: rise .2s ease;
  max-width: 340px;
}
.toast.good { border-left-color: var(--success); }
.toast.bad { border-left-color: var(--accent); }
.toast.warn { border-left-color: var(--warning); }

.demo-banner {
  font-size: 12px; padding: 6px 12px; border-radius: 999px;
  background: rgba(6, 182, 212, .12); border: 1px solid rgba(6, 182, 212, .35);
  color: #a5f3fc; display: inline-flex; align-items: center; gap: 8px;
}

footer { color: var(--text-dim); font-size: 11.5px; text-align: center; padding: 24px 0 8px; }
footer a { color: var(--text-muted); }

/* ==========================================================
   PIPELINE CANVAS
   A node graph of the audit. Node positions are set inline by
   js/ui/flow.js from the column/row in pipeline.js — the same
   arithmetic that draws the wires, so the two cannot drift.
   ========================================================== */

.flowpanel { display: flex; flex-direction: column; }

.flowsplit {
  display: grid; grid-template-columns: minmax(0, 1fr) 380px;
  gap: 16px; align-items: stretch;
}
@media (max-width: 1100px) { .flowsplit { grid-template-columns: 1fr; } }

.flowviewport {
  overflow: auto; cursor: grab; border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); background:
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, .07) 1px, transparent 0) 0 0 / 22px 22px,
    rgba(9, 13, 22, .55);
  height: 620px; position: relative;
}
.flowviewport.panning { cursor: grabbing; user-select: none; }
.flowstage { position: relative; }
.flowcanvas { position: relative; transform-origin: 0 0; }

.flow-wires { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.wire {
  fill: none; stroke: var(--border-strong); stroke-width: 1.6;
  transition: stroke .25s, stroke-width .25s;
}
.wire.done { stroke: rgba(16, 185, 129, .55); }
.wire.live { stroke: var(--secondary); stroke-width: 2.4; stroke-dasharray: 6 6; animation: wiredash 1s linear infinite; }
@keyframes wiredash { to { stroke-dashoffset: -12; } }

.flownode {
  position: absolute; background: var(--bg-solid);
  border: 1px solid var(--border-color); border-left: 3px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 10px 12px; cursor: pointer;
  display: flex; flex-direction: column; gap: 2px; overflow: hidden;
  transition: border-color .2s, box-shadow .2s, transform .12s;
}
.flownode:hover { transform: translateY(-1px); border-color: var(--border-strong); }
.flownode:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.flownode.selected { box-shadow: 0 0 0 2px var(--primary), 0 10px 26px rgba(0, 0, 0, .5); }
.flownode.off { opacity: .45; }

.flownode.agent { border-left-color: var(--primary); }
.flownode.code  { border-left-color: var(--secondary); }
.flownode.human { border-left-color: var(--warning); }

.flownode-head { display: flex; align-items: center; gap: 7px; }
.flownode .kindicon { font-size: 11px; color: var(--text-dim); }
.flowlabel {
  font-size: 12.5px; font-weight: 700; flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.flowdot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-dim); flex: none; }
.flowsub, .flowstat {
  font-family: var(--mono); font-size: 10.5px; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.flowstat { color: var(--text-muted); }

.flownode[data-state="running"] { border-color: var(--secondary); }
.flownode[data-state="running"] .flowdot { background: var(--secondary); animation: pulse 1s ease-in-out infinite; }
.flownode[data-state="done"] .flowdot { background: var(--success); }
.flownode[data-state="waiting"] { border-color: var(--warning); }
.flownode[data-state="waiting"] .flowdot { background: var(--warning); animation: pulse 1.4s ease-in-out infinite; }
.flownode[data-state="error"] { border-color: var(--critical); }
.flownode[data-state="error"] .flowdot { background: var(--critical); }
@keyframes pulse { 50% { opacity: .3; } }

.zoomer { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11px; color: var(--text-muted); }
.zoomer .btn { min-width: 30px; justify-content: center; }

.flowlegend {
  display: flex; gap: 16px; flex-wrap: wrap; align-items: center;
  margin-top: 12px; font-size: 11px; color: var(--text-dim);
}
.flowlegend i.lg { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.flowlegend .idle { background: var(--text-dim); }
.flowlegend .running { background: var(--secondary); }
.flowlegend .waiting { background: var(--warning); }
.flowlegend .done { background: var(--success); }
.flowlegend .error { background: var(--critical); }

/* ── the node inspector ─────────────────────────────────── */

.inspector {
  border: 1px solid var(--border-color); border-radius: var(--radius-sm);
  background: var(--bg-raise); padding: 16px; overflow-y: auto;
  height: 620px; display: flex; flex-direction: column; gap: 12px;
}
@media (max-width: 1100px) { .inspector { height: auto; max-height: 560px; } }

.inspector-head { display: flex; align-items: center; gap: 10px; }
.inspector-head h3 { font-size: 15px; font-weight: 700; }
.inspector-head .sub { font-family: var(--mono); font-size: 11px; color: var(--text-dim); }
.inspector-head .switch { margin-left: auto; }
.inspector-head .kindicon { font-size: 15px; color: var(--primary); }
.inspector-head .kindicon.code { color: var(--secondary); }
.inspector-head .kindicon.human { color: var(--warning); }

.inspector-note { font-size: 12.5px; color: var(--text-muted); }
.inspector .grid { gap: 12px; }
.inspector .grid.two { grid-template-columns: 1fr 1fr; }

.prompt-head { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.prompt-head h4 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }

.promptbox {
  font-family: var(--mono); font-size: 11.5px; line-height: 1.6;
  resize: vertical; min-height: 200px; width: 100%;
}

.contract { border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 10px 12px; }
.contract summary { cursor: pointer; font-size: 11.5px; color: var(--text-muted); font-weight: 600; }
.contract pre {
  font-family: var(--mono); font-size: 10.5px; line-height: 1.55; color: var(--text-dim);
  white-space: pre-wrap; word-break: break-word; margin: 10px 0;
  max-height: 260px; overflow: auto;
}

.lastrun { border-top: 1px solid var(--border-color); padding-top: 12px; margin-top: 4px; }
.lastrun h4 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
