/* ============================================================
   DealerLoop — Global Stylesheet
   Dark Navy + Deep Blue + Orange Accent Enterprise Theme
   ============================================================ */

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

:root {
  /* Brand Colors */
  --navy:       #0A0F1E;
  --navy-mid:   #0D1528;
  --navy-light: #111D35;
  --panel:      #141F38;
  --panel-mid:  #192444;
  --panel-light:#1E2B4F;
  --border:     #1F3060;
  --border-lite:#243466;

  /* Accent */
  --orange:     #F47320;
  --orange-lite:#FF8C3A;
  --orange-dim: rgba(244,115,32,0.15);
  --orange-glow:rgba(244,115,32,0.08);

  /* Text */
  --text-primary:   #E8EDF8;
  --text-secondary: #8A9AC0;
  --text-muted:     #556085;
  --text-orange:    #F47320;

  /* Status Colors */
  --green:   #22C55E;
  --green-dim:rgba(34,197,94,0.15);
  --blue:    #3B82F6;
  --blue-dim: rgba(59,130,246,0.15);
  --yellow:  #EAB308;
  --yellow-dim:rgba(234,179,8,0.15);
  --red:     #EF4444;
  --red-dim: rgba(239,68,68,0.15);
  --purple:  #A855F7;
  --purple-dim:rgba(168,85,247,0.15);
  --teal:    #14B8A6;
  --teal-dim: rgba(20,184,166,0.15);

  /* Sizing */
  --sidebar-w: 240px;
  --topbar-h:  64px;
  --radius:    10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
}

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--navy);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--navy-mid); }
::-webkit-scrollbar-thumb { background: var(--border-lite); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--orange); }

/* ── Typography ── */
h1 { font-size: 1.65rem; font-weight: 700; }
h2 { font-size: 1.3rem;  font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 600; }
h4 { font-size: 0.9rem;  font-weight: 600; }

a { color: var(--orange); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--orange-lite); }

/* ============================================================
   LAYOUT SHELL
   ============================================================ */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy-mid);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-logo {
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy-mid);
}

.sidebar-logo-img {
  width: 100%;
  max-width: 190px;
  height: auto;
  object-fit: contain;
  display: block;
  /* logo has white text on transparent — it looks great on dark */
  filter: drop-shadow(0 2px 8px rgba(244,115,32,0.15));
}

.logo-mark {
  width: 38px; height: 38px;
  background: var(--orange);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 800; color: #fff;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.logo-text { display: flex; flex-direction: column; }
.logo-text strong { font-size: 0.95rem; font-weight: 800; color: var(--text-primary); letter-spacing: 0.3px; }
.logo-text span   { font-size: 0.68rem; color: var(--text-muted); font-weight: 500; letter-spacing: 0.5px; text-transform: uppercase; }

.sidebar-oem-badge {
  margin: 12px 14px;
  padding: 10px 12px;
  background: var(--orange-dim);
  border: 1px solid rgba(244,115,32,0.25);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; gap: 10px;
}

.oem-badge-icon {
  width: 28px; height: 28px;
  background: var(--orange);
  border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 800; color: #fff;
  flex-shrink: 0;
}

.oem-badge-text strong { font-size: 0.78rem; font-weight: 700; color: var(--text-primary); display: block; }
.oem-badge-text span   { font-size: 0.67rem; color: var(--text-orange); font-weight: 500; }

.sidebar-nav { flex: 1; padding: 8px 0; }

.nav-section-label {
  padding: 14px 16px 6px;
  font-size: 0.64rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 16px;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 0;
  border-left: 3px solid transparent;
  transition: all 0.18s;
  position: relative;
}

.nav-item:hover { background: var(--panel); color: var(--text-primary); border-left-color: var(--border-lite); }
.nav-item.active { background: var(--orange-glow); color: var(--text-orange); border-left-color: var(--orange); font-weight: 600; }
.nav-item.active .nav-icon { color: var(--orange); }

.nav-icon { font-size: 1rem; width: 18px; text-align: center; }

.nav-badge {
  margin-left: auto;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  background: var(--orange);
  color: #fff;
}

.nav-badge.blue { background: var(--blue); }
.nav-badge.green { background: var(--green); }

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}

.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--orange), #c45a18);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

