/* ══════════════════════════════════════════════════════════════
   Call Agent Dashboard — Fintech Reference Reskin
   style.css v4.0
══════════════════════════════════════════════════════════════ */

/* ── DESIGN TOKENS ── */
:root {
  /* Surfaces */
  --bg:         #f3f4f6;
  --surface:    #ffffff;
  --border:     #e5e7eb;
  --border2:    #d1d5db;

  /* Brand accent — green primary */
  --green:       #16a34a;
  --green-mid:   #22c55e;
  --green-light: #dcfce7;
  --green-50:    #f0fdf4;

  /* Secondary accents */
  --amber:       #f59e0b;
  --amber-light: #fef3c7;
  --orange:      #f97316;
  --orange-light:#fff7ed;
  --red:         #ef4444;
  --red-light:   #fef2f2;
  --blue:        #3b82f6;
  --blue-light:  #eff6ff;
  --purple:      #a855f7;

  /* Text */
  --t1: #111827;
  --t2: #374151;
  --t3: #6b7280;
  --t4: #9ca3af;
  --t5: #d1d5db;

  /* Layout */
  --sidebar-w:     240px;
  --sidebar-w-col: 64px;
  --topbar-h:      72px;

  /* Radii */
  --r:    10px;
  --r-lg: 18px;
  --r-xl: 24px;

  /* Shadows */
  --shadow-sm:   0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-card: 0 4px 24px rgba(0,0,0,.05);
  --shadow-pop:  0 8px 32px rgba(0,0,0,.1);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--t1);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--t4); }

/* ══════════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════════ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: width .25s ease, transform .25s ease;
  overflow: hidden;
  overflow-y: auto;
}

.sidebar.collapsed {
  width: var(--sidebar-w-col);
}

/* Logo / wordmark slot */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  white-space: nowrap;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--t1);
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--t1);
  letter-spacing: -.01em;
  transition: opacity .2s;
}

.sidebar.collapsed .logo-name { opacity: 0; pointer-events: none; }

/* Nav */
.nav-menu {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  height: 44px;
  border-radius: var(--r);
  font-size: 14px;
  font-weight: 500;
  color: var(--t3);
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, color .15s;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  user-select: none;
}

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

.nav-item.active {
  background: var(--green-light);
  color: var(--green);
}

.nav-item.active-parent {
  color: var(--brand);
}

.nav-chevron {
  margin-left: auto;
  transition: transform .2s ease;
}

.nav-item.open .nav-chevron {
  transform: rotate(180deg);
}

.nav-submenu {
  display: none;
  flex-direction: column;
  padding: 4px 0 4px 36px;
  gap: 4px;
}

.nav-submenu.open {
  display: flex;
}

.nav-subitem {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--r);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--t3);
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.nav-subitem:hover {
  background: var(--bg);
  color: var(--t1);
}

.nav-subitem.active {
  color: var(--brand);
  background: rgba(15, 98, 254, 0.08);
  font-weight: 600;
}

.nav-item.active .nav-ico { color: var(--green); opacity: 1; }

.nav-ico {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: .65;
  color: currentColor;
  transition: opacity .15s;
}

.nav-item:hover .nav-ico { opacity: 1; }

.nav-label {
  flex: 1;
  transition: opacity .2s;
}

.sidebar.collapsed .nav-label { opacity: 0; pointer-events: none; }

/* Chevron */
.nav-chevron {
  flex-shrink: 0;
  opacity: .5;
  transition: transform .2s, opacity .2s;
}
.nav-item.open .nav-chevron { transform: rotate(180deg); }
.sidebar.collapsed .nav-chevron { opacity: 0; }

/* Submenu */
.nav-submenu {
  overflow: hidden;
  max-height: 0;
  transition: max-height .25s ease;
  padding: 0 8px 0 44px;
}
.nav-submenu.open { max-height: 200px; }
.sidebar.collapsed .nav-submenu { display: none; }

.nav-subitem {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--r);
  font-size: 13px;
  color: var(--t3);
  cursor: pointer;
  text-decoration: none;
  transition: background .12s, color .12s;
}
.nav-subitem:hover { background: var(--bg); color: var(--t1); }
.nav-subitem.active { color: var(--green); font-weight: 600; }

.sub-badge {
  background: var(--t1);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* Divider */
.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 12px;
}

/* Live dot */
.online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green-mid);
  margin-left: auto;
  flex-shrink: 0;
  animation: blink 2s infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.35} }

