/* ============================================================
   VoiceForge Studio — Design System
   Palette: Deep Space + Electric Lime + Neon Cyan
   Typography: Clash Display (headings) + Syne (UI) + JetBrains Mono (code)
   ============================================================ */

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  /* Colors */
  --bg-base:        #080810;
  --bg-surface:     #0e0e1a;
  --bg-elevated:    #13131f;
  --bg-card:        #16162a;
  --bg-hover:       #1c1c30;
  --bg-active:      #1f1f35;

  --border:         rgba(255,255,255,0.07);
  --border-bright:  rgba(255,255,255,0.14);

  --accent-lime:    #CCFF00;
  --accent-cyan:    #00E5FF;
  --accent-pink:    #FF3CAC;
  --accent-purple:  #7B68EE;

  --text-primary:   #F0EEF8;
  --text-secondary: #8B8BAA;
  --text-muted:     #4A4A6A;
  --text-inverse:   #080810;

  /* Semantic */
  --success:        #CCFF00;
  --warning:        #FFB800;
  --error:          #FF3CAC;
  --info:           #00E5FF;

  /* Spacing */
  --sidebar-w:      240px;
  --topbar-h:       64px;
  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      16px;
  --radius-xl:      24px;

  /* Shadows */
  --shadow-sm:      0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:      0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:      0 8px 32px rgba(0,0,0,0.6);
  --shadow-glow:    0 0 24px rgba(204,255,0,0.15);
  --shadow-cyan:    0 0 24px rgba(0,229,255,0.15);

  /* Transitions */
  --transition:     0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { font-size: 14px; -webkit-font-smoothing: antialiased; }

body {
  font-family: 'Syne', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

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

/* ── Layout ────────────────────────────────────────────────── */
#app {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition-slow);
}

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

.logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, rgba(204,255,0,0.15), rgba(0,229,255,0.15));
  border: 1px solid rgba(204,255,0,0.3);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.logo-text {
  font-family: 'Clash Display', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.logo-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  font-weight: 500;
  color: var(--accent-lime);
  background: rgba(204,255,0,0.1);
  border: 1px solid rgba(204,255,0,0.25);
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-section-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  padding: 0 8px;
  margin-bottom: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--transition);
  margin-bottom: 2px;
  position: relative;
  cursor: pointer;
}

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

.nav-item.active {
  background: linear-gradient(135deg, rgba(204,255,0,0.12), rgba(0,229,255,0.06));
  color: var(--accent-lime);
  border: 1px solid rgba(204,255,0,0.2);
}

.nav-item.active .nav-icon { color: var(--accent-lime); }

.nav-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  transition: color var(--transition);
}

.nav-badge {
  margin-left: auto;
  background: rgba(204,255,0,0.15);
  color: var(--accent-lime);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 20px;
  border: 1px solid rgba(204,255,0,0.2);
}

.nav-live-dot {
  margin-left: auto;
  width: 7px; height: 7px;
  background: var(--accent-lime);
  border-radius: 50%;
  animation: pulse-dot 2s infinite;
}

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

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

.system-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.online { background: var(--accent-lime); box-shadow: 0 0 6px var(--accent-lime); }
.status-dot.offline { background: var(--error); }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent-lime), var(--accent-cyan));
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Clash Display', sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-inverse);
  flex-shrink: 0;
}

.user-info { display: flex; flex-direction: column; }
.user-name { font-size: 12.5px; font-weight: 600; color: var(--text-primary); }
.user-plan { font-size: 11px; color: var(--accent-lime); }

/* ── Main Content ──────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Topbar ────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
}

.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.sidebar-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }

.page-breadcrumb {
  font-family: 'Clash Display', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 20px;
}

.pulse-dot {
  width: 8px; height: 8px;
  background: var(--accent-lime);
  border-radius: 50%;
  animation: pulse-ring 2s infinite;
  flex-shrink: 0;
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(204,255,0,0.6); }
  70% { box-shadow: 0 0 0 6px rgba(204,255,0,0); }
  100% { box-shadow: 0 0 0 0 rgba(204,255,0,0); }
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-lime);
  color: var(--text-inverse);
  border: none;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: 'Syne', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.btn-primary:hover {
  background: #d4ff1a;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(204,255,0,0.35);
}

.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-bright);
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: 'Syne', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-bright);
}

.btn-danger {
  background: rgba(255,60,172,0.15);
  color: var(--error);
  border: 1px solid rgba(255,60,172,0.3);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-family: 'Syne', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-danger:hover { background: rgba(255,60,172,0.25); }

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* ── Pages ─────────────────────────────────────────────────── */
.page {
  display: none;
  padding: 28px;
  flex: 1;
  animation: fadeInUp 0.3s ease;
}

