/* ═══════════════════════════════════════════════════════════
   VENKANNA MOTORS — Voice Agent UI
   Hero Red Brand · Premium Dark Sidebar · Light/Dark Content
   ═══════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --red:        #D0021B;
  --red-h:      #b00217;
  --red-glow:   rgba(208,2,27,.22);
  --red-sub:    rgba(208,2,27,.09);
  --red-border: rgba(208,2,27,.28);
  --sidebar-w:  220px;
  --r:          10px;
  --r-sm:       7px;
  --t:          .18s ease;

  /* Sidebar always dark */
  --sb-bg:      #111114;
  --sb-border:  #232328;
  --sb-text:    #c0c0c8;
  --sb-muted:   #55555e;
  --sb-active-bg: rgba(208,2,27,.12);
}

/* Light theme */
[data-theme="light"] {
  --bg:       #f3f4f7;
  --surface:  #ffffff;
  --surf2:    #f0f2f6;
  --surf3:    #e6eaf0;
  --border:   #dde2ea;
  --border2:  #c5cdd8;
  --text:     #0f1117;
  --muted:    #5c6778;
  --faint:    #a8b3c0;
  --shadow:   0 1px 3px rgba(15,17,23,.06), 0 4px 14px rgba(15,17,23,.07);
  --code-bg:  #edf0f5;
}

/* Dark theme */
[data-theme="dark"] {
  --bg:       #0e0e10;
  --surface:  #18181c;
  --surf2:    #202025;
  --surf3:    #27272d;
  --border:   #2c2c32;
  --border2:  #3a3a42;
  --text:     #ededf0;
  --muted:    #888890;
  --faint:    #44444c;
  --shadow:   0 2px 16px rgba(0,0,0,.4);
  --code-bg:  #27272d;
}

/* ── Base ──────────────────────────────────────────────────── */
html, body { height: 100%; overflow: hidden; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  transition: background var(--t), color var(--t);
}

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

/* ── Shell ─────────────────────────────────────────────────── */
.shell { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sb-bg);
  border-right: 1px solid var(--sb-border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  z-index: 100;
  transition: left .25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 22px 18px 20px;
  border-bottom: 1px solid var(--sb-border);
}

.brand-logo { flex-shrink: 0; display: flex; align-items: center; }

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
}

.brand-name {
  font-size: 12.5px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -.01em;
}

.brand-sub {
  font-size: 10.5px;
  color: var(--sb-muted);
  white-space: nowrap;
}

.brand-tag {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--red);
  text-transform: uppercase;
  margin-top: 1px;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 14px 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 18px;
  text-decoration: none;
  color: var(--sb-text);
  font-size: 13px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all .14s ease;
  cursor: pointer;
}

.nav-item:hover { color: #fff; background: rgba(255,255,255,.05); }

.nav-item.active {
  color: #fff;
  background: var(--sb-active-bg);
  border-left-color: var(--red);
}

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

/* Footer */
.sidebar-footer {
  padding: 14px 0;
  border-top: 1px solid var(--sb-border);
}

.theme-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 18px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--sb-text);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  transition: color .14s;
  text-align: left;
}
.theme-toggle:hover { color: #fff; }
.theme-icon { display: flex; align-items: center; width: 16px; height: 16px; flex-shrink: 0; }

/* ── Mobile ────────────────────────────────────────────────── */
.mobile-header {
  display: none;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.mobile-title { font-size: 14px; font-weight: 700; color: var(--text); }

.hamburger {
  background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; gap: 5px; padding: 3px;
}
.hamburger span { display: block; width: 18px; height: 2px; background: var(--text); border-radius: 2px; }

.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.55); z-index: 99; backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* ── Main ──────────────────────────────────────────────────── */
.main {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ── Page ──────────────────────────────────────────────────── */
.page {
  flex: 1;
  padding: 32px 36px;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  animation: fadeUp .2s ease;
}
.page.hidden { display: none; }

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

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

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
  margin-bottom: 3px;
}
.page-sub { font-size: 13px; color: var(--muted); }

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

/* ── Tabs ──────────────────────────────────────────────────── */
.tabs-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: var(--muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color .14s, border-color .14s;
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--red); border-bottom-color: var(--red); }
.tab-btn.active svg { stroke: var(--red); }

.tab-panel { }
.tab-panel.hidden { display: none; }

/* ── Section Card ──────────────────────────────────────────── */
.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  transition: background var(--t), border-color var(--t), box-shadow var(--t);
}
.section-card.no-pad { padding: 0; }
.section-card.voice-card { display: flex; flex-direction: column; gap: 24px; }

