/* Google Fonts loaded via <link> in HTML — no @import here */

:root {
  --bg-primary: #070d1a;
  --bg-secondary: #0d1b35;
  --bg-card: rgba(13, 28, 58, 0.80);
  --bg-sidebar: rgba(7, 13, 30, 0.95);
  --accent-blue: #1a73e8;
  --accent-cyan: #00d4ff;
  --accent-orange: #f4a623;
  --accent-green: #00e676;
  --text-primary: #ffffff;
  --text-muted: rgba(255,255,255,0.55);
  --text-secondary: rgba(255,255,255,0.80);
  --border: rgba(0,212,255,0.18);
  --border-subtle: rgba(255,255,255,0.07);
  --glow-cyan: 0 0 30px rgba(0,212,255,0.25);
  --glow-blue: 0 0 40px rgba(26,115,232,0.30);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 50px;
  --sidebar-w: 260px;
  --header-h: 62px;
  --font-heading: 'Orbitron', monospace;
  --font-body: 'Inter', 'Exo 2', sans-serif;
  --transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
}

*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Star Field Background ── */
.stars-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(26,115,232,0.18) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(0,212,255,0.12) 0%, transparent 60%),
    linear-gradient(160deg, #070d1a 0%, #0d1b35 50%, #070d1a 100%);
}

.stars-canvas::before,
.stars-canvas::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 10% 15%, rgba(255,255,255,0.9) 0%, transparent 100%),
    radial-gradient(1px 1px at 30% 45%, rgba(255,255,255,0.7) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 50% 20%, rgba(255,255,255,0.8) 0%, transparent 100%),
    radial-gradient(1px 1px at 70% 60%, rgba(255,255,255,0.6) 0%, transparent 100%),
    radial-gradient(1px 1px at 85% 30%, rgba(255,255,255,0.9) 0%, transparent 100%),
    radial-gradient(1px 1px at 20% 80%, rgba(255,255,255,0.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 60% 85%, rgba(255,255,255,0.7) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 40% 65%, rgba(0,212,255,0.6) 0%, transparent 100%),
    radial-gradient(1px 1px at 90% 75%, rgba(255,255,255,0.8) 0%, transparent 100%),
    radial-gradient(1px 1px at 15% 50%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(1px 1px at 75% 10%, rgba(255,255,255,0.9) 0%, transparent 100%),
    radial-gradient(1px 1px at 55% 40%, rgba(255,255,255,0.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 25% 25%, rgba(255,255,255,0.7) 0%, transparent 100%),
    radial-gradient(1px 1px at 95% 55%, rgba(255,255,255,0.6) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 65% 95%, rgba(0,212,255,0.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 5% 90%, rgba(255,255,255,0.8) 0%, transparent 100%),
    radial-gradient(1px 1px at 45% 5%, rgba(255,255,255,0.9) 0%, transparent 100%),
    radial-gradient(1px 1px at 80% 40%, rgba(255,255,255,0.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 35% 90%, rgba(255,255,255,0.7) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 12% 35%, rgba(26,115,232,0.7) 0%, transparent 100%);
  animation: twinkle 8s ease-in-out infinite alternate;
}
.stars-canvas::after {
  animation-delay: -4s;
  animation-duration: 12s;
  background-image:
    radial-gradient(1px 1px at 22% 12%, rgba(255,255,255,0.6) 0%, transparent 100%),
    radial-gradient(1px 1px at 48% 78%, rgba(255,255,255,0.8) 0%, transparent 100%),
    radial-gradient(1px 1px at 68% 25%, rgba(255,255,255,0.5) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 88% 88%, rgba(0,212,255,0.7) 0%, transparent 100%),
    radial-gradient(1px 1px at 8% 62%, rgba(255,255,255,0.9) 0%, transparent 100%),
    radial-gradient(1px 1px at 52% 52%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(1px 1px at 78% 72%, rgba(255,255,255,0.6) 0%, transparent 100%),
    radial-gradient(1px 1px at 38% 38%, rgba(255,255,255,0.7) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 92% 18%, rgba(26,115,232,0.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 18% 92%, rgba(255,255,255,0.8) 0%, transparent 100%);
}

@keyframes twinkle {
  0%   { opacity: 0.6; }
  50%  { opacity: 1; }
  100% { opacity: 0.7; }
}

/* ── Shooting Stars ── */
.shooting-star {
  position: fixed;
  top: 0;
  left: 0;
  width: 2px;
  height: 2px;
  background: white;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
}
.shooting-star::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  width: 80px;
  height: 1px;
  background: linear-gradient(to left, rgba(255,255,255,0.8), rgba(0,212,255,0.4), transparent);
  border-radius: 50%;
}
@keyframes shoot {
  0%   { opacity: 0; transform: translate(0, 0) rotate(var(--angle)); }
  5%   { opacity: 1; }
  80%  { opacity: 0.6; }
  100% { opacity: 0; transform: translate(var(--tx), var(--ty)) rotate(var(--angle)); }
}

/* ── Page wrapper ── */
.page { position: relative; z-index: 1; }

/* ── Glass Card ── */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 40px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.06);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border: none;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, #1a73e8, #00d4ff);
  color: white;
  box-shadow: 0 4px 20px rgba(0,212,255,0.30);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0,212,255,0.45);
  filter: brightness(1.1);
}
.btn-orange {
  background: linear-gradient(135deg, #f4a623, #ff6f00);
  color: white;
  box-shadow: 0 4px 20px rgba(244,166,35,0.35);
}
.btn-orange:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(244,166,35,0.5);
  filter: brightness(1.1);
}
.btn-outline {
  background: transparent;
  color: var(--accent-cyan);
  border: 1px solid var(--border);
}
.btn-outline:hover {
  background: rgba(0,212,255,0.08);
  border-color: var(--accent-cyan);
}
.btn-ghost {
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}
.btn-ghost:hover {
  background: rgba(255,255,255,0.10);
  color: var(--text-primary);
}
.btn-danger {
  background: linear-gradient(135deg, #c62828, #ef5350);
  color: white;
  box-shadow: 0 4px 16px rgba(198,40,40,0.35);
}
.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(239,83,80,0.5);
}
.btn-sm {
  padding: 9px 20px;
  font-size: 0.82rem;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ── Input Fields ── */
.input-group {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.input-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  font-size: 1rem;
  pointer-events: none;
  display: flex;
  align-items: center;
}
.input-field {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 13px 16px 13px 44px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: var(--transition);
  outline: none;
}
.input-field:focus {
  border-color: var(--accent-cyan);
  background: rgba(0,212,255,0.05);
  box-shadow: 0 0 0 3px rgba(0,212,255,0.12);
}
.input-field::placeholder { color: var(--text-muted); }
.input-field.no-icon { padding-left: 16px; }
.input-field.has-toggle { padding-right: 44px; }
.input-toggle {
  position: absolute;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  transition: var(--transition);
  display: flex;
  align-items: center;
}
.input-toggle:hover { color: var(--text-primary); }

/* ── Alert/Error ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  display: none;
}
.alert.show { display: block; }
.alert-error {
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.3);
  color: #fca5a5;
}
.alert-success {
  background: rgba(0,230,118,0.12);
  border: 1px solid rgba(0,230,118,0.25);
  color: #86efac;
}

/* ── Auth Pages (login/register) ── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  z-index: 1;
}
.auth-card {
  width: 100%;
  max-width: 440px;
  padding: 40px;
  animation: cardIn 0.5s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(28px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.auth-header {
  text-align: center;
  margin-bottom: 32px;
}
.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
}
.auth-logo-name {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-cyan);
  letter-spacing: 3px;
}
.auth-title {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  font-family: var(--font-heading);
  letter-spacing: 1px;
}
.auth-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.auth-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 0.88rem;
  color: var(--text-muted);
}
.auth-footer a {
  color: var(--accent-cyan);
  text-decoration: none;
  font-weight: 600;
}
.auth-footer a:hover { text-decoration: underline; }

/* Back link */
.back-link {
  position: fixed;
  top: 22px;
  left: 22px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-family: var(--font-heading);
  letter-spacing: 1px;
  text-decoration: none;
  text-transform: uppercase;
  transition: var(--transition);
}
.back-link:hover { color: var(--accent-cyan); }
.back-link svg { transition: transform 0.2s ease; }
.back-link:hover svg { transform: translateX(-3px); }

/* Password strength */
.strength-bar {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}
.strength-seg {
  flex: 1;
  height: 3px;
  border-radius: 99px;
  background: var(--border-subtle);
  transition: var(--transition);
}
.strength-seg.s1 { background: #ef4444; }
.strength-seg.s2 { background: #f97316; }
.strength-seg.s3 { background: #eab308; }
.strength-seg.s4 { background: #22c55e; }
.strength-seg.s5 { background: #00e676; }
.strength-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 3px;
}

/* Password match */
.match-indicator {
  font-size: 0.73rem;
  margin-top: 4px;
  min-height: 16px;
  transition: var(--transition);
}
.match-ok  { color: #22c55e; }
.match-bad { color: #ef4444; }

/* Spinner */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.25);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Landing Page ── */
.landing-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}
.landing-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 48px;
  background: rgba(7,13,26,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.nav-logo-name {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent-cyan);
  letter-spacing: 3px;
}
.nav-actions { display: flex; gap: 12px; align-items: center; }

.landing-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-top: 68px;
}
.landing-hero {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 48px;
  gap: 60px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}
.hero-content { flex: 1; max-width: 560px; }
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(0,212,255,0.1);
  border: 1px solid rgba(0,212,255,0.25);
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-cyan);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 24px;
}
.badge-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent-cyan);
  animation: pulse-dot 2s ease infinite;
}
@keyframes pulse-dot {
  0%,100% { box-shadow: 0 0 0 0 rgba(0,212,255,0.5); }
  50% { box-shadow: 0 0 0 6px rgba(0,212,255,0); }
}
.hero-title {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 900;
  line-height: 1.15;
  color: var(--text-primary);
  margin-bottom: 16px;
  letter-spacing: 1px;
}
.hero-title span { color: var(--accent-cyan); }
.hero-desc {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 36px;
  max-width: 460px;
}
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-stats {
  display: flex;
  gap: 32px;
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border-subtle);
}
.stat-item { display: flex; flex-direction: column; gap: 4px; }
.stat-value {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
}
.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}
.hero-visual {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  max-width: 480px;
  position: relative;
}
.robot-container {
  position: relative;
  animation: float 4s ease-in-out infinite;
  filter: drop-shadow(0 0 40px rgba(0,212,255,0.30));
  cursor: pointer;
  overflow: visible;
}
.robot-container.robot-animating {
  animation: robotFlight 4s ease-in-out forwards !important;
}

