/* ── 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: 18px 4px;
  overflow: visible;
  /* Override .glass-panel so the brand floats without a card background. */
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  box-shadow: none;
}

.brand-panel:hover {
  border: none;
  box-shadow: none;
}

.brand-panel::before,
.brand-panel::after {
  display: 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.1);
  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 Routing select ──────────────────────────────────────────── */
.model-routing-select {
  width: 100%;
  display: block;
  padding: 8px 22px 8px 8px;
  margin-bottom: 6px;
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position:
    calc(100% - 10px) 50%,
    calc(100% - 6px) 50%;
  background-size:
    4px 4px,
    4px 4px;
  background-repeat: no-repeat;
  text-overflow: ellipsis;
  overflow: hidden;
}
.model-routing-select:hover {
  border-color: var(--accent-cyan);
  color: var(--text);
}
.model-routing-select:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.12);
}
.model-routing-select option {
  background: #0a0a0a;
  color: var(--text);
  padding: 4px 0;
}
.model-routing-select optgroup {
  background: #0a0a0a;
  color: var(--accent-cyan);
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 10px;
}
.model-status {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  text-align: center;
  min-height: 14px;
}

/* ── Agent Status Orb ─────────────────────────────────────────────── */
.agent-status-panel {
  text-align: center;
  /* Override .glass-panel so the orb floats without a card background. */
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  box-shadow: none;
}

.agent-status-panel:hover {
  border: none;
  box-shadow: none;
}

.agent-status-panel::before,
.agent-status-panel::after {
  display: none;
}

.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;
}

/* ── Secondary "Working" indicator ── */
.aso-working {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.aso-working.active {
  display: flex;
  opacity: 1;
}
.aso-working-asterisk {
  display: inline-block;
  font-size: 12px;
  color: var(--aso-color, rgba(0, 212, 255, 0.75));
  animation: aso-spin 1.5s linear infinite;
  filter: drop-shadow(0 0 4px var(--aso-color, rgba(0, 212, 255, 0.75)));
}
.aso-working-text {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* ── Layout columns ───────────────────────────────────────────────── */
.metrics-col {
  position: fixed;
  top: 24px;
  /* Stage C.3 (3.5.24): align with the bottom of the prompt-wrap
     (which sits at `bottom: 28px`) so the side columns end at the
     same vertical level as the prompt input's bottom edge. The
     columns are horizontally clear of the prompt-bar (different
     x-ranges) so this only adds usable vertical space — no overlap.
     Previously this was `bottom: 120px` which left ~90px of unused
     space at the bottom and forced symframe content (especially the
     AWAITING footer) to be squeezed off-screen. */
  bottom: 28px;
  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);
}

/* ── Symframe (right-column dynamic display) ──────────────────────── */
/* Stage B (3.5.20): the column is now layered. .symframe-stack holds
   the substrate (ambient reasoning behind everything) and the cards
   (foreground artifacts) in a single CSS grid cell via grid-area, so
   they overlap. Cards have backdrop-filter so the substrate breathes
   THROUGH them. Header floats on top, unchanged.

   The "reasoning live dot" (id="reasoning-live-dot") moved from inside
   the now-removed reasoning panel up into the header row, where it
   still pulses on agent activity (app.js:840-845 untouched, single id
   continues to bind that semantic). */
/* Stage C.4 (3.5.25): switched the symframe from flex to grid. The
   flex-based layout (flex: 1 1 0 + min-height: 0 + child grid
   overflow: hidden) intermittently failed to bound the substrate's
   intrinsic content size — observed on real hardware where the
   substrate's reasoning entries still pushed the AWAITING footer
   past the viewport.

   Grid handles the "auto-row + 1fr-row + auto-row" pattern natively:
   the 1fr row is constrained to whatever space remains after the
   two auto rows resolve. There's no flex-basis-vs-content-size
   negotiation to get wrong. The grid track shrinks to fit and the
   substrate's overflow-y reliably engages. */
.symframe {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 8px;
  height: 100%;
  overflow: hidden;
}
.symframe-header {
  padding: 8px 10px 10px;
  border-bottom: 1px solid rgba(0, 212, 255, 0.12);
  margin-bottom: 4px;
  min-height: 0;
}
.symframe-header-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.symframe-title {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--accent-cyan);
}
.symframe-count {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  opacity: 0.7;
  text-transform: uppercase;
}
.symframe-sub {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  opacity: 0.55;
  margin-top: 4px;
  line-height: 1.4;
}

/* ── Stage D (3.5.26) mode chips + per-mode layout ───────────────── */
.symframe-modes {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}
.mode-chip {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(0, 212, 255, 0.32);
  background: transparent;
  padding: 0;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.15s ease;
  flex-shrink: 0;
}
.mode-chip:hover {
  border-color: var(--accent-cyan);
  background: rgba(0, 212, 255, 0.15);
  transform: scale(1.15);
}
.mode-chip.active {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 6px rgba(0, 212, 255, 0.5);
}
.mode-auto {
  margin-left: auto;
  padding: 2px 8px;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent-cyan);
  background: rgba(0, 212, 255, 0.08);
  border: 1px solid rgba(0, 212, 255, 0.32);
  border-radius: 8px;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}
.mode-auto:hover {
  background: rgba(0, 212, 255, 0.2);
  color: var(--text);
}

/* ── Per-mode layout overrides ───────────────────────────────── */
/* Default (ambient): inherits the base .symframe grid above —
   auto / 1fr / auto rows. No override needed. */

/* Focus mode: hide AWAITING; dim substrate to a soft texture; the
   foreground card takes the visual stage. If a focusedId is set, the
   matching card gets a cyan halo + others fade out. */
.symframe[data-mode="focus"] {
  grid-template-rows: auto 1fr 0;
}
.symframe[data-mode="focus"] .symframe-awaiting {
  display: none;
}
.symframe[data-mode="focus"] .symframe-substrate {
  opacity: 0.2;
  pointer-events: none;
  filter: blur(2px);
  transition:
    opacity 0.4s ease,
    filter 0.4s ease;
}
/* When focusedId is set, dim non-matching cards. */
.symframe[data-mode="focus"][data-focus-id] .symframe-card-dynamic {
  opacity: 0.25;
  transition: opacity 0.4s ease;
}
.symframe[data-mode="focus"][data-focus-id] .symframe-card-dynamic:hover {
  opacity: 0.6;
}
/* The focused card gets a halo and stays sharp. Selector is built
   dynamically by symframe.js via the [data-focus-id] attribute and
   the card's own [data-card-id]; CSS can't directly match across
   them, so we use a generic "the card whose id matches" pattern via
   :has() (when supported) plus a fallback class added by JS. */
