/* JaxoVoice — app shell (sidebar + topbar) styles */

.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  background: var(--bg-muted);
}
.app[data-collapsed="true"] { grid-template-columns: 64px 1fr; }

/* Sidebar */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 20;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 60px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.sidebar-brand .mark {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, var(--navy-700), var(--cyan-500));
  border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  color: white;
  flex: 0 0 28px;
  position: relative;
  overflow: hidden;
}
.sidebar-brand .mark svg { width: 16px; height: 16px; }
.sidebar-brand .name {
  font-weight: var(--fw-bold);
  font-size: var(--fs-15);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.sidebar-brand .name b { color: var(--accent); }

.sidebar-section {
  padding: 12px 8px;
  display: flex; flex-direction: column; gap: 2px;
}
.sidebar-section-label {
  font-size: 11px;
  font-weight: var(--fw-medium);
  color: var(--text-faint);
  padding: 4px 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.app[data-collapsed="true"] .sidebar-section-label { display: none; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--r-md);
  color: var(--text-muted);
  font-size: var(--fs-14);
  font-weight: var(--fw-medium);
  text-decoration: none;
  position: relative;
  cursor: pointer;
  white-space: nowrap;
}
.sidebar-link:hover { background: var(--bg-subtle); color: var(--text); text-decoration: none; }
.sidebar-link.active { background: var(--primary-soft); color: var(--primary); }
[data-theme="dark"] .sidebar-link.active { color: #93B4FF; }
.sidebar-link .icon-w { width: 18px; height: 18px; flex: 0 0 18px; display: inline-flex; align-items: center; justify-content: center; }
.sidebar-link .badge-count {
  margin-left: auto;
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: var(--fw-medium);
  padding: 1px 6px;
  border-radius: 999px;
}
.sidebar-link.active .badge-count { background: white; color: var(--primary); }
.app[data-collapsed="true"] .sidebar-link .label,
.app[data-collapsed="true"] .sidebar-link .badge-count { display: none; }
.app[data-collapsed="true"] .sidebar-link { justify-content: center; padding: 8px; }

.sidebar-divider { height: 1px; background: var(--border); margin: 8px 16px; }
.sidebar-spacer { flex: 1; }

.sidebar-user {
  padding: 10px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  cursor: pointer;
  border-radius: 0;
}
.sidebar-user:hover { background: var(--bg-subtle); }
.sidebar-user .meta { display: flex; flex-direction: column; min-width: 0; }
.sidebar-user .name { font-size: var(--fs-13); font-weight: var(--fw-semi); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .org { font-size: var(--fs-12); color: var(--text-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app[data-collapsed="true"] .sidebar-user .meta,
.app[data-collapsed="true"] .sidebar-user .chev { display: none; }
.app[data-collapsed="true"] .sidebar-user { justify-content: center; }
.sidebar-user .chev { margin-left: auto; color: var(--text-faint); }

/* Main */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: var(--fs-14); color: var(--text-muted); min-width: 0; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb .sep { color: var(--text-faint); }
.breadcrumb .current { color: var(--text); font-weight: var(--fw-medium); }
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-search { width: 280px; position: relative; }

.content { padding: 28px 32px 64px; max-width: var(--content-max); width: 100%; margin: 0 auto; }
.content-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.content-title { font-size: var(--fs-24); font-weight: var(--fw-semi); letter-spacing: -0.015em; }
.content-subtitle { color: var(--text-muted); font-size: var(--fs-14); margin-top: 4px; }

/* Page section spacing */
.page-section { margin-bottom: 32px; }
.page-section-title { font-size: var(--fs-15); font-weight: var(--fw-semi); margin-bottom: 12px; }

/* Empty state */
.empty {
  text-align: center;
  padding: 64px 24px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.empty-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: var(--bg-subtle);
  color: var(--text-subtle);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 4px;
}
.empty-title { font-size: var(--fs-16); font-weight: var(--fw-semi); }
.empty-desc { color: var(--text-muted); max-width: 360px; }

/* Stat card */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 1024px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 6px;
  box-shadow: var(--shadow-xs);
}
.stat-label { font-size: var(--fs-12); color: var(--text-subtle); font-weight: var(--fw-medium); text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-size: var(--fs-28); font-weight: var(--fw-semi); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-delta { font-size: var(--fs-12); color: var(--text-muted); }
.stat-delta.up { color: var(--green-600); }
.stat-delta.down { color: var(--red-600); }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
  animation: fade-in 150ms ease;
}
[data-theme="dark"] .modal-backdrop { background: rgba(0,0,0,0.6); }
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
  width: min(480px, 92vw);
  max-height: 90vh;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: var(--fs-16); font-weight: var(--fw-semi); }
.modal-body { padding: 20px; overflow: auto; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: var(--bg-muted); }

/* Tooltip-style row error */
.tooltip-cell { cursor: help; border-bottom: 1px dotted var(--text-faint); }

/* Voice activity dot */
.voice-dot {
  width: 8px; height: 8px;
  background: var(--cyan-500);
  border-radius: 50%;
  display: inline-block;
  position: relative;
}
.voice-dot::before, .voice-dot::after {
  content: ''; position: absolute; inset: 0;
  border-radius: 50%;
  background: var(--cyan-500);
  opacity: 0.5;
  animation: voice-pulse 1.6s ease-out infinite;
}
.voice-dot::after { animation-delay: 0.8s; }
@keyframes voice-pulse {
  0% { transform: scale(1); opacity: 0.5; }
  100% { transform: scale(2.5); opacity: 0; }
}

/* Mini bar waveform (animated for active calls) */
.bars { display: inline-flex; align-items: center; gap: 2px; height: 14px; }
.bars span {
  width: 2px;
  background: var(--cyan-500);
  border-radius: 2px;
  animation: bars-bounce 900ms ease-in-out infinite;
}
.bars span:nth-child(1) { height: 30%; animation-delay: 0ms; }
.bars span:nth-child(2) { height: 70%; animation-delay: 120ms; }
.bars span:nth-child(3) { height: 100%; animation-delay: 240ms; }
.bars span:nth-child(4) { height: 60%; animation-delay: 360ms; }
.bars span:nth-child(5) { height: 40%; animation-delay: 480ms; }
@keyframes bars-bounce {
  0%, 100% { transform: scaleY(0.4); }
  50% { transform: scaleY(1); }
}
