/* KH Labs Agent Gateway console on the shared design system (/kh-system.css loads first).
   Rounded system: panels 20px, cards 14px, chips and buttons pill. Amber only for held / blocked.
   Semantic colours (allowed / held / blocked) are used for verdicts and status only.
   --s1..--s4 are spacing tokens in the shared file, so surface colours live in --sf1/--sf2 here. */
:root {
  --raise: var(--bg);
  --text: var(--ink); --text-2: var(--mute); --muted: var(--mute); --line-2: var(--line2);
  --accent: var(--ink); --accent-hi: #ffffff;
  --hold: var(--acc); --bad: var(--acc); --on-accent: #000;
  --display: var(--sans); --ease: var(--out);
  --r-c: var(--r-pill); --r-p: var(--r2);
}

button, input, textarea { font: inherit; color: inherit; }
.app a { color: var(--accent); text-decoration: none; }
.app a:hover { text-decoration: underline; text-underline-offset: 3px; }
.mono { font-family: var(--mono); font-size: 1em; }
.dim { color: var(--dim); }
[hidden] { display: none !important; }
.composer input:focus-visible, .ap-note:focus-visible { outline-offset: 0; }
.app { display: flex; flex-direction: column; height: calc(100vh - var(--nav-h)); min-height: 680px; padding: 0 var(--pad) var(--sp4); max-width: calc(var(--wrap) + 2 * var(--pad)); margin: 0 auto; font: 400 14px/1.5 var(--sans); color: var(--text); }

