/* =========================================================
   VoIP Lead Bot — Premium Dark SaaS Dashboard
   Design System v2.0

   Color Tokens:
     --bg:          #09090b  (near-black, Vercel-style)
     --surface:     rgba(255,255,255,0.03)  (glass cards)
     --surface-el:  #111113  (elevated surfaces)
     --border:      rgba(255,255,255,0.06)
     --text:        #fafafa
     --text-2:      #a1a1aa
     --muted:       #71717a
     --accent:      #6366f1  (indigo)
     --accent-h:    #818cf8
     --green:       #22c55e
     --red:         #ef4444
     --amber:       #f59e0b
     --blue:        #3b82f6
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

:root {
  --bg:          #09090b;
  --surface:     rgba(255,255,255,0.03);
  --surface-el:  #111113;
  --surface-2:   #0a0a0c;
  --border:      rgba(255,255,255,0.06);
  --border-2:    rgba(255,255,255,0.10);
  --text:        #fafafa;
  --text-2:      #a1a1aa;
  --muted:       #71717a;
  --accent:      #6366f1;
  --accent-h:    #818cf8;
  --green:       #22c55e;
  --red:         #ef4444;
  --amber:       #f59e0b;
  --blue:        #3b82f6;
  --purple:      #a855f7;
  --sidebar-w:   260px;
  --header-h:    60px;
  --radius:      8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --transition:  0.2s ease;
  --shadow-sm:   0 1px 2px 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);
  --glow-accent: 0 0 20px rgba(99,102,241,0.25);
  --glow-green:  0 0 16px rgba(34,197,94,0.25);
  --glow-red:    0 0 16px rgba(239,68,68,0.25);
}

html { font-size: 14px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Subtle page-load fade-in */
body { animation: pageIn 0.35s ease both; }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

img { max-width: 100%; }

/* ── Layout ───────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

.sidebar__logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid var(--border);
  text-decoration: none !important;
  flex-shrink: 0;
}

.sidebar__logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--purple) 100%);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 0 16px rgba(99,102,241,0.35);
}

.sidebar__logo-text {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.sidebar__logo-sub {
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 400;
}

.sidebar__nav {
  flex: 1;
  padding: 12px 10px;
}

.sidebar__section,
.sidebar__label {
  padding: 16px 10px 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
}

/* nav-link and sidebar__link are both used in templates */
.sidebar__link,
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: var(--text-2);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius);
  transition: color var(--transition), background var(--transition);
  text-decoration: none !important;
  position: relative;
  margin-bottom: 2px;
}

.sidebar__link:hover,
.nav-link:hover {
  color: var(--text);
  background: rgba(255,255,255,0.05);
}

.sidebar__link.active,
.nav-link.active {
  color: var(--accent-h);
  background: rgba(99,102,241,0.15);
}

.sidebar__link.active::before,
.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.sidebar__link .icon,
.nav-link .icon {
  font-size: 0.95rem;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.85;
}

.sidebar__link.active .icon,
.nav-link.active .icon { opacity: 1; }

.sidebar__footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted);
  flex-shrink: 0;
}

.sidebar__footer a { color: var(--muted); }
.sidebar__footer a:hover { color: var(--text); }

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

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

.topbar__title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

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

.topbar__user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--text-2);
}

.topbar__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  color: #fff;
  font-weight: 700;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px rgba(99,102,241,0.3);
  flex-shrink: 0;
}

/* ── Content area ────────────────────────────────────── */
.content {
  padding: 28px;
  flex: 1;
}

/* ── Flash messages ───────────────────────────────────── */
.flash-messages { margin-bottom: 20px; }

.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  border: 1px solid transparent;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  backdrop-filter: blur(8px);
}