.avatar-text strong { font-size: 0.78rem; font-weight: 600; display: block; }
.avatar-text span   { font-size: 0.67rem; color: var(--text-muted); }

/* ── Main Content ── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Topbar ── */
.topbar {
  height: var(--topbar-h);
  background: var(--navy-mid);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
  z-index: 50;
}

.topbar-title { flex: 1; }
.topbar-title h1 { font-size: 1.05rem; font-weight: 700; }
.topbar-title p  { font-size: 0.75rem; color: var(--text-secondary); margin-top: 1px; }

.topbar-actions { display: flex; align-items: center; gap: 10px; }

/* ── Page Body ── */
.page-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* ============================================================
   UTILITY COMPONENTS
   ============================================================ */

/* ── Card ── */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

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

.card-header h3 { font-size: 0.92rem; font-weight: 700; }
.card-body { padding: 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--panel-mid);
}

/* ── Stat Card ── */
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}

.stat-card:hover { border-color: var(--border-lite); transform: translateY(-1px); }

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent-color, var(--orange));
}

.stat-label { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 8px; }
.stat-value { font-size: 1.9rem; font-weight: 800; color: var(--text-primary); line-height: 1; }
.stat-value.orange { color: var(--orange); }
.stat-sub   { font-size: 0.73rem; color: var(--text-secondary); margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.stat-delta { font-weight: 600; }
.stat-delta.up   { color: var(--green); }
.stat-delta.down { color: var(--red); }
.stat-icon-bg {
  position: absolute;
  right: 16px; top: 50%;
  transform: translateY(-50%);
  font-size: 2.4rem;
  opacity: 0.06;
}

/* ── Button ── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px;
  font-size: 0.82rem; font-weight: 600;
  border-radius: var(--radius-sm);
  border: none; cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}

.btn-primary  { background: var(--orange); color: #fff; }
.btn-primary:hover  { background: var(--orange-lite); color: #fff; }

.btn-secondary { background: var(--panel-light); color: var(--text-primary); border: 1px solid var(--border-lite); }
.btn-secondary:hover { background: var(--panel-mid); border-color: var(--orange); color: var(--orange); }

.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--orange); color: var(--orange); }

.btn-sm { padding: 5px 11px; font-size: 0.76rem; }
.btn-icon { padding: 8px; width: 34px; height: 34px; justify-content: center; }

/* ── Badge ── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  font-size: 0.7rem; font-weight: 700;
  border-radius: 20px;
  white-space: nowrap;
}

.badge-orange { background: var(--orange-dim); color: var(--orange); }
.badge-green  { background: var(--green-dim);  color: var(--green); }
.badge-blue   { background: var(--blue-dim);   color: var(--blue); }
.badge-yellow { background: var(--yellow-dim); color: var(--yellow); }
.badge-red    { background: var(--red-dim);    color: var(--red); }
.badge-purple { background: var(--purple-dim); color: var(--purple); }
.badge-teal   { background: var(--teal-dim);   color: var(--teal); }
.badge-gray   { background: rgba(138,154,192,0.12); color: var(--text-secondary); }

/* ── Table ── */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.83rem; }
.data-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-mid);
  white-space: nowrap;
}

.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid rgba(31,48,96,0.5);
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(244,115,32,0.04); }

/* ── Progress Bar ── */
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--orange);
  border-radius: 3px;
  transition: width 0.5s ease;
}
.progress-fill.green  { background: var(--green); }
.progress-fill.blue   { background: var(--blue); }
.progress-fill.yellow { background: var(--yellow); }

/* ── Lead Score Pill ── */
.score-pill {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 22px;
  border-radius: 11px;
  font-size: 0.72rem; font-weight: 700;
}

/* ── Channel Icon Chips ── */
.channel-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  font-size: 0.72rem; font-weight: 600;
  border-radius: 20px;
}