/* ── Robot flight animation: full circle (left-first, CCW) ──
   Timeline: 0-20% activate, 20-80% circle, 80-100% landing
   Circle: R=120px, center=(0,-130px) relative to robot home */
@keyframes robotFlight {
  /* Activation */
  0%   { transform: translate(0,    0)    rotate(0deg)   scale(1);    opacity:1; }
  8%   { transform: translate(0,   -8px) rotate(-5deg)  scale(1.06); opacity:1; }
  /* Shake */
  12%  { transform: translate(-3px,-20px) rotate(-6deg)  scale(1.06); }
  16%  { transform: translate(3px, -13px) rotate(-4deg)  scale(1.06); }
  20%  { transform: translate(0,   -10px) rotate(-5deg)  scale(1.06); }
  /* Circle — left → top → right → back (CCW, R≈120px) */
  28%  { transform: translate(-85px,  -45px)  rotate(-22deg) scale(1.08); }
  35%  { transform: translate(-120px, -130px) rotate(-18deg) scale(1.08); }
  43%  { transform: translate(-85px,  -215px) rotate(-6deg)  scale(1.08); }
  50%  { transform: translate(0,      -250px) rotate(5deg)   scale(1.08); }
  58%  { transform: translate(85px,   -215px) rotate(18deg)  scale(1.08); }
  65%  { transform: translate(120px,  -130px) rotate(22deg)  scale(1.08); }
  73%  { transform: translate(85px,   -45px)  rotate(10deg)  scale(1.07); }
  80%  { transform: translate(0,      -10px)  rotate(-3deg)  scale(1.06); }
  /* Landing bounce */
  88%  { transform: translate(0,  20px) rotate(2deg)    scale(1.02); }
  93%  { transform: translate(0, -10px) rotate(-0.5deg) scale(1);    }
  97%  { transform: translate(0,   5px) rotate(0deg);                }
  100% { transform: translate(0,   0)   rotate(0deg)   scale(1);    opacity:1; }
}

/* ── Dynamic effect elements (injected via JS) ── */
@keyframes robotShockwave {
  0%   { width: 10px; height: 10px; margin-left: -5px; margin-top: -5px; opacity: 0.9; }
  100% { width: 300px; height: 300px; margin-left: -150px; margin-top: -150px; opacity: 0; }
}
@keyframes thrusterBurn {
  0%, 100% { transform: scaleY(1)   scaleX(1);    opacity: 0.9; }
  25%       { transform: scaleY(1.5) scaleX(0.75); opacity: 1;   }
  60%       { transform: scaleY(0.7) scaleX(1.2);  opacity: 0.8; }
}
@keyframes streakFade {
  0%   { opacity: 0.85; }
  100% { opacity: 0; transform: scaleX(0.15); }
}
@keyframes trailStarPop {
  0%   { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.4) translateY(-25px); }
}
@keyframes landingFlash {
  0%   { width: 10px; height: 10px; margin-left: -5px; margin-top: -5px; opacity: 1; }
  100% { width: 320px; height: 320px; margin-left: -160px; margin-top: -160px; opacity: 0; }
}
@keyframes float {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-18px); }
}
.robot-glow {
  position: absolute;
  inset: -40px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0,212,255,0.15) 0%, transparent 70%);
  animation: glow-pulse 3s ease-in-out infinite;
  pointer-events: none;
}
@keyframes glow-pulse {
  0%,100% { opacity: 0.6; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.05); }
}
.orbit-ring {
  position: absolute;
  border: 1px solid rgba(0,212,255,0.2);
  border-radius: 50%;
  pointer-events: none;
}
.orbit-ring-1 {
  width: 120%; height: 30%;
  top: 35%; left: -10%;
  transform: rotateX(70deg);
  animation: orbit-spin 12s linear infinite;
}
.orbit-ring-2 {
  width: 145%; height: 36%;
  top: 30%; left: -22%;
  transform: rotateX(70deg);
  animation: orbit-spin 18s linear infinite reverse;
  border-color: rgba(244,166,35,0.15);
}
@keyframes orbit-spin {
  from { transform: rotateX(70deg) rotateZ(0deg); }
  to   { transform: rotateX(70deg) rotateZ(360deg); }
}

/* Features strip */
.features-strip {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0 48px 80px;
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
}
.feature-card {
  flex: 1;
  min-width: 200px;
  max-width: 230px;
  padding: 22px 20px;
  border-radius: var(--radius-md);
  background: rgba(13,28,58,0.5);
  border: 1px solid var(--border-subtle);
  text-align: center;
  transition: var(--transition);
  cursor: default;
}
.feature-card:hover {
  border-color: var(--border);
  background: rgba(13,28,58,0.8);
  transform: translateY(-4px);
  box-shadow: var(--glow-cyan);
}
.feature-icon { font-size: 1.8rem; margin-bottom: 10px; display: block; }
.feature-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.feature-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.landing-footer-bar {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 0.78rem;
  letter-spacing: 0.5px;
  border-top: 1px solid var(--border-subtle);
}

/* ── Chat Layout ── */
.chat-app {
  display: flex;
  height: 100vh;
  height: 100dvh;
  height: calc(var(--app-vh, 1vh) * 100);
  overflow: hidden;
  position: relative;
  margin-left: var(--sidebar-w);
  z-index: 1;
}

/* Sidebar: now a direct body child — fixed on both mobile and desktop.
   Desktop: docked at left, chat-app shifted by margin-left.
   Mobile: slide-in drawer. */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 10;
}
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.sidebar-logo-name {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent-cyan);
  letter-spacing: 2px;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a73e8, #00d4ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.88rem;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 0 14px rgba(0,212,255,0.3);
  font-family: var(--font-heading);
  letter-spacing: 1px;
}
.user-info { min-width: 0; flex: 1; }
.user-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: 0.72rem;
  color: var(--accent-cyan);
  letter-spacing: 0.5px;
  font-family: var(--font-heading);
}
.sidebar-nav {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,212,255,0.2) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(0,212,255,0.2); border-radius: 99px; }

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 8px 8px 6px;
}
.new-chat-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(26,115,232,0.2), rgba(0,212,255,0.15));
  border: 1px dashed rgba(0,212,255,0.3);
  color: var(--accent-cyan);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 14px;
  letter-spacing: 0.5px;
  font-family: var(--font-body);
}
.new-chat-btn:hover {
  background: linear-gradient(135deg, rgba(26,115,232,0.35), rgba(0,212,255,0.25));
  border-color: var(--accent-cyan);
  box-shadow: var(--glow-cyan);
}
.history-list { display: flex; flex-direction: column; gap: 3px; }
.history-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-muted);
  font-size: 0.83rem;
}
.history-item:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text-primary);
}
.history-item-icon { font-size: 0.8rem; flex-shrink: 0; }
.history-item-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.history-item-time { font-size: 0.68rem; color: var(--text-muted); flex-shrink: 0; }
.history-delete-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(239,68,68,0.15);
  border: none;
  color: #fca5a5;
  font-size: 0.6rem;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: 2px;
  transition: var(--transition);
  line-height: 1;
}
.history-item:hover .history-delete-btn { display: flex; }
.history-delete-btn:hover {
  background: rgba(239,68,68,0.35);
  color: white;
  transform: scale(1.1);
}
.history-empty {
  text-align: center;
  padding: 20px 8px;
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.6;
}
.sidebar-footer {
  margin-top: auto;
  padding: 14px 12px;
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.86rem;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-body);
}
.logout-btn:hover {
  background: rgba(239,68,68,0.1);
  color: #fca5a5;
}

