/* ── Reset & Base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #07070f;
  --glass-bg: rgba(255,255,255,0.04);
  --glass-bg-hover: rgba(255,255,255,0.07);
  --glass-border: rgba(255,255,255,0.08);
  --glass-border-strong: rgba(255,255,255,0.14);
  --text: rgba(255,255,255,0.92);
  --text-muted: rgba(255,255,255,0.45);
  --text-dim: rgba(255,255,255,0.25);
  --accent-cyan: #00d4ff;
  --accent-purple: #8b5cf6;
  --accent-pink: #f472b6;
  --accent-green: #34d399;
  --accent-blue: #60a5fa;
  --shadow: 0 8px 32px rgba(0,0,0,0.5);
  --blur: blur(24px) saturate(160%);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Background ───────────────────────────────────────────────────── */
.bg-orbs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.18;
  animation: drift 20s ease-in-out infinite alternate;
}

.orb-1 {
  width: 700px; height: 700px;
  background: radial-gradient(circle, var(--accent-cyan), transparent 70%);
  top: -200px; left: -150px;
  animation-duration: 25s;
}

.orb-2 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, var(--accent-purple), transparent 70%);
  bottom: -100px; right: -100px;
  animation-duration: 30s;
  animation-delay: -8s;
}

.orb-3 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, var(--accent-pink), transparent 70%);
  top: 40%; left: 45%;
  animation-duration: 22s;
  animation-delay: -4s;
  opacity: 0.1;
}

@keyframes drift {
  0%   { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(60px, -40px) scale(1.05); }
  66%  { transform: translate(-40px, 60px) scale(0.95); }
  100% { transform: translate(30px, 20px) scale(1.02); }
}

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 40%, transparent 100%);
}

/* ── Glass Panel ──────────────────────────────────────────────────── */
.glass-panel {
  position: relative;
  background: var(--glass-bg);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.06);
  transition: border-color 0.3s, box-shadow 0.3s;
}

.glass-panel:hover {
  border-color: var(--glass-border-strong);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.1), 0 0 0 1px rgba(0,212,255,0.05);
}

.glass-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255,255,255,0.04) 0%, transparent 60%);
  pointer-events: none;
}

.panel-sm { padding: 10px 12px; }

.panel-label {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--accent-cyan);
  margin-bottom: 12px;
  opacity: 0.9;
}

/* ── Brand Panel ─────────────────────────────────────────────────── */
.brand-panel {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  overflow: hidden;
}

.brand-panel::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: linear-gradient(
    120deg,
    rgba(0,212,255,0.06) 0%,
    rgba(139,92,246,0.06) 50%,
    rgba(0,212,255,0.03) 100%
  );
  pointer-events: none;
}

.brand-mark {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(0,212,255,0.15), rgba(139,92,246,0.15));
  border: 1px solid rgba(0,212,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 0 16px rgba(0,212,255,0.1), inset 0 1px 0 rgba(255,255,255,0.1);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.brand-name {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.22em;
  background: linear-gradient(90deg, #00d4ff 0%, #a78bfa 60%, #00d4ff 120%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: brand-shimmer 6s linear infinite;
  line-height: 1;
}

.brand-sub {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--text-dim);
  opacity: 0.6;
  text-transform: uppercase;
}

@keyframes brand-shimmer {
  0%   { background-position: 0% center; }
  100% { background-position: 200% center; }
}

/* ── Metric Rows ──────────────────────────────────────────────────── */
.metric-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}

.metric-row:last-child { margin-bottom: 0; }

.metric-name {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  width: 38px;
  flex-shrink: 0;
}

.metric-bar {
  flex: 1;
  height: 3px;
  background: rgba(255,255,255,0.08);
  border-radius: 99px;
  overflow: hidden;
}

.metric-fill {
  --accent: var(--accent-cyan);
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.metric-val {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  width: 40px;
  text-align: right;
  flex-shrink: 0;
}

/* ── Network / Status Rows ────────────────────────────────────────── */
.net-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
  min-height: 20px;
}
.net-row:last-child { margin-bottom: 0; }

.net-name {
  font-size: 12px;
  color: var(--text);
  flex: 1;
}
.net-name.muted { color: var(--text-muted); }

.net-ip {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-green  { background: var(--accent-green); box-shadow: 0 0 6px var(--accent-green); }
.dot-blue   { background: var(--accent-blue);  box-shadow: 0 0 6px var(--accent-blue);  }
.dot-yellow { background: #fbbf24; box-shadow: 0 0 6px #fbbf24; }

.pulse {
  animation: pulse-glow 2s ease-in-out infinite;
}
@keyframes pulse-glow {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px var(--accent-green); }
  50%       { opacity: 0.5; box-shadow: 0 0 12px var(--accent-green), 0 0 24px var(--accent-green); }
}

.divider {
  height: 1px;
  background: var(--glass-border);
  margin: 8px 0;
}

.badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 2px 7px;
  border-radius: 99px;
}
.badge-green { background: rgba(52,211,153,0.12); color: var(--accent-green); border: 1px solid rgba(52,211,153,0.2); }
.badge-blue  { background: rgba(96,165,250,0.12); color: var(--accent-blue);  border: 1px solid rgba(96,165,250,0.2); }
.badge-cyan  { background: rgba(0,212,255,0.10);  color: var(--accent-cyan);  border: 1px solid rgba(0,212,255,0.2);  }

