/* ═══════════════════════════════════════════════════════════════════════════
   Minno AI — site.css
   Google Sans · Glassmorphism · Continuous Transitions · Dark/Light Themes
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Google Sans import fallback ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Google+Sans:wght@300;400;500;600;700&family=Google+Sans+Display:wght@400;500;700&family=Google+Sans+Mono&display=swap');

/* ── CSS Variables ────────────────────────────────────────────────────────── */
:root {
  /* Dark Theme (default) */
  --bg-base:          #0a0f1e;
  --bg-mid:           #0d1427;
  --bg-surface:       rgba(255,255,255,0.04);
  --bg-surface-hover: rgba(255,255,255,0.07);
  --glass-bg:         rgba(13,20,39,0.7);
  --glass-border:     rgba(255,255,255,0.08);
  --glass-shadow:     0 8px 32px rgba(0,0,0,0.4);
  --glass-inner:      rgba(255,255,255,0.04);

  --text-primary:   #f0f4ff;
  --text-secondary: #8b9fc8;
  --text-muted:     #4a5a7a;
  --text-accent:    #4f8bff;

  --accent:         #4f8bff;
  --accent-glow:    rgba(79,139,255,0.25);
  --accent-2:       #a78bfa;
  --accent-3:       #34d399;

  --orb-1:  rgba(79,139,255,0.15);
  --orb-2:  rgba(167,139,250,0.10);
  --orb-3:  rgba(52,211,153,0.08);

  --user-bubble:    rgba(79,139,255,0.18);
  --user-border:    rgba(79,139,255,0.35);
  --bot-bubble:     rgba(255,255,255,0.04);
  --bot-border:     rgba(255,255,255,0.08);

  --input-bg:      rgba(255,255,255,0.04);
  --input-border:  rgba(255,255,255,0.10);
  --input-focus:   rgba(79,139,255,0.4);

  --scrollbar-thumb: rgba(79,139,255,0.25);

  --sidebar-w: 280px;
  --topbar-h:  64px;
  --transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
}

[data-theme="light"] {
  --bg-base:          #e8edf8;
  --bg-mid:           #dde3f5;
  --bg-surface:       rgba(255,255,255,0.65);
  --bg-surface-hover: rgba(255,255,255,0.85);
  --glass-bg:         rgba(255,255,255,0.55);
  --glass-border:     rgba(79,139,255,0.15);
  --glass-shadow:     0 8px 32px rgba(79,139,255,0.12);
  --glass-inner:      rgba(255,255,255,0.6);

  --text-primary:   #0d1427;
  --text-secondary: #3a4a6a;
  --text-muted:     #6a7a9a;
  --text-accent:    #2563eb;

  --accent:         #2563eb;
  --accent-glow:    rgba(37,99,235,0.18);
  --accent-2:       #7c3aed;
  --accent-3:       #059669;

  --orb-1:  rgba(37,99,235,0.12);
  --orb-2:  rgba(124,58,237,0.08);
  --orb-3:  rgba(5,150,105,0.07);

  --user-bubble:    rgba(37,99,235,0.12);
  --user-border:    rgba(37,99,235,0.25);
  --bot-bubble:     rgba(255,255,255,0.75);
  --bot-border:     rgba(79,139,255,0.15);

  --input-bg:      rgba(255,255,255,0.7);
  --input-border:  rgba(79,139,255,0.2);
  --input-focus:   rgba(37,99,235,0.35);

  --scrollbar-thumb: rgba(37,99,235,0.2);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Google Sans', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  height: 100%;
  overflow-x: hidden;
  transition: var(--transition);
}

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

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  animation: orbFloat 12s ease-in-out infinite;
}

.orb-1 {
  width: 600px; height: 600px;
  background: var(--orb-1);
  top: -200px; left: -200px;
  animation-duration: 14s;
}
.orb-2 {
  width: 500px; height: 500px;
  background: var(--orb-2);
  bottom: -150px; right: -150px;
  animation-duration: 18s;
  animation-delay: -6s;
}
.orb-3 {
  width: 350px; height: 350px;
  background: var(--orb-3);
  top: 40%; left: 40%;
  animation-duration: 22s;
  animation-delay: -10s;
}

@keyframes orbFloat {
  0%,100% { transform: translate(0,0) scale(1); }
  25%      { transform: translate(40px,-30px) scale(1.05); }
  50%      { transform: translate(-20px,40px) scale(0.95); }
  75%      { transform: translate(30px,20px) scale(1.02); }
}

/* ── Glassmorphism Utilities ─────────────────────────────────────────────── */
.glass-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border-radius: var(--radius-xl);
}