.channel-facebook { background: rgba(24,119,242,0.18); color: #4F8FF7; }
.channel-google   { background: rgba(234,67,53,0.15);  color: #F97066; }
.channel-geofencing { background: rgba(168,85,247,0.15); color: #C084FC; }
.channel-banner   { background: rgba(20,184,166,0.15); color: #2DD4BF; }
.channel-direct_mail { background: rgba(234,179,8,0.15); color: #FCD34D; }
.channel-organic  { background: var(--green-dim); color: var(--green); }

/* ── Donut / Mini Chart wrappers ── */
.mini-chart { position: relative; }

/* ── Tabs ── */
.tab-bar {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--panel-mid);
  border-radius: var(--radius-sm);
  width: fit-content;
}

.tab-btn {
  padding: 6px 16px;
  font-size: 0.8rem; font-weight: 600;
  border: none; background: transparent;
  color: var(--text-secondary);
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.18s;
}

.tab-btn.active { background: var(--panel-light); color: var(--text-orange); box-shadow: 0 1px 4px rgba(0,0,0,0.2); }
.tab-btn:hover:not(.active) { color: var(--text-primary); background: rgba(255,255,255,0.04); }

/* ── Section Divider ── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}

.section-header h2 { font-size: 1rem; font-weight: 700; }
.section-header p  { font-size: 0.77rem; color: var(--text-secondary); margin-top: 2px; }

/* ── Form Controls ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.77rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }

.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--navy-light);
  border: 1px solid var(--border-lite);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 0.83rem;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-dim);
}

.form-select { appearance: none; cursor: pointer; }
.form-textarea { resize: vertical; min-height: 80px; }

/* ── Grid Helpers ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.grid-5 { display: grid; grid-template-columns: repeat(5,1fr); gap: 16px; }

/* ── Flex Helpers ── */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }

/* ── Spacing ── */
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

/* ── Text Helpers ── */
.text-orange  { color: var(--orange); }
.text-muted   { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-sm { font-size: 0.78rem; }
.text-xs { font-size: 0.7rem; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }

/* ── Divider ── */
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* ── Notification Dot ── */
.notif-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--orange);
  display: inline-block;
}

/* ── Overlay Panels ── */
.overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(5,8,18,0.7);
  z-index: 300;
  backdrop-filter: blur(2px);
}

.overlay.open { display: flex; align-items: flex-start; justify-content: flex-end; }

.drawer {
  width: 520px;
  max-width: 95vw;
  height: 100%;
  background: var(--panel);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  animation: slideIn 0.25s ease;
  overflow-y: auto;
}

@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }

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

.drawer-body { flex: 1; padding: 22px; overflow-y: auto; }

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(5,8,18,0.8);
  z-index: 400;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 560px; max-width: 95vw;
  max-height: 90vh;
  display: flex; flex-direction: column;
  animation: popIn 0.2s ease;
  overflow: hidden;
}

@keyframes popIn { from { transform: scale(0.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }

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

.modal-body { padding: 22px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ── Toast ── */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 600;
  display: flex; flex-direction: column; gap: 10px;
}

.toast {
  background: var(--panel-light);
  border: 1px solid var(--border-lite);
  border-radius: var(--radius);
  padding: 12px 18px;
  min-width: 280px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: toastIn 0.25s ease;
  font-size: 0.83rem;
}

@keyframes toastIn { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.toast-icon { font-size: 1.1rem; }
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.info    { border-left: 3px solid var(--blue); }

/* ── Lead Pipeline Column ── */
.pipeline-board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }

.pipeline-col {
  flex-shrink: 0;
  width: 200px;
  background: var(--panel-mid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.pipeline-col-header {
  padding: 10px 14px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.pipeline-col-header h4 { font-size: 0.78rem; font-weight: 700; }
.pipeline-col-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 80px; }

.pipeline-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.18s, transform 0.18s;
}

.pipeline-card:hover { border-color: var(--orange); transform: translateY(-1px); }
.pipeline-card-name { font-size: 0.82rem; font-weight: 600; margin-bottom: 4px; }
.pipeline-card-meta { font-size: 0.7rem; color: var(--text-muted); display: flex; align-items: center; gap: 5px; }

/* ── Funnel Bar ── */
.funnel-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(31,48,96,0.5);
}
.funnel-row:last-child { border-bottom: none; }
.funnel-label { width: 120px; font-size: 0.78rem; color: var(--text-secondary); flex-shrink: 0; }
.funnel-bar-wrap { flex: 1; }
.funnel-count { width: 60px; text-align: right; font-size: 0.83rem; font-weight: 700; flex-shrink: 0; }
.funnel-pct { width: 44px; text-align: right; font-size: 0.73rem; color: var(--text-muted); flex-shrink: 0; }

/* ── Landing Page Preview Card ── */
.lp-preview-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
}

.lp-preview-card:hover { border-color: var(--orange); transform: translateY(-2px); }

.lp-preview-thumb {
  height: 140px;
  background: linear-gradient(135deg, var(--navy-light), var(--panel-mid));
  position: relative;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem;
}

.lp-preview-info { padding: 14px; }
.lp-preview-title { font-size: 0.87rem; font-weight: 700; margin-bottom: 4px; }
.lp-preview-meta  { font-size: 0.72rem; color: var(--text-muted); }

/* ── Source Row ── */
.source-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(31,48,96,0.4);
}
.source-row:last-child { border-bottom: none; }
.source-row .label { font-size: 0.81rem; font-weight: 500; flex: 1; }
.source-row .value { font-size: 0.85rem; font-weight: 700; min-width: 60px; text-align: right; }
.source-row .change { font-size: 0.71rem; color: var(--green); min-width: 44px; text-align: right; }