/* ── Big Stats ────────────────────────────────────────────────────── */
.big-stat {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
  margin: 2px 0 2px;
}
.stat-sub {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

/* ── Model rows ───────────────────────────────────────────────────── */
.model-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.model-row:last-child { margin-bottom: 0; }

.model-icon {
  font-size: 15px;
  color: var(--accent-cyan);
  flex-shrink: 0;
  text-shadow: 0 0 8px var(--accent-cyan);
}
.model-icon.dim { color: var(--text-dim); text-shadow: none; }

.model-name {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
}
.model-name.dim { color: var(--text-dim); }

.model-sub {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  margin-top: 2px;
}

.active-model .model-name { color: var(--accent-cyan); }

/* ── Agent Status Orb ─────────────────────────────────────────────── */
.agent-status-panel { text-align: center; }

.aso-orb-wrap {
  width: 120px;
  height: 120px;
  margin: 10px auto 14px;
}

.aso-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Orbit guide tracks — faint rings */
.aso-track {
  fill: none;
  stroke: rgba(255,255,255,0.07);
  stroke-width: 1;
}

/* Arc segments */
.aso-arc {
  fill: none;
  stroke: var(--aso-color);
  stroke-width: 1.8;
  stroke-linecap: round;
  filter: drop-shadow(0 0 3px var(--aso-color));
}
.aso-arc-dim { opacity: 0.5; }

/* Core halo */
.aso-core-halo {
  fill: var(--aso-color);
  opacity: 0.12;
  filter: blur(6px);
}

/* Core dot */
.aso-core {
  fill: var(--aso-color);
  filter: drop-shadow(0 0 5px var(--aso-color));
}

/* Rotation groups — transform-origin at SVG center (50,50) */
.aso-rot {
  transform-box: fill-box;
  transform-origin: center;
}

/* ── State: idle — slow cyan ── */
#agent-status-panel[data-state="idle"]   { --aso-color: rgba(0,212,255,0.75); }
#agent-status-panel[data-state="idle"]   .aso-rot1 { animation: aso-spin  8s linear infinite; }
#agent-status-panel[data-state="idle"]   .aso-rot2 { animation: aso-spin 13s linear infinite reverse; }
#agent-status-panel[data-state="idle"]   .aso-rot3 { animation: aso-spin 10s linear infinite; }
#agent-status-panel[data-state="idle"]   .aso-rot4 { animation: aso-spin 17s linear infinite reverse; }
#agent-status-panel[data-state="idle"]   .aso-rot5 { animation: aso-spin 12s linear infinite; }
#agent-status-panel[data-state="idle"]   .aso-core { animation: aso-breathe 3.5s ease-in-out infinite; }

/* ── State: waiting — amber, a bit faster ── */
#agent-status-panel[data-state="waiting"] { --aso-color: #f59e0b; }
#agent-status-panel[data-state="waiting"] .aso-rot1 { animation: aso-spin  4s linear infinite; }
#agent-status-panel[data-state="waiting"] .aso-rot2 { animation: aso-spin  6s linear infinite reverse; }
#agent-status-panel[data-state="waiting"] .aso-rot3 { animation: aso-spin  5s linear infinite; }
#agent-status-panel[data-state="waiting"] .aso-rot4 { animation: aso-spin  9s linear infinite reverse; }
#agent-status-panel[data-state="waiting"] .aso-rot5 { animation: aso-spin  6s linear infinite; }
#agent-status-panel[data-state="waiting"] .aso-core { animation: aso-pulse 1s ease-in-out infinite; }

/* ── State: thinking — violet, fast spin ── */
#agent-status-panel[data-state="thinking"] { --aso-color: #a78bfa; }
#agent-status-panel[data-state="thinking"] .aso-rot1 { animation: aso-spin 1.1s linear infinite; }
#agent-status-panel[data-state="thinking"] .aso-rot2 { animation: aso-spin 0.7s linear infinite reverse; }
#agent-status-panel[data-state="thinking"] .aso-rot3 { animation: aso-spin 1.4s linear infinite; }
#agent-status-panel[data-state="thinking"] .aso-rot4 { animation: aso-spin 0.5s linear infinite reverse; }
#agent-status-panel[data-state="thinking"] .aso-rot5 { animation: aso-spin 1.8s linear infinite; }
#agent-status-panel[data-state="thinking"] .aso-core { animation: aso-pulse 0.45s ease-in-out infinite; }

/* ── State: streaming — green, medium flow ── */
#agent-status-panel[data-state="streaming"] { --aso-color: #34d399; }
#agent-status-panel[data-state="streaming"] .aso-rot1 { animation: aso-spin 2.2s linear infinite; }
#agent-status-panel[data-state="streaming"] .aso-rot2 { animation: aso-spin 3.5s linear infinite reverse; }
#agent-status-panel[data-state="streaming"] .aso-rot3 { animation: aso-spin 2.8s linear infinite; }
#agent-status-panel[data-state="streaming"] .aso-rot4 { animation: aso-spin 4.5s linear infinite reverse; }
#agent-status-panel[data-state="streaming"] .aso-rot5 { animation: aso-spin 3.2s linear infinite; }
#agent-status-panel[data-state="streaming"] .aso-core { animation: aso-pulse 0.7s ease-in-out infinite; }

/* ── State: done — brief flash, stays green ── */
#agent-status-panel[data-state="done"] { --aso-color: #34d399; }
#agent-status-panel[data-state="done"] .aso-rot1 { animation: aso-spin 0.4s linear infinite; }
#agent-status-panel[data-state="done"] .aso-rot2 { animation: aso-spin 0.3s linear infinite reverse; }
#agent-status-panel[data-state="done"] .aso-rot3 { animation: aso-spin 0.5s linear infinite; }
#agent-status-panel[data-state="done"] .aso-rot4 { animation: aso-spin 0.25s linear infinite reverse; }
#agent-status-panel[data-state="done"] .aso-rot5 { animation: aso-spin 0.6s linear infinite; }
#agent-status-panel[data-state="done"] .aso-core { animation: aso-flash 0.4s ease-out forwards; }

/* ERROR state — red/pink, irregular erratic pulse to signal distress */
#agent-status-panel[data-state="error"] { --aso-color: #f87171; }
#agent-status-panel[data-state="error"] .aso-rot1 { animation: aso-spin  2.1s linear infinite; }
#agent-status-panel[data-state="error"] .aso-rot2 { animation: aso-spin  1.4s linear infinite reverse; }
#agent-status-panel[data-state="error"] .aso-rot3 { animation: aso-spin  3.3s linear infinite; }
#agent-status-panel[data-state="error"] .aso-rot4 { animation: aso-spin  1.8s linear infinite reverse; }
#agent-status-panel[data-state="error"] .aso-rot5 { animation: aso-spin  2.7s linear infinite; }
#agent-status-panel[data-state="error"] .aso-core { animation: aso-error-pulse 0.6s ease-in-out infinite; }

@keyframes aso-error-pulse {
  0%, 100% { opacity: 1;   transform: scale(1);    }
  50%       { opacity: 0.4; transform: scale(0.75); }
}

/* ── Run error bubble (failure message in the feed) ──────────────── */
.run-error-bubble {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(248, 113, 113, 0.06) !important;
  border-color: rgba(248, 113, 113, 0.25) !important;
}

.run-error-icon {
  font-size: 15px;
  flex-shrink: 0;
  margin-top: 1px;
  color: #f87171;
  filter: drop-shadow(0 0 4px rgba(248,113,113,0.5));
}

.run-error-text {
  color: #fca5a5 !important;
  font-size: 13px;
  line-height: 1.5;
}

/* Partial/failed stream bubble — dim to indicate incomplete */
.stream-failed {
  opacity: 0.6;
  border-color: rgba(248,113,113,0.2) !important;
}
.stream-failed::after {
  content: ' [incomplete]';
  font-size: 11px;
  color: #f87171;
  font-family: var(--font-mono);
  opacity: 0.7;
}

/* ── Keyframes ── */
@keyframes aso-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes aso-breathe {
  0%, 100% { transform: scale(1);    opacity: 0.75; }
  50%      { transform: scale(1.45); opacity: 1;    }
}
@keyframes aso-pulse {
  0%, 100% { transform: scale(1);   }
  50%      { transform: scale(1.6); }
}
@keyframes aso-flash {
  0%   { transform: scale(2.5); opacity: 1; }
  60%  { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1);   opacity: 1; }
}

/* ── Status label & sub-text ── */
.aso-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--aso-color);
  margin-bottom: 5px;
  text-shadow: 0 0 8px var(--aso-color);
  transition: color 0.4s ease, text-shadow 0.4s ease;
}
.aso-sub {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}

/* ── Layout columns ───────────────────────────────────────────────── */
.metrics-col {
  position: fixed;
  top: 24px;
  bottom: 120px;
  width: 360px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 10;
  overflow-y: auto;
  scrollbar-width: none;
  padding-bottom: 8px;
}
.metrics-col::-webkit-scrollbar { display: none; }