/* Main chat area */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  min-width: 0;
}
.chat-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: rgba(7,13,26,0.70);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  position: relative;
  z-index: 5;
}
.chat-header-bot {
  display: flex;
  align-items: center;
  gap: 12px;
}
.chat-bot-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0d1b35, #1a73e8);
  border: 1.5px solid rgba(0,212,255,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.chat-bot-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  font-family: var(--font-heading);
  letter-spacing: 1px;
}
.chat-bot-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.74rem;
  color: var(--accent-green);
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent-green);
  animation: pulse-dot 2s ease infinite;
}
.chat-header-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.header-user-name {
  font-size: 0.86rem;
  color: var(--text-muted);
}
.header-user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a73e8, #00d4ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
  font-family: var(--font-heading);
  letter-spacing: 1px;
  box-shadow: 0 0 12px rgba(0,212,255,0.3);
  flex-shrink: 0;
}

/* Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,212,255,0.15) transparent;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* Welcome screen */
.welcome-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
  gap: 14px;
  animation: fadeIn 0.5s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.welcome-robot {
  filter: drop-shadow(0 0 24px rgba(0,212,255,0.50));
  animation: float 4s ease-in-out infinite;
}
.welcome-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-heading);
  letter-spacing: 1px;
}
.welcome-title span { color: var(--accent-cyan); }
.welcome-sub {
  font-size: 0.93rem;
  color: var(--text-muted);
  max-width: 380px;
  line-height: 1.6;
}
.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 10px;
}
.quick-prompt {
  padding: 9px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: rgba(13,28,58,0.5);
  color: var(--text-secondary);
  font-size: 0.83rem;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-body);
}
.quick-prompt:hover {
  background: rgba(0,212,255,0.08);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* Message bubbles */
.message {
  display: flex;
  gap: 12px;
  max-width: 78%;
  animation: msg-in 0.3s ease;
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.message.user-msg { align-self: flex-end; flex-direction: row-reverse; }
.message.bot-msg  { align-self: flex-start; }

.msg-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-heading);
}
.msg-avatar.user-av {
  background: linear-gradient(135deg, #1a73e8, #00d4ff);
  color: white;
  box-shadow: 0 0 12px rgba(0,212,255,0.3);
  letter-spacing: 1px;
}
.msg-avatar.bot-av {
  background: linear-gradient(135deg, #0d1b35, #1a73e8);
  border: 1px solid rgba(0,212,255,0.35);
  overflow: hidden;
}

.msg-content { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.msg-bubble {
  padding: 14px 18px;
  border-radius: 18px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.65;
  letter-spacing: 0.1px;
  position: relative;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* ── Markdown rendering inside bot bubbles ───────────────────────── */
.bot-msg .msg-bubble .md-p { margin: 0 0 10px; }
.bot-msg .msg-bubble .md-p:last-child { margin-bottom: 0; }
.bot-msg .msg-bubble .md-h {
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: 0.4px;
  margin: 10px 0 6px;
  line-height: 1.3;
  color: var(--text-primary);
}
.bot-msg .msg-bubble h2.md-h { font-size: 1.08rem; color: var(--accent-cyan); }
.bot-msg .msg-bubble h3.md-h { font-size: 1rem; }
.bot-msg .msg-bubble h4.md-h { font-size: 0.93rem; color: rgba(0,212,255,0.9); }
.bot-msg .msg-bubble .md-h:first-child { margin-top: 0; }
.bot-msg .msg-bubble strong {
  font-weight: 700;
  color: #fff;
}
.bot-msg .msg-bubble em { font-style: italic; color: rgba(255,255,255,0.92); }
.bot-msg .msg-bubble a {
  color: var(--accent-cyan);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: rgba(0,212,255,0.4);
  transition: var(--transition);
  word-break: break-all;
}
.bot-msg .msg-bubble a:hover {
  color: #fff;
  text-decoration-color: var(--accent-cyan);
}
.bot-msg .msg-bubble .md-list {
  margin: 6px 0 10px 4px;
  padding-left: 22px;
}
.bot-msg .msg-bubble .md-list li {
  margin: 4px 0;
  padding-left: 4px;
}
.bot-msg .msg-bubble .md-list li::marker {
  color: var(--accent-cyan);
}
.bot-msg .msg-bubble .md-ic {
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.86em;
  padding: 2px 6px;
  background: rgba(0,212,255,0.1);
  border: 1px solid rgba(0,212,255,0.2);
  border-radius: 5px;
  color: #8ee4ff;
  white-space: pre-wrap;
}
.bot-msg .msg-bubble .md-pre {
  display: block;
  margin: 10px 0;
  padding: 12px 14px;
  background: rgba(5, 10, 22, 0.7);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--accent-cyan);
  border-radius: 8px;
  overflow-x: auto;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.82rem;
  line-height: 1.55;
}
.bot-msg .msg-bubble .md-pre code {
  background: none;
  border: none;
  padding: 0;
  color: #d6eaff;
  white-space: pre;
}
.bot-msg .msg-bubble .md-bq {
  margin: 8px 0;
  padding: 6px 14px;
  border-left: 3px solid var(--accent-cyan);
  background: rgba(0,212,255,0.05);
  color: var(--text-secondary);
  font-style: italic;
  border-radius: 0 6px 6px 0;
}
.bot-msg .msg-bubble .md-hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-subtle), transparent);
  margin: 12px 0;
}
.user-msg .msg-bubble {
  background: linear-gradient(135deg, #1a73e8, #0d52b5);
  color: white;
  border-bottom-right-radius: 5px;
  box-shadow: 0 4px 16px rgba(26,115,232,0.3);
}
.bot-msg .msg-bubble {
  background: rgba(13,28,58,0.85);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-bottom-left-radius: 5px;
  backdrop-filter: blur(10px);
}
.msg-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}
.msg-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  padding: 0 4px;
}
.user-msg .msg-meta { justify-content: flex-end; }

/* Copy button */
.copy-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.72rem;
  padding: 3px 6px;
  border-radius: 4px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 3px;
  opacity: 0;
}
.message:hover .copy-btn { opacity: 1; }
.copy-btn:hover { color: var(--accent-cyan); }

/* Audio player in message */
.msg-audio {
  margin-top: 8px;
  padding: 10px 14px;
  background: rgba(0,212,255,0.06);
  border: 1px solid rgba(0,212,255,0.15);
  border-radius: var(--radius-md);
}
.msg-audio audio {
  width: 100%;
  height: 32px;
}
.msg-audio-label {
  font-size: 0.74rem;
  color: var(--accent-cyan);
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
  align-self: flex-start;
  animation: msg-in 0.3s ease;
}
.typing-dots {
  display: flex;
  gap: 5px;
  padding: 13px 17px;
  background: rgba(13,28,58,0.85);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  border-bottom-left-radius: 5px;
}
.typing-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent-cyan);
  opacity: 0.4;
  animation: bounce 1.2s ease infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
  0%,100% { opacity: 0.4; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-5px); }
}

/* Chat Input */
.chat-input-area {
  padding: 14px 28px 18px;
  background: rgba(7,13,26,0.7);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.recording-indicator {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  background: rgba(239,68,68,0.10);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: var(--radius-pill);
  color: #fca5a5;
  font-size: 0.81rem;
  margin-bottom: 10px;
}
.recording-indicator.show { display: flex; }
.rec-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #ef4444;
  animation: rec-blink 1s ease infinite;
  flex-shrink: 0;
}
@keyframes rec-blink { 0%,100%{opacity:1} 50%{opacity:0.2} }

.chat-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: rgba(13,28,58,0.6);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 10px 12px;
  transition: var(--transition);
}
.chat-input-wrap:focus-within {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0,212,255,0.10), var(--glow-cyan);
}
.chat-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.93rem;
  line-height: 1.5;
  resize: none;
  max-height: 140px;
  min-height: 24px;
  padding: 2px 6px;
  align-self: center;
  scrollbar-width: none;
}
.chat-textarea::-webkit-scrollbar { display: none; }
.chat-textarea::placeholder { color: var(--text-muted); }
.input-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }

.mic-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: var(--transition);
  flex-shrink: 0;
}
.mic-btn:hover {
  background: rgba(0,212,255,0.1);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}
