/* ==============================
   FlowAI Design System
   ============================== */

:root {
  /* Colors - Dark Theme */
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: #1a2235;
  --bg-card-hover: #1f2a40;
  --bg-input: #0d1321;
  --bg-sidebar: #0d1219;

  --border: #1e2d45;
  --border-light: #2a3a55;

  --text-primary: #e8ecf4;
  --text-secondary: #8899b4;
  --text-muted: #5a6a84;

  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.25);

  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --info: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.12);

  /* Sizing */
  --sidebar-width: 240px;
  --topbar-height: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px var(--accent-glow);
}

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

html { font-size: 14px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ==============================
   Scrollbar
   ============================== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ==============================
   App Layout
   ============================== */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ==============================
   Sidebar
   ============================== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.logo-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  border-radius: var(--radius-sm);
  color: white;
}

.logo-text {
  font-size: 1.35rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-hover), #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all 0.2s ease;
  font-weight: 500;
  font-size: 0.93rem;
}

.nav-item:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent-hover);
}

.nav-item.active svg { stroke: var(--accent-hover); }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
}

.status-dot.online { background: var(--success); box-shadow: 0 0 8px rgba(16,185,129,0.5); }
.status-dot.offline { background: var(--text-muted); }

/* ==============================
   Main Content
   ============================== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.top-bar {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.live-calls-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--success-bg);
  border: 1px solid rgba(16,185,129,0.2);
  border-radius: 20px;
  color: var(--success);
  font-weight: 600;
  font-size: 0.85rem;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

.content-area {
  flex: 1;
  padding: 28px 32px;
  overflow-y: auto;
}

/* ==============================
   Cards & Stats
   ============================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #a855f7);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.stat-card:hover { border-color: var(--border-light); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card:hover::before { opacity: 1; }

.stat-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 600;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.1;
}

.stat-value.accent { color: var(--accent-hover); }
.stat-value.success { color: var(--success); }
.stat-value.warning { color: var(--warning); }

.stat-change {
  font-size: 0.78rem;
  margin-top: 6px;
  color: var(--text-muted);
}

/* ==============================
   Data Tables
   ============================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.card-body { padding: 0; }
.card-body.padded { padding: 22px; }

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 12px 18px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}

.data-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tr:hover td { background: var(--bg-card-hover); }

/* ==============================
   Badges & Status
   ============================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-muted { background: rgba(90,106,132,0.15); color: var(--text-muted); }

/* ==============================
   Buttons
   ============================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: var(--shadow-glow); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent-hover); background: var(--accent-glow); }

.btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.btn-icon { padding: 8px; }

.btn-group { display: flex; gap: 8px; }

/* ==============================
   Forms
   ============================== */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color 0.2s ease;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-textarea { resize: vertical; min-height: 100px; }
.form-select { cursor: pointer; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ==============================
   Modals
   ============================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-title { font-size: 1.15rem; font-weight: 700; }

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-close:hover { border-color: var(--danger); color: var(--danger); }

.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ==============================
   Audio Player (fixed bottom)
   ============================== */
.audio-player {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-width);
  right: 0;
  height: 64px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 20px;
  z-index: 500;
}

.player-info { min-width: 160px; }
.player-phone { font-weight: 600; font-size: 0.9rem; display: block; }
.player-campaign { font-size: 0.75rem; color: var(--text-muted); }

.player-controls { display: flex; align-items: center; gap: 12px; flex: 1; }

.btn-player {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.btn-player:hover { border-color: var(--accent); color: var(--accent-hover); }

.player-progress { flex: 1; display: flex; align-items: center; gap: 12px; }

.progress-bar {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  cursor: pointer;
  overflow: hidden;
}

.progress-fill { height: 100%; background: var(--accent); border-radius: 2px; width: 0%; transition: width 0.1s linear; }

.player-time { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }

/* ==============================
   Charts (Canvas placeholder)
   ============================== */
.chart-container {
  position: relative;
  width: 100%;
  height: 260px;
  padding: 16px;
}

.chart-bar-container {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 200px;
  padding-top: 20px;
}

.chart-bar-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}