/* Anchor panels adjacent to the centered 740px chat column, 16px gap */
.metrics-left  { left:  calc(50% - 370px - 16px - 360px); }
.metrics-right { right: calc(50% - 370px - 16px - 360px); }

/* ── Response Area ────────────────────────────────────────────────── */
.response-area {
  position: fixed;
  top: 0;
  left:  calc(50% - 370px);
  right: calc(50% - 370px);
  bottom: 150px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 32px 0 16px;
  overflow-y: auto;
  overflow-x: hidden;
  pointer-events: none;
}

/* Constrain all response content to a readable column, centered */
.response-area > * {
  width: 100%;
  max-width: 740px;
  margin-left: auto;
  margin-right: auto;
  flex-shrink: 0;
  pointer-events: auto;
}

/* ── Message Bubbles ──────────────────────────────────────────────── */
.message {
  pointer-events: auto;
  width: 100%;
  max-width: 740px;
  margin-bottom: 16px;
  animation: waterfall 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
  transform: translateY(-20px);
  /* Allow bubble to fit content — don't impose a forced width on the child */
  display: block;
}

@keyframes waterfall {
  to { opacity: 1; transform: translateY(0); }
}

.message.user-msg .bubble {
  background: rgba(0,212,255,0.07);
  border: 1px solid rgba(0,212,255,0.18);
  border-radius: 12px 12px 4px 12px;
  padding: 10px 14px;
  display: inline-block;
  float: right;
  max-width: 75%;
  backdrop-filter: blur(12px);
  color: var(--text);
  font-size: 14.5px;
  clear: both;
}

.message.symi-msg .bubble {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 4px 12px 12px 12px;
  padding: 12px 16px;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.04);
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--text);
  position: relative;
  clear: both;
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
  overflow: visible;
}

.message.symi-msg .bubble::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,212,255,0.3), transparent);
}

.message-clearfix { clear: both; }

.typing-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--accent-cyan);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
  box-shadow: 0 0 4px var(--accent-cyan);
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ── Floating Prompt Bar ──────────────────────────────────────────── */
.prompt-wrap {
  position: fixed;
  bottom: 28px;
  left:  calc(50% - 370px);
  right: calc(50% - 370px);
  z-index: 20;
  display: flex;
  justify-content: center;
}

.prompt-bar {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(32px) saturate(200%);
  -webkit-backdrop-filter: blur(32px) saturate(200%);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  padding: 14px 16px 12px;
  box-shadow:
    0 0 0 1px rgba(0,212,255,0.08),
    0 8px 40px rgba(0,0,0,0.6),
    0 0 60px rgba(0,212,255,0.04),
    inset 0 1px 0 rgba(255,255,255,0.08);
  transition: border-color 0.3s, box-shadow 0.3s;
  cursor: text;
}

/* ── Prompt rows ──────────────────────────────────────────────────── */
.prompt-row-main {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.prompt-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  width: 100%;
  padding-top: 2px;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.prompt-bar:focus-within {
  border-color: rgba(0,212,255,0.3);
  box-shadow:
    0 0 0 1px rgba(0,212,255,0.15),
    0 8px 40px rgba(0,0,0,0.6),
    0 0 80px rgba(0,212,255,0.08),
    inset 0 1px 0 rgba(255,255,255,0.1);
}

.prompt-icon {
  color: var(--accent-cyan);
  opacity: 0.7;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  filter: drop-shadow(0 0 4px var(--accent-cyan));
}

.prompt-bar textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: 0.01em;
  caret-color: var(--accent-cyan);
  resize: none;
  overflow-y: hidden;
  min-height: 22px;
  max-height: calc(3 * 1.55 * 14px); /* 3 lines */
  padding: 0;
  margin: 0;
  display: block;
  scrollbar-width: none;
}

.prompt-bar textarea::-webkit-scrollbar { display: none; }

.prompt-bar textarea::placeholder {
  color: var(--text-dim);
}

.send-btn {
  background: rgba(0,212,255,0.12);
  border: 1px solid rgba(0,212,255,0.2);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.send-btn:hover {
  background: rgba(0,212,255,0.22);
  box-shadow: 0 0 16px rgba(0,212,255,0.25);
  transform: scale(1.05);
}

.send-btn:active {
  transform: scale(0.95);
}

/* ── New Session Button ───────────────────────────────────────────── */
.prompt-divider {
  width: 1px;
  height: 18px;
  background: rgba(255,255,255,0.08);
  flex-shrink: 0;
}

.new-session-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(139,92,246,0.1);
  border: 1px solid rgba(139,92,246,0.2);
  border-radius: 8px;
  padding: 0 11px;
  height: 28px;
  color: rgba(139,92,246,0.85);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, box-shadow 0.2s, transform 0.15s, opacity 0.2s;
}

.new-session-btn:hover {
  background: rgba(139,92,246,0.2);
  box-shadow: 0 0 16px rgba(139,92,246,0.2);
  transform: scale(1.03);
}

.new-session-btn:active {
  transform: scale(0.96);
}

.new-session-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

.new-session-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  font-weight: 600;
}

/* ── New Session Cleared State ───────────────────────────────────── */
.session-cleared {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 60px 20px;
  opacity: 0;
  animation: session-cleared-in 0.5s ease forwards;
}

.session-cleared-icon {
  font-size: 28px;
  opacity: 0.3;
}

.session-cleared-text {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  opacity: 0.5;
}

@keyframes session-cleared-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0);   }
}

/* ── Thinking Bubble ──────────────────────────────────────────────── */
.thinking-bubble {
  background: rgba(0,212,255,0.04) !important;
  border-color: rgba(0,212,255,0.15) !important;
  padding: 10px 16px !important;
}

.think-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.think-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--accent-cyan);
  text-shadow: 0 0 8px var(--accent-cyan);
}

.think-dots span {
  display: inline-block;
  color: var(--accent-cyan);
  animation: dot-pulse 1.2s ease-in-out infinite;
  font-size: 14px;
  opacity: 0;
}
.think-dots span:nth-child(1) { animation-delay: 0s; }
.think-dots span:nth-child(2) { animation-delay: 0.2s; }
.think-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot-pulse {
  0%, 100% { opacity: 0; transform: translateY(0); }
  50%       { opacity: 1; transform: translateY(-3px); }
}

.think-bar-wrap {
  height: 2px;
  background: rgba(255,255,255,0.06);
  border-radius: 99px;
  overflow: hidden;
}

.think-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
  border-radius: 99px;
  animation: think-scan 1s ease-in-out infinite;
}

@keyframes think-scan {
  0%   { width: 0%;   margin-left: 0%;   opacity: 1; }
  50%  { width: 60%;  margin-left: 20%;  opacity: 1; }
  100% { width: 0%;   margin-left: 100%; opacity: 0; }
}

/* ── Streaming Bubble ─────────────────────────────────────────────── */
.stream-bubble {
  position: relative;
}

.stream-bubble.streaming {
  width: 100% !important;
  border-color: rgba(0,212,255,0.25) !important;
  box-shadow:
    0 8px 32px rgba(0,0,0,0.5),
    0 0 20px rgba(0,212,255,0.06),
    inset 0 1px 0 rgba(255,255,255,0.06) !important;
  animation: stream-pulse 1.8s ease-in-out infinite;
}