.mic-btn.recording {
  background: rgba(239,68,68,0.15);
  border-color: #ef4444;
  color: #ef4444;
  animation: mic-pulse 1s ease infinite;
}
@keyframes mic-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(239,68,68,0); }
}

.send-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a73e8, #00d4ff);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  transition: var(--transition);
  flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(0,212,255,0.3);
}
.send-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 20px rgba(0,212,255,0.5);
}
.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}
.input-hint {
  text-align: center;
  font-size: 0.71rem;
  color: var(--text-muted);
  margin-top: 8px;
  letter-spacing: 0.3px;
}
.input-hint kbd {
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: monospace;
  font-size: 0.68rem;
}

/* Logout modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(5px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal-card {
  width: 100%;
  max-width: 360px;
  padding: 32px;
  text-align: center;
}
.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
  font-family: var(--font-heading);
  letter-spacing: 1px;
}
.modal-desc {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 24px;
  line-height: 1.6;
}
.modal-actions { display: flex; gap: 12px; justify-content: center; }

/* Toast */
.toast-container {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  padding: 13px 20px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  backdrop-filter: blur(20px);
  pointer-events: auto;
  animation: toast-in 0.3s ease;
  max-width: 340px;
}
@keyframes toast-in { from{opacity:0;transform:translateX(20px)} to{opacity:1;transform:translateX(0)} }
.toast-success { background: rgba(0,230,118,0.15); border: 1px solid rgba(0,230,118,0.3); color: #86efac; }
.toast-error   { background: rgba(239,68,68,0.15);  border: 1px solid rgba(239,68,68,0.3);  color: #fca5a5; }
.toast-info    { background: rgba(0,212,255,0.12);   border: 1px solid rgba(0,212,255,0.25);  color: var(--accent-cyan); }

/* Settings gear button in sidebar user section */
.settings-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
  margin-left: auto;
}
.settings-btn:hover {
  background: rgba(0,212,255,0.1);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  transform: rotate(45deg);
}

/* Settings Modal */
.settings-card {
  width: 100%;
  max-width: 420px;
  padding: 0;
  overflow: hidden;
  animation: cardIn 0.3s cubic-bezier(0.34,1.56,0.64,1) both;
}
.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--border-subtle);
}
.settings-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 1px;
}
.settings-close {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.settings-close:hover {
  background: rgba(239,68,68,0.12);
  border-color: rgba(239,68,68,0.3);
  color: #fca5a5;
}
.settings-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 16px;
  gap: 4px;
}
.settings-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 13px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.3px;
  margin-bottom: -1px;
}
.settings-tab:hover { color: var(--text-primary); }
.settings-tab.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
}
.settings-panel {
  display: none;
  padding: 22px 24px 26px;
}
.settings-panel.active { display: block; }
.settings-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Scrollbar global */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--border); }

/* ═══════════════════════════════════════════════════════════════════
   CHAT — Mobile menu button & sidebar drawer
   ═══════════════════════════════════════════════════════════════════ */
.chat-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.chat-menu-btn:hover {
  background: rgba(0,212,255,0.1);
  border-color: rgba(0,212,255,0.35);
  color: var(--accent-cyan);
}
.chat-menu-btn:active { transform: scale(0.95); }

.sidebar-close-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-left: auto;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}
.sidebar-close-btn:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 14, 0.78);
  z-index: 998 !important;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.sidebar-overlay.show {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 768px) {
  .landing-hero { flex-direction: column; padding: 40px 24px; gap: 36px; }
  .hero-visual { display: none; }
  .landing-nav { padding: 0 20px; }
  .features-strip { padding: 0 20px 60px; }
  .chat-messages { padding: 16px; }
  .chat-input-area { padding: 10px 14px 14px; }
  .form-row { grid-template-columns: 1fr; }
  .auth-card { padding: 28px 24px; }

  /* Show mobile menu button in chat header */
  .chat-menu-btn { display: flex; margin-right: 4px; }
  .sidebar-close-btn { display: flex; }

  /* On mobile, chat-app takes full width (no sidebar column) */
  .chat-app {
    margin-left: 0;
  }

  /* Sidebar becomes a slide-in drawer */
  .sidebar {
    width: min(86vw, 320px) !important;
    transform: translateX(-105%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2147483646 !important;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.5);
    border-right: 1px solid var(--border);
    /* Fully opaque on mobile to prevent iOS Safari compositing blur */
    background: #070d1a !important;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    pointer-events: auto;
  }
  .sidebar.sidebar-open {
    transform: translateX(0);
  }
  .sidebar * { pointer-events: auto; }

  /* Lock body scroll when drawer open */
  body.drawer-open { overflow: hidden; }

  /* Chat header: give a little more space on the left for burger */
  .chat-header { gap: 8px; }
  .chat-header-bot { min-width: 0; flex: 1; }

  /* Sidebar is position:fixed → out of flow → chat-main naturally takes full width.
     Keep chat-app as flex row (desktop default) so chat-main height resolves. */
  .chat-main { min-width: 0; }
}

@media (max-width: 768px) {
  /* Make sure header stays single-line and shrinks the bot info if needed */
  .chat-header { gap: 6px !important; padding: 10px 12px; overflow: hidden; }
  .chat-header > * { flex-shrink: 0; }
  .chat-header-bot { min-width: 0; flex: 1 1 auto; overflow: hidden; gap: 8px; }
  .chat-header-bot .chat-bot-name { font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* Compact action buttons */
  .header-action-btn { width: 32px; height: 32px; }
  .chat-menu-btn { width: 36px; height: 36px; margin-right: 0; }

  /* Persona becomes icon-only — show just the leading emoji */
  .persona-select {
    width: 50px;
    padding: 7px 22px 7px 10px;
    font-size: 0.88rem;
    text-indent: -9999px;
    color: transparent;
    background-image:
      url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23aaa' stroke-width='2'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
    background-position: right 6px center;
  }
  /* Show a single emoji glyph centered using ::before of the wrapper */
  .persona-select-wrap::before {
    content: '🤖';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    pointer-events: none;
    z-index: 1;
  }
  .persona-select-wrap[data-current="formal"]::before    { content: '🎩'; }
  .persona-select-wrap[data-current="casual"]::before    { content: '😎'; }
  .persona-select-wrap[data-current="teacher"]::before   { content: '🎓'; }
  .persona-select-wrap[data-current="dev"]::before       { content: '💻'; }
  .persona-select-wrap[data-current="poet"]::before      { content: '🎭'; }
  .persona-select-wrap[data-current="scientist"]::before { content: '🔬'; }
}

@media (max-width: 560px) {
  .chat-header-bot .chat-bot-status { display: none; }
  .chat-header-bot .chat-bot-name { font-size: 0.88rem; }
  .chat-bot-avatar { transform: scale(0.85); margin-right: -2px; }

  /* Messages slightly tighter */
  .msg-avatar { width: 34px; height: 34px; font-size: 0.78rem; }
  .msg-bubble { font-size: 0.92rem; padding: 12px 14px; }

  /* Input hint: shorter text */
  .input-hint kbd { display: none; }
  .input-hint { font-size: 0.7rem; }

  /* Chat input prevent iOS zoom on focus */
  .chat-textarea { font-size: 16px; }
}

/* Very small phones — drop the persona entirely (still accessible via Settings) */
@media (max-width: 430px) {
  .persona-select-wrap { display: none; }
  .chat-header-bot .chat-bot-name { font-size: 0.84rem; }
}

@media (max-width: 480px) {
  .auth-card { padding: 24px 18px; }
  .auth-title { font-size: 1.2rem; }
}

/* ═══════════════════════════════════════════════════════════════════
   LANDING V2 — Modern landing with central chat bar
   ═══════════════════════════════════════════════════════════════════ */

body.landing-v2 {
  min-height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ── Nav V2 ──────────────────────────────────────────────────────── */
.nav-v2 {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 48px;
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  background: transparent;
  border-bottom: 1px solid transparent;
}
.nav-v2-scrolled {
  background: rgba(7, 13, 26, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 48px;
}
.nav-v2-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}
.nav-v2-robot {
  filter: drop-shadow(0 0 10px rgba(0,212,255,0.6));
}
.nav-v2-name {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 1.05rem;
  letter-spacing: 3px;
  background: linear-gradient(135deg, #00d4ff 0%, #1a73e8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.nav-v2-links {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-v2-link {
  position: relative;
  padding: 8px 16px;
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius-pill);
  transition: var(--transition);
}
.nav-v2-link:hover { color: var(--text-primary); background: rgba(255,255,255,0.06); }
.nav-v2-link.active {
  color: var(--accent-cyan);
  background: rgba(0,212,255,0.08);
}
.nav-v2-link.active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(0,212,255,0.6);
}
.nav-v2-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-v2-burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.nav-v2-burger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: var(--transition);
}