/* ---------------- header ---------------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 56px; flex: none; }
.top .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: 13.5px; 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; }

.pill { display: inline-flex; align-items: center; gap: 8px; font-size: 13.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 10px; margin: 0 -10px; transition: color var(--t-fast), background-color var(--t-fast); }
button.pill:hover { color: var(--text); background: var(--hover); }
.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); }
button.pill:focus-visible { outline: 0; box-shadow: var(--ring); }
.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: 36px; padding: 0 16px; border-radius: var(--r-pill);
  background: transparent; border: 0; box-shadow: inset 0 0 0 1px var(--line-2); color: var(--text); font-weight: 500; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: transform .3s var(--spring), background-color var(--t-fast), box-shadow var(--t-fast);
}
.kill svg { width: 14px; height: 14px; }
.kill:hover { background: rgb(255 255 255 / .06); box-shadow: inset 0 0 0 1px var(--line3); transform: translateY(-1px); }
.kill:active, .kill.press { transform: scale(.97); transition-duration: .08s; }
.kill:focus-visible { outline: 0; box-shadow: var(--ring); }
.kill.on { background: var(--bad); color: #1a1204; box-shadow: none; }

.killbar {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 8px; border-radius: var(--r2);
  background: var(--raise); border: 1px solid var(--bad); color: var(--text); font-size: 13.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: 6px; height: 36px; padding: 0 10px; border-radius: var(--r-c);
  border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 13.5px; transition: color var(--t-fast), background-color var(--t-fast); white-space: nowrap; position: relative; overflow: hidden; flex: none;
}
.chip:hover { color: var(--text); background: var(--hover); }
.chip .n { font: 500 13.5px var(--mono); color: var(--dim); }
.chip.active { color: #000; background: var(--ink); }
.chip.active .n { color: #000; }
.chip.done .n { color: var(--accent); }
.chip:focus-visible { outline: 0; box-shadow: var(--ring); }
.chip .prog { position: absolute; left: 10px; right: 10px; bottom: 0; height: 2px; background: var(--accent); width: 0; }
.ctl-right { display: flex; gap: 8px; align-items: center; flex: none; }
/* buttons: the shared .btn pill (kh-system.css) with compact, scoped variants */
.app .btn { height: 36px; padding: 0 16px; font-size: 14px; background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.app .btn:hover { background: rgb(255 255 255 / .06); box-shadow: inset 0 0 0 1px var(--line3); }
.app .btn.press { transform: scale(.97); }
.app .btn.sm { height: 32px; padding: 0 14px; font-size: 13.5px; }
.app .btn.ghost { box-shadow: none; color: var(--text-2); }
.app .btn.ghost:hover { color: var(--text); box-shadow: none; }
.app .btn.primary, .app .btn.accept, .app .btn.approve { background: var(--accent); color: var(--on-accent); box-shadow: none; font-weight: 500; } /* same weight as its hairline pair (Deny/Approve, founder 11-13) */
.app .btn.primary:hover, .app .btn.accept:hover, .app .btn.approve:hover { background: var(--accent-hi); box-shadow: none; }
.app .btn.deny:hover { box-shadow: inset 0 0 0 1px var(--line3); color: var(--text); background: rgb(255 255 255 / .06); }
.app .btn.on { box-shadow: inset 0 0 0 1px var(--bad); color: var(--bad); }
.app .btn:focus-visible { box-shadow: inset 0 0 0 1px var(--line3), var(--ring); }
.speed { color: var(--muted); font: 13.5px 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: 13.5px; 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 13.5px 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 13.5px 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: 4px; border-radius: var(--r-pill); 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(240px, 264px) minmax(0, 1fr) minmax(300px, 328px); gap: var(--gap); }
.side { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: var(--gap); min-height: 0; }
.panel { background: transparent; border: 1px solid var(--line); border-radius: var(--r); 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: 52px; padding: 8px 20px; border-bottom: 1px solid var(--line); flex: none; }
.tabs-head { padding: 8px 12px; }
.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: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-icon { display: none; }
.badge-count { font: 400 13.5px var(--mono); color: var(--muted); }
.badge-count.on { color: var(--hold); }
.jb { font: 500 13.5px var(--mono); color: var(--bad); border: 1px solid var(--bad); padding: 2px 10px; border-radius: var(--r-pill); white-space: nowrap; }
/* while the jailbreak badge shows, it takes the place of the run label so the header never wraps or clips */
.ph-title { white-space: nowrap; }
.jb:not([hidden]) + .ph-meta { display: none; }

/* 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 13.5px 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 13.5px var(--mono); color: var(--muted); }
.t-short { display: none; }
.tb.hot { color: var(--hold); }
.tb.good { color: var(--ok); }
.tb.badv { color: var(--bad); }
.tabpanes { flex: 1; min-height: 0; position: relative; }
/* inactive panes are out of layout (not just transparent): hidden text is not read by screen readers or counted as page text */
.pane { position: absolute; inset: 0; display: none; flex-direction: column; }
.pane.active { display: flex; animation: paneIn .2s var(--ease); }
@keyframes paneIn { from { opacity: 0; transform: translateY(4px); } }

/* ---------------- 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: 13.5px; }
.msg { max-width: 92%; padding: 8px 14px; border-radius: var(--r2); animation: rise .35s var(--ease); white-space: pre-wrap; word-wrap: break-word; font-size: 13.5px; }
.msg.user { align-self: flex-end; background: transparent; border: 0; border-radius: 0; padding: 4px 0 4px 14px; text-align: right; color: var(--text); }
.msg.agent { align-self: flex-start; padding-left: 0; padding-right: 0; }
.msg.agent::before { content: "Agent"; display: block; font-size: 13.5px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.msg.system { align-self: center; max-width: 100%; text-align: center; font-size: 13.5px; 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: 13.5px; margin: 8px 0 0; animation: rise .35s var(--ease); }
.caption { align-self: center; text-align: center; color: var(--muted); font-size: 13.5px; 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: 13.5px; }
.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: 16px; border-top: 1px solid var(--line); flex: none; }
.composer input { flex: 1; min-width: 0; height: 40px; padding: 0 16px; 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: 40px; height: 40px; 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(--bg); 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: 13.5px; flex: none; white-space: nowrap; min-width: 0; }
.pipeline-legend i { width: 12px; height: 1px; background: var(--line-2); }
.lg-r { margin-left: auto; font: 13.5px 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: 13.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: 13.5px 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(--r2); background: var(--bg); 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 13.5px 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: 13.5px var(--mono); white-space: nowrap; }
.args { margin-top: 8px; font: 13.5px/1.55 var(--mono); color: var(--text-2); background: var(--bg); border-radius: var(--r3); 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: 13.5px; font-weight: 500; color: var(--muted); }
.st-detail { overflow-wrap: break-word; margin-top: 4px; padding-left: 16px; font-size: 13.5px; color: var(--muted); line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -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); }
/* not reached: its own class name, because ".skip" is the shared skip-link (absolute, white) in kh-system.css */
.st.nr { opacity: .5; } .st.nr .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: 13.5px; animation: rise .35s var(--ease); min-width: 0; }
.verdict .tag { height: 24px; padding: 0 10px; border-radius: var(--r-pill); font: 600 13.5px var(--mono); letter-spacing: .06em; flex: none; box-shadow: none; }
.verdict .why { color: var(--text-2); min-width: 0; flex: 1; overflow-wrap: break-word; }
.verdict .lat { font: 13.5px var(--mono); color: var(--muted); flex: none; }
.verdict.allowed .tag { color: var(--ink); box-shadow: inset 0 0 0 1px rgb(255 255 255 / .34); }
.verdict.held .tag { color: var(--hold); box-shadow: inset 0 0 0 1px var(--hold); }
.verdict.blocked .tag { color: var(--acc-ink); background: var(--bad); }
.rule { font: 13.5px/1.45 var(--mono); color: var(--text); background: var(--bg); border-radius: 6px; padding: 1px 8px; cursor: pointer; max-width: 100%; overflow-wrap: break-word; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.rule:hover { color: var(--accent); }
.result { margin-top: 8px; font: 13.5px/1.5 var(--mono); color: var(--muted); white-space: normal; overflow-wrap: anywhere; }
.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 13.5px var(--mono); }
.gauge .g-l { font: 13.5px 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; align-content: center; text-align: center; font: 500 20px/1.05 var(--display); letter-spacing: -.02em; }
.ring .r-n small { display: block; font: 400 13.5px/1.2 var(--sans); margin-top: 2px; color: var(--muted); letter-spacing: 0; }
.rt-title { font: 500 20px var(--display); letter-spacing: -.02em; }
.rt-sub { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.tally { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.tl { font: 500 13.5px 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: #1a1204; background: var(--bad); padding: 0 8px; border-radius: var(--r-pill); }
.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: 13.5px; }
.rt-row .i { font: 13.5px var(--mono); color: var(--dim); }
.rt-row .nm { min-width: 0; }
.rt-row .nm b { font-weight: 500; display: block; }
.rt-row .nm span { color: var(--muted); font-size: 13.5px; display: block; overflow-wrap: break-word; }
.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: 13.5px; max-width: 100%; overflow-wrap: break-word; }
.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 13.5px var(--mono); color: var(--muted); border: 1px solid var(--line-2); border-radius: var(--r-pill); padding: 0 8px; 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: 13.5px; 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-rec { text-align: right; } .sh-rec .sh-vs { justify-content: flex-end; }
.sh-head { font: 500 20px/1.3 var(--display); letter-spacing: -.02em; margin: 16px 0 4px; }
.sh-sub { color: var(--muted); font-size: 13.5px; }
.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: 13.5px; color: var(--muted); margin-top: 4px; }
.mt .l b { font-weight: 500; color: var(--text-2); }
.mt .l code { font: 13.5px var(--mono); }
.mt.up .n { color: var(--ok); } .mt.down .n { color: var(--bad); } .mt.amber .n { color: var(--hold); }
.ydiff { font: 13.5px/1.6 var(--mono); background: var(--bg); border-radius: var(--r3); padding: 8px 0; overflow-x: auto; }
.ydiff div { padding: 0 12px; white-space: pre-wrap; overflow-wrap: break-word; }
.ydiff .a { background: rgb(255 255 255 / .05); color: var(--ok); } .ydiff .d { background: rgb(242 181 68 / .1); color: var(--bad); } .ydiff .h { color: var(--muted); }
.sh-sec { margin: 24px 0 8px; font: 500 13.5px var(--display); color: var(--text-2); letter-spacing: -.01em; }
.ch-row { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 4px 16px; align-items: start; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; animation: rise .35s var(--ease) both; }
.ch-row .what b { display: block; font: 500 13.5px var(--mono); overflow-wrap: break-word; }
.ch-row .what span { color: var(--muted); }
.ch-row .rules { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ch-row .r { font: 13.5px/1.45 var(--mono); color: var(--muted); overflow-wrap: break-word; }
.ch-row .r.to { color: var(--text); }
.ch-row .r.to::before { content: "\2192  "; color: var(--dim); }
.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: 13.5px; margin-right: auto; }
.sh-done { margin-top: 16px; padding: 12px 0 0; border-top: 1px solid var(--line); font-size: 13.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: none; }
.ap-list { overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; max-height: 34vh; }
.ap { border: 1px solid rgb(242 181 68 / .45); background: var(--raise); border-radius: var(--r2); padding: 16px; animation: cardIn .4s var(--ease); flex: none; }
.ap-top { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.ap-top .svc { display: none; }
.ap-top .tool { font: 500 13.5px var(--mono); min-width: 0; overflow-wrap: break-word; }
.ap-id { font: 13.5px 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: 13.5px; color: var(--text-2); }
.ap-cust .tier { font: 400 13.5px 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: 13.5px; color: var(--muted); }
.ap-quote { font-size: 13.5px; 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: 13.5px; display: block; }
.ap-why { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; font-size: 13.5px; color: var(--hold); }
.ap-note { width: 100%; margin-top: 12px; resize: none; height: 40px; padding: 8px 12px; font-size: 13.5px; border-radius: 12px; 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 13.5px 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: 13.5px var(--sans); color: var(--text-2); letter-spacing: 0; margin-top: 4px; }

/* ---------------- audit ---------------- */
.au-tools { display: flex; flex-wrap: wrap; 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(--r3); font-size: 13.5px; 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: 13.5px; }
.audit-list { flex: 1; overflow-y: auto; font: 13.5px/1.45 var(--mono); margin-top: 4px; }
.au { display: grid; grid-template-columns: 24px auto minmax(0, 1fr); gap: 2px 12px; padding: 8px 12px; border-bottom: 1px solid var(--line); align-items: baseline; position: relative; }
.au .seq { grid-column: 1; grid-row: 1; } .au .ts { grid-column: 2; grid-row: 1; }
.au .end { grid-column: 3; grid-row: 1; display: flex; justify-content: flex-end; align-items: baseline; gap: 12px; }
.au .body { grid-column: 2 / -1; grid-row: 2; }
.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 { display: block; overflow-wrap: break-word; }
.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: 13.5px; }
.au .h { color: var(--dim); font-size: 13.5px; }
.au .d { font: 500 13.5px var(--sans); text-transform: capitalize; }
.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 { color: var(--dim); font-size: 13.5px; }
.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 .h::after { content: " \00b7  edited"; font: 500 13.5px var(--sans); color: var(--bad); }