@keyframes stream-pulse {
  0%, 100% { box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 20px rgba(0,212,255,0.06), inset 0 1px 0 rgba(255,255,255,0.06); }
  50%       { box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 40px rgba(0,212,255,0.12), inset 0 1px 0 rgba(255,255,255,0.06); }
}

.stream-bubble.streaming::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
  opacity: 0.6;
  animation: top-scan 2s linear infinite;
}

@keyframes top-scan {
  0%   { transform: scaleX(0); transform-origin: left; opacity: 0.8; }
  50%  { transform: scaleX(1); transform-origin: left; opacity: 0.6; }
  100% { transform: scaleX(0); transform-origin: right; opacity: 0; }
}

.stream-bubble.done {
  width: fit-content;
  max-width: 100%;
  border-color: rgba(255,255,255,0.1) !important;
  transition: border-color 0.8s, box-shadow 0.8s, width 0.3s ease;
}

/* ── Character spawn animation ────────────────────────────────────── */
.char-spawn {
  display: inline;
  color: transparent;
  text-shadow: none;
  transition: color 0.12s ease, text-shadow 0.2s ease;
}

.char-spawn.char-visible {
  color: var(--text);
  text-shadow: 0 0 8px rgba(0,212,255,0.4);
  animation: char-settle 0.4s ease forwards;
}

@keyframes char-settle {
  0%   { color: var(--accent-cyan); text-shadow: 0 0 12px var(--accent-cyan), 0 0 24px rgba(0,212,255,0.3); }
  40%  { color: rgba(200,240,255,0.95); text-shadow: 0 0 6px rgba(0,212,255,0.2); }
  100% { color: var(--text); text-shadow: none; }
}

/* ── Telemetry footer ─────────────────────────────────────────────── */
.telemetry {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.05);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.5s ease 0.2s, transform 0.5s ease 0.2s;
}

.telemetry.tele-visible {
  opacity: 1;
  transform: translateY(0);
}

.tele-item {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
}

.tele-sep {
  color: rgba(255,255,255,0.12);
  font-size: 9px;
}

/* ── Send button loading state ────────────────────────────────────── */
.send-btn.btn-loading {
  animation: btn-spin 1s linear infinite;
}
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

/* ── Connection status ────────────────────────────────────────────── */
.conn-status {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--glass-bg);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  border-radius: 99px;
  padding: 5px 12px;
  pointer-events: none;
}

.conn-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

.dot-red { background: #f87171; box-shadow: 0 0 6px #f87171; }

/* ── UI Toggle button ─────────────────────────────────────────────── */
.ui-toggle {
  position: fixed;
  top: 16px;
  right: 24px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--glass-bg);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  border-radius: 99px;
  padding: 6px 14px;
  color: var(--text-muted);
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.ui-toggle:hover {
  border-color: var(--glass-border-strong);
  color: var(--text);
  box-shadow: 0 0 16px rgba(0,212,255,0.08);
}

/* ── Scrollbar ────────────────────────────────────────────────────── */
.response-area::-webkit-scrollbar { display: none; }
.response-area { scrollbar-width: none; }

/* ═══════════════════════════════════════════════════════════════════
   CONTENT TYPES — Markdown, Thinking, Tool Cards, Code
   ═══════════════════════════════════════════════════════════════════ */

/* ── Markdown prose ────────────────────────────────────────────────── */
.msg-text {
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--text);
  word-wrap: break-word;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Paragraph spacing */
.msg-text :where(p, ul, ol, pre, blockquote, table) { margin: 0; }
.msg-text :where(p + p,
                 p + ul, p + ol, p + pre, p + blockquote, p + table,
                 ul + p, ol + p, pre + p, blockquote + p, table + p) { margin-top: 0.75em; }
.msg-text :where(li + li) { margin-top: 0.25em; }

/* Headings */
.msg-text :where(h1, h2, h3, h4, h5, h6) {
  font-weight: 600;
  line-height: 1.3;
  color: rgba(255,255,255,0.96);
  margin: 1.1em 0 0.4em;
}
.msg-text :where(h1) { font-size: 1.35em; border-bottom: 1px solid var(--glass-border); padding-bottom: 0.3em; }
.msg-text :where(h2) { font-size: 1.18em; border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 0.2em; }
.msg-text :where(h3) { font-size: 1.06em; }
.msg-text :where(h4, h5, h6) { font-size: 1em; color: rgba(255,255,255,0.8); }
.msg-text :where(h1, h2, h3, h4, h5, h6):first-child { margin-top: 0.3em; }

/* Lists */
.msg-text :where(ul, ol) { padding-left: 1.4em; }
.msg-text :where(ul)     { list-style-type: disc; }
.msg-text :where(ol)     { list-style-type: decimal; }
.msg-text :where(ul ul)  { list-style-type: circle; margin-top: 0.25em; }

/* Text formatting */
.msg-text :where(strong) { font-weight: 600; color: rgba(255,255,255,0.97); }
.msg-text :where(em)     { font-style: italic; color: rgba(255,255,255,0.82); }
.msg-text :where(del)    { text-decoration: line-through; opacity: 0.6; }
.msg-text :where(mark)   { background: rgba(251,191,36,0.2); color: #fbbf24; border-radius: 2px; padding: 0 3px; }
.msg-text :where(sup)    { font-size: 0.75em; vertical-align: super; }
.msg-text :where(sub)    { font-size: 0.75em; vertical-align: sub; }

/* Links */
.msg-text :where(a) { color: var(--accent-cyan); text-decoration: none; border-bottom: 1px solid rgba(0,212,255,0.3); }
.msg-text :where(a:hover) { border-bottom-color: var(--accent-cyan); }

/* Horizontal rule */
.msg-text :where(hr) {
  border: none;
  border-top: 1px solid var(--glass-border);
  margin: 1em 0;
}

/* Blockquote */
.msg-text :where(blockquote) {
  border-left: 2px solid rgba(0,212,255,0.3);
  margin: 0.6em 0;
  padding: 6px 14px;
  background: rgba(0,212,255,0.03);
  color: var(--text-muted);
  border-radius: 0 6px 6px 0;
}
.msg-text :where(blockquote blockquote) {
  border-left-color: rgba(139,92,246,0.4);
  background: rgba(139,92,246,0.03);
  margin-top: 6px;
}

/* ── Tables ─────────────────────────────────────────────────────────── */
.msg-text :where(table) {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 0.75em;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  overflow: hidden;
}

.msg-text :where(thead) {
  background: rgba(0,212,255,0.06);
}

.msg-text :where(th) {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-cyan);
  border: 1px solid var(--glass-border);
  padding: 8px 12px;
  text-align: left;
  background: rgba(0,0,0,0.15);
}

.msg-text :where(td) {
  border: 1px solid var(--glass-border);
  padding: 7px 12px;
  vertical-align: top;
  color: var(--text);
  line-height: 1.5;
}

.msg-text :where(tr:nth-child(even) td) {
  background: rgba(255,255,255,0.015);
}

.msg-text :where(tr:hover td) {
  background: rgba(0,212,255,0.03);
}

/* ── Inline code ────────────────────────────────────────────────────── */
.inline-code,
.msg-text :where(:not(pre) > code) {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  padding: 0.1em 0.4em;
  color: var(--accent-cyan);
}

/* ── Code blocks — full-featured ────────────────────────────────────── */
.code-block {
  margin: 0.75em 0;
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(0,0,0,0.45);
  font-family: var(--font-mono);
}

/* Full-width breakout — code gets the whole column regardless of bubble */
.code-block-full {
  width: 100%;
  max-width: 100%;
}

/* ── Header ── */
.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid var(--glass-border);
  gap: 10px;
}