/* Engine status / promo card */
.sidebar-promo {
  margin: 12px;
  background: var(--t1);
  border-radius: var(--r-lg);
  padding: 16px;
  color: #fff;
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
  transition: opacity .2s;
}

.sidebar.collapsed .sidebar-promo { opacity: 0; pointer-events: none; }

.sidebar-promo-close {
  position: absolute;
  top: 8px; right: 10px;
  background: none;
  border: none;
  color: rgba(255,255,255,.6);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}

.sidebar-promo-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.sidebar-promo-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}

.sidebar-promo-sub {
  font-size: 11px;
  color: rgba(255,255,255,.65);
  margin-bottom: 12px;
  line-height: 1.4;
}

.sidebar-promo-btn {
  width: 100%;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
  padding: 8px;
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.sidebar-promo-btn:hover { background: rgba(255,255,255,.25); }

/* Collapse button */
.sidebar-collapse {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: none;
  background: none;
  border-top: 1px solid var(--border);
  cursor: pointer;
  color: var(--t3);
  font-size: 13px;
  font-weight: 500;
  width: 100%;
  transition: color .15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.sidebar-collapse:hover { color: var(--t1); }
.sidebar.collapsed .sidebar-collapse .nav-label { opacity: 0; }

/* ══════════════════════════════════════════════
   MAIN WRAPPER
══════════════════════════════════════════════ */
.main-wrap {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left .25s ease;
}

.main-wrap.sidebar-collapsed {
  margin-left: var(--sidebar-w-col);
}

/* ── TOP BAR ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
}

.topbar-search {
  flex: 1;
  max-width: 420px;
  position: relative;
}

.topbar-search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--t4);
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.topbar-search-input {
  width: 100%;
  height: 42px;
  border-radius: 21px;
  border: 1px solid var(--border);
  background: var(--bg);
  padding: 0 16px 0 44px;
  font-size: 14px;
  font-family: inherit;
  color: var(--t1);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.topbar-search-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(22,163,74,.1);
}
.topbar-search-input::placeholder { color: var(--t4); }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.topbar-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: none;
  color: var(--t3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
}
.topbar-icon-btn:hover { background: var(--bg); color: var(--t1); }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: default;
}

.topbar-user-av {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.topbar-user-info {
  display: flex;
  flex-direction: column;
}

.topbar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--t1);
  line-height: 1.2;
}

.topbar-user-email {
  font-size: 11px;
  color: var(--t4);
  line-height: 1.2;
}

.btn-add-widget {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 8px 18px;
  border-radius: var(--r-xl);
  font-size: 13px;
  font-weight: 600;
  color: var(--t1);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background .15s, box-shadow .15s;
  white-space: nowrap;
  font-family: inherit;
}
.btn-add-widget:hover { background: var(--bg); box-shadow: var(--shadow-card); }

/* ══════════════════════════════════════════════
   CONTENT AREA & PAGES
══════════════════════════════════════════════ */
.content-area {
  padding: 28px;
  flex: 1;
}

.page { display: none; }
.page.active { display: block; animation: fadeUp .2s ease; }
@keyframes fadeUp {
  from { opacity:0; transform:translateY(10px); }
  to   { opacity:1; transform:translateY(0); }
}

.section-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}
.page-title-inner {
  font-size: 20px;
  font-weight: 700;
  color: var(--t1);
}

/* ── Hidden engine controls (JS still needs them) ── */
.engine-controls-hidden { display: none; }

/* ══════════════════════════════════════════════
   CARDS
══════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
  margin-bottom: 0;
}

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

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--t1);
  letter-spacing: -.01em;
}

.card-sub {
  font-size: 12px;
  color: var(--t4);
  margin-top: 2px;
}

/* ══════════════════════════════════════════════
   DASHBOARD GRID ROWS
══════════════════════════════════════════════ */

/* ROW 1: chart | stats | engine panel */
.dash-row-1 {
  display: grid;
  grid-template-columns: 1fr 200px 280px;
  gap: 20px;
  margin-bottom: 20px;
  align-items: start;
}

/* ROW 2: progress | tip */
.dash-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

/* ROW 3: outcomes | gauge | goals */
.dash-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

/* .card-recent — inherits from .card */

/* ── Main chart card ── */
.card-chart-main {
  padding: 24px;
}

.chart-main-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.chart-main-num {
  font-size: 40px;
  font-weight: 800;
  color: var(--t1);
  line-height: 1;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}

.chart-main-label {
  font-size: 12px;
  color: var(--t4);
  margin-top: 4px;
}

.chart-main-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.chart-range-select {
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--t2);
  background: var(--surface);
  cursor: pointer;
  outline: none;
}