/* ── Empty State ── */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 24px;
  text-align: center;
  gap: 14px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 3rem; opacity: 0.4; }
.empty-state h3 { font-size: 0.95rem; color: var(--text-secondary); }
.empty-state p { font-size: 0.82rem; max-width: 320px; }

/* ── Dealer Card (Grid) ── */
.dealer-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
  position: relative;
  overflow: hidden;
}

.dealer-card:hover { border-color: var(--orange); transform: translateY(-2px); }

.dealer-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.dealer-initials {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--orange), #c45a18);
}

.dealer-stats { display: flex; gap: 16px; margin-top: 12px; }
.dealer-stat-item { flex: 1; }
.dealer-stat-item .val { font-size: 1.2rem; font-weight: 800; color: var(--text-primary); }
.dealer-stat-item .lbl { font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* ── LP Thumbnail shapes ── */
.lp-shape {
  position: absolute;
  border-radius: 50%;
  background: rgba(244,115,32,0.1);
}

/* ── AI Nurture Banner ── */
.ai-banner {
  background: linear-gradient(135deg, rgba(168,85,247,0.18), rgba(59,130,246,0.12));
  border: 1px solid rgba(168,85,247,0.3);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex; align-items: center; gap: 14px;
}

.ai-icon-circle {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, #7C3AED, #2563EB);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

/* ── Scrollable areas ── */
.scroll-x { overflow-x: auto; }

/* ── LP Builder Enhancements ── */
@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes pulse   { 0%,100%{opacity:1} 50%{opacity:0.3} }
@keyframes fadeIn  { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }
@keyframes slideIn { from { transform:translateX(-8px); opacity:0; } to { transform:translateX(0); opacity:1; } }

/* AI progress animation */
.ai-step-active {
  animation: slideIn 0.3s ease;
}

/* LP builder step tabs */
#lpStepProgress { gap: 0; }
#lpStepProgress > div { flex-shrink: 0; }

/* LP config panel animation */
#lpConfigPanel > div { animation: fadeIn 0.25s ease; }

/* Catalog modal overlay */
#catalogEmbedModal,
#productDetailModal,
#lpAnalyticsModal {
  display: none;
}
#catalogEmbedModal[style*="flex"],
#productDetailModal[style*="flex"],
#lpAnalyticsModal[style*="flex"] {
  display: flex !important;
}

/* Catalog click tracking dot */
.tracking-live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #C084FC;
  animation: pulse 1.8s infinite;
  margin-right: 6px;
}

/* Dealer campaign group styles */
.dealer-campaign-group { animation: fadeIn 0.3s ease; }

/* LP preview browser chrome */
.lp-browser-chrome {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

/* Product card hover on catalog */
.product-catalog-card {
  transition: all 0.2s;
  cursor: pointer;
}
.product-catalog-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

/* Form field toggle rows */
.form-field-row { transition: background 0.15s; }
.form-field-row:hover { background: rgba(244,115,32,0.04) !important; }

/* Color preset swatches */
.color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}
.color-swatch:hover { transform: scale(1.2); box-shadow: 0 2px 8px rgba(0,0,0,0.3); }

/* LP stats mini-bar */
.lp-stats-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.lp-stat-pill {
  padding: 8px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── CRM Connector cards ── */
.crm-connector-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s;
}
.crm-connector-card:hover { border-color: var(--orange); }