.symframe[data-mode="focus"] .symframe-card-focused {
  opacity: 1 !important;
  box-shadow:
    0 0 24px rgba(0, 212, 255, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 4px 12px rgba(0, 0, 0, 0.25);
  border-color: var(--accent-cyan) !important;
  transform: scale(1.02);
  transform-origin: center;
  transition:
    box-shadow 0.4s ease,
    border-color 0.4s ease,
    transform 0.4s ease;
}

/* Awaiting mode: footer dominant; cards collapse to title strips;
   substrate dims to a status band. */
.symframe[data-mode="awaiting"] {
  grid-template-rows: auto minmax(60px, 1fr) 4fr;
}
.symframe[data-mode="awaiting"] .symframe-substrate {
  opacity: 0.35;
}
.symframe[data-mode="awaiting"] .symframe-card-dynamic {
  max-height: 38px;
  overflow: hidden;
  transition:
    max-height 0.4s ease,
    opacity 0.4s ease;
}
.symframe[data-mode="awaiting"] .symframe-card-dynamic .symframe-card-body,
.symframe[data-mode="awaiting"] .symframe-card-dynamic .symframe-card-actions {
  display: none;
}
.symframe[data-mode="awaiting"] .symframe-awaiting {
  max-height: none;
  background: rgba(0, 212, 255, 0.04);
  border-radius: 10px;
  margin-top: 8px;
}
.symframe[data-mode="awaiting"] .awaiting-list {
  max-height: none;
}

/* Quiet mode: only the substrate breathes. Cards + AWAITING hidden.
   This is the "deep think" or "nothing to surface" posture. */
.symframe[data-mode="quiet"] {
  grid-template-rows: auto 1fr;
}
.symframe[data-mode="quiet"] .symframe-cards,
.symframe[data-mode="quiet"] .symframe-awaiting {
  display: none;
}

/* Reduced-motion: drop the per-mode transitions. The data-mode
   attribute still flips; just no animated handoff between modes. */
@media (prefers-reduced-motion: reduce) {
  .symframe[data-mode="focus"] .symframe-substrate,
  .symframe[data-mode="focus"][data-focus-id] .symframe-card-dynamic,
  .symframe[data-mode="focus"] .symframe-card-focused,
  .symframe[data-mode="awaiting"] .symframe-substrate,
  .symframe[data-mode="awaiting"] .symframe-card-dynamic {
    transition: none;
  }
}

/* The stack — substrate + cards share a single grid cell so they
   overlap on the z-axis. Cards on top (z:1) with backdrop-filter let
   the substrate (z:0) show through.

   Stage C.2 sizing fixes (after the substrate was observed bursting
   the column on a long reasoning session):
     - flex: 1 1 0   force pure flex-grow, ignore intrinsic content size
     - min-height: 0 break the default min-height:auto so the flex
                     algorithm can actually shrink this child below
                     its content size — required for the substrate's
                     overflow-y:auto to engage
     - grid-template-rows: 1fr explicitly bound the row height so the
                     grid cell tracks the stack's measured size, not
                     its content size
     - overflow: hidden on the stack as belt-and-suspenders so any
                     stray overflow doesn't leak past the cell bounds
     - min-height: 0 on each grid child for the same reason
*/
.symframe-stack {
  position: relative;
  min-height: 0;
  display: grid;
  grid-template-areas: "overlay";
  grid-template-rows: 1fr;
  overflow: hidden;
}
.symframe-cards {
  grid-area: overlay;
  z-index: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 212, 255, 0.12) transparent;
  /* Let scroll/click events fall through the empty space between cards
     down to the substrate, so the user can scroll reasoning even when
     foreground cards are foregrounded. Cards themselves re-enable
     pointer-events on their own root. */
  pointer-events: none;
}
.symframe-cards > * {
  pointer-events: auto;
}
.symframe-cards::-webkit-scrollbar {
  width: 3px;
}
.symframe-cards::-webkit-scrollbar-thumb {
  background: rgba(0, 212, 255, 0.12);
  border-radius: 2px;
}

/* ── Substrate (ambient reasoning layer, Stage B) ──────────────────── */
/* Lives behind the cards in the same grid cell. Independently
   scrollable. Newest entries prepend at the top; live entry pinned at
   index 0 with no decay; older entries fade per DECAY_TIERS (see
   glass-ui/js/symframe-substrate.js). */
.symframe-substrate {
  grid-area: overlay;
  z-index: 0;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 2px 4px 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 212, 255, 0.18) transparent;
}
.symframe-substrate::-webkit-scrollbar {
  width: 3px;
}
.symframe-substrate::-webkit-scrollbar-thumb {
  background: rgba(0, 212, 255, 0.18);
  border-radius: 2px;
}

/* Substrate entry — decay-driven visual. Custom properties are written
   per-entry by the JS tick; CSS just consumes them with a transition
   so changes ease rather than snap. */
.substrate-entry {
  opacity: var(--substrate-opacity, 1);
  filter: blur(var(--substrate-blur, 0));
  transform: scale(var(--substrate-scale, 1));
  transform-origin: top left;
  transition:
    opacity 1.2s ease,
    filter 1.2s ease,
    transform 1.2s ease,
    max-height 0.6s ease;
}

/* Live trace — pinned at top, exempt from decay, with a pulsing dot. */
.substrate-entry.substrate-live {
  opacity: 1;
  filter: none;
  transform: none;
  border-color: rgba(0, 212, 255, 0.32);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.08);
}
.substrate-live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-cyan);
  margin-right: 6px;
  animation: pulse 1.2s ease-in-out infinite;
  flex-shrink: 0;
}

/* Texture tier — oldest entries collapse to thin horizontal strokes
   that read as panel texture rather than content. Hover restores
   readability. */
.substrate-entry.substrate-texture {
  max-height: 2px;
  padding: 0;
  border-width: 0;
  border-top: 1px solid rgba(0, 212, 255, 0.06);
  overflow: hidden;
}
.substrate-entry.substrate-texture:hover {
  max-height: 200px;
  padding: 6px 8px;
  border: 1px solid rgba(0, 212, 255, 0.18);
  opacity: 0.7;
  filter: none;
}

/* Run separator — survives decay better than entries (a structural
   landmark), but still respects the substrate-entry transitions. */
.substrate-run-sep {
  border-color: transparent !important;
  background: transparent !important;
  padding: 0 !important;
}

/* Quiet mind — empty state. A slow-pulsing dot with a label, centered
   in the substrate. CSS-only animation. Visible when no reasoning has
   happened yet (or has been cleared); foreground cards float over it. */
.substrate-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 0;
  margin: auto;
  opacity: 0.85;
}
.substrate-quiet-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(
    circle at center,
    rgba(0, 212, 255, 0.45) 0%,
    rgba(0, 212, 255, 0) 70%
  );
  animation: quiet-pulse 3.2s ease-in-out infinite;
}
.substrate-quiet-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  opacity: 0.5;
}
@keyframes quiet-pulse {
  0%,
  100% {
    transform: scale(0.85);
    opacity: 0.45;
  }
  50% {
    transform: scale(1.18);
    opacity: 0.85;
  }
}

/* Reduced motion — collapse decay transitions to opacity-only at 200ms
   and freeze quiet-pulse on the midpoint frame. The substrate stays
   informative; the panel stays still. */
@media (prefers-reduced-motion: reduce) {
  .substrate-entry {
    transition: opacity 0.2s ease;
    filter: none !important;
    transform: none !important;
  }
  .substrate-live-dot,
  .substrate-quiet-dot {
    animation: none;
    opacity: 0.85;
  }
}
/* Card chrome — overrides the per-panel transparent treatment from the
   floating-panels arc (3.4.10/11/12/13) for the panels that now live
   inside the symframe. Higher specificity (`.symframe .symframe-card`)
   wins over the panel-specific class selectors. */
.symframe .symframe-card {
  position: relative;
  /* Stage B: cards need enough opacity to stay readable WHILE letting
     the substrate breathe through. The backdrop-filter blurs whatever
     substrate texture is behind, so even at moderate transparency the
     card body stays crisp. */
  background: rgba(10, 16, 26, 0.62);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  border: 1px solid rgba(0, 212, 255, 0.12);
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 4px 12px rgba(0, 0, 0, 0.25);
}
.symframe .symframe-card::before,
.symframe .symframe-card::after {
  display: none;
}
.symframe .symframe-card:hover {
  border-color: rgba(0, 212, 255, 0.18);
}

/* Phase 2: dynamic-card sub-elements (only present on cards added via
   symframe.add(); the 3 sticky panels render their own internals). */
.symframe-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.symframe-card-dismiss {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  line-height: 1;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0.6;
  transition:
    opacity 0.15s ease,
    color 0.15s ease,
    background 0.15s ease;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.symframe-card-dismiss:hover {
  opacity: 1;
  color: var(--accent-cyan);
  background: rgba(0, 212, 255, 0.08);
}

/* Stage C: pin glyph — replaces dismiss button on pinned cards. Click
   to unpin. The card's persistence is user-curated, so the affordance
   sits in the same slot as the dismiss × but with a different glyph
   and tooltip. */
.symframe-card-pin {
  background: transparent;
  border: none;
  color: var(--accent-cyan);
  font-size: 13px;
  line-height: 1;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0.8;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    opacity 0.15s ease,
    background 0.15s ease;
}
.symframe-card-pin:hover {
  opacity: 1;
  background: rgba(0, 212, 255, 0.08);
}

/* Stage C: dwell pulse — 600ms cyan border + glow then return. */
.symframe-card.symframe-dwelling {
  animation: symframe-dwell 600ms ease-out;
}
@keyframes symframe-dwell {
  0% {
    border-color: var(--accent-cyan);
    box-shadow:
      0 0 0 0 rgba(0, 212, 255, 0.55),
      inset 0 1px 0 rgba(255, 255, 255, 0.04),
      0 4px 12px rgba(0, 0, 0, 0.25);
  }
  60% {
    border-color: rgba(0, 212, 255, 0.6);
    box-shadow:
      0 0 0 6px rgba(0, 212, 255, 0),
      inset 0 1px 0 rgba(255, 255, 255, 0.04),
      0 4px 12px rgba(0, 0, 0, 0.25);
  }
  100% {
    border-color: rgba(0, 212, 255, 0.12);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.04),
      0 4px 12px rgba(0, 0, 0, 0.25);
  }
}

