/* ============================================================================
 * Sophia · VoxAI Design System (ported from /Users/saikiran/web-agent)
 * Dark glassmorphic UI — electric violet + cyan + magenta on deep ink.
 * Loaded alongside Tailwind CDN; this file owns the theme and dark-mode
 * overrides for the utility classes sophia-client.js injects at runtime.
 * ========================================================================== */

:root {
  /* Brand — electric violet */
  --brand-50:  #f3f0ff;
  --brand-100: #e9e3ff;
  --brand-200: #d4c8fe;
  --brand-300: #b6a4fc;
  --brand-400: #957cf8;
  --brand-500: #8b5cf6;
  --brand-600: #7c3aed;
  --brand-700: #6d28d9;
  --brand-800: #4c1d95;

  /* Cyan / magenta accents */
  --cyan-accent: #22d3ee;
  --cyan-soft:   #67e8f9;
  --cyan-deep:   #06b6d4;
  --magenta:     #f472b6;

  /* Ink surfaces */
  --ink-50:  #f7f8fb;
  --ink-100: #eef0f6;
  --ink-200: #e1e4ed;
  --ink-300: #c8ccd9;
  --ink-400: #8d93a6;
  --ink-500: #5b6173;
  --ink-600: #383d50;
  --ink-700: #1c2036;
  --ink-800: #11142a;
  --ink-900: #0b0e1a;
  --ink-950: #070912;

  /* Status */
  --success: #10b981;
  --warn:    #f59e0b;
  --danger:  #ef4444;

  /* Glass tokens */
  --bg:        #070912;
  --fg:        #ffffff;
  --surface:   rgba(255, 255, 255, 0.03);
  --surface-2: rgba(255, 255, 255, 0.05);
  --surface-3: rgba(255, 255, 255, 0.08);
  --border:        rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --muted:        rgba(255, 255, 255, 0.55);
  --muted-strong: rgba(255, 255, 255, 0.72);

  /* Glow shadows */
  --shadow-card:       0 1px 2px rgba(0,0,0,0.4), 0 16px 40px rgba(0,0,0,0.45);
  --shadow-card-hover: 0 1px 2px rgba(0,0,0,0.5), 0 24px 56px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.06);
  --shadow-violet:     0 24px 64px -16px rgba(139, 92, 246, 0.55);
  --shadow-cyan:       0 24px 64px -16px rgba(34, 211, 238, 0.50);
  --shadow-pink:       0 24px 64px -16px rgba(244, 114, 182, 0.45);
  --shadow-danger:     0 8px 28px -8px rgba(239, 68, 68, 0.60);

  /* Gradients */
  --grad-violet:  linear-gradient(135deg, #8b5cf6 0%, #7c3aed 50%, #6d28d9 100%);
  --grad-cyan:    linear-gradient(135deg, #67e8f9 0%, #22d3ee 50%, #06b6d4 100%);
  --grad-aurora:  linear-gradient(135deg, #8b5cf6 0%, #6d28d9 30%, #22d3ee 100%);
  --grad-aurora-text: linear-gradient(135deg, #c4b5fd 0%, #67e8f9 50%, #f472b6 100%);
  --grad-equalizer: linear-gradient(180deg, #f0abfc 0%, #c4b5fd 30%, #8b5cf6 60%, #22d3ee 100%);

  /* Type */
  --font-sans:    'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* Radii */
  --r-pill: 999px;
  --r-card: 16px;
  --r-btn:  12px;
}

/* ============================================================================
 * Base
 * ========================================================================== */

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-image:
    radial-gradient(at 20% 8%,  rgba(139, 92, 246, 0.18) 0,  transparent 45%),
    radial-gradient(at 80% 4%,  rgba(34, 211, 238, 0.14) 0,  transparent 50%),
    radial-gradient(at 50% 95%, rgba(244, 114, 182, 0.10) 0, transparent 55%);
  background-attachment: fixed;
  min-height: 100vh;
}

body { overflow-x: hidden; }

::selection { background: rgba(139, 92, 246, 0.35); color: #fff; }

* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.16) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); border-radius: 999px; transition: background .2s; }
*::-webkit-scrollbar-thumb:hover { background: rgba(139,92,246,0.4); }

a { color: var(--brand-300); text-decoration: none; }
a:hover { color: var(--brand-200); text-decoration: underline; }

button { font-family: inherit; cursor: pointer; }
input, select, textarea, button { font-family: inherit; }
input[type="checkbox"] { accent-color: var(--brand-500); }

*:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.65); }

/* ============================================================================
 * Ambient gradient mesh (fixed background blobs)
 * ========================================================================== */

.bg-mesh {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden;
}
.bg-mesh .blob {
  position: absolute; border-radius: 50%; filter: blur(70px);
  will-change: transform;
}
.bg-mesh .blob.violet {
  top: -20%; left: -10%; width: 60vw; height: 60vw;
  background: radial-gradient(closest-side, rgba(139,92,246,0.55), rgba(139,92,246,0));
  animation: mesh-drift 30s ease-in-out infinite;
}
.bg-mesh .blob.cyan {
  top: -10%; right: -15%; width: 55vw; height: 55vw;
  background: radial-gradient(closest-side, rgba(34,211,238,0.45), rgba(34,211,238,0));
  animation: mesh-drift 60s ease-in-out infinite;
  animation-delay: -10s;
}
.bg-mesh .blob.pink {
  bottom: -20%; left: 20%; width: 50vw; height: 50vw;
  background: radial-gradient(closest-side, rgba(244,114,182,0.32), rgba(244,114,182,0));
  animation: mesh-drift 30s ease-in-out infinite;
  animation-delay: -20s;
}
.bg-mesh .grid-overlay {
  position: absolute; inset: 0; opacity: 0.015; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.6) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.6) 1px, transparent 1px);
  background-size: 44px 44px;
}
.bg-mesh .vignette {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 0%, transparent 50%, rgba(7,9,18,0.85) 100%);
}