.glass-inner {
  background: var(--glass-inner);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: var(--radius-md);
}

.glass-sidebar {
  background: var(--glass-bg);
  border-right: 1px solid var(--glass-border);
  backdrop-filter: blur(32px) saturate(1.5);
  -webkit-backdrop-filter: blur(32px) saturate(1.5);
}

.glass-topbar {
  background: rgba(var(--glass-bg), 0.8);
  border-bottom: 1px solid var(--glass-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.glass-input-area {
  background: var(--glass-bg);
  border-top: 1px solid var(--glass-border);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

/* ── Accent Color ─────────────────────────────────────────────────────────── */
.accent { color: var(--accent); }

/* ── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 10px;
}

/* ── Animate In ───────────────────────────────────────────────────────────── */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: slideUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards; }

/* ════════════════════════════════════════════════════════════════════════════
   AUTH PAGES
   ════════════════════════════════════════════════════════════════════════════ */
.auth-container {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

/* Brand */
.auth-brand { text-align: center; }

.brand-logo-wrap {
  margin-bottom: 20px;
}
.brand-logo {
  height: 52px;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px var(--accent-glow));
  transition: var(--transition);
}

.brand-text { display: flex; flex-direction: column; align-items: center; gap: 6px; }

.mai-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #fff;
}
.mai-badge .mai-icon {
  width: 18px; height: 18px;
  background: rgba(255,255,255,0.25);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800;
}

.brand-title {
  font-family: 'Google Sans Display', 'Google Sans', sans-serif;
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -1px;
  color: var(--text-primary);
}
.brand-subtitle {
  color: var(--text-secondary);
  font-size: 15px;
}

/* Divider */
.auth-divider {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13px;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--glass-border);
}

/* Auth Buttons */
.auth-buttons { width: 100%; display: flex; flex-direction: column; gap: 12px; }

.btn-auth {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 24px;
  border-radius: var(--radius-md);
  font-family: 'Google Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--glass-border);
  background: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.btn-auth::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent, rgba(255,255,255,0.05));
  opacity: 0;
  transition: var(--transition);
}
.btn-auth:hover {
  background: var(--bg-surface-hover);
  border-color: var(--accent);
  box-shadow: 0 4px 20px var(--accent-glow);
  transform: translateY(-2px);
  color: var(--text-primary);
  text-decoration: none;
}
.btn-auth:hover::before { opacity: 1; }

.btn-auth-icon { width: 20px; height: 20px; flex-shrink: 0; }

/* Auth Footer */
.auth-footer {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.auth-footer p { color: var(--text-muted); font-size: 12px; }
.auth-website-link {
  color: var(--accent);
  font-size: 13px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}
.auth-website-link:hover {
  color: var(--text-primary);
  text-shadow: 0 0 12px var(--accent-glow);
}

/* Theme Toggle Float */
.theme-toggle-float {
  position: fixed;
  top: 20px; right: 20px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  color: var(--text-primary);
  font-size: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  z-index: 100;
}
.theme-toggle-float:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 20px var(--accent-glow);
  transform: rotate(20deg);
}

/* Access Denied */
.denied-card { text-align: center; gap: 20px; }
.denied-icon {
  width: 80px; height: 80px;
  background: linear-gradient(135deg, rgba(239,68,68,0.15), rgba(239,68,68,0.05));
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  color: #ef4444;
  margin: 0 auto;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.2); }
  50% { box-shadow: 0 0 0 12px rgba(239,68,68,0); }
}
.denied-title { font-size: 24px; font-weight: 700; color: var(--text-primary); }
.denied-email {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  background: var(--glass-inner);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-secondary);
}
.denied-email code { color: var(--accent); font-family: 'Google Sans Mono', monospace; }
.denied-message { color: var(--text-secondary); font-size: 14px; line-height: 1.6; }
.denied-actions { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; }

/* ════════════════════════════════════════════════════════════════════════════
   APP SHELL
   ════════════════════════════════════════════════════════════════════════════ */
.app-shell {
  position: relative;
  z-index: 10;
  display: flex;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  overflow: hidden;
  position: relative;
  z-index: 50;
  flex-shrink: 0;
}

.sidebar.collapsed { width: 0; min-width: 0; }