/* ── Hero V2 ─────────────────────────────────────────────────────── */
.hero-v2 {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 120px 24px 60px;
  z-index: 1;
  overflow: hidden;
}
.hero-v2-inner {
  position: relative;
  z-index: 2;
  max-width: 960px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}
.hero-v2-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(0,212,255,0.08);
  border: 1px solid rgba(0,212,255,0.25);
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--accent-cyan);
}
.hero-v2-badge-dot {
  width: 6px;
  height: 6px;
  background: #00e676;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(0,230,118,0.8);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.2); }
}
.hero-v2-title {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: clamp(2rem, 5vw, 3.6rem);
  line-height: 1.1;
  letter-spacing: -1px;
  margin: 0;
  color: var(--text-primary);
}
.hero-v2-title-grad {
  background: linear-gradient(135deg, #00d4ff 0%, #1a73e8 50%, #f4a623 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}
.hero-v2-sub {
  max-width: 640px;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0;
}

/* ── Central Chat Bar ────────────────────────────────────────────── */
.hero-chatbar {
  width: 100%;
  max-width: 720px;
  margin-top: 8px;
}
.hero-chatbar-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 20px;
  background: rgba(13, 28, 58, 0.75);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  box-shadow: 0 12px 48px rgba(0,0,0,0.4), 0 0 40px rgba(0,212,255,0.12), inset 0 1px 0 rgba(255,255,255,0.06);
  transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
}
.hero-chatbar-inner:focus-within {
  border-color: var(--accent-cyan);
  box-shadow: 0 12px 48px rgba(0,0,0,0.4), 0 0 60px rgba(0,212,255,0.25), inset 0 1px 0 rgba(255,255,255,0.06);
  transform: translateY(-2px);
}
.hero-chatbar-icon {
  color: var(--accent-cyan);
  flex-shrink: 0;
}
.hero-chatbar-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 10px 0;
  min-width: 0;
}
.hero-chatbar-input::placeholder { color: var(--text-muted); }
.hero-chatbar-send {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  background: linear-gradient(135deg, #f4a623, #ff6f00);
  color: white;
  border: none;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 18px rgba(244,166,35,0.35);
  flex-shrink: 0;
}
.hero-chatbar-send:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: 0 8px 26px rgba(244,166,35,0.5);
}
.hero-chatbar-send:active { transform: translateY(0); }
.hero-chatbar-hint {
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
}
.hero-chatbar-hint kbd {
  display: inline-block;
  padding: 1px 6px;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* ── Suggestion Chips ────────────────────────────────────────────── */
.hero-v2-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
  max-width: 720px;
}
.hero-v2-chip {
  padding: 8px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-body);
}
.hero-v2-chip:hover {
  background: rgba(0,212,255,0.08);
  border-color: rgba(0,212,255,0.4);
  color: var(--text-primary);
  transform: translateY(-1px);
}

/* ── Stats Row ───────────────────────────────────────────────────── */
.hero-v2-stats {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-top: 10px;
}
.hero-v2-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.hero-v2-stat-val {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--accent-cyan);
  letter-spacing: 1px;
}
.hero-v2-stat-lab {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.hero-v2-stat-sep {
  width: 1px;
  height: 28px;
  background: var(--border-subtle);
}

/* ── Orbit decorations ───────────────────────────────────────────── */
.hero-v2-orbit {
  position: absolute;
  border-radius: 50%;
  border: 1px dashed rgba(0,212,255,0.12);
  pointer-events: none;
  z-index: 1;
}
.hero-v2-orbit-1 {
  width: 680px;
  height: 680px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: slowSpin 80s linear infinite;
}
.hero-v2-orbit-2 {
  width: 1000px;
  height: 1000px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: slowSpin 120s linear infinite reverse;
  border-color: rgba(26,115,232,0.10);
}
@keyframes slowSpin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to   { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ═══════════════════════════════════════════════════════════════════
   SECTIONS — shared heading styles
   ═══════════════════════════════════════════════════════════════════ */
.section-head {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 48px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}
.section-eyebrow {
  display: inline-block;
  padding: 5px 12px;
  background: rgba(0,212,255,0.08);
  border: 1px solid rgba(0,212,255,0.22);
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--accent-cyan);
  text-transform: uppercase;
}
.section-title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: clamp(1.6rem, 3.6vw, 2.6rem);
  line-height: 1.2;
  color: var(--text-primary);
  margin: 0;
}
.section-title-grad {
  background: linear-gradient(135deg, #00d4ff 0%, #f4a623 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.section-sub {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0;
}

/* ═══════════════════════════════════════════════════════════════════
   FEATURES V2
   ═══════════════════════════════════════════════════════════════════ */
.features-v2 {
  position: relative;
  z-index: 1;
  padding: 80px 48px;
  max-width: 1200px;
  margin: 0 auto;
}
.features-v2-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}
.feature-v2-card {
  padding: 28px 24px;
  text-align: left;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.feature-v2-card:hover {
  transform: translateY(-4px);
  border-color: rgba(0,212,255,0.35);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 0 40px rgba(0,212,255,0.1);
}
.feature-v2-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.feature-v2-icon-cyan  { background: rgba(0,212,255,0.12);  border: 1px solid rgba(0,212,255,0.3); }
.feature-v2-icon-blue  { background: rgba(26,115,232,0.12); border: 1px solid rgba(26,115,232,0.3); }
.feature-v2-icon-orange{ background: rgba(244,166,35,0.12); border: 1px solid rgba(244,166,35,0.3); }
.feature-v2-icon-green { background: rgba(0,230,118,0.12);  border: 1px solid rgba(0,230,118,0.3); }
.feature-v2-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-primary);
  margin: 0;
}
.feature-v2-desc {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 0;
}

/* ═══════════════════════════════════════════════════════════════════
   ABOUT V2
   ═══════════════════════════════════════════════════════════════════ */
.about-v2 {
  position: relative;
  z-index: 1;
  padding: 80px 48px;
  max-width: 1200px;
  margin: 0 auto;
}
.about-v2-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px;
  padding: 0;
  overflow: hidden;
  margin: 0 auto 56px;
  max-width: 960px;
  background: rgba(0,212,255,0.08);
}
.about-v2-meta-item {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg-card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}
.about-v2-meta-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.about-v2-meta-value {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.3px;
}

/* Team */
.team-head {
  text-align: center;
  margin-bottom: 28px;
}
.team-title {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 6px;
  letter-spacing: 1px;
}
.team-sub {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0;
}
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  max-width: 1000px;
  margin: 0 auto;
}
.team-card {
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  transition: var(--transition);
}
.team-card:hover {
  transform: translateY(-4px);
  border-color: rgba(0,212,255,0.4);
  box-shadow: 0 14px 40px rgba(0,0,0,0.5), 0 0 40px rgba(0,212,255,0.15);
}
.team-avatar {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a73e8, #00d4ff);
  color: white;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: 1px;
  box-shadow: 0 8px 24px rgba(0,212,255,0.35), inset 0 1px 0 rgba(255,255,255,0.2);
  position: relative;
}
.team-avatar::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1px dashed rgba(0,212,255,0.4);
  animation: slowSpin 20s linear infinite;
}
.team-card:nth-child(2) .team-avatar { background: linear-gradient(135deg, #f4a623, #ff6f00); box-shadow: 0 8px 24px rgba(244,166,35,0.35), inset 0 1px 0 rgba(255,255,255,0.2); }
.team-card:nth-child(3) .team-avatar { background: linear-gradient(135deg, #00e676, #00bfa5); box-shadow: 0 8px 24px rgba(0,230,118,0.35), inset 0 1px 0 rgba(255,255,255,0.2); }
.team-card:nth-child(4) .team-avatar { background: linear-gradient(135deg, #d946ef, #8b5cf6); box-shadow: 0 8px 24px rgba(217,70,239,0.35), inset 0 1px 0 rgba(255,255,255,0.2); }

/* Photo avatars: actual headshot images instead of initials */
.team-avatar-photo {
  background: #0d1b35 !important;
  padding: 0;
  overflow: hidden;
  border: 2px solid rgba(0, 212, 255, 0.5);
}
.team-avatar-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}
/* Per-card glow color preserved on the image cards */
.team-card:nth-child(1) .team-avatar-photo { border-color: rgba(0, 212, 255, 0.6); }
.team-card:nth-child(2) .team-avatar-photo { border-color: rgba(244, 166, 35, 0.6); }
.team-card:nth-child(3) .team-avatar-photo { border-color: rgba(0, 230, 118, 0.6); }
.team-card:nth-child(4) .team-avatar-photo { border-color: rgba(217, 70, 239, 0.6); }
.team-name {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}
.team-role {
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--accent-cyan);
}

/* ═══════════════════════════════════════════════════════════════════
   FOOTER V2
   ═══════════════════════════════════════════════════════════════════ */
.footer-v2 {
  position: relative;
  z-index: 1;
  padding: 48px 48px 24px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 40px;
}
.footer-v2-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-subtle);
}
.footer-v2-left { display: flex; flex-direction: column; gap: 8px; }
.footer-v2-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 0.95rem;
  letter-spacing: 3px;
  color: var(--text-primary);
}
.footer-v2-tag {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}
.footer-v2-right { display: flex; gap: 24px; }
.footer-v2-link {
  font-size: 0.88rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
}
.footer-v2-link:hover { color: var(--accent-cyan); }
.footer-v2-bottom {
  max-width: 1200px;
  margin: 0 auto;
  padding-top: 20px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════════
   AUTH MODAL
   ═══════════════════════════════════════════════════════════════════ */
.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(5, 10, 22, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.auth-modal.show { display: flex; opacity: 1; }
.auth-modal-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 32px 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: modalPop 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes modalPop {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.auth-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}
.auth-modal-close:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); }
.auth-modal-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}
.auth-modal-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: 1px;
}
.auth-modal-sub {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0;
}
.auth-modal-alert {
  display: none;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}