/* ============================================================================
 * Utilities
 * ========================================================================== */

.glass {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.glass-strong {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-strong);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
}
.glass-deep {
  background: linear-gradient(180deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.02) 100%);
  border: 1px solid var(--border);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.text-gradient-aurora {
  background: var(--grad-aurora-text);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradient-flow 8s ease infinite;
}
.text-gradient-violet {
  background: linear-gradient(135deg, #c4b5fd 0%, #8b5cf6 60%, #6d28d9 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: rgba(255,255,255,0.6);
}
.eyebrow.cyan   { color: #a5f3fc; }
.eyebrow.violet { color: #ddd6fe; }
.eyebrow.pink   { color: #fbcfe8; }
.eyebrow.white  { color: rgba(255,255,255,0.6); }
.eyebrow .dot {
  width: 6px; height: 6px; border-radius: 999px;
  background: currentColor;
  animation: pulse-soft 1.6s ease-in-out infinite;
}

.font-display { font-family: var(--font-display); letter-spacing: -0.02em; }
.font-mono    { font-family: var(--font-mono); }
.tabular      { font-variant-numeric: tabular-nums; }

.hairline { border-color: var(--border); }

/* Animation utilities */
.animate-pulse-soft  { animation: pulse-soft  1.6s ease-in-out infinite; }
.animate-pulse-glow  { animation: pulse-glow  2.4s ease-in-out infinite; }
.animate-ping-out    { animation: ping-out    2.6s cubic-bezier(0,0,0.2,1) infinite; }
.animate-reveal-up   { animation: reveal-up   .6s cubic-bezier(0.22,1,0.36,1) both; }
.animate-spin-slow   { animation: spin-slow   18s linear infinite; }
.animate-spin-slower { animation: spin-slower 36s linear infinite; }
.animate-shimmer {
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.10) 50%, rgba(255,255,255,0.04) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
}
.animate-caret { animation: caret-blink 1s step-end infinite; }
.animate-rec   { animation: rec-pulse 1.4s ease-in-out infinite; }

/* ============================================================================
 * Keyframes
 * ========================================================================== */

@keyframes pulse-soft {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.55; transform: scale(0.85); }
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(139,92,246,0.6), 0 0 32px rgba(139,92,246,0.3); }
  50%      { box-shadow: 0 0 0 18px rgba(139,92,246,0), 0 0 48px rgba(139,92,246,0.5); }
}
@keyframes ping-out {
  0%   { transform: scale(0.8); opacity: 0.7; }
  100% { transform: scale(2); opacity: 0; }
}
@keyframes spin-slow   { to { transform: rotate(360deg); } }
@keyframes spin-slower { to { transform: rotate(-360deg); } }
@keyframes mesh-drift {
  0%   { transform: translate3d(0,0,0) scale(1); }
  33%  { transform: translate3d(40px,-28px,0) scale(1.05); }
  66%  { transform: translate3d(-32px,20px,0) scale(0.96); }
  100% { transform: translate3d(0,0,0) scale(1); }
}
@keyframes reveal-up {
  0%   { opacity: 0; transform: translate3d(0,16px,0); }
  100% { opacity: 1; transform: translate3d(0,0,0); }
}
@keyframes gradient-flow {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes caret-blink {
  0%, 49%   { opacity: 1; }
  50%, 100% { opacity: 0; }
}
@keyframes eq {
  0%, 100% { transform: scaleY(0.3); }
  50%      { transform: scaleY(1); }
}
@keyframes listen-dot {
  0%, 100% { opacity: 0.2; transform: scale(0.7); }
  50%      { opacity: 1;   transform: scale(1); }
}
@keyframes rec-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.5); }
  50%      { box-shadow: 0 0 0 8px rgba(239,68,68,0); }
}
@keyframes float-up-down {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

@media (prefers-reduced-motion: reduce) {
  .bg-mesh .blob,
  .animate-spin-slow,
  .animate-spin-slower,
  .animate-ping-out,
  .text-gradient-aurora {
    animation: none !important;
  }
}

/* ============================================================================
 * Logo
 * ========================================================================== */

.logo {
  display: inline-flex; align-items: center; gap: 10px;
}
.logo .mark {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  position: relative; overflow: hidden; flex-shrink: 0;
  background: linear-gradient(135deg, #c4b5fd 0%, #8b5cf6 50%, #6d28d9 100%);
  box-shadow: 0 8px 24px -6px rgba(139,92,246,0.55), inset 0 1px 0 rgba(255,255,255,0.25);
}
.logo .mark::before {
  content: '';
  position: absolute; inset: 4px; border-radius: 8px; opacity: 0.7;
  mix-blend-mode: screen;
  background: conic-gradient(from 120deg, transparent, rgba(34,211,238,0.55), transparent 65%);
}
.logo .mark svg { position: relative; }
.logo .word {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.02em;
  color: #fff;
}
.logo.sm .mark { width: 28px; height: 28px; border-radius: 8px; }
.logo.sm .word { font-size: 15px; }

/* ============================================================================
 * Buttons
 * ========================================================================== */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px;
  border: 0; border-radius: var(--r-btn);
  font-family: inherit; font-size: 14px; font-weight: 500;
  color: #fff; cursor: pointer;
  transition: transform .18s, box-shadow .18s, background .18s, color .18s, opacity .18s;
  position: relative;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: scale(0.98); }

.btn.sm { height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.lg { height: 48px; padding: 0 22px; font-size: 15px; }
.btn.xl { height: 54px; padding: 0 28px; font-size: 16px; border-radius: 14px; }

.btn-primary {
  background: var(--grad-violet);
  box-shadow: 0 8px 32px -8px rgba(139,92,246,0.65);
  box-shadow: 0 8px 32px -8px rgba(139,92,246,0.65), inset 0 0 0 1px rgba(255,255,255,0.14);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 14px 44px -10px rgba(139,92,246,0.75), inset 0 0 0 1px rgba(255,255,255,0.18); }

.btn-cyan {
  background: var(--grad-cyan); color: #051528;
  box-shadow: 0 8px 32px -8px rgba(34,211,238,0.55), inset 0 0 0 1px rgba(255,255,255,0.14);
}
.btn-aurora {
  background: var(--grad-aurora);
  box-shadow: 0 8px 32px -8px rgba(139,92,246,0.55), inset 0 0 0 1px rgba(255,255,255,0.14);
}
.btn-secondary {
  background: rgba(255,255,255,0.06);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12);
}
.btn-secondary:hover:not(:disabled) { background: rgba(255,255,255,0.10); }
.btn-ghost {
  background: transparent; color: rgba(255,255,255,0.85);
}
.btn-ghost:hover:not(:disabled) { background: rgba(255,255,255,0.06); }
.btn-outline {
  background: transparent; color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18);
}
.btn-outline:hover:not(:disabled) { background: rgba(255,255,255,0.04); }
.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 8px 32px -8px rgba(16,185,129,0.5), inset 0 0 0 1px rgba(255,255,255,0.14);
}
.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  box-shadow: var(--shadow-danger), inset 0 0 0 1px rgba(255,255,255,0.14);
}
.btn-danger:hover:not(:disabled) { box-shadow: 0 14px 36px -10px rgba(239,68,68,0.7), inset 0 0 0 1px rgba(255,255,255,0.18); }