.chart-type-toggles {
  display: flex;
  gap: 2px;
  background: var(--bg);
  border-radius: var(--r);
  padding: 3px;
}

.chart-type-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  border-radius: 7px;
  cursor: pointer;
  color: var(--t4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .12s, color .12s;
}
.chart-type-btn.active { background: var(--surface); color: var(--t1); box-shadow: var(--shadow-sm); }
.chart-type-btn:hover:not(.active) { color: var(--t2); }

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

.chart-box { position: relative; }

/* ── Stat blocks column ── */
.dash-stats-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stat-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
}

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

.stat-block-num {
  font-size: 26px;
  font-weight: 800;
  color: var(--t1);
  line-height: 1;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  margin-bottom: 6px;
}

.stat-block-chg {
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 3px;
}
.stat-block-chg.up   { color: var(--green); }
.stat-block-chg.down { color: var(--red); }

/* ── Engine panel ("My card") ── */
.card-engine-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
}

.engine-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.engine-panel-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--t1);
}

.engine-panel-add {
  font-size: 12px;
  color: var(--t3);
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 500;
}
.engine-panel-add:hover { color: var(--green); }

/* Engine card visual */
.engine-card-visual {
  border-radius: var(--r-lg);
  padding: 18px;
  background: linear-gradient(135deg, #1f2937, #374151);
  color: #fff;
  position: relative;
  overflow: hidden;
  min-height: 90px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: background .3s;
}

.engine-card-visual.engine-el {
  background: linear-gradient(135deg, #1e3a5f, #2563eb);
}

.engine-card-visual::before {
  content: '';
  position: absolute;
  top: -20px; right: -20px;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: rgba(255,255,255,.07);
}

.engine-card-badge {
  background: rgba(255,255,255,.2);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  align-self: flex-end;
  letter-spacing: .05em;
}

.engine-card-name {
  font-size: 14px;
  font-weight: 700;
  margin-top: 8px;
}

.engine-card-status {
  font-size: 11px;
  color: rgba(255,255,255,.7);
}

/* Quick actions */
.engine-quick-actions {
  display: flex;
  justify-content: space-between;
  gap: 4px;
}

.engine-qa-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  border: none;
  background: none;
  cursor: pointer;
  flex: 1;
  padding: 6px 2px;
  border-radius: var(--r);
  transition: background .12s;
}
.engine-qa-btn:hover { background: var(--bg); }

.engine-qa-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--t2);
}

.engine-qa-lbl {
  font-size: 10px;
  color: var(--t3);
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

/* Quick callers */
.engine-panel-callers-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--t4);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 10px;
}

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

.caller-av {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  max-width: 36px;
  max-height: 36px;
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* .card-progress — inherits from .card */

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

.progress-edit-btn {
  background: none;
  border: none;
  color: var(--t4);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
}
.progress-edit-btn:hover { color: var(--t1); background: var(--bg); }

.progress-nums {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 12px;
}
.progress-current {
  font-size: 28px;
  font-weight: 800;
  color: var(--t1);
  letter-spacing: -.02em;
}
.progress-sep { font-size: 20px; color: var(--t4); }
.progress-target { font-size: 20px; font-weight: 600; color: var(--t4); }
.progress-unit { font-size: 13px; color: var(--t4); margin-left: 4px; }

.progress-bar-track {
  height: 10px;
  background: var(--bg);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 10px;
}
.progress-bar-fill {
  height: 100%;
  background: var(--green-mid);
  border-radius: 5px;
  transition: width .6s ease;
}

.progress-hint {
  font-size: 12px;
  color: var(--t4);
}

/* ── Tip card ── */
.card-tip {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.tip-content { flex: 1; }

.tip-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--t1);
  margin-bottom: 8px;
  line-height: 1.3;
}

.tip-body {
  font-size: 13px;
  color: var(--t3);
  line-height: 1.5;
  margin-bottom: 12px;
}

.tip-read-more {
  font-size: 13px;
  font-weight: 600;
  color: var(--green);
  text-decoration: none;
}
.tip-read-more:hover { text-decoration: underline; }

.tip-graphic { flex-shrink: 0; }

/* ── Outcomes card ── */
.outcomes-total {
  font-size: 28px;
  font-weight: 800;
  color: var(--t1);
  letter-spacing: -.02em;
  margin-bottom: 12px;
}