.auth-modal-alert.show { display: block; }
.auth-modal-alert.alert-error {
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.3);
  color: #fca5a5;
}
.auth-modal-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-modal-foot {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 4px;
  padding-top: 18px;
}
.auth-modal-foot a {
  color: var(--accent-cyan);
  text-decoration: none;
  font-weight: 600;
}
.auth-modal-foot a:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE V2
   ═══════════════════════════════════════════════════════════════════ */
/* ═══════════════════════════════════════════════════════════════════
   SPA PAGE VISIBILITY
   ═══════════════════════════════════════════════════════════════════ */
.page[hidden] { display: none !important; }
.page {
  animation: pageEnter 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes pageEnter {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
/* Ensure Features + About feel like full pages */
#features.page, #about.page {
  min-height: calc(100vh - 120px);
}

/* Mobile-only CTAs inside burger dropdown (hidden on desktop) */
.nav-v2-mobile-ctas { display: none !important; }

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE V2
   ═══════════════════════════════════════════════════════════════════ */

/* ── Tablet / smaller-desktop ──────────────────────────────────── */
@media (max-width: 900px) {
  body.mobile-menu-open { overflow: hidden; }

  .nav-v2 { padding: 14px 18px; }
  .nav-v2-scrolled { padding: 10px 18px; }

  /* Fullscreen mobile menu */
  .nav-v2-links {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(5, 10, 22, 0.98);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: none;
    border-radius: 0;
    padding: 82px 24px 32px;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    margin: 0;
    box-shadow: none;
    z-index: 95;
    overflow-y: auto;
  }
  .nav-v2-links.open { display: flex; }
  .nav-v2-links li { list-style: none; }
  .nav-v2-link {
    text-align: left;
    padding: 18px 18px;
    font-size: 1.1rem;
    font-weight: 600;
    display: block;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
  }
  .nav-v2-link.active {
    border-color: rgba(0,212,255,0.3);
    background: rgba(0,212,255,0.08);
  }
  .nav-v2-link.active::after { display: none; }

  .nav-v2-mobile-ctas {
    display: flex !important;
    gap: 10px;
    padding: 18px 0 0;
    margin-top: 12px;
    border-top: 1px solid var(--border-subtle);
    list-style: none !important;
  }
  .nav-v2-mobile-ctas .btn {
    flex: 1;
    padding: 14px 16px;
    font-size: 0.95rem;
    justify-content: center;
  }

  .nav-v2-actions { display: none; }

  .nav-v2-burger {
    display: flex;
    position: relative;
    z-index: 120;
    padding: 10px;
  }
  .nav-v2-burger[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  .nav-v2-burger[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
  }
  .nav-v2-burger[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  /* Sections */
  .hero-v2 { padding: 96px 20px 40px; }
  .hero-v2-chips { gap: 6px; }
  .hero-v2-chip { font-size: 0.78rem; padding: 7px 12px; }
  .hero-v2-stats { gap: 16px; }
  .hero-v2-stat-val { font-size: 1.15rem; }

  .features-v2 { padding: 110px 20px 60px; }
  .about-v2 { padding: 110px 20px 60px; }
  .footer-v2 { padding: 36px 20px 20px; }
  .footer-v2-inner { flex-direction: column; align-items: flex-start; gap: 18px; }
}

/* ── Mobile (small) ────────────────────────────────────────────── */
@media (max-width: 560px) {
  .hero-v2-title { font-size: 1.75rem; line-height: 1.15; }
  .hero-v2-sub { font-size: 0.95rem; }
  .hero-v2-badge { font-size: 0.72rem; padding: 5px 12px; }
  .hero-v2-orbit-1, .hero-v2-orbit-2 { display: none; }

  .hero-chatbar-inner { padding: 6px 6px 6px 16px; }
  .hero-chatbar-input { font-size: 0.95rem; }
  .hero-chatbar-send { padding: 11px 14px; }
  .hero-chatbar-send span { display: none; }
  .hero-chatbar-hint { font-size: 0.72rem; }

  .hero-v2-stats { gap: 14px; }
  .hero-v2-stat-sep { height: 22px; }
  .hero-v2-stat-val { font-size: 1rem; }
  .hero-v2-stat-lab { font-size: 0.65rem; letter-spacing: 1px; }

  .section-title { font-size: 1.45rem; }
  .section-sub { font-size: 0.9rem; }

  .features-v2-grid { gap: 14px; }
  .feature-v2-card { padding: 22px 18px; }
  .feature-v2-icon { width: 42px; height: 42px; font-size: 1.3rem; }

  .about-v2-meta { grid-template-columns: 1fr 1fr; }
  .about-v2-meta-item { padding: 16px 18px; }
  .team-grid { gap: 14px; }
  .team-card { padding: 22px 16px; }
  .team-avatar { width: 60px; height: 60px; font-size: 1.1rem; }

  /* Auth modal on small phones */
  .auth-modal {
    padding: 0;
    align-items: flex-end;
  }
  .auth-modal-card {
    max-width: 100%;
    border-radius: 22px 22px 0 0;
    padding: 28px 22px 22px;
    animation: modalSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  @keyframes modalSlideUp {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
  }
  .auth-modal-close {
    top: 10px;
    right: 10px;
  }
  .auth-modal-title { font-size: 1.15rem; }
  .auth-modal-sub { font-size: 0.82rem; }
  .input-field { font-size: 16px; } /* prevents iOS zoom on focus */
}

/* ── Very small phones ─────────────────────────────────────────── */
/* ═══════════════════════════════════════════════════════════════════
   CHAT — Attachment button + chip + PDF card
   ═══════════════════════════════════════════════════════════════════ */
.attach-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.attach-btn:hover {
  background: rgba(0, 212, 255, 0.1);
  border-color: rgba(0, 212, 255, 0.4);
  color: var(--accent-cyan);
  transform: translateY(-1px);
}
.attach-btn:active { transform: scale(0.95); }

.attachment-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 12px;
  margin-bottom: 8px;
  background: rgba(0, 212, 255, 0.08);
  border: 1px solid rgba(0, 212, 255, 0.3);
  border-radius: 12px;
  animation: chipIn 0.25s ease-out;
}
@keyframes chipIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.attachment-chip[hidden] { display: none; }
.attachment-chip-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 212, 255, 0.15);
  border-radius: 8px;
  color: var(--accent-cyan);
  flex-shrink: 0;
}
.attachment-chip-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.attachment-chip-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.attachment-chip-size {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.attachment-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.attachment-chip-remove:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

/* Attachment shown inside a user's message bubble */
.msg-attachment {
  margin-bottom: 10px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.25);
}
.msg-attachment img {
  display: block;
  max-width: 100%;
  max-height: 320px;
  object-fit: contain;
  background: rgba(0,0,0,0.3);
}
.msg-attachment-meta {
  padding: 6px 10px;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.7);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.msg-file-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}
.msg-file-chip-icon {
  font-size: 1.3rem;
}
.msg-file-chip-info { flex: 1; min-width: 0; }
.msg-file-chip-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-file-chip-size {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.7);
}

/* PDF download card in bot bubble */
.msg-pdf-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(244, 166, 35, 0.14), rgba(244, 166, 35, 0.04));
  border: 1px solid rgba(244, 166, 35, 0.35);
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition);
}
.msg-pdf-card:hover {
  transform: translateY(-1px);
  border-color: rgba(244, 166, 35, 0.6);
  box-shadow: 0 6px 20px rgba(244, 166, 35, 0.18);
}
.msg-pdf-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f4a623, #ff6f00);
  border-radius: 10px;
  color: #fff;
  flex-shrink: 0;
}
.msg-pdf-info { flex: 1; min-width: 0; }
.msg-pdf-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-pdf-hint {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.65);
  margin-top: 2px;
}
.msg-pdf-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.msg-pdf-download:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