.btn .spinner {
  width: 14px; height: 14px; border-radius: 999px;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin-slow 0.7s linear infinite;
}

/* Icon buttons (square) */
.btn-icon {
  width: 44px; padding: 0; flex-shrink: 0;
}
.btn-icon.sm { width: 36px; height: 36px; }
.btn-icon.lg { width: 48px; height: 48px; }
.btn-icon.xl { width: 54px; height: 54px; }

/* Tiny chip-style toolbar buttons */
.chip-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 10px; font-size: 11px; font-weight: 500;
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.78);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, transform .15s;
}
.chip-btn:hover { background: rgba(255,255,255,0.09); color: #fff; border-color: var(--border-strong); }
.chip-btn:active { transform: scale(0.97); }
.chip-btn.danger { color: #fda4af; }
.chip-btn.danger:hover { background: rgba(239,68,68,0.15); border-color: rgba(239,68,68,0.4); color: #fecaca; }

/* ============================================================================
 * Inputs
 * ========================================================================== */

.input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  color: #fff;
  font-size: 15px;
  font-family: inherit;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.input::placeholder { color: rgba(255,255,255,0.40); }
.input:hover { border-color: rgba(255,255,255,0.20); }
.input:focus {
  outline: none;
  background: rgba(255,255,255,0.06);
  border-color: rgba(139,92,246,0.70);
  box-shadow: 0 0 0 4px rgba(139,92,246,0.20);
}
.input.sm { height: 36px; font-size: 13px; padding: 0 10px; border-radius: 10px; }
.input.mono { font-family: var(--font-mono); font-size: 13px; }

.field-label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: rgba(255,255,255,0.55);
  margin-bottom: 8px;
}
.field-label .hint a { font-size: 11px; letter-spacing: normal; text-transform: none; }

.input-wrap { position: relative; }
.input-wrap .input-suffix {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  color: rgba(255,255,255,0.45); cursor: pointer;
  background: transparent; border: 0; padding: 6px;
  display: inline-flex; align-items: center;
  border-radius: 6px;
  transition: color .15s, background .15s;
}
.input-wrap .input-suffix:hover { color: #fff; background: rgba(255,255,255,0.05); }

/* Range slider — VoxAI */
input[type="range"].slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  outline: none;
}
input[type="range"].slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px;
  border-radius: 999px;
  background: var(--grad-violet);
  box-shadow: 0 0 0 4px rgba(139,92,246,0.18), 0 4px 12px rgba(139,92,246,0.5);
  cursor: pointer;
  transition: transform .15s;
}
input[type="range"].slider::-webkit-slider-thumb:hover { transform: scale(1.1); }
input[type="range"].slider::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 999px;
  background: var(--grad-violet);
  border: 0;
  cursor: pointer;
}