/* Stage C: release fade-out — animated dismissal that's softer than
   the instant remove. The JS cleanup (cards.delete + DOM remove) fires
   on transitionend or after a 900ms fail-safe timeout. */
.symframe-card.symframe-releasing {
  transition:
    opacity 800ms cubic-bezier(0.4, 0, 0.6, 1),
    transform 800ms cubic-bezier(0.4, 0, 0.6, 1),
    max-height 800ms cubic-bezier(0.4, 0, 0.6, 1),
    margin 800ms ease;
  opacity: 0;
  transform: scale(0.92);
  max-height: 0;
  margin-top: 0;
  margin-bottom: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Reduced-motion: skip elaborate animations. */
@media (prefers-reduced-motion: reduce) {
  .symframe-card.symframe-dwelling {
    animation: none;
    border-color: var(--accent-cyan);
  }
  .symframe-card.symframe-releasing {
    transition: opacity 200ms ease;
    transform: none;
    max-height: none;
  }
}

/* ── AWAITING footer (Stage C) ───────────────────────────────────── */
/* Always-present footer (when there's anything pending) below the
   substrate+cards stack. Merges in-flight sub-agents and scheduled
   cron jobs into one list, sorted by in-flight-first then ETA.
   Click a sub-agent row → no-op (future: open a detail view).
   Click a schedule row → existing schedule edit modal.
   Click [+ Add] → menu with "Spawn subagent" / "Add scheduled task". */
.symframe-awaiting {
  position: relative;
  border-top: 1px solid rgba(0, 212, 255, 0.12);
  margin-top: 8px;
  padding: 8px 6px 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  /* Stage C.4: cap the AWAITING footer so it can't claim more than ~40%
     of the column height even if the user has many cron jobs. The
     list inside still scrolls (max-height: 200px on .awaiting-list)
     so visible item count stays sensible. This is a defensive cap —
     the grid auto-row already takes only what the footer needs, but
     a cap stops a pathological case from squeezing the substrate to
     nothing. */
  max-height: 40%;
  min-height: 0;
  overflow: hidden;
}
.awaiting-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 0 4px 4px;
}
.awaiting-title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--accent-cyan);
}
.awaiting-count {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  opacity: 0.6;
  text-transform: uppercase;
}
.awaiting-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 200px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 212, 255, 0.18) transparent;
}
.awaiting-list::-webkit-scrollbar {
  width: 3px;
}
.awaiting-list::-webkit-scrollbar-thumb {
  background: rgba(0, 212, 255, 0.18);
  border-radius: 2px;
}
.awaiting-item {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  font-family: var(--font-mono);
  font-size: 10px;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}
.awaiting-item:hover {
  background: rgba(0, 212, 255, 0.06);
  border-color: rgba(0, 212, 255, 0.15);
}
.awaiting-item-disabled {
  opacity: 0.45;
}
.awaiting-glyph {
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  line-height: 1;
}
.awaiting-glyph-subagent {
  color: var(--accent-purple, #8b5cf6);
}
.awaiting-glyph-schedule {
  color: var(--accent-cyan);
  cursor: pointer;
}
.awaiting-glyph-schedule:hover {
  color: var(--text);
}
.awaiting-label {
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.awaiting-meta {
  color: var(--text-dim);
  opacity: 0.75;
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  white-space: nowrap;
}

/* Empty-state placeholder when no subagents and no schedules exist. */
.awaiting-empty {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  opacity: 0.55;
  padding: 8px 10px;
  text-align: center;
  font-style: italic;
}

/* Add button + menu */
.awaiting-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  align-self: flex-start;
  padding: 4px 10px;
  background: transparent;
  border: 1px dashed rgba(0, 212, 255, 0.25);
  border-radius: 6px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}
.awaiting-add-btn:hover {
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
  background: rgba(0, 212, 255, 0.04);
}
.awaiting-add-btn svg {
  width: 12px;
  height: 12px;
}
.awaiting-add-menu {
  position: absolute;
  left: 10px;
  bottom: 100%;
  margin-bottom: 6px;
  background: rgba(10, 16, 26, 0.95);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: 8px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 180px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 20;
}
.awaiting-add-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: transparent;
  border: none;
  border-radius: 5px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  text-align: left;
}
.awaiting-add-item:hover {
  background: rgba(0, 212, 255, 0.08);
  color: var(--accent-cyan);
}
.awaiting-add-glyph {
  display: inline-flex;
  width: 14px;
  justify-content: center;
}

.symframe-card-body {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  color: var(--text);
  margin-top: 8px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow-y: auto;
}
.symframe-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  flex-wrap: wrap;
}
.symframe-card-action {
  flex: 1 1 auto;
  min-width: 60px;
  padding: 6px 10px;
  border: 1px solid var(--glass-border);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.15s ease;
}
.symframe-card-action:hover {
  border-color: var(--accent-cyan);
  color: var(--text);
}
.symframe-card-action-primary {
  background: rgba(0, 212, 255, 0.08);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}
.symframe-card-action-primary:hover {
  background: rgba(0, 212, 255, 0.14);
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.18);
}

/* ── Stage D.1 (3.5.27): intent-aware visual treatment ──────────── */
/* The data-intent attribute has been on every card since Stage A but
   was metadata only. Stage D.1 makes the agent's mental categorization
   visible: each intent gets a distinct color stripe running down the
   left edge of the card + a small corner ribbon at the top-left with
   the intent label. Some intents add subtle behavior (producing
   pulses; drafted emphasizes action buttons; reference desaturates).

   No JS changes — purely a CSS layer on top of the existing
   .symframe-card-dynamic[data-intent="..."] hook. */

/* Base treatment shared across all intents: the left stripe is via
   inset box-shadow so it doesn't disturb the card's border-radius.
   The ribbon is via ::before pseudo-element at the top-left corner.
   Cards without data-intent (legacy / pre-Stage-A pushes) get neither. */

.symframe-card-dynamic[data-intent]::before {
  content: attr(data-intent);
  position: absolute;
  top: 0;
  left: 0;
  padding: 2px 8px 2px 6px;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 10px 0 6px 0;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  pointer-events: none;
  z-index: 2;
  opacity: 0.85;
}
/* Reset the base card-padding so the ribbon hugs the corner */
.symframe-card-dynamic[data-intent] {
  /* Slight top padding so the ribbon doesn't crowd the title */
  padding-top: 22px;
}

/* holding — cyan; working memory */
.symframe-card-dynamic[data-intent="holding"] {
  box-shadow:
    inset 3px 0 0 0 rgba(0, 212, 255, 0.65),
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 4px 12px rgba(0, 0, 0, 0.25);
}
.symframe-card-dynamic[data-intent="holding"]::before {
  color: var(--accent-cyan);
}

/* weighing — amber; an option under consideration */
.symframe-card-dynamic[data-intent="weighing"] {
  box-shadow:
    inset 3px 0 0 0 #f5b73a,
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 4px 12px rgba(0, 0, 0, 0.25);
}
.symframe-card-dynamic[data-intent="weighing"]::before {
  color: #f5b73a;
}

/* producing — green; actively drafting, slow pulse on the stripe */
.symframe-card-dynamic[data-intent="producing"] {
  animation: intent-producing-pulse 2.6s ease-in-out infinite;
}
@keyframes intent-producing-pulse {
  0%,
  100% {
    box-shadow:
      inset 3px 0 0 0 rgba(52, 211, 153, 0.55),
      inset 0 1px 0 rgba(255, 255, 255, 0.04),
      0 4px 12px rgba(0, 0, 0, 0.25);
  }
  50% {
    box-shadow:
      inset 3px 0 0 0 rgba(52, 211, 153, 1),
      inset 0 1px 0 rgba(255, 255, 255, 0.04),
      0 4px 12px rgba(0, 0, 0, 0.25),
      0 0 14px rgba(52, 211, 153, 0.2);
  }
}
.symframe-card-dynamic[data-intent="producing"]::before {
  content: "● producing";
  color: #34d399;
}