.code-header-left  { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.code-header-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

/* Language badge with per-language color */
.code-lang-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--lang-color, var(--accent-cyan));
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  text-shadow: 0 0 8px var(--lang-color, var(--accent-cyan));
}

/* Filename */
.code-filename {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  border-radius: 4px;
  padding: 1px 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

/* Line count */
.code-lines-count {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-dim);
  white-space: nowrap;
}

/* Expand button */
.code-expand-btn {
  font-size: 14px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.2s;
}
.code-expand-btn:hover { color: var(--text); }

/* Copy button */
.code-copy {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
  white-space: nowrap;
}
.code-copy:hover  { color: var(--text); background: rgba(255,255,255,0.06); }
.code-copy.copied { color: var(--accent-green); }

/* ── Code body ── */
.code-body { overflow: hidden; }
.code-body-collapsed { max-height: 400px; overflow: hidden; position: relative; }
.code-body-collapsed::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 80px;
  background: linear-gradient(to bottom, transparent, rgba(0,0,0,0.8));
  pointer-events: none;
}
.code-expanded .code-body-collapsed { max-height: none; overflow: auto; }
.code-expanded .code-body-collapsed::after { display: none; }

/* Show more button */
.code-show-more {
  display: block;
  width: 100%;
  padding: 8px;
  background: rgba(255,255,255,0.03);
  border: none;
  border-top: 1px solid var(--glass-border);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  cursor: pointer;
  letter-spacing: 0.06em;
  transition: background 0.2s, color 0.2s;
  text-align: center;
}
.code-show-more:hover { background: rgba(255,255,255,0.06); color: var(--text); }

/* ── Line numbers ── */
.code-pre {
  margin: 0;
  padding: 12px 0;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.65;
}

.code-numbered { display: block; }

.code-line {
  display: flex;
  min-height: 1.65em;
}

.code-line:hover { background: rgba(255,255,255,0.03); }

.line-num {
  display: inline-block;
  min-width: 44px;
  padding: 0 12px 0 14px;
  color: rgba(255,255,255,0.2);
  text-align: right;
  user-select: none;
  border-right: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
  font-size: 11px;
  line-height: inherit;
}

.line-content {
  display: inline-block;
  padding: 0 16px;
  white-space: pre;
  flex: 1;
}

.hljs { background: transparent !important; padding: 0 !important; }

/* ── Thinking block ─────────────────────────────────────────────────── */
.msg-thinking { margin: 4px 0 8px; }

.thinking-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 0;
  color: var(--text-dim);
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  transition: color 0.2s;
}
.thinking-toggle:hover { color: var(--text-muted); }
.thinking-icon    { color: var(--accent-purple); }
.thinking-chevron { font-size: 9px; transition: transform 0.2s; }

.thinking-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}
.thinking-body.thinking-open { max-height: 600px; overflow-y: auto; }

.thinking-text {
  margin-top: 6px;
  padding: 10px 14px;
  border: 1px dashed rgba(139,92,246,0.25);
  border-radius: 8px;
  background: rgba(139,92,246,0.04);
  font-size: 12px;
  line-height: 1.65;
  color: var(--text-muted);
  white-space: pre-wrap;
  font-family: var(--font-mono);
}

/* ── Tool call card ─────────────────────────────────────────────────── */
.msg-tool-card {
  margin: 4px 0;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255,255,255,0.02);
}

.tool-header {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  color: var(--text-muted);
  font-size: 12px;
  transition: background 0.2s;
}
.tool-header:hover { background: rgba(255,255,255,0.03); }
.tool-icon    { font-size: 13px; flex-shrink: 0; }
.tool-name    { flex: 1; font-family: var(--font-mono); font-size: 11px; color: var(--text); }
.tool-chevron { font-size: 9px; color: var(--text-dim); }

.tool-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  border-top: 0 solid var(--glass-border);
}
.tool-body.tool-open { max-height: 320px; overflow-y: auto; border-top-width: 1px; }

.tool-input {
  margin: 0;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-all;
  background: rgba(0,0,0,0.25);
}

/* ── Tool result ────────────────────────────────────────────────────── */
.msg-tool-result {
  margin: 2px 0 6px;
  border: 1px solid rgba(52,211,153,0.14);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(52,211,153,0.02);
}

.result-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 11px;
  color: var(--text-dim);
}
.result-icon   { color: var(--accent-green); font-size: 12px; }
.result-label  { font-family: var(--font-mono); letter-spacing: 0.06em; flex: 1; }

.result-expand {
  font-family: var(--font-mono);
  font-size: 9px;
  background: transparent;
  border: 1px solid var(--glass-border);
  border-radius: 4px;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px 8px;
  transition: color 0.2s;
}
.result-expand:hover { color: var(--text); }

.result-preview { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; border-top: 0 solid rgba(52,211,153,0.14); }
.result-open    { max-height: 260px; overflow-y: auto; border-top-width: 1px; }

.result-text {
  margin: 0;
  padding: 8px 14px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-all;
  background: rgba(0,0,0,0.2);
}

/* ── Message image ──────────────────────────────────────────────────── */
.msg-image img {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  margin: 4px 0;
}

/* ── Copy button ────────────────────────────────────────────────────── */
.msg-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  color: var(--text-dim);
  cursor: pointer;
  padding: 5px 6px;
  opacity: 0;
  transition: opacity 0.2s, color 0.2s, background 0.2s;
  display: flex;
  align-items: center;
  line-height: 1;
}
.stream-bubble:hover .msg-copy-btn,
.msg-copy-visible   { opacity: 1; }
.msg-copy-btn:hover  { color: var(--text); background: rgba(255,255,255,0.1); }
.msg-copy-btn.copied { color: var(--accent-green); }

/* ── Timestamp ──────────────────────────────────────────────────────── */
.msg-timestamp {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-dim);
  margin-top: 10px;
  letter-spacing: 0.05em;
}


/* ── Task lists ─────────────────────────────────────────────────────── */
.msg-text :where(li.task-item) {
  list-style: none;
  margin-left: -1.4em;
  padding-left: 0.2em;
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.task-cb {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--glass-border-strong);
  border-radius: 3px;
  background: transparent;
  flex-shrink: 0;
  position: relative;
  top: 2px;
  cursor: default;
}