.sidebar-header {
  padding: 18px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-logo {
  height: 30px;
  object-fit: contain;
  flex-shrink: 0;
}
.sidebar-brand-text { display: flex; flex-direction: column; }
.sidebar-brand-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-primary);
}
.sidebar-brand-sub {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.sidebar-toggle-btn {
  width: 32px; height: 32px;
  background: var(--glass-inner);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  transition: var(--transition);
}
.sidebar-toggle-btn:hover { color: var(--accent); background: var(--accent-glow); }

/* New Chat Button */
.btn-new-chat {
  margin: 14px 12px 8px;
  padding: 10px 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-family: 'Google Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 4px 16px var(--accent-glow);
}
.btn-new-chat:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--accent-glow);
  filter: brightness(1.1);
}
.btn-new-chat i { font-size: 13px; }

/* Provider Switch */
.provider-switch-wrap {
  margin: 8px 12px;
  padding: 12px;
  flex-shrink: 0;
}
.provider-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.provider-toggle {
  display: flex;
  background: var(--glass-inner);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
}
.provider-btn {
  flex: 1;
  padding: 6px 8px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-family: 'Google Sans', sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
}
.provider-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px var(--accent-glow);
}
.provider-btn:not(.active):hover { color: var(--text-primary); background: var(--bg-surface-hover); }

/* Sessions List */
.sidebar-sessions {
  flex: 1;
  overflow-y: auto;
  padding: 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 0;
}
.sessions-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 8px 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.session-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  position: relative;
  group: true;
}
.session-item:hover {
  background: var(--bg-surface-hover);
  border-color: var(--glass-border);
}
.session-item.active {
  background: var(--user-bubble);
  border-color: var(--user-border);
}

.session-item-icon {
  width: 28px; height: 28px;
  background: var(--glass-inner);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  font-size: 11px;
  flex-shrink: 0;
}
.session-item.active .session-item-icon { color: var(--accent); }

.session-item-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.session-item-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.session-item-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.session-delete-btn {
  width: 26px; height: 26px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  opacity: 0;
  transition: var(--transition);
}
.session-item:hover .session-delete-btn { opacity: 1; }
.session-delete-btn:hover { background: rgba(239,68,68,0.15); color: #ef4444; }

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.user-info {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.user-details { display: flex; flex-direction: column; min-width: 0; }
.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-email {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-org {
  font-size: 11px;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.user-org-admin {
  color: #f59e0b;
}

.sidebar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}
.sidebar-action-btn {
  width: 36px; height: 36px;
  background: var(--glass-inner);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  text-decoration: none;
  transition: var(--transition);
}
.sidebar-action-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-glow);
  box-shadow: 0 0 12px var(--accent-glow);
}

/* Sidebar Backdrop (mobile) */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 40;
  backdrop-filter: blur(4px);
}
.sidebar-backdrop.visible { display: block; }

/* ── Chat Main ────────────────────────────────────────────────────────────── */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
  min-width: 0;
  position: relative;
}

/* Topbar */
.chat-topbar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  padding: 0 20px;
  padding-top: env(safe-area-inset-top, 0px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  z-index: 20;
  box-sizing: content-box;
}

.topbar-menu-btn {
  width: 36px; height: 36px;
  background: var(--glass-inner);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  transition: var(--transition);
  display: none;
}
.topbar-menu-btn:hover { color: var(--accent); }

/* Expand sidebar button — shown in topbar only when sidebar is collapsed (desktop) */
.topbar-expand-btn {
  width: 36px; height: 36px;
  background: var(--glass-inner);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: var(--transition);
  flex-shrink: 0;
  /* JS sets display:flex when sidebar is collapsed, display:none otherwise */
}
.topbar-expand-btn:hover { color: var(--accent); }

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.mai-badge-sm {
  padding: 3px 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 100px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #fff;
}
.topbar-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-primary);
}

.topbar-actions { display: flex; align-items: center; gap: 10px; }
.provider-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--glass-inner);
  border: 1px solid var(--glass-border);
  border-radius: 100px;
  font-size: 12px;
  color: var(--text-secondary);
}
.provider-badge i { color: var(--accent-3); font-size: 8px; }

/* ── Chat Messages ────────────────────────────────────────────────────────── */
.chat-messages-wrap {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
  min-height: 0;
}

.chat-messages {
  max-width: 820px;
  margin: 0 auto;
  padding: 24px 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Welcome Screen */
.chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 20px;
  gap: 20px;
}

.welcome-logo-wrap { position: relative; }
.welcome-mai-ring {
  width: 100px; height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  position: relative;
  animation: welcomeRing 3s ease-in-out infinite;
  box-shadow: 0 0 40px var(--accent-glow), 0 0 80px rgba(167,139,250,0.1);
}
.welcome-mai-ring::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid;
  border-color: var(--accent) transparent var(--accent-2) transparent;
  animation: spin 3s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes welcomeRing {
  0%,100% { box-shadow: 0 0 40px var(--accent-glow), 0 0 80px rgba(167,139,250,0.1); }
  50% { box-shadow: 0 0 60px var(--accent-glow), 0 0 120px rgba(167,139,250,0.2); }
}