/* drafted — violet; finished artifact ready for user review */
.symframe-card-dynamic[data-intent="drafted"] {
  box-shadow:
    inset 3px 0 0 0 #8b5cf6,
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 4px 12px rgba(0, 0, 0, 0.25);
}
.symframe-card-dynamic[data-intent="drafted"]::before {
  color: #8b5cf6;
}
/* Emphasize action buttons on drafted cards — these cards exist to
   be acted on (Send / Copy / Open). Make the buttons more clickable. */
.symframe-card-dynamic[data-intent="drafted"] .symframe-card-action {
  border-color: rgba(139, 92, 246, 0.55);
  color: var(--text);
  font-weight: 600;
}
.symframe-card-dynamic[data-intent="drafted"] .symframe-card-action:hover {
  background: rgba(139, 92, 246, 0.12);
  border-color: #8b5cf6;
}
.symframe-card-dynamic[data-intent="drafted"] .symframe-card-action-primary {
  background: rgba(139, 92, 246, 0.22);
  border-color: #8b5cf6;
  color: var(--text);
}
.symframe-card-dynamic[data-intent="drafted"] .symframe-card-action-primary:hover {
  background: rgba(139, 92, 246, 0.32);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.25);
}

/* reference — muted gray; passive read-only context */
.symframe-card-dynamic[data-intent="reference"] {
  box-shadow:
    inset 3px 0 0 0 rgba(255, 255, 255, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 4px 12px rgba(0, 0, 0, 0.25);
  opacity: 0.88;
  filter: saturate(0.75);
}
.symframe-card-dynamic[data-intent="reference"]::before {
  color: var(--text-dim);
}

/* awaiting — if a card is mistakenly pushed with this intent (it
   belongs in the AWAITING footer, not the foreground), flag with a
   pink stripe and a "→ footer" hint so the user/agent notices the
   miscategorization. */
.symframe-card-dynamic[data-intent="awaiting"] {
  box-shadow:
    inset 3px 0 0 0 rgba(244, 114, 182, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 4px 12px rgba(0, 0, 0, 0.25);
}
.symframe-card-dynamic[data-intent="awaiting"]::before {
  content: "awaiting → footer";
  color: rgba(244, 114, 182, 0.85);
}

/* Reduced-motion: skip the producing pulse but keep the static
   green stripe so the intent is still visible. */
@media (prefers-reduced-motion: reduce) {
  .symframe-card-dynamic[data-intent="producing"] {
    animation: none;
    box-shadow:
      inset 3px 0 0 0 rgba(52, 211, 153, 0.75),
      inset 0 1px 0 rgba(255, 255, 255, 0.04),
      0 4px 12px rgba(0, 0, 0, 0.25);
  }
}

/* ── Phase 4: type-specific body renderers ───────────────────────── */

/* Text + markdown: inherit from .symframe-card-body. Add minimal
   markdown rules — most users will want headings and code blocks
   readable but compact. */
.symframe-body-markdown h1,
.symframe-body-markdown h2,
.symframe-body-markdown h3,
.symframe-body-markdown h4 {
  font-size: 12px;
  font-weight: 600;
  margin: 8px 0 4px;
  color: var(--text);
}
.symframe-body-markdown p {
  margin: 4px 0;
}
.symframe-body-markdown ul,
.symframe-body-markdown ol {
  padding-left: 18px;
  margin: 4px 0;
}
.symframe-body-markdown code {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 4px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 3px;
}
.symframe-body-markdown pre {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 5px;
  padding: 8px;
  overflow-x: auto;
  margin: 6px 0;
}
.symframe-body-markdown pre code {
  background: transparent;
  padding: 0;
  font-size: 10px;
}

/* Code body — pre/code wrapper with hljs theme-friendly chrome. */
.symframe-body-code {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 5px;
  padding: 8px 10px;
  margin: 0;
  overflow-x: auto;
  max-height: 320px;
  overflow-y: auto;
}
.symframe-body-code code {
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.45;
  color: var(--text);
  background: transparent;
}

/* Email-draft — From/To/Subject header rows + body. */
.symframe-body-email {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.symframe-email-row {
  display: flex;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.02em;
  padding: 2px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
}
.symframe-email-row:last-of-type {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 4px;
  padding-bottom: 4px;
}
.symframe-email-label {
  flex: 0 0 auto;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 9px;
  min-width: 48px;
  opacity: 0.7;
}
.symframe-email-value {
  color: var(--text);
  word-break: break-word;
}
.symframe-email-body {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  margin-top: 4px;
}

/* PDF embed */
.symframe-body-pdf {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.symframe-pdf-iframe {
  width: 100%;
  height: 280px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.2);
}

/* Audio + video shared chrome */
.symframe-body-audio,
.symframe-body-video {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.symframe-audio,
.symframe-video {
  width: 100%;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.2);
}
.symframe-video {
  max-height: 280px;
  object-fit: contain;
}

/* Empty-media placeholder when url is missing */
.symframe-body-empty {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  opacity: 0.6;
  font-style: italic;
}

/* Download link — used by pdf/audio/video renderers */
.symframe-download {
  display: inline-block;
  padding: 4px 8px;
  border: 1px solid var(--glass-border);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  text-decoration: none;
  transition: all 0.15s ease;
  align-self: flex-start;
}
.symframe-download:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: rgba(0, 212, 255, 0.06);
}

/* ── 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 24px 16px;
  overflow-y: auto;
  overflow-x: hidden;
  pointer-events: none;
  /* Glass-panel background to highlight the reading column. Mirrors the
     same look the side panels just had stripped from them, so the user's
     eye is drawn here. */
  background: var(--glass-bg);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  box-shadow:
    var(--shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

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

/* ── Slash command autocomplete dropdown ─────────────────────────── */
.slash-autocomplete {
  display: none;
  flex-direction: column;
  margin: -2px -8px 8px;
  padding: 4px;
  background: rgba(10, 14, 23, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(0, 212, 255, 0.18);
  border-radius: 10px;
  max-height: 280px;
  overflow-y: auto;
  font-size: 12px;
}
.slash-autocomplete.open {
  display: flex;
}
.slash-ac-item {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: baseline;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-dim);
  transition: background 0.1s;
}
.slash-ac-item:hover,
.slash-ac-item.selected {
  background: rgba(0, 212, 255, 0.1);
  color: var(--text-bright);
}
.slash-ac-name {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent-cyan);
}
.slash-ac-alias {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  opacity: 0.6;
}
.slash-ac-desc {
  font-size: 11px;
  opacity: 0.85;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.slash-ac-header {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  opacity: 0.7;
  padding: 4px 10px 6px;
  margin-bottom: 2px;
  border-bottom: 1px solid rgba(0, 212, 255, 0.12);
}
.slash-ac-arg {
  grid-template-columns: auto 1fr;
}

/* ── 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-search {
  position: relative;
  padding: 8px 14px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.history-search-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  color: var(--text-primary);
  font: inherit;
  font-size: 13px;
  padding: 7px 30px 7px 10px;
  outline: none;
  transition: border-color 120ms;
}
.history-search-input::placeholder {
  color: var(--text-dim);
  opacity: 0.7;
}
.history-search-input:focus {
  border-color: rgba(139, 92, 246, 0.6);
}
.history-search-clear {
  position: absolute;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.history-search-clear:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.history-search-status {
  padding: 14px 18px;
  color: var(--text-dim);
  font-size: 12px;
}
.history-match-snippet {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 6px 0 0;
  white-space: pre-wrap;
  line-height: 1.4;
  max-height: 84px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-match-snippet mark {
  background: rgba(139, 92, 246, 0.32);
  color: var(--text-primary);
  padding: 0 2px;
  border-radius: 2px;
}
.history-match-meta {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.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);
}

/* ── Load session button ──────────────────────────────────────────────── */
.history-load-btn {
  margin-top: 8px;
  padding: 5px 14px;
  height: 28px;
  width: 100%;
  background: rgba(0, 212, 255, 0.08);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: 6px;
  color: rgba(0, 212, 255, 0.8);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.15s;
}
.history-load-btn:hover {
  background: rgba(0, 212, 255, 0.15);
  border-color: rgba(0, 212, 255, 0.4);
  color: rgba(0, 212, 255, 1);
}

/* ── 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);
}
.archive-banner-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.archive-banner-toggle {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 3px 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.archive-banner-toggle:hover {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}
.archive-banner-toggle.active {
  color: rgba(139, 92, 246, 0.9);
  border-color: rgba(139, 92, 246, 0.4);
  background: rgba(139, 92, 246, 0.08);
}

.history-tool-block {
  margin-top: 6px;
  padding: 6px 8px;
  border-left: 2px solid rgba(139, 92, 246, 0.3);
  background: rgba(0, 0, 0, 0.18);
  border-radius: 0 4px 4px 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}
.history-tool-block.history-tool-result-error {
  border-left-color: rgba(239, 68, 68, 0.6);
  background: rgba(239, 68, 68, 0.08);
}
.history-tool-head {
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.history-tool-body {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 180px;
  overflow-y: auto;
  font-size: 11px;
  color: var(--text-secondary);
}

.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 SETTINGS PANELS (Config, Debug, Logs)
   ══════════════════════════════════════════════════════════════════════════ */

#native-settings-container {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}

.settings-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

/* ── Toolbar ────────────────────────────────────────────────────────── */
.settings-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(10, 12, 20, 0.6);
  flex-shrink: 0;
  min-height: 44px;
}

.settings-toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-toolbar-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.45);
}