/* Native select — themed */
.select {
  height: 28px; padding: 0 26px 0 10px;
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.85);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 11px;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'><path fill='rgba(255,255,255,0.55)' d='M6 8L1.5 3.5h9z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
.select option { background: var(--ink-900); color: #fff; }

/* Checkbox */
.check {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; color: rgba(255,255,255,0.78);
  cursor: pointer; user-select: none;
}
.check input[type="checkbox"] {
  width: 16px; height: 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
}

/* ============================================================================
 * Pills
 * ========================================================================== */

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 10px;
  height: 28px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.78);
  white-space: nowrap;
}
.pill.sm { height: 22px; padding: 0 8px; font-size: 11px; }
.pill.brand  { background: rgba(139,92,246,0.15); color: #ddd6fe; border-color: rgba(139,92,246,0.30); }
.pill.cyan   { background: rgba(34,211,238,0.15); color: #a5f3fc; border-color: rgba(34,211,238,0.30); }
.pill.green  { background: rgba(16,185,129,0.15); color: #6ee7b7; border-color: rgba(16,185,129,0.30); }
.pill.red    { background: rgba(239,68,68,0.15);  color: #fecaca; border-color: rgba(239,68,68,0.30); }
.pill.amber  { background: rgba(245,158,11,0.15); color: #fcd34d; border-color: rgba(245,158,11,0.30); }
.pill.pink   { background: rgba(244,114,182,0.15); color: #fbcfe8; border-color: rgba(244,114,182,0.30); }
.pill .dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.pill .dot.pulse { animation: pulse-soft 1.6s ease-in-out infinite; }

/* ============================================================================
 * Cards
 * ========================================================================== */

.card {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-size: 14px; font-weight: 600; color: #fff;
  letter-spacing: -0.01em;
}
.card-body { padding: 16px 18px; }

/* ============================================================================
 * Toasts
 * ========================================================================== */

#toasts {
  position: fixed; right: 24px; top: 24px; z-index: 200;
  display: flex; flex-direction: column; gap: 10px;
  max-width: 360px;
  pointer-events: none;
}
#toasts .toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(15,18,32,0.95);
  border: 1px solid var(--border-strong);
  box-shadow: 0 16px 40px rgba(0,0,0,0.45), 0 0 0 1px rgba(139,92,246,0.18);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  color: #fff;
  font-size: 13px;
  animation: reveal-up .35s cubic-bezier(0.22,1,0.36,1) both;
}
#toasts .toast.success { box-shadow: 0 16px 40px rgba(0,0,0,0.45), 0 0 0 1px rgba(16,185,129,0.28); }
#toasts .toast.error   { box-shadow: 0 16px 40px rgba(0,0,0,0.45), 0 0 0 1px rgba(239,68,68,0.32); }
#toasts .toast .icon { line-height: 1; margin-top: 1px; }
#toasts .toast .msg  { line-height: 1.45; }

/* ============================================================================
 * AUTH SCREEN
 * ========================================================================== */

.auth-screen {
  position: relative; z-index: 2;
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
}
@media (min-width: 1024px) {
  .auth-screen { grid-template-columns: 1fr 1fr; }
}

.auth-panel {
  display: none;
  position: relative;
  overflow: hidden;
  background: var(--ink-950);
  color: #fff;
  padding: 48px;
}
@media (min-width: 1024px) {
  .auth-panel { display: flex; flex-direction: column; }
}
.auth-panel .panel-mesh {
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
}
.auth-panel .panel-mesh .blob {
  position: absolute; border-radius: 50%; filter: blur(50px);
}
.auth-panel .panel-mesh .blob.v { top: -120px; right: -120px; width: 480px; height: 480px; background: radial-gradient(closest-side, rgba(139,92,246,0.55), rgba(139,92,246,0)); animation: mesh-drift 30s ease-in-out infinite; }
.auth-panel .panel-mesh .blob.c { bottom: -120px; left: -120px; width: 420px; height: 420px; background: radial-gradient(closest-side, rgba(34,211,238,0.45), rgba(34,211,238,0)); animation: mesh-drift 60s ease-in-out infinite; animation-delay: -10s; }
.auth-panel .panel-mesh .blob.p { top: 33%; left: 50%; transform: translateX(-50%); width: 320px; height: 320px; background: radial-gradient(closest-side, rgba(244,114,182,0.32), rgba(244,114,182,0)); }
.auth-panel .ring {
  position: absolute; border: 1px solid rgba(255,255,255,0.05); border-radius: 50%;
}
.auth-panel .ring.r1 { right: -60px; top: 28%; width: 280px; height: 280px; }
.auth-panel .ring.r2 { right: 12%; bottom: 14%; width: 220px; height: 220px; }
.auth-panel .ring.r3 { left: -50px; top: 15%; width: 180px; height: 180px; }

.auth-panel .float-dot {
  position: absolute; width: 8px; height: 8px; border-radius: 999px;
  animation: float-up-down 4s ease-in-out infinite;
}
.auth-panel .float-dot.c1 { right: 20%; top: 25%; background: #67e8f9; box-shadow: 0 0 16px rgba(34,211,238,0.8); }
.auth-panel .float-dot.c2 { right: 34%; top: 55%; width: 6px; height: 6px; background: #f472b6; box-shadow: 0 0 14px rgba(244,114,182,0.8); animation-delay: 0.6s; }
.auth-panel .float-dot.c3 { left: 15%; top: 60%; background: #b6a4fc; box-shadow: 0 0 18px rgba(139,92,246,0.8); animation-delay: 1.2s; }

.auth-panel .panel-content {
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  height: 100%;
}
.auth-panel .panel-hero { margin-top: auto; }
.auth-panel .hero-title {
  font-family: var(--font-display);
  font-size: clamp(40px, 5vw, 56px);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0;
}
.auth-panel .hero-title.line-2 {
  background: var(--grad-aurora-text);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradient-flow 8s ease infinite;
  margin-bottom: 24px;
}
.auth-panel .hero-sub {
  color: rgba(255,255,255,0.65);
  line-height: 1.65;
  max-width: 480px;
  margin: 0 0 32px;
  font-size: 15px;
}
.auth-panel .voice-sig-card {
  padding: 18px;
  border-radius: 18px;
  margin-bottom: 24px;
}
.auth-panel .feature-pills {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.auth-panel .feature-pills .chip {
  display: inline-flex; align-items: center;
  padding: 0 14px; height: 32px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: rgba(255,255,255,0.75);
  font-size: 12px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.auth-form-wrap {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; justify-content: center;
  padding: 48px 24px;
}
@media (min-width: 640px) { .auth-form-wrap { padding: 48px; } }
@media (min-width: 1024px) { .auth-form-wrap { padding: 48px 80px; } }

.auth-form {
  width: 100%; max-width: 440px; margin: 0 auto;
  animation: reveal-up .55s cubic-bezier(0.22,1,0.36,1) both;
}
.auth-form .title {
  font-family: var(--font-display);
  font-size: 44px; font-weight: 700;
  line-height: 1.05; letter-spacing: -0.02em;
  margin: 12px 0 8px;
  color: #fff;
}
.auth-form .sub {
  font-size: 13px; color: rgba(255,255,255,0.55);
  margin-bottom: 36px;
}
.auth-form .oauth-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin-bottom: 20px;
}
.auth-form .divider {
  position: relative; margin: 10px 0 22px;
  text-align: center;
}
.auth-form .divider::before {
  content: ''; position: absolute; inset: 50% 0 0 0; height: 1px;
  background: rgba(255,255,255,0.08);
}
.auth-form .divider span {
  position: relative; padding: 0 12px;
  background: var(--ink-950);
  font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase;
  color: rgba(255,255,255,0.4);
}
.auth-form .field { margin-bottom: 18px; }
.auth-form .error {
  font-size: 13px; color: #fecaca;
  background: rgba(239,68,68,0.10);
  border: 1px solid rgba(239,68,68,0.20);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 8px;
  animation: reveal-up .25s both;
}
.auth-form .footer-tags {
  margin-top: 36px;
  display: flex; align-items: center; justify-content: center;
  gap: 20px; flex-wrap: wrap;
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: rgba(255,255,255,0.4);
}
.auth-form .footer-tags .sep { color: rgba(255,255,255,0.2); }

/* ============================================================================
 * APP LAYOUT
 * ========================================================================== */

body.is-authed .auth-screen { display: none; }
body:not(.is-authed) .app-screen { display: none !important; }

.app-screen {
  position: relative; z-index: 2;
  display: flex; flex-direction: column;
  min-height: 100vh;
}

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(7,9,18,0.55);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1480px; margin: 0 auto;
  padding: 14px 24px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px;
  justify-content: space-between;
}
.topbar .brand-block {
  display: flex; align-items: center; gap: 12px;
}
.topbar .brand-block .meta { display: flex; flex-direction: column; line-height: 1.15; }
.topbar .brand-block .meta .name { font-weight: 600; font-size: 14px; color: #fff; }
.topbar .brand-block .meta .sub { font-size: 11px; color: rgba(255,255,255,0.55); }

.topbar .status-cluster {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  font-size: 13px;
}
.status-tile {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
}
.status-tile .label { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(255,255,255,0.5); }
.status-tile .value { font-size: 12px; font-weight: 600; color: #fff; }
.status-tile .dot {
  width: 10px; height: 10px; border-radius: 999px;
  background: rgba(255,255,255,0.25); flex-shrink: 0;
}
#conn-dot { width: 8px; height: 8px; border-radius: 999px; background: rgba(255,255,255,0.25); }

.user-menu {
  position: relative;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 4px 6px 4px 4px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
}
.user-menu .avatar {
  width: 32px; height: 32px;
  border-radius: 999px;
  background: var(--grad-violet);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: #fff;
}
.user-menu .name { font-size: 13px; color: rgba(255,255,255,0.85); padding-right: 4px; }
.user-menu .caret { color: rgba(255,255,255,0.4); }
.user-menu .menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 220px;
  background: rgba(15,18,32,0.95);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  box-shadow: 0 24px 48px rgba(0,0,0,0.55);
  padding: 6px;
  display: none;
}
.user-menu.open .menu { display: block; animation: reveal-up .2s both; }
.user-menu .menu-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 10px 12px;
  font-size: 13px; color: rgba(255,255,255,0.85);
  background: transparent;
  border: 0; border-radius: 10px;
  cursor: pointer; text-align: left;
}
.user-menu .menu-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.user-menu .menu-item.danger { color: #fca5a5; }
.user-menu .menu-item.danger:hover { background: rgba(239,68,68,0.12); color: #fecaca; }
.user-menu .menu-meta {
  padding: 12px 12px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.user-menu .menu-meta .email { font-size: 12px; color: rgba(255,255,255,0.55); }
.user-menu .menu-meta .who   { font-size: 13px; color: #fff; font-weight: 600; }

/* Backend bar (preserved IDs) */
.backend-bar {
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border);
}
.backend-bar-inner {
  max-width: 1480px; margin: 0 auto;
  padding: 12px 24px;
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px;
  font-size: 12px;
}
.backend-bar .lab { font-size: 11px; font-weight: 600; color: rgba(255,255,255,0.55); align-self: center; }
.backend-bar .field-block { display: flex; flex-direction: column; gap: 4px; }
.backend-bar .field-block > span { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(255,255,255,0.5); }
.backend-bar .input { height: 36px; padding: 0 10px; border-radius: 10px; font-size: 12px; font-family: var(--font-mono); }
.backend-bar .grow { flex: 1; min-width: 200px; }
.backend-bar .narrow { width: 92px; }
.backend-bar .host   { width: 200px; }

/* File protocol banner */
#file-protocol-banner {
  display: none;
  max-width: 1480px;
  margin: 12px auto 0;
  padding: 10px 16px;
  background: rgba(245,158,11,0.12);
  border: 1px solid rgba(245,158,11,0.30);
  border-radius: 12px;
  color: #fcd34d;
  font-size: 12px;
}
#file-protocol-banner code {
  background: rgba(255,255,255,0.08);
  padding: 1px 6px; border-radius: 4px;
}
html.sophia-file-origin #file-protocol-banner { display: block !important; }

/* Main grid */
.main-grid {
  flex: 1;
  max-width: 1480px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 24px 32px;
  display: grid;
  gap: 18px;
  min-height: 0;
  grid-template-columns: 1fr;
}
@media (min-width: 1100px) {
  .main-grid { grid-template-columns: minmax(0, 1fr) 400px; }
}

.conversation {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 22px;
  box-shadow: var(--shadow-card);
  display: flex; flex-direction: column;
  min-height: 540px;
  overflow: hidden;
}
.conversation-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.conversation-header .title-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.conversation-header h2 {
  font-size: 16px; font-weight: 600; margin: 0;
  letter-spacing: -0.01em;
}
.conversation-header .actions {
  display: flex; gap: 10px;
}

/* Orb row */
.orb-row {
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  gap: 12px;
  padding: 18px 22px 0;
}
@media (max-width: 880px) {
  .orb-row { grid-template-columns: 1fr; }
}
.orb-card {
  display: grid; place-items: center;
  padding: 16px;
  min-width: 200px;
  border-radius: 18px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
}
.eq-card {
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 10px;
}
.eq-card .eq-head { display: flex; align-items: center; justify-content: space-between; }
.eq-card .badge-active { font-size: 11px; color: #6ee7b7; font-weight: 600; }
.eq-card .badge-muted  { font-size: 11px; color: rgba(255,255,255,0.5); font-weight: 600; }

/* Voice Orb */
.voice-orb {
  position: relative;
  width: 160px; height: 160px;
  display: grid; place-items: center;
  user-select: none;
}
.voice-orb.lg { width: 220px; height: 220px; }
.voice-orb .ring {
  position: absolute; border-radius: 999px; pointer-events: none;
}
.voice-orb .ring.r0 { width: 100%; height: 100%; border: 1px solid rgba(255,255,255,0.08); }
.voice-orb .ring.r1 { width: 82%; height: 82%; border: 1px solid rgba(255,255,255,0.12); }
.voice-orb .ring.pulse-a { width: 90%; height: 90%; border: 2px solid rgba(139,92,246,0.40); animation: ping-out 2.6s cubic-bezier(0,0,0.2,1) infinite; }
.voice-orb .ring.pulse-b { width: 90%; height: 90%; border: 2px solid rgba(34,211,238,0.30); animation: ping-out 2.6s cubic-bezier(0,0,0.2,1) infinite; animation-delay: 1.3s; }
.voice-orb .conic {
  position: absolute;
  width: 70%; height: 70%;
  border-radius: 999px;
  background: conic-gradient(from 0deg, #8b5cf6, #22d3ee, #f472b6, #8b5cf6);
  filter: blur(2px);
  animation: spin-slow 12s linear infinite;
}
.voice-orb.active .conic { animation-duration: 4s; }
.voice-orb .conic-mask {
  position: absolute;
  width: calc(70% - 6px); height: calc(70% - 6px);
  border-radius: 999px;
  background: var(--ink-950);
}
.voice-orb .core {
  position: relative;
  width: 55%; height: 55%;
  border-radius: 999px;
  background: var(--grad-violet);
  display: grid; place-items: center;
  box-shadow: var(--shadow-violet), inset 0 0 0 1px rgba(255,255,255,0.20);
  cursor: default;
  transition: transform .15s;
}
.voice-orb.clickable .core { cursor: pointer; }
.voice-orb.clickable:hover .core { transform: scale(1.03); }
.voice-orb.clickable:active .core { transform: scale(0.97); }
.voice-orb .core svg { color: #fff; filter: drop-shadow(0 4px 8px rgba(0,0,0,0.25)); }

/* Equalizer / Listen Dots */
.equalizer-bars {
  display: flex; align-items: flex-end; gap: 3px;
  height: 56px;
}
.equalizer-bars .bar {
  flex: 1;
  border-radius: 999px;
  background: var(--grad-equalizer);
  transform-origin: bottom;
  box-shadow: 0 0 12px rgba(139,92,246,0.55);
  animation: eq 1s ease-in-out infinite;
}
.equalizer-bars.idle .bar { animation-play-state: paused; box-shadow: none; opacity: 0.55; }

.listen-dots {
  display: flex; align-items: center; gap: 6px;
  height: 56px;
}
.listen-dots .dot {
  width: 6px; height: 6px; border-radius: 999px;
  animation: listen-dot 1.2s ease-in-out infinite;
}
.listen-dots.idle .dot { animation-play-state: paused; opacity: 0.3; box-shadow: none; }

/* Messages */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px;
  display: flex; flex-direction: column; gap: 12px;
  min-height: 240px;
}

/* Override Tailwind utility classes JS injects for bubbles, in dark theme */
#messages .bg-blue-600 {
  background: var(--grad-violet) !important;
  box-shadow: 0 8px 24px -12px rgba(139,92,246,0.7);
  border: 1px solid rgba(255,255,255,0.10);
}
#messages .bg-slate-100 {
  background: rgba(255,255,255,0.06) !important;
  border: 1px solid rgba(255,255,255,0.10);
}
#messages .text-slate-900 { color: rgba(255,255,255,0.92) !important; }
#messages .bg-yellow-50 { background: rgba(245,158,11,0.12) !important; }
#messages .text-yellow-900 { color: #fcd34d !important; }
#messages .border-yellow-200 { border-color: rgba(245,158,11,0.30) !important; }

/* FR mode strip */
#fr-mode-composer-strip {
  padding: 10px 22px;
  background: rgba(245,158,11,0.08);
  border-top: 1px solid rgba(245,158,11,0.20);
}
#fr-mode-composer-strip p { margin: 0; color: #fcd34d; font-size: 12px; line-height: 1.4; }
#fr-mode-composer-strip strong { color: #fde68a; }

/* Composer */
.composer {
  border-top: 1px solid var(--border);
  padding: 14px 18px;
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,0.02);
}
.composer #text-input {
  flex: 1;
  height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: #fff;
  font-size: 14px;
  outline: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.composer #text-input:focus {
  background: rgba(255,255,255,0.07);
  border-color: rgba(139,92,246,0.6);
  box-shadow: 0 0 0 4px rgba(139,92,246,0.18);
}
.composer #text-input::placeholder { color: rgba(255,255,255,0.4); }
.composer #text-input:disabled { background: rgba(255,255,255,0.025); color: rgba(255,255,255,0.4); }

.composer #mic-btn {
  width: 48px; height: 48px;
  border-radius: 999px;
  border: 0;
  display: grid; place-items: center;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.55);
  cursor: pointer;
  transition: transform .15s, background .15s, color .15s, box-shadow .15s;
  position: relative;
  flex-shrink: 0;
}
.composer #mic-btn:hover:not(:disabled) { background: rgba(255,255,255,0.12); color: #fff; }
.composer #mic-btn:disabled { cursor: not-allowed; opacity: 0.55; }
.composer #mic-btn.bg-red-500 {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
  color: #fff !important;
  box-shadow: 0 8px 24px -6px rgba(239,68,68,0.6), inset 0 0 0 1px rgba(255,255,255,0.15);
  animation: rec-pulse 1.4s ease-in-out infinite;
}
.composer #mic-btn.bg-slate-200 {
  background: rgba(255,255,255,0.08) !important;
  color: rgba(255,255,255,0.55) !important;
}
.composer #mic-btn.text-white { color: #fff !important; }
.composer #mic-btn.text-slate-700 { color: rgba(255,255,255,0.55) !important; }
.composer #mic-btn.cursor-not-allowed { cursor: not-allowed; opacity: 0.5; }

.composer #send-btn {
  height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  border: 0;
  font-size: 14px; font-weight: 600;
  color: #fff;
  background: var(--grad-violet);
  cursor: pointer;
  box-shadow: 0 8px 24px -8px rgba(139,92,246,0.6), inset 0 0 0 1px rgba(255,255,255,0.14);
  transition: transform .15s, box-shadow .15s, opacity .15s;
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 8px;
}
.composer #send-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 14px 34px -10px rgba(139,92,246,0.75); }
.composer #send-btn:active:not(:disabled) { transform: scale(0.98); }
.composer #send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Conversation actions */
#start-call {
  height: 36px; padding: 0 16px;
  border-radius: 10px; border: 0;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff; font-weight: 600; font-size: 13px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  box-shadow: 0 8px 24px -8px rgba(16,185,129,0.5), inset 0 0 0 1px rgba(255,255,255,0.14);
  transition: transform .15s, box-shadow .15s, opacity .15s;
}
#start-call:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 14px 32px -10px rgba(16,185,129,0.6); }
#start-call:disabled { opacity: 0.5; cursor: not-allowed; }