.page.active { display: block; }

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.page-title {
  font-family: 'Clash Display', sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.page-subtitle {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.header-actions { display: flex; align-items: center; gap: 12px; }

/* ── Time Filter ───────────────────────────────────────────── */
.time-filter {
  display: flex;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}

.time-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition);
}

.time-btn.active {
  background: var(--accent-lime);
  color: var(--text-inverse);
}

.time-btn:hover:not(.active) { background: var(--bg-hover); color: var(--text-primary); }

/* ── Stats Grid ────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(204,255,0,0.3), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

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

.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 20px; height: 20px; }
.stat-icon.green { background: rgba(204,255,0,0.12); color: var(--accent-lime); }
.stat-icon.blue { background: rgba(0,229,255,0.12); color: var(--accent-cyan); }
.stat-icon.yellow { background: rgba(255,184,0,0.12); color: var(--warning); }
.stat-icon.purple { background: rgba(123,104,238,0.12); color: var(--accent-purple); }

.stat-content { flex: 1; min-width: 0; }

.stat-value {
  font-family: 'Clash Display', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 6px;
}

.stat-change {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
}
.stat-change.positive { color: var(--accent-lime); }
.stat-change.negative { color: var(--error); }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

.card-title {
  font-family: 'Clash Display', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 4px;
}

.card-link {
  font-size: 12.5px;
  color: var(--accent-lime);
  text-decoration: none;
  font-weight: 600;
  transition: opacity var(--transition);
}
.card-link:hover { opacity: 0.7; }

/* ── Dashboard Grid ────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 16px;
}

/* ── Chart ─────────────────────────────────────────────────── */
.chart-card { }
.chart-container {
  padding: 20px;
  height: 220px;
  position: relative;
}

#volumeCanvas { width: 100% !important; height: 100% !important; }

/* ── Sentiment Donut ───────────────────────────────────────── */
.sentiment-card { }
.sentiment-rings {
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.ring-chart {
  position: relative;
  width: 140px; height: 140px;
}

.donut-svg {
  width: 100%; height: 100%;
  transform: rotate(-90deg);
}

.ring-center {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.ring-value {
  display: block;
  font-family: 'Clash Display', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent-lime);
}

.ring-label {
  font-size: 11px;
  color: var(--text-muted);
}

.sentiment-legend {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.legend-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-item strong {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-primary);
}

/* ── Data Tables ───────────────────────────────────────────── */
.agents-table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}

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

.data-table tbody tr {
  transition: background var(--transition);
  cursor: pointer;
}

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

.agent-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.agent-avatar-sm {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(204,255,0,0.2), rgba(0,229,255,0.2));
  border: 1px solid rgba(204,255,0,0.2);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Clash Display', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-lime);
  flex-shrink: 0;
}

.agent-name-text { font-weight: 600; color: var(--text-primary); font-size: 13px; }
.agent-role-text { font-size: 11px; color: var(--text-muted); }

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-active { background: rgba(204,255,0,0.12); color: var(--accent-lime); border: 1px solid rgba(204,255,0,0.25); }
.badge-inactive { background: rgba(255,255,255,0.05); color: var(--text-muted); border: 1px solid var(--border); }
.badge-positive { background: rgba(204,255,0,0.1); color: var(--accent-lime); border: 1px solid rgba(204,255,0,0.2); }
.badge-negative { background: rgba(255,60,172,0.1); color: var(--error); border: 1px solid rgba(255,60,172,0.2); }
.badge-neutral { background: rgba(123,104,238,0.1); color: var(--accent-purple); border: 1px solid rgba(123,104,238,0.2); }
.badge-completed { background: rgba(0,229,255,0.1); color: var(--accent-cyan); border: 1px solid rgba(0,229,255,0.2); }
.badge-failed { background: rgba(255,60,172,0.1); color: var(--error); border: 1px solid rgba(255,60,172,0.2); }
.badge-in-progress { background: rgba(255,184,0,0.1); color: var(--warning); border: 1px solid rgba(255,184,0,0.2); }