.chart-bar {
  width: 100%;
  max-width: 32px;
  background: linear-gradient(180deg, var(--accent), rgba(99,102,241,0.4));
  border-radius: 4px 4px 0 0;
  min-height: 2px;
  transition: height 0.5s ease;
  position: relative;
}

.chart-bar:hover { background: linear-gradient(180deg, var(--accent-hover), rgba(129,140,248,0.5)); }

.chart-bar-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 6px;
  text-align: center;
}

/* ==============================
   Campaign Cards Grid
   ============================== */
.campaigns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.campaign-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
}

.campaign-card:hover { border-color: var(--border-light); transform: translateY(-2px); box-shadow: var(--shadow-md); }

.campaign-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.campaign-name {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
}

.campaign-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
}

.campaign-stat-item {
  text-align: center;
}

.campaign-stat-value {
  font-size: 1.25rem;
  font-weight: 700;
}

.campaign-stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.campaign-progress {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 16px;
}

.campaign-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--success));
  border-radius: 2px;
  transition: width 0.5s ease;
}

.campaign-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

/* ==============================
   Call List Item
   ============================== */
.call-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s ease;
  cursor: pointer;
}

.call-item:last-child { border-bottom: none; }
.call-item:hover { background: var(--bg-card-hover); }

.call-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 1rem;
}

.call-icon.answered { background: var(--success-bg); color: var(--success); }
.call-icon.missed { background: var(--danger-bg); color: var(--danger); }
.call-icon.machine { background: var(--warning-bg); color: var(--warning); }

.call-info { flex: 1; min-width: 0; }
.call-phone { font-weight: 600; font-size: 0.95rem; }
.call-meta { font-size: 0.78rem; color: var(--text-muted); }
.call-duration { font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); }

.call-actions { display: flex; gap: 6px; }

/* ==============================
   Empty State
   ============================== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 1rem;
  margin-bottom: 20px;
}

/* ==============================
   Transcript View
   ============================== */
.transcript {
  padding: 16px;
  font-size: 0.88rem;
  line-height: 1.7;
}

.transcript-line {
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  margin-bottom: 6px;
}

.transcript-line.ai { background: var(--accent-glow); border-left: 3px solid var(--accent); }
.transcript-line.caller { background: rgba(255,255,255,0.03); border-left: 3px solid var(--text-muted); }

.transcript-speaker {
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 2px;
}

.transcript-speaker.ai { color: var(--accent-hover); }
.transcript-speaker.caller { color: var(--text-muted); }

/* ==============================
   Loading
   ============================== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ==============================
   File Upload
   ============================== */
.file-upload {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.file-upload:hover { border-color: var(--accent); background: var(--accent-glow); }

.file-upload-icon { font-size: 2rem; margin-bottom: 10px; }
.file-upload-text { font-size: 0.9rem; color: var(--text-secondary); }

/* ==============================
   Agent Cards Grid
   ============================== */
.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.agent-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.agent-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #a855f7, var(--accent));
  opacity: 0;
  transition: opacity 0.25s ease;
}

.agent-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.agent-card:hover::before { opacity: 1; }

.agent-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.agent-avatar {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #a855f7, var(--accent));
  border-radius: var(--radius-sm);
  font-size: 1.4rem;
  flex-shrink: 0;
}

.agent-info { min-width: 0; }

.agent-name {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agent-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.agent-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.agent-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(30, 45, 69, 0.5);
}

.agent-detail-row:last-child { border-bottom: none; }

.agent-detail-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: 500;
}

.agent-detail-value {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.agent-card-footer {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* ==============================
   Form Tabs (inside modals)
   ============================== */
.form-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 24px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 3px;
  border: 1px solid var(--border);
}

.form-tab {
  flex: 1;
  padding: 9px 16px;
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.form-tab:hover {
  color: var(--text-secondary);
  background: rgba(255,255,255,0.03);
}

.form-tab.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 8px rgba(99,102,241,0.3);
}

.form-tab-content {
  display: none;
}

.form-tab-content.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

/* ==============================
   Form Enhancements
   ============================== */
.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.4;
}