.task-cb:checked {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

.task-cb:checked::after {
  content: '';
  position: absolute;
  top: 1px; left: 3px;
  width: 5px; height: 8px;
  border: 2px solid #000;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

.task-done > * { opacity: 0.55; }
.task-done .task-cb + span,
.task-done .task-cb ~ * { text-decoration: line-through; }

/* ── Table overflow wrapper ──────────────────────────────────────────── */
.msg-text :where(table) {
  display: block;
  overflow-x: auto;
  white-space: nowrap;
}
/* Allow cells to wrap when content isn't too wide */
.msg-text :where(th, td) {
  white-space: normal;
  min-width: 80px;
}

/* ── Details / Summary (collapsible sections) ─────────────────────────── */
.msg-text :where(details) {
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 0;
  margin: 0.6em 0;
  overflow: hidden;
  background: rgba(255,255,255,0.02);
}

.msg-text :where(summary) {
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-muted);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
  transition: background 0.2s;
}
.msg-text :where(summary):hover { background: rgba(255,255,255,0.03); }
.msg-text :where(summary)::before {
  content: '▸';
  font-size: 9px;
  color: var(--accent-cyan);
  transition: transform 0.2s;
}
.msg-text :where(details[open] summary)::before {
  transform: rotate(90deg);
}
.msg-text :where(details) > *:not(summary) {
  padding: 0 14px 10px;
}

/* ── Spacing improvements ────────────────────────────────────────────── */
.bubble-content + .bubble-content { margin-top: 0.5em; }

.msg-text :where(h1 + p, h2 + p, h3 + p) { margin-top: 0.4em; }
.msg-text :where(p:last-child, ul:last-child, ol:last-child) { margin-bottom: 0; }

/* Separator after heading when followed by block content */
.msg-text :where(h2, h3) {
  padding-top: 0.3em;
}

/* Better nested list indent */
.msg-text :where(ul ul, ol ol, ul ol, ol ul) {
  margin-top: 0.25em;
  margin-bottom: 0.25em;
  padding-left: 1.2em;
}

/* ── Keyboard shortcut styling ───────────────────────────────────────── */
.msg-text :where(kbd) {
  font-family: var(--font-mono);
  font-size: 0.8em;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-bottom: 2px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--text);
}

/* ── Abbr tooltip ────────────────────────────────────────────────────── */
.msg-text :where(abbr[title]) {
  border-bottom: 1px dotted var(--text-muted);
  cursor: help;
  text-decoration: none;
}

/* ── Scrollbar ────────────────────────────────────────────────────── */
.response-area::-webkit-scrollbar { display: none; }
.response-area { scrollbar-width: none; }

/* ══════════════════════════════════════════════════════════════════════
   COMMAND MENU SYSTEM
   ══════════════════════════════════════════════════════════════════════ */

/* ── Group accent colours ─────────────────────────────────────────── */
:root {
  --cmd-chat:      #00d4ff;
  --cmd-control:   #60a5fa;
  --cmd-agent:     #a78bfa;
  --cmd-settings:  #f59e0b;
  --cmd-resources: #34d399;
}

/* ── Menu Trigger Button ──────────────────────────────────────────── */
.menu-trigger {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 50;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass-bg);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.menu-trigger:hover {
  color: var(--accent-cyan);
  border-color: rgba(0,212,255,0.35);
  box-shadow: 0 0 12px rgba(0,212,255,0.15);
}
.menu-trigger:active { transform: scale(0.93); }

/* Icon swap: grid → close */
.menu-icon-close { display: none; }
.menu-trigger.menu-open .menu-icon-grid  { display: none; }
.menu-trigger.menu-open .menu-icon-close { display: block; color: var(--accent-cyan); }
.menu-trigger.menu-open {
  color: var(--accent-cyan);
  border-color: rgba(0,212,255,0.4);
  box-shadow: 0 0 16px rgba(0,212,255,0.2);
}

/* ── Full-Screen Overlay ──────────────────────────────────────────── */
.cmd-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Hidden state */
  opacity: 0;
  pointer-events: none;
  transform: scale(0.97);
  transition: opacity 0.28s ease, transform 0.28s ease;
}
.cmd-overlay.open {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

/* Dark glass backdrop */
.cmd-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 8, 14, 0.9);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

/* Shell (content on top of backdrop) */
.cmd-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1080px;
  padding: 0 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Header Bar ───────────────────────────────────────────────────── */
.cmd-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--glass-border);
}
.cmd-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cmd-brand-glyph {
  font-size: 22px;
  color: var(--accent-cyan);
  text-shadow: 0 0 12px var(--accent-cyan);
  animation: aso-breathe 3s ease-in-out infinite;
}
.cmd-brand-name {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.15em;
}
.cmd-brand-sep {
  font-size: 16px;
  color: var(--text-dim);
  margin: 0 2px;
}
.cmd-brand-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.22em;
  padding-top: 2px;
}
.cmd-esc-hint {
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 5px;
}
.cmd-kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 6px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 4px;
  color: var(--text-muted);
}

/* ── Command Grid ─────────────────────────────────────────────────── */
.cmd-grid {
  display: grid;
  grid-template-columns: 200px 1fr 200px;
  grid-template-rows: auto auto;
  gap: 14px;
  width: 100%;
}

.cmd-group--chat      { grid-column: 1; grid-row: 1 / 3; }
.cmd-group--control   { grid-column: 2; grid-row: 1; }
.cmd-group--agent     { grid-column: 3; grid-row: 1; }
.cmd-group--settings  { grid-column: 2; grid-row: 2; }
.cmd-group--resources { grid-column: 3; grid-row: 2; }

/* ── Group Card ───────────────────────────────────────────────────── */
.cmd-group {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  /* Stagger-reveal when overlay opens */
  opacity: 0;
  transform: translateY(14px);
  transition: border-color 0.25s, box-shadow 0.25s;
}
.cmd-overlay.open .cmd-group {
  animation: cmd-card-in 0.32s ease forwards;
}
.cmd-overlay.open .cmd-group:nth-child(1) { animation-delay:  30ms; }
.cmd-overlay.open .cmd-group:nth-child(2) { animation-delay:  80ms; }
.cmd-overlay.open .cmd-group:nth-child(3) { animation-delay: 130ms; }
.cmd-overlay.open .cmd-group:nth-child(4) { animation-delay: 180ms; }
.cmd-overlay.open .cmd-group:nth-child(5) { animation-delay: 230ms; }

@keyframes cmd-card-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Per-group accent borders & hover glow */
.cmd-group--chat:hover      { border-color: rgba(0,212,255,0.35);   box-shadow: 0 0 20px rgba(0,212,255,0.06); }
.cmd-group--control:hover   { border-color: rgba(96,165,250,0.35);  box-shadow: 0 0 20px rgba(96,165,250,0.06); }
.cmd-group--agent:hover     { border-color: rgba(167,139,250,0.35); box-shadow: 0 0 20px rgba(167,139,250,0.06); }
.cmd-group--settings:hover  { border-color: rgba(245,158,11,0.35);  box-shadow: 0 0 20px rgba(245,158,11,0.06); }
.cmd-group--resources:hover { border-color: rgba(52,211,153,0.35);  box-shadow: 0 0 20px rgba(52,211,153,0.06); }

/* ── Group Header ─────────────────────────────────────────────────── */
.cmd-group-hd {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--glass-border);
}
.cmd-group-svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.cmd-group-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
}

/* Accent colours on group labels and icons */
.cmd-group--chat      .cmd-group-hd { color: var(--cmd-chat); }
.cmd-group--control   .cmd-group-hd { color: var(--cmd-control); }
.cmd-group--agent     .cmd-group-hd { color: var(--cmd-agent); }
.cmd-group--settings  .cmd-group-hd { color: var(--cmd-settings); }
.cmd-group--resources .cmd-group-hd { color: var(--cmd-resources); }

