/* KH Labs Agent Gateway console. Near-black ground, cool white ink, one electric-blue accent.
   Semantic colours (allowed / held / blocked) are used for verdicts and status only. */
:root {
  --bg: #08090b;
  --raise: #101216;
  --s2: #16191e;
  --text: #eef0f3;
  --text-2: #c5c9d0;
  --muted: #8d939c;
  --dim: #858b95;
  --line: rgba(238, 240, 243, .10);
  --line-2: rgba(238, 240, 243, .18);
  --accent: #2f8cff;
  --accent-hi: #5aa5ff;
  --ok: #3ddc97;
  --hold: #f5b942;
  --bad: #ff5c5c;
  --on-accent: #04101f;
  --sans: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --r-c: 6px;
  --r-p: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 13.5px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
.mono { font-family: var(--mono); font-size: .92em; }
.dim { color: var(--dim); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.composer input:focus-visible, .ap-note:focus-visible { outline-offset: 0; }

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

/* ---------------- header ---------------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 56px; flex: none; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mark { width: 26px; height: 26px; flex: none; }
.brand-text { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; font: 500 16px var(--display); letter-spacing: -.02em; }
.brand-product { color: var(--text-2); }
.sep { color: var(--dim); }
.demo-badge { font-size: 12px; color: var(--muted); border-left: 1px solid var(--line-2); padding-left: 12px; white-space: nowrap; }
.top-right { display: flex; align-items: center; gap: 16px; }
.back { font-size: 12.5px; color: var(--accent); white-space: nowrap; }
.pill { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); white-space: nowrap; background: none; border: 0; padding: 0; }
button.pill { cursor: pointer; border-radius: var(--r-c); padding: 4px 6px; margin: 0 -6px; }
button.pill:hover { color: var(--text); background: var(--raise); }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); flex: none; }
.pill.mode.live .dot { background: var(--ok); animation: pulse 2.4s ease-in-out infinite; }
.pill.mode.replay .dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--muted); }
.pill.agent .dot { background: var(--ok); }
.pill.agent.revoked { color: var(--bad); }
.pill.agent.revoked .dot { background: var(--bad); }
.pill.agent.revoked #tokenHint { text-decoration: line-through; }
.pill.policy .pk { color: var(--muted); }
.pill.policy.flash { animation: blink 1.2s ease-out 2; }
@keyframes pulse { 50% { opacity: .35; } }

.kill {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: var(--r-c);
  background: transparent; border: 1px solid var(--bad); color: var(--bad); font-weight: 500; font-size: 12.5px; cursor: pointer; white-space: nowrap;
}
.kill svg { width: 14px; height: 14px; }
.kill:hover { background: rgba(255, 92, 92, .12); }
.kill:active, .kill.press { transform: scale(.96); }
.kill.on { background: var(--bad); color: var(--on-accent); }

.killbar {
  display: flex; align-items: center; gap: 12px; padding: 8px 16px; margin-bottom: 8px; border-radius: var(--r-c);
  background: var(--raise); border: 1px solid var(--bad); color: var(--text); font-size: 12.5px; animation: slideDown .35s var(--ease); flex: none;
}
.killbar svg { width: 16px; height: 16px; flex: none; color: var(--bad); }
.killbar b { color: var(--bad); font-weight: 600; }
.killbar .mono { margin-left: auto; color: var(--muted); }
@keyframes slideDown { from { opacity: 0; transform: translateY(-6px); } }

/* ---------------- controls ---------------- */
.controls { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 8px; flex: none; }
.scen { display: flex; gap: 4px; flex-wrap: wrap; min-width: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: var(--r-c);
  border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 12.5px; white-space: nowrap; position: relative; overflow: hidden; flex: none;
}
.chip:hover { color: var(--text); background: var(--raise); }
.chip .n { font: 500 11px var(--mono); color: var(--dim); }
.chip.active { color: var(--text); background: var(--raise); }
.chip.active .n { color: var(--accent); }
.chip.done .n { color: var(--accent); }
.chip .prog { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--accent); width: 0; }
.ctl-right { display: flex; gap: 8px; align-items: center; flex: none; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 32px; padding: 0 12px;
  border-radius: var(--r-c); border: 1px solid var(--line-2); background: transparent; color: var(--text); cursor: pointer;
  font-size: 12.5px; font-weight: 500; white-space: nowrap;
}
.btn:hover { background: var(--raise); }
.btn:active, .btn.press { transform: scale(.96); }
.btn svg { width: 14px; height: 14px; flex: none; }
.btn.sm { height: 28px; padding: 0 12px; font-size: 12px; }
.btn.ghost { border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { color: var(--text); }
.btn.primary, .btn.accept, .btn.approve { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover, .btn.accept:hover, .btn.approve:hover { background: var(--accent-hi); border-color: var(--accent-hi); }
.btn.deny:hover { border-color: var(--bad); color: var(--bad); background: transparent; }
.btn.on { border-color: var(--bad); color: var(--bad); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.speed { color: var(--muted); font: 12px var(--mono); }

/* ---------------- metrics ---------------- */
.metrics { display: flex; align-items: flex-end; gap: 32px; flex: none; padding: 8px 0 16px; margin-bottom: 0; flex-wrap: wrap; }
.m { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ml { font-size: 12px; color: var(--muted); white-space: nowrap; }
.ml em { font-style: normal; }
.mv { font: 500 22px/1.1 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.mv.mono { font-family: var(--display); font-size: 22px; }
.mv.sm { font: 400 12px var(--sans); letter-spacing: 0; color: var(--muted); gap: 4px; }
.mv b { font: 500 22px/1.1 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.mv .sd { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); flex: none; }
.mv .sd.ok { background: var(--ok); }
.mv .sd.bad { background: var(--bad); animation: pulse 1.2s ease-in-out infinite; }
.mv span { font: 500 16px var(--display); letter-spacing: -.01em; }
.mv.sm span { font: 400 12px var(--sans); }
.m.wide { gap: 6px; min-width: 200px; }
.mix { display: flex; gap: 16px; align-items: baseline; }
.mix .mv.sm { align-items: baseline; }
b.ok { color: var(--ok); } b.hold { color: var(--hold); } b.bad { color: var(--bad); }
.bar { display: flex; height: 3px; border-radius: 3px; overflow: hidden; background: var(--line); }
.bar i { display: block; height: 100%; width: 0; }
.bar i.ok { background: var(--ok); } .bar i.hold { background: var(--hold); } .bar i.bad { background: var(--bad); }
.bump { animation: bump .4s var(--ease); }
@keyframes bump { from { opacity: .45; } }

/* ---------------- grid & panels ---------------- */
.grid { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(270px, 300px) minmax(0, 1fr) minmax(320px, 370px); gap: 16px; }
.side { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 16px; min-height: 0; }
.panel { background: transparent; border: 1px solid var(--line); border-radius: var(--r-p); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.panel.mid { background: var(--raise); border-color: var(--line-2); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 48px; padding: 8px 16px; border-bottom: 1px solid var(--line); flex: none; }
.tabs-head { padding: 8px 8px; }
.ph-title { display: flex; align-items: center; gap: 8px; font: 500 14px var(--display); letter-spacing: -.02em; color: var(--text-2); }
.ph-meta { color: var(--dim); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-icon { display: none; }
.badge-count { font: 400 12px var(--mono); color: var(--muted); }
.badge-count.on { color: var(--hold); }
.jb { font: 500 11px var(--mono); color: var(--bad); border: 1px solid var(--bad); padding: 1px 6px; border-radius: 4px; white-space: nowrap; }

/* tabs */
.tabs { display: flex; gap: 4px; height: 100%; align-items: stretch; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 0 8px; background: none; border: 0; cursor: pointer; color: var(--muted); font: 500 13px var(--sans); position: relative; white-space: nowrap; }
.tabs-head .tabs { height: calc(100% + 8px); margin-bottom: -8px; }
.tabs-head .tab { padding-bottom: 8px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); }
.tab::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: 0; height: 2px; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .25s var(--ease); }
.tab.active::after { transform: scaleX(1); }
.mid .tab { font-size: 14px; font-weight: 500; padding: 0 12px; }
.mid .tab::after { left: 12px; right: 12px; }
.tb { font: 400 12px var(--mono); color: var(--muted); }
.tb.hot { color: var(--hold); }
.tb.good { color: var(--ok); }
.tb.badv { color: var(--bad); }
.tabpanes { flex: 1; min-height: 0; position: relative; }
.pane { position: absolute; inset: 0; display: flex; flex-direction: column; opacity: 0; pointer-events: none; transform: translateY(4px); transition: opacity .2s var(--ease), transform .2s var(--ease); }
.pane.active { opacity: 1; pointer-events: auto; transform: none; }

/* ---------------- chat ---------------- */
.msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.empty-chat { margin: auto 0; }
.ec-title { margin: 0 0 4px; font: 500 15px var(--display); letter-spacing: -.01em; }
.ec-sub { margin: 0; color: var(--muted); font-size: 12.5px; }
.msg { max-width: 92%; padding: 8px 12px; border-radius: var(--r-p); animation: rise .35s var(--ease); white-space: pre-wrap; word-wrap: break-word; font-size: 13px; }
.msg.user { align-self: flex-end; background: var(--raise); border: 1px solid var(--line); }
.msg.agent { align-self: flex-start; padding-left: 0; padding-right: 0; }
.msg.agent::before { content: "Agent"; display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.msg.system { align-self: center; max-width: 100%; text-align: center; font-size: 12px; color: var(--muted); padding: 4px 0; }
.msg.system.warn { color: var(--bad); }
.msg.system.good { color: var(--ok); }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 11.5px; margin: 8px 0 0; animation: rise .35s var(--ease); }
.caption { align-self: center; text-align: center; color: var(--muted); font-size: 12px; max-width: 92%; animation: rise .35s var(--ease); }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.thinking { display: flex; align-items: center; gap: 4px; padding: 0 16px 8px; color: var(--muted); font-size: 12px; }
.thinking span { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); }
.thinking em { font-style: normal; margin-left: 8px; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); flex: none; }
.composer input { flex: 1; min-width: 0; height: 36px; padding: 0 12px; border-radius: var(--r-c); background: var(--bg); border: 1px solid var(--line-2); outline: none; }
.composer input:focus { border-color: var(--accent); }
.composer input::placeholder { color: var(--dim); }
.composer input:disabled { color: var(--text-2); }
.composer button { width: 36px; height: 36px; border-radius: var(--r-c); border: 0; background: var(--accent); color: var(--on-accent); cursor: pointer; display: grid; place-items: center; }
.composer button svg { width: 16px; height: 16px; }
.composer button:disabled { background: var(--s2); color: var(--dim); cursor: default; }
.composer button.press { transform: scale(.9); }

/* ---------------- stream ---------------- */
.pipeline-legend { display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; flex: none; }
.pipeline-legend i { width: 12px; height: 1px; background: var(--line-2); }
.lg-r { margin-left: auto; font: 12px var(--mono); color: var(--muted); }
.cards { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.empty { margin: auto; text-align: center; color: var(--muted); max-width: 320px; font-size: 12.5px; }
.empty.small { margin: 0; padding: 16px; text-align: left; max-width: none; color: var(--muted); }
.empty-art { display: flex; justify-content: center; gap: 12px; margin-bottom: 12px; font: 12px var(--mono); color: var(--dim); }
.empty-art span + span::before { content: "/"; margin-right: 12px; color: var(--line-2); }
.empty .btn { margin-top: 16px; }

.card { border: 1px solid var(--line); border-radius: var(--r-p); background: var(--s2); padding: 16px; animation: cardIn .4s var(--ease); position: relative; overflow: hidden; flex: none; }
.card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 2px; background: var(--line-2); }
.card.allowed::before { background: var(--ok); } .card.held::before { background: var(--hold); } .card.blocked::before { background: var(--bad); }
.card.scan::after { content: ""; position: absolute; left: 0; top: 0; height: 2px; width: 100%; background: var(--accent); opacity: .5; pointer-events: none; }
@keyframes cardIn { from { opacity: 0; transform: translateY(-8px); } }
.c-top { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.svc { font: 400 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); flex: none; }
.tool { font: 500 14px var(--mono); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-meta { margin-left: auto; color: var(--dim); font: 11px var(--mono); white-space: nowrap; }
.args { margin-top: 8px; font: 12px/1.55 var(--mono); color: var(--text-2); background: var(--bg); border-radius: var(--r-c); padding: 8px 12px; white-space: pre-wrap; word-break: break-word; max-height: 76px; overflow: hidden; }
.args .k { color: var(--muted); } .args .s { color: var(--text); } .args .n { color: var(--text); }
.args .bad { color: var(--bad); text-decoration: underline wavy var(--bad); text-underline-offset: 3px; }
.pipe { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 16px; }
.st { position: relative; padding-right: 12px; min-width: 0; }
.st-row { display: flex; align-items: center; gap: 8px; }
.st-ico { width: 8px; height: 8px; border-radius: 50%; display: block; flex: none; background: var(--line-2); font-size: 0; }
.st-ico svg { display: none; }
.st-line { flex: 1; height: 1px; background: var(--line-2); position: relative; overflow: hidden; }
.st-line::after { content: ""; position: absolute; inset: 0; transform: scaleX(0); transform-origin: left; background: var(--ok); transition: transform .4s var(--ease); }
.st.pass .st-line::after { transform: scaleX(1); }
.st-name { font-size: 12px; font-weight: 500; color: var(--muted); }
.st-detail { overflow-wrap: anywhere; margin-top: 4px; padding-left: 16px; font-size: 11.5px; color: var(--muted); line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; min-height: 16px; }
.st.run .st-ico { background: transparent; box-shadow: inset 0 0 0 1.5px var(--accent); animation: pulse 1s ease-in-out infinite; }
.st.run .st-name { color: var(--text); }
.st.pass .st-ico { background: var(--ok); }
.st.pass .st-name { color: var(--text); }
.st.fail .st-ico { background: var(--bad); }
.st.fail .st-name, .st.fail .st-detail { color: var(--bad); }
.st.hold .st-ico { background: var(--hold); }
.st.hold .st-name, .st.hold .st-detail { color: var(--hold); }
.st.skip { opacity: .5; } .st.skip .st-ico { background: transparent; box-shadow: inset 0 0 0 1px var(--dim); }
.verdict { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 12px; font-size: 12.5px; animation: rise .35s var(--ease); min-width: 0; }
.verdict .tag { font: 600 12px var(--sans); letter-spacing: .08em; flex: none; }
.verdict .why { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.verdict .lat { font: 11.5px var(--mono); color: var(--muted); flex: none; }
.verdict.allowed .tag { color: var(--ok); } .verdict.held .tag { color: var(--hold); } .verdict.blocked .tag { color: var(--bad); }
.rule { font: 11.5px var(--mono); color: var(--text); background: var(--bg); border-radius: 4px; padding: 1px 6px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.rule:hover { color: var(--accent); }
.result { margin-top: 8px; font: 11.5px/1.5 var(--mono); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result .mask { color: var(--text); text-decoration: underline dotted var(--accent); text-underline-offset: 3px; }
.result b { color: var(--text-2); font-weight: 500; }

/* risk gauge */
.gauge { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.gauge svg { width: 34px; height: 20px; overflow: visible; }
.gauge .g-bg { stroke: var(--line-2); }
.gauge .g-fg { transition: stroke-dashoffset .8s var(--ease); }
.gauge .g-n { font: 500 12px var(--mono); }
.gauge .g-l { font: 11px var(--sans); color: var(--muted); }
.gauge.lg svg { width: 60px; height: 34px; }
.gauge.lg .g-n { font: 500 20px var(--display); }

/* ---------------- red team ---------------- */
.rt, .sh { flex: 1; overflow-y: auto; padding: 16px; }
.rt-head { display: flex; align-items: center; gap: 24px; padding: 0 0 16px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.ring { width: 76px; height: 76px; flex: none; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .r-bg { stroke: var(--line); }
.ring .r-fg { stroke: var(--ok); transition: stroke-dashoffset .5s var(--ease); }
.ring .r-n { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font: 500 20px/1.05 var(--display); letter-spacing: -.02em; }
.ring .r-n small { display: block; font: 400 10.5px var(--sans); color: var(--muted); letter-spacing: 0; }
.rt-title { font: 500 20px var(--display); letter-spacing: -.02em; }
.rt-sub { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.tally { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.tl { font: 500 12px var(--sans); letter-spacing: 0; }
.oc-BLOCKED { color: var(--bad); }
.oc-HELD { color: var(--hold); }
.oc-MASKED { color: var(--ok); }
.oc-NO_EFFECT, .oc-REFUSED { color: var(--muted); }
.oc-LEAKED, .oc-ERROR { color: var(--on-accent); background: var(--bad); padding: 0 6px; border-radius: 4px; }
.oc-PENDING { color: var(--dim); }
.rt-row { display: grid; grid-template-columns: 24px minmax(0, 1.3fr) 88px minmax(0, 1fr); gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.rt-row .i { font: 11px var(--mono); color: var(--dim); }
.rt-row .nm { min-width: 0; }
.rt-row .nm b { font-weight: 500; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rt-row .nm span { color: var(--muted); font-size: 11.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rt-row .oc { justify-self: start; }
.rt-row .why { min-width: 0; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.rt-row .why span { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.rt-row .why .rule { color: var(--text); }
.rt-row.pending { opacity: .5; }
.rt-row.pending .oc { animation: pulse 1.1s ease-in-out infinite; }
.rt-row.landed { animation: rise .35s var(--ease); }
.llm-tag { font: 500 10px var(--mono); color: var(--muted); border: 1px solid var(--line-2); border-radius: 4px; padding: 0 4px; margin-left: 8px; vertical-align: 1px; }

/* ---------------- shadow ---------------- */
.sh-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.sh-k { font-size: 12px; color: var(--muted); }
.sh-vs { display: flex; align-items: center; gap: 8px; margin-top: 4px; font: 14px var(--mono); }
.sh-vs .arrow { color: var(--dim); }
.sh-vs .cand { color: var(--accent); }
.sh-head { font: 500 20px/1.3 var(--display); letter-spacing: -.02em; margin: 16px 0 4px; }
.sh-sub { color: var(--muted); font-size: 12px; }
.mtx { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 16px 0; align-content: start; align-items: start; }
.mt { border-top: 1px solid var(--line-2); padding-top: 8px; animation: rise .4s var(--ease) both; }
.mt .n { font: 500 28px/1.1 var(--display); letter-spacing: -.02em; }
.mt .l { font-size: 12px; color: var(--muted); margin-top: 4px; }
.mt .l b { font-weight: 500; color: var(--text-2); }
.mt .l code { font: 11px var(--mono); }
.mt.up .n { color: var(--ok); } .mt.down .n { color: var(--bad); } .mt.amber .n { color: var(--hold); }
.ydiff { font: 12px/1.6 var(--mono); background: var(--bg); border-radius: var(--r-c); padding: 8px 0; overflow-x: auto; }
.ydiff div { padding: 0 12px; white-space: pre; }
.ydiff .a { background: rgba(61, 220, 151, .1); color: var(--ok); } .ydiff .d { background: rgba(255, 92, 92, .1); color: var(--bad); } .ydiff .h { color: var(--muted); }
.sh-sec { margin: 24px 0 8px; font: 500 13px var(--display); color: var(--text-2); letter-spacing: -.01em; }
.ch-row { display: grid; grid-template-columns: 76px 72px minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12px; animation: rise .35s var(--ease) both; }
.ch-row .amt { font: 500 12.5px var(--mono); }
.ch-row .tier { color: var(--muted); }
.ch-row .r { font: 11px var(--mono); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-row .r.to { color: var(--text); }
.sh-act { position: sticky; bottom: -16px; margin: 16px -16px -16px; padding: 12px 16px; background: var(--raise); border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }
.sh-act .note { color: var(--muted); font-size: 12px; margin-right: auto; }
.sh-done { margin-top: 16px; padding: 12px 0 0; border-top: 1px solid var(--line); font-size: 12.5px; animation: rise .35s var(--ease); }
.sh-done.accepted b { color: var(--ok); font-weight: 600; }
.sh-done.rejected { color: var(--text-2); }

/* ---------------- approvals ---------------- */
.approvals { max-height: 56vh; }
.ap-list { overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.ap { border: 1px solid rgba(245, 185, 66, .4); background: var(--raise); border-radius: var(--r-c); padding: 12px; animation: cardIn .4s var(--ease); flex: none; }
.ap-top { display: flex; align-items: baseline; gap: 8px; }
.ap-id { font: 11px var(--mono); color: var(--dim); margin-left: auto; }
.ap-main { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 4px; }
.ap-amt { font: 500 26px/1.1 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ap-cust { font-size: 12px; color: var(--text-2); }
.ap-cust .tier { font: 400 11px var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-left: 8px; }
.ap-stats { display: flex; gap: 24px; margin: 12px 0; }
.ap-stats b { display: block; font: 500 15px var(--display); letter-spacing: -.01em; }
.ap-stats span { font-size: 11px; color: var(--muted); }
.ap-quote { font-size: 12px; color: var(--text-2); border-left: 1px solid var(--line-2); padding: 0 0 0 12px; margin: 8px 0; }
.ap-quote em { color: var(--muted); font-style: normal; font-size: 11px; display: block; }
.ap-why { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; font-size: 12px; color: var(--hold); }
.ap-note { width: 100%; margin-top: 12px; resize: none; height: 34px; padding: 8px 12px; font-size: 12px; border-radius: var(--r-c); background: var(--bg); border: 1px solid var(--line-2); outline: none; }
.ap-note:focus { border-color: var(--accent); }
.ap-note::placeholder { color: var(--dim); }
.ap-act { display: flex; gap: 8px; margin-top: 8px; }
.ap-act .btn { flex: 1; }
.ap.resolved { border-color: var(--line-2); background: transparent; }
.ap.resolved .ap-act, .ap.resolved .ap-note, .ap.resolved .ap-stats, .ap.resolved .ap-quote { display: none; }
.ap-status { margin-top: 8px; font: 500 12px var(--sans); letter-spacing: .04em; }
.ap-status.approved { color: var(--ok); } .ap-status.denied, .ap-status.expired { color: var(--bad); }
.ap-status em { display: block; font: 12px var(--sans); color: var(--text-2); letter-spacing: 0; margin-top: 4px; }

/* ---------------- audit ---------------- */
.au-tools { display: flex; align-items: center; gap: 4px; padding: 8px 12px; border-bottom: 1px solid var(--line); flex: none; }
.verify { margin: 8px 12px 0; padding: 8px 12px; border-radius: var(--r-c); font-size: 12px; display: block; line-height: 1.45; animation: rise .3s var(--ease); flex: none; background: var(--raise); }
.verify.run { color: var(--text-2); }
.verify.ok { border: 1px solid var(--line-2); color: var(--text); } .verify.ok b { color: var(--ok); }
.verify.bad { border: 1px solid var(--bad); color: var(--text); } .verify.bad b { color: var(--bad); }
.verify .mono { float: right; margin-left: 8px; color: var(--muted); font-size: 11px; }
.audit-list { flex: 1; overflow-y: auto; font: 11.5px/1.45 var(--mono); margin-top: 4px; }
.au { display: grid; grid-template-columns: 24px 58px minmax(0, 1fr) auto; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); align-items: start; position: relative; }
.au::before { content: ""; position: absolute; inset: 0; background: var(--accent); opacity: 0; pointer-events: none; animation: auIn .8s var(--ease); }
@keyframes auIn { from { opacity: .16; } }
.au .seq { color: var(--dim); } .au .ts { color: var(--muted); }
.au .body { min-width: 0; }
.au .t, .au .r, .au .h { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.au .t { color: var(--text); }
.au .r { color: var(--muted); font-family: var(--sans); font-size: 12px; }
.au .h { color: var(--dim); font-size: 10.5px; }
.au .d { font: 500 11px var(--sans); text-transform: capitalize; text-align: right; display: block; }
.au .d.allowed, .au .d.approved, .au .d.restored, .au .d.promoted { color: var(--ok); }
.au .d.held { color: var(--hold); }
.au .d.blocked, .au .d.denied, .au .d.revoked { color: var(--bad); }
.au .lat { display: block; color: var(--dim); font-size: 10.5px; text-align: right; margin-top: 4px; }
.au.chk .seq { color: var(--ok); }
.au.chk { box-shadow: inset 2px 0 0 var(--ok); }
.au.broken { box-shadow: inset 2px 0 0 var(--bad); }
.au.broken .seq { color: var(--bad); }
.au.edited .r, .au.edited .t { color: var(--bad); }
.au.edited::after { content: "edited"; position: absolute; right: 12px; bottom: 6px; font: 500 10px var(--sans); color: var(--bad); }

/* ---------------- policy ---------------- */
.pol { flex: 1; overflow: auto; padding: 8px 0; font: 12px/1.65 var(--mono); }
.pol-h { padding: 4px 16px 8px; color: var(--muted); font: 12px var(--sans); display: flex; gap: 8px; align-items: center; }
.pol-h code { font: 11px var(--mono); color: var(--text-2); }
.pl { display: grid; grid-template-columns: 36px 1fr; padding-right: 12px; }
.pl .ln { color: var(--dim); text-align: right; padding-right: 12px; user-select: none; }
.pl .tx { white-space: pre; color: var(--text-2); }
.pl .tx .c { color: var(--dim); } .pl .tx .k { color: var(--text); } .pl .tx .v { color: var(--muted); }
.pl.hit { background: rgba(47, 140, 255, .1); box-shadow: inset 2px 0 0 var(--accent); }
.pl.chg { background: rgba(47, 140, 255, .08); box-shadow: inset 2px 0 0 var(--accent); }

/* ---------------- footer / toast ---------------- */
.foot { display: flex; justify-content: space-between; gap: 16px; padding-top: 12px; color: var(--muted); font-size: 12px; flex: none; }
.foot b { color: var(--text-2); font-weight: 500; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px); opacity: 0; pointer-events: none; background: var(--s2); border: 1px solid var(--line-2); padding: 8px 16px; border-radius: var(--r-c); font-size: 12.5px; transition: opacity .25s var(--ease), transform .25s var(--ease); z-index: 20; max-width: calc(100vw - 32px); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(238, 240, 243, .12); border-radius: 9px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(238, 240, 243, .22); }

/* ---------------- responsive ---------------- */
@media (max-width: 1280px) {
  .grid { grid-template-columns: minmax(250px, 290px) minmax(0, 1fr); }
  .side { grid-column: 1 / -1; grid-template-rows: none; grid-template-columns: 1fr 1fr; min-height: 380px; }
  .approvals { max-height: none; }
  .app { height: auto; }
  .grid { min-height: 760px; }
}
@media (max-width: 1100px) and (min-width: 861px) {
  .demo-badge { display: none; }
}
@media (max-width: 860px) {
  .app { height: auto; min-height: 0; padding: 0 16px 24px; }
  .top { height: auto; padding: 16px 0 8px; flex-wrap: wrap; row-gap: 12px; }
  .brand { flex-wrap: wrap; row-gap: 4px; }
  .demo-badge { border-left: 0; padding-left: 0; white-space: normal; flex-basis: 100%; }
  .top-right { width: 100%; flex-wrap: wrap; gap: 8px 16px; }
  .kill { margin-left: auto; }
  .controls { flex-direction: column; align-items: stretch; gap: 8px; }
  .scen { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .scen::-webkit-scrollbar { display: none; }
  .ctl-right { flex-wrap: wrap; }
  .metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 16px 0; }
  .m.wide { grid-column: 1 / -1; order: -1; min-width: 0; }
  .mix { flex-wrap: wrap; gap: 8px 16px; }
  .grid { display: flex; flex-direction: column; min-height: 0; gap: 16px; }
  .mid { order: 0; height: 640px; }
  .chat { order: 1; height: 400px; }
  .side { order: 2; display: flex; flex-direction: column; min-height: 0; }
  .approvals { max-height: 520px; }
  .right-tabs { height: 460px; }
  .pipeline-legend > span:not(.lg-r), .pipeline-legend > i { display: none; }
  .pipe { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 12px; }
  .c-top { flex-wrap: wrap; row-gap: 4px; }
  .c-meta { margin-left: 0; flex-basis: 100%; order: 3; }
  .verdict { flex-wrap: wrap; row-gap: 8px; }
  .verdict .why { flex-basis: 100%; order: 3; white-space: normal; }
  .verdict .lat { margin-left: auto; }
  .st-detail { -webkit-line-clamp: 3; }
  .rt-row { grid-template-columns: 20px minmax(0, 1fr) 84px; }
  .rt-row .why { grid-column: 2 / -1; }
  .rt-head { gap: 16px; }
  .mtx { grid-template-columns: repeat(2, 1fr); }
  .sh-top { flex-direction: column; }
  .sh-top > div:last-child { text-align: left !important; }
  .sh-top .sh-vs { justify-content: flex-start !important; }
  .ch-row { grid-template-columns: 72px minmax(0, 1fr); }
  .ch-row .r { grid-column: 1 / -1; }
  .sh-act { flex-wrap: wrap; }
  .sh-act .note { flex-basis: 100%; }
  .foot { flex-direction: column; gap: 4px; }
  .killbar { flex-wrap: wrap; }
  .tab { padding: 0 8px; font-size: 12.5px; }
  .mid .tab { font-size: 13px; padding: 0 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