.alert-info    { background: rgba(59,130,246,0.1);  border-color: rgba(59,130,246,0.25);  color: #93c5fd; }
.alert-success { background: rgba(34,197,94,0.1);   border-color: rgba(34,197,94,0.25);   color: #86efac; }
.alert-warning { background: rgba(245,158,11,0.1);  border-color: rgba(245,158,11,0.25);  color: #fcd34d; }
.alert-danger  { background: rgba(239,68,68,0.1);   border-color: rgba(239,68,68,0.25);   color: #fca5a5; }
.alert-error   { background: rgba(239,68,68,0.1);   border-color: rgba(239,68,68,0.25);   color: #fca5a5; }

/* ── Page header ─────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h1 {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.page-header .subtitle {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: 2px;
  font-weight: 400;
}

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

.stats-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
}

.stats-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
}

.stats-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.10);
}

.stats-card__icon {
  font-size: 1.25rem;
  margin-bottom: 2px;
  opacity: 0.9;
}

.stats-card__number {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--text);
}

.stats-card__label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

/* Color variants — number color + left border accent */
.stats-card--green     { border-left: 3px solid var(--green); }
.stats-card--red       { border-left: 3px solid var(--red); }
.stats-card--amber     { border-left: 3px solid var(--amber); }
.stats-card--blue      { border-left: 3px solid var(--blue); }
.stats-card--white     { border-left: 3px solid rgba(255,255,255,0.2); }
.stats-card--orange    { border-left: 3px solid #ff9800; }
.stats-card--gray      { border-left: 3px solid #9e9e9e; }
.stats-card--dark-red  { border-left: 3px solid #b91c1c; }

.stats-card--green .stats-card__number     { color: var(--green); }
.stats-card--red .stats-card__number       { color: var(--red); }
.stats-card--amber .stats-card__number     { color: var(--amber); }
.stats-card--blue .stats-card__number      { color: var(--blue); }
.stats-card--orange .stats-card__number    { color: #ff9800; }
.stats-card--gray .stats-card__number      { color: #9e9e9e; }
.stats-card--dark-red .stats-card__number  { color: #f87171; }

.stats-card--green:hover     { box-shadow: var(--shadow-md), var(--glow-green); }
.stats-card--red:hover       { box-shadow: var(--shadow-md), var(--glow-red); }
.stats-card--amber:hover     { box-shadow: var(--shadow-md), 0 0 16px rgba(245,158,11,0.2); }
.stats-card--blue:hover      { box-shadow: var(--shadow-md), 0 0 16px rgba(59,130,246,0.2); }
.stats-card--orange:hover    { box-shadow: var(--shadow-md), 0 0 16px rgba(255,152,0,0.2); }
.stats-card--gray:hover      { box-shadow: var(--shadow-md), 0 0 16px rgba(158,158,158,0.15); }
.stats-card--dark-red:hover  { box-shadow: var(--shadow-md), 0 0 16px rgba(185,28,28,0.2); }

/* Alternate stat-card classes */
.stat-card { position: relative; overflow: hidden; }
.stat-card .stat-icon {
  position: absolute; right: 14px; top: 14px;
  font-size: 2rem; opacity: 0.12; pointer-events: none;
}
.stat-card-green .stat-value,
.stat-card-green .stats-card__number  { color: var(--green); }
.stat-card-blue .stat-value,
.stat-card-blue .stats-card__number   { color: var(--blue); }
.stat-card-amber .stat-value,
.stat-card-amber .stats-card__number  { color: var(--amber); }
.stat-card-red .stat-value,
.stat-card-red .stats-card__number    { color: var(--red); }
.stat-card-gray .stat-value,
.stat-card-gray .stats-card__number   { color: var(--muted); }

/* ── Cards / Panels ──────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  backdrop-filter: blur(12px);
  transition: box-shadow var(--transition), border-color var(--transition);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
  pointer-events: none;
}

.card:hover {
  border-color: rgba(255,255,255,0.09);
  box-shadow: var(--shadow-md);
}

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

.card__title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.card__body { padding: 24px; }

.card__footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--muted);
}

/* ── Tables ───────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  -webkit-overflow-scrolling: touch;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table thead th {
  background: rgba(255,255,255,0.02);
  color: var(--muted);
  text-align: left;
  padding: 11px 16px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background var(--transition);
}

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

.data-table tbody tr:hover { background: rgba(255,255,255,0.025); }

.data-table td {
  padding: 11px 16px;
  color: var(--text);
  vertical-align: middle;
}

.data-table td.muted { color: var(--muted); font-size: 0.8125rem; }

/* New row animation */
.call-row-new { animation: rowSlideIn 0.4s ease both, rowHighlight 2s ease 0.4s both; }

@keyframes rowSlideIn {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes rowHighlight {
  0%   { background: rgba(99,102,241,0.12); }
  100% { background: transparent; }
}

/* ── Badges ───────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

/* Double-dash variants (.badge--valid etc.) */
.badge--valid,
.badge--completed    { background: rgba(34,197,94,0.12);   color: #86efac; border: 1px solid rgba(34,197,94,0.25); }
.badge--invalid,
.badge--failed       { background: rgba(239,68,68,0.12);   color: #fca5a5; border: 1px solid rgba(239,68,68,0.25); }
.badge--no-answer,
.badge--pending      { background: rgba(245,158,11,0.12);  color: #fcd34d; border: 1px solid rgba(245,158,11,0.25); }
.badge--running      { background: rgba(59,130,246,0.12);  color: #93c5fd; border: 1px solid rgba(59,130,246,0.25); animation: badgePulse 2s ease-in-out infinite; }
.badge--admin        { background: rgba(168,85,247,0.12);  color: #d8b4fe; border: 1px solid rgba(168,85,247,0.25); }
.badge--user         { background: rgba(59,130,246,0.12);  color: #93c5fd; border: 1px solid rgba(59,130,246,0.25); }

/* Single-dash legacy variants */
.badge-valid,
.badge-completed,
.badge-connected,
.badge-answered      { background: rgba(34,197,94,0.12);   color: #86efac; border: 1px solid rgba(34,197,94,0.25); }
.badge-invalid       { background: rgba(245,158,11,0.12);  color: #fcd34d; border: 1px solid rgba(245,158,11,0.25); }
.badge-failed        { background: rgba(239,68,68,0.12);   color: #fca5a5; border: 1px solid rgba(239,68,68,0.25); }
.badge-no-answer,
.badge-noanswer,
.badge-unanswered    { background: rgba(113,113,122,0.15); color: var(--text-2); border: 1px solid rgba(113,113,122,0.25); }
.badge-busy          { background: rgba(249,115,22,0.12);  color: #fdba74; border: 1px solid rgba(249,115,22,0.25); }
.badge-pending       { background: rgba(245,158,11,0.12);  color: #fcd34d; border: 1px solid rgba(245,158,11,0.25); }
.badge-running       { background: rgba(59,130,246,0.12);  color: #93c5fd; border: 1px solid rgba(59,130,246,0.25); animation: badgePulse 2s ease-in-out infinite; }
.badge-admin         { background: rgba(168,85,247,0.12);  color: #d8b4fe; border: 1px solid rgba(168,85,247,0.25); }
.badge-user          { background: rgba(59,130,246,0.12);  color: #93c5fd; border: 1px solid rgba(59,130,246,0.25); }
.badge-pressed1      { background: rgba(59,130,246,0.15);  color: #93c5fd; border: 1px solid rgba(59,130,246,0.3); }
.badge-pressed2      { background: rgba(99,102,241,0.15);  color: #a5b4fc; border: 1px solid rgba(99,102,241,0.3); }

@keyframes badgePulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.65; }
}

/* Result badge (connected/disconnected) */
.result-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
}

.result-badge--connected    { background: rgba(34,197,94,0.12);  color: #86efac; border: 1px solid rgba(34,197,94,0.25); }
.result-badge--pressed_1    { background: rgba(59,130,246,0.12); color: #93c5fd; border: 1px solid rgba(59,130,246,0.25); }
.result-badge--pressed_2    { background: rgba(99,102,241,0.12); color: #a5b4fc; border: 1px solid rgba(99,102,241,0.25); }
.result-badge--no_answer    { background: rgba(113,113,122,0.15); color: var(--text-2); border: 1px solid rgba(113,113,122,0.25); }
.result-badge--failed       { background: rgba(239,68,68,0.12);  color: #fca5a5; border: 1px solid rgba(239,68,68,0.25); }
.result-badge--busy         { background: rgba(255,152,0,0.2);    color: #ff9800; border: 1px solid rgba(255,152,0,0.35); }
.result-badge--timeout      { background: rgba(158,158,158,0.2);  color: #9e9e9e; border: 1px solid rgba(158,158,158,0.35); }
.result-badge--valid        { background: rgba(34,197,94,0.12);  color: #86efac; border: 1px solid rgba(34,197,94,0.25); }
.result-badge--invalid      { background: rgba(239,68,68,0.12);  color: #fca5a5; border: 1px solid rgba(239,68,68,0.25); }

/* ── Progress bars ───────────────────────────────────── */
.progress-wrap {
  background: rgba(255,255,255,0.06);
  border-radius: 20px;
  overflow: hidden;
  height: 8px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--green));
  border-radius: 20px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px rgba(99,102,241,0.4);
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.progress-section { margin-bottom: 16px; }

/* Campaign detail progress block */
.cd-progress-block .card__body { padding: 20px 24px; }

.cd-progress-header { margin-bottom: 10px; }

.cd-progress-count {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.cd-progress-pct {
  font-size: 1rem;
  font-weight: 700;
  color: var(--green);
}

.cd-progress-track {
  height: 10px;
  background: rgba(255,255,255,0.06);
  border-radius: 20px;
  overflow: hidden;
}

.cd-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--green));
  border-radius: 20px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px rgba(34,197,94,0.3);
}

/* ── Reason bars ─────────────────────────────────────── */
.reason-bars { list-style: none; }

.reason-bar__row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.reason-bar__label {
  width: 90px;
  font-size: 0.8125rem;
  color: var(--muted);
  flex-shrink: 0;
  text-align: right;
}

.reason-bar__track {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 20px;
  overflow: hidden;
}

.reason-bar__fill {
  height: 100%;
  border-radius: 20px;
  transition: width 0.5s ease;
}

.reason-bar__fill--invalid   { background: var(--amber); }
.reason-bar__fill--no-answer { background: var(--muted); }
.reason-bar__fill--failed    { background: var(--red); }
.reason-bar__fill--valid     { background: var(--green); }

.reason-bar__count {
  width: 36px;
  text-align: right;
  font-size: 0.8125rem;
  color: var(--text);
  flex-shrink: 0;
}

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

.form-label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-2);
  margin-bottom: 6px;
  font-weight: 500;
}

.form-control {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px 14px;
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

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

.form-control[type="file"] {
  cursor: pointer;
  padding: 8px 12px;
  color: var(--text-2);
}

.form-control:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

textarea.form-control { resize: vertical; min-height: 100px; }

select.form-control {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2371717a'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  padding-right: 34px;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 5px;
}

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

/* Input group (password reveal etc.) */
.input-group {
  display: flex;
  align-items: stretch;
}

.input-group .form-control {
  border-radius: var(--radius) 0 0 var(--radius);
  flex: 1;
}

.input-group-append {
  display: flex;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid rgba(255,255,255,0.1);
  border-left: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0 12px;
  cursor: pointer;
  transition: background var(--transition);
}

.input-group-append:hover { background: rgba(255,255,255,0.05); }

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  text-decoration: none !important;
  white-space: nowrap;
  letter-spacing: -0.005em;
  position: relative;
}

.btn:active { transform: scale(0.98); }

.btn:disabled,
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
}

/* Primary */
.btn--primary,
.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, #8b5cf6 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3), 0 0 0 1px rgba(99,102,241,0.3);
}

.btn--primary:hover,
.btn-primary:hover {
  filter: brightness(1.12);
  box-shadow: 0 4px 14px rgba(99,102,241,0.4), 0 0 0 1px rgba(99,102,241,0.4);
  color: #fff;
}

/* Success */
.btn--success,
.btn-success {
  background: linear-gradient(135deg, var(--green) 0%, #16a34a 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.btn--success:hover,
.btn-success:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 14px rgba(34,197,94,0.35);
  color: #fff;
}

/* Danger */
.btn--danger,
.btn-danger {
  background: linear-gradient(135deg, var(--red) 0%, #b91c1c 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.btn--danger:hover,
.btn-danger:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 14px rgba(239,68,68,0.35);
  color: #fff;
}

/* Outline */
.btn--outline,
.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: rgba(255,255,255,0.12);
}

.btn--outline:hover,
.btn-outline:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.2);
  color: var(--text);
}

/* Ghost */
.btn--ghost,
.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: transparent;
}

.btn--ghost:hover,
.btn-ghost:hover {
  color: var(--text);
  background: rgba(255,255,255,0.05);
}

/* Sizes */
.btn--sm, .btn-sm { padding: 6px 12px; font-size: 0.8125rem; }
.btn--lg, .btn-lg { padding: 12px 24px; font-size: 0.9375rem; }

/* ── Login page ───────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

/* Radial glow background decoration */
.login-page::before {
  content: '';
  position: fixed;
  top: -30%;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 500px;
  background: radial-gradient(ellipse, rgba(99,102,241,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.login-card {
  position: relative;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-xl);
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  backdrop-filter: blur(24px);
  box-shadow: 0 24px 64px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.04);
  animation: cardIn 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

/* Gradient border effect on login card */
.login-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: calc(var(--radius-xl) + 1px);
  padding: 1px;
  background: linear-gradient(135deg, rgba(99,102,241,0.4), rgba(168,85,247,0.2), rgba(255,255,255,0.04));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.login-header,
.login-card__logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-card__logo-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #fff;
  font-weight: 800;
  margin-bottom: 16px;
  box-shadow: 0 0 24px rgba(99,102,241,0.4);
}

.login-title,
.login-card__title {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.login-card__sub {
  font-size: 0.875rem;
  color: var(--muted);
}

/* Auth tabs */
.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  text-align: center;
  padding: 10px 16px;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  text-decoration: none;
}

.auth-tab:hover { color: var(--text); }

.auth-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Divider ──────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

/* ── Status dot ───────────────────────────────────────── */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  flex-shrink: 0;
}

.status-dot--green  { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot--red    { background: var(--red);   box-shadow: 0 0 6px var(--red); }
.status-dot--amber  { background: var(--amber); }
.status-dot--muted  { background: var(--muted); }

/* ── Live dot (pulsing) ───────────────────────────────── */
.live-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(34,197,94,0.6);
  animation: livePulse 1.8s ease-out infinite;
  flex-shrink: 0;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--green);
  border-radius: 50%;
  display: inline-block;
  animation: livePulse 1.8s ease-out infinite;
  flex-shrink: 0;
}

@keyframes livePulse {
  0%   { box-shadow: 0 0 0 0 rgba(34,197,94,0.6); }
  70%  { box-shadow: 0 0 0 8px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}

/* ── SIP status ───────────────────────────────────────── */
.sip-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
}

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

.empty-state__icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
  opacity: 0.4;
  display: block;
}

.empty-state__title {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 8px;
}

.empty-state__text {
  font-size: 0.875rem;
  color: var(--muted);
  max-width: 340px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ── Spinner ─────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.08);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

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

/* ── Code blocks ─────────────────────────────────────── */
code, kbd {
  font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
  font-size: 0.8125em;
  background: rgba(255,255,255,0.06);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent-h);
  border: 1px solid var(--border);
}

/* ── Tooltips ────────────────────────────────────────── */
[data-tooltip] { position: relative; cursor: help; }

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a1f;
  color: var(--text);
  font-size: 0.75rem;
  font-family: inherit;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
  border: 1px solid var(--border-2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
  z-index: 999;
  box-shadow: var(--shadow-md);
  transform: translateX(-50%) translateY(4px);
}

[data-tooltip]::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--border-2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 999;
}

[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

[data-tooltip]:hover::before { opacity: 1; }

/* ── Pagination ───────────────────────────────────────── */
.pagination {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: center;
  margin-top: 20px;
}

.pagination .page-link {
  padding: 6px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: all var(--transition);
  text-decoration: none !important;
  background: rgba(255,255,255,0.02);
}

.pagination .page-link:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.15);
  color: var(--text);
}

.pagination .page-link.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(99,102,241,0.35);
}

/* ── Footer ──────────────────────────────────────────── */
.footer {
  padding: 16px 28px;
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.footer a { color: var(--muted); }
.footer a:hover { color: var(--text); }

/* ── Audio player ─────────────────────────────────────── */
.audio-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 10px;
  transition: border-color var(--transition), box-shadow var(--transition);
  backdrop-filter: blur(12px);
}

.audio-card:hover {
  border-color: rgba(99,102,241,0.3);
  box-shadow: 0 0 16px rgba(99,102,241,0.1);
}

.audio-play-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  flex-shrink: 0;
  transition: all var(--transition);
  box-shadow: 0 0 12px rgba(99,102,241,0.3);
}

.audio-play-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 0 20px rgba(99,102,241,0.45);
}

.audio-progress {
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 20px;
  overflow: hidden;
  margin-top: 8px;
  flex: 1;
}

.audio-progress__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-h));
  border-radius: 20px;
  transition: width 0.3s ease;
}

/* ── Dropzone ────────────────────────────────────────── */
.dropzone {
  border: 2px dashed rgba(255,255,255,0.12);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  text-align: center;
  transition: all 0.25s ease;
  cursor: pointer;
  position: relative;
  background: rgba(255,255,255,0.01);
}

.dropzone:hover {
  border-color: rgba(99,102,241,0.4);
  background: rgba(99,102,241,0.04);
}

.dropzone.dragover {
  border-color: var(--accent);
  background: rgba(99,102,241,0.08);
  box-shadow: 0 0 0 4px rgba(99,102,241,0.12);
  animation: dropzoneGlow 1.5s ease-in-out infinite alternate;
}

@keyframes dropzoneGlow {
  from { box-shadow: 0 0 0 4px rgba(99,102,241,0.1); }
  to   { box-shadow: 0 0 0 6px rgba(99,102,241,0.2); }
}

.dropzone .dropzone-icon {
  font-size: 2.5rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
  display: block;
  transition: transform var(--transition);
}

.dropzone:hover .dropzone-icon { transform: translateY(-2px); }

.dropzone .dropzone-text {
  color: var(--text-2);
  font-size: 0.875rem;
}

/* ── Filter tabs ─────────────────────────────────────── */
.filter-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-tabs::-webkit-scrollbar { display: none; }

.filter-tab {
  padding: 10px 16px;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  position: relative;
}

.filter-tab:hover { color: var(--text-2); text-decoration: none; }

.filter-tab.active {
  color: var(--accent-h);
  border-bottom-color: var(--accent);
}

.filter-tab .tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.08);
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 0.6875rem;
  font-weight: 600;
  margin-left: 5px;
  vertical-align: middle;
}

.filter-tab.active .tab-count {
  background: rgba(99,102,241,0.2);
  color: var(--accent-h);
}

/* ── Completion banner ───────────────────────────────── */
.completion-banner {
  background: linear-gradient(135deg, rgba(34,197,94,0.15) 0%, rgba(16,185,129,0.12) 100%);
  border: 1px solid rgba(34,197,94,0.25);
  color: #86efac;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-lg);
  text-align: center;
  margin-bottom: 1rem;
  display: none;
  backdrop-filter: blur(8px);
}

.completion-banner.show {
  display: block;
  animation: bannerFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

/* ── Campaign detail — two-col lower grid ────────────── */
.cd-lower-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  margin-bottom: 0;
}

/* ── Campaign detail — call count badge in header ────── */
.cd-call-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 20px;
  padding: 0 7px;
  margin-left: 6px;
  border-radius: 10px;
  font-size: 0.6875rem;
  font-weight: 600;
  background: rgba(59,130,246,0.15);
  color: #93c5fd;
  border: 1px solid rgba(59,130,246,0.25);
}

/* ── Campaign detail — export row ───────────────────── */
.cd-export-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}

/* ── Step number (wizard) ─────────────────────────────── */
.step-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  margin-right: 8px;
  flex-shrink: 0;
  box-shadow: 0 0 10px rgba(99,102,241,0.3);
}

/* ── Password reveal toggle ───────────────────────────── */
.password-toggle { cursor: pointer; color: var(--muted); padding: 2px 4px; transition: color var(--transition); }
.password-toggle:hover { color: var(--accent-h); }

/* ── Utilities ────────────────────────────────────────── */
.text-green  { color: var(--green) !important; }
.text-red    { color: var(--red) !important; }
.text-amber  { color: var(--amber) !important; }
.text-blue   { color: var(--blue) !important; }
.text-muted  { color: var(--muted) !important; }
.text-center { text-align: center !important; }
.text-right  { text-align: right !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 8px !important; }
.mt-2 { margin-top: 16px !important; }
.mt-3 { margin-top: 24px !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 8px !important; }
.mb-2 { margin-bottom: 16px !important; }
.mb-3 { margin-bottom: 24px !important; }

.d-flex       { display: flex !important; }
.align-center { align-items: center !important; }
.justify-between { justify-content: space-between !important; }
.gap-1        { gap: 8px !important; }
.gap-2        { gap: 14px !important; }
.flex-wrap    { flex-wrap: wrap !important; }

.w-100  { width: 100% !important; }
.hidden { display: none !important; }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 900px) {
  :root { --sidebar-w: 64px; }

  .sidebar { overflow: hidden; }

  .sidebar__logo-text,
  .sidebar__logo-sub,
  .sidebar__section,
  .sidebar__label,
  .sidebar__link span:not(.icon),
  .nav-link span:not(.icon),
  .sidebar__footer { display: none; }

  .sidebar__link,
  .nav-link {
    justify-content: center;
    padding: 12px;
  }

  .sidebar__link.active::before,
  .nav-link.active::before { display: none; }

  .sidebar__logo {
    justify-content: center;
    padding: 16px 8px;
  }

  .cd-lower-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .content { padding: 20px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .card { overflow-x: hidden; }
  .form-row { grid-template-columns: 1fr; }
  .filter-tabs { flex-wrap: nowrap; overflow-x: auto; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .topbar { padding: 0 16px; }
  .footer { padding: 12px 16px; }
}

@media (max-width: 600px) {
  .content { padding: 16px; }
  .topbar { padding: 0 14px; }
  .login-card { padding: 32px 24px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .btn--lg, .btn-lg { padding: 10px 20px; font-size: 0.9rem; }
  .topbar__title { font-size: 0.875rem; }
}