.outcomes-bar-strip {
  display: flex;
  gap: 3px;
  margin-bottom: 16px;
  height: 10px;
  width: 100%;
}

.outcomes-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.outcomes-leg-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.outcomes-leg-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.outcomes-leg-name {
  flex: 1;
  font-size: 13px;
  color: var(--t2);
}

.outcomes-leg-pct {
  font-size: 13px;
  font-weight: 600;
  color: var(--t1);
}

/* ── Gauge card ── */
.gauge-big-num {
  font-size: 28px;
  font-weight: 800;
  color: var(--t1);
  letter-spacing: -.02em;
  margin-bottom: 4px;
}

.gauge-trend {
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 4px;
}

.gauge-center-label {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
}

.gauge-center-label span {
  display: block;
  font-size: 22px;
  font-weight: 800;
  color: var(--t1);
  line-height: 1;
}

.gauge-center-label small {
  font-size: 11px;
  color: var(--t4);
}

.gauge-caption {
  font-size: 11px;
  color: var(--t4);
  margin-top: 8px;
  text-align: center;
}

/* ── Goal tracker card ── */
.btn-add-goal {
  font-size: 12px;
  font-weight: 600;
  color: var(--green);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.btn-add-goal:hover { text-decoration: underline; }

.goals-section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--t4);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 12px;
}

.goal-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.goal-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.goal-meta { flex: 1; min-width: 0; }

.goal-name-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}

.goal-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--t1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.goal-counts {
  font-size: 12px;
  color: var(--t3);
  white-space: nowrap;
}

.goal-prog-track {
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 5px;
}

.goal-prog-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .5s ease;
}
.goal-prog-fill.green  { background: var(--green-mid); }
.goal-prog-fill.orange { background: var(--orange); }
.goal-prog-fill.blue   { background: var(--blue); }

.goal-time {
  font-size: 11px;
  color: var(--t4);
}

/* ── Recent calls list ── */
.recent-calls-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.recent-call-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r);
  transition: background .12s;
  cursor: default;
}
.recent-call-row:hover { background: var(--bg); }

.rcr-av {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.rcr-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rcr-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--t1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rcr-time {
  font-size: 11px;
  color: var(--t4);
}

.rcr-status {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  text-transform: capitalize;
  white-space: nowrap;
}

.rcr-dur {
  font-size: 12px;
  font-weight: 500;
  color: var(--t2);
  white-space: nowrap;
}

/* ══════════════════════════════════════════════
   CHART LEGEND (shared)
══════════════════════════════════════════════ */
.legend-row {
  display: flex;
  gap: 14px;
  align-items: center;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--t3);
}

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

/* ══════════════════════════════════════════════
   CHIPS & STATUS BADGES
══════════════════════════════════════════════ */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.chip-green  { background: var(--green-light); color: var(--green); }
.chip-blue   { background: var(--blue-light);  color: var(--blue); }
.chip-red    { background: var(--red-light);   color: var(--red); }
.chip-orange { background: var(--orange-light);color: var(--orange); }
.chip-gray   { background: var(--bg);          color: var(--t4); }
.chip-purple { background: #faf5ff;            color: var(--purple); }

/* ══════════════════════════════════════════════
   DATA TABLES (Leads / Calls / Interested pages)
══════════════════════════════════════════════ */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--t4);
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px 12px;
  font-size: 13px;
  color: var(--t2);
  border-bottom: 1px solid var(--border);
}

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

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

.td-lead { display: flex; flex-direction: column; gap: 2px; }
.td-lead strong { font-weight: 600; color: var(--t1); }
.td-lead span   { font-size: 11px; color: var(--t4); font-family: 'Roboto Mono', monospace; }

.tbl-empty {
  text-align: center;
  color: var(--t4);
  padding: 32px !important;
  font-size: 14px;
}

/* ══════════════════════════════════════════════
   FORMS & CAMPAIGN PAGE
══════════════════════════════════════════════ */
.form-stack { display: flex; flex-direction: column; gap: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; }

.field-lbl {
  font-size: 12px;
  font-weight: 600;
  color: var(--t2);
}

.hint { font-weight: 400; color: var(--t4); }

.field-input {
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--t1);
  background: var(--surface);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.field-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(22,163,74,.1);
}

.upload-box {
  border: 2px dashed var(--border2);
  border-radius: var(--r-lg);
  padding: 32px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s;
}
.upload-box:hover { border-color: var(--green); }

