:root {
  --sidebar-w: 220px;
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-hover: #1e293b;
  --sidebar-active-text: #f1f5f9;
  --accent: #06b6d4;
  --page-bg: #f1f5f9;
  --card-bg: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -1px rgba(0,0,0,.04);
}

/* ── Base ─────────────────────────────────────────────────────────── */
body {
  background: var(--page-bg);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: .9rem;
}

/* ── Sidebar ──────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 200;
}

.sidebar-brand {
  padding: 1.375rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
  text-decoration: none;
  display: block;
}

.sidebar-brand-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: -.3px;
}

.sidebar-brand-text span { color: var(--accent); }

.sidebar-nav {
  flex: 1;
  padding: 1.25rem 0 .75rem;
  overflow-y: auto;
}

.sidebar-section {
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #475569;
  padding: .15rem 1.25rem .5rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .575rem 1.25rem;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: .85rem;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s;
}

.sidebar-link:hover {
  background: var(--sidebar-hover);
  color: #e2e8f0;
}

.sidebar-link.active {
  background: var(--sidebar-hover);
  color: var(--sidebar-active-text);
  border-left-color: var(--accent);
}

.sidebar-link i { font-size: .95rem; width: 1.1rem; flex-shrink: 0; }

.sidebar-footer {
  padding: .875rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex;
  flex-direction: column;
  gap: .375rem;
}

.sidebar-footer-link {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .45rem 0;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: .8rem;
  background: none;
  border: none;
  cursor: pointer;
  transition: color .15s;
  width: 100%;
  text-align: left;
}

.sidebar-footer-link:hover { color: #e2e8f0; }
.sidebar-footer-link i { font-size: .85rem; width: 1.1rem; }

.lang-row {
  display: flex;
  align-items: center;
  gap: .25rem;
  padding: .35rem 0;
}

.lang-row a {
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: .75rem;
  padding: .1rem .3rem;
  border-radius: 4px;
  transition: color .15s, background .15s;
}

.lang-row a:hover { color: #e2e8f0; background: var(--sidebar-hover); }
.lang-row .sep { color: #334155; }

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

.content-area {
  padding: 2rem;
  flex: 1;
}

.page-header {
  margin-bottom: 1.75rem;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -.2px;
}

/* ── Cards ────────────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.card-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .875rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ── Stat cards ───────────────────────────────────────────────────── */
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 1.25rem 1.375rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-icon {
  width: 42px; height: 42px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.stat-icon.teal   { background: #ecfeff; color: #06b6d4; }
.stat-icon.blue   { background: #eff6ff; color: #3b82f6; }
.stat-icon.green  { background: #f0fdf4; color: #22c55e; }
.stat-icon.purple { background: #faf5ff; color: #a855f7; }
.stat-icon.amber  { background: #fffbeb; color: #f59e0b; }

.stat-body {}

.stat-label {
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: .2rem;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text-primary);
  letter-spacing: -.5px;
}

/* ── Tables ───────────────────────────────────────────────────────── */
.table {
  margin: 0;
  font-size: .85rem;
}

.table thead th {
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: transparent;
  border-bottom: 1px solid var(--border);
  padding: .75rem 1.125rem;
  white-space: nowrap;
}

.table tbody td {
  padding: .85rem 1.125rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

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

.table-hover tbody tr:hover td { background: #f8fafc; }

/* ── Badges ───────────────────────────────────────────────────────── */
.badge {
  font-size: .68rem;
  font-weight: 500;
  padding: .3em .65em;
  border-radius: 5px;
}

/* ── Forms ────────────────────────────────────────────────────────── */
.form-control, .form-select {
  border-color: var(--border);
  font-size: .85rem;
  border-radius: 7px;
  color: var(--text-primary);
}

.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(6,182,212,.1);
}

.form-label {
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn { border-radius: 7px; font-size: .85rem; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
}
.btn-primary:hover { background: #0891b2; border-color: #0891b2; }

.btn-outline-secondary {
  border-color: var(--border);
  color: var(--text-secondary);
}
.btn-outline-secondary:hover {
  background: var(--page-bg);
  border-color: #cbd5e1;
  color: var(--text-primary);
}

.btn-sm { font-size: .78rem; padding: .3rem .7rem; }

/* ── Alerts ───────────────────────────────────────────────────────── */
.alert { border-radius: 9px; font-size: .85rem; border: 1px solid transparent; }

/* ── Call detail ──────────────────────────────────────────────────── */
.detail-grid dt {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
}

.detail-grid dd {
  color: var(--text-secondary);
  font-size: .9rem;
}

.transcript-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 1.25rem;
  font-size: .84rem;
  line-height: 1.7;
  white-space: pre-wrap;
  color: var(--text-secondary);
  max-height: 500px;
  overflow-y: auto;
}

/* ── Cache freshness badge ────────────────────────────────────────── */
.cache-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .72rem;
  color: var(--text-muted);
  background: var(--page-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .25rem .7rem;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}

.cache-badge:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Login ────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: white;
  border-radius: 14px;
  padding: 2.5rem;
  width: 380px;
  box-shadow: 0 25px 60px rgba(0,0,0,.35);
}

.login-brand {
  text-align: center;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1.875rem;
  letter-spacing: -.3px;
}

.login-brand span { color: var(--accent); }