/* ── Skeleton Loading ──────────────────────────────────────── */
.skeleton {
  height: 40px;
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-hover) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-card {
  height: 200px;
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-hover) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Agents Grid ───────────────────────────────────────────── */
.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.agent-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.agent-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-lime), var(--accent-cyan));
  opacity: 0;
  transition: opacity var(--transition);
}

.agent-card:hover { border-color: var(--border-bright); transform: translateY(-3px); box-shadow: var(--shadow-md); }
.agent-card:hover::after { opacity: 1; }

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

.agent-avatar-lg {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(204,255,0,0.2), rgba(0,229,255,0.15));
  border: 1px solid rgba(204,255,0,0.25);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Clash Display', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-lime);
}

.agent-card-name {
  font-family: 'Clash Display', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 3px;
}

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

.agent-card-traits {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 16px;
}

.trait-tag {
  font-size: 10.5px;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 20px;
}

.agent-card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
  padding: 12px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
}

.agent-stat-item { text-align: center; }
.agent-stat-val {
  font-family: 'Clash Display', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}
.agent-stat-lbl { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

.agent-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.agent-voice-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.voice-dot {
  width: 6px; height: 6px;
  background: var(--accent-cyan);
  border-radius: 50%;
}

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

.btn-icon {
  width: 30px; height: 30px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-secondary);
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-bright); }
.btn-icon svg { width: 14px; height: 14px; }

/* ── Phone Cards ───────────────────────────────────────────── */
.phones-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.phone-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition);
}

.phone-card:hover { border-color: var(--border-bright); transform: translateY(-2px); }

.phone-number-display {
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.phone-friendly-name {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.phone-agent-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.phone-agent-link-label { font-size: 11px; color: var(--text-muted); }
.phone-agent-link-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }

.phone-webhook {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  background: var(--bg-elevated);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  word-break: break-all;
  margin-bottom: 12px;
}

.phone-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── Filter Bar ────────────────────────────────────────────── */
.filter-bar { display: flex; gap: 10px; align-items: center; }

.filter-select {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-family: 'Syne', sans-serif;
  font-size: 12.5px;
  cursor: pointer;
  transition: all var(--transition);
  outline: none;
}

.filter-select:hover, .filter-select:focus {
  border-color: var(--border-bright);
  color: var(--text-primary);
}

/* ── Pagination ────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px;
  border-top: 1px solid var(--border);
}

.page-btn {
  width: 32px; height: 32px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex; align-items: center; justify-content: center;
}

.page-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.page-btn.active { background: var(--accent-lime); color: var(--text-inverse); border-color: var(--accent-lime); }

/* ── Analytics ─────────────────────────────────────────────── */
.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.latency-bars { padding: 20px; display: flex; flex-direction: column; gap: 16px; }

.latency-bar-item { }
.latency-bar-item.total .latency-fill { background: linear-gradient(90deg, var(--accent-lime), var(--accent-cyan)); }

.latency-label {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.latency-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-primary);
}

.latency-track {
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px;
  overflow: hidden;
}

.latency-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.latency-fill.stt { background: var(--accent-cyan); }
.latency-fill.llm { background: var(--accent-purple); }
.latency-fill.tts { background: var(--warning); }
.latency-fill.total { background: linear-gradient(90deg, var(--accent-lime), var(--accent-cyan)); }

.top-agents-list { padding: 12px; display: flex; flex-direction: column; gap: 8px; }

.top-agent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.top-agent-rank {
  font-family: 'Clash Display', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-muted);
  width: 24px;
  text-align: center;
}

.top-agent-info { flex: 1; }
.top-agent-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.top-agent-calls { font-size: 11px; color: var(--text-muted); }

.top-agent-score {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--accent-lime);
  font-weight: 500;
}

/* ── Settings ──────────────────────────────────────────────── */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.settings-card { padding: 24px; }