.settings-toolbar-count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: rgba(139, 92, 246, 0.6);
  letter-spacing: 0.04em;
}

.settings-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Buttons ────────────────────────────────────────────────────────── */
.settings-btn {
  padding: 4px 12px;
  height: 28px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.6);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.settings-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.9);
}
.settings-btn--primary {
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.25);
  color: rgba(139, 92, 246, 0.9);
}
.settings-btn--primary:hover {
  background: rgba(139, 92, 246, 0.2);
  border-color: rgba(139, 92, 246, 0.45);
}
.settings-btn--active {
  background: rgba(139, 92, 246, 0.2);
  border-color: rgba(139, 92, 246, 0.4);
}
.settings-btn--danger {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.25);
  color: rgba(239, 68, 68, 0.9);
}
.settings-btn--danger:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.45);
}

/* ── Search / filter input ──────────────────────────────────────────── */
.settings-search {
  padding: 4px 10px;
  height: 28px;
  width: 140px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 10px;
  outline: none;
  transition: border-color 0.15s;
}
.settings-search:focus {
  border-color: rgba(139, 92, 246, 0.4);
}
.settings-search::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

/* ── Checkbox label ─────────────────────────────────────────────────── */
.settings-checkbox-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  white-space: nowrap;
}
.settings-checkbox-label input[type="checkbox"] {
  accent-color: var(--accent-purple);
  width: 12px;
  height: 12px;
}

/* ── Content area ───────────────────────────────────────────────────── */
.settings-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 92, 246, 0.3) transparent;
}
.settings-content::-webkit-scrollbar {
  width: 5px;
}
.settings-content::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.3);
  border-radius: 3px;
}

/* ── State messages ─────────────────────────────────────────────────── */
.settings-loading,
.settings-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.3);
  letter-spacing: 0.05em;
}

/* ══════════════════════════════════════════════════════════════════════
   CONFIG PANEL — tree view
   ══════════════════════════════════════════════════════════════════════ */

.settings-section {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.settings-section:hover {
  border-color: rgba(255, 255, 255, 0.1);
}

.settings-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.settings-section-header:hover {
  background: rgba(255, 255, 255, 0.04);
}

.settings-section-arrow {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.3);
  transition: transform 0.15s;
  width: 10px;
  text-align: center;
}
.settings-section.collapsed .settings-section-arrow {
  transform: rotate(-90deg);
}

.settings-section-key {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-cyan);
  letter-spacing: 0.03em;
}

.settings-section-body {
  padding: 8px 14px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.7;
  overflow-x: auto;
}
.settings-section.collapsed .settings-section-body {
  display: none;
}

.cfg-key {
  color: rgba(0, 212, 255, 0.8);
}
.cfg-colon {
  color: rgba(255, 255, 255, 0.3);
}
.cfg-str {
  color: rgba(52, 211, 153, 0.9);
  word-break: break-all;
}
.cfg-num {
  color: rgba(244, 114, 182, 0.9);
}
.cfg-bool {
  color: rgba(139, 92, 246, 0.9);
}
.cfg-null {
  color: rgba(255, 255, 255, 0.3);
  font-style: italic;
}
.cfg-bracket {
  color: rgba(255, 255, 255, 0.25);
}
.cfg-row {
  padding-left: 1em;
}
.cfg-redacted {
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: rgba(239, 68, 68, 0.7);
  letter-spacing: 0.08em;
  margin-left: 8px;
}

/* ── Config editor ──────────────────────────────────────────────────── */
.config-editor-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 12px;
  height: 100%;
}
.config-editor {
  flex: 1;
  min-height: 300px;
  padding: 14px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
  resize: none;
  outline: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 92, 246, 0.3) transparent;
  tab-size: 2;
}
.config-editor:focus {
  border-color: rgba(139, 92, 246, 0.35);
}
.config-editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.config-editor-hint {
  font-family: var(--font-mono);
  font-size: 10px;
  color: rgba(255, 255, 255, 0.3);
}

/* ══════════════════════════════════════════════════════════════════════
   DATA CARDS — used by generic RPC panels (Overview, Channels, etc.)
   ══════════════════════════════════════════════════════════════════════ */

.data-card {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.data-card:hover {
  border-color: rgba(255, 255, 255, 0.1);
}

.data-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-cyan);
  letter-spacing: 0.03em;
}

.data-card-badge {
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(0, 212, 255, 0.1);
  border: 1px solid rgba(0, 212, 255, 0.2);
  color: rgba(0, 212, 255, 0.7);
  letter-spacing: 0.06em;
}

.data-card-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 5px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
}
.data-card-row:first-child {
  border-top: none;
}

.data-card-label {
  color: rgba(255, 255, 255, 0.5);
  flex-shrink: 0;
  min-width: 100px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-card-value {
  color: rgba(255, 255, 255, 0.75);
  word-break: break-all;
  flex: 1;
  min-width: 0;
}

.data-card-inline {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 8px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  margin-bottom: 4px;
}

/* ══════════════════════════════════════════════════════════════════════
   DEBUG PANEL
   ══════════════════════════════════════════════════════════════════════ */

.debug-scroll {
  padding: 0 !important;
}

.debug-entry-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 5px 16px;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.5;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  transition: background 0.1s;
}
.debug-entry-row:hover {
  background: rgba(255, 255, 255, 0.02);
}

.debug-time {
  color: rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
  width: 65px;
}

.debug-type {
  flex-shrink: 0;
  width: 60px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.debug-type--chat {
  color: var(--accent-cyan);
}
.debug-type--agent {
  color: var(--accent-purple);
}
.debug-type--error {
  color: #ef4444;
}
.debug-type--other {
  color: rgba(255, 255, 255, 0.4);
}

.debug-summary {
  color: rgba(255, 255, 255, 0.55);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

/* ══════════════════════════════════════════════════════════════════════
   LOGS PANEL
   ══════════════════════════════════════════════════════════════════════ */

.logs-scroll {
  padding: 0 !important;
}

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

.logs-level-chip {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  transition: all 0.15s;
}
.logs-level-chip:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}
.logs-level-chip input[type="checkbox"] {
  display: none;
}
.logs-level-chip:has(input:not(:checked)) {
  opacity: 0.35;
}

.log-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 3px 16px;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.5;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}
.log-row:hover {
  background: rgba(255, 255, 255, 0.02);
}

.log-time {
  color: rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
  width: 65px;
}

.log-level {
  flex-shrink: 0;
  width: 45px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.log-sub {
  color: rgba(0, 212, 255, 0.5);
  flex-shrink: 0;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-msg {
  color: rgba(255, 255, 255, 0.6);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

/* ══════════════════════════════════════════════════════════════════════
   CONNECTIONS PANEL
   ══════════════════════════════════════════════════════════════════════ */

.connections-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* Override .glass-panel so the connections list floats without a card background. */
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  box-shadow: none;
}

.connections-panel:hover {
  border: none;
  box-shadow: none;
}

.connections-panel::before,
.connections-panel::after {
  display: none;
}

.conn-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: left;
  color: var(--text);
  font-family: inherit;
}
.conn-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateX(2px);
}
.conn-btn:active {
  transform: translateX(2px) scale(0.99);
}

.conn-btn[data-state="connected"] {
  border-color: rgba(52, 211, 153, 0.25);
  background: rgba(52, 211, 153, 0.04);
}
.conn-btn[data-state="connected"]:hover {
  border-color: rgba(52, 211, 153, 0.4);
  background: rgba(52, 211, 153, 0.08);
}
.conn-btn[data-state="error"] {
  border-color: rgba(248, 113, 113, 0.25);
  background: rgba(248, 113, 113, 0.04);
}
.conn-btn[data-state="pending"] {
  border-color: rgba(251, 191, 36, 0.25);
  background: rgba(251, 191, 36, 0.04);
}