.welcome-mai-text {
  font-family: 'Google Sans Display', sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.05em;
}

.welcome-title {
  font-family: 'Google Sans Display', sans-serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
}
.wave { display: inline-block; animation: wave 2s ease-in-out infinite; }
@keyframes wave { 0%,100% { transform: rotate(0); } 50% { transform: rotate(20deg); } }

.welcome-sub {
  color: var(--text-secondary);
  font-size: 16px;
  max-width: 500px;
  line-height: 1.6;
}

.welcome-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  max-width: 600px;
}
.suggestion-chip {
  padding: 10px 18px;
  background: var(--glass-inner);
  border: 1px solid var(--glass-border);
  border-radius: 100px;
  color: var(--text-secondary);
  font-family: 'Google Sans', sans-serif;
  font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  transition: var(--transition);
}
.suggestion-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px var(--accent-glow);
}
.suggestion-chip i { font-size: 12px; }

/* Message Bubbles */
.message-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  animation: msgIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.message-row.user-row { flex-direction: row-reverse; }

.msg-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}
.user-row .msg-avatar {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}
.bot-row .msg-avatar {
  background: linear-gradient(135deg, #4f8bff, #a78bfa);
  color: #fff;
  font-size: 10px;
  letter-spacing: 0.05em;
}

.msg-content { max-width: 75%; display: flex; flex-direction: column; gap: 4px; }
.user-row .msg-content { align-items: flex-end; }

.msg-bubble {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.6;
  transition: var(--transition);
  position: relative;
  word-break: break-word;
}

.user-bubble {
  background: var(--user-bubble);
  border: 1px solid var(--user-border);
  color: var(--text-primary);
  border-radius: var(--radius-md) var(--radius-md) 4px var(--radius-md);
}

.bot-bubble {
  background: var(--bot-bubble);
  border: 1px solid var(--bot-border);
  color: var(--text-primary);
  border-radius: var(--radius-md) var(--radius-md) var(--radius-md) 4px;
}

.msg-time {
  font-size: 11px;
  color: var(--text-muted);
  padding: 0 4px;
}

/* MAI HTML Response Styles */
.bot-bubble .mai-response {
  color: var(--text-primary);
}
.bot-bubble .mai-response p { margin-bottom: 10px; font-size: 14px; }
.bot-bubble .mai-response ol {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 10px 0;
}
.bot-bubble .mai-response ul {
  padding-left: 18px;
  margin: 8px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bot-bubble .mai-response li { font-size: 14px; line-height: 1.6; }
.bot-bubble .mai-response strong { color: var(--accent); font-weight: 600; }
.bot-bubble .mai-response ol > li {
  background: var(--glass-inner);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  list-style: none;
  counter-increment: step-counter;
  position: relative;
  padding-left: 44px;
}
.bot-bubble .mai-response ol { counter-reset: step-counter; }
.bot-bubble .mai-response ol > li::before {
  content: counter(step-counter);
  position: absolute;
  left: 12px;
  top: 12px;
  width: 22px; height: 22px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}
.bot-bubble .mai-response .mai-error {
  color: #ef4444;
}

/* Typing Indicator */
.typing-row { display: flex; gap: 12px; align-items: center; }
.typing-bubble {
  padding: 14px 18px;
  background: var(--bot-bubble);
  border: 1px solid var(--bot-border);
  border-radius: var(--radius-md) var(--radius-md) var(--radius-md) 4px;
  display: flex; gap: 6px; align-items: center;
}
.typing-dot {
  width: 8px; height: 8px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typingBounce 1.2s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%,60%,100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-8px); opacity: 1; }
}

/* ── Chat Input ───────────────────────────────────────────────────────────── */
.chat-input-area {
  padding: 16px 20px 20px;
  padding-bottom: max(20px, calc(20px + env(safe-area-inset-bottom, 0px)));
  flex-shrink: 0;
}
.chat-input-wrap {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-box {
  padding: 12px 14px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  transition: var(--transition);
}
.input-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow), 0 8px 24px rgba(0,0,0,0.2);
}

.chat-textarea {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  resize: none;
  color: var(--text-primary);
  font-family: 'Google Sans', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  max-height: 160px;
  overflow-y: auto;
  padding: 0;
}
.chat-textarea::placeholder { color: var(--text-muted); }