.form-textarea.tall {
  min-height: 200px;
}

.knowledge-stats {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ==============================
   Campaign Agent Badge
   ============================== */
.campaign-agent-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.2);
  border-radius: 16px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #c084fc;
  margin-bottom: 8px;
}

/* ==============================
   Responsive
   ============================== */
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar .logo-text, .sidebar .nav-item span, .sidebar-footer .status-text { display: none; }
  .sidebar-logo { padding: 16px; justify-content: center; }
  .nav-item { padding: 10px; justify-content: center; }
  .content-area { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .campaigns-grid { grid-template-columns: 1fr; }
  .agents-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .audio-player { left: 60px; }
  #logout-btn { display: none; }
}

/* ==============================
   Login Page
   ============================== */
.login-container {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(168, 85, 247, 0.06) 0%, transparent 50%);
  z-index: 2000;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.4s ease;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo .logo-icon {
  margin: 0 auto 16px;
  border-radius: var(--radius);
}

.login-title {
  font-size: 1.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-hover), #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.login-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.login-error {
  background: var(--danger-bg);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(239, 68, 68, 0.2);
  font-size: 0.85rem;
  margin-bottom: 12px;
}

/* ==============================
   Toast Notifications
   ============================== */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 3000;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  transform: translateX(120%);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
  opacity: 0;
  min-width: 250px;
  max-width: 400px;
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.toast-success {
  background: #0d2818;
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--success);
}
.toast-success .toast-icon { background: rgba(16, 185, 129, 0.2); }

.toast-error {
  background: #2d0d0d;
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger);
}
.toast-error .toast-icon { background: rgba(239, 68, 68, 0.2); }

.toast-info {
  background: #0d1a2d;
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: var(--info);
}
.toast-info .toast-icon { background: rgba(59, 130, 246, 0.2); }

.toast-warning {
  background: #2d1f0d;
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--warning);
}
.toast-warning .toast-icon { background: rgba(245, 158, 11, 0.2); }

/* ==============================
   Test Call Modal
   ============================== */
.test-call-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.test-call-avatar {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  color: var(--text-muted);
  transition: all 0.3s ease;
}

.test-call-avatar.active {
  border-color: var(--success);
  color: var(--success);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.3);
  animation: avatarPulse 2s ease-in-out infinite;
}

@keyframes avatarPulse {
  0%, 100% { box-shadow: 0 0 16px rgba(16, 185, 129, 0.3); }
  50% { box-shadow: 0 0 24px rgba(16, 185, 129, 0.5); }
}

.test-call-name {
  font-size: 1.1rem;
  font-weight: 700;
}

.test-call-status {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.test-call-duration {
  margin-left: auto;
  font-size: 1.4rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}

/* Visualizer */
.test-call-visualizer {
  display: flex;
  justify-content: center;
  padding: 16px 0;
}

.visualizer-bars {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 48px;
}

.v-bar {
  width: 4px;
  height: 3px;
  background: linear-gradient(180deg, var(--accent-hover), var(--accent));
  border-radius: 2px;
  transition: height 0.08s ease;
}

/* Transcript */
.test-call-transcript {
  max-height: 280px;
  overflow-y: auto;
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tc-message {
  display: flex;
}

.tc-message.user {
  justify-content: flex-end;
}

.tc-message.ai {
  justify-content: flex-start;
}

.tc-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.tc-bubble.ai {
  background: var(--accent-glow);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-bottom-left-radius: 4px;
}

.tc-bubble.user {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-bottom-right-radius: 4px;
}

.tc-bubble.live {
  opacity: 0.6;
  border-style: dashed;
}

.tc-speaker {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
  color: var(--text-muted);
}

/* End button */
.test-call-controls {
  display: flex;
  justify-content: center;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  margin-top: 16px;
}

.test-call-end-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--danger);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
}

.test-call-end-btn:hover {
  background: #dc2626;
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(239, 68, 68, 0.5);
}