#end-call {
  height: 36px; padding: 0 16px;
  border-radius: 10px; border: 0;
  background: rgba(239,68,68,0.12);
  color: #fca5a5; font-weight: 600; font-size: 13px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid rgba(239,68,68,0.30);
  transition: background .15s, color .15s;
}
#end-call:hover:not(:disabled) { background: rgba(239,68,68,0.20); color: #fecaca; }
#end-call:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================================================================
 * Right rail
 * ========================================================================== */

.rail {
  display: flex; flex-direction: column; gap: 14px;
  min-height: 0;
  min-width: 0;
}

.rail .rcard {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow-card);
}
.rail .rcard.flex { display: flex; flex-direction: column; min-height: 0; flex: 1; padding: 0; }
.rail .rcard h3 {
  margin: 0 0 8px;
  font-size: 13px; font-weight: 600;
  color: #fff;
}
.rail .rcard p { font-size: 12px; color: rgba(255,255,255,0.55); margin: 0; line-height: 1.5; }

/* FR Mode card */
.fr-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
#fr-toggle {
  position: relative; display: inline-flex; align-items: center;
  height: 24px; width: 46px;
  border: 0; border-radius: 999px;
  background: rgba(255,255,255,0.15);
  cursor: pointer;
  transition: background .2s;
}
#fr-toggle.bg-blue-600 {
  background: var(--grad-violet) !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18), 0 0 0 4px rgba(139,92,246,0.18);
}
#fr-toggle.bg-slate-300 {
  background: rgba(255,255,255,0.15) !important;
}
#fr-knob {
  display: inline-block;
  height: 16px; width: 16px;
  border-radius: 999px;
  background: #fff;
  transform: translateX(4px);
  transition: transform .2s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
}