.settings-section-title {
  font-family: 'Clash Display', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.settings-form { display: flex; flex-direction: column; gap: 16px; }

/* ── Forms ─────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }

.form-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.2px;
}

.required { color: var(--error); }

.form-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-family: 'Syne', sans-serif;
  font-size: 13px;
  outline: none;
  transition: all var(--transition);
  width: 100%;
}

.form-input:focus {
  border-color: rgba(204,255,0,0.4);
  box-shadow: 0 0 0 3px rgba(204,255,0,0.08);
}

.form-input::placeholder { color: var(--text-muted); }

select.form-input { cursor: pointer; }
select.form-input option { background: var(--bg-elevated); }

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
}

.form-hint-inline {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--accent-lime);
  margin-left: 6px;
}

.input-with-icon {
  position: relative;
  display: flex;
}

.input-with-icon .form-input { padding-right: 60px; }

.input-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  font-family: 'Syne', sans-serif;
  transition: color var(--transition);
}
.input-toggle:hover { color: var(--text-primary); }

/* ── Range Input ───────────────────────────────────────────── */
.range-input {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: var(--bg-elevated);
  border-radius: 2px;
  outline: none;
  border: none;
  padding: 0;
}

.range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  background: var(--accent-lime);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(204,255,0,0.4);
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8,8,16,0.85);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.open { display: flex; }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(204,255,0,0.05);
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-wide { max-width: 900px; }

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

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

.modal-title {
  font-family: 'Clash Display', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}

.modal-close {
  width: 32px; height: 32px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition);
  flex-shrink: 0;
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ── Wizard Steps ──────────────────────────────────────────── */
.wizard-steps {
  display: flex;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  gap: 0;
}

.wizard-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.step-circle {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  transition: all var(--transition);
}

.wizard-step.active .step-circle {
  background: var(--accent-lime);
  border-color: var(--accent-lime);
  color: var(--text-inverse);
  box-shadow: 0 0 16px rgba(204,255,0,0.4);
}

.wizard-step.completed .step-circle {
  background: rgba(204,255,0,0.15);
  border-color: rgba(204,255,0,0.4);
  color: var(--accent-lime);
}

.step-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  transition: color var(--transition);
}

.wizard-step.active .step-label { color: var(--accent-lime); }
.wizard-step.completed .step-label { color: var(--text-secondary); }

.wizard-connector {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin-bottom: 18px;
  transition: background var(--transition);
}

.wizard-connector.completed { background: rgba(204,255,0,0.3); }

/* ── Wizard Body ───────────────────────────────────────────── */
.wizard-body { padding: 24px; min-height: 380px; }

.wizard-panel { display: none; animation: fadeInUp 0.25s ease; }
.wizard-panel.active { display: block; }

.step-intro {
  text-align: center;
  margin-bottom: 24px;
}

.step-icon-large {
  font-size: 40px;
  margin-bottom: 10px;
  display: block;
}