/* ---------------- policy ---------------- */
.pol { flex: 1; overflow: auto; padding: 8px 0; font: 13.5px/1.65 var(--mono); }
.pol-h { padding: 4px 16px 8px; color: var(--muted); font: 13.5px var(--sans); display: flex; gap: 8px; align-items: center; }
.pol-h code { font: 13.5px 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: rgb(242 181 68 / .07); box-shadow: inset 2px 0 0 var(--accent); }
.pl.chg { background: rgb(255 255 255 / .05); 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: 13.5px; 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(--bg); border: 1px solid var(--line-2); padding: 10px 18px; border-radius: var(--r2); font-size: 13.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(255, 255, 255, .12); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(255, 255, 255, .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; }
  .ap-list { max-height: 520px; }
  .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 var(--pad) var(--sp5); }
  .top { height: auto; padding: 16px 0 8px; flex-wrap: wrap; row-gap: 12px; }
  .top .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 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 4px; }
  .scen .chip { justify-content: flex-start; }
  .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; }
  .ch-row { grid-template-columns: minmax(0, 1fr); }
  .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: 13.5px; }
  .mid .tab { font-size: 13.5px; padding: 0 8px; }
  .mid .tabs-head { padding: 8px 6px; }
  .mid .tabs { gap: 0; }
  .mid .tab { padding: 0 6px; gap: 6px; }
  .mid .tab::after { left: 6px; right: 6px; }
  .t-full { display: none; } .t-short { display: inline; }
  .sh-rec { text-align: left; } .sh-rec .sh-vs { justify-content: flex-start; }
}

.top .page-title { font: 600 15px var(--display); letter-spacing: -.01em; color: var(--text); white-space: nowrap; }

.wrap > p { max-width: 56ch; }
/* footer demo list: the demo name stays on one line; only its result line wraps */
.ft__demos a{white-space:nowrap}.ft__demos a span{white-space:normal}

/* shared footer (design/partials/footer.html): the legal links sit in one span */
.ft__ln{display:inline-flex;flex-wrap:wrap;gap:8px 24px}

/* ---------------- review fixes 12 Nov, round 2 ---------------- */
/* a stage's rule text wraps in full: no 3-line clamp that cuts "refunds.max_any_usd = $5,000 → BLOCKED" */
.st-detail{display:block;-webkit-line-clamp:unset;overflow:visible}
/* phones: the replay panels come first, the metrics after them */
@media (max-width:720px){
  .metrics{order:2}
  .foot{order:3}
}/* the approval count stays on one line: '0 waiting · 1 approved' */
.badge-count{white-space:nowrap}
