/* Version 0.9.9-compact — Text/Audio as top tabs, optional perf strip, condensed chrome */
:root {
  --bg: #f6f7fb;
  --bg-grad: radial-gradient(1200px 600px at 80% -10%, #e8ecff 0%, rgba(232,236,255,0) 60%),
             radial-gradient(1000px 500px at -10% 0%, #e3f6ff 0%, rgba(227,246,255,0) 55%);
  --surface: #ffffff; --surface-2: #f0f3f9; --surface-3: #e7ecf5;
  --text: #141a24; --muted: #64707f; --line: #e2e8f1; --line-strong: #d2dbe8;
  --accent: #4f46e5; --accent-2: #0ea5a4; --accent-soft: #eef0ff;
  --good: #12915f; --warn: #b7791f; --danger: #d64545;
  --user-bubble: #4f46e5; --user-text: #fff;
  --shadow-sm: 0 1px 2px rgba(20,26,36,.06), 0 1px 3px rgba(20,26,36,.05);
  --shadow: 0 12px 30px rgba(28,42,71,.10);
  --radius: 14px; --radius-sm: 10px;
  --mono: "SFMono-Regular", ui-monospace, Consolas, "Liberation Mono", monospace;
  --sans: Inter, "Segoe UI", system-ui, "Noto Sans", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg:#0c0f16; --bg-grad: radial-gradient(1200px 600px at 82% -12%, #1a2140 0%, rgba(26,33,64,0) 60%), radial-gradient(1000px 520px at -10% 0%, #0d2f38 0%, rgba(13,47,56,0) 58%);
  --surface:#141924; --surface-2:#1b2230; --surface-3:#232c3d; --text:#e8edf5; --muted:#94a2b5; --line:#263041; --line-strong:#334055;
  --accent:#8b8bff; --accent-2:#2dd4bf; --accent-soft:#1e2340; --good:#34d399; --warn:#fbbf24; --danger:#f87171; --user-bubble:#4f46e5;
  --shadow: 0 16px 40px rgba(0,0,0,.45); color-scheme: dark;
} }
:root[data-theme="dark"] {
  --bg:#0c0f16; --bg-grad: radial-gradient(1200px 600px at 82% -12%, #1a2140 0%, rgba(26,33,64,0) 60%), radial-gradient(1000px 520px at -10% 0%, #0d2f38 0%, rgba(13,47,56,0) 58%);
  --surface:#141924; --surface-2:#1b2230; --surface-3:#232c3d; --text:#e8edf5; --muted:#94a2b5; --line:#263041; --line-strong:#334055;
  --accent:#8b8bff; --accent-2:#2dd4bf; --accent-soft:#1e2340; --good:#34d399; --warn:#fbbf24; --danger:#f87171; --user-bubble:#4f46e5;
  --shadow: 0 16px 40px rgba(0,0,0,.45); color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
html, body { margin: 0; height: 100%; overflow: hidden; max-width: 100%; }
body { font-family: var(--sans); background: var(--bg); background-image: var(--bg-grad); background-attachment: fixed; color: var(--text);
  -webkit-font-smoothing: antialiased; display: flex; flex-direction: column; height: 100vh; height: 100dvh; padding: 0 clamp(14px,2.4vw,32px); max-width: none; margin: 0; width: 100%; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, p { margin: 0; }

.topbar-progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 50; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transform: scaleX(0); transform-origin: left; opacity: 0; transition: opacity .2s; }
.topbar-progress.active { opacity: 1; animation: indet 1.1s ease-in-out infinite; }
@keyframes indet { 0%{transform:scaleX(0);transform-origin:left;} 50%{transform:scaleX(.7);} 100%{transform:scaleX(1);transform-origin:right;opacity:.3;} }

/* topbar */
.topbar { display: flex; align-items: center; gap: 12px; padding: 8px 0 7px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 32px; height: 32px; flex: 0 0 auto; display: block; border-radius: 9px; box-shadow: var(--shadow-sm); }
.brand-text { min-width: 0; }
h1 { font-size: clamp(15px,1.8vw,18px); font-weight: 750; letter-spacing: -.02em; line-height: 1.1; }
.sub { color: var(--muted); font-size: 11.5px; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabs { display: flex; align-items: center; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; padding: 3px; margin: 0 auto; }
.tab-sep { width: 1px; align-self: stretch; margin: 5px 4px; background: var(--line-strong); }
.t-ico { margin-right: 5px; font-size: 11.5px; opacity: .8; }
.tab { border: none; background: transparent; color: var(--muted); padding: 6px 14px; border-radius: 8px; font-size: 13px; white-space: nowrap; font-weight: 650; cursor: pointer; transition: all .15s; }
.tab:hover { color: var(--text); }
.tab.is-active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); }
.perf-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-sm); font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; user-select: none; white-space: nowrap; }
.perf-toggle:hover { color: var(--text); border-color: var(--line-strong); }
.perf-toggle input { width: 14px; height: 14px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.perf-toggle:has(input:checked) { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.perf-toggle .t-short { display: none; }
body:not([data-view="text"]) .perf-toggle { visibility: hidden; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; margin-left: auto; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-sm); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.chip-status.ok .dot { background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 22%, transparent); }
.chip-status.bad .dot { background: var(--danger); }
.icon-btn { width: 32px; height: 32px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 16px; display: grid; place-items: center; box-shadow: var(--shadow-sm); transition: transform .1s, background .15s; }
.icon-btn:hover { background: var(--surface-2); } .icon-btn:active { transform: scale(.94); }

.view { display: flex; flex-direction: column; gap: 10px; flex: 1 1 auto; min-width: 0; min-height: 0; width: 100%; }
/* dashboard & history scroll internally; each playground pane owns its own overflow */
#view-dashboard, #view-history, #view-config { overflow-y: auto; overflow-x: hidden; padding-bottom: 16px; }
/* natural-height content that scrolls — do NOT let the flex column shrink panels to fit (was clipping GPU cards) */
#view-dashboard > *, #view-history > *, #view-config > * { flex-shrink: 0; }

.playground-pane { flex: 1 1 auto; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
#playground-audio { overflow-y: auto; overflow-x: hidden; padding-bottom: 16px; }
#playground-audio > * { flex-shrink: 0; }

/* metrics */
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; flex: 0 0 auto; }
.dash-metrics { grid-template-columns: repeat(6, 1fr); }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 13px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.metric-accent::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: linear-gradient(var(--accent), var(--accent-2)); }
.metric-label { display: block; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.metric-value { display: block; margin-top: 6px; font-size: clamp(19px,2.2vw,25px); font-weight: 720; letter-spacing: -.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.metric-value.flash { animation: flash .5s ease; } @keyframes flash { 0%{color:var(--accent-2);} 100%{color:var(--text);} }
.metric-unit { display: block; margin-top: 6px; font-size: 11px; color: var(--muted); }
/* playground perf strip: one ~36px line instead of four ~100px cards */
#perfStrip { display: flex; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-sm); overflow: hidden; }
#perfStrip .metric { flex: 1 1 0; min-width: 0; display: flex; align-items: baseline; gap: 8px; padding: 7px 14px; background: none; border: 0; border-left: 1px solid var(--line); border-radius: 0; box-shadow: none; white-space: nowrap; }
#perfStrip .metric:first-child { border-left: 0; }
#perfStrip .metric-accent::before { width: 2px; }
#perfStrip .metric-label { font-size: 10px; flex: 0 0 auto; }
#perfStrip .metric-value { margin: 0; font-size: 16px; flex: 0 0 auto; }
#perfStrip .metric-unit { margin: 0; font-size: 11px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* chat — FIXED height, internal scroll */
.chat-shell { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.chat { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; padding: 14px clamp(12px,2.4vw,22px); display: flex; flex-direction: column; gap: 14px; }
.empty-state { margin: auto; text-align: center; max-width: 440px; color: var(--muted); padding: 20px 0; }
.empty-glyph { font-size: 28px; width: 60px; height: 60px; margin: 0 auto 14px; border-radius: 18px; display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); border: 1px solid var(--line); }
.empty-state h2 { font-size: 19px; color: var(--text); font-weight: 720; } .empty-state p { margin-top: 6px; font-size: 14px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.suggestions button { border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); padding: 8px 13px; border-radius: 999px; font-size: 13px; cursor: pointer; transition: all .15s; }
.suggestions button:hover { border-color: var(--accent); color: var(--accent); }

.msg { display: flex; flex-direction: column; max-width: 100%; animation: rise .25s ease; }
@keyframes rise { from{opacity:0;transform:translateY(6px);} to{opacity:1;transform:none;} }
.msg.user { align-items: flex-end; }
.msg-role { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 4px 5px; }
.bubble { padding: 12px 15px; border-radius: 16px; line-height: 1.55; font-size: 14.5px; max-width: min(760px, 92%); white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; }
.msg.user .bubble { background: var(--user-bubble); color: var(--user-text); border-bottom-right-radius: 5px; box-shadow: var(--shadow-sm); }
.msg.assistant .bubble { background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.thinking { margin-bottom: 8px; max-width: min(760px, 92%); }
.thinking > summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 650; color: var(--accent); background: var(--accent-soft); border: 1px solid var(--line); padding: 5px 11px; border-radius: 999px; }
.thinking > summary::-webkit-details-marker { display: none; } .thinking > summary::before { content: "✦"; font-size: 11px; } .thinking[open] > summary { margin-bottom: 8px; }
.thinking-body { font-family: var(--mono); font-size: 12.3px; line-height: 1.5; color: var(--muted); background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: 10px; padding: 11px 13px; white-space: pre-wrap; word-break: break-word; max-height: 300px; overflow-y: auto; }
.msg-meta { display: flex; flex-wrap: wrap; gap: 12px; margin: 6px 4px 0; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.msg-meta b { color: var(--text); font-weight: 650; }
.typing { display: inline-flex; gap: 4px; padding: 4px 2px; } .typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; } .typing i:nth-child(2){animation-delay:.2s;} .typing i:nth-child(3){animation-delay:.4s;}
@keyframes blink { 0%,60%,100%{opacity:.25;} 30%{opacity:1;} }
/* per-message send state: spinner (sending) -> brain (computing first token) */
.msg-status { display: inline-flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13.5px; }
.spin { width: 15px; height: 15px; flex: 0 0 auto; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--accent); animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.brain { font-size: 16px; display: inline-block; animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: .5; transform: scale(1); } 50% { opacity: 1; transform: scale(1.14); } }
.st-text { font-weight: 500; }
.jump-latest { position: absolute; left: 50%; transform: translateX(-50%); bottom: 96px; z-index: 5; border: 1px solid var(--line-strong); background: var(--surface); color: var(--accent); font-weight: 650; font-size: 12.5px; padding: 6px 14px; border-radius: 999px; cursor: pointer; box-shadow: var(--shadow); }

/* composer */
.composer { border-top: 1px solid var(--line); padding: 9px clamp(10px,2.4vw,16px) 10px; background: var(--surface); flex: 0 0 auto; }
.composer-controls { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.model-picker select { border: 1px solid var(--line-strong); background: var(--surface-2); border-radius: 10px; padding: 7px 10px; font-size: 13px; font-weight: 600; max-width: 240px; cursor: pointer; }
.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg { border: none; background: transparent; color: var(--muted); padding: 6px 15px; border-radius: 8px; font-size: 13px; font-weight: 650; cursor: pointer; transition: all .15s; }
.seg.is-active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); }
.settings { position: relative; margin-left: auto; } .settings > summary { list-style: none; } .settings > summary::-webkit-details-marker { display: none; }
.settings-pop { position: absolute; right: 0; bottom: 48px; width: min(380px, 86vw); max-height: 70vh; overflow-y: auto; z-index: 20; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--shadow); padding: 14px; display: grid; gap: 11px; }
.settings-pop label { display: grid; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted); } .settings-pop input, .settings-pop textarea { border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; background: var(--surface-2); color: var(--text); font-family: inherit; font-size: 13px; }
.settings-pop textarea { resize: vertical; min-height: 34px; }
.settings-pop label.full #toolsInput { font-family: var(--mono); font-size: 11.5px; line-height: 1.45; }
.settings-pop .hint { font-weight: 500; color: var(--muted); opacity: .8; font-size: 10.5px; }
.settings-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.settings-err { font-size: 11.5px; color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); border-radius: 8px; padding: 6px 9px; }
.tool-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 11px; font-weight: 500; color: var(--muted); margin-top: 4px; }
.tool-presets button { font-size: 11px; padding: 3px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); cursor: pointer; color: var(--accent); font-weight: 600; }
.tool-presets button:hover { background: var(--accent-soft); }
/* tool-call block in a message */
.toolcall { margin-top: 8px; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; font-size: 12.5px; }
.toolcall-head { background: var(--accent-soft); color: var(--accent); font-weight: 700; padding: 6px 10px; display: flex; align-items: center; gap: 7px; }
.toolcall pre { margin: 0; padding: 9px 11px; font-family: var(--mono); font-size: 11.5px; white-space: pre-wrap; word-break: break-word; background: var(--surface-2); }
.ghost-btn { border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px; padding: 8px; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--danger); }
.composer-input { display: flex; align-items: flex-end; gap: 10px; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 14px; padding: 8px 8px 8px 14px; transition: border-color .15s; }
.composer-input:focus-within { border-color: var(--accent); }
#prompt { flex: 1; min-width: 0; border: none; background: transparent; resize: none; outline: none; font-size: 14.5px; line-height: 1.5; max-height: 160px; padding: 6px 0; }
.send-btn { width: 40px; height: 40px; flex: 0 0 auto; border: none; border-radius: 11px; cursor: pointer; font-size: 16px; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); display: grid; place-items: center; transition: transform .1s, opacity .15s; }
/* attachments (vision) */
.attach-btn { width: 38px; height: 38px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: 17px; background: var(--surface); display: grid; place-items: center; transition: background .15s, transform .1s; }
.attach-btn:hover { background: var(--accent-soft); transform: translateY(-1px); }
.attach-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.attach-item { position: relative; width: 56px; height: 56px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line-strong); }
.attach-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach-item button { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border: none; border-radius: 50%; background: rgba(0,0,0,.62); color: #fff; font-size: 10px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.attach-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.attach-thumb { max-width: 200px; max-height: 200px; border-radius: 10px; border: 1px solid rgba(255,255,255,.25); object-fit: cover; }
.chat-shell.drop-hint { outline: 2px dashed var(--accent); outline-offset: -6px; }
.send-btn:hover { opacity: .92; } .send-btn:active { transform: scale(.92); } .stop-btn { background: var(--danger); }

/* Audio playground */
.asr-layout { width: min(1180px, 100%); max-width: 100%; align-self: center; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(330px, .95fr); gap: 14px; }
.asr-layout > .panel { min-width: 0; }
.asr-panel-body, .asr-result-body { min-width: 0; padding: clamp(14px, 2vw, 20px); }
.asr-panel-body { display: grid; gap: 14px; }
.asr-service-row { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.asr-service-row > div { min-width: 0; }
.asr-service-row b { display: block; font-size: 13px; }
.asr-service-row span:not(.badge) { display: block; margin-top: 2px; color: var(--muted); font-size: 11.5px; }
.audio-model-picker { display: grid; gap: 7px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.audio-model-picker label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 700; }
.audio-model-picker select { width: 100%; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); padding: 9px 10px; font-size: 13px; font-weight: 650; outline: none; }
.audio-model-picker select:focus { border-color: var(--accent); }
.audio-model-picker p { color: var(--muted); font-size: 11px; line-height: 1.45; }
.asr-drop-zone { min-height: 154px; border: 2px dashed var(--line-strong); border-radius: 14px; background: var(--surface-2); display: grid; place-content: center; justify-items: center; gap: 10px; padding: 22px; text-align: center; cursor: pointer; outline: none; transition: border-color .15s, background .15s, transform .15s; }
.asr-drop-zone:hover, .asr-drop-zone:focus-visible, .asr-drop-zone.is-dragging { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); }
.asr-drop-zone.has-file { border-style: solid; border-color: color-mix(in srgb, var(--good) 50%, var(--line)); }
.asr-drop-glyph { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: #fff; font-size: 22px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.asr-drop-zone b { display: block; font-size: 14px; word-break: break-word; }
.asr-drop-zone > div { min-width: 0; max-width: 100%; }
.asr-drop-zone div > span { display: block; margin-top: 4px; color: var(--muted); font-size: 11.5px; }
.asr-source-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.asr-action-btn { border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); border-radius: 9px; padding: 8px 12px; cursor: pointer; font-size: 12.5px; font-weight: 650; }
.asr-action-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.asr-record-btn span { color: var(--danger); margin-right: 5px; }
.asr-record-btn.is-recording { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); border-color: var(--danger); color: var(--danger); }
.asr-record-btn.is-recording span { animation: asrPulse 1s ease-in-out infinite; }
@keyframes asrPulse { 50% { opacity: .35; } }
.asr-record-time { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--danger); }
.asr-note { margin-top: -8px; color: var(--muted); font-size: 10.5px; }
.asr-preview { display: grid; gap: 7px; }
.asr-preview audio { width: 100%; height: 42px; }
.asr-file-meta { color: var(--muted); font-size: 11px; word-break: break-word; }
.asr-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.asr-options label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 700; }
.asr-options select, .asr-options input { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); padding: 8px 10px; font-size: 13px; outline: none; }
.asr-options select:focus, .asr-options input:focus { border-color: var(--accent); }
.asr-optional { font-weight: 500; opacity: .8; }
.asr-submit { border: 0; border-radius: 11px; min-height: 44px; padding: 10px 16px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; cursor: pointer; font-weight: 700; box-shadow: var(--shadow-sm); }
.asr-submit:hover:not(:disabled) { opacity: .92; }
.asr-submit:disabled, .asr-action-btn:disabled { opacity: .45; cursor: not-allowed; }
.asr-error { border-radius: 9px; padding: 8px 10px; color: var(--danger); background: color-mix(in srgb, var(--danger) 11%, transparent); font-size: 12px; }
.asr-result-panel { display: flex; flex-direction: column; }
.asr-result-body { flex: 1; display: flex; flex-direction: column; gap: 12px; min-height: 370px; }
.asr-transcript { flex: 1; min-height: 220px; margin: 0; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--text); font-family: var(--sans); font-size: 16px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; overflow-y: auto; }
.asr-transcript.is-loading { color: var(--muted); }
.asr-transcript.is-partial { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); box-shadow: inset 3px 0 0 var(--accent); }
.omni-reply { display: grid; gap: 7px; padding: 11px 12px; border: 1px solid color-mix(in srgb, var(--accent-2) 45%, var(--line)); border-radius: 11px; background: color-mix(in srgb, var(--accent-2) 8%, var(--surface-2)); }
.omni-reply > span { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.omni-reply audio { width: 100%; height: 42px; }
.asr-result-meta { min-height: 16px; color: var(--muted); font-size: 11px; word-break: break-word; }
.asr-endpoint-card { display: grid; gap: 5px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.asr-endpoint-card > span { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.asr-endpoint-card code { color: var(--accent); font-family: var(--mono); font-size: 11.5px; word-break: break-all; }
.asr-endpoint-card small { color: var(--muted); font-size: 10.5px; }

/* Audio studio v0.9 */
.audio-studio { width: min(1180px, 100%); max-width: 100%; align-self: center; display: grid; gap: 10px; }
.audio-studio-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.audio-studio-head h2 { font-size: 15px; }
.audio-studio-head p { margin-top: 3px; color: var(--muted); font-size: 11.5px; line-height: 1.45; }
.audio-tabs { width: fit-content; display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); }
.audio-tab { display: inline-flex; align-items: center; gap: 7px; border: 0; border-radius: 9px; padding: 8px 14px; background: transparent; color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.audio-tab b { width: 19px; height: 19px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; font-size: 10px; }
.audio-tab:hover { color: var(--text); }
.audio-tab.is-active { color: var(--accent); background: var(--surface); box-shadow: var(--shadow-sm); }
.audio-tab.is-active b { border-color: var(--accent); color: #fff; background: var(--accent); }
.audio-pane { min-width: 0; }
.audio-text-field { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 700; }
.audio-text-field > span { display: inline; font-weight: 500; opacity: .8; }
.audio-text-field textarea, .audio-text-field input { width: 100%; min-width: 0; resize: vertical; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); color: var(--text); padding: 9px 10px; font: inherit; font-size: 13px; line-height: 1.45; outline: none; }
.audio-text-field textarea:focus, .audio-text-field input:focus { border-color: var(--accent); }
.hold-wrap { display: grid; justify-items: center; gap: 8px; padding: 2px 0; }
.hold-talk { width: min(340px, 100%); min-height: 88px; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; align-items: center; column-gap: 12px; border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line)); border-radius: 44px; padding: 15px 27px; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 10px 28px color-mix(in srgb, var(--accent) 24%, transparent); cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; transition: transform .15s, filter .15s, background .15s; }
.hold-talk:hover { filter: brightness(1.04); transform: translateY(-1px); }
.hold-talk:active, .hold-talk.is-recording { transform: scale(.985); }
.hold-talk .hold-icon { grid-row: 1 / -1; font-size: 24px; animation: asrPulse 1.1s ease-in-out infinite; }
.hold-talk strong { align-self: end; text-align: left; font-size: 16px; }
.hold-talk small { align-self: start; text-align: left; opacity: .8; font-size: 10.5px; }
.hold-talk.is-recording { background: linear-gradient(135deg, #e3485b, #be2445); }
.hold-talk.is-cancel { background: linear-gradient(135deg, #6b7280, #374151); filter: none; transform: translateY(-4px); }
.asr-drop-zone.compact { min-height: 96px; grid-template-columns: auto minmax(0, 1fr); place-content: center; justify-items: start; text-align: left; padding: 15px 18px; }
.asr-submit.grow { flex: 1; min-height: 37px; }
.audio-progress { position: relative; min-height: 34px; display: flex; align-items: center; gap: 9px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; padding: 8px 11px; color: var(--muted); background: var(--surface-2); font-size: 11.5px; font-weight: 650; }
.audio-progress i { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--muted); }
.audio-progress.is-active { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.audio-progress.is-active::after { content: ''; position: absolute; inset: auto 0 0; height: 2px; background: linear-gradient(90deg, transparent, var(--accent), transparent); animation: audioSweep 1.2s linear infinite; }
.audio-progress.is-active i { background: var(--accent); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 13%, transparent); animation: asrPulse 1s ease-in-out infinite; }
.audio-progress.is-failed { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.audio-progress.is-failed i { background: var(--danger); }
@keyframes audioSweep { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.live-call { width: min(900px, 100%); margin: 0 auto; }
.live-call-body { display: grid; gap: 15px; padding: clamp(15px, 2.4vw, 24px); }
.live-settings { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 10px; }
.live-settings label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 700; }
.live-settings select { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); color: var(--text); padding: 8px 10px; font-size: 12.5px; outline: none; }
.phone-stage { display: grid; justify-items: center; gap: 8px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: radial-gradient(circle at 50% 15%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 58%), var(--surface-2); text-align: center; }
.phone-stage > b { font-size: 15px; }
.phone-stage > p { max-width: 520px; min-height: 16px; color: var(--muted); font-size: 11px; }
.live-orb { width: 76px; height: 76px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line-strong); color: var(--muted); background: var(--surface); font-size: 28px; box-shadow: var(--shadow-sm); transition: color .2s, background .2s, transform .2s; }
.live-orb.is-live { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--good), #0ea5a4); animation: liveBreathe 1.8s ease-in-out infinite; }
.live-orb.is-speaking { background: linear-gradient(135deg, var(--accent), var(--accent-2)); animation-duration: .8s; }
@keyframes liveBreathe { 50% { transform: scale(1.06); box-shadow: 0 0 0 12px color-mix(in srgb, var(--accent) 10%, transparent); } }
.call-button { min-width: 170px; border: 0; border-radius: 999px; padding: 11px 22px; color: #fff; background: linear-gradient(135deg, var(--good), #0f9d6b); cursor: pointer; font-weight: 750; }
.call-button.is-hangup { background: linear-gradient(135deg, #e3485b, #be2445); }
.live-transcript { min-height: 130px; max-height: 230px; font-size: 14px; }
.generated-audio-art { flex: 1; min-height: 250px; display: grid; place-content: center; justify-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 15px; color: var(--muted); background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--accent-2) 14%, transparent), transparent 55%), var(--surface-2); text-align: center; }
.generated-audio-art > span { width: 72px; height: 72px; display: grid; place-items: center; border-radius: 20px; color: #fff; font-size: 34px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 12px 30px color-mix(in srgb, var(--accent) 22%, transparent); }
.generated-audio-art b { color: var(--text); font-size: 15px; }
.generated-audio-art small { max-width: 330px; line-height: 1.45; }
.generated-player { width: 100%; }
#speechFields, #musicFields { display: grid; gap: 12px; }
.audio-capability-note { display: grid; grid-template-columns: auto repeat(4, 1fr); gap: 10px; align-items: start; border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; color: var(--muted); background: var(--surface-2); font-size: 10.5px; line-height: 1.45; }
.audio-capability-note > b { color: var(--text); font-size: 11px; }
.audio-capability-note strong { color: var(--text); }

/* dashboard */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 14px; font-weight: 700; } .panel-head .sub { display: inline; font-weight: 500; margin-left: 6px; }
.t-short { display: none; }
.plot-panel canvas { display: block; width: 100%; height: clamp(220px, 30vw, 320px); padding: 8px 12px; }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dash-grid canvas { display: block; width: 100%; height: 220px; padding: 8px 12px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.legend .lg { display: inline-flex; align-items: center; gap: 6px; } .legend i { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 480px; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: right; font-size: 12.5px; font-variant-numeric: tabular-nums; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
tr.offline td { color: var(--muted); font-style: italic; }

/* configurations tab */
.cfg-table td { vertical-align: middle; }
.cfg-model .sub2 { font-size: 11px; color: var(--muted); font-weight: 500; margin-top: 2px; }
.cfg-table code { font-family: var(--mono); font-size: 11.5px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; white-space: nowrap; }
.cfg-caps { display: flex; flex-wrap: wrap; gap: 5px; justify-content: flex-start; }
.cap { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.cap-vision { background: color-mix(in srgb, #6366f1 15%, transparent); border-color: transparent; color: #6366f1; }
.cap-tools { background: color-mix(in srgb, #0ea5a4 16%, transparent); border-color: transparent; color: #0ea5a4; }
.cap-mtp { background: color-mix(in srgb, #f59e0b 18%, transparent); border-color: transparent; color: #b8730a; }
.cap-audio-in, .cap-speech-out { background: color-mix(in srgb, var(--accent-2) 16%, transparent); border-color: transparent; color: var(--accent-2); }
.cap-streaming { background: color-mix(in srgb, var(--good) 15%, transparent); border-color: transparent; color: var(--good); }
.badge { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.badge.ok { background: color-mix(in srgb, #10b981 16%, transparent); color: #0f9d6b; border-color: transparent; }
.badge.err { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); border-color: transparent; }
.badge.warn { background: color-mix(in srgb, #f59e0b 18%, transparent); color: #b8730a; border-color: transparent; }
.cfg-access { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; padding: 14px 16px; }
.cfg-ap { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface-2); }
.cfg-ap-k { font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.cfg-ap-u { display: inline-block; font-family: var(--mono); font-size: 12px; color: var(--accent); word-break: break-all; }
.cfg-ap-d { font-size: 11.5px; color: var(--muted); margin-top: 6px; }

.footer { text-align: center; padding: 4px 0 6px; color: var(--muted); font-size: 10.5px; opacity: .75; flex: 0 0 auto; }

/* ===== responsive =====
   Phone layout is CONTENT-FIRST: the four stat cards used to eat two rows of ~110px each,
   which on a 6" screen left the reply itself about four lines tall. On phones they collapse
   into ONE ~40px strip, the toolbar goes flat (no cards, no shadows) and scrolls sideways
   instead of wrapping to three rows, and the chrome around the chat is stripped so the
   answer gets the screen. */
@media (max-width: 860px) {
  .topbar { gap: 10px; } .tabs { order: 3; width: 100%; margin: 4px 0 0; justify-content: center; }
  .dash-metrics { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 720px) {
  body { padding: 0 8px; }
  .dash-grid { grid-template-columns: 1fr; }
  .tab-sep { display: none; }
  .perf-toggle { padding: 4px 8px; font-size: 11.5px; box-shadow: none; }
  .perf-toggle .t-full { display: none; } .perf-toggle .t-short { display: inline; }
  #perfStrip .metric { flex-direction: column; align-items: center; gap: 1px; padding: 5px 6px; }
  #perfStrip .metric-unit { display: none; }
  .asr-layout { width: 100%; max-width: 100%; grid-template-columns: minmax(0, 1fr); }
  .asr-layout > .panel { width: 100%; max-width: 100%; }
  .asr-input-panel .panel-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .asr-input-panel .panel-head h2 { min-width: 0; }
  .asr-input-panel .panel-head .ghost-btn2 { white-space: nowrap; }
  .asr-source-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .asr-action-btn { width: 100%; min-width: 0; padding-inline: 8px; white-space: nowrap; }
  .asr-record-time { grid-column: 1 / -1; }
  .asr-options { grid-template-columns: 1fr; }
  .asr-drop-zone { min-height: 130px; padding: 17px; }
  .asr-result-body { min-height: 310px; }
  .asr-transcript { min-height: 180px; }
  .audio-studio-head { align-items: flex-start; }
  .audio-studio-head p { display: none; }
  .audio-tabs { width: 100%; }
  .audio-tab { flex: 1; justify-content: center; padding: 8px 5px; font-size: 10.5px; }
  .audio-tab b { display: none; }
  .hold-talk { min-height: 78px; }
  .live-settings { grid-template-columns: 1fr; }
  .audio-capability-note { grid-template-columns: 1fr; }
  .bubble, .thinking { max-width: 100%; }

  /* header: one compact line */
  .topbar { padding: 8px 0 6px; gap: 8px; }
  .brand-mark { width: 28px; height: 28px; border-radius: 8px; }
  .brand-text h1 { font-size: 15px; }
  .brand-text .sub { font-size: 10.5px; }
  .chip-status { display: none; }

  /* tabs: flat, scrollable, no container chrome */
  .tabs { background: none; border: 0; padding: 0; gap: 2px; margin: 2px 0 0;
          overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; justify-content: flex-start; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { padding: 6px 10px; font-size: 12.5px; border-radius: 8px; flex: 1 1 auto; }
  .t-full { display: none; } .t-short { display: inline; }

  /* panel headers stack instead of pushing their controls off-screen */
  .panel-head { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .panel-head h2 { font-size: 13px; } .panel-head .sub { display: block; margin-left: 0; font-size: 10.5px; }
  .hist-controls { width: 100%; gap: 6px; }
  .hist-controls .ghost-btn2, .hist-controls .ghost-btn { padding: 4px 8px; font-size: 11.5px; }

  /* audit table: keep the columns that answer "what happened", tap a row for the rest */
  .hist-table { min-width: 0; width: 100%; }
  .hist-table td, .hist-table th { padding: 6px 6px; font-size: 11px; }
  .hist-table th:nth-child(4), .hist-table td:nth-child(4),
  .hist-table th:nth-child(6), .hist-table td:nth-child(6),
  .hist-table th:nth-child(7), .hist-table td:nth-child(7),
  .hist-table th:nth-child(9), .hist-table td:nth-child(9) { display: none; }

  /* metrics: one flat strip, ~40px total instead of ~220px of cards */
  .metrics { display: flex; gap: 0; background: var(--surface); border: 1px solid var(--line);
             border-radius: 10px; padding: 0; overflow: hidden; }
  .metric { flex: 1 1 0; min-width: 0; background: none; border: 0; border-radius: 0;
            box-shadow: none; padding: 6px 8px; text-align: center;
            border-left: 1px solid var(--line); }
  .metric:first-child { border-left: 0; }
  .metric-accent::before { display: none; }
  .metric-label { font-size: 9px; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .metric-value { margin-top: 1px; font-size: 16px; line-height: 1.1; }
  .metric-unit { display: none; }
  .dash-metrics { display: grid; grid-template-columns: repeat(3, 1fr); }
  .dash-metrics .metric-unit { display: block; font-size: 9.5px; margin-top: 2px; }

  /* chat: take the screen, drop the card look */
  .chat-shell { border-radius: 10px; box-shadow: none; }
  .chat { padding: 12px 10px; gap: 12px; }
  .msg-role { font-size: 10.5px; }

  /* composer toolbar: FLAT and on one scrollable line */
  .composer { padding: 8px 8px 10px; }
  .composer-controls { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
                       scrollbar-width: none; gap: 6px; margin-bottom: 8px; padding-bottom: 2px; }
  .composer-controls::-webkit-scrollbar { display: none; }
  .composer-controls > * { flex: 0 0 auto; }
  .model-picker select, .segmented, .ctx-meter, .new-chat-btn, .settings > .icon-btn {
    background: none; border: 0; box-shadow: none; border-radius: 8px; font-size: 12.5px; padding: 5px 8px; }
  .segmented { background: var(--surface-2); padding: 2px; }
  .seg { padding: 4px 9px; font-size: 12.5px; }
  .model-picker select { max-width: 44vw; text-overflow: ellipsis; }
  .ctx-meter { color: var(--muted); }
  .composer-input { border-radius: 12px; padding: 6px 6px 6px 10px; }
  .settings-pop { width: min(92vw, 360px); right: 0; }

  /* Thinking stays visible (a blank card reads as a hang) but is capped so it can never
     push the answer off-screen; it auto-collapses as soon as content starts. */
  .thinking-body { max-height: 30vh; overflow-y: auto; }

  /* the jump pill sat on top of the toolbar and covered the "Fast" button */
  .jump-latest { bottom: auto; top: 8px; left: auto; right: 10px; transform: none;
                 padding: 4px 10px; font-size: 11.5px; opacity: .92; }

  /* version: a whisper, not a block */
  .footer { padding: 3px 0 5px; font-size: 9.5px; opacity: .6; }

  /* tables scroll instead of squashing */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .cell-client { max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
  .plot-panel canvas { height: 200px; }
}
/* very small phones: two metrics per half-row would wrap; keep the strip but shrink type */
@media (max-width: 380px) {
  .metric-value { font-size: 14.5px; } .metric-label { font-size: 8.5px; }
  .model-picker select { max-width: 38vw; }
}

/* ===== 0.4.0-atlas additions: GPU grid, call history, dialog ===== */
.gpu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; padding: 14px 16px; }
.gpu-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface-2); }
.gpu-head { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.gpu-util { font-weight: 750; font-variant-numeric: tabular-nums; color: var(--accent); }
.bar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin: 9px 0 7px; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .4s ease; }
.gpu-foot { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.hist-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ghost-btn2 { border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); border-radius: 8px; padding: 6px 11px; cursor: pointer; font-size: 12.5px; font-weight: 600; }
.ghost-btn2:hover { border-color: var(--accent); color: var(--accent); }
.hist-table { min-width: 900px; }
.hist-table td, .hist-table th { padding: 8px 10px; font-size: 12px; }
.hist-table tbody tr { cursor: pointer; }
.hist-table tbody tr:hover { background: var(--surface-2); }
.cell-model { text-align: left; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-open { color: var(--muted); font-weight: 800; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.badge.ok { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }
.badge.err { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.badge.warn { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.badge.run { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.yes { color: var(--good); font-weight: 700; } .no { color: var(--danger); font-weight: 700; }

.call-dialog { width: min(760px, 94vw); max-height: 88vh; border: 1px solid var(--line-strong); border-radius: 16px; padding: 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow); overflow: hidden; }
.call-dialog::backdrop { background: rgba(8,12,20,.55); backdrop-filter: blur(3px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.dialog-head h3 { font-size: 14px; font-weight: 700; word-break: break-all; }
.dialog-body { padding: 16px 18px; overflow-y: auto; max-height: calc(88vh - 56px); }
.dialog-body h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 16px 0 8px; }
.dlg-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.dlg-stats > div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 11px; }
.dlg-stats span { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.dlg-stats b { display: block; margin-top: 3px; font-size: 13px; font-weight: 650; word-break: break-word; }
.kv { margin-bottom: 8px; } .kv .role { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--accent); }
.dlg-pre, .kv pre { font-family: var(--mono); font-size: 12px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; margin: 4px 0 0; max-height: 300px; overflow-y: auto; }
.dlg-pre.reason { color: var(--muted); border-style: dashed; }
.dlg-loading { color: var(--muted); padding: 20px; text-align: center; }
@media (max-width: 720px) { .hist-controls { width: 100%; } }

/* context meter (playground) */
.ctx-meter { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ctx-meter.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
.ctx-meter.over { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, var(--line)); }

/* new chat button */
.new-chat-btn { border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); border-radius: 9px; padding: 7px 13px; font-size: 12.5px; font-weight: 650; cursor: pointer; white-space: nowrap; }
.new-chat-btn:hover { border-color: var(--accent); color: var(--accent); }


/* ===== 0.5.0-ledger: dashboard history + audit ===== */
.range-picker { display: flex; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 2px; }
.range-picker button { background: none; border: 0; border-radius: 7px; padding: 4px 10px; font-size: 12px; color: var(--muted); cursor: pointer; }
.range-picker button.is-active { background: var(--surface); color: var(--text); font-weight: 650; box-shadow: var(--shadow-sm); }
.hist-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; padding: 0 16px 14px; }
.hist-totals > div { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; background: var(--surface-2); border-radius: 10px; }
.hist-totals span { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.hist-totals b { font-size: 15px; font-variant-numeric: tabular-nums; }
@media (max-width: 720px) {
  .hist-totals { grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 0 10px 10px; }
  .hist-totals > div { padding: 6px 8px; } .hist-totals b { font-size: 13px; } .hist-totals span { font-size: 8.5px; }
  .range-picker button { padding: 3px 8px; font-size: 11.5px; }
}

/* ===== 0.9.13-liveflight: realtime flying requests view ===== */
.live-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 5px; border-radius: 999px; background: var(--accent-2, #0ea5a4); color: #fff; font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; animation: liveGlow 1.6s ease-in-out infinite; }
@keyframes liveGlow { 0%, 100% { opacity: 1; } 50% { opacity: .65; } }
.live-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.live-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); cursor: pointer; }
.live-cards { display: flex; flex-direction: column; gap: 14px; padding: 14px 16px 16px; }
.live-empty { text-align: center; color: var(--muted); padding: 36px 16px; font-size: 13.5px; }
.live-card { border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface-2); overflow: hidden; transition: border-color .2s; }
.live-card.is-flying { border-color: color-mix(in srgb, var(--accent-2, #0ea5a4) 65%, var(--line)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent-2, #0ea5a4) 22%, transparent); }
.live-card.is-finished { opacity: .88; }
.live-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface); }
.live-card-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.live-model { font-size: 13px; font-weight: 700; }
.live-chip { font-size: 11px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; font-family: var(--mono); }
.live-card-stats { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); }
.live-stat-accent { color: var(--accent-2, #0ea5a4); font-weight: 700; }
.live-pulse { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; margin-right: 5px; animation: liveGlow 1s ease-in-out infinite; }
.live-card-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: 12px; padding: 12px 14px; }
@media (max-width: 900px) { .live-card-grid { grid-template-columns: 1fr; } }
.live-col h5 { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 6px; display: flex; align-items: center; gap: 6px; }
.live-col h5 small { font-weight: 500; text-transform: none; opacity: .8; }
.live-streaming-tag { font-size: 9.5px; font-weight: 800; padding: 1px 6px; border-radius: 4px; background: var(--accent-2, #0ea5a4); color: #fff; letter-spacing: .05em; }
.live-req-list { display: flex; flex-direction: column; gap: 6px; max-height: 360px; overflow-y: auto; }
.live-msg { display: flex; flex-direction: column; gap: 3px; }
.live-role { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--accent); }
.live-pre { font-family: var(--mono); font-size: 12px; line-height: 1.48; white-space: pre-wrap; word-break: break-word; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; margin: 0; max-height: 260px; overflow-y: auto; }
.live-reason { color: var(--muted); border-style: dashed; max-height: 160px; }
.live-resp { min-height: 70px; max-height: 300px; }
.live-tc { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.live-sec + .live-sec { margin-top: 10px; }
.live-fault { margin-top: 6px; font-size: 12px; color: var(--danger); font-weight: 600; }
.live-muted { font-size: 12px; color: var(--muted); font-style: italic; }