/* ── Rooftop config tabs ── */
.rooftop-tab {
  padding: 8px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.2s;
}
.rooftop-tab.active {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
}

/* ── Compliance badges ── */
.compliance-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 700;
}
.compliance-badge.ok      { background: var(--green-dim);          color: var(--green);  }
.compliance-badge.warn    { background: rgba(234,179,8,0.15);     color: var(--yellow); }
.compliance-badge.blocked { background: var(--red-dim);            color: var(--red);    }

/* ── Coverage metric bars ── */
.coverage-bar-row {
  display: grid;
  grid-template-columns: 52px 1fr 1fr 1fr 1fr 60px;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

/* ── Stalled lead alert card ── */
.stalled-card {
  padding: 12px 16px;
  background: var(--panel-mid);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* ── Voice preset selection ── */
.voice-preset-card {
  padding: 12px;
  background: var(--panel-mid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}
.voice-preset-card:hover     { border-color: rgba(168,85,247,0.4); }
.voice-preset-card.active    { background: rgba(168,85,247,0.1); border-color: rgba(168,85,247,0.5); }

/* ── Lead State Machine badge ── */
.state-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 700;
}

/* ── Bidirectional sync arrows ── */
.sync-arrow-left  { color: #C084FC; }
.sync-arrow-right { color: var(--orange); }

/* ── Audit trail table ── */
.audit-row-compliant  { border-left: 2px solid var(--green); }
.audit-row-pending    { border-left: 2px solid var(--yellow); }
.audit-row-violation  { border-left: 2px solid var(--red); }

/* ── Metric cohort grid ── */
.cohort-row {
  display: grid;
  grid-template-columns: 48px 1fr 1fr 1fr 1fr 60px;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

/* ── Jump-in alert pulse ── */
.jump-in-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.62rem;
  padding: 1px 6px;
  background: rgba(34,197,94,0.2);
  border-radius: 6px;
  color: var(--green);
  font-weight: 700;
  animation: pulse 2s infinite;
}

/* ── Expanded sidebar nav ── */
.nav-section-label {
  font-size: 0.6rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 14px 18px 6px;
}

/* ============================================================
   MOBILE HAMBURGER & RESPONSIVE SIDEBAR
   ============================================================ */

/* Hamburger button — hidden on desktop */
.hamburger-btn {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 300;
  width: 38px;
  height: 38px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0;
  transition: background 0.2s, border-color 0.2s;
}

.hamburger-btn:hover { background: var(--panel-mid); border-color: var(--orange); }

.hamburger-btn span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all 0.25s;
}

/* Sidebar overlay (backdrop on mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 199;
  backdrop-filter: blur(2px);
}

.sidebar-overlay.open { display: block; }

/* Sidebar close button (mobile only) */
.sidebar-close-btn {
  display: none;
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.85rem;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.sidebar-close-btn:hover { background: var(--red-dim); color: var(--red); border-color: var(--red); }

/* ── Responsive breakpoints ── */
@media (max-width: 1100px) {
  :root { --sidebar-w: 210px; }
}

@media (max-width: 900px) {
  :root { --sidebar-w: 210px; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .grid-5 { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 0 16px; }
  .page-body { padding: 16px; }
}

@media (max-width: 700px) {
  /* Show hamburger, hide fixed sidebar */
  .hamburger-btn     { display: flex; }
  .sidebar-close-btn { display: flex; }

  /* Sidebar becomes a drawer from the left */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 260px !important;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.28s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,0.6);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  /* Main content takes full width */
  .main-content {
    width: 100%;
    margin-left: 0;
  }

  /* Topbar padded left to make room for hamburger */
  .topbar {
    padding-left: 60px;
    padding-right: 12px;
  }

  .topbar-actions { gap: 6px; }
  .topbar-actions .btn span,
  .topbar-actions .btn:not(.btn-icon):not(.btn-primary) { display: none; }

  .page-body { padding: 12px; }

  .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }

  /* Stat cards in 2 cols on mobile */
  .stat-card .stat-value { font-size: 1.4rem; }

  /* Modals go full-width */
  .modal { max-width: calc(100vw - 24px) !important; margin: 12px; }

  /* Tables scroll */
  .scroll-x { overflow-x: auto; }
}