.conn-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
}
.conn-icon svg {
  width: 18px;
  height: 18px;
}

.conn-icon-slack {
  background: linear-gradient(135deg, rgba(74, 21, 75, 0.3), rgba(54, 197, 171, 0.2));
  border: 1px solid rgba(224, 30, 90, 0.2);
  color: #e01e5a;
}
.conn-btn[data-state="connected"] .conn-icon-slack {
  box-shadow: 0 0 12px rgba(224, 30, 90, 0.2);
}

.conn-icon-email {
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.2), rgba(139, 92, 246, 0.2));
  border: 1px solid rgba(96, 165, 250, 0.2);
  color: var(--accent-blue);
}
.conn-btn[data-state="connected"] .conn-icon-email {
  box-shadow: 0 0 12px rgba(96, 165, 250, 0.2);
}

.conn-icon-teams {
  background: linear-gradient(135deg, rgba(98, 100, 167, 0.3), rgba(139, 92, 246, 0.2));
  border: 1px solid rgba(98, 100, 167, 0.25);
  color: #6264a7;
}
.conn-btn[data-state="connected"] .conn-icon-teams {
  box-shadow: 0 0 12px rgba(98, 100, 167, 0.2);
}

.conn-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.conn-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}
.conn-btn-status {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}
.conn-btn[data-state="connected"] .conn-btn-status {
  color: var(--accent-green);
}
.conn-btn[data-state="error"] .conn-btn-status {
  color: #f87171;
}
.conn-btn[data-state="pending"] .conn-btn-status {
  color: #fbbf24;
}

.conn-state {
  flex-shrink: 0;
  width: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.conn-state .conn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: all 0.3s ease;
}
.conn-btn[data-state="connected"] .conn-state .conn-dot {
  background: var(--accent-green);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.5);
  animation: conn-pulse 2s ease-in-out infinite;
}
.conn-btn[data-state="error"] .conn-state .conn-dot {
  background: #f87171;
  box-shadow: 0 0 8px rgba(248, 113, 113, 0.4);
}
.conn-btn[data-state="pending"] .conn-state .conn-dot {
  background: #fbbf24;
  animation: conn-blink 1s ease-in-out infinite;
}

@keyframes conn-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(0.9);
  }
}
@keyframes conn-blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

.conn-notif {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: linear-gradient(135deg, #f43f5e, #ec4899);
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
  color: white;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(244, 63, 94, 0.4);
  animation: notif-bounce 0.4s ease;
}
.conn-notif:not(:empty) {
  display: flex;
}
@keyframes notif-bounce {
  0% {
    transform: scale(0);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

/* ── Connection Modal ────────────────────────────────────────────────── */
.conn-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.25s ease,
    visibility 0.25s ease;
}
.conn-modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.conn-modal {
  position: relative;
  width: 90%;
  max-width: 420px;
  background: linear-gradient(135deg, rgba(15, 15, 25, 0.98), rgba(10, 10, 18, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.6),
    0 0 1px rgba(255, 255, 255, 0.1);
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s ease;
  overflow: hidden;
}
.conn-modal-overlay.open .conn-modal {
  transform: scale(1) translateY(0);
}

.conn-modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.conn-modal-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.conn-modal-icon svg {
  width: 24px;
  height: 24px;
}
.conn-modal-icon.slack {
  background: linear-gradient(135deg, rgba(74, 21, 75, 0.4), rgba(54, 197, 171, 0.3));
  border: 1px solid rgba(224, 30, 90, 0.3);
  color: #e01e5a;
}
.conn-modal-icon.email {
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.3), rgba(139, 92, 246, 0.3));
  border: 1px solid rgba(96, 165, 250, 0.3);
  color: var(--accent-blue);
}
.conn-modal-icon.msteams {
  background: linear-gradient(135deg, rgba(98, 100, 167, 0.4), rgba(139, 92, 246, 0.3));
  border: 1px solid rgba(98, 100, 167, 0.35);
  color: #6264a7;
}
.conn-modal-title {
  flex: 1;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}
.conn-modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.conn-modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}
.conn-modal-body {
  padding: 20px;
}
.conn-modal-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  margin-bottom: 16px;
}
.conn-modal-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-dim);
}
.conn-modal-status.connected .conn-modal-status-dot {
  background: var(--accent-green);
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.5);
}
.conn-modal-status.disconnected .conn-modal-status-dot {
  background: var(--text-dim);
}
.conn-modal-status-text {
  flex: 1;
  font-size: 13px;
  color: var(--text);
}
.conn-modal-status-badge {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: 0.08em;
}
.conn-modal-status.connected .conn-modal-status-badge {
  background: rgba(52, 211, 153, 0.15);
  color: var(--accent-green);
}
.conn-modal-status.disconnected .conn-modal-status-badge {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}
.conn-modal-info {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.conn-modal-info code {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-cyan);
}
.conn-modal-config {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  overflow-x: auto;
  white-space: pre;
}
.conn-modal-footer {
  padding: 16px 20px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: flex-end;
}
.conn-modal-docs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent-cyan);
  text-decoration: none;
  cursor: pointer;
  padding: 8px 14px;
  background: rgba(0, 212, 255, 0.1);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: 8px;
  transition: all 0.2s ease;
}
.conn-modal-docs:hover {
  background: rgba(0, 212, 255, 0.15);
  border-color: rgba(0, 212, 255, 0.35);
}

/* ── Docs Viewer Modal (scrollable markdown viewer) ────────────────────── */

.docs-viewer-overlay {
  position: fixed;
  inset: 0;
  z-index: 9100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.25s ease,
    visibility 0.25s ease;
}
.docs-viewer-overlay.open {
  opacity: 1;
  visibility: visible;
}

.docs-viewer {
  position: relative;
  width: 92%;
  max-width: 820px;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(135deg, rgba(15, 15, 25, 0.98), rgba(10, 10, 18, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  box-shadow:
    0 28px 90px rgba(0, 0, 0, 0.7),
    0 0 1px rgba(255, 255, 255, 0.1);
  transform: scale(0.96) translateY(12px);
  transition: transform 0.25s ease;
  overflow: hidden;
}
.docs-viewer-overlay.open .docs-viewer {
  transform: scale(1) translateY(0);
}

.docs-viewer-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}
.docs-viewer-title {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}
.docs-viewer-close {
  width: 34px;
  height: 34px;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.docs-viewer-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

.docs-viewer-body {
  padding: 20px 28px 28px;
  overflow-y: auto;
  flex: 1 1 auto;
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}
.docs-viewer-loading,
.docs-viewer-error {
  color: var(--text-muted);
  font-style: italic;
  padding: 8px 0;
}
.docs-viewer-error {
  color: var(--accent-red, #f87171);
  font-style: normal;
}

.docs-viewer-body h1,
.docs-viewer-body h2,
.docs-viewer-body h3,
.docs-viewer-body h4 {
  color: var(--text);
  font-weight: 600;
  line-height: 1.3;
  margin-top: 1.4em;
  margin-bottom: 0.5em;
}
.docs-viewer-body h1 {
  font-size: 22px;
  margin-top: 0;
}
.docs-viewer-body h2 {
  font-size: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 6px;
}
.docs-viewer-body h3 {
  font-size: 15px;
  color: var(--accent-cyan);
}
.docs-viewer-body h4 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.docs-viewer-body p {
  margin: 0.6em 0;
}
.docs-viewer-body ul,
.docs-viewer-body ol {
  margin: 0.5em 0;
  padding-left: 1.4em;
}
.docs-viewer-body li {
  margin: 0.25em 0;
}
.docs-viewer-body a {
  color: var(--accent-cyan);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.docs-viewer-body a:hover {
  color: var(--text);
}
.docs-viewer-body code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--accent-cyan);
}
.docs-viewer-body pre {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 12px 14px;
  overflow-x: auto;
  margin: 0.8em 0;
}
.docs-viewer-body pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.55;
}
.docs-viewer-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.8em 0;
  font-size: 13px;
}
.docs-viewer-body th,
.docs-viewer-body td {
  text-align: left;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.docs-viewer-body th {
  background: rgba(255, 255, 255, 0.04);
  font-weight: 600;
  color: var(--text);
}
.docs-viewer-body blockquote {
  border-left: 3px solid rgba(0, 212, 255, 0.4);
  margin: 0.8em 0;
  padding: 0.3em 0 0.3em 14px;
  color: var(--text-muted);
}
.docs-viewer-body hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin: 1.4em 0;
}