.upload-txt  { font-size: 14px; color: var(--t2); margin: 8px 0 4px; }
.upload-link { color: var(--green); cursor: pointer; font-weight: 600; }
.upload-hint { font-size: 12px; color: var(--t4); }
.upload-fn   { font-size: 12px; color: var(--t3); margin-top: 6px; }

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Buttons */
.btn-primary {
  background: var(--t1);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: var(--r);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity .15s;
}
.btn-primary:hover { opacity: .85; }

.btn-success {
  background: var(--green);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: var(--r);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity .15s;
}
.btn-success:hover { opacity: .85; }

.btn-danger {
  background: var(--red);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: var(--r);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity .15s;
}
.btn-danger:hover { opacity: .85; }

.btn-outline {
  background: none;
  color: var(--t2);
  border: 1px solid var(--border2);
  padding: 10px 20px;
  border-radius: var(--r);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s;
}
.btn-outline:hover { background: var(--bg); }

.section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--t1);
  margin-bottom: 16px;
}

.status-msg {
  font-size: 13px;
  color: var(--t3);
  padding: 10px 0;
}

/* ══════════════════════════════════════════════
   AGENT TEST PAGE
══════════════════════════════════════════════ */
.test-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
  align-items: start;
}

/* .test-ctrl — inherits from .card */
.test-chat { display: flex; flex-direction: column; gap: 0; }

.chat-log {
  min-height: 300px;
  max-height: 480px;
  overflow-y: auto;
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-empty {
  text-align: center;
  color: var(--t4);
  padding: 40px 20px;
  font-size: 14px;
}

.bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.4;
}

.bubble.user {
  align-self: flex-end;
  background: var(--t1);
  color: #fff;
  border-radius: 14px 14px 4px 14px;
}

.bubble.agent {
  align-self: flex-start;
  background: var(--bg);
  color: var(--t1);
  border-radius: 14px 14px 14px 4px;
}

.bubble-meta {
  font-size: 10px;
  font-weight: 600;
  opacity: .6;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.chat-foot { border-top: 1px solid var(--border); padding-top: 14px; }

.quick-test-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.quick-test-btn {
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 14px;
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--t2);
  cursor: pointer;
  font-family: inherit;
  transition: background .12s, border-color .12s;
}
.quick-test-btn:hover { background: var(--green-50); border-color: var(--green); }

.chat-ta {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  color: var(--t1);
  background: var(--surface);
  transition: border-color .15s;
}
.chat-ta:focus { border-color: var(--green); }

/* ══════════════════════════════════════════════
   LOGS
══════════════════════════════════════════════ */
.log-list { display: flex; flex-direction: column; gap: 4px; }

.log-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 8px 4px;
  border-radius: var(--r);
  font-size: 13px;
  transition: background .12s;
}
.log-row:hover { background: var(--bg); }

.log-time {
  font-family: 'Roboto Mono', monospace;
  font-size: 11px;
  color: var(--t4);
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 1px;
}

.log-lvl {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}
.log-lvl.info  { background: var(--blue-light);  color: var(--blue); }
.log-lvl.warn  { background: var(--amber-light);  color: var(--amber); }
.log-lvl.error { background: var(--red-light);    color: var(--red); }
.log-lvl.debug { background: var(--bg);           color: var(--t4); }

.log-msg { color: var(--t2); flex: 1; word-break: break-word; }

/* ══════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════ */
.toast-wrap {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--t1);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--r-lg);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-pop);
  z-index: 1000;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: transform .25s ease, opacity .25s ease;
  max-width: 380px;
}
.toast-wrap.show { transform: translateY(0); opacity: 1; }
.toast-wrap.error { background: var(--red); }

/* ══════════════════════════════════════════════
   HIDDEN ENGINE CONTROLS (JS refs)
══════════════════════════════════════════════ */
.engine-btn { display: none; }

/* ══════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════ */
@media (max-width: 1200px) {
  .dash-row-1 {
    grid-template-columns: 1fr 180px 260px;
  }
  .dash-row-3 {
    grid-template-columns: 1fr 1fr;
  }
  .card-goals { grid-column: 1 / -1; }
}

@media (max-width: 960px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-pop);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-wrap { margin-left: 0 !important; }
  .dash-row-1, .dash-row-2, .dash-row-3 { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .test-layout { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .content-area { padding: 16px; }
  .topbar { padding: 0 16px; }
  .topbar-search { max-width: 200px; }
  .topbar-user-info { display: none; }
  .btn-add-widget span:not(svg) { display: none; }
  .dash-row-1, .dash-row-2, .dash-row-3 { gap: 12px; }
}