@media (max-width: 380px) {
  .nav-v2 { padding: 12px 14px; }
  .nav-v2-name { font-size: 0.92rem; letter-spacing: 2px; }
  .hero-v2-title { font-size: 1.55rem; }
  .hero-v2-chips { padding: 0 6px; }
  .hero-chatbar-send { padding: 10px 12px; }
}

/* ═══════════════════════════════════════════════════════════════════
   TOOLS MODAL (Notebook, YouTube, Image-edit, Workflows)
   ═══════════════════════════════════════════════════════════════════ */
.tools-card {
  width: 100%;
  max-width: 620px;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 85vh;
}
.tools-card .settings-panel {
  padding: 18px 22px;
  overflow-y: auto;
}
.tools-intro {
  font-size: 0.86rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
  line-height: 1.55;
}
.tools-section-label {
  font-family: var(--font-heading);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 18px 0 8px;
}
.tools-active-binding {
  padding: 12px 14px;
  background: rgba(0, 212, 255, 0.08);
  border: 1px solid rgba(0, 212, 255, 0.3);
  border-radius: 10px;
  margin-bottom: 14px;
  font-size: 0.86rem;
}
.tools-result {
  margin-top: 12px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
}

/* Documents list */
.documents-list { display: flex; flex-direction: column; gap: 8px; }
.doc-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
}
.doc-item-info { flex: 1; min-width: 0; }
.doc-item-name { font-weight: 600; font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-item-meta { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }
.doc-item-actions { display: flex; gap: 6px; flex-shrink: 0; }
.doc-item-actions .btn { padding: 6px 10px; font-size: 0.74rem; }

/* Image edit preview */
.img-edit-row { display: flex; gap: 10px; align-items: stretch; }
.img-edit-preview {
  flex: 1;
  height: 120px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px dashed var(--border-subtle);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.img-edit-preview img { width: 100%; height: 100%; object-fit: cover; }

/* Workflow editor */
.wf-step {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}
.wf-step-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 212, 255, 0.15);
  color: var(--accent-cyan);
  border-radius: 50%;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.78rem;
}
.wf-step textarea {
  flex: 1;
  resize: vertical;
  min-height: 50px;
  font-size: 0.85rem;
  font-family: var(--font-body);
  padding-left: 12px !important;
}
.wf-step .btn { flex-shrink: 0; }

.workflow-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  margin-bottom: 6px;
}

/* ═══════════════════════════════════════════════════════════════════
   TAGS / FOLDERS on sessions
   ═══════════════════════════════════════════════════════════════════ */
.tag-filter-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 14px 8px;
}
.tag-filter-wrap:empty { display: none; }
.tag-chip {
  padding: 3px 9px;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: var(--transition);
  --tc: var(--accent-cyan);
}
.tag-chip:hover { background: rgba(255, 255, 255, 0.1); color: var(--text-primary); }
.tag-chip.active {
  background: var(--tc);
  color: #0d1b35;
  border-color: var(--tc);
}
.history-item-tag {
  display: inline-block;
  padding: 1px 7px;
  margin-right: 6px;
  background: color-mix(in srgb, var(--tc) 18%, transparent);
  color: var(--tc);
  border: 1px solid color-mix(in srgb, var(--tc) 35%, transparent);
  border-radius: 100px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  --tc: var(--accent-cyan);
  white-space: nowrap;
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-tag-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 4px;
  opacity: 0;
  transition: opacity 0.2s;
  font-size: 0.78rem;
}
.history-item:hover .history-tag-btn { opacity: 1; }
.history-tag-btn:hover { color: var(--accent-cyan); }

/* ═══════════════════════════════════════════════════════════════════
   UI DENSITY toggle (Compact mode)
   ═══════════════════════════════════════════════════════════════════ */
.display-option {
  padding: 8px 0;
}
.display-option-label {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.86rem;
  margin-bottom: 10px;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}
.display-option-toggle {
  display: flex;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 4px;
}
.density-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  background: transparent;
  border: none;
  border-radius: 7px;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.density-btn:hover { color: var(--text-primary); }
.density-btn.active {
  background: rgba(0, 212, 255, 0.12);
  color: var(--accent-cyan);
  box-shadow: inset 0 0 0 1px rgba(0, 212, 255, 0.3);
}
.display-option-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 8px;
}

/* Compact density rules */
body[data-density="compact"] .msg-bubble { padding: 9px 13px; font-size: 0.86rem; line-height: 1.5; }
body[data-density="compact"] .chat-messages { padding: 12px 18px; gap: 10px !important; }
body[data-density="compact"] #messagesArea { gap: 10px !important; }
body[data-density="compact"] .msg-avatar { width: 30px; height: 30px; font-size: 0.7rem; }
body[data-density="compact"] .chat-input-area { padding: 8px 18px 12px; }
body[data-density="compact"] .chat-header { padding: 8px 18px; }
body[data-density="compact"] .history-item { padding: 6px 12px; font-size: 0.82rem; }
body[data-density="compact"] .sidebar-user { padding: 8px 14px; }
body[data-density="compact"] .new-chat-btn { padding: 8px 12px; font-size: 0.84rem; }
body[data-density="compact"] .input-hint { font-size: 0.7rem; padding-top: 6px; }
body[data-density="compact"] .welcome-screen { padding: 20px 16px; }
body[data-density="compact"] .welcome-title { font-size: 1.2rem; }
body[data-density="compact"] .welcome-sub { font-size: 0.86rem; }
body[data-density="compact"] .quick-prompt { padding: 8px 14px; font-size: 0.8rem; }

/* ═══════════════════════════════════════════════════════════════════
   AVATAR PREVIEW IN SETTINGS + CROP MODAL
   ═══════════════════════════════════════════════════════════════════ */
.avatar-section {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.avatar-section-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.avatar-section-row {
  display: flex;
  align-items: center;
  gap: 16px;
}
.avatar-preview {
  width: 76px;
  height: 76px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a73e8, #00d4ff);
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: 1px;
  border: 2px solid rgba(0, 212, 255, 0.4);
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(0, 212, 255, 0.3);
}
.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.avatar-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.avatar-controls .btn {
  padding: 8px 14px;
  font-size: 0.82rem;
}
.avatar-hint {
  width: 100%;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* User avatars elsewhere: when a photo is set, the container should have no
   background gradient bleeding through the rounded image edges. */
.user-avatar.has-photo,
.header-user-avatar.has-photo,
.msg-avatar.user-av.has-photo {
  background: #0d1b35;
  padding: 0;
  overflow: hidden;
}
.user-avatar img,
.header-user-avatar img,
.msg-avatar.user-av img {
  border-radius: 50%;
}

/* Crop modal */
.crop-card {
  width: 100%;
  max-width: 560px;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.crop-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: rgba(0, 0, 0, 0.25);
}
.crop-canvas-wrap {
  width: 100%;
  height: 360px;
  background: #050a16;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}
.crop-canvas-wrap img {
  display: block;
  max-width: 100%;
  max-height: 360px;
}
.crop-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
.crop-tool-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}
.crop-tool-btn:hover {
  background: rgba(0, 212, 255, 0.12);
  border-color: rgba(0, 212, 255, 0.4);
  color: var(--accent-cyan);
}
.crop-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--border-subtle);
}
@media (max-width: 560px) {
  .crop-canvas-wrap { height: 280px; }
  .crop-card { max-width: 100%; }
}

/* Make Cropper.js view box match our cyan theme */
.cropper-view-box,
.cropper-face {
  border-radius: 50% !important;
}
.cropper-view-box {
  outline: 2px solid var(--accent-cyan);
  outline-color: var(--accent-cyan);
}
.cropper-line, .cropper-point {
  background-color: var(--accent-cyan);
}

/* ═══════════════════════════════════════════════════════════════════
   LIGHT THEME
   ═══════════════════════════════════════════════════════════════════ */