/* ══════════════════════════════════════════════════════════════════════════
   SUBAGENTS PANEL
   ══════════════════════════════════════════════════════════════════════════ */

.subagents-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  /* Override .glass-panel so the subagents list floats without a card background. */
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  box-shadow: none;
}

.subagents-panel:hover {
  border: none;
  box-shadow: none;
}

.subagents-panel::before,
.subagents-panel::after {
  display: none;
}

.subagents-count {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
  margin-left: 6px;
  font-weight: 600;
}

/* Quick Deploy */
.quick-deploy-section {
  margin-bottom: 10px;
}
.quick-deploy-label {
  font-size: 9px;
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.quick-deploy-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.quick-deploy-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}
.quick-deploy-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.7;
}
.quick-deploy-btn:hover {
  background: rgba(0, 212, 255, 0.06);
  border-color: rgba(0, 212, 255, 0.2);
  color: var(--accent-cyan);
}
.quick-deploy-btn:hover svg {
  opacity: 1;
}
.quick-deploy-btn.selected {
  background: rgba(0, 212, 255, 0.1);
  border-color: rgba(0, 212, 255, 0.3);
  color: var(--accent-cyan);
}
.quick-deploy-btn.selected svg {
  opacity: 1;
}

/* Staging Box */
.staging-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  margin-bottom: 12px;
  min-height: 38px;
}
.staging-chips {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 22px;
  align-items: center;
}
.staging-empty {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}
.staging-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: rgba(0, 212, 255, 0.1);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: 12px;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
  cursor: default;
}
.staging-chip-remove {
  cursor: pointer;
  opacity: 0.6;
  font-size: 12px;
  line-height: 1;
}
.staging-chip-remove:hover {
  opacity: 1;
}
.staging-deploy-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: rgba(0, 212, 255, 0.12);
  border: 1px solid rgba(0, 212, 255, 0.25);
  border-radius: 8px;
  color: var(--accent-cyan);
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.staging-deploy-btn svg {
  width: 13px;
  height: 13px;
}
.staging-deploy-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.staging-deploy-btn:not(:disabled):hover {
  background: rgba(0, 212, 255, 0.2);
  border-color: rgba(0, 212, 255, 0.4);
}

/* Active subagents */
.subagents-active-label {
  font-size: 9px;
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.subagents-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
  max-height: 240px;
  overflow-y: auto;
}
.subagents-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 0;
}
.subagents-empty-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.35;
}
.subagents-empty-icon svg {
  width: 24px;
  height: 24px;
}
.subagents-empty-text {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

/* Individual subagent item */
.subagent-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.subagent-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}
.subagent-item[data-status="running"] {
  border-color: rgba(0, 212, 255, 0.2);
  background: rgba(0, 212, 255, 0.03);
}
.subagent-item[data-status="completed"] {
  border-color: rgba(52, 211, 153, 0.15);
}
.subagent-item[data-status="error"] {
  border-color: rgba(248, 113, 113, 0.2);
}

.subagent-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.subagent-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.subagent-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.subagent-task {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.subagent-runtime {
  flex-shrink: 0;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

/* Spawn button */
.subagent-spawn-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 8px;
  background: rgba(139, 92, 246, 0.08);
  border: 1px dashed rgba(139, 92, 246, 0.25);
  border-radius: 8px;
  color: rgba(139, 92, 246, 0.85);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}
.subagent-spawn-btn svg {
  width: 14px;
  height: 14px;
}
.subagent-spawn-btn:hover {
  background: rgba(139, 92, 246, 0.12);
  border-color: rgba(139, 92, 246, 0.35);
  color: var(--accent-purple);
}

/* ── Subagent Modal ──────────────────────────────────────────────────── */
.subagent-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.25s ease,
    visibility 0.25s ease;
}
.subagent-modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.subagent-modal {
  position: relative;
  width: 90%;
  max-width: 460px;
  background: linear-gradient(135deg, rgba(15, 15, 25, 0.98), rgba(10, 10, 18, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.6),
    0 0 1px rgba(255, 255, 255, 0.1);
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s ease;
  overflow: hidden;
}
.subagent-modal-overlay.open .subagent-modal {
  transform: scale(1) translateY(0);
}

.subagent-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.subagent-modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}
.subagent-modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.subagent-modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.subagent-modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.subagent-form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.subagent-form-label {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
}
.subagent-form-input,
.subagent-form-select,
.subagent-form-textarea {
  width: 100%;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease;
}
.subagent-form-input:focus,
.subagent-form-select:focus,
.subagent-form-textarea:focus {
  border-color: rgba(139, 92, 246, 0.4);
}
.subagent-form-textarea {
  min-height: 80px;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 12px;
}
.subagent-form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='rgba(255,255,255,0.4)' viewBox='0 0 16 16'%3E%3Cpath d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.subagent-form-select option {
  background: #0f0f19;
  color: var(--text);
}

.subagent-modal-footer {
  padding: 14px 20px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.subagent-modal-cancel {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}
.subagent-modal-cancel:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}
.subagent-modal-spawn {
  padding: 8px 18px;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 8px;
  color: var(--accent-purple);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}
.subagent-modal-spawn:hover {
  background: rgba(139, 92, 246, 0.25);
  border-color: rgba(139, 92, 246, 0.5);
}

/* ══════════════════════════════════════════════════════════════════════════
   SCHEDULING PANEL
   ══════════════════════════════════════════════════════════════════════════ */

.scheduling-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ── Float right-column panels (no card background) ──────────────────── */
.gateway-panel,
#model-routing-panel,
.scheduling-panel {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  box-shadow: none;
}

.gateway-panel:hover,
#model-routing-panel:hover,
.scheduling-panel:hover {
  border: none;
  box-shadow: none;
}

.gateway-panel::before,
.gateway-panel::after,
#model-routing-panel::before,
#model-routing-panel::after,
.scheduling-panel::before,
.scheduling-panel::after {
  display: none;
}

.schedule-count {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--accent-green);
  margin-left: 6px;
  font-weight: 600;
}

.schedule-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
  max-height: 260px;
  overflow-y: auto;
}

/* Empty state */
.schedule-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 0;
}
.schedule-empty-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.35;
}
.schedule-empty-icon svg {
  width: 24px;
  height: 24px;
}
.schedule-empty-text {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

/* Schedule items */
.schedule-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.schedule-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}
.schedule-item[data-active="true"] {
  border-color: rgba(52, 211, 153, 0.15);
}
.schedule-item[data-active="false"] {
  opacity: 0.5;
}

/* Toggle dot */
.schedule-toggle {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-dim);
  border: 2px solid rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
  cursor: pointer;
}
.schedule-item[data-active="true"] .schedule-toggle {
  background: var(--accent-green);
  border-color: rgba(52, 211, 153, 0.3);
  box-shadow: 0 0 6px rgba(52, 211, 153, 0.3);
}
.schedule-toggle:hover {
  border-color: rgba(255, 255, 255, 0.3);
}

.schedule-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.schedule-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.schedule-next {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.schedule-interval {
  flex-shrink: 0;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  letter-spacing: 0.04em;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
}

/* Add schedule button */
.schedule-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 8px;
  background: rgba(52, 211, 153, 0.08);
  border: 1px dashed rgba(52, 211, 153, 0.25);
  border-radius: 8px;
  color: rgba(52, 211, 153, 0.85);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}
.schedule-add-btn svg {
  width: 14px;
  height: 14px;
}
.schedule-add-btn:hover {
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.35);
  color: var(--accent-green);
}

/* ── Schedule Modal ──────────────────────────────────────────────────── */
.schedule-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.25s ease,
    visibility 0.25s ease;
}
.schedule-modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.schedule-modal {
  position: relative;
  width: 90%;
  max-width: 460px;
  background: linear-gradient(135deg, rgba(15, 15, 25, 0.98), rgba(10, 10, 18, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.6),
    0 0 1px rgba(255, 255, 255, 0.1);
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s ease;
  overflow: hidden;
}
.schedule-modal-overlay.open .schedule-modal {
  transform: scale(1) translateY(0);
}

.schedule-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.schedule-modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}
.schedule-modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.schedule-modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.schedule-modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.schedule-form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.schedule-form-label {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
}
.schedule-form-input,
.schedule-form-textarea {
  width: 100%;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease;
}
.schedule-form-input:focus,
.schedule-form-textarea:focus {
  border-color: rgba(52, 211, 153, 0.4);
}
.schedule-form-textarea {
  min-height: 70px;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 12px;
}