.input-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.char-count {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.send-btn {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  transition: var(--transition);
  box-shadow: 0 4px 12px var(--accent-glow);
  flex-shrink: 0;
}
.send-btn:not(:disabled):hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px var(--accent-glow);
}
.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}
.send-btn.loading {
  animation: sendSpin 1s linear infinite;
  pointer-events: none;
}
@keyframes sendSpin { to { transform: rotate(360deg); } }

.input-hint {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.input-hint a { color: var(--accent); text-decoration: none; }
.input-hint a:hover { text-decoration: underline; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 280px; }

  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    height: 100vh;
    height: 100dvh;
    transform: translateX(-100%);
    z-index: 50;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
  }

  .topbar-menu-btn { display: flex; }

  /* Re-anchor app-shell and chat-main to dvh on mobile */
  .app-shell {
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
  }
  .chat-main {
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
  }

  .chat-messages { padding: 16px 12px 8px; }
  .msg-content { max-width: 90%; }
  .welcome-title { font-size: 24px; }
  .welcome-suggestions { flex-direction: column; align-items: center; }
  .suggestion-chip { width: 100%; max-width: 320px; justify-content: center; }

  .chat-input-area {
    padding: 12px;
    padding-bottom: max(12px, calc(12px + env(safe-area-inset-bottom, 0px)));
  }
}

/* ── Continuous transition shimmer on inputs ─────────────────────────────── */
@keyframes borderShimmer {
  0%   { border-color: rgba(79,139,255,0.15); }
  50%  { border-color: rgba(167,139,250,0.3); }
  100% { border-color: rgba(79,139,255,0.15); }
}
.input-box { animation: borderShimmer 4s ease-in-out infinite; }
.input-box:focus-within { animation: none; }

/* ── Live Agent Card ─────────────────────────────────────────────────────── */
.mai-live-agent-card {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  background: linear-gradient(135deg, rgba(52,211,153,0.08) 0%, rgba(79,139,255,0.08) 100%);
  border: 1px solid rgba(52,211,153,0.35);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-top: 8px;
}

.live-agent-icon {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #34d399, #4f8bff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  box-shadow: 0 4px 14px rgba(52,211,153,0.4);
}

.live-agent-body { flex: 1; display: flex; flex-direction: column; gap: 8px; }

.live-agent-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
  margin: 0;
}

.live-agent-sub {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

.live-agent-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 999px;
  background: linear-gradient(135deg, #34d399, #4f8bff);
  color: #fff !important;
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none !important;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 14px rgba(52,211,153,0.35);
  align-self: flex-start;
}

.live-agent-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(52,211,153,0.5);
}

.live-agent-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.live-agent-btn-inner,
.live-agent-btn-spinner {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.live-agent-error {
  margin-top: 8px;
  font-size: 0.82rem;
  color: #f87171;
  line-height: 1.45;
}

.live-agent-joined {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(52,211,153,0.12);
  border: 1px solid rgba(52,211,153,0.4);
  border-radius: 999px;
  font-size: 0.875rem;
  color: #34d399;
  font-weight: 500;
}

.live-agent-joined a {
  color: #34d399;
  font-weight: 600;
  text-decoration: underline;
}

.live-agent-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

.live-agent-note i { color: var(--accent-3); margin-right: 4px; }

/* Light theme adjustments */
[data-theme="light"] .mai-live-agent-card {
  background: linear-gradient(135deg, rgba(52,211,153,0.06) 0%, rgba(79,139,255,0.06) 100%);
  border-color: rgba(52,211,153,0.4);
}

/* ═══════════════════════════════════════════════════════════════════
   ADMIN PANEL
   ═══════════════════════════════════════════════════════════════════ */

.admin-page {
  min-height: 100vh;
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 12px;
}

.admin-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.admin-back-btn {
  width: 38px; height: 38px;
  background: var(--glass-inner);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  text-decoration: none;
  font-size: 15px;
  transition: var(--transition);
}
.admin-back-btn:hover { color: var(--accent); border-color: var(--accent); }

.admin-brand { display: flex; align-items: center; gap: 10px; }
.admin-title { font-size: 1.2rem; font-weight: 700; color: var(--text-primary); }

.btn-admin-primary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border: none; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: var(--transition);
  box-shadow: 0 2px 12px var(--accent-glow);
}
.btn-admin-primary:hover { opacity: 0.9; color: #fff; }

.btn-admin-secondary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px;
  background: var(--glass-inner);
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  cursor: pointer; text-decoration: none;
  transition: var(--transition);
}
.btn-admin-secondary:hover { color: var(--text-primary); border-color: var(--text-muted); }