.step-intro h3 {
  font-family: 'Clash Display', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.step-intro p {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 400px;
  margin: 0 auto;
}

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

/* ── Trait Picker ──────────────────────────────────────────── */
.trait-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.trait-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 20px;
  font-family: 'Syne', sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.trait-btn:hover { border-color: var(--border-bright); color: var(--text-secondary); }

.trait-btn.active {
  background: rgba(204,255,0,0.12);
  border-color: rgba(204,255,0,0.35);
  color: var(--accent-lime);
}

/* ── Voice Grid ────────────────────────────────────────────── */
.voice-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.voice-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.voice-card:hover { border-color: var(--border-bright); }

.voice-card.active {
  border-color: rgba(204,255,0,0.4);
  background: rgba(204,255,0,0.06);
}

.voice-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Clash Display', sans-serif;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.voice-avatar.female { background: rgba(255,60,172,0.2); color: var(--error); }
.voice-avatar.male { background: rgba(0,229,255,0.2); color: var(--accent-cyan); }

.voice-info { flex: 1; min-width: 0; }
.voice-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.voice-meta { font-size: 11px; color: var(--text-muted); }

.voice-play-btn {
  width: 28px; height: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 10px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.voice-play-btn:hover { background: var(--accent-lime); color: var(--text-inverse); border-color: var(--accent-lime); }

.voice-selected-check {
  position: absolute;
  top: 8px; right: 8px;
  width: 18px; height: 18px;
  background: var(--accent-lime);
  border-radius: 50%;
  display: none;
  align-items: center; justify-content: center;
  font-size: 10px;
  color: var(--text-inverse);
  font-weight: 700;
}

.voice-card.active .voice-selected-check { display: flex; }

.voice-settings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

/* ── Prompt Textarea ───────────────────────────────────────── */
.prompt-toolbar {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.prompt-tool-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  cursor: pointer;
  transition: all var(--transition);
  font-family: 'Syne', sans-serif;
}
.prompt-tool-btn:hover { border-color: var(--border-bright); color: var(--text-secondary); }

.prompt-textarea {
  min-height: 180px;
  resize: vertical;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  line-height: 1.6;
}

.prompt-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.prompt-tip { color: var(--text-muted); font-style: italic; }

.behavior-settings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

/* ── Deploy Summary ────────────────────────────────────────── */
.deploy-summary {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.summary-row:last-child { border-bottom: none; }

.summary-label { font-size: 12px; color: var(--text-muted); }
.summary-value { font-size: 13px; font-weight: 600; color: var(--text-primary); }

.webhook-display {
  background: var(--bg-elevated);
  border: 1px solid rgba(204,255,0,0.2);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
}

.webhook-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--accent-lime);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.webhook-url-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.webhook-url {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: var(--text-secondary);
  word-break: break-all;
  flex: 1;
}

.copy-btn {
  background: rgba(204,255,0,0.12);
  border: 1px solid rgba(204,255,0,0.25);
  color: var(--accent-lime);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  font-family: 'Syne', sans-serif;
}
.copy-btn:hover { background: rgba(204,255,0,0.2); }

.webhook-hint { font-size: 11px; color: var(--text-muted); }

/* ── Modal Footer ──────────────────────────────────────────── */
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.wizard-progress {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Call Detail Modal ─────────────────────────────────────── */
.call-detail-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 400px;
}

.call-meta-panel {
  padding: 20px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.call-meta-item { }
.call-meta-label { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 3px; font-family: 'JetBrains Mono', monospace; }
.call-meta-value { font-size: 13px; color: var(--text-primary); font-weight: 500; }

.transcript-panel { padding: 20px; }

.transcript-title {
  font-family: 'Clash Display', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.transcript-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
}

.transcript-msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.transcript-msg.user { flex-direction: row-reverse; }

.msg-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

.transcript-msg.agent .msg-avatar { background: rgba(204,255,0,0.15); color: var(--accent-lime); }
.transcript-msg.user .msg-avatar { background: rgba(0,229,255,0.15); color: var(--accent-cyan); }

.msg-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.5;
}

.transcript-msg.agent .msg-bubble {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 4px var(--radius-md) var(--radius-md) var(--radius-md);
}

.transcript-msg.user .msg-bubble {
  background: rgba(0,229,255,0.08);
  border: 1px solid rgba(0,229,255,0.15);
  color: var(--text-primary);
  border-radius: var(--radius-md) 4px var(--radius-md) var(--radius-md);
}

/* ── Toast ─────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  color: var(--text-primary);
  min-width: 280px;
  animation: toastIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.success { border-left: 3px solid var(--accent-lime); }
.toast.error { border-left: 3px solid var(--error); }
.toast.info { border-left: 3px solid var(--accent-cyan); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .analytics-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }

  .sidebar {
    transform: translateX(-240px);
    width: 240px;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .main-content { margin-left: 0; }
  .sidebar-toggle { display: flex; }

  .call-detail-grid { grid-template-columns: 1fr; }
  .call-meta-panel { border-right: none; border-bottom: 1px solid var(--border); }
}

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr; }
  .page { padding: 16px; }
  .topbar { padding: 0 16px; }
  .voice-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .behavior-settings { grid-template-columns: 1fr; }
  .voice-settings { grid-template-columns: 1fr; }
}

/* ── Utility ───────────────────────────────────────────────── */
.text-mono { font-family: 'JetBrains Mono', monospace; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent-lime); }
.text-cyan { color: var(--accent-cyan); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Noise Texture Overlay ─────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
}

/* ── Grid Lines Background ─────────────────────────────────── */
.main-content::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

.page, .topbar, .sidebar { position: relative; z-index: 1; }