:root {
  color-scheme: dark;
  --bg: #0b0e13;
  --panel: rgba(19, 24, 33, 0.88);
  --panel-soft: rgba(24, 30, 41, 0.7);
  --line: rgba(167, 183, 207, 0.15);
  --muted: #8590a4;
  --text: #f4f6fb;
  --accent: #a6f16e;
  --accent-2: #70d9ff;
  --warning: #ffca72;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background: radial-gradient(circle at 15% 0%, #1a2b2d 0, transparent 34rem), var(--bg);
}
.noise { position: fixed; inset: 0; pointer-events: none; opacity: .035; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.45'/%3E%3C/svg%3E"); }
.app-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 58px 0 80px; }
.topbar { display: flex; justify-content: space-between; gap: 32px; align-items: flex-start; margin-bottom: 34px; }
.eyebrow, .section-kicker { margin: 0 0 10px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .18em; }
h1, h2, p { margin-top: 0; }
h1 { max-width: 700px; margin-bottom: 12px; font-size: clamp(32px, 5vw, 58px); line-height: .98; letter-spacing: -.055em; }
.lede { max-width: 600px; margin-bottom: 0; color: var(--muted); font-size: 15px; line-height: 1.7; }
.runtime-pill { display: flex; align-items: center; gap: 9px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 999px; color: #c7d0de; background: rgba(255,255,255,.035); font-size: 12px; white-space: nowrap; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 14px var(--accent); }
.workspace { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(300px, .7fr); gap: 18px; align-items: start; }
.chat-card, .metric-card, .control-card, .pattern-card { border: 1px solid var(--line); background: var(--panel); box-shadow: 0 24px 70px rgba(0,0,0,.22); backdrop-filter: blur(18px); }
.chat-card { min-height: 650px; border-radius: 25px; overflow: hidden; }
.card-heading { display: flex; justify-content: space-between; align-items: center; padding: 23px 25px 18px; border-bottom: 1px solid var(--line); }
.card-heading.compact { padding: 0 0 18px; border-bottom: 0; }
h2 { margin-bottom: 0; font-size: 19px; letter-spacing: -.02em; }
.live-state { color: var(--accent); font-family: ui-monospace, SFMono-Regular, monospace; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.live-state.busy { color: var(--warning); }
.messages { height: 450px; padding: 26px 25px; overflow-y: auto; }
.message-row { display: flex; margin-bottom: 16px; animation: rise .25s ease-out both; }
.message-row.user { justify-content: flex-end; }
.message-bubble, .decision-bubble { max-width: min(78%, 550px); border-radius: 17px; padding: 13px 16px; font-size: 14px; line-height: 1.6; }
.message-row.bot .message-bubble { color: #d8dfeb; border: 1px solid var(--line); background: var(--panel-soft); }
.message-row.user .message-bubble { color: #10150e; background: var(--accent); border-bottom-right-radius: 5px; }
.intro-row .message-bubble { color: #aeb9ca; font-size: 13px; }
.decision-row { justify-content: flex-start; }
.decision-bubble { min-width: min(82%, 430px); border: 1px solid rgba(166,241,110,.35); background: linear-gradient(135deg, rgba(42,66,43,.82), rgba(19,30,31,.9)); border-bottom-left-radius: 5px; }
.decision-header, .confidence-line, .metric-line, .contract-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.decision-kind, .decision-time { color: var(--accent); font-family: ui-monospace, SFMono-Regular, monospace; font-size: 11px; text-transform: uppercase; }
.decision-time { color: var(--accent-2); }
.decision-value { margin: 7px 0 12px; font-size: 30px; font-weight: 800; letter-spacing: -.05em; }
.reply-text { margin: 10px 0 14px; color: #f2f7ee; font-size: 18px; font-weight: 650; line-height: 1.55; letter-spacing: -.02em; }
.confidence-line { justify-content: flex-start; color: #9bacaf; font-family: ui-monospace, SFMono-Regular, monospace; font-size: 11px; }
.confidence-line strong { color: var(--text); }
.confidence-bar { width: 86px; height: 4px; overflow: hidden; border-radius: 9px; background: rgba(255,255,255,.14); }
.confidence-bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.decision-explanation { margin: 13px 0 0; color: #bfceca; font-size: 12px; line-height: 1.6; }
.reply-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 14px; padding-top: 10px; border-top: 1px solid rgba(166,241,110,.16); color: #91a79e; font-family: ui-monospace, SFMono-Regular, monospace; font-size: 10px; }
.reply-meta strong { color: #d8f0d0; font-weight: 600; }
.memory-badge { padding: 4px 6px; border: 1px solid rgba(255,255,255,.15); border-radius: 5px; color: #b9c8d5; }
.memory-badge.candidate { color: var(--accent); border-color: rgba(166,241,110,.35); }
.memory-badge.forget { color: var(--warning); border-color: rgba(255,202,114,.35); }
.composer { margin: 0 18px 18px; padding: 13px; border: 1px solid var(--line); border-radius: 17px; background: rgba(5,8,12,.4); }
textarea, select { width: 100%; color: var(--text); border: 0; outline: 0; background: transparent; font: inherit; }
textarea { resize: vertical; min-height: 64px; padding: 3px 2px; line-height: 1.5; }
textarea::placeholder { color: #667185; }
.composer-footer { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-top: 8px; }
.hint { color: #68758b; font-size: 11px; }
button { font: inherit; cursor: pointer; }
.send-button { padding: 10px 15px; color: #11170e; border: 0; border-radius: 10px; background: var(--accent); font-size: 12px; font-weight: 800; }
.send-button span { margin-left: 5px; font-size: 16px; }
button:disabled, textarea:disabled { cursor: wait; opacity: .55; }
.side-column { display: grid; gap: 18px; }
.metric-card, .control-card, .pattern-card { border-radius: 20px; padding: 21px; }
.accent-card { border-color: rgba(112,217,255,.23); background: linear-gradient(145deg, rgba(22,46,54,.82), var(--panel)); }
.metric-value { margin: 5px 0 0; color: var(--accent-2); font-size: 55px; font-weight: 800; letter-spacing: -.08em; line-height: 1; }
.metric-label { margin: 7px 0 22px; color: var(--muted); font-size: 12px; }
.metric-line { padding-top: 11px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.metric-line + .metric-line { margin-top: 11px; }
.metric-line strong { color: var(--text); font-family: ui-monospace, SFMono-Regular, monospace; font-weight: 500; }
.quick-actions { display: grid; gap: 8px; }
.quick-button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; color: var(--text); text-align: left; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.025); transition: border-color .2s, background .2s, transform .2s; }
.quick-button:hover { border-color: rgba(166,241,110,.55); background: rgba(166,241,110,.06); transform: translateY(-1px); }
.quick-icon { display: grid; place-items: center; width: 28px; height: 28px; color: var(--accent); border-radius: 9px; background: rgba(166,241,110,.1); font-weight: 800; }
.quick-button strong, .quick-button small { display: block; }
.quick-button strong { font-size: 12px; }
.quick-button small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.select-label { display: block; margin: 20px 0 7px; color: var(--muted); font-size: 11px; }
select { padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #151b25; font-size: 12px; }
.reset-button { width: 100%; margin-top: 10px; padding: 10px; color: #aab5c5; border: 1px solid var(--line); border-radius: 10px; background: transparent; font-size: 12px; }
.reset-button:hover { color: var(--text); border-color: rgba(255,255,255,.35); }
.contract-row { padding: 9px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.contract-row strong { color: var(--text); font-family: ui-monospace, SFMono-Regular, monospace; font-size: 11px; font-weight: 500; }
.contract-note { margin: 15px 0 0; color: #78859a; font-size: 11px; line-height: 1.65; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@keyframes rise { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 820px) {
  .app-shell { width: min(100% - 24px, 640px); padding-top: 30px; }
  .topbar { display: block; }
  .runtime-pill { display: inline-flex; margin-top: 18px; }
  .workspace { grid-template-columns: 1fr; }
  .chat-card { min-height: 0; }
  .messages { height: 390px; }
}