/* ── Items List ───────────────────────────────────────────────────── */
.cmd-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

/* 3-column sub-grid for CONTROL (6 items) */
.cmd-items--grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

/* ── Individual Item ──────────────────────────────────────────────── */
.cmd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: rgba(255,255,255,0.025);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, transform 0.15s;
}
.cmd-item:hover {
  background: rgba(255,255,255,0.06);
  transform: translateY(-1px);
}
/* Per-group item hover accent */
.cmd-group--chat      .cmd-item:hover { border-color: rgba(0,212,255,0.3);   }
.cmd-group--control   .cmd-item:hover { border-color: rgba(96,165,250,0.3);  }
.cmd-group--agent     .cmd-item:hover { border-color: rgba(167,139,250,0.3); }
.cmd-group--settings  .cmd-item:hover { border-color: rgba(245,158,11,0.3);  }
.cmd-group--resources .cmd-item:hover { border-color: rgba(52,211,153,0.3);  }

.cmd-item-icon {
  font-size: 16px;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
  opacity: 0.7;
}
.cmd-group--chat      .cmd-item-icon { color: var(--cmd-chat); }
.cmd-group--control   .cmd-item-icon { color: var(--cmd-control); }
.cmd-group--agent     .cmd-item-icon { color: var(--cmd-agent); }
.cmd-group--settings  .cmd-item-icon { color: var(--cmd-settings); }
.cmd-group--resources .cmd-item-icon { color: var(--cmd-resources); }

.cmd-item-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.cmd-item-name {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cmd-item-desc {
  font-size: 10px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cmd-item-badge {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 2px 6px;
  border-radius: 99px;
  background: rgba(0,212,255,0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(0,212,255,0.25);
  flex-shrink: 0;
}

/* ── History button ─────────────────────────────────────────────────── */
.history-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 11px;
  height: 28px;
  background: rgba(139,92,246,0.08);
  border: 1px solid rgba(139,92,246,0.2);
  border-radius: 8px;
  color: rgba(139,92,246,0.85);
  font-size: 10px; font-family: var(--font-mono); letter-spacing: 0.08em; font-weight: 600;
  cursor: pointer; transition: all 0.2s; white-space: nowrap; flex-shrink: 0;
}
.history-btn:hover {
  background: rgba(139,92,246,0.16);
  border-color: rgba(139,92,246,0.4);
  box-shadow: 0 0 12px rgba(139,92,246,0.12);
}
.history-btn-label { font-size: 10px; }

/* ── History overlay + drawer ───────────────────────────────────────── */
.history-overlay {
  position: fixed; inset: 0; z-index: 1100;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
}
.history-overlay.open { opacity: 1; pointer-events: auto; }

.history-drawer {
  position: fixed; top: 0; right: -440px; height: 100vh; width: 420px;
  z-index: 1101;
  background: rgba(10,12,20,0.97);
  border-left: 1px solid rgba(139,92,246,0.25);
  box-shadow: -20px 0 60px rgba(0,0,0,0.6);
  display: flex; flex-direction: column;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.history-drawer.open { right: 0; }

.history-drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 14px;
  border-bottom: 1px solid rgba(139,92,246,0.15);
  flex-shrink: 0;
}
.history-drawer-title {
  display: flex; align-items: center; gap: 7px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  letter-spacing: 0.14em; color: rgba(139,92,246,0.9);
}
.history-close-btn {
  background: none; border: none; color: var(--text-dim);
  font-size: 13px; cursor: pointer; padding: 4px 6px; border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.history-close-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.06); }

.history-drawer-body {
  flex: 1; overflow-y: auto; padding: 12px 0;
}
.history-drawer-body::-webkit-scrollbar { width: 4px; }
.history-drawer-body::-webkit-scrollbar-track { background: transparent; }
.history-drawer-body::-webkit-scrollbar-thumb { background: rgba(139,92,246,0.3); border-radius: 2px; }

.history-loading {
  padding: 24px 18px;
  color: var(--text-dim);
  font-size: 12px; font-family: var(--font-mono);
  text-align: center;
}

/* ── Session list items ─────────────────────────────────────────────── */
.history-session-item {
  padding: 12px 18px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.15s;
  position: relative;
}
.history-session-item:hover { background: rgba(139,92,246,0.07); }
.history-session-item:last-child { border-bottom: none; }

.history-session-meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 5px;
}
.history-session-date {
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  color: rgba(139,92,246,0.8); letter-spacing: 0.06em;
}
.history-session-count {
  font-family: var(--font-mono); font-size: 9px;
  color: var(--text-dim); letter-spacing: 0.05em;
}
.history-session-preview {
  font-size: 12px; color: var(--text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.4;
}
.history-session-badge {
  display: inline-block; margin-bottom: 4px;
  font-family: var(--font-mono); font-size: 9px; font-weight: 700;
  letter-spacing: 0.1em; padding: 2px 6px; border-radius: 99px;
}
.history-session-badge.live {
  background: rgba(0,212,255,0.12); color: var(--accent-cyan);
  border: 1px solid rgba(0,212,255,0.25);
}
.history-session-badge.archived {
  background: rgba(139,92,246,0.1); color: rgba(139,92,246,0.7);
  border: 1px solid rgba(139,92,246,0.2);
}

/* ── Archive viewer banner ──────────────────────────────────────────── */
.archive-banner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; margin: 0 0 8px;
  background: rgba(139,92,246,0.1);
  border-bottom: 1px solid rgba(139,92,246,0.2);
  flex-shrink: 0;
}
.archive-banner-label {
  font-family: var(--font-mono); font-size: 10px;
  color: rgba(139,92,246,0.8); letter-spacing: 0.08em;
}
.archive-banner-back {
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  color: rgba(139,92,246,0.9); cursor: pointer;
  background: none; border: none; padding: 3px 8px;
  border: 1px solid rgba(139,92,246,0.3); border-radius: 6px;
  transition: all 0.15s;
}
.archive-banner-back:hover { background: rgba(139,92,246,0.15); }

.history-transcript {
  flex: 1; overflow-y: auto; padding: 8px 12px;
}
.history-transcript::-webkit-scrollbar { width: 4px; }
.history-transcript::-webkit-scrollbar-thumb { background: rgba(139,92,246,0.3); border-radius: 2px; }

.history-msg {
  margin-bottom: 12px; font-size: 12.5px; line-height: 1.5;
}
.history-msg-role {
  font-family: var(--font-mono); font-size: 9px; font-weight: 700;
  letter-spacing: 0.1em; margin-bottom: 3px;
}
.history-msg-role.user  { color: var(--accent-cyan); }
.history-msg-role.assistant { color: rgba(139,92,246,0.8); }
.history-msg-text {
  color: var(--text-secondary); padding: 6px 10px;
  background: rgba(255,255,255,0.025);
  border-radius: 6px; border-left: 2px solid rgba(255,255,255,0.08);
  white-space: pre-wrap; word-break: break-word;
}
.history-msg.assistant .history-msg-text {
  border-left-color: rgba(139,92,246,0.3);
}
.history-msg.user .history-msg-text {
  border-left-color: rgba(0,212,255,0.25);
}