.section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.section-row.pad { padding: 16px 20px; border-bottom: 1px solid var(--border); margin-bottom: 0; }

.section-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--muted);
  text-transform: uppercase;
}

.section-divider {
  text-align: center;
  font-size: 12px;
  color: var(--faint);
  margin: 16px 0;
  position: relative;
}
.section-divider::before, .section-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 42%;
  height: 1px;
  background: var(--border);
}
.section-divider::before { left: 0; }
.section-divider::after  { right: 0; }

/* ── Drop Zone ─────────────────────────────────────────────── */
.drop-zone {
  border: 1.5px dashed var(--border2);
  border-radius: var(--r-sm);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--red);
  background: var(--red-sub);
}
.drop-zone svg { stroke: var(--muted); transition: stroke .15s; }
.drop-zone:hover svg, .drop-zone.dragover svg { stroke: var(--red); }
.drop-zone p { font-size: 13px; color: var(--muted); }
.drop-hint { font-size: 12px !important; color: var(--faint) !important; }
.drop-zone code { font-size: 11px; background: var(--code-bg); padding: 2px 6px; border-radius: 4px; font-family: monospace; }
.link-text { color: var(--red); cursor: pointer; font-weight: 500; }
.link-text:hover { text-decoration: underline; }
.upload-status { font-size: 12px; font-weight: 500; color: var(--red); min-height: 16px; }

/* ── Form Fields ───────────────────────────────────────────── */
.field-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.field-hint { font-size: 12px; color: var(--faint); margin-top: 6px; }

.input-row { display: flex; gap: 8px; }

.manual-fields {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}
.manual-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.manual-field--add {
  display: flex;
  align-items: flex-end;
}
.manual-field--add .btn-primary {
  height: 38px;
  white-space: nowrap;
}
/* manual-fields collapse handled in responsive section below */

.text-input {
  flex: 1;
  height: 38px;
  padding: 0 13px;
  background: var(--surf2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border-color .14s;
}
.text-input:focus { border-color: var(--red); }
.text-input::placeholder { color: var(--faint); }

/* ── Phone Tags ────────────────────────────────────────────── */
.phone-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  min-height: 0;
}

.phone-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--surf2);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 12.5px;
  color: var(--text);
  font-weight: 500;
  animation: tagIn .15s ease;
}
@keyframes tagIn { from { opacity:0; transform:scale(.9); } to { opacity:1; transform:scale(1); } }

.tag-remove {
  background: none; border: none; cursor: pointer;
  color: var(--faint); display: flex; align-items: center;
  padding: 0; transition: color .12s;
}
.tag-remove:hover { color: var(--red); }

/* ── Buttons ───────────────────────────────────────────────── */
.btn-primary {
  height: 38px;
  padding: 0 18px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .14s, box-shadow .14s;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--red-h); box-shadow: 0 4px 14px var(--red-glow); }
.btn-primary.btn-sm { height: 32px; padding: 0 14px; font-size: 12px; }

.btn-ghost {
  height: 32px;
  padding: 0 12px;
  background: none;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all .14s;
  white-space: nowrap;
}
.btn-ghost:hover { color: var(--text); border-color: var(--border2); background: var(--surf2); }
.btn-ghost.btn-sm { height: 30px; }

.btn-action {
  width: 100%;
  height: 44px;
  margin-top: 18px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  transition: background .14s, box-shadow .14s, opacity .14s;
}
.btn-action:hover:not(:disabled) { background: var(--red-h); box-shadow: 0 4px 20px var(--red-glow); }
.btn-action:disabled { opacity: .4; cursor: not-allowed; }

.icon-btn {
  background: none; border: none; cursor: pointer;
  color: var(--muted); display: flex; align-items: center;
  padding: 4px; border-radius: 5px; transition: color .13s, background .13s;
}
.icon-btn:hover { color: var(--text); background: var(--surf2); }

/* ── Inline error ──────────────────────────────────────────── */
.inline-error { font-size: 12.5px; color: #e53935; margin-top: 10px; }
.error-inline { font-size: 12.5px; color: #e53935; margin-top: 4px; }

/* ── Call Results / Batch Status ───────────────────────────── */
.batch-status {
  margin-top: 14px;
  padding: 13px 16px;
  background: var(--surf2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  animation: fadeUp .2s ease;
}

.batch-msg {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text); font-weight: 500;
}

.batch-id {
  font-size: 11.5px;
  color: var(--faint);
  font-family: monospace;
}

.batch-bar {
  margin-top: 10px;
  height: 38px;
  background: var(--red-sub);
  border: 1px solid var(--red-border);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--red);
  animation: fadeUp .2s ease;
}

.batch-bar span { color: var(--muted); font-weight: 400; }

/* ── Status Pill ───────────────────────────────────────────── */
.voice-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 13px;
  background: var(--surf2);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 12.5px; font-weight: 500; color: var(--muted);
  transition: all var(--t);
}

