/* Version 0.3.0-nexus — gateway console: playground + dashboard, light + dark, responsive */
: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: 14px; padding: 16px 0 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 21px; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: var(--shadow-sm); }
.brand-text { min-width: 0; }
h1 { font-size: clamp(17px,2.2vw,21px); font-weight: 750; letter-spacing: -.02em; line-height: 1.1; }
.sub { color: var(--muted); font-size: 12px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabs { display: flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 4px; margin: 0 auto; }
.tab { border: none; background: transparent; color: var(--muted); padding: 8px 18px; border-radius: 9px; font-size: 13.5px; font-weight: 650; cursor: pointer; transition: all .15s; }
.tab.is-active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); }
.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: 6px 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: 38px; height: 38px; 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: 14px; flex: 1 1 auto; min-height: 0; }
/* dashboard & history scroll internally; playground never scrolls at the page level */
#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; }

/* 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: 13px 15px; 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); }

/* 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: 20px clamp(14px,3vw,26px); display: flex; flex-direction: column; gap: 16px; }
.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: 12px clamp(12px,3vw,20px) 14px; background: var(--surface); flex: 0 0 auto; }
.composer-controls { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; 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); }

/* 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: 13px 16px; 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; }
.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; }
.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: 16px 0 22px; color: var(--muted); font-size: 11.5px; flex: 0 0 auto; }

/* responsive */
@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) {
  .metrics { grid-template-columns: repeat(2, 1fr); } .dash-grid { grid-template-columns: 1fr; }
  .chip-status { display: none; } .bubble, .thinking { max-width: 100%; }
}

/* ===== 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); }