.admin-alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13px;
  display: flex; align-items: center; gap: 8px;
}
.admin-alert-success {
  background: rgba(52,211,153,0.1);
  border: 1px solid rgba(52,211,153,0.4);
  color: #34d399;
}
.admin-alert-error {
  background: rgba(248,113,113,0.1);
  border: 1px solid rgba(248,113,113,0.4);
  color: #f87171;
}

.admin-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  overflow: hidden;
}

.admin-table-wrap { overflow-x: auto; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-table th {
  padding: 12px 16px;
  background: var(--glass-inner);
  color: var(--text-muted);
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--glass-border);
}
.admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--glass-border);
  vertical-align: middle;
  color: var(--text-secondary);
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr.row-inactive td { opacity: 0.5; }
.admin-table tr:hover td { background: var(--glass-inner); }

.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell-avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.user-cell-avatar-lg { width: 48px; height: 48px; font-size: 18px; }
.user-cell-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.user-cell-email { font-size: 11px; color: var(--text-muted); }

.badge-org {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px;
  background: rgba(79,139,255,0.12);
  color: var(--accent);
  border: 1px solid rgba(79,139,255,0.3);
  border-radius: 999px;
  font-size: 11px; font-weight: 500;
}
.badge-admin {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px;
  background: rgba(245,158,11,0.12);
  color: #f59e0b;
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: 999px;
  font-size: 11px; font-weight: 500;
}
.badge-user {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px;
  background: var(--glass-inner);
  color: var(--text-muted);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  font-size: 11px;
}
.badge-active {
  padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 500;
  background: rgba(52,211,153,0.12); color: #34d399;
  border: 1px solid rgba(52,211,153,0.3);
}
.badge-inactive {
  padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 500;
  background: rgba(248,113,113,0.1); color: #f87171;
  border: 1px solid rgba(248,113,113,0.3);
}
.badge-muted { font-size: 12px; color: var(--text-muted); }

.text-muted-sm { font-size: 12px; color: var(--text-muted); }

.action-btns { display: flex; gap: 6px; align-items: center; }
.action-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: var(--glass-inner);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  cursor: pointer; text-decoration: none;
  transition: var(--transition);
  color: var(--text-secondary);
}
.action-btn-edit:hover { color: var(--accent); border-color: var(--accent); }
.action-btn-delete:hover { color: #f87171; border-color: #f87171; }
.action-btn:disabled { opacity: 0.35; cursor: not-allowed; pointer-events: none; }

/* Admin form */
.admin-form-card { padding: 28px; max-width: 560px; }
.admin-user-badge { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }

.form-group-admin {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 18px;
}
.form-group-admin label {
  font-size: 13px; font-weight: 600; color: var(--text-primary);
}
.admin-input, .admin-select {
  padding: 10px 14px;
  background: var(--glass-inner);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
  font-family: inherit;
}
.admin-input:focus, .admin-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.admin-select option { background: var(--sidebar-bg); }

.form-group-check { flex-direction: row; align-items: center; }
.check-label {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--text-secondary);
  cursor: pointer; user-select: none;
}
.check-label input[type="checkbox"] {
  width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer;
}

.field-error { font-size: 11px; color: #f87171; }
.field-hint { font-size: 11px; color: var(--text-muted); }
.required-star { color: #f87171; }

.form-actions {
  display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Support Agent — Availability Banner & Call Panels
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Agent availability banner ───────────────────────────────────────────── */
.agent-banner {
  position: fixed;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 400;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  background: rgba(52,211,153,0.12);
  border: 1px solid rgba(52,211,153,0.35);
  backdrop-filter: blur(16px);
  box-shadow: 0 4px 24px rgba(52,211,153,0.15);
  animation: bannerSlideUp 0.4s cubic-bezier(.4,0,.2,1);
}

@keyframes bannerSlideUp {
  from { opacity:0; transform: translateX(-50%) translateY(20px); }
  to   { opacity:1; transform: translateX(-50%) translateY(0); }
}

.agent-banner-left {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; font-weight: 500; color: var(--accent-3);
}

.agent-status-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent-3);
  box-shadow: 0 0 8px var(--accent-3);
  animation: dotPulse 1.5s ease-in-out infinite;
}

@keyframes dotPulse {
  0%,100% { opacity:1; transform:scale(1); }
  50%      { opacity:.6; transform:scale(1.3); }
}

.btn-call {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 18px; border-radius: var(--radius-sm);
  background: var(--accent-3); color: #0a0f1e;
  font-size: 13px; font-weight: 600; border: none; cursor: pointer;
  transition: var(--transition);
}
.btn-call:hover { filter: brightness(1.15); transform: scale(1.03); }

/* ── Shared Call Panel ───────────────────────────────────────────────────── */
.call-panel {
  position: fixed;
  bottom: 90px;
  right: 24px;
  z-index: 500;
  width: 300px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(24px);
  box-shadow: var(--glass-shadow);
  animation: panelSlideIn 0.35s cubic-bezier(.4,0,.2,1);
}

@keyframes panelSlideIn {
  from { opacity:0; transform: translateY(30px) scale(.96); }
  to   { opacity:1; transform: translateY(0) scale(1); }
}

.call-panel-header {
  display: flex; align-items: center; justify-content: space-between;
}

.call-panel-title {
  font-size: 14px; font-weight: 600; color: var(--text-primary);
  display: flex; align-items: center; gap: 8px;
}

.call-status {
  font-size: 12px; color: var(--text-secondary);
  padding: 3px 10px; border-radius: 20px;
  background: var(--bg-surface);
}

.call-panel.call-connected .call-status {
  background: rgba(52,211,153,0.15);
  color: var(--accent-3);
}

/* ── Visualizer ──────────────────────────────────────────────────────────── */
.call-visualizer {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}

.call-avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--bg-surface);
  border: 2px solid var(--glass-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; color: var(--text-secondary);
}