.history-empty {
  padding: 32px 18px; text-align: center;
  color: var(--text-dim); font-size: 12px; font-family: var(--font-mono);
}

/* ── Archive toast ──────────────────────────────────────────────────── */
.session-archive-toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%) translateY(20px);
  z-index: 1200;
  display: flex; align-items: center; gap: 7px;
  padding: 8px 16px;
  background: rgba(15,17,28,0.95);
  border: 1px solid rgba(139,92,246,0.35);
  border-radius: 99px;
  font-size: 11.5px; font-family: var(--font-mono); color: var(--text-secondary);
  box-shadow: 0 4px 24px rgba(0,0,0,0.5), 0 0 20px rgba(139,92,246,0.08);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  white-space: nowrap;
}
.session-archive-toast.show {
  opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0);
}
#session-archive-link {
  color: rgba(139,92,246,0.9); cursor: pointer; font-weight: 600;
  text-decoration: underline; text-underline-offset: 2px;
}
#session-archive-link:hover { color: rgba(139,92,246,1); }

/* ── Queue button ───────────────────────────────────────────────────── */
.queue-btn {
  display: none; /* hidden until streaming starts */
  align-items: center;
  gap: 5px;
  padding: 0 11px;
  height: 28px;
  background: rgba(0,212,255,0.08);
  border: 1px solid rgba(0,212,255,0.2);
  border-radius: 8px;
  color: rgba(0,212,255,0.8);
  font-size: 10px; font-family: var(--font-mono); letter-spacing: 0.08em; font-weight: 600;
  cursor: pointer; flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}
.queue-btn.visible { display: flex; }
.queue-btn:hover {
  background: rgba(0,212,255,0.15);
  border-color: rgba(0,212,255,0.4);
  box-shadow: 0 0 12px rgba(0,212,255,0.12);
}

/* Active state — item is queued */
.queue-btn.has-queue {
  background: rgba(0,212,255,0.14);
  border-color: rgba(0,212,255,0.45);
  color: var(--accent-cyan);
  box-shadow: 0 0 14px rgba(0,212,255,0.1);
}

.queue-cancel-x {
  display: none;
  margin-left: 2px;
  font-size: 10px;
  opacity: 0.6;
  line-height: 1;
  padding: 1px 3px;
  border-radius: 3px;
  transition: opacity 0.15s, background 0.15s;
}
.queue-btn.has-queue .queue-cancel-x { display: inline; }
.queue-cancel-x:hover { opacity: 1; background: rgba(255,255,255,0.1); }

/* ── Stop button ────────────────────────────────────────────────────── */
.stop-btn {
  display: none; /* hidden until streaming starts */
  align-items: center;
  gap: 5px;
  padding: 0 11px;
  height: 28px;
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.22);
  border-radius: 8px;
  color: rgba(239,68,68,0.85);
  font-size: 10px; font-family: var(--font-mono); letter-spacing: 0.08em; font-weight: 600;
  cursor: pointer; flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}
.stop-btn.visible { display: flex; }
.stop-btn:hover {
  background: rgba(239,68,68,0.18);
  border-color: rgba(239,68,68,0.5);
  box-shadow: 0 0 14px rgba(239,68,68,0.14);
  color: rgba(239,68,68,1);
}
.stop-btn-label { font-size: 10px; }

/* ── Page Navigation Overlay ────────────────────────────────────────── */
.page-overlay {
  position: fixed;
  inset: 0;
  z-index: 1050;
  display: flex;
  flex-direction: column;
  background: rgba(8, 10, 18, 0.98);
  backdrop-filter: blur(24px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.page-overlay.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.page-overlay-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(139,92,246,0.18);
  background: rgba(10,12,20,0.95);
  flex-shrink: 0;
  height: 46px;
}

.page-back-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px; height: 28px;
  background: rgba(139,92,246,0.1);
  border: 1px solid rgba(139,92,246,0.25);
  border-radius: 8px;
  color: rgba(139,92,246,0.9);
  font-size: 11px; font-family: var(--font-mono); font-weight: 600; letter-spacing: 0.07em;
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
  transition: all 0.15s;
}
.page-back-btn:hover {
  background: rgba(139,92,246,0.2);
  border-color: rgba(139,92,246,0.45);
}

.page-overlay-title {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 700; letter-spacing: 0.14em;
  color: rgba(255,255,255,0.6);
  text-align: center;
}

.page-popout-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 11px; height: 28px;
  background: rgba(0,212,255,0.06);
  border: 1px solid rgba(0,212,255,0.15);
  border-radius: 8px;
  color: rgba(0,212,255,0.6);
  font-size: 10px; font-family: var(--font-mono); letter-spacing: 0.07em;
  cursor: pointer; text-decoration: none; flex-shrink: 0;
  transition: all 0.15s;
}
.page-popout-btn:hover {
  background: rgba(0,212,255,0.12);
  border-color: rgba(0,212,255,0.35);
  color: rgba(0,212,255,0.9);
}

.page-overlay-frame {
  flex: 1;
  border: none;
  width: 100%;
  background: transparent;
}

/* ── Native Logs Viewer ──────────────────────────────────────────────── */
#native-logs-container {
  display: none;
  flex-direction: column;
  position: absolute;
  inset: 56px 0 0 0;
  background: var(--bg);
  z-index: 10;
  font-family: var(--mono);
  font-size: 12px;
}

.logs-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.logs-filters {
  display: flex;
  gap: 6px;
  align-items: center;
}

.logs-level-toggle {
  display: flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.logs-level-toggle input {
  width: 12px;
  height: 12px;
  accent-color: var(--accent-cyan);
  cursor: pointer;
}

.logs-level-badge {
  opacity: 0.9;
}

.logs-level-toggle input:not(:checked) + .logs-level-badge {
  opacity: 0.3;
  text-decoration: line-through;
}

.logs-search {
  flex: 1;
  min-width: 150px;
}

#logs-search-input {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 6px 10px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  outline: none;
  transition: border-color 0.2s;
}

#logs-search-input:focus {
  border-color: rgba(0,212,255,0.3);
}

.logs-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logs-auto-follow {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-dim);
  cursor: pointer;
}

.logs-auto-follow input {
  accent-color: var(--accent-cyan);
  cursor: pointer;
}

#logs-export-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 5px 12px;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

#logs-export-btn:hover {
  border-color: rgba(0,212,255,0.3);
  color: var(--text);
}

.logs-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.logs-entries {
  padding: 0 16px;
}

.log-line {
  display: flex;
  gap: 8px;
  padding: 2px 8px;
  border-radius: 4px;
  line-height: 1.6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.log-line:hover {
  background: rgba(255,255,255,0.03);
}

.log-time {
  color: rgba(255,255,255,0.3);
  flex-shrink: 0;
  min-width: 70px;
  font-size: 11px;
}

.log-level {
  flex-shrink: 0;
  min-width: 44px;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.05em;
}

.log-sub {
  color: rgba(0,212,255,0.6);
  flex-shrink: 0;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
}

.log-msg {
  color: rgba(255,255,255,0.75);
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
}

.log-empty {
  color: var(--text-dim);
  text-align: center;
  padding: 40px 0;
  font-size: 13px;
}