/* Turn taking */
.turn-state {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  margin-top: 10px;
}
.turn-state .who {
  display: flex; flex-direction: column; line-height: 1.15;
}
.turn-state .who .lab { font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; color: rgba(255,255,255,0.5); }
.turn-state .who .val { font-size: 13px; font-weight: 600; color: #fff; }
#turn-state-emoji { font-size: 18px; line-height: 1; }
#recording-pill {
  display: none;
  margin-top: 10px;
  font-size: 12px; font-weight: 600;
  color: #fca5a5;
}
#recording-pill:not(.hidden) { display: flex; align-items: center; gap: 8px; }
#recording-pill::before {
  content: '';
  width: 8px; height: 8px; border-radius: 999px; background: #ef4444;
  animation: pulse-soft 1.6s ease-in-out infinite;
}

.eou-controls {
  margin: 10px 0;
  display: flex; align-items: center; gap: 12px;
}
#eou-delay-label {
  font-family: var(--font-mono);
  font-size: 12px; font-weight: 600; color: #fff;
  min-width: 76px; text-align: right;
}

/* Session & audio path */
.kv-list { display: flex; flex-direction: column; gap: 6px; font-family: var(--font-mono); font-size: 12px; color: rgba(255,255,255,0.78); }
.kv-list .row { display: flex; align-items: center; gap: 6px; }
.kv-list .row .v { color: #fff; font-weight: 600; }
.kv-list .row .v.amber  { color: #fcd34d; }
.kv-list .row .v.cyan   { color: #67e8f9; }
.kv-list .row .v.violet { color: #c4b5fd; }
.audio-flow-note { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.audio-flow-note code {
  background: rgba(255,255,255,0.06);
  padding: 1px 6px; border-radius: 6px;
  font-size: 11px;
}

/* Live transcript */
#live-transcript {
  font-size: 13px;
  font-style: italic;
  color: rgba(255,255,255,0.72);
  min-height: 36px;
  line-height: 1.5;
}
#live-transcript:empty::before { content: '—'; color: rgba(255,255,255,0.3); font-style: normal; }

/* ============================================================================
 * Log console
 * ========================================================================== */

.log-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 18px;
  display: flex; flex-direction: column;
  flex: 1; min-height: 320px; max-height: min(60vh, 580px);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.log-card .log-head {
  padding: 12px 14px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}
.log-card .log-head h3 { margin: 0; font-size: 13px; font-weight: 600; color: #fff; }
.log-card .log-toolbar {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}
.log-card .log-toolbar input.input {
  height: 28px; padding: 0 10px; font-size: 11px; border-radius: 8px;
  flex: 1; min-width: 80px; max-width: 160px;
}

#socket-log-scroll {
  flex: 1;
  overflow-y: scroll;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  background: rgba(7,9,18,0.45);
  position: relative;
  scroll-behavior: smooth;
}
#socket-log-scroll:focus-visible { box-shadow: inset 0 0 0 2px rgba(34,211,238,0.45); border-radius: 4px; }

#socket-log-rows {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  padding: 8px 10px 20px;
  color: rgba(255,255,255,0.78);
}
.log-line {
  padding: 2px 6px;
  border-radius: 4px;
  white-space: pre-wrap;
  word-break: break-word;
}
.log-line .log-lv { font-weight: 700; }
.log-line:hover { background: rgba(255,255,255,0.05) !important; }
.log-line.log-lv-ERROR    { color: #fda4af; }
.log-line.log-lv-ERROR .log-lv,
.log-line.log-lv-CRITICAL .log-lv { color: #fda4af; }
.log-line.log-lv-WARNING  { color: #fde68a; }
.log-line.log-lv-WARNING .log-lv { color: #fbbf24; }
.log-line.log-lv-INFO     { color: rgba(199,210,254,0.92); }
.log-line.log-lv-INFO .log-lv    { color: #93c5fd; }
.log-line.log-lv-SUCCESS  { color: #a7f3d0; }
.log-line.log-lv-SUCCESS .log-lv { color: #34d399; }
.log-line.log-lv-DEBUG    { color: rgba(255,255,255,0.45); }
.log-line.log-lv-DEBUG .log-lv   { color: rgba(255,255,255,0.40); }

/* Override Tailwind-utility-classed badges JS produces, scoped to log-card */
.log-card .bg-emerald-50  { background: rgba(16,185,129,0.15) !important; }
.log-card .text-emerald-900, .log-card .text-emerald-800 { color: #6ee7b7 !important; }
.log-card .border-emerald-200, .log-card .border-emerald-100 { border-color: rgba(16,185,129,0.40) !important; }
.log-card .bg-violet-50   { background: rgba(139,92,246,0.18) !important; }
.log-card .text-violet-900 { color: #c4b5fd !important; }
.log-card .border-violet-200 { border-color: rgba(139,92,246,0.40) !important; }
.log-card .bg-amber-50    { background: rgba(245,158,11,0.18) !important; }
.log-card .text-amber-900, .log-card .text-amber-800 { color: #fcd34d !important; }
.log-card .border-amber-100, .log-card .border-amber-200 { border-color: rgba(245,158,11,0.40) !important; }
.log-card .bg-slate-100   { background: rgba(255,255,255,0.06) !important; }
.log-card .text-slate-700, .log-card .text-slate-600 { color: rgba(255,255,255,0.78) !important; }
.log-card .bg-white       { background: rgba(255,255,255,0.06) !important; }
.log-card .hover\:bg-emerald-100:hover { background: rgba(16,185,129,0.28) !important; }
.log-card .hover\:bg-slate-50:hover { background: rgba(255,255,255,0.10) !important; }
.log-card .hover\:bg-white\/70:hover { background: rgba(255,255,255,0.05) !important; }
.log-card .text-red-700 { color: #fda4af !important; }
.log-card .border-slate-200 { border-color: rgba(255,255,255,0.12) !important; }
.log-card .border-slate-100 { border-color: rgba(255,255,255,0.08) !important; }

/* Bubble container (parent of msg div) — give it width inheritance */
#messages > .flex { width: 100%; }

/* ============================================================================
 * Misc
 * ========================================================================== */

footer.app-footer {
  text-align: center; padding: 18px 24px;
  color: rgba(255,255,255,0.30);
  font-size: 11px;
}

.split { color: rgba(255,255,255,0.20); padding: 0 4px; }

/* Hide elements with sophia-client.js .hidden class */
.hidden { display: none !important; }

/* Speaking pill equalizer (header) */
.mini-eq { display: inline-flex; gap: 2px; align-items: end; height: 14px; }
.mini-eq span {
  width: 2px;
  background: currentColor;
  border-radius: 2px;
  animation: eq 0.85s ease-in-out infinite;
}
.mini-eq span:nth-child(1) { animation-delay: 0s; height: 6px; }
.mini-eq span:nth-child(2) { animation-delay: 0.12s; height: 12px; }
.mini-eq span:nth-child(3) { animation-delay: 0.24s; height: 8px; }
.mini-eq span:nth-child(4) { animation-delay: 0.36s; height: 14px; }

/* Thinking pill */
.thinking-dots { display: inline-flex; align-items: center; gap: 3px; }
.thinking-dots span {
  width: 4px; height: 4px; border-radius: 999px; background: currentColor;
  animation: listen-dot 1.2s ease-in-out infinite;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.15s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.30s; }