.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--faint); flex-shrink: 0;
  transition: background .3s;
}
.status-dot.connecting  { background: #f5a623; box-shadow: 0 0 5px #f5a62355; }
.status-dot.listening   { background: #4a90d9; box-shadow: 0 0 5px #4a90d955; }
.status-dot.thinking    { background: #9b59b6; box-shadow: 0 0 5px #9b59b655; }
.status-dot.speaking    { background: #27ae60; box-shadow: 0 0 5px #27ae6055; }
.status-dot.idle        { background: #27ae60; box-shadow: 0 0 5px #27ae6055; }

/* ── Call Stage ────────────────────────────────────────────── */
.voice-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
}

.call-ring-wrap {
  position: relative;
  width: 130px; height: 130px;
  display: flex; align-items: center; justify-content: center;
}

.call-ring-wrap.live::before,
.call-ring-wrap.live::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 2px solid var(--red);
  animation: pulseRing 2.4s ease-out infinite;
  pointer-events: none;
}
.call-ring-wrap.live::after { animation-delay: 1.2s; }

@keyframes pulseRing {
  0%   { transform: scale(1);    opacity: .65; }
  100% { transform: scale(1.65); opacity: 0; }
}

.call-btn {
  width: 110px; height: 110px;
  border-radius: 50%;
  background: var(--red);
  border: none; cursor: pointer; color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px;
  box-shadow: 0 8px 28px var(--red-glow);
  transition: transform .18s, box-shadow .18s, background .18s;
  position: relative; z-index: 1;
}
.call-btn:hover { transform: scale(1.06); box-shadow: 0 12px 36px rgba(208,2,27,.38); background: var(--red-h); }
.call-btn:active { transform: scale(.97); }
.call-btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.call-btn.in-call { background: var(--surf3); border: 1.5px solid var(--border2); box-shadow: none; cursor: default; }
.call-btn-label { font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }

.call-hint { font-size: 12.5px; color: var(--muted); text-align: center; }

.call-controls {
  display: flex; gap: 10px; align-items: center;
  opacity: 0; transform: translateY(6px);
  pointer-events: none;
  transition: opacity .22s, transform .22s;
}
.call-controls.visible { opacity: 1; transform: none; pointer-events: all; }

.ctrl-btn {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 18px;
  border-radius: 100px;
  font-size: 12.5px; font-weight: 600; font-family: inherit;
  cursor: pointer;
  border: 1px solid var(--border2);
  background: var(--surf2);
  color: var(--muted);
  transition: all .14s;
}
.ctrl-btn:hover { background: var(--surf3); color: var(--text); }
.ctrl-btn.mute-btn.muted { background: var(--red-sub); border-color: var(--red-border); color: var(--red); }
.ctrl-btn.end-btn { background: var(--red); border-color: var(--red); color: #fff; }
.ctrl-btn.end-btn:hover { background: var(--red-h); box-shadow: 0 4px 14px var(--red-glow); }

/* ── Transcript ────────────────────────────────────────────── */
.transcript-card {
  background: var(--surf2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  overflow: hidden;
}

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

.transcript-title {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600; color: var(--text);
  letter-spacing: .01em;
}
.transcript-title svg { stroke: var(--muted); }

#transcript-count { font-size: 11.5px; color: var(--faint); }

.transcript-body {
  height: 280px; overflow-y: auto;
  padding: 16px; display: flex; flex-direction: column; gap: 10px;
}

.transcript-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; height: 100%; color: var(--faint); text-align: center;
}
.transcript-empty svg { stroke: var(--faint); opacity: .5; }
.transcript-empty p { font-size: 12.5px; color: var(--muted); max-width: 220px; line-height: 1.5; }

.message { display: flex; flex-direction: column; gap: 3px; max-width: 72%; animation: msgIn .18s ease; }
@keyframes msgIn { from { opacity:0; transform:translateY(3px); } to { opacity:1; transform:none; } }
.message.agent { align-self: flex-start; }
.message.user  { align-self: flex-end; }
.message .role { font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; padding: 0 3px; }
.message.agent .role { color: var(--muted); }
.message.user  .role { color: var(--red); text-align: right; }
.message .text {
  font-size: 13px; line-height: 1.5;
  padding: 9px 13px;
  border-radius: 3px 13px 13px 13px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
}
.message.user .text {
  background: var(--red-sub); border-color: var(--red-border);
  border-radius: 13px 3px 13px 13px;
}
.message .text.partial { opacity: .5; }

/* ── Filter Panel ──────────────────────────────────────────── */
.filter-panel {
  padding: 16px 20px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
}
.filter-field { display: flex; flex-direction: column; gap: 6px; }
.filter-label {
  font-size: 10px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
}
.filter-text, .filter-select {
  height: 34px; font-size: 13px;
  background: var(--surf2); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 0 10px;
  transition: border-color .15s;
}
.filter-text:focus, .filter-select:focus {
  outline: none; border-color: var(--red);
}
.filter-select { cursor: pointer; }
.btn-filter-active {
  background: rgba(208,2,27,.1) !important;
  color: var(--red) !important;
  border-color: var(--red) !important;
}

/* ── Logs Page — full width, no max-width constraint ───────── */
#page-logs {
  max-width: none;
  padding: 32px 0 0;
}
#page-logs .page-header {
  padding: 0 36px 24px;
}

/* ── Logs bordered container ───────────────────────────────── */
.logs-container {
  margin: 0 36px 32px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

/* ── Logs Table ────────────────────────────────────────────── */
.logs-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.logs-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--muted);
}

.calls-table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
.calls-table th {
  padding: 10px 20px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--surf2);
}
.calls-table td {
  padding: 13px 20px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
}
.calls-table tr:last-child td { border-bottom: none; }
.calls-table tbody tr { cursor: pointer; transition: background .12s; }
.calls-table tbody tr:hover { background: var(--surf2); }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 100px;
  font-size: 11px; font-weight: 600;
  background: var(--surf3); color: var(--muted);
}
.badge.joined    { background: rgba(39,174,96,.12);  color: #27ae60; }
.badge.ended     { background: rgba(39,174,96,.12);  color: #27ae60; }
.badge.no_answer { background: rgba(245,166,35,.1);  color: #e8900a; }
.badge.failed    { background: rgba(229,57,53,.1);   color: #e53935; }
.badge.webRtc    { background: rgba(74,144,217,.1);  color: #4a90d9; }
.badge.plivo     { background: rgba(155,89,182,.1);  color: #9b59b6; }
/* sentiment */
.badge.positive  { background: rgba(39,174,96,.12);  color: #27ae60; }
.badge.negative  { background: rgba(229,57,53,.1);   color: #e53935; }
.badge.neutral   { background: rgba(180,180,180,.12);color: #888;    }
/* callback */
.badge.cb-yes    { background: rgba(229,57,53,.1);   color: #e53935; font-weight: 700; }
.badge.cb-no     { background: rgba(39,174,96,.12);  color: #27ae60; }

.table-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--muted);
}

/* ── Loader spinner ─────────────────────────────────────────── */
.loader-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 64px 24px;
  color: var(--muted);
  font-size: 13px;
}
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 60px 20px; text-align: center;
}
.empty-state svg { stroke: var(--faint); }
.empty-state p { font-size: 13px; color: var(--muted); max-width: 260px; line-height: 1.5; }

/* ── Transcript Drawer ─────────────────────────────────────── */
.drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 200;
  backdrop-filter: blur(2px);
}
.drawer {
  position: fixed; right: 0; top: 0; bottom: 0;
  width: 420px; max-width: 95vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 201;
  display: flex; flex-direction: column;
  animation: slideIn .22s ease;
}
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }

.drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.drawer-title { font-size: 17px; font-weight: 700; color: var(--text); line-height: 1.2; }
.drawer-meta  { font-size: 12px; color: var(--muted); margin-top: 3px; }
.drawer-body  { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 16px; }

.drawer-section-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .08em;
  color: var(--muted); text-transform: uppercase; margin-bottom: 8px;
}
.drawer-audio {
  width: 100%; height: 36px;
  border-radius: 8px;
  accent-color: var(--red);
}
.drawer-transcript { display: flex; flex-direction: column; gap: 8px; }

/* ── Usage / Stats ─────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px 16px;
  box-shadow: var(--shadow);
  transition: background var(--t), border-color var(--t), box-shadow var(--t);
}
.stat-val { font-size: 24px; font-weight: 800; color: var(--text); letter-spacing: -.02em; margin-bottom: 4px; }
.stat-key { font-size: 11.5px; color: var(--muted); font-weight: 500; }

.daily-chart-wrap { padding: 20px 24px 28px; }
.daily-chart-wrap canvas { width: 100% !important; height: 320px !important; }

/* ── Form Controls ─────────────────────────────────────────── */
.date-input, .select-input {
  height: 32px; padding: 0 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 12.5px; font-family: inherit; color: var(--text);
  outline: none; transition: border-color .14s;
  cursor: pointer;
}
.date-input:focus, .select-input:focus { border-color: var(--red); }

/* ── Utility ───────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Responsive ────────────────────────────────────────────── */

/* ── Tablet: 769–1024px ─────────────────────────────────────── */
@media (min-width: 769px) and (max-width: 1024px) {
  .page { padding: 24px; }
  #page-logs { padding: 24px 0 0; }
  #page-logs .page-header { padding: 0 24px 18px; }
  .logs-container { margin: 0 24px 28px; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .filter-grid { grid-template-columns: repeat(3, 1fr); }
  .daily-chart-wrap canvas { height: 280px !important; }
}

/* ── Mobile / small tablet: ≤ 768px ────────────────────────── */
@media (max-width: 768px) {
  /* Sidebar — slide off-screen, toggle via hamburger */
  .sidebar {
    position: fixed; left: -100%; top: 0; height: 100%;
    transition: left .25s ease; z-index: 200;
  }
  .sidebar.open { left: 0; box-shadow: 4px 0 24px rgba(0,0,0,.35); }
  .mobile-header { display: flex; }

  /* Page layout */
  .page { padding: 16px; }
  .page-header { flex-direction: column; gap: 10px; margin-bottom: 16px; }
  .page-title { font-size: 18px; }
  .page-sub { font-size: 12.5px; }
  .header-actions { width: 100%; flex-wrap: wrap; gap: 6px; }

  /* Logs page overrides */
  #page-logs { padding: 0; }
  #page-logs .page-header { padding: 16px 14px 12px; }
  .logs-container { margin: 0 12px 20px; }
  .logs-footer { padding: 10px 14px; flex-wrap: wrap; gap: 8px; }
  .calls-table th,
  .calls-table td { padding: 10px 12px; font-size: 12.5px; }

  /* Filter panel */
  .filter-panel { padding: 14px 14px 16px; }
  .filter-grid { grid-template-columns: 1fr 1fr; gap: 10px; }

  /* Tabs — horizontal scroll, no scrollbar visible */
  .tabs-bar { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tabs-bar::-webkit-scrollbar { display: none; }
  .tab-btn { white-space: nowrap; padding: 10px 14px; font-size: 12.5px; }

  /* Cards */
  .section-card { padding: 16px; }

  /* Manual fields — 2 cols, add button spans full row */
  .manual-fields { grid-template-columns: 1fr 1fr; }
  .manual-field--add { grid-column: span 2; }

  /* Stats */
  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  /* Usage chart */
  .daily-chart-wrap { padding: 14px 14px 20px; }
  .daily-chart-wrap canvas { height: 260px !important; }

  /* Drawer — sheet slides up from bottom on mobile */
  .drawer {
    width: 100%; right: 0; left: 0;
    border-radius: 16px 16px 0 0;
    bottom: 0; top: auto; height: 88vh;
    border-left: none; border-top: 1px solid var(--border);
    animation: slideUp .22s ease;
  }
  @keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
}

/* ── Small phone: ≤ 480px ───────────────────────────────────── */
@media (max-width: 480px) {
  .page { padding: 12px; }
  .page-title { font-size: 16.5px; }

  /* Logs */
  #page-logs .page-header { padding: 12px 12px 10px; }
  .logs-container { margin: 0 8px 16px; }
  .calls-table th,
  .calls-table td { padding: 9px 10px; font-size: 12px; }

  /* Filter — single column */
  .filter-grid { grid-template-columns: 1fr; }
  .filter-panel { padding: 12px; }

  /* Manual fields — stack all */
  .manual-fields { grid-template-columns: 1fr; }
  .manual-field--add { grid-column: span 1; }

  /* Header actions — stack vertically */
  .header-actions { flex-direction: column; align-items: stretch; }
  .header-actions .btn-ghost { justify-content: center; }

  /* Stats */
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-val { font-size: 21px; }
  .stat-card { padding: 14px 12px; }

  /* Tabs */
  .tab-btn { padding: 9px 12px; font-size: 12px; }

  /* Usage chart */
  .daily-chart-wrap canvas { height: 220px !important; }

  /* Drop zone tighter */
  .drop-zone { padding: 22px 14px; }

  /* Section card */
  .section-card { padding: 14px; }

  /* Drawer */
  .drawer { height: 92vh; }
}