body[data-theme="light"] {
  --bg-primary: #f4f7fb;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-sidebar: rgba(247, 250, 253, 0.95);
  --text-primary: #0d1b35;
  --text-muted: rgba(13, 27, 53, 0.55);
  --text-secondary: rgba(13, 27, 53, 0.80);
  --border: rgba(26, 115, 232, 0.22);
  --border-subtle: rgba(13, 27, 53, 0.08);
}
body[data-theme="light"] .stars-canvas {
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(26, 115, 232, 0.08) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(0, 212, 255, 0.05) 0%, transparent 60%),
    linear-gradient(160deg, #eef3fa 0%, #f4f7fb 50%, #eaf1f9 100%);
}
body[data-theme="light"] .stars-canvas::before,
body[data-theme="light"] .stars-canvas::after { opacity: 0.25; }
body[data-theme="light"] .user-msg .msg-bubble {
  background: linear-gradient(135deg, #1a73e8, #0d52b5);
  color: #fff;
}
body[data-theme="light"] .bot-msg .msg-bubble {
  background: #ffffff;
  border: 1px solid rgba(13, 27, 53, 0.1);
  color: #0d1b35;
  box-shadow: 0 2px 12px rgba(13, 27, 53, 0.05);
}
body[data-theme="light"] .bot-msg .msg-bubble strong { color: #0d1b35; }
body[data-theme="light"] .bot-msg .msg-bubble .md-h { color: #0d1b35; }
body[data-theme="light"] .bot-msg .msg-bubble h2.md-h { color: #1a73e8; }
body[data-theme="light"] .bot-msg .msg-bubble em { color: #0d1b35; }
body[data-theme="light"] .bot-msg .msg-bubble a { color: #1a73e8; }
body[data-theme="light"] .bot-msg .msg-bubble .md-ic {
  background: rgba(26, 115, 232, 0.08);
  border-color: rgba(26, 115, 232, 0.2);
  color: #0d52b5;
}
body[data-theme="light"] .bot-msg .msg-bubble .md-pre {
  background: #f7f9fc;
  border-color: rgba(13, 27, 53, 0.1);
  border-left-color: #1a73e8;
}
body[data-theme="light"] .bot-msg .msg-bubble .md-pre code { color: #0d1b35; }
body[data-theme="light"] .sidebar { background: #ffffff !important; border-right-color: rgba(13, 27, 53, 0.08); }
body[data-theme="light"] .chat-header { background: #ffffff; border-bottom-color: rgba(13, 27, 53, 0.08); }
body[data-theme="light"] .chat-input-area { background: #f7f9fc; border-top-color: rgba(13, 27, 53, 0.08); }
body[data-theme="light"] .chat-textarea { color: #0d1b35; }
body[data-theme="light"] .chat-textarea::placeholder { color: rgba(13, 27, 53, 0.45); }
body[data-theme="light"] .history-item { color: #0d1b35; }
body[data-theme="light"] .history-item:hover { background: rgba(26, 115, 232, 0.06); }
body[data-theme="light"] .history-item.active { background: rgba(26, 115, 232, 0.1); }
body[data-theme="light"] .input-field { background: #ffffff; color: #0d1b35; border-color: rgba(13, 27, 53, 0.12); }
body[data-theme="light"] .input-field::placeholder { color: rgba(13, 27, 53, 0.4); }
body[data-theme="light"] .nav-v2-scrolled { background: rgba(255, 255, 255, 0.85); }

/* ═══════════════════════════════════════════════════════════════════
   HEADER ACTIONS (theme toggle, export, persona)
   ═══════════════════════════════════════════════════════════════════ */
.header-action-wrap {
  position: relative;
}
.header-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.header-action-btn:hover {
  background: rgba(0, 212, 255, 0.1);
  border-color: rgba(0, 212, 255, 0.35);
  color: var(--accent-cyan);
}
.header-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 4px;
  min-width: 200px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.header-menu[hidden] { display: none; }
.header-menu-item {
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.88rem;
  text-align: left;
  padding: 10px 14px;
  border-radius: 7px;
  cursor: pointer;
  transition: var(--transition);
}
.header-menu-item:hover {
  background: rgba(0, 212, 255, 0.1);
  color: var(--accent-cyan);
}

.persona-select-wrap {
  position: relative;
}
.persona-select {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 8px 30px 8px 12px;
  cursor: pointer;
  transition: var(--transition);
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23aaa' stroke-width='2'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.persona-select:hover {
  background-color: rgba(0, 212, 255, 0.08);
  border-color: rgba(0, 212, 255, 0.3);
}
.persona-select:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.15);
}
.persona-select option {
  background: #0d1b35;
  color: #fff;
}

/* ═══════════════════════════════════════════════════════════════════
   SIDEBAR SEARCH
   ═══════════════════════════════════════════════════════════════════ */
.sidebar-search {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 14px;
  margin: 10px 0 8px;
}
.sidebar-search-icon {
  position: absolute;
  left: 26px;
  color: var(--text-muted);
  pointer-events: none;
}
.sidebar-search-input {
  width: 100%;
  padding: 8px 30px 8px 34px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  outline: none;
  transition: var(--transition);
}
.sidebar-search-input:focus {
  border-color: var(--accent-cyan);
  background: rgba(0, 212, 255, 0.05);
}
.sidebar-search-input::placeholder { color: var(--text-muted); }
.sidebar-search-clear {
  position: absolute;
  right: 22px;
  width: 20px;
  height: 20px;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sidebar-search-clear:hover { background: rgba(255, 255, 255, 0.15); color: #fff; }

/* ═══════════════════════════════════════════════════════════════════
   DRAG & DROP OVERLAY
   ═══════════════════════════════════════════════════════════════════ */
.drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(7, 13, 26, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 2.5px dashed rgba(0, 212, 255, 0.6);
  border-radius: 0;
  pointer-events: none;
}
.drop-overlay.show { display: flex; pointer-events: auto; }
.drop-overlay-inner {
  text-align: center;
  color: var(--accent-cyan);
  animation: dropPulse 1.2s ease-in-out infinite;
}
.drop-overlay-title {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  margin-top: 12px;
  letter-spacing: 1px;
  color: #fff;
}
.drop-overlay-sub {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-top: 6px;
}
@keyframes dropPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.04); opacity: 0.85; }
}

/* Multi-attachment chips container */
.attachment-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.attachment-chips:empty { display: none; }

/* ═══════════════════════════════════════════════════════════════════
   STOP BUTTON
   ═══════════════════════════════════════════════════════════════════ */
.stop-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #c62828, #ef5350);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(198, 40, 40, 0.35);
  transition: var(--transition);
  animation: stopPulse 1.4s ease-in-out infinite;
}
.stop-btn:not([hidden]) { display: inline-flex; }
.stop-btn[hidden] { display: none; }
.stop-btn:hover { transform: scale(1.05); }
@keyframes stopPulse {
  0%, 100% { box-shadow: 0 4px 12px rgba(198, 40, 40, 0.35); }
  50%      { box-shadow: 0 4px 24px rgba(239, 83, 80, 0.65); }
}

/* ═══════════════════════════════════════════════════════════════════
   MESSAGE ACTIONS (regenerate, edit, tts)
   ═══════════════════════════════════════════════════════════════════ */
.msg-action-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.72rem;
  padding: 3px 6px;
  border-radius: 4px;
  opacity: 0;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.message:hover .msg-action-btn { opacity: 1; }
.msg-action-btn:hover { color: var(--accent-cyan); background: rgba(0, 212, 255, 0.08); }
.msg-action-btn.active { color: var(--accent-cyan); }

/* Editing user message */
.msg-bubble[contenteditable="true"] {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
  cursor: text;
}

/* ═══════════════════════════════════════════════════════════════════
   MERMAID DIAGRAMS
   ═══════════════════════════════════════════════════════════════════ */
.mermaid-container {
  display: block;
  margin: 12px 0;
  padding: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  overflow-x: auto;
  text-align: center;
}
body[data-theme="light"] .mermaid-container {
  background: #fff;
  border-color: rgba(13, 27, 53, 0.1);
}
.mermaid-container svg { max-width: 100%; height: auto; }

/* ═══════════════════════════════════════════════════════════════════
   KATEX / MATH
   ═══════════════════════════════════════════════════════════════════ */
.katex-display { margin: 10px 0 !important; overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.bot-msg .msg-bubble .katex { color: inherit; }

/* ═══════════════════════════════════════════════════════════════════
   HIGHLIGHT.JS overrides
   ═══════════════════════════════════════════════════════════════════ */
.bot-msg .msg-bubble .md-pre code.hljs { background: transparent !important; padding: 0; }
.bot-msg .msg-bubble .md-pre { position: relative; }
.bot-msg .msg-bubble .md-pre[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 6px;
  right: 10px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--accent-cyan);
  opacity: 0.7;
}

/* ═══════════════════════════════════════════════════════════════════
   STREAMING / TYPING ANIMATION
   ═══════════════════════════════════════════════════════════════════ */
.msg-bubble.streaming::after {
  content: '▋';
  display: inline-block;
  margin-left: 2px;
  color: var(--accent-cyan);
  animation: cursorBlink 1s steps(2) infinite;
}
@keyframes cursorBlink {
  0%, 50%  { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* ═══════════════════════════════════════════════════════════════════
   LANGUAGE FLAG INDICATOR
   ═══════════════════════════════════════════════════════════════════ */
.msg-lang-flag {
  display: inline-block;
  padding: 1px 6px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  background: rgba(0, 212, 255, 0.1);
  border: 1px solid rgba(0, 212, 255, 0.25);
  border-radius: 4px;
  color: var(--accent-cyan);
  text-transform: uppercase;
  margin-right: 6px;
}