.call-panel.call-connected .call-avatar {
  border-color: var(--accent-3);
  box-shadow: 0 0 0 4px rgba(52,211,153,0.15);
}

.call-caller-name {
  font-size: 14px; font-weight: 500; color: var(--text-primary);
}

/* Sound waves */
.call-waves {
  display: flex; align-items: center; gap: 4px; height: 30px;
}

.call-waves span {
  display: block; width: 4px; border-radius: 2px;
  background: var(--accent);
  animation: waveIdle 1.2s ease-in-out infinite;
}

.call-waves span:nth-child(1) { animation-delay: 0s;    height: 8px; }
.call-waves span:nth-child(2) { animation-delay: .15s;  height: 16px; }
.call-waves span:nth-child(3) { animation-delay: .30s;  height: 24px; }
.call-waves span:nth-child(4) { animation-delay: .15s;  height: 16px; }
.call-waves span:nth-child(5) { animation-delay: 0s;    height: 8px; }

@keyframes waveIdle {
  0%,100% { transform: scaleY(.4); opacity:.5; }
  50%      { transform: scaleY(1);  opacity:1; }
}

.call-panel.call-connected .call-waves span {
  background: var(--accent-3);
  animation: waveActive 0.7s ease-in-out infinite;
}

.call-panel.call-connected .call-waves span:nth-child(1) { animation-delay:0s; }
.call-panel.call-connected .call-waves span:nth-child(2) { animation-delay:.1s; }
.call-panel.call-connected .call-waves span:nth-child(3) { animation-delay:.2s; }
.call-panel.call-connected .call-waves span:nth-child(4) { animation-delay:.1s; }
.call-panel.call-connected .call-waves span:nth-child(5) { animation-delay:0s; }

@keyframes waveActive {
  0%,100% { transform: scaleY(.3); }
  50%      { transform: scaleY(1.2); }
}

/* ── Call Controls ───────────────────────────────────────────────────────── */
.call-controls {
  display: flex; align-items: center; justify-content: center; gap: 16px;
}

.call-ctrl-btn {
  width: 48px; height: 48px; border-radius: 50%;
  border: none; cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}

.call-ctrl-answer {
  background: var(--accent-3); color: #0a0f1e;
  box-shadow: 0 4px 16px rgba(52,211,153,0.4);
}
.call-ctrl-answer:hover { filter: brightness(1.15); transform: scale(1.1); }