/* Interval presets */
.schedule-interval-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.schedule-interval-btn {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 11px;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.2s ease;
}
.schedule-interval-btn:hover {
  background: rgba(52, 211, 153, 0.08);
  border-color: rgba(52, 211, 153, 0.2);
  color: var(--accent-green);
}
.schedule-interval-btn.selected {
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.3);
  color: var(--accent-green);
}

.schedule-modal-footer {
  padding: 14px 20px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.schedule-modal-cancel {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}
.schedule-modal-cancel:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}
.schedule-modal-save {
  padding: 8px 18px;
  background: rgba(52, 211, 153, 0.15);
  border: 1px solid rgba(52, 211, 153, 0.3);
  border-radius: 8px;
  color: var(--accent-green);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}
.schedule-modal-save:hover {
  background: rgba(52, 211, 153, 0.25);
  border-color: rgba(52, 211, 153, 0.5);
}

/* ── Reasoning live-dot (used in symframe header, Stage B+) ────────── */
/* Stage B (3.5.20): The reasoning panel was removed; reasoning now flows
   to the substrate. The live-dot id is retained in the symframe header
   so app.js:840-845 continues to bind a single semantic ("agent is
   active") to a single element without code change. */
.reasoning-live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-cyan);
  margin-left: 6px;
  vertical-align: middle;
  opacity: 0;
  transition: opacity 0.3s ease;
  flex-shrink: 0;
}
.reasoning-live-dot.active {
  opacity: 1;
  animation: pulse 1.2s ease-in-out infinite;
}

/* The .reasoning-panel / .reasoning-feed / .reasoning-empty* rules were
   removed in Stage B — their DOM is gone. The .reasoning-entry / badge
   / body / preview / result-meta rules below ARE still in use: the
   substrate's buildEntryForBlock writes the same class names so existing
   entry visuals carry forward unchanged. */

/* Run separator */
.reasoning-run-sep {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 2px;
}
.reasoning-run-sep::before,
.reasoning-run-sep::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
}
.reasoning-run-sep-label {
  font-size: 9px;
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  white-space: nowrap;
}

/* Individual reasoning entry */
.reasoning-entry {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  transition: border-color 0.2s;
}
.reasoning-entry:hover {
  border-color: rgba(255, 255, 255, 0.09);
}

/* Entry header row: badge + label */
.reasoning-entry-header {
  display: flex;
  align-items: center;
  gap: 6px;
}
.reasoning-entry-badge {
  font-size: 9px;
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 1px 5px;
  border-radius: 4px;
  flex-shrink: 0;
}
/* Thinking badge — cyan tint */
.reasoning-entry-badge.badge-think {
  background: rgba(0, 212, 255, 0.1);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 212, 255, 0.18);
}
/* Tool call badge — purple tint */
.reasoning-entry-badge.badge-tool {
  background: rgba(139, 92, 246, 0.12);
  color: var(--accent-purple);
  border: 1px solid rgba(139, 92, 246, 0.2);
}
/* Tool result badge — green tint */
.reasoning-entry-badge.badge-result {
  background: rgba(52, 211, 153, 0.1);
  color: var(--accent-green);
  border: 1px solid rgba(52, 211, 153, 0.18);
}
/* Narration badge — dim white tint */
.reasoning-entry-badge.badge-narration {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.reasoning-entry-name {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* Thinking body */
.reasoning-think-body {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 120px;
  overflow-y: auto;
  padding: 4px 2px 0;
  opacity: 0.75;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 212, 255, 0.15) transparent;
}
.reasoning-think-body::-webkit-scrollbar {
  width: 2px;
}
.reasoning-think-body::-webkit-scrollbar-thumb {
  background: rgba(0, 212, 255, 0.15);
  border-radius: 2px;
}

/* Tool detail — compact JSON preview, collapsible */
.reasoning-tool-preview {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  opacity: 0.65;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 2px 0 0;
}
.reasoning-tool-detail {
  display: none;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-all;
  padding: 4px 2px 0;
  opacity: 0.65;
  max-height: 100px;
  overflow-y: auto;
}
.reasoning-entry.expanded .reasoning-tool-detail {
  display: block;
}
.reasoning-entry.expanded .reasoning-tool-preview {
  display: none;
}

/* Result row */
.reasoning-result-meta {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  padding: 2px 0 0;
}

/* ── Lazy-load sentinel ──────────────────────────────────────────── */
.load-more-sentinel {
  text-align: center;
  padding: 12px 0;
  font-size: 12px;
  color: var(--text-dim);
  opacity: 0.7;
}

/* ── Model info (below agent status orb) ─────────────────────────── */
.aso-model-info {
  text-align: center;
  margin-top: 6px;
  font-size: 10px;
  color: var(--text-dim);
  opacity: 0.8;
}
.aso-model-label {
  font-weight: 500;
  letter-spacing: 0.03em;
}
.aso-model-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
}

/* History-unavailable banner — shown when server retries fail and we fall
   back to the localStorage feed cache. Kept terse so it doesn't dominate
   the chat area. Dismissable via the × button on the right. */
.history-unavailable-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 12px;
  padding: 8px 12px;
  background: rgba(255, 180, 60, 0.12);
  border: 1px solid rgba(255, 180, 60, 0.35);
  color: rgba(255, 220, 160, 0.95);
  font-size: 12px;
  border-radius: 6px;
  font-family: inherit;
}

.history-unavailable-dismiss {
  background: transparent;
  border: none;
  color: inherit;
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  opacity: 0.7;
}

.history-unavailable-dismiss:hover {
  opacity: 1;
}

/* Generic data-panel pagination footer — "Showing N of M + [Show more]" row
   appears after a paginated list in Sessions / Agents / Cron / etc. */
.settings-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  margin-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 6px;
  font-size: 12px;
}

.settings-pagination-info {
  opacity: 0.7;
  font-family: inherit;
}

/* ═══════════════════════════════════════════════════════════════════════
   2.7.1 — History modal rework: CURRENT/PAST/ARCHIVED badges, favourite
   star, two-stage delete button, section headings.
   ═══════════════════════════════════════════════════════════════════════ */

/* Section heading above a group of rows */
.history-section-heading {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: rgba(255, 255, 255, 0.35);
  padding: 12px 14px 6px;
  text-transform: uppercase;
}

/* Row accent for CURRENT (green, as per "live is exactly one") */
.history-session-item.history-session-current {
  border-left: 2px solid var(--accent-green, #10b981);
  background: rgba(16, 185, 129, 0.04);
}

.history-session-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

/* Badges — CURRENT (green), PAST (cyan), ARCHIVED (violet) */
.history-session-badge.badge-current {
  background: rgba(16, 185, 129, 0.15);
  color: rgba(16, 185, 129, 1);
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.history-session-badge.badge-past {
  background: rgba(0, 212, 255, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 212, 255, 0.25);
}
.history-session-badge.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);
}

/* Favourite star */
.history-fav-btn {
  background: transparent;
  border: none;
  padding: 0 4px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.25);
  transition: color 0.15s;
}
.history-fav-btn:hover {
  color: rgba(255, 215, 0, 0.6);
}
.history-fav-btn.active {
  color: rgba(255, 215, 0, 0.95);
}

/* Row actions row */
.history-session-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.history-session-actions .history-load-btn {
  margin-top: 0;
  flex: 1;
}
.history-session-actions .history-delete-btn {
  margin-top: 0;
  padding: 5px 14px;
  height: 28px;
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 6px;
  color: rgba(239, 68, 68, 0.75);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.15s;
}
.history-session-actions .history-delete-btn:hover {
  background: rgba(239, 68, 68, 0.12);
  color: rgba(239, 68, 68, 1);
}
.history-session-actions .history-delete-btn.armed {
  background: rgba(239, 68, 68, 0.2);
  color: rgba(255, 255, 255, 1);
  border-color: rgba(239, 68, 68, 0.6);
  animation: delete-armed-pulse 1s ease-in-out infinite;
}
.history-session-actions .history-delete-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

@keyframes delete-armed-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0);
  }
}