.call-ctrl-mute {
  background: var(--bg-surface); color: var(--text-primary);
  border: 1px solid var(--glass-border);
}
.call-ctrl-mute:hover  { background: var(--bg-surface-hover); }
.call-ctrl-mute.muted  { background: rgba(251,191,36,0.15); color: #fbbf24; border-color: rgba(251,191,36,0.35); }

.call-ctrl-end {
  background: rgba(248,113,113,0.15); color: #f87171;
  border: 1px solid rgba(248,113,113,0.35);
  box-shadow: 0 4px 16px rgba(248,113,113,0.15);
}
.call-ctrl-end:hover { background: rgba(248,113,113,0.25); transform: scale(1.05); }

.call-ctrl-cancel {
  background: rgba(248,113,113,0.12); color: #f87171;
  border: 1px solid rgba(248,113,113,0.35);
  font-size: 13px; font-weight: 600; width: auto; padding: 0 18px; border-radius: 24px;
  display: flex; align-items: center; gap: 7px;
}
.call-ctrl-cancel:hover { background: rgba(248,113,113,0.25); transform: scale(1.03); }

/* ── Agent panel accent ──────────────────────────────────────────────────── */
.call-panel-agent { border-color: rgba(167,139,250,0.35); }
.call-panel-agent .call-avatar { border-color: var(--accent-2); }
.call-panel-agent .call-panel.call-connected .call-avatar {
  box-shadow: 0 0 0 4px rgba(167,139,250,0.15);
}

/* ── Support Agent badge in sidebar ─────────────────────────────────────── */
.user-org-agent {
  color: var(--accent-3);
}

/* ── Support Agent badge in Admin table ─────────────────────────────────── */
.badge-agent {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 500;
  background: rgba(52,211,153,0.12); color: var(--accent-3);
  border: 1px solid rgba(52,211,153,0.25);
}

/* ── Connected Call Info Popup ───────────────────────────────────────────── */
.call-info-popup {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 600;
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  background: var(--glass-bg);
  border: 1px solid rgba(52,211,153,0.35);
  backdrop-filter: blur(24px);
  box-shadow: 0 8px 32px rgba(52,211,153,0.12), var(--glass-shadow);
  animation: panelSlideIn 0.35s cubic-bezier(.4,0,.2,1);
}

.call-info-popup-header {
  display: flex; align-items: center; justify-content: space-between;
}

.call-info-popup-title {
  font-size: 14px; font-weight: 600; color: var(--text-primary);
  display: flex; align-items: center; gap: 8px;
}

.call-info-live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent-3);
  display: inline-block;
  box-shadow: 0 0 0 0 rgba(52,211,153,0.6);
  animation: livePulse 1.4s ease-in-out infinite;
}

@keyframes livePulse {
  0%   { box-shadow: 0 0 0 0 rgba(52,211,153,0.6); }
  70%  { box-shadow: 0 0 0 7px rgba(52,211,153,0); }
  100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); }
}

.call-info-badge {
  font-size: 11px; font-weight: 600; padding: 2px 10px; border-radius: 20px;
  background: rgba(52,211,153,0.15); color: var(--accent-3);
  border: 1px solid rgba(52,211,153,0.3);
}

.call-info-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px;
}

.call-info-label {
  color: var(--text-secondary); display: flex; align-items: center; gap: 6px;
}

.call-info-value {
  font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums;
}

/* Quality bars */
.call-info-quality {
  display: flex; align-items: flex-end; gap: 3px;
}

.quality-bar {
  width: 5px; border-radius: 2px;
  background: var(--bg-surface-hover);
  transition: background 0.4s, height 0.4s;
}
.quality-bar:nth-child(1) { height: 6px; }
.quality-bar:nth-child(2) { height: 10px; }
.quality-bar:nth-child(3) { height: 14px; }
.quality-bar:nth-child(4) { height: 18px; }

.quality-bar.active { background: var(--accent-3); }
.quality-bar.active-warn { background: #fbbf24; }
.quality-bar.active-poor { background: #f87171; }

.quality-label {
  font-size: 12px; font-weight: 600; color: var(--accent-3);
  margin-left: 6px; align-self: center;
}

.call-info-disconnect-btn {
  width: 100%; padding: 10px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(248,113,113,0.35);
  background: rgba(248,113,113,0.12);
  color: #f87171; font-size: 13px; font-weight: 600;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: var(--transition);
}
.call-info-disconnect-btn:hover {
  background: rgba(248,113,113,0.25); transform: scale(1.02);
}

/* ── Responsive: stack call panel on small screens ───────────────────────── */
@media (max-width: 600px) {
  .call-panel { right: 12px; left: 12px; width: auto; bottom: 80px; }
  .agent-banner { width: calc(100% - 32px); flex-direction: column; gap: 10px; bottom: 80px; }
  .call-info-popup { right: 12px; left: 12px; width: auto; top: 70px; }
}

/* ── Prevent iOS/Android auto-zoom on input focus ────────────────────────── */
/* Browsers zoom when focused input font-size < 16px; force 16px on mobile  */
@media (max-width: 768px) {
  input,
  textarea,
  select {
    font-size: 16px !important;
  }
  /* Restore visual size after overriding — scale back via transform so the   */
  /* layout doesn't shift, but zoom is suppressed.                            */
  .chat-textarea {
    font-size: 16px !important;
  }
}


