@import url("./shared/components.css");

/* ===========================
   DKA Sales Dashboard — Styles
   Dark data-dense dashboard
   =========================== */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; margin: 0; }

:root {
  /* Surfaces */
  --bg-base: #0f1117;
  --bg-surface: #161821;
  --bg-raised: #1c1e2b;
  --bg-overlay: #232636;
  --bg-hover: #282b3a;
  --bg-input: #1a1c28;

  /* Borders */
  --border: rgba(255,255,255,0.06);
  --border-strong: rgba(255,255,255,0.12);
  --border-accent: rgba(32,128,141,0.3);

  /* Text */
  --text-primary: #f0f0f4;
  --text-secondary: #a0a3b1;
  --text-muted: #6b6f80;
  --text-faint: #4a4d5e;

  /* DKA's red (lost / no-reply / not-delivered labels, conversation modals). One place to change it. */
  --brand-red: #c0392b;

  /* Accent */
  --accent: #20808D;
  --accent-light: #2ba3b2;
  --accent-muted: rgba(32,128,141,0.15);
  --accent-glow: rgba(32,128,141,0.25);

  /* Status */
  --green: #22c55e;
  --green-muted: rgba(34,197,94,0.12);
  --amber: #f59e0b;
  --amber-muted: rgba(245,158,11,0.12);
  --red: #ef4444;
  --red-muted: rgba(239,68,68,0.12);
  --blue: #3b82f6;
  --blue-muted: rgba(59,130,246,0.12);
  --purple: #a855f7;
  --purple-muted: rgba(168,85,247,0.12);

  /* Tier colors */
  --tier1: #20808D;
  --tier2: #3b82f6;
  --tier3: #a855f7;
  --tier4: #f59e0b;
  --tier5: #ef4444;

  /* Spacing (4px base) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', ui-monospace, monospace;
  --text-xs: 11px;
  --text-sm: 12px;
  --text-base: 13px;
  --text-md: 14px;
  --text-lg: 16px;
  --text-xl: 20px;
  --text-2xl: 24px;
  --text-3xl: 32px;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;

  --sidebar-width: 240px;
  --header-height: 64px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);

  --transition: 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

body.light {
  --bg-base: #f4f5f7;
  --bg-surface: #ffffff;
  --bg-raised: #f0f1f4;
  --bg-overlay: #e8eaef;
  --bg-hover: #e2e4eb;
  --bg-input: #eceef3;
  --border: rgba(0,0,0,0.07);
  --border-strong: rgba(0,0,0,0.14);
  --border-accent: rgba(32,128,141,0.25);
  --text-primary: #14161f;
  --text-secondary: #4a4d5e;
  --text-muted: #7a7e92;
  --text-faint: #b0b4c4;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

body {
  font-family: var(--font);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: tabular-nums lining-nums;
}

/* --- Dashboard Grid --- */
.dashboard {
  display: flex;
  height: 100dvh;
  overflow: hidden;
  width: 100%;
}

.mobile-header {
  display: none;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 100;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-5);
  border-bottom: 1px solid var(--border);
  min-height: 60px;
}

.logo-icon {
  color: var(--text-primary);
  flex-shrink: 0;
}

.logo-img {
  flex-shrink: 0;
  object-fit: contain;
  background: #fff;
  border-radius: 6px;
  padding: 3px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-name {
  font-size: var(--text-md);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.brand-sub {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.sidebar-nav {
  padding: var(--space-3) var(--space-3);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-group + .nav-group {
  margin-top: var(--space-3);
}

.nav-group-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: var(--space-2) var(--space-3) var(--space-1);
  user-select: none;
}
.nav-group-label--dim {
  font-weight: 600;
  color: var(--text-faint);
}
.nav-group--divided {
  border-top: 1px solid var(--border);
  margin-top: var(--space-2);
  padding-top: var(--space-2);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--text-base);
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
}

.nav-item:hover {
  background: rgba(32, 128, 141, 0.08);
  color: var(--text-primary);
}

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

.nav-item.active svg {
  color: var(--accent);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}
.nav-plus-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.75;
}
.nav-plus-icon svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 2;
}
.nav-item.active .nav-plus-icon {
  opacity: 1;
}
.nav-item:hover .nav-plus-icon {
  opacity: 1;
}

.nav-item.active svg {
  opacity: 1;
}

.nav-sub-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px var(--space-3) 5px 36px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
  margin-top: 1px;
}
.nav-sub-item svg { flex-shrink: 0; opacity: 0.5; }
.nav-sub-item:hover { background: rgba(32,128,141,0.06); color: var(--text-secondary); }
.nav-sub-item:hover svg { opacity: 0.8; }
.nav-sub-item.active { color: var(--accent-light); background: var(--accent-muted); }
.nav-sub-item.active svg { opacity: 1; color: var(--accent); }
.nav-sub-badge:empty { display: none; }
.nav-sub-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 20px;
  padding: 1px 6px;
  line-height: 16px;
}
body.light .nav-sub-badge {
  background: rgba(0,0,0,0.08);
  border-color: rgba(0,0,0,0.15);
  color: #444;
}

.sidebar-footer {
  padding: var(--space-4);
  border-top: 1px solid var(--border);
  margin-top: auto;
}

/* --- Facebook Nav Status --- */
.nav-oauth-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 var(--space-4) 5px;
}
.fb-nav-status,
.gmail-nav-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  flex: 1;
  min-width: 0;
  border-radius: 6px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  overflow: hidden;
}
.fb-nav-prefix,
.gmail-nav-prefix {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.fb-nav-badge,
.gmail-nav-badge {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fb-nav-badge.connected,
.gmail-nav-badge.connected {
  color: #22c55e;
}
.fb-nav-connect {
  flex-shrink: 0;
  background: rgba(24, 119, 242, 0.08);
  border: 1px solid rgba(24, 119, 242, 0.25);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 10px;
  font-weight: 500;
  color: #1877F2;
  cursor: pointer;
  white-space: nowrap;
}
.fb-nav-connect:hover { opacity: 0.8; }
.gmail-nav-connect {
  flex-shrink: 0;
  background: var(--accent-muted);
  border: 1px solid var(--border-accent);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 10px;
  font-weight: 500;
  color: var(--accent-light);
  cursor: pointer;
  white-space: nowrap;
}
.gmail-nav-connect:hover { opacity: 0.8; }

/* --- Contact Quota Widget --- */
.contact-quota-widget {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 12px;
  margin-bottom: 10px;
}

.cq-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}

.cq-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.cq-month {
  font-size: 10px;
  color: var(--text-faint);
}

.cq-count {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 7px;
}

.cq-num {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1;
}

.cq-denom {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-faint);
}

.cq-bar-track {
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  height: 4px;
  overflow: hidden;
  margin-bottom: 5px;
}

body.light .cq-bar-track {
  background: rgba(0,0,0,0.07);
}

.cq-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: 4px;
}

.cq-remaining {
  font-size: 10px;
  color: var(--text-muted);
}

.user-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
}

.theme-toggle {
  margin-left: auto;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--bg-raised);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), transform 0.3s;
}

.theme-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  transform: rotate(20deg);
}

.theme-toggle svg {
  width: 14px;
  height: 14px;
}

body:not(.light) .icon-sun { display: none; }
body.light .icon-moon { display: none; }

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-muted);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 700;
  flex-shrink: 0;
}

.user-avatar-img {
  object-fit: cover;
}

.user-details {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.user-role {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* --- Main Area --- */
.main-area {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-base);
  flex: 1;
  min-width: 0;
}

/* --- KPI Header / Pipeline Strip (global) --- */
.kpi-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0 var(--space-6);
  flex-shrink: 0;
  z-index: 10;
}

.kpi-bar {
  display: flex;
  gap: var(--space-1);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.kpi-card {
  display: flex;
  flex-direction: column;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  min-width: 130px;
  flex: 1;
}

.kpi-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.kpi-value {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.kpi-value.accent {
  color: var(--accent-light);
}

.kpi-unit {
  font-size: 0.65em;
  font-weight: 500;
  color: var(--text-muted);
  vertical-align: baseline;
}

/* --- Content --- */
.content {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-6);
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: fadeIn 200ms ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes sendPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.65); }
}

.view-header {
  display: flex;
  align-items: baseline;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.view-header h1 {
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.view-date {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* --- Cards --- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  overflow: hidden;
}

.card-header {
  margin-bottom: var(--space-4);
}

.card-header h2 {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text-primary);
}

/* --- Dashboard view overrides --- */
#view-dashboard.active {
  display: flex;
  flex-direction: column;
}

/* --- Pipeline Strip --- */
.pipeline-strip {
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  height: 88px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 0;
}

.pipeline-strip-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-right: 32px;
  flex-shrink: 0;
}

.pipeline-strip-heading {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.pipeline-strip-date {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.pipeline-stages {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.pipe-stage {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  flex-shrink: 0;
}

.pipe-stage-label {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.pipe-stage-num {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1;
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.pipe-delta {
  font-size: 10px;
  font-weight: 500;
  color: var(--green);
  letter-spacing: 0;
}

.pipe-enrolled-tag {
  font-size: 10px;
  font-weight: 500;
  color: var(--green);
  letter-spacing: 0;
}

.pipe-bar {
  height: 3px;
  width: 100%;
  border-radius: 2px;
  margin-top: 2px;
}

.pipe-bar-indigo { background: #4f46e5; }
.pipe-bar-teal   { background: #20808D; }
.pipe-bar-amber  { background: var(--amber); }
.pipe-bar-green  { background: var(--green); }

.pipe-stage-enrolled .pipe-stage-label {
  color: var(--green);
}

.pipe-stage-enrolled .pipe-stage-num {
  color: var(--green);
}

.pipe-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 0 14px;
  flex-shrink: 0;
  padding-top: 14px;
}

.pipe-rate {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
}

.pipe-arrow {
  font-size: 13px;
  color: var(--border-strong);
}

.pipeline-revenue {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
  margin-left: 24px;
  padding-left: 24px;
  border-left: 1px solid var(--border);
}

.pipe-rev-label {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pipe-rev-val {
  font-size: 28px;
  font-weight: 800;
  color: var(--green);
  letter-spacing: -0.03em;
  line-height: 1;
}

.pipe-rev-sub {
  font-size: 10px;
  color: var(--text-muted);
}

/* --- Pipeline Brief --- */
#pipelineBrief { margin: 0 var(--space-6) 0; }
.pb-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 15px 20px;
}
.pb-analyzing {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 120px;
  font-size: 15px;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.01em;
  background-image: radial-gradient(circle, var(--border-strong) 1px, transparent 1px);
  background-size: 24px 24px;
  border-radius: 10px;
  animation: pb-fade-pulse 1.6s ease-in-out infinite;
}
@keyframes pb-fade-pulse {
  0%, 100% { opacity: 0.6; }
  50%       { opacity: 1; }
}
.pb-dots::after {
  content: '';
  animation: pb-dot-anim 1.2s steps(1) infinite;
}
@keyframes pb-dot-anim {
  0%   { content: ''; }
  33%  { content: '.'; }
  66%  { content: '..'; }
  100% { content: '...'; }
}
.pb-header {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 12px;
}
.pb-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.pb-date { font-size: 11px; color: var(--text-faint); margin-left: auto; }
.pb-list { display: flex; flex-direction: column; gap: 9px; }
.pb-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
}
.pb-item strong { color: var(--text-primary); font-weight: 600; }
.pb-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
}
.pb-dot--action      { background: #F59E0B; }
.pb-dot--opportunity { background: var(--accent); }
.pb-dot--stale       { background: #F87171; }
.pb-dot--info        { background: var(--text-faint); }

/* --- Dashboard Body --- */
.dash-body {
  display: flex;
  flex-direction: row;
  gap: 0;
  flex: 1;
  min-height: 0;
  padding: var(--space-4) var(--space-6);
  gap: var(--space-3);
}

.dash-charts-col {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: var(--space-3);
  min-width: 0;
}

.dash-chart-card {
}

.chart-container-compact {
  position: relative;
  height: 180px;
}

.dash-leads-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding-bottom: 0 !important;
  overflow: hidden;
}

.dash-leads-list {
  flex: 1;
  overflow-y: auto;
  margin: 0 calc(-1 * var(--space-5));
}

.dash-lead-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px var(--space-5);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.dash-lead-row:last-child {
  border-bottom: none;
}

.dash-lead-avatar {
  flex-shrink: 0;
}

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

.dash-lead-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-lead-meta {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-lead-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
}

.dash-lead-followers {
  font-size: 10px;
  color: var(--text-muted);
}

.dash-leads-footer {
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.dash-leads-link {
  font-size: 12px;
  color: #20808D;
  font-weight: 500;
  text-decoration: none;
}

.dash-leads-link:hover {
  text-decoration: underline;
}

/* --- Dashboard Grid (legacy, kept for other views) --- */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-3);
}

.card-lg {
  grid-column: span 2;
}

.card-market {
  grid-column: span 2;
}

.card-market-bottom {
  grid-column: unset;
  margin-top: 0;
}

.dash-market-section {
  margin: 0 var(--space-6) var(--space-6);
}

.card-timeline {
  grid-column: 3 / 4;
  grid-row: span 3;
  max-height: none;
  overflow-y: auto;
}

.card-header {
  margin-bottom: var(--space-4);
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
}

.card-subtitle {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 400;
}

.chart-container {
  position: relative;
  height: 200px;
}

.chart-container-sm {
  height: 180px;
}

/* --- Enrollment Bars --- */
.enrollment-bars {
  padding: var(--space-4) var(--space-5) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.enroll-row-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-2);
}

.enroll-bar-track {
  display: flex;
  height: 32px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-raised);
}

.enroll-bar-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s;
  min-width: 2px;
}

.enroll-bar-seg:hover { opacity: 0.8; }

.enroll-bar-seg span {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
}

.enroll-bar-empty {
  font-size: var(--text-xs);
  color: var(--text-faint);
  padding: 0 var(--space-3);
  display: flex;
  align-items: center;
}

.enroll-legend {
  display: flex;
  gap: var(--space-4);
  margin-top: var(--space-2);
  font-size: 11px;
  color: var(--text-muted);
}

/* --- Funnel --- */
.funnel-container {
  padding: var(--space-3) 0 var(--space-2);
}

.funnel-step {
  margin-bottom: 2px;
}

.funnel-drop {
  font-size: 10px;
  color: var(--text-faint);
  text-align: center;
  margin-bottom: 2px;
  letter-spacing: 0.02em;
}

.funnel-drop-alert {
  color: var(--red);
  font-weight: 600;
}

.funnel-bar-wrap {
  display: flex;
  justify-content: center;
}

.funnel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 14px;
  border-radius: 4px;
  transition: opacity 0.15s;
  min-width: 120px;
}

.funnel-bar:hover {
  opacity: 0.85;
}

.funnel-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.02em;
}

.funnel-value {
  font-size: var(--text-sm);
  font-weight: 700;
  color: rgba(255,255,255,0.9);
}

/* --- Timeline --- */
.timeline {
  display: flex;
  flex-direction: column;
}

.timeline-item {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}

.timeline-item:last-child {
  border-bottom: none;
}

.tl-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.tl-dot-green { background: var(--green); }
.tl-dot-teal { background: var(--accent); }
.tl-dot-amber { background: var(--amber); }
.tl-dot-red { background: var(--red); }

.tl-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tl-text {
  font-size: var(--text-base);
  color: var(--text-primary);
  line-height: 1.4;
}

.tl-text strong {
  font-weight: 600;
}

.tl-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* --- Kanban Board --- */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--space-4);
  overflow-x: auto;
  padding-bottom: var(--space-4);
}

.kanban-col {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  min-width: 200px;
  display: flex;
  flex-direction: column;
}

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

.kanban-col-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.kanban-col-count {
  font-size: var(--text-xs);
  color: var(--text-muted);
  background: var(--bg-raised);
  padding: 2px 8px;
  border-radius: 10px;
}

.kanban-col-body {
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 1;
  min-height: 120px;
}

.kanban-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  transition: all var(--transition);
  cursor: default;
}

.kanban-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

.kanban-card-name {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.kanban-card-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.5;
}

.kanban-card-meta span {
  display: block;
}

/* --- Data Tables --- */
.table-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-base);
}

.data-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

.data-table th {
  background: var(--bg-raised);
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-strong);
  cursor: pointer;
  user-select: none;
  transition: color var(--transition);
}

.data-table th:hover {
  color: var(--text-primary);
}

.data-table th::after {
  content: '';
  display: inline-block;
  width: 0;
  margin-left: 4px;
}

.data-table th.sort-asc::after {
  content: '↑';
  color: var(--accent);
}

.data-table th.sort-desc::after {
  content: '↓';
  color: var(--accent);
}

.data-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-table tbody tr {
  transition: background var(--transition);
}

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

/* --- Status Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
}

.badge-red {
  background: var(--red-muted);
  color: var(--red);
}

.badge-source {
  background: none;
  color: var(--text-muted);
  font-weight: 500;
  padding: 0;
  border-radius: 0;
  display: block;
}

.source-link {
  display: block;
  font-size: 11px;
  color: #a78bfa;
  text-decoration: none;
  margin-top: 2px;
  opacity: 0.8;
}

.source-link:hover {
  opacity: 1;
  text-decoration: underline;
}

/* --- Status Dropdown --- */
.status-dropdown {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  border-radius: 10px;
  padding: 3px 22px 3px 10px;
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='currentColor' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 7px center;
  white-space: nowrap;
  max-width: 100%;
}

.status-dropdown:hover {
  opacity: 0.85;
}

/* --- Tier Badges --- */
.tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
}

.tier-1 { background: rgba(32,128,141,0.12); color: var(--tier1); }
.tier-2 { background: rgba(59,130,246,0.12); color: var(--tier2); }
.tier-3 { background: rgba(168,85,247,0.12); color: var(--tier3); }
.tier-4 { background: rgba(245,158,11,0.12); color: var(--tier4); }
.tier-5 { background: rgba(239,68,68,0.12); color: var(--tier5); }

/* Tier row left-border highlight */
.data-table tr[data-tier="1"] td:first-child { box-shadow: inset 3px 0 0 var(--tier1); }
.data-table tr[data-tier="2"] td:first-child { box-shadow: inset 3px 0 0 var(--tier2); }
.data-table tr[data-tier="3"] td:first-child { box-shadow: inset 3px 0 0 var(--tier3); }
.data-table tr[data-tier="4"] td:first-child { box-shadow: inset 3px 0 0 var(--tier4); }
.data-table tr[data-tier="5"] td:first-child { box-shadow: inset 3px 0 0 var(--tier5); }

/* Prospects table: fixed layout; colgroup col widths are border-box px — no ambiguity */
#prospectsTable { table-layout: fixed; }

/* --- Market Penetration Card --- */
.market-stats {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.market-stat-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-4);
}

.market-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.market-stat-value {
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
}

.market-stat-value.highlight {
  color: var(--accent-light);
}

.market-stat-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
}

.market-stat-detail {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.market-bar-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.market-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.market-bar-track {
  position: relative;
  height: 24px;
  background: var(--bg-raised);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: visible;
}

.market-bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  min-width: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  box-shadow: 0 0 12px rgba(32,128,141,0.4);
}

.market-bar-milestone {
  position: absolute;
  top: 0;
  height: 100%;
  width: 2px;
  background: var(--text-faint);
}

.market-bar-milestone::after {
  content: attr(data-label);
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}

.market-penetration-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: var(--space-4);
}

.market-pen-labels {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.market-pen-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.market-pen-pct {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}

.market-pen-sub {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
}

.market-pen-track {
  position: relative;
  height: 10px;
  background: var(--bg-raised);
  border-radius: 99px;
  border: 1px solid var(--border);
  overflow: visible;
}

.market-pen-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  min-width: 6px;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: 99px;
  box-shadow: 0 0 8px rgba(32,128,141,0.4);
}

.market-pen-marker {
  position: absolute;
  top: -3px;
  width: 1px;
  height: 16px;
  background: var(--border);
}

.market-pen-marker-label {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}

.market-pen-endpoints {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 14px;
}

.market-breakdown {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.market-isd-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: var(--space-4);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-raised);
  font-size: var(--text-sm);
}

.market-isd-name {
  font-weight: 600;
  color: var(--text-primary);
}

.market-isd-count {
  color: var(--text-secondary);
  font-weight: 500;
}

.market-isd-schools {
  color: var(--text-muted);
}

/* --- Source Filter Chips --- */
.source-chips-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
}

.source-chips-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  flex-shrink: 0;
}

.ig-review-notice {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 12px;
  font-size: 11px;
  color: #F59E0B;
  flex-shrink: 0;
  white-space: nowrap;
}
.ig-review-eta { opacity: 0.55; }

.nav-unread-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #F59E0B;
  position: absolute; top: 6px; right: 6px;
  animation: sa-review-pulse 1.8s ease-in-out infinite;
  pointer-events: none;
}

/* ── Right column ── */
.dash-right-col {
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* ── Notification stream widget ── */
.dash-notif-panel {
  flex-shrink: 0;
  padding-bottom: 0 !important;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.dash-notif-markall {
  background: none; border: none; padding: 0;
  font-size: 11px; color: var(--text-faint); cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
}
.dash-notif-markall:hover { color: var(--text-main); }
.dash-notif-list {
  margin: 0 calc(-1 * var(--space-5));
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.dash-notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px var(--space-5);
  border-top: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
  position: relative;
}
.dash-notif-item:hover { background: var(--surface2); }
.dash-notif-item.unread { background: rgba(245,158,11,0.05); }
.dash-notif-item.unread:hover { background: rgba(245,158,11,0.1); }
.dash-notif-icon {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(245,158,11,0.15);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 14px;
}
.dash-notif-item.unread .dash-notif-icon { background: rgba(245,158,11,0.22); }
.dash-notif-body { flex: 1; min-width: 0; }
.dash-notif-title { font-size: 12px; font-weight: 600; color: var(--text-main); line-height: 1.3; margin-bottom: 2px; }
.dash-notif-sub { font-size: 11px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-notif-time { font-size: 10px; color: var(--text-faint); margin-top: 3px; }
.dash-notif-unread-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #F59E0B; flex-shrink: 0; margin-top: 5px;
  animation: sa-review-pulse 1.8s ease-in-out infinite;
}
.dash-notif-empty {
  padding: 18px var(--space-5);
  border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-faint); text-align: center;
}

.source-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.source-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 400;
  color: #9CA3AF;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  cursor: pointer;
  transition: all 150ms;
  white-space: nowrap;
}

.source-chip:hover {
  border-color: rgba(255,255,255,0.18);
  color: var(--text-primary);
}

.source-chip.active {
  background: rgba(32,128,141,0.15);
  border-color: rgba(32,128,141,0.45);
  color: #20808D;
}

.source-chip.active .chip-count {
  background: rgba(32,128,141,0.2);
  color: #20808D;
}

.globe-icon {
  flex-shrink: 0;
  opacity: 0.8;
}

.chip-count {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(255,255,255,0.08);
  color: #6B7280;
}

/* --- Agent/Search tag (table) --- */
.agent-search-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  background: var(--accent-muted);
  border: 1px solid var(--border-accent);
  color: var(--accent-light);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

/* --- Prospect Criteria Card --- */
.criteria-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
}

.criteria-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.criteria-header h3 {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text-primary);
}

.criteria-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: var(--text-xs);
  font-weight: 600;
  background: var(--accent-muted);
  color: var(--accent-light);
  letter-spacing: 0.02em;
}

.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px 4px 8px;
  border-radius: 20px;
  background: rgba(139,92,246,0.12);
  border: 1px solid rgba(139,92,246,0.35);
  color: #a78bfa;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.criteria-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.criteria-note {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 400;
  color: #d97706;
  letter-spacing: 0.01em;
}

.criteria-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3) var(--space-5);
}

.criteria-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.criteria-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.criteria-value {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
}

/* --- Filter Bar --- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.filter-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-8) var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-family: var(--font);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color var(--transition);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 5L6 8L9 5' stroke='%236b6f80' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.filter-select:hover,
.filter-select:focus {
  border-color: var(--border-strong);
  outline: none;
}

.filter-reset {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-family: var(--font);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.filter-reset:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

/* --- ISD Accordion --- */
.isd-accordion {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.isd-section-row {
  cursor: pointer;
  user-select: none;
}
.isd-sortable { cursor: pointer; user-select: none; }
.isd-sortable:hover { color: var(--accent); }
.sort-icon { font-size: 10px; opacity: 0.5; margin-left: 2px; }

.isd-section-row:hover td {
  background: var(--bg-hover);
}

.isd-caret {
  width: 14px;
  height: 14px;
  margin-right: 8px;
  vertical-align: middle;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.isd-section-row td {
  background: var(--bg-raised);
  padding: var(--space-2) var(--space-4) !important;
  border-top: 2px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.isd-section-label {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-primary);
  margin-right: var(--space-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.isd-section-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.table-link {
  color: var(--accent-light);
  text-decoration: none;
  font-size: var(--text-xs);
}

.table-link:hover {
  text-decoration: underline;
}

.row-sub {
  display: none;
}

/* --- Prospect Footer --- */
.prospect-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* --- Utility Colors --- */
.text-green {
  color: var(--green);
}

@media (max-width: 768px) {
  .criteria-grid {
    grid-template-columns: 1fr 1fr;
  }

  .filter-bar {
    gap: var(--space-2);
  }

  .filter-select {
    flex: 1;
    min-width: 0;
  }
}

@media (max-width: 480px) {
  .criteria-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Outreach Sequences --- */
.outreach-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.outreach-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  font-size: 13px;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.15s;
}
.outreach-tab.active {
  color: var(--text-primary);
  font-weight: 500;
  border-bottom-color: #EC3025;
}
.outreach-tab-panel { display: none; }
.outreach-tab-panel.active { display: block; }

/* Contacts filter dropdowns */
.contacts-filter-bar { display: flex; gap: 8px; margin-bottom: 20px; }
.contacts-filter-select {
  background: var(--bg-surface); border: 1px solid var(--border-strong);
  border-radius: 6px; padding: 6px 26px 6px 10px; font-size: 12px;
  color: var(--text-secondary); cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b6f80' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
}
.seq-pro-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #EC3025;
  background: rgba(236,48,37,0.12);
  border: 1px solid rgba(236,48,37,0.25);
  border-radius: 4px;
  padding: 1px 5px;
}

/* Hero */
.seq-hero {
  display: flex;
  align-items: flex-start;
  gap: 40px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px 36px;
  margin-bottom: 28px;
}
.seq-hero-left { flex: 1; display: flex; flex-direction: column; gap: 14px; }
.seq-hero-eyebrow { display: flex; align-items: center; gap: 10px; }
.seq-hero-icon {
  width: 30px; height: 30px; border-radius: 7px;
  background: rgba(32,128,141,0.1); border: 1px solid rgba(32,128,141,0.2);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.seq-hero-eyebrow > span {
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--accent);
}
.seq-hero-headline {
  font-size: 24px; font-weight: 700; letter-spacing: -0.5px;
  line-height: 1.2; color: var(--text-primary); margin: 0;
}
.seq-hero-body { font-size: 13px; color: var(--text-muted); line-height: 1.6; margin: 0; }
.seq-feature-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 7px; }
.seq-feature-list li { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text-secondary); }
.seq-hero-cta { display: flex; align-items: center; gap: 14px; margin-top: 4px; }
.seq-unlock-btn {
  background: #EC3025; color: #fff; border: none; border-radius: 7px;
  padding: 10px 20px; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: opacity 0.15s;
}
.seq-unlock-btn:hover { opacity: 0.88; }
.seq-cta-sub { font-size: 12px; color: var(--text-muted); }

/* Sequence step preview */
.seq-preview { width: 320px; flex-shrink: 0; display: flex; flex-direction: column; gap: 7px; }
.seq-preview-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; }
.seq-preview-label { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.seq-preview-meta { font-size: 10px; color: var(--text-faint); }
.seq-step {
  background: rgba(255,255,255,0.03); border: 1px solid rgba(var(--step-color), 0.15);
  border-radius: 9px; padding: 12px 14px; display: flex; align-items: center; gap: 11px;
  border-color: rgba(255,255,255,0.1);
}
.seq-step-icon {
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--step-bg); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--step-color);
}
.seq-step-info { flex: 1; }
.seq-step-name { font-size: 12px; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.seq-step-sub { font-size: 11px; color: var(--text-muted); }
.seq-step-day {
  font-size: 10px; font-weight: 600; color: var(--step-color);
  background: var(--step-bg); padding: 2px 8px; border-radius: 5px; flex-shrink: 0;
}
.seq-connector {
  font-size: 10px; color: var(--text-faint); padding-left: 8px;
  display: flex; align-items: center; gap: 6px;
}
.seq-connector::before {
  content: ''; width: 1px; height: 14px; background: var(--border); display: inline-block;
}
.seq-autostop {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 12px; background: rgba(52,211,153,0.05);
  border: 1px solid rgba(52,211,153,0.15); border-radius: 7px; margin-top: 2px;
  font-size: 11px; color: #6EE7B7;
}

/* Section headers */
.seq-section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.seq-section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; color: var(--text-secondary);
}
.seq-locked-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 9px; font-weight: 600; color: var(--text-muted);
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 6px;
}
.seq-running-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 600; color: #22C55E;
  background: rgba(34,197,94,0.1); border-radius: 10px; padding: 1px 8px;
}
.seq-dot { width: 5px; height: 5px; border-radius: 50%; background: #22C55E; display: inline-block; }
.seq-section-sub { font-size: 11px; color: var(--text-faint); }

/* Template cards */
.seq-templates { display: flex; gap: 16px; margin-bottom: 28px; }
.seq-template-card {
  flex: 1; background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 18px; display: flex; flex-direction: column; gap: 14px;
}
.seq-locked { opacity: 0.4; pointer-events: none; }
.seq-tmpl-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.seq-tmpl-name { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 3px; }
.seq-tmpl-meta { font-size: 11px; color: var(--text-muted); }
.seq-tmpl-tag { font-size: 10px; font-weight: 600; padding: 3px 8px; border-radius: 5px; white-space: nowrap; }
.seq-tmpl-steps { display: flex; flex-direction: column; gap: 6px; }
.seq-tmpl-row {
  display: flex; align-items: center; gap: 7px;
  font-size: 11px; color: var(--text-muted);
}
.seq-tmpl-day { margin-left: auto; font-size: 10px; color: var(--text-faint); }
.seq-tmpl-stats {
  display: flex; gap: 16px; padding-top: 12px;
  border-top: 1px solid var(--border);
}
.seq-tmpl-stat-val { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.seq-tmpl-stat-lbl { font-size: 10px; color: var(--text-muted); }

/* Scroll wrapper for contacts/campaigns table on narrow screens */
.seq-table-scroll-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; width: 100%; }
#campaignsTable { min-width: 1150px; }
#contactsTable  { min-width: 1350px; }

/* Active sequences table */
.seq-active-table {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden;
}
.seq-active-header, .seq-active-row {
  display: flex; align-items: flex-start; padding: 7px 16px; gap: 16px;
}
.seq-active-header {
  border-bottom: 1px solid var(--border);
  font-size: 10px; font-weight: 600; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-faint);
  align-items: center;
}
.sort-header { cursor: pointer; user-select: none; display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.sort-header:hover { color: var(--text-primary); }
.sort-arrow { font-size: 10px; color: var(--text-faint); }
.sort-arrow-active { color: var(--accent); }
.seq-active-row { border-bottom: 1px solid var(--border); font-size: 12px; padding: 18px 16px; }
.seq-active-row:last-child { border-bottom: none; }
.seq-col-athlete { flex: 1; min-width: 160px; display: flex; align-items: flex-start; gap: 9px; }
.seq-col-headline { width: 160px; flex-shrink: 0; }
.seq-col-seq { width: 120px; flex-shrink: 0; color: var(--text-muted); }
.seq-col-step { width: 120px; flex-shrink: 0; }
.seq-col-bool { width: 80px; flex-shrink: 0; display: flex; align-items: center; gap: 4px; }
.seq-col-status { width: 100px; flex-shrink: 0; display: flex; align-items: center; gap: 4px; }
.seq-col-next { width: 140px; flex-shrink: 0; color: var(--text-muted); display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
.seq-col-next strong { color: #F59E0B; font-weight: 500; }
.seq-col-sendat { width: 160px; flex-shrink: 0; color: var(--text-muted); display: flex; flex-direction: column; justify-content: center; }
.seq-active-header .seq-col-sendat { flex-direction: row; align-items: center; }
.seq-active-header .seq-col-bool,
.seq-active-header .seq-col-status,
.seq-active-header .seq-col-next,
.seq-active-header .seq-col-sendat { font-size: inherit; color: inherit; flex-direction: row; align-items: center; justify-content: flex-start; }
.seq-yes { color: #34D399; }
.seq-no { color: var(--text-faint); }

/* Contacts status text */
.ct-status-text { font-size: 12px; font-weight: 500; }
.ct-status-active            { color: var(--text-muted); }
.ct-status-awaiting-follow-back { color: var(--text-muted); }
.ct-status-paused            { color: var(--amber); }
.ct-status-replied           { color: var(--green); }
.ct-status-completed         { color: var(--green); }
.ct-status-cancelled         { color: var(--text-faint); }
.ct-status-booked            { color: var(--green); }
.ct-status-slot-confirmed    { color: var(--green); }

.seq-av {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; margin-top: 1px;
}
.seq-av-name { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.seq-av-sub { font-size: 10px; color: var(--text-muted); }
.seq-step-badge { font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 4px; }
.seq-complete-badge {
  font-size: 11px; font-weight: 600; color: #22C55E;
  background: rgba(34,197,94,0.1); padding: 2px 9px; border-radius: 4px;
}

/* --- Footer --- */
.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-6);
  border-top: 1px solid var(--border);
  font-size: var(--text-xs);
  color: var(--text-muted);
  flex-shrink: 0;
  background: var(--bg-surface);
}

.app-footer a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
}

.app-footer a:hover {
  color: var(--accent);
}

/* --- Kanban Column Header Colors --- */
.kanban-col[data-stage="new"] .kanban-col-header { border-top: 2px solid var(--text-muted); }
.kanban-col[data-stage="contacted"] .kanban-col-header { border-top: 2px solid var(--blue); }
.kanban-col[data-stage="responded"] .kanban-col-header { border-top: 2px solid var(--amber); }
.kanban-col[data-stage="assessment"] .kanban-col-header { border-top: 2px solid var(--accent); }
.kanban-col[data-stage="enrolled"] .kanban-col-header { border-top: 2px solid var(--green); }
.kanban-col[data-stage="lost"] .kanban-col-header { border-top: 2px solid var(--red); }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-overlay); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* --- Focus Visible --- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --- Mobile Responsive --- */
@media (max-width: 1024px) {
  .kanban-board {
    grid-template-columns: repeat(3, minmax(200px, 1fr));
  }

  .dashboard-grid {
    grid-template-columns: 1fr 1fr;
  }

  .card-lg {
    grid-column: 1 / -1;
  }

  .card-market {
    grid-column: 1 / -1;
  }

  .card-timeline {
    grid-column: 1 / -1;
    grid-row: auto;
    max-height: 400px;
  }

  .dash-body {
    flex-direction: column;
  }

  .dash-right-col {
    width: 100%;
  }

  .pipeline-stages {
    gap: 0;
  }

  .pipe-connector {
    padding: 0 8px;
  }
}

/* Bottom Navigation - Hidden on desktop */
.bottom-nav {
  display: none;
}

@media (max-width: 768px) {
  .dashboard {
    flex-direction: column;
  }

  .mobile-header {
    display: none; /* Hidden in favor of bottom nav */
  }

  .mobile-logo {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 700;
    font-size: var(--text-lg);
    color: var(--text-primary);
  }

  .hamburger {
    background: none;
    border: none;
    padding: var(--space-2);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 1px;
    transition: all var(--transition);
  }

  /* Bottom Navigation */
  .bottom-nav.hidden {
    display: none !important;
  }

  .bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
    z-index: 9999;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
  }

  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    min-width: 70px;
    color: var(--text-muted);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    transition: color var(--transition);
    position: relative;
    font-family: inherit;
  }

  .bottom-nav-item svg,
  .bottom-nav-item i {
    width: 24px;
    height: 24px;
    stroke-width: 1.5;
  }

  .bottom-nav-item span {
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
  }

  .bottom-nav-item.active {
    color: var(--primary);
  }

  .bottom-nav-item:hover {
    color: var(--text-primary);
  }

  .bottom-nav-item.active:hover {
    color: var(--primary);
  }

  .bottom-nav-badge {
    position: absolute;
    top: 6px;
    right: 18px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
  }

  /* Adjust main-area padding for bottom nav */
  .main-area {
    padding-bottom: calc(70px + env(safe-area-inset-bottom));
  }

  body:has(#bottomNav.hidden) .main-area {
    padding-bottom: 0;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    transform: translateX(-100%);
    transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 300;
    /* The bottom nav is z-index 9999, so it paints OVER this drawer. Reserve its exact height as
       padding so the footer (Log out) is pinned just above it and is reachable WITHOUT scrolling.
       Measured at 81px (12px top pad + 57px item + 12px bottom pad); 84px leaves a small buffer
       so a font or line-height change can't silently push Log out back under the bar.
       Previously this scrolled the whole drawer instead, which put Log out at a fixed 700px from
       the top at every viewport height — behind the bottom nav on any screen shorter than ~780px. */
    overflow: hidden;
    padding-bottom: calc(84px + env(safe-area-inset-bottom));
  }

  /* Only the nav list scrolls. The footer must never be part of the scrolled region. */
  .sidebar-nav {
    flex: 1 1 auto;
    min-height: 0;              /* without this a flex child refuses to shrink, so it never scrolls */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

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

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 250;
  }

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

  .kpi-header {
    padding: var(--space-3) var(--space-4);
  }

  /* Pipeline strip mobile */
  .pipeline-strip {
    height: auto;
    padding: 12px 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .pipeline-strip-title {
    margin-right: 0;
    margin-bottom: 4px;
  }

  .pipeline-strip-heading {
    font-size: 15px;
  }

  .pipeline-stages {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }

  .pipe-stage {
    min-width: 70px;
  }

  .pipe-stage-label {
    font-size: 8px;
  }

  .pipe-stage-num {
    font-size: 20px;
  }

  .pipe-enrolled-tag {
    font-size: 8px;
    padding: 2px 5px;
  }

  .pipe-connector {
    padding: 0 6px;
    padding-top: 10px;
  }

  .pipe-rate {
    font-size: 9px;
  }

  .pipe-arrow {
    font-size: 10px;
  }

  .pipeline-revenue {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    align-items: flex-start;
  }

  .pipe-rev-label {
    font-size: 9px;
  }

  .pipe-rev-val {
    font-size: 22px;
  }

  .pipe-rev-sub {
    font-size: 10px;
  }

  .kpi-bar {
    gap: var(--space-2);
    -webkit-overflow-scrolling: touch;
  }

  .kpi-card {
    min-width: 110px;
    padding: var(--space-2) var(--space-3);
  }

  .kpi-value {
    font-size: var(--text-lg);
  }

  .content {
    padding: var(--space-4);
  }

  .kanban-board {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
    gap: var(--space-3);
  }

  .view-header {
    flex-direction: column;
    gap: var(--space-1);
  }

  .data-table {
    font-size: var(--text-sm);
    min-width: 700px;
  }

  .data-table th,
  .data-table td {
    padding: var(--space-2) var(--space-3);
  }
}

@media (max-width: 480px) {
  /* ISD table: smaller text + truncate name/role so rows fit on screen */
  #isdTable td, #isdTable th {
    font-size: 11px;
    padding: 8px 10px;
  }
  #isdTable td:nth-child(1),
  #isdTable td:nth-child(2) {
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .kanban-board {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   SCOUT AGENTS
   ============================================================ */

/* --- View container --- */
#view-scout-agents.active {
  margin: -24px -24px 0 -24px;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 65px);
  overflow: hidden;
}

/* --- Sub-screen system --- */
.sa-screen { display: none; }
.sa-screen.sa-screen-active {
  display: flex;
  flex-direction: column;
  flex: 1;
  animation: fadeIn 200ms ease-out;
}

/* ── ENTRY ───────────────────────────────────────────── */
.sa-entry-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  padding: 15vh 24px 52px;
  gap: 0;
}
.sa-entry-recent {
  margin-top: 28px;
  width: 100%;
  max-width: 640px;
}
.sa-entry-hd { text-align: center; margin-bottom: 36px; }
.sa-entry-hd-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}
.sa-entry-title {
  font-size: 22px;
  font-weight: 700;
  color: #F0F0F4;
  letter-spacing: -0.03em;
  line-height: 28px;
}
.sa-entry-sub {
  font-size: 13px;
  color: #4A4F66;
  line-height: 16px;
  text-align: center;
  margin: 0;
}

/* Mode pill */
.sa-mode-pill {
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 16px;
}
.sa-mode-opt {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 20px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: #4A4F66;
  cursor: pointer;
  transition: background 150ms, border-color 150ms, color 150ms;
}
.sa-mode-opt:hover:not(.sa-mode-opt-active) { color: #20808D; }
.sa-mode-opt > span:first-of-type {
  font-size: 13px;
  color: inherit;
  line-height: 16px;
}
.sa-mode-opt-active {
  background: #161821;
  border-color: rgba(255,255,255,0.08);
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
  color: #20808D;
}
.sa-mode-opt-active > span:first-of-type { color: #F0F0F4; }
.sa-mode-hint {
  font-size: 10px;
  color: #3A3F55;
  line-height: 12px;
}
.sa-mode-opt-active .sa-mode-hint { color: #4A4F66; }

/* Command box */
.sa-cmd-box {
  width: 680px;
  background: #161821;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 14px;
  overflow: hidden;
}
.sa-cmd-input-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 20px 14px;
}
.sa-cmd-textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: #C8CAD6;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.5;
  resize: none;
  outline: none;
}
.sa-cmd-textarea::placeholder { color: #3A3F55; }
.sa-cmd-divider {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: 0 20px;
}
.sa-cmd-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
}
.sa-try-row { display: flex; align-items: center; gap: 6px; }
.sa-try-label { font-size: 10px; color: #3A3F55; line-height: 12px; }
.sa-try-chip {
  background: rgba(255,255,255,0.04);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 10px;
  color: #4A4F66;
  line-height: 12px;
  cursor: pointer;
  transition: color 150ms, background 150ms;
}
.sa-try-chip:hover { color: #8A8D9F; background: rgba(255,255,255,0.07); }
.sa-cmd-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.sa-agent-ready-txt { font-size: 10px; color: #3A3F55; line-height: 12px; }
.sa-spawn-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 8px;
  border: none;
  background: #EC3025;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 150ms;
  white-space: nowrap;
}
.sa-spawn-btn:hover { opacity: 0.88; }

/* Info row */
.sa-info-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 12px;
  width: 680px;
  font-size: 11px;
  color: #3A3F55;
  line-height: 1.5;
}

/* Recent */
.sa-recent-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 36px;
  width: 680px;
}
.sa-section-label-up {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #3A3F55;
  line-height: 12px;
  margin: 0;
}
.sa-recent-list { display: flex; flex-direction: column; gap: 6px; }
.sa-recent-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 9px;
  cursor: pointer;
  transition: border-color 150ms, background 150ms;
}
.sa-recent-row:hover { border-color: rgba(255,255,255,0.10); background: rgba(255,255,255,0.03); }
.sa-recent-row-alert {
  background: rgba(167,139,250,0.04);
  border-color: rgba(167,139,250,0.12);
}
.sa-recent-row-alert:hover { background: rgba(167,139,250,0.07); border-color: rgba(167,139,250,0.18); }
.sa-recent-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.sa-recent-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.sa-recent-name { font-size: 12px; color: #8A8D9F; line-height: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sa-recent-meta { font-size: 10px; color: #3A3F55; line-height: 12px; }
.sa-rerun-btn {
  background: rgba(255,255,255,0.04);
  border: none;
  border-radius: 4px;
  padding: 3px 10px;
  font-size: 10px;
  color: #4A4F66;
  line-height: 12px;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 150ms, background 150ms;
}
.sa-rerun-btn:hover { color: #8A8D9F; background: rgba(255,255,255,0.07); }
.sa-active-btn {
  background: rgba(167,139,250,0.10);
  border: 1px solid rgba(167,139,250,0.20);
  border-radius: 4px;
  padding: 3px 10px;
  font-size: 10px;
  color: #A78BFA;
  line-height: 12px;
  cursor: pointer;
  flex-shrink: 0;
}

/* ── SHARED TOPBAR (all screens except entry) ────────── */
.sa-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 0 32px;
  flex-shrink: 0;
  gap: 12px;
}
.sa-topbar-left { display: flex; align-items: center; gap: 10px; }
.sa-topbar-right { display: flex; align-items: center; gap: 8px; }
.sa-topbar-title { font-size: 14px; font-weight: 600; color: #E2E8F0; line-height: 20px; }
.sa-topbar-title-sm { font-size: 13px; font-weight: 500; color: #94A3B8; }
.sa-running-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid rgba(236,48,37,0.2);
  background: rgba(236,48,37,0.08);
  font-size: 11px;
  color: #EC3025;
  font-weight: 500;
}
.sa-dot-sm { width: 6px; height: 6px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.sa-time-txt { font-size: 12px; color: #3A3F55; }
.sa-ghost-btn {
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.10);
  background: transparent;
  color: #4A4F66;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 150ms, color 150ms;
  white-space: nowrap;
}
.sa-ghost-btn:hover { border-color: rgba(255,255,255,0.18); color: #94A3B8; }
.sa-red-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 6px;
  border: none;
  background: #EC3025;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 150ms;
  white-space: nowrap;
}
.sa-red-btn:hover { opacity: 0.88; }
.sa-purple-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 6px;
  border: none;
  background: #7C3AED;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 150ms;
  white-space: nowrap;
}
.sa-purple-btn:hover { opacity: 0.88; }
.sa-bc-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 6px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.08);
  background: transparent;
  color: #4A4F66;
  font-size: 12px;
  cursor: pointer;
  transition: color 150ms, border-color 150ms;
}
.sa-bc-btn:hover { color: #94A3B8; border-color: rgba(255,255,255,0.14); }
.sa-bc-sep { font-size: 12px; color: #2A2F42; }
.sa-needs-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid rgba(245,158,11,0.2);
  background: rgba(245,158,11,0.08);
  font-size: 11px;
  color: #F59E0B;
  font-weight: 500;
}

/* ── OVERVIEW BODY ───────────────────────────────────── */
.sa-ov-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 32px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── ALL AGENTS SPLIT LAYOUT ─────────────────────────────── */
#sa-all-agents {
  overflow: hidden;
}
.sa-split {
  display: flex;
  flex: 1;
  overflow: hidden;
  height: 100%;
}
.sa-split-left {
  width: 272px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sa-split-left-hd {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sa-split-left-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
#saOverviewDynamicRows {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
#saDynamicAgents {
  flex-shrink: 0;
}
/* Left panel rows: make them narrower / list-style */
.sa-split-left .sa-agent-row {
  padding: 10px 14px;
  border-radius: 0;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}
.sa-split-left .sa-agent-row:last-child { border-bottom: none; }
.sa-split-left .sa-agent-icon-box { width: 26px !important; height: 26px !important; flex-shrink: 0; }
.sa-split-left .sa-agent-info { min-width: 0; flex: 1; }
.sa-split-left .sa-agent-name { font-size: 11.5px; }
.sa-split-left .sa-agent-query { font-size: 10.5px; }
.sa-split-left .sa-agent-status-col { display: none; }
.sa-split-left .sa-progress-track { display: none; }
.sa-split-left .sa-pending-delete { margin-left: 0; }
.sa-agent-row-active {
  background: rgba(32, 128, 141, 0.08) !important;
  border-left: 2px solid #20808D !important;
  padding-left: 12px !important;
}
body.light .sa-agent-row-active {
  background: rgba(32, 128, 141, 0.07) !important;
}
.sa-split-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}
.sa-right-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.sa-right-empty-txt {
  font-size: 13px;
  color: var(--text-faint);
}
#saRightDetail {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}
.sa-detail-inner-hd {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 8px;
}
.sa-agent-inactive {
  opacity: 0.6;
}
body.light .sa-agent-inactive {
  opacity: 0.65;
}
.sa-pending-delete {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: all;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.sa-pending-delete:hover {
  background: rgba(248,113,113,0.1);
  border-color: rgba(248,113,113,0.3);
  color: #F87171;
}

.sa-agent-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: #161821;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  transition: border-color 150ms;
}
.sa-agent-clickable { cursor: pointer; }
.sa-agent-clickable:hover { border-color: rgba(255,255,255,0.12); background: rgba(255,255,255,0.02); }
.sa-agent-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sa-agent-info { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.sa-agent-name-row { display: flex; align-items: center; gap: 8px; }
.sa-agent-name { font-size: 13px; font-weight: 600; color: #E2E8F0; }
.sa-type-badge {
  padding: 1px 7px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(32,128,141,0.12);
  color: #20808D;
}
.sa-type-alert { background: rgba(167,139,250,0.10); color: #A78BFA; }
.sa-agent-query { font-size: 11px; color: #3A3F55; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 420px; }
.sa-agent-status-col { display: flex; flex-direction: column; gap: 3px; flex-shrink: 0; min-width: 120px; }
.sa-status-row { display: flex; align-items: center; gap: 5px; }
.sa-agent-sub { font-size: 11px; color: #3A3F55; }
.sa-progress-track {
  width: 80px;
  height: 3px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}
.sa-progress-fill { height: 100%; border-radius: 2px; }
.sa-prog-teal { background: #20808D; }
.sa-prog-purple { background: #A78BFA; }

/* ── DETAIL — INSTAGRAM SCOUT ────────────────────────── */
.sa-query-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 32px;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.sa-qb-body { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.sa-qb-text { font-size: 13px; color: #E2E8F0; line-height: 1.4; }
.sa-qb-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.sa-qb-chip {
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  font-size: 11px;
  color: #4A4F66;
}
.sa-chip-teal { border-color: rgba(32,128,141,0.2); color: #20808D; background: rgba(32,128,141,0.06); }
.sa-chip-purple { border-color: rgba(167,139,250,0.2); color: #A78BFA; background: rgba(167,139,250,0.06); }
.sa-spawned-txt { font-size: 11px; color: #3A3F55; flex-shrink: 0; margin-top: 4px; }
.sa-detail-body { flex: 1; overflow-y: auto; padding: 20px 32px; }
.sa-result-card {
  background: #161821;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  overflow: hidden;
  max-width: 680px;
}
.sa-rc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sa-rc-header-left { display: flex; align-items: center; gap: 10px; }
.sa-rc-name { font-size: 13px; font-weight: 600; color: #E2E8F0; }
.sa-rc-sub { font-size: 11px; color: #3A3F55; margin-top: 1px; }
.sa-scanning-txt { font-size: 10px; font-weight: 700; letter-spacing: 0.06em; color: #22C55E; text-transform: uppercase; }
.sa-scan-log-area {
  padding: 12px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.sa-log-line { font-size: 11px; line-height: 1.5; font-family: 'SF Mono', 'Fira Code', monospace; }
.sa-results-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.sa-results-label { font-size: 11px; font-weight: 600; color: #4A4F66; text-transform: uppercase; letter-spacing: 0.05em; }
.sa-running-badge-complete {
  border-color: rgba(34,197,94,0.25) !important;
  background: rgba(34,197,94,0.1) !important;
  color: #22C55E !important;
}
.sa-running-badge-complete span { color: #22C55E; }

.sa-complete-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #22C55E;
  animation: saRowIn 250ms ease-out;
}

.sa-review-cta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #20808D;
  border: none;
  border-radius: 6px;
  padding: 5px 11px 5px 10px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: opacity 150ms;
  animation: saRowIn 300ms ease-out;
}
.sa-review-cta:hover { opacity: 0.88; }

.sa-view-list-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(32,128,141,0.1);
  border: 1px solid rgba(32,128,141,0.25);
  border-radius: 20px;
  color: #20808D;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  cursor: pointer;
  transition: background 150ms, border-color 150ms;
  letter-spacing: 0.01em;
}
.sa-view-list-btn:hover {
  background: rgba(32,128,141,0.18);
  border-color: rgba(32,128,141,0.4);
}
.sa-athlete-rows { display: flex; flex-direction: column; }
.sa-ath-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.sa-ath-row-last { border-bottom: none; }
.sa-ath-av {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}
.sa-ath-info { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.sa-ath-name { font-size: 12px; font-weight: 600; color: #E2E8F0; }
.sa-ath-meta { font-size: 10px; color: #3A3F55; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sa-ath-sport { font-size: 11px; color: #4A4F66; flex-shrink: 0; white-space: nowrap; }
.sa-ath-badge {
  padding: 2px 7px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
  flex-shrink: 0;
}
.sa-badge-teal { background: rgba(32,128,141,0.12); color: #20808D; }
.sa-badge-amber { background: rgba(245,158,11,0.12); color: #F59E0B; }
.sa-review-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #F59E0B;
  flex-shrink: 0;
  animation: sa-review-pulse 1.8s ease-in-out infinite;
}
@keyframes sa-review-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.75); }
}
.sa-review-col {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.sa-review-label {
  font-size: 10px;
  color: #F59E0B;
  font-weight: 500;
  white-space: nowrap;
}
.sa-rc-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: rgba(255,255,255,0.015);
  font-size: 11px;
  color: #3A3F55;
}
.sa-rc-dots { display: flex; align-items: center; gap: 4px; }
.sa-rc-dot { width: 5px; height: 5px; border-radius: 50%; background: #20808D; }

/* ── ALERT BUILDER ───────────────────────────────────── */
.sa-alert-cols {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}
.sa-alert-log-col {
  width: 420px;
  flex-shrink: 0;
  border-right: 1px solid rgba(255,255,255,0.06);
  background: rgba(0,0,0,0.12);
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sa-alert-cfg-col {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.sa-col-label-up {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #3A3F55;
}
.sa-build-log { display: flex; flex-direction: column; gap: 6px; }
.sa-cfg-header { display: flex; flex-direction: column; gap: 4px; }
.sa-cfg-title { font-size: 14px; font-weight: 600; color: #E2E8F0; }
.sa-cfg-sub { font-size: 12px; color: #4A4F66; line-height: 1.5; }
.sa-cfg-cards { display: flex; flex-direction: column; gap: 10px; }
.sa-cfg-card {
  background: #161821;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sa-cfg-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #3A3F55;
}
.sa-cfg-val { font-size: 13px; color: #94A3B8; }
.sa-cfg-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.sa-kw-chip {
  padding: 3px 9px;
  border-radius: 8px;
  border: 1px solid rgba(167,139,250,0.2);
  background: rgba(167,139,250,0.06);
  font-size: 11px;
  color: #A78BFA;
}
.sa-kw-add {
  padding: 3px 9px;
  border-radius: 8px;
  border: 1px dashed rgba(255,255,255,0.10);
  font-size: 11px;
  color: #3A3F55;
  cursor: pointer;
  transition: color 150ms;
}
.sa-kw-add:hover { color: #94A3B8; }
.sa-cfg-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sa-deliver-row { display: flex; align-items: center; justify-content: space-between; }
.sa-add-delivery { font-size: 11px; color: #3A3F55; cursor: pointer; transition: color 150ms; }
.sa-add-delivery:hover { color: #94A3B8; }
.sa-cfg-info-box {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(245,158,11,0.15);
  background: rgba(245,158,11,0.05);
  font-size: 11px;
  color: #4A4F66;
  line-height: 1.5;
}

/* ── REVIEW ──────────────────────────────────────────── */
.sa-topbar-review {
  height: auto;
  padding: 16px 32px;
  align-items: flex-start;
}
.sa-bc-path { display: flex; align-items: center; gap: 6px; }
.sa-bc-link { font-size: 12px; color: #4A4F66; cursor: pointer; transition: color 150ms; }
.sa-bc-link:hover { color: #94A3B8; }
.sa-pending-title { font-size: 16px; font-weight: 700; color: #E2E8F0; }
.sa-pending-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid rgba(251,191,36,0.2);
  background: rgba(251,191,36,0.08);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #FBBF24;
}
.sa-ath-counter { font-size: 12px; color: #4A4F66; white-space: nowrap; }
.sa-nav-btns { display: flex; gap: 4px; }
.sa-nav-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.10);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 150ms;
}
.sa-nav-btn:hover:not(:disabled) { background: rgba(255,255,255,0.05); }
.sa-nav-btn:disabled { opacity: 0.35; cursor: default; }
.sa-review-cols {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}
.sa-review-profile-col {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.sa-review-panel {
  width: 340px;
  flex-shrink: 0;
  background: #161A23;
  border-left: 1px solid rgba(255,255,255,0.06);
  overflow-y: auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Review panel components */
.sa-rp-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #3A3F55;
  margin-bottom: 10px;
  display: block;
}
.sa-thumb-row { display: flex; gap: 8px; }
.sa-thumb-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 0 14px;
  border-radius: 10px;
  border: 1.5px solid rgba(255,255,255,0.08);
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: #4A4F66;
  cursor: pointer;
  transition: border-color 150ms, background 150ms, color 150ms;
}
.sa-thumb-btn:hover { border-color: rgba(255,255,255,0.15); background: rgba(255,255,255,0.03); }
.sa-thumb-btn.sa-thumb-selected-good {
  border-color: #22C55E;
  background: rgba(34,197,94,0.08);
  color: #22C55E;
}
.sa-thumb-btn.sa-thumb-selected-bad {
  border-color: #EC3025;
  background: rgba(236,48,37,0.08);
  color: #EC3025;
}
.sa-note-input {
  width: 100%;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 9px 10px;
  color: #94A3B8;
  font-size: 12px;
  font-family: inherit;
  resize: vertical;
  min-height: 72px;
  box-sizing: border-box;
  transition: border-color 150ms;
}
.sa-note-input:focus { outline: none; border-color: rgba(255,255,255,0.18); }
.sa-note-input::placeholder { color: #2A2F42; }
.sa-rp-divider { height: 1px; background: rgba(255,255,255,0.05); margin: 0 -20px; }
.sa-rp-label-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sa-reviewed-count { font-size: 11px; color: #3A3F55; }
.sa-reviewed-section { flex: 1; min-height: 0; }
.sa-reviewed-list { display: flex; flex-direction: column; gap: 6px; }
.sa-reviewed-empty { font-size: 11px; color: #2A2F42; }
.sa-see-list-link {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--accent);
  text-decoration: none;
  margin-top: 6px;
  opacity: 0.8;
  transition: opacity 150ms;
}
.sa-see-list-link:hover { opacity: 1; }
.sa-reviewed-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.sa-reviewed-item:last-child { border-bottom: none; }
.sa-reviewed-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  flex-shrink: 0;
}
.sa-reviewed-name { flex: 1; font-size: 11px; color: #4A4F66; }
.sa-reviewed-thumb-box {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  border: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sa-reviewed-thumb-box.sa-rv-good { border-color: rgba(34,197,94,0.2); background: rgba(34,197,94,0.06); color: #22C55E; }
.sa-reviewed-thumb-box.sa-rv-bad  { border-color: rgba(236,48,37,0.2);  background: rgba(236,48,37,0.06);  color: #EC3025; }
.sa-done-area { display: flex; flex-direction: column; gap: 8px; }
.sa-done-btn {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: none;
  background: #20808D;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 150ms;
}
.sa-done-btn:hover:not(:disabled) { opacity: 0.88; }
.sa-done-btn:disabled { opacity: 0.35; cursor: default; }
.sa-more-to-review { font-size: 10px; color: #2A2F42; text-align: center; }

/* Review profile (JS-rendered) */
.sa-profile-identity { display: flex; align-items: center; gap: 16px; }
.sa-profile-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  flex-shrink: 0;
}
.sa-profile-name { font-size: 18px; font-weight: 700; color: #E2E8F0; margin-bottom: 2px; }
.sa-profile-handle { font-size: 12px; color: #4A4F66; margin-bottom: 8px; }
.sa-profile-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.sa-profile-chip {
  padding: 3px 9px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  font-size: 11px;
  color: #4A4F66;
}
.sa-profile-section { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
/* Athlete drawer: stacked header + a two-column property list (icon · label · value). */
.sa-profile-identity--stacked { flex-direction: column; align-items: center; gap: 10px; text-align: center; padding-top: 4px; padding-bottom: 28px; }
.sa-profile-identity--stacked .sa-profile-avatar { width: 56px; height: 56px; font-size: 20px; }
.sa-profile-identity--stacked .sa-profile-name { font-size: 17px; }
.sa-profile-identity--stacked .sa-profile-name { margin-bottom: 0; }
.sa-actions { display: flex; justify-content: center; gap: 12px; margin-top: 10px; }
/* Quo-style: grey outline icon on a light grey tile (#5b5b5c on #f3f3f4); softer equivalents in dark mode. */
.sa-act-btn { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border: none; border-radius: 10px; background: rgba(255,255,255,0.06); color: #a1a1aa; cursor: pointer; transition: background .15s; }
.sa-act-btn:hover { background: rgba(255,255,255,0.1); }
body.light .sa-act-btn { background: #f3f3f4; color: #5b5b5c; }
body.light .sa-act-btn:hover { background: #e9e9eb; }
.sa-act-btn svg { width: 18px; height: 18px; }
.sa-profile-sub { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; font-size: 12px; color: var(--text-muted); }
.sa-props { display: flex; flex-direction: column; margin-top: 18px; }
.sa-prop { display: grid; grid-template-columns: 16px 104px minmax(0, 1fr); align-items: start; column-gap: 10px; padding: 6px 0; }
.sa-prop-ico { width: 14px; height: 14px; margin-top: 2px; color: var(--text-muted); }
.sa-prop-label { font-size: 12px; color: var(--text-muted); line-height: 18px; }
/* Field groups in the lead panel (Contact · Athlete · Pipeline) — same look as the section titles, theme colours. */
.sa-prop-group { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-faint); margin: 14px 0 4px; }
.sa-prop-group:first-child { margin-top: 0; }
.sa-prop-val { font-size: 13px; color: var(--text-primary); line-height: 18px; overflow-wrap: anywhere; }
.sa-prop-val a { color: var(--accent); text-decoration: none; }
.sa-prop-val a:hover { text-decoration: underline; }
.sa-prop-val--empty, .sa-prop-pending { color: var(--text-faint); }
/* Inline edit (Quo-style): the value is the hit target; on edit it becomes a white field in place */
.sa-prop-val--edit { cursor: text; border-radius: 6px; margin: -3px -6px; padding: 3px 6px; }
.sa-prop-val--edit:hover { background: var(--bg-hover, rgba(0,0,0,0.04)); }
.sa-prop-val--edit:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
.sa-prop-val--editing, .sa-prop-val--editing:hover { background: none; cursor: default; }
.sa-prop-input { width: 100%; box-sizing: border-box; font: inherit; font-size: 13px; line-height: 18px; color: #111;
  background: #fff; border: 1px solid #d9d9dc; border-radius: 6px; padding: 4px 8px; margin: -1px 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08); outline: none; }
.sa-prop-input:focus { border-color: #b9b9be; box-shadow: 0 1px 4px rgba(0,0,0,0.12); }
.sa-prop-input:disabled { opacity: 0.6; }
body:not(.light) .sa-prop-input { background: var(--bg-card, #2a2d3e); color: var(--text-primary); border-color: rgba(255,255,255,0.16); box-shadow: 0 1px 3px rgba(0,0,0,0.4); }
.sa-prop-err { color: var(--red, #d93025); font-size: 12px; margin-top: 4px; }
.sa-prop-err:empty { display: none; }
.sa-prop-ext { margin-left: 4px; }
/* Thread one-liner for a contact-number change — same pill as the date separator */
.ci-sys-line { text-align: center; font-size: 11px; color: var(--text-faint); margin: 10px 0; }
/* Touch screens: 16px stops iOS zooming into the field */
@media (max-width: 600px) { .sa-prop-input { font-size: 16px; padding: 8px 10px; } }
/* Why matched as plain bullet notes (title, then its reason in muted text). */
.sa-why-notes { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.sa-why-notes li { font-size: 13px; line-height: 18px; color: var(--text-primary); }
.sa-why-notes li span { color: var(--text-muted); }
.drawer-profile-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--bg-soft, #f4f4f6);
  border: 1px solid var(--border, #e2e4ea);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}
.drawer-profile-link:hover { opacity: 0.8; }

.on3-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--bg-soft, #f4f4f6);
  border: 1px solid var(--border, #e2e4ea);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-main, #14161f);
  text-decoration: none;
  white-space: nowrap;
}
.on3-pill:hover { opacity: 0.75; }
.sa-profile-section-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #3A3F55;
}
.sa-why-list { display: flex; flex-direction: column; gap: 10px; }
.sa-why-card {
  background: #1C2130;
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sa-why-card-title { font-size: 13px; font-weight: 600; color: #94A3B8; }
.sa-why-card-sub { font-size: 12px; color: #3A3F55; }
.sa-ig-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.sa-ig-thumb {
  aspect-ratio: 1;
  border-radius: 6px;
  background: #1C2130;
  border: 1px solid rgba(255,255,255,0.05);
}
.sa-ig-stat-row { display: flex; gap: 28px; margin-top: 4px; }
.sa-ig-stat { display: flex; flex-direction: column; gap: 4px; }
.sa-ig-stat-val { font-size: 16px; font-weight: 700; color: #E2E8F0; }
.sa-ig-stat-label { font-size: 11px; color: #3A3F55; text-transform: uppercase; letter-spacing: 0.04em; }

/* ── SCOUT AGENTS — LIGHT MODE ───────────────────────── */
body.light .sa-entry-title { color: #14161F; }
body.light .sa-entry-sub   { color: #7a7e92; }

body.light .sa-mode-pill {
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.08);
}
body.light .sa-mode-opt { color: #7a7e92; }
body.light .sa-mode-opt:hover:not(.sa-mode-opt-active) { color: #20808D; }
body.light .sa-mode-opt-active {
  background: #ffffff;
  border-color: rgba(0,0,0,0.10);
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}
body.light .sa-mode-opt-active > span:first-of-type { color: #14161F; }
body.light .sa-mode-hint { color: #b0b4c4; }
body.light .sa-mode-opt-active .sa-mode-hint { color: #7a7e92; }

body.light .sa-cmd-box {
  background: #ffffff;
  border-color: rgba(0,0,0,0.09);
}
body.light .sa-cmd-textarea { color: #14161F; }
body.light .sa-cmd-textarea::placeholder { color: #b0b4c4; }
body.light .sa-cmd-divider { background: rgba(0,0,0,0.07); }
body.light .sa-try-label { color: #b0b4c4; }
body.light .sa-try-chip { background: rgba(0,0,0,0.04); color: #7a7e92; }
body.light .sa-try-chip:hover { background: rgba(0,0,0,0.08); color: #4a4d5e; }
body.light .sa-agent-ready-txt { color: #b0b4c4; }

body.light .sa-info-row { color: #b0b4c4; }

body.light .sa-section-label-up { color: #b0b4c4; }
body.light .sa-recent-row {
  background: rgba(0,0,0,0.02);
  border-color: rgba(0,0,0,0.06);
}
body.light .sa-recent-row:hover {
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.10);
}
body.light .sa-recent-row-alert {
  background: rgba(167,139,250,0.05);
  border-color: rgba(167,139,250,0.15);
}
body.light .sa-recent-name { color: #4a4d5e; }
body.light .sa-recent-meta { color: #b0b4c4; }
body.light .sa-rerun-btn { background: rgba(0,0,0,0.04); color: #7a7e92; }
body.light .sa-rerun-btn:hover { background: rgba(0,0,0,0.08); color: #4a4d5e; }

body.light .sa-topbar { border-bottom-color: rgba(0,0,0,0.07); }
body.light .sa-topbar-title { color: #14161F; }
body.light .sa-topbar-title-sm { color: #7a7e92; }
body.light .sa-time-txt { color: #b0b4c4; }
body.light .sa-ghost-btn { border-color: rgba(0,0,0,0.10); color: #7a7e92; }
body.light .sa-ghost-btn:hover { border-color: rgba(0,0,0,0.18); color: #4a4d5e; }
body.light .sa-bc-btn { border-color: rgba(0,0,0,0.09); color: #7a7e92; }
body.light .sa-bc-sep { color: #d0d3df; }

body.light .sa-agent-row {
  background: #ffffff;
  border-color: rgba(0,0,0,0.07);
}
body.light .sa-agent-clickable:hover {
  background: rgba(0,0,0,0.02);
  border-color: rgba(0,0,0,0.12);
}
body.light .sa-agent-name { color: #14161F; }
body.light .sa-agent-query { color: #b0b4c4; }
body.light .sa-agent-sub  { color: #b0b4c4; }
body.light .sa-progress-track { background: rgba(0,0,0,0.06); }

body.light .sa-query-banner {
  background: rgba(0,0,0,0.02);
  border-bottom-color: rgba(0,0,0,0.07);
}
body.light .sa-qb-text   { color: #14161F; }
body.light .sa-qb-chip   { border-color: rgba(0,0,0,0.09); color: #7a7e92; }
body.light .sa-spawned-txt { color: #b0b4c4; }

body.light .sa-result-card {
  background: #ffffff;
  border-color: rgba(0,0,0,0.08);
}
body.light .sa-rc-header  { border-bottom-color: rgba(0,0,0,0.07); }
body.light .sa-rc-name    { color: #14161F; }
body.light .sa-rc-sub     { color: #b0b4c4; }
body.light .sa-scan-log-area { border-bottom-color: rgba(0,0,0,0.05); }
body.light .sa-results-hdr   { border-bottom-color: rgba(0,0,0,0.05); }
body.light .sa-results-label { color: #b0b4c4; }
body.light .sa-ath-row  { border-bottom-color: rgba(0,0,0,0.05); }
body.light .sa-ath-name { color: #14161F; }
body.light .sa-ath-meta { color: #b0b4c4; }
body.light .sa-ath-sport { color: #7a7e92; }
body.light .sa-rc-footer { background: rgba(0,0,0,0.02); color: #b0b4c4; }

body.light .sa-alert-log-col {
  background: rgba(0,0,0,0.03);
  border-right-color: rgba(0,0,0,0.07);
}
body.light .sa-col-label-up { color: #b0b4c4; }
body.light .sa-cfg-title { color: #14161F; }
body.light .sa-cfg-sub   { color: #7a7e92; }
body.light .sa-cfg-card  { background: #f4f5f7; border-color: rgba(0,0,0,0.07); }
body.light .sa-cfg-label { color: #b0b4c4; }
body.light .sa-cfg-val   { color: #4a4d5e; }
body.light .sa-cfg-info-box {
  border-color: rgba(245,158,11,0.2);
  background: rgba(245,158,11,0.05);
  color: #7a7e92;
}

body.light .sa-topbar-review { border-bottom-color: rgba(0,0,0,0.07); }
body.light .sa-bc-link { color: #7a7e92; }
body.light .sa-bc-link:hover { color: #4a4d5e; }
body.light .sa-pending-title { color: #14161F; }
body.light .sa-ath-counter { color: #7a7e92; }
body.light .sa-nav-btn { border-color: rgba(0,0,0,0.10); }

body.light .sa-review-panel {
  background: #f0f1f4;
  border-left-color: rgba(0,0,0,0.07);
}
body.light .sa-rp-label   { color: #b0b4c4; }
body.light .sa-thumb-btn  { border-color: rgba(0,0,0,0.10); color: #7a7e92; }
body.light .sa-thumb-btn:hover { background: rgba(0,0,0,0.04); }
body.light .sa-note-input {
  background: rgba(0,0,0,0.03);
  border-color: rgba(0,0,0,0.09);
  color: #4a4d5e;
}
body.light .sa-note-input::placeholder { color: #d0d3df; }
body.light .sa-rp-divider { background: rgba(0,0,0,0.07); }
body.light .sa-reviewed-count { color: #b0b4c4; }
body.light .sa-reviewed-empty { color: #d0d3df; }
body.light .sa-reviewed-item { border-bottom-color: rgba(0,0,0,0.05); }
body.light .sa-reviewed-name { color: #7a7e92; }
body.light .sa-reviewed-thumb-box { border-color: rgba(0,0,0,0.10); }
body.light .sa-more-to-review { color: #d0d3df; }

body.light .sa-profile-name { color: #14161F; }
body.light .sa-profile-handle { color: #7a7e92; }
body.light .sa-profile-chip { border-color: rgba(0,0,0,0.09); color: #7a7e92; }
body.light .sa-profile-section-title { color: #b0b4c4; }
body.light .sa-why-card { background: #e8eaef; border-color: rgba(0,0,0,0.06); }
body.light .sa-why-card-title { color: #4a4d5e; }
body.light .sa-why-card-sub   { color: #7a7e92; }
body.light .sa-ig-thumb { background: #e8eaef; border-color: rgba(0,0,0,0.06); }
body.light .sa-ig-stat-val { color: #14161F; }
body.light .sa-ig-stat-label { color: #b0b4c4; }

/* --- Scout Agent: Live Animation --- */
@keyframes saRowIn {
  from { opacity: 0; transform: translateY(7px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes saCursorBlink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}
@keyframes saDotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.7); }
}
.sa-dot-pulse {
  animation: saDotPulse 1.2s ease-in-out infinite;
}
.sa-log-cursor {
  display: inline-block;
  width: 6px;
  height: 12px;
  background: #20808D;
  border-radius: 1px;
  margin-left: 2px;
  vertical-align: middle;
  animation: saCursorBlink 600ms steps(1) infinite;
}
.sa-ath-row { opacity: 0; }
.sa-ath-row.sa-row-in {
  animation: saRowIn 260ms ease-out forwards;
}

/* ── Athlete Side Drawer ─────────────────────────────────────── */
.athlete-drawer {
  position: fixed;
  inset: 0;
  z-index: 900;
  pointer-events: none;
}
.athlete-drawer.open { pointer-events: all; }

.athlete-drawer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.athlete-drawer.open .athlete-drawer-overlay { opacity: 1; }

.athlete-drawer-panel {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 380px;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-strong);
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.athlete-drawer.open .athlete-drawer-panel { transform: translateX(0); }

.athlete-drawer-header {
  display: flex;
  justify-content: flex-end;
  padding: 14px 16px 0;
  flex-shrink: 0;
}
.athlete-drawer-close {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.athlete-drawer-close:hover { background: var(--bg-hover); color: var(--text-primary); }
/* ONE back button everywhere a screen replaces another (Conversations thread, archived list, and the
   drawers on phones): a round ‹ in a light circle, like Quo / iOS. Keep these two blocks identical.
   `button.` outranks the older .ci-back-btn / .ci-archived-back rules; visibility (display) stays theirs.
   Desktop drawers float over the page as a side panel, so they keep the square ×. */
button.round-back-btn { width: 40px; height: 40px; padding: 0; border-radius: 50%; align-items: center; justify-content: center; flex-shrink: 0; cursor: pointer; background: var(--bg-surface); border: 1px solid var(--border-strong, var(--border)); box-shadow: 0 1px 3px rgba(0,0,0,0.06); color: var(--text-primary); }
body.light button.round-back-btn { background: #fff; color: #1d1d1f; border-color: #e3e3e6; }
.athlete-drawer-close .dc-back { display: none; }
@media (max-width: 600px) {
  .athlete-drawer-header { justify-content: flex-start; padding: 12px 16px 0; }
  .athlete-drawer-header .athlete-drawer-close { width: 40px; height: 40px; padding: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; cursor: pointer; background: var(--bg-surface); border: 1px solid var(--border-strong, var(--border)); box-shadow: 0 1px 3px rgba(0,0,0,0.06); color: var(--text-primary); }
  body.light .athlete-drawer-header .athlete-drawer-close { background: #fff; color: #1d1d1f; border-color: #e3e3e6; }
  .athlete-drawer-close .dc-x { display: none; }
  .athlete-drawer-close .dc-back { display: block; }
}

#athleteDrawerProfile {
  padding: 20px 24px 0;
  flex-shrink: 0;
}
.athlete-drawer-actions {
  padding: 20px 24px 32px;
  border-top: 1px solid var(--border);
  margin-top: 20px;
  flex-shrink: 0;
}

.prospect-row { cursor: pointer; }
.prospect-row:hover td { background: var(--bg-hover) !important; }

@media (max-width: 600px) {
  .athlete-drawer-panel {
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* panel itself clips; content div scrolls */
  }

  /* Both drawers: single scrollable body fills remaining space */
  .athlete-drawer-body,
  #enrollmentDrawerContent {
    flex: 1;
    min-height: 0; /* lets flex child shrink so overflow triggers */
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-bottom: calc(72px + env(safe-area-inset-bottom)); /* clear bottom nav */
  }
}

/* light mode drawer */
body.light .athlete-drawer-panel {
  background: #ffffff;
  border-left-color: rgba(0,0,0,0.1);
}
body.light .athlete-drawer-close {
  background: #f3f4f6;
  border-color: rgba(0,0,0,0.1);
  color: #6b7280;
}
body.light .athlete-drawer-actions { border-top-color: rgba(0,0,0,0.08); }

/* ===========================
   CAMPAIGNS & CONTACTS VIEWS
   =========================== */

/* Header button */
.cmp-new-btn {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  background: #EC3025; color: #fff;
  border: none; border-radius: 7px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.cmp-new-btn:hover { background: #d42a1f; }
.view-header { flex-wrap: wrap; }

/* ── Filter toolbar ── */
.cmp-toolbar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap;
}
.oct-search-wrap {
  display: flex; align-items: center; gap: 7px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  border-radius: 7px; padding: 7px 12px; width: 260px; flex-shrink: 0;
}
body.light .oct-search-wrap { background: var(--bg-surface); border-color: var(--border); }
.oct-search-wrap svg { color: var(--text-faint); flex-shrink: 0; }
.oct-search { background: none; border: none; outline: none; font-size: 12px; color: var(--text-primary); width: 100%; }
.oct-search::placeholder { color: var(--text-faint); }
.oct-filters { display: flex; align-items: center; gap: 4px; }
.oct-filter {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 20px; background: none;
  border: 1px solid var(--border);
  font-size: 13px; font-weight: 500; color: var(--text-muted); cursor: pointer; transition: color 0.15s, background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.oct-filter:hover { color: var(--text-primary); }
.oct-filter.active { color: var(--text-primary); background: var(--bg-surface); border-color: var(--border); box-shadow: 0 1px 4px rgba(0,0,0,0.12); font-weight: 600; }
body.light .oct-filter.active { background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.1); }
.oct-dot { width: 6px; height: 6px; border-radius: 50%; background: #22C55E; display: inline-block; }
.oct-filter-count {
  font-size: 11px; font-weight: 500; color: #9ca3af; margin-left: 3px;
}
.oct-running {
  display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: #22C55E;
  background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.2); border-radius: 20px; padding: 4px 12px;
}

/* ── Bulk action bar ── */
.cmp-bulk-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; margin-bottom: 8px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 8px; font-size: 12px;
}
.cmp-bulk-count { font-weight: 600; color: var(--text-primary); margin-right: 4px; }
.cmp-bulk-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text-primary);
  font-size: 12px; font-weight: 500; cursor: pointer;
  transition: background 0.15s;
}
.cmp-bulk-btn:hover { background: var(--bg-hover); border-color: var(--border-strong); color: var(--text-primary); }
.cmp-bulk-btn.danger { color: #F87171; border-color: rgba(248,113,113,0.3); }
.cmp-bulk-btn.danger:hover { background: rgba(248,113,113,0.08); }

/* Fixed-width pause/resume button in campaign rows so all rows align */
.cmp-row-action-btn { width: 82px; justify-content: center; flex-shrink: 0; }
.cmp-row-action-placeholder { display: inline-block; width: 82px; flex-shrink: 0; }

/* Mark Sent / Mark Followed buttons inside Next Action cell */
.ct-mark-sent-btn, .ct-follow-back-btn { display: flex; font-size: 11px; padding: 4px 9px; }

/* ── Enrollment Drawer ── */
.enr-drawer-profile {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.enr-drawer-av { width: 44px; height: 44px; font-size: 16px; flex-shrink: 0; }
.enr-drawer-name { font-size: 16px; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.enr-drawer-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.enr-drawer-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }

.enr-drawer-tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
}
.enr-tab-btn {
  background: none; border: none; border-bottom: 2px solid transparent;
  padding: 10px 14px; font-size: 13px; font-weight: 500;
  color: var(--text-muted); cursor: pointer; margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.enr-tab-btn:hover { color: var(--text-primary); }
.enr-tab-btn.active { color: var(--text-primary); border-bottom-color: var(--accent); font-weight: 600; }

.enr-drawer-body { padding: 16px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; }
.enr-drawer-body .sa-profile-section { gap: 8px; }
.enr-tl-empty { color: var(--text-faint); font-size: 13px; padding: 8px 0; }

/* Next step card */
.enr-tl-next-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 4px;
}
.enr-tl-next-chip {
  display: inline-block;
  font-size: 11px; font-weight: 500; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.enr-tl-next-step {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-primary); font-weight: 500;
}

/* Timeline header */
.enr-tl-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 0 8px;
}
.enr-tl-header-title { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.enr-tl-header-count { font-size: 12px; color: var(--text-faint); }

/* Timeline rows */
.enr-timeline { display: flex; flex-direction: column; gap: 0; }
.enr-tl-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0; position: relative;
}
.enr-tl-row:not(:last-child)::after {
  content: ""; position: absolute; left: 7px; top: 26px; bottom: -11px;
  width: 1px; background: var(--border);
}
.enr-tl-dot {
  width: 15px; height: 15px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid transparent;
}
.enr-tl-dot-enrolled  { background: var(--blue-muted);  border-color: var(--blue); }
.enr-tl-dot-sent      { background: var(--green-muted); border-color: var(--green); }
.enr-tl-dot-replied   { background: var(--green-muted); border-color: var(--green); }
.enr-tl-dot-completed { background: rgba(107,111,128,0.12); border-color: var(--text-muted); }
.enr-tl-dot-cancelled { background: rgba(107,111,128,0.06); border-color: var(--text-faint); }
.enr-tl-dot-paused    { background: var(--amber-muted); border-color: var(--amber); }

.enr-tl-label { flex: 1; font-size: 13px; color: var(--text-primary); line-height: 1.4; }
.enr-tl-label strong { font-weight: 600; }
.enr-tl-body { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; font-style: italic; }
.enr-tl-campaign-tag { color: var(--text-faint); font-size: 11px; font-weight: 500; }
.enr-tl-ts {
  flex-shrink: 0; font-size: 11px; color: var(--text-faint);
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 20px; padding: 2px 8px; white-space: nowrap;
}
.enr-tl-ts-pending { color: var(--amber); border-color: var(--amber-muted); background: var(--amber-muted); }

/* Details tab */
.enr-details { display: flex; flex-direction: column; gap: 0; }
.enr-detail-row {
  display: flex; gap: 12px; padding: 9px 0;
  border-bottom: 1px solid var(--border); font-size: 13px;
}
.enr-detail-row:last-child { border-bottom: none; }
.enr-detail-label { width: 72px; flex-shrink: 0; color: var(--text-muted); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; padding-top: 1px; }
.enr-detail-val { color: var(--text-primary); flex: 1; word-break: break-word; }

/* Make contact rows feel clickable */
.seq-active-row { cursor: pointer; }
.seq-active-row:hover { background: var(--bg-hover); }
.seq-active-row:hover .cmp-bulk-btn {
  background: var(--bg-surface);
  border-color: var(--border-strong);
}
.seq-active-row:hover .cmp-bulk-btn:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
}

/* ── Checkbox column ── */
.cmp-col-check { width: 32px; flex-shrink: 0; display: flex; align-items: center; }
.cmp-col-check input[type="checkbox"] { width: 15px; height: 15px; cursor: pointer; accent-color: #EC3025; }

/* ── Campaign table columns — layout only, no typography (header inherits seq-active-header) ── */
.cmp-col-name     { flex: 1; min-width: 160px; }
.cmp-col-template { width: 160px; flex-shrink: 0; }
.cmp-col-stat     { width: 76px; flex-shrink: 0; text-align: center; }
.cmp-col-progress { width: 160px; flex-shrink: 0; }
.cmp-col-status   { width: 110px; flex-shrink: 0; }
.cmp-col-date     { width: 100px; flex-shrink: 0; }
.cmp-col-actions  { width: 100px; flex-shrink: 0; display: flex; justify-content: flex-end; align-items: center; gap: 2px; }

/* Typography only in data rows */
.cmp-row .cmp-col-name     { font-weight: 500; color: var(--text-primary); }
.cmp-row .cmp-col-template { color: var(--text-muted); font-size: 11px; }
.cmp-row .cmp-col-stat     { font-size: 12px; }
.cmp-row .cmp-col-date     { font-size: 11px; color: var(--text-muted); }
.cmp-contacts-link {
  color: #60A5FA;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}
.cmp-contacts-link:hover { color: #3B82F6; }

/* Campaign row */
.cmp-row { display: flex; align-items: center; padding: 10px 20px 10px 16px; border-bottom: 1px solid var(--border); font-size: 12px; gap: 16px; }
.cmp-row:last-child { border-bottom: none; }

/* ── Segmented progress bar + tooltip ── */
.cmp-prog-wrap {
  position: relative; display: inline-block; width: 100%;
}
.cmp-seg-bar {
  height: 6px; border-radius: 99px; overflow: hidden; background: rgba(255,255,255,0.08);
  display: flex; cursor: default;
}
body.light .cmp-seg-bar { background: rgba(0,0,0,0.08); }
.cmp-seg { display: block; height: 100%; min-width: 4px; }
.cmp-seg-wait   { background: #64748B; }
.cmp-seg-run    { background: #22C55E; }
.cmp-seg-done   { background: #3B82F6; }
.cmp-seg-cancel { background: #D1D5DB; }

/* Tooltip */
.cmp-prog-tip {
  display: none; position: fixed; z-index: 9999;
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: 9px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25); padding: 12px 14px; min-width: 220px;
  pointer-events: none;
}
body.light .cmp-prog-tip { box-shadow: 0 3px 14px rgba(0,0,0,0.12); }
/* tooltip shown via JS */
.cmp-prog-tip-title { font-size: 12px; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }
.cmp-prog-tip-bar {
  height: 8px; border-radius: 99px; overflow: hidden; background: rgba(255,255,255,0.08);
  display: flex; margin-bottom: 8px;
}
body.light .cmp-prog-tip-bar { background: rgba(0,0,0,0.06); }
.cmp-prog-tip-legend { display: flex; gap: 10px; flex-wrap: wrap; }
.cmp-tip-leg { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-muted); }
.cmp-tip-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.cmp-tip-leg strong { color: var(--text-primary); }

/* Contact actions in rows */
.cmp-action-btn {
  background: var(--bg-overlay); border: 1px solid var(--border-strong); border-radius: 5px;
  padding: 3px 10px; font-size: 10px; font-weight: 500;
  color: var(--text-secondary); cursor: pointer; transition: opacity 0.15s;
}
.cmp-action-btn:hover { opacity: 0.8; }
.cmp-action-btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.cmp-action-btn.danger:hover { opacity: 0.85; }

/* Campaign row icon buttons */
.cmp-icon-btn {
  width: 28px; height: 28px; border-radius: 6px; border: 1px solid transparent;
  background: transparent; color: var(--text-faint); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; line-height: 1; transition: background 0.12s, color 0.12s;
  flex-shrink: 0;
}
.cmp-icon-btn:hover { background: var(--bg-overlay); color: var(--text-primary); border-color: var(--border); }
.cmp-icon-btn.danger:hover { background: rgba(220,38,38,0.1); color: var(--red); border-color: rgba(220,38,38,0.2); }

/* Campaign actions dropdown menu */
.cmp-menu-wrap { position: relative; }
.cmp-menu {
  position: fixed; z-index: 9998;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,0.18);
  min-width: 160px; padding: 4px;
}
.cmp-menu-item {
  display: block; width: 100%; text-align: left; padding: 7px 10px;
  font-size: 12px; color: var(--text-primary); background: transparent;
  border: none; border-radius: 5px; cursor: pointer;
}
.cmp-menu-item:hover { background: var(--bg-overlay); }

/* Empty state */
.cmp-empty {
  display: flex; flex-direction: column; align-items: center;
  padding: 64px 24px; text-align: center; gap: 10px;
}
.cmp-empty-icon { color: var(--text-faint); margin-bottom: 4px; }
.cmp-empty-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.cmp-empty-sub { font-size: 12px; color: var(--text-muted); max-width: 320px; line-height: 1.6; }

/* Wizard overlay (modal) */
.wiz-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}

/* Wizard */
.cmp-wizard {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden;
  width: 820px; max-width: 96vw; max-height: 88vh;
  display: flex; flex-direction: column;
}
.cmp-wizard-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.cmp-wizard-steps { display: flex; align-items: center; gap: 6px; }
.cmp-wiz-step {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 500; color: var(--text-faint);
}
.cmp-wiz-step.active { color: var(--text-primary); }
.cmp-wiz-step.done { color: var(--text-muted); }
.cmp-wiz-num {
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(255,255,255,0.06); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
}
.cmp-wiz-step.active .cmp-wiz-num { background: #EC3025; border-color: #EC3025; color: #fff; }
.cmp-wiz-step.done .cmp-wiz-num { background: rgba(34,197,94,0.15); border-color: rgba(34,197,94,0.3); color: #34D399; }
.cmp-wiz-sep { font-size: 12px; color: var(--text-faint); }
.cmp-wizard-close {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  padding: 4px; border-radius: 4px; display: flex;
}
.cmp-wizard-close:hover { color: var(--text-primary); }

/* Wizard panels */
.cmp-wiz-panel { display: none; padding: 24px 20px; overflow-y: auto; flex: 1; min-height: 0; }
.cmp-wiz-panel.active { display: block; }
.cmp-wiz-title { font-size: 15px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.cmp-wiz-sub { font-size: 12px; color: var(--text-muted); margin-bottom: 20px; line-height: 1.6; }

/* Template picker */
/* Template grid */
.tmpl-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 24px;
}
.tmpl-card {
  border: 1.5px solid var(--border); border-radius: 12px;
  padding: 20px 18px; cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  display: flex; flex-direction: column; gap: 8px;
}
.tmpl-card:hover { border-color: rgba(236,48,37,0.4); background: rgba(236,48,37,0.02); }
.tmpl-card.selected { border-color: #EC3025; background: rgba(236,48,37,0.05); }
.tmpl-channels { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.tmpl-ch-icon {
  width: 36px; height: 36px; border-radius: 9px; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
}
.tmpl-ch-email  { background: rgba(96,165,250,0.15); color: #60A5FA; }
.tmpl-ch-dm     { background: rgba(32,128,141,0.15); color: #20808D; }
.tmpl-ch-sms    { background: rgba(167,139,250,0.15); color: #A78BFA; }
.tmpl-ch-arrow  { font-size: 16px; color: var(--text-faint); line-height: 1; }
.tmpl-name      { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.tmpl-meta      { font-size: 11px; font-weight: 600; color: var(--text-muted); letter-spacing: 0.03em; }
.tmpl-desc      { font-size: 12px; color: var(--text-faint); line-height: 1.5; }

/* keep old names for backward compat with other uses */
.cmp-tmpl-pick { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.cmp-tmpl-card {
  border: 1.5px solid var(--border); border-radius: 9px;
  padding: 14px 16px; cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.cmp-tmpl-card:hover { border-color: rgba(255,255,255,0.18); }
.cmp-tmpl-card.selected { border-color: #EC3025; background: rgba(236,48,37,0.05); }
.cmp-tmpl-card-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; }
.cmp-tmpl-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.cmp-tmpl-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Contact picker */
.cmp-contact-search-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; gap: 12px;
}
.cmp-contact-search {
  flex: 1; background: var(--bg-input, rgba(255,255,255,0.05));
  border: 1px solid var(--border); border-radius: 7px;
  padding: 7px 12px; font-size: 12px; color: var(--text-primary);
  outline: none;
}
.cmp-contact-search:focus { border-color: rgba(255,255,255,0.2); }
.cmp-sel-count { font-size: 11px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.wiz-select-all-btn { background: none; border: none; font-size: 11px; font-weight: 600; color: var(--red); cursor: pointer; white-space: nowrap; padding: 0; }
.wiz-select-all-btn:hover { opacity: 0.75; }
.wiz-search-tag {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 99px;
  background: rgba(96,165,250,0.12); color: #60A5FA;
  cursor: pointer; white-space: nowrap; margin-right: 4px;
  transition: background 0.12s;
}
.wiz-search-tag:hover { background: rgba(96,165,250,0.22); }

/* Search tag filter strip */
.wiz-search-tags-row {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px;
}
.wiz-stag-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 99px; border: 1px solid var(--border);
  background: var(--bg-overlay); font-size: 11px; font-weight: 600;
  color: var(--text-muted); cursor: pointer; transition: all 0.12s; white-space: nowrap;
}
.wiz-stag-pill:hover { border-color: #60A5FA; color: #60A5FA; }
.wiz-stag-pill.active { background: rgba(96,165,250,0.12); border-color: #60A5FA; color: #60A5FA; }
.wiz-list-actions { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }

.cmp-contact-list {
  max-height: 340px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 9px;
}
.cmp-contact-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 14px; border-bottom: 1px solid rgba(255,255,255,0.04);
  cursor: pointer; transition: background 0.1s;
}
.cmp-contact-item:last-child { border-bottom: none; }
.cmp-contact-item:hover { background: rgba(255,255,255,0.03); }
.cmp-contact-item.selected { background: rgba(236,48,37,0.06); }
.cmp-contact-cb {
  width: 15px; height: 15px; border-radius: 4px; flex-shrink: 0;
  border: 1.5px solid var(--border); background: none;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.cmp-contact-item.selected .cmp-contact-cb {
  background: #EC3025; border-color: #EC3025;
}
.cmp-contact-info { flex: 1; }
.cmp-contact-name { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.cmp-contact-meta { font-size: 10px; color: var(--text-muted); margin-top: 1px; }
.cmp-contact-channels { display: flex; gap: 4px; margin-left: auto; }
.cmp-ch-tag {
  font-size: 9px; font-weight: 600; padding: 1px 6px; border-radius: 3px;
  letter-spacing: 0.04em;
}
.cmp-ch-email { background: rgba(96,165,250,0.12); color: #60A5FA; }
.cmp-ch-instagram { background: rgba(32,128,141,0.12); color: #20808D; }
.cmp-ch-sms { background: rgba(167,139,250,0.12); color: #A78BFA; }

/* Review grid */
.cmp-review-grid { display: flex; flex-direction: column; gap: 14px; margin-bottom: 24px; }
.cmp-review-section { background: rgba(255,255,255,0.02); border: 1px solid var(--border); border-radius: 9px; padding: 14px 16px; }
.cmp-review-label { font-size: 10px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 8px; }
.cmp-review-val { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.cmp-review-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.cmp-review-contacts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cmp-review-chip {
  font-size: 11px; font-weight: 500; color: var(--text-muted);
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  border-radius: 5px; padding: 2px 8px;
}

/* Wizard footer */
.cmp-wiz-footer { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding-top: 16px; border-top: 1px solid var(--border); margin-top: 4px; }
.cmp-wiz-next, .cmp-wiz-launch {
  background: #EC3025; color: #fff; border: none; border-radius: 7px;
  padding: 8px 16px; font-size: 12px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background 0.15s, opacity 0.15s;
}
.cmp-wiz-next:disabled { opacity: 0.4; cursor: not-allowed; }
.cmp-wiz-next:not(:disabled):hover, .cmp-wiz-launch:hover { background: #d42a1f; }
.cmp-wiz-back {
  background: none; border: 1px solid var(--border); border-radius: 7px;
  padding: 8px 14px; font-size: 12px; font-weight: 500;
  color: var(--text-muted); cursor: pointer; transition: all 0.15s;
}
.cmp-wiz-back:hover { color: var(--text-primary); border-color: rgba(255,255,255,0.2); }

/* Launch loading state */
.cmp-wiz-launch.loading { opacity: 0.7; cursor: wait; }

/* Light mode overrides */
body.light .wiz-overlay { background: rgba(0,0,0,0.35); }
body.light .cmp-wizard { background: #fff; }
body.light .cmp-tmpl-card { border-color: rgba(0,0,0,0.1); }
body.light .cmp-tmpl-card:hover { border-color: rgba(0,0,0,0.2); }
body.light .cmp-tmpl-card.selected { border-color: #EC3025; background: rgba(236,48,37,0.04); }
body.light .tmpl-card { border-color: rgba(0,0,0,0.1); }
body.light .tmpl-card:hover { border-color: rgba(236,48,37,0.35); }
body.light .tmpl-card.selected { border-color: #EC3025; background: rgba(236,48,37,0.04); }
body.light .cmp-contact-search { background: #f8f9fb; border-color: rgba(0,0,0,0.1); color: #1a1c23; }
body.light .cmp-contact-item:hover { background: rgba(0,0,0,0.02); }
body.light .cmp-contact-item.selected { background: rgba(236,48,37,0.04); }
body.light .cmp-review-section { background: rgba(0,0,0,0.02); border-color: rgba(0,0,0,0.08); }

/* Wizard step 1 — mode cards */
.wiz-mode-cards { display: flex; flex-direction: column; gap: 10px; margin-bottom: 4px; }
.wiz-mode-card {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--bg-overlay);
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.wiz-mode-card:hover { border-color: var(--red); background: rgba(236,48,37,0.04); }
.wiz-mode-icon {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  background: rgba(236,48,37,0.08); color: var(--red);
  display: flex; align-items: center; justify-content: center;
}
.wiz-mode-info { flex: 1; }
.wiz-mode-name { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.wiz-mode-desc { font-size: 11px; color: var(--text-muted); }
.wiz-mode-chevron { color: var(--text-faint); flex-shrink: 0; }

/* Wizard manual form */
.wiz-manual-form { display: flex; flex-direction: column; gap: 12px; padding: 4px 0 16px; }
.wiz-form-row { display: flex; flex-direction: column; gap: 5px; }
.wiz-form-label { font-size: 11px; font-weight: 600; color: var(--text-muted); letter-spacing: 0.04em; }
.wiz-form-input {
  background: var(--bg-overlay); border: 1px solid var(--border-strong);
  border-radius: 7px; padding: 8px 10px; font-size: 13px; color: var(--text-primary); outline: none;
  transition: border-color 0.15s;
}
.wiz-form-input:focus { border-color: var(--red); }
.wiz-add-btn {
  align-self: flex-start; padding: 7px 14px; font-size: 12px; font-weight: 600;
  background: var(--red); color: #fff; border: none; border-radius: 7px; cursor: pointer; transition: opacity 0.15s;
}
.wiz-add-btn:hover { opacity: 0.85; }
.wiz-manual-added { margin-top: 4px; }
.wiz-manual-added-title { font-size: 11px; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; letter-spacing: 0.04em; }
.wiz-manual-added-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 10px; border-radius: 7px; background: var(--bg-overlay);
  font-size: 12px; color: var(--text-primary); margin-bottom: 4px;
}
.wiz-manual-remove { background: none; border: none; color: var(--text-faint); font-size: 16px; cursor: pointer; line-height: 1; padding: 0 2px; }
.wiz-manual-remove:hover { color: var(--red); }

/* Wizard step 3 — two-panel layout */
#wizStep3 { overflow: hidden; display: none; flex-direction: column; }
#wizStep3.active { display: flex; }
.wiz-seq-steps { padding: 0; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.wiz-seq-layout {
  display: grid; grid-template-columns: 280px 1fr; gap: 0;
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  min-height: 360px; flex: 1; min-height: 0;
}

/* Left — step list (outreach log style) */
.wiz-seq-left {
  border-right: 1px solid var(--border);
  padding: 12px 0; overflow-y: auto;
}
.wiz-step-row {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; cursor: pointer;
  transition: background 0.12s; position: relative;
}
.wiz-step-row:hover { background: var(--bg-overlay); }
.wiz-step-row.active { background: var(--bg-overlay); }
.wiz-step-icon {
  width: 36px; height: 36px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s;
}
.wiz-step-row-body { flex: 1; min-width: 0; }
.wiz-step-row-name { font-size: 12px; font-weight: 700; color: var(--text-primary); margin-bottom: 2px; }
.wiz-step-row-desc { font-size: 11px; color: var(--text-muted); line-height: 1.4; }
.wiz-step-day-pill {
  font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 5px;
  flex-shrink: 0; letter-spacing: 0.02em;
}
/* Editable delay node between steps */
.wiz-delay-node {
  display: flex; flex-direction: column; align-items: center; gap: 0; padding: 0 16px;
}
.wiz-delay-line { width: 1px; height: 12px; background: var(--border); flex-shrink: 0; }
.wiz-delay-block {
  display: flex; align-items: center; gap: 5px;
  background: var(--bg-overlay); border: 1px solid var(--border);
  border-radius: 8px; padding: 5px 10px;
}
.wiz-delay-dec, .wiz-delay-inc {
  background: none; border: none; color: var(--text-muted); font-size: 15px; line-height: 1;
  cursor: pointer; padding: 0 2px; border-radius: 4px;
}
.wiz-delay-dec:hover, .wiz-delay-inc:hover { color: var(--text-primary); background: rgba(255,255,255,0.06); }
.wiz-delay-input {
  width: 32px; background: none; border: none; outline: none;
  font-size: 13px; font-weight: 700; color: var(--text-primary);
  text-align: center; padding: 0;
  -moz-appearance: textfield;
}
.wiz-delay-input::-webkit-outer-spin-button,
.wiz-delay-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.wiz-delay-unit { font-size: 12px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.wiz-delay-unit-toggle { font-size: 12px; font-weight: 600; color: var(--text-muted); background: none; border: none; outline: none; padding: 0; cursor: pointer; white-space: nowrap; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 2px; }
.wiz-delay-unit-toggle:hover { color: var(--accent); }
.wiz-delay-hint { font-size: 10px; color: var(--text-faint); margin-top: 2px; }

/* Right — message editor */
.wiz-seq-right {
  padding: 20px; display: flex; flex-direction: column; gap: 14px;
  overflow-y: auto;
}
.wiz-editor-header { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.wiz-seq-ch-badge {
  font-size: 11px; font-weight: 700; padding: 3px 10px;
  border-radius: 99px; letter-spacing: 0.03em;
}
.wiz-seq-day-badge { font-size: 11px; color: var(--text-faint); }
.wiz-edit-field { display: flex; flex-direction: column; gap: 5px; }
.wiz-edit-label {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  letter-spacing: 0.04em; display: flex; align-items: center; gap: 6px;
}
.wiz-var-hint {
  font-weight: 400; font-size: 10px; color: var(--text-faint);
  background: var(--bg-overlay); border-radius: 4px; padding: 1px 6px;
}
.wiz-edit-input, .wiz-edit-textarea {
  background: var(--bg-overlay); border: 1px solid var(--border-strong);
  border-radius: 7px; padding: 8px 10px; font-size: 13px; color: var(--text-primary);
  outline: none; transition: border-color 0.15s; font-family: inherit; resize: none; width: 100%; box-sizing: border-box;
}
.wiz-edit-input:focus, .wiz-edit-textarea:focus { border-color: var(--red); }

/* Inbound sequence tabs (Seq 1 / Seq 2 / Seq 3) */
.wiz-seq-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}
.wiz-seq-tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  flex: 1;
}
.wiz-seq-tab:hover { background: var(--bg-overlay); }
.wiz-seq-tab.active {
  background: rgba(236,48,37,0.1);
  border-color: rgba(236,48,37,0.4);
}
.wiz-seq-tab-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}
.wiz-seq-tab.active .wiz-seq-tab-label { color: #EC3025; }
.wiz-seq-tab-desc {
  font-size: 10px;
  color: var(--text-faint);
}

body.light .wiz-seq-layout { border-color: rgba(0,0,0,0.1); }
body.light .wiz-seq-left { border-color: rgba(0,0,0,0.1); }
body.light .wiz-step-row:hover, body.light .wiz-step-row.active { background: rgba(0,0,0,0.025); }
body.light .wiz-edit-input, body.light .wiz-edit-textarea { background: #f8f9fb; border-color: rgba(0,0,0,0.12); color: #1a1c23; }

/* Wizard step 4 — campaign name */
.wiz-launch-name { margin-bottom: 20px; }

/* Step 4 launch review */
.wiz-launch-checklist { display: flex; flex-direction: column; gap: 10px; margin: 20px 0; }
.wiz-launch-check {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 13px; color: var(--text-primary); line-height: 1.5;
}
.wiz-launch-check svg { flex-shrink: 0; margin-top: 1px; }
.wiz-launch-athletes { margin: 20px 0 16px; }
.wiz-launch-athletes-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: 8px;
}
.wiz-launch-note {
  display: flex; align-items: flex-start; gap: 9px;
  background: rgba(245,158,11,0.07); border: 1px solid rgba(245,158,11,0.2);
  border-radius: 9px; padding: 12px 14px;
  font-size: 12px; color: var(--text-muted); line-height: 1.55;
}
.wiz-launch-note svg { flex-shrink: 0; margin-top: 1px; }

/* Light mode overrides */
body.light .wiz-mode-card { background: #f8f9fb; border-color: rgba(0,0,0,0.1); }
body.light .wiz-form-input { background: #f8f9fb; border-color: rgba(0,0,0,0.12); color: #1a1c23; }
body.light .wiz-manual-added-row { background: rgba(0,0,0,0.03); }

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ─── CONVERSATIONS INBOX ──────────────────────────────────────────── */
#view-conversations { padding: 0; overflow: hidden; }

.ci-layout {
  display: flex;
  height: calc(100vh - 48px);
  overflow: hidden;
}

/* Inbox sidebar */
.ci-inbox {
  width: 340px;
  min-width: 340px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ci-inbox-top {
  padding: 12px 12px 0;
  flex-shrink: 0;
}

.ci-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 10px;
}
.ci-search {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 13px;
  width: 100%;
}
.ci-search::placeholder { color: var(--text-faint); }

.ci-filter-row {
  display: flex;
  gap: 6px;
  padding-bottom: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.ci-filter-row::-webkit-scrollbar { display: none; }
.ci-filter-btn {
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s;
  /* The row is overflow-x:auto (scrollable). Without this, mobile browsers hesitate on the first
     tap (tap vs horizontal-scroll) — the click gets eaten and only a sticky :hover shows, so the
     filter needs a SECOND tap to register. manipulation makes the tap fire immediately. */
  touch-action: manipulation;
}
.ci-filter-btn.active, .ci-filter-btn:hover {
  background: var(--accent-muted);
  color: var(--accent-light);
  border-color: var(--border-accent);
}
/* Stage-chip count badge — same shape as the Call badge, tinted to the chip's OWN color
   (currentColor), so each count matches its chip. :empty auto-hides a zero count. */
.ci-filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  margin-left: 5px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  background: color-mix(in srgb, currentColor 15%, transparent);
  color: currentColor;
}
.ci-filter-count:empty { display: none; }
/* "Needs Human" — light amber outline so it differentiates from the gray
   filters and the teal active state, matching the Booked/AI-off amber. */
.ci-filter-btn--human {
  border-color: rgba(217,119,6,0.45);
  color: #b07a3c;
}
.ci-filter-btn--human.active, .ci-filter-btn--human:hover {
  background: rgba(217,119,6,0.10);
  color: #a16a3c;
  border-color: rgba(217,119,6,0.6);
}
/* "Call" — red outline so it reads as the call-back queue. */
.ci-filter-btn--call {
  border-color: rgba(192,57,43,0.45);
  color: #b1564b;
}
.ci-filter-btn--call.active, .ci-filter-btn--call:hover {
  background: rgba(192,57,43,0.10);
  color: #a8453c;
  border-color: rgba(192,57,43,0.6);
}
/* "Sold" — green outline, icon-only (money bag). */
/* "Sold" — green, money-bag icon + "Sold" label. */
.ci-filter-btn--sold {
  border-color: rgba(22,163,74,0.45);
  color: #16a34a;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.ci-filter-btn--sold.active, .ci-filter-btn--sold:hover {
  background: rgba(22,163,74,0.10);
  color: #15803d;
  border-color: rgba(22,163,74,0.6);
}
/* Stage chips — outline + text tinted to match their inbox-section color
   (Reschedule=amber, Upcoming=blue, Mark Sold/Lost=purple). Qualifying stays the
   default gray. Count badges inherit the chip color via currentColor. */
.ci-filter-btn--reschedule { border-color: rgba(217,119,6,0.45); color: #d97706; }
.ci-filter-btn--reschedule.active, .ci-filter-btn--reschedule:hover { background: rgba(217,119,6,0.10); color: #b45309; border-color: rgba(217,119,6,0.6); }
.ci-filter-btn--upcoming { border-color: rgba(37,99,235,0.45); color: #2563eb; }
.ci-filter-btn--upcoming.active, .ci-filter-btn--upcoming:hover { background: rgba(37,99,235,0.10); color: #1d4ed8; border-color: rgba(37,99,235,0.6); }
.ci-filter-btn--marksold { border-color: rgba(124,58,237,0.45); color: #7c3aed; }
.ci-filter-btn--marksold.active, .ci-filter-btn--marksold:hover { background: rgba(124,58,237,0.10); color: #6d28d9; border-color: rgba(124,58,237,0.6); }
/* "Call" chip count badge — neutral by default, red when any callback is overdue. */
.ci-call-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  margin-left: 5px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  background: rgba(220,38,38,0.15);
  color: #dc2626;
}
/* Overdue is the same red now — badge is always red for a consistent look with the
   red Call chip (kept as a no-op so the JS toggle doesn't need to change). */
.ci-call-badge--overdue {
  background: rgba(220,38,38,0.15);
  color: #dc2626;
}
/* Date section headers in the "Call" filter list. */
.ci-cb-section {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent);            /* future dates (tomorrow + each date) — calm teal */
  padding: 12px 14px 5px;
  text-transform: uppercase;
}
.ci-cb-section--overdue { color: #991b1b; }  /* deep red — urgent/late */
.ci-cb-section--today { color: #dc2626; }    /* red — today */
.ci-cb-section--tomorrow { color: #ca8a04; } /* amber/gold — tomorrow */
/* Upcoming call-reminder chip in the thread (tappable to edit). */
.ci-event-card--callback { cursor: pointer; }
.ci-event-tap {
  display: inline-block;
  margin-top: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent);
  background: var(--accent-muted);
  padding: 2px 8px;
  border-radius: 10px;
}

.ci-view-toggle {
  margin-left: auto;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 6px;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
@media (hover: hover) {
  .ci-view-toggle:hover {
    background: var(--accent-muted);
    color: var(--accent-light);
    border-color: var(--border-accent);
  }
}
.ci-view-toggle--active {
  background: var(--accent-muted);
  color: var(--accent-light);
  border-color: var(--border-accent);
}

.ci-pipeline-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 16px 14px 4px;
  border-top: 1px solid var(--border);
}
.ci-pipeline-group:first-child .ci-pipeline-header {
  border-top: none;
  padding-top: 8px;
}
.ci-pipeline-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-secondary);
}
.ci-pipeline-count {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-faint);
}
.ci-pipeline-group[data-group="book_now"] .ci-pipeline-label   { color: #d97706; }
.ci-pipeline-group[data-group="call_confirm"] .ci-pipeline-label { color: #2563eb; }
.ci-pipeline-group[data-group="follow_up"] .ci-pipeline-label  { color: #7c3aed; }
.ci-pipeline-group[data-group="my_leads"] .ci-pipeline-label   { color: #0891b2; }
.ci-pipeline-group[data-group="qualifying"] .ci-pipeline-label { color: var(--text-secondary); }

.ci-list {
  flex: 1;
  overflow-y: auto;
}
.ci-loading {
  padding: 24px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
}

/* Inbox list items */
.ci-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}
.ci-item:hover { background: var(--accent-muted); }
.ci-item--active { background: var(--accent-muted); }

.ci-item-avatar {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}
.ci-item-avatar--unread {
  background: var(--accent-muted);
  border-color: var(--border-accent);
  color: var(--accent-light);
}

.ci-item-body { flex: 1; min-width: 0; }
.ci-item-row1 { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 2px; }
.ci-item-name { font-size: 14px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.ci-item-name--unread { font-weight: 700; }
.ci-item-time { font-size: 11px; color: var(--text-faint); flex-shrink: 0; }
.ci-item-time--unread { color: var(--accent-light); font-weight: 600; }
.ci-item-preview { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.ci-item-row3 { display: flex; align-items: center; gap: 6px; }
.ci-item-source { font-size: 11px; color: var(--text-faint); margin-right: auto; }
.ci-item-my-leads {
  font-size: 10px;
  font-weight: 700;
  color: #2563eb;
  background: rgba(37,99,235,0.1);
  border-radius: 8px;
  padding: 1px 6px;
  white-space: nowrap;
}
.ci-item-ai-stopped {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  color: #a16a3c;                 /* muted amber — "AI stopped" (matches the filter) */
  background: rgba(217,119,6,0.10);
  border-radius: 8px;
  padding: 1px 6px;
  white-space: nowrap;
}
/* Owner chip — which trainer is handling the lead (gray); blue when it's you */
.ci-item-owner {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  color: #5b7aa6;                       /* muted blue — a trainer's on it */
  background: rgba(91,122,166,0.12);
  border-radius: 8px;
  padding: 1px 6px;
  white-space: nowrap;
}
.ci-item-owner svg { flex-shrink: 0; }
/* "Booked" chip — calendar icon + text, muted amber, right-aligned with the badge */
.ci-item-booked {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  color: #a16a3c;
  background: rgba(217,119,6,0.10);
  border-radius: 8px;
  padding: 1px 6px;
  white-space: nowrap;
}
.ci-item-booked svg { flex-shrink: 0; }
/* Pending call-reminder marker — same pill shape as the AI icon, in red for visibility. */
.ci-item-callicon {
  display: inline-flex;
  align-items: center;
  color: #ad6258;
  background: rgba(192,57,43,0.07);
  border-radius: 8px;
  padding: 1px 5px;
}
.ci-item-callicon svg { flex-shrink: 0; }
.ci-item-badge {
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* Thread pane */
.ci-thread-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.ci-thread-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  gap: 12px;
  font-size: 13px;
}

.ci-thread-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Thread header */
.ci-thread-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ci-back-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  display: none;
  align-items: center;
}
.ci-call-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.15s;
  margin-left: auto;
}
.ci-call-btn:hover {
  background: var(--bg-hover);
  color: var(--accent);
}
.ci-call-btn:active {
  transform: scale(0.96);
}
.ci-call-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.ci-ai-summary-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.15s;
}
.ci-ai-summary-btn:hover { background: var(--bg-hover); color: var(--accent); }
.ci-ai-summary-btn:active { transform: scale(0.96); }
.ci-ai-summary-btn.loading { opacity: 0.5; pointer-events: none; }
.ci-ai-summary-btn svg { pointer-events: none; }

/* ── More button (⋯) ── */
.ci-more-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.15s;
  flex-shrink: 0;
}
.ci-more-btn:hover { background: var(--bg-hover); }
.ci-more-btn:active { transform: scale(0.96); }

/* ── More menu dropdown ── */
.ci-more-menu {
  position: absolute;
  top: 54px;
  right: 12px;
  z-index: 300;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.18);
  padding: 6px;
  min-width: 200px;
}
.ci-more-menu-hd {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  padding: 4px 12px 6px;
}
.ci-more-item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  transition: background 0.1s;
}
.ci-more-item:hover { background: var(--bg-hover); }
.ci-more-item--dim { color: var(--text-muted); }
.ci-more-check { width: 14px; flex-shrink: 0; display: flex; align-items: center; }
.ci-more-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ── Archived row (WhatsApp-style) ── */
.ci-archived-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
  user-select: none;
}
.ci-archived-row:hover { background: var(--accent-muted); }
.ci-archived-row-icon {
  width: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.ci-archived-row-label { flex: 1; font-size: 14px; font-weight: 400; color: var(--text-muted); }
.ci-archived-row-count { font-size: 13px; color: var(--text-faint); }

/* ── Archived view header ── */
.ci-archived-nav {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ci-archived-back {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.ci-archived-nav-title {
  flex: 1;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-right: 28px;
}
.ci-archived-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 8px 20px;
  border-bottom: 1px solid var(--border);
  line-height: 1.4;
}

/* ── Swipe-to-archive (mobile) ── */
.ci-item-wrap {
  position: relative;
  overflow: hidden;
  touch-action: pan-y;
}
.ci-item-slider {
  position: relative;
  will-change: transform;
}
.ci-item-actions {
  position: absolute;
  left: 100%;
  top: 0;
  bottom: 0;
  width: 88px;
  display: flex;
}
.ci-swipe-btn {
  flex: 1;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  padding: 0;
}
.ci-swipe-btn--archive { background: #34C759; }
.ci-swipe-btn--unarchive { background: #007AFF; }
.ci-swipe-btn svg { pointer-events: none; }

@media (hover: hover) and (pointer: fine) {
  .ci-item-actions { display: none; }
}

.ci-summary-modal {
  position: absolute;
  top: 56px;
  right: 12px;
  z-index: 100;
  width: 320px;
  max-width: calc(100% - 24px);
}
.ci-summary-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  overflow: hidden;
}
.ci-summary-hd {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.ci-summary-close {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-faint);
  font-size: 13px;
  padding: 2px 4px;
  line-height: 1;
}
.ci-summary-close:hover { color: var(--text); }
.ci-summary-body {
  padding: 14px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
  max-height: 320px;
  overflow-y: auto;
}
.ci-thread-avatar {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 50%;
  background: var(--accent-muted);
  border: 1px solid var(--border-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-light);
}
.ci-thread-name { font-size: 15px; font-weight: 600; color: var(--text); }
.ci-thread-sub { font-size: 12px; color: var(--text-faint); margin-top: 1px; }

/* Messages area */
.ci-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* System event card */
.ci-event-card {
  display: flex;
  gap: 10px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  align-self: center;
  max-width: 280px;
  text-align: center;
  flex-direction: column;
  align-items: center;
  margin: 4px auto 8px;
}
.ci-event-icon { color: var(--text-faint); }
.ci-event-title { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.ci-event-name { font-size: 12px; color: var(--text-muted); }
.ci-event-time { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.ci-event-meta { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* Call pill — right-aligned like outbound messages */
.ci-call-pill {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  background: rgba(32,128,141,0.1);
  border: 1px solid rgba(32,128,141,0.25);
  border-radius: 14px;
  padding: 7px 14px;
  max-width: 100%;
}
.ci-call-pill__meta { font-size: 11px; font-weight: 400; color: var(--text-faint); }
.ci-call-pill__name { color: var(--text-primary); font-weight: 500; }
.ci-call-pill__row { display: flex; align-items: center; gap: 6px; }
.ci-call-pill__row svg { color: var(--accent-light); flex-shrink: 0; }
.ci-call-pill__label { font-size: 13px; font-weight: 600; color: var(--accent-light); }

/* Call recording player */
.ci-recording { display: flex; align-items: center; gap: 10px; margin-top: 8px; width: 100%; }
.ci-recording__play {
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(32,128,141,0.8); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: #fff; padding: 0; transition: background 0.15s;
}
.ci-recording__play:hover { background: rgba(32,128,141,1); }
.ci-recording__wave { flex: 1; height: 30px; min-width: 80px; }
.ci-recording__wave svg { width: 100%; height: 100%; display: block; }
.ci-recording__dur { font-size: 11px; color: var(--text-faint); flex-shrink: 0; min-width: 28px; text-align: right; font-variant-numeric: tabular-nums; }
.ci-recording audio { display: none; }

/* Message bubbles */
.ci-date-separator { display: flex; align-items: center; justify-content: center; margin: 16px 0 8px; width: 100%; }
.ci-date-separator span { background: var(--bg-card, #2a2d3e); color: var(--text-faint, #8b8fa8); font-size: 11px; font-weight: 500; padding: 3px 10px; border-radius: 10px; letter-spacing: 0.3px; }

.ci-msg { display: flex; flex-direction: column; max-width: 75%; }
.ci-msg--out { align-self: flex-end; align-items: flex-end; }
.ci-msg--in { align-self: flex-start; align-items: flex-start; }
.ci-msg-label { font-size: 11px; color: var(--text-faint); margin-bottom: 4px; }
.ci-msg-author--ai { color: rgba(32,128,141,0.7); }

.ci-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}
.ci-bubble--out {
  background: rgba(32,128,141,0.15);
  color: var(--text);
  border-bottom-right-radius: 4px;
}
.ci-bubble--in {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

/* Reply bar */
.ci-reply-bar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.ci-reply-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--text-primary);
  resize: none;
  outline: none;
  max-height: 120px;
  min-height: 40px;
  font-family: inherit;
  line-height: 1.4;
}
.ci-reply-input::placeholder { color: var(--text-faint); }
.ci-reply-input:focus { border-color: var(--border-accent); }
.ci-send-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: opacity 0.15s;
}
.ci-send-btn:hover { opacity: 0.85; }
.ci-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Tablet responsive (768px - 1024px) */
@media (max-width: 1024px) and (min-width: 768px) {
  .ci-inbox {
    width: 300px;
    min-width: 300px;
  }

  .ci-item-name {
    max-width: 140px;
  }

  .ci-msg {
    max-width: 80%;
  }
}

/* Mobile responsive */
@media (max-width: 767px) {
  .ci-layout {
    position: relative;
    height: calc(100vh - 60px - 70px - env(safe-area-inset-bottom));
    display: block !important;
    overflow: hidden;
  }

  .ci-layout--thread-open {
    height: calc(100vh - 60px - env(safe-area-inset-bottom));
  }

  .ci-inbox {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    height: 100%;
    border-right: none;
    position: relative;
    z-index: 1;
  }

  .ci-layout--thread-open .ci-inbox {
    visibility: hidden;
  }

  .ci-inbox-top {
    padding: 16px 16px 0;
  }

  .ci-search-wrap {
    padding: 12px 14px;
    margin-bottom: 12px;
    border-radius: 12px;
  }

  .ci-search {
    font-size: 15px;
  }

  .ci-filter-row {
    gap: 8px;
    padding: 0 4px 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .ci-filter-btn {
    padding: 8px 16px;
    font-size: 13px;
    white-space: nowrap;
    min-width: fit-content;
    border-radius: 8px;
  }

  .ci-list {
    padding: 0 8px;
  }

  .ci-item {
    padding: 14px 12px;
    margin-bottom: 4px;
    border-radius: 8px;
  }

  .ci-item-avatar {
    width: 52px;
    height: 52px;
    min-width: 52px;
    font-size: 17px;
  }

  .ci-item-name {
    font-size: 16px;
    font-weight: 600;
    max-width: 200px;
  }

  .ci-item-preview {
    font-size: 14px;
    margin-top: 4px;
    line-height: 1.4;
  }

  .ci-item-time {
    font-size: 13px;
  }

  .ci-item-source {
    font-size: 12px;
    margin-top: 4px;
  }

  .ci-item-badge {
    min-width: 22px;
    height: 22px;
    font-size: 11px;
    border-radius: 11px;
  }

  .ci-loading {
    padding: 32px 20px;
    font-size: 14px;
  }

  /* Hide footer on mobile to prevent overlap with reply bar */
  .app-footer {
    display: none;
  }

  .ci-thread-pane {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 100dvh;
    width: 100%;
    padding-top: env(safe-area-inset-top); /* clear status bar (border-box so total stays 100dvh) */
    background: var(--bg);
    transform: translateX(100%);
    transition: transform 0.25s ease;
    z-index: 50;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .ci-layout--thread-open .ci-thread-pane {
    transform: translateX(0);
  }

  .ci-back-btn {
    display: inline-flex !important;
    margin-right: 8px;
  }

  .ci-thread-empty {
    display: none;
  }

  .ci-thread-header {
    padding: 10px 12px;
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-base, var(--bg));
  }

  .ci-thread-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    font-size: 13px;
  }

  .ci-thread-name {
    font-size: 16px;
    font-weight: 600;
  }

  .ci-thread-sub {
    font-size: 13px;
    margin-top: 2px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

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

  .ci-call-btn {
    padding: 4px;
    margin-left: 0;
  }

  .ci-ai-summary-btn {
    padding: 4px;
  }

  .ci-more-btn {
    padding: 4px;
  }

  .ci-thread-inner {
    min-height: 0; /* allow flex shrink so messages area can scroll */
  }

  .ci-messages {
    padding: 16px 14px;
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-height: 0;
  }

  .ci-msg {
    max-width: 85%;
  }

  .ci-msg-label {
    font-size: 12px;
    margin-bottom: 4px;
  }

  .ci-bubble {
    font-size: 15px;
    padding: 11px 14px;
    line-height: 1.4;
  }

  .ci-thread-inner .ci-reply-bar {
    position: static; /* natural flex child; container height:100dvh keeps it above browser toolbar */
    padding: 12px 14px;
    padding-bottom: max(env(safe-area-inset-bottom), 12px);
    gap: 10px;
    background: var(--bg-base);
    border-top: 1px solid var(--border);
    display: none;
  }

  .ci-thread-inner[style*="display: flex"] .ci-reply-bar,
  .ci-thread-inner[style*="display:flex"] .ci-reply-bar {
    display: flex !important;
  }

  .ci-reply-input {
    font-size: 16px;
    padding: 12px 14px;
    min-height: 44px;
    border-radius: 22px;
  }

  .ci-send-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    padding: 0;
    flex-shrink: 0;
  }

  .ci-event-card {
    padding: 12px 14px;
    font-size: 14px;
    border-radius: 10px;
  }

  .ci-event-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    font-size: 16px;
  }

  .ci-event-title {
    font-size: 14px;
    font-weight: 600;
  }

  .ci-event-name {
    font-size: 15px;
  }

  .ci-event-time {
    font-size: 12px;
  }

  .ci-event-meta {
    font-size: 13px;
    padding: 4px 0;
  }
}

/* Extra small mobile (< 480px) */
@media (max-width: 479px) {
  .ci-inbox-top {
    padding: 14px 12px 0;
  }

  .ci-search-wrap {
    padding: 10px 12px;
    border-radius: 10px;
  }

  .ci-filter-btn {
    padding: 7px 14px;
    font-size: 12px;
  }

  .ci-list {
    padding: 0 6px;
  }

  .ci-item {
    padding: 12px 10px;
  }

  .ci-item-avatar {
    width: 48px;
    height: 48px;
    min-width: 48px;
    font-size: 16px;
  }

  .ci-item-name {
    font-size: 15px;
    max-width: 160px;
  }

  .ci-item-preview {
    font-size: 13px;
  }

  .ci-thread-header {
    padding: 12px 14px;
  }

  .ci-thread-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
  }

  .ci-messages {
    padding: 14px 12px;
  }

  .ci-bubble {
    font-size: 14px;
    padding: 10px 13px;
  }

  .ci-reply-bar {
    padding: 10px 12px;
    padding-bottom: max(env(safe-area-inset-bottom), 10px);
    /* position: static — inherits flex-child positioning from larger breakpoint */
  }

  .ci-reply-input {
    font-size: 16px;
    padding: 11px 13px;
    min-height: 42px;
  }

  .ci-send-btn {
    width: 42px;
    height: 42px;
    min-width: 42px;
  }
}

/* ============================================================
   CALL MODAL
   ============================================================ */

.call-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.call-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.call-modal-content {
  position: relative;
  background: var(--bg-surface);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  max-width: 480px;
  width: 100%;
  border: 1px solid var(--border);
  animation: callModalSlideIn 0.25s ease-out;
}

@keyframes callModalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.call-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.call-modal-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.call-modal-title {
  flex: 1;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.call-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.call-modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.call-modal-body {
  padding: 24px;
}

.call-contact-info {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-raised);
  border-radius: 12px;
  margin-bottom: 24px;
}

.call-contact-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-muted);
  border: 2px solid var(--border-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 600;
  color: var(--accent-light);
}

.call-contact-details {
  flex: 1;
  min-width: 0;
}

.call-contact-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.call-contact-phone {
  font-size: 14px;
  color: var(--text-muted);
}

.call-flow-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.call-step-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
}

.call-step-text {
  font-size: 14px;
  color: var(--text-secondary);
}

.call-status {
  margin-top: 20px;
  padding: 16px;
  background: var(--accent-muted);
  border: 1px solid var(--border-accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.call-status-icon {
  font-size: 20px;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.call-status-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--accent-light);
}

.call-modal-footer {
  display: flex;
  gap: 12px;
  padding: 20px 24px;
  border-top: 1px solid var(--border);
}

.call-btn-secondary,
.call-btn-primary {
  flex: 1;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.call-btn-secondary {
  background: var(--bg-raised);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.call-btn-secondary:hover {
  background: var(--bg-hover);
}

.call-btn-primary {
  background: var(--accent);
  color: #fff;
}

.call-btn-primary:hover {
  background: var(--accent-light);
}

.call-btn-primary:disabled,
.call-btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Mobile responsive */
@media (max-width: 767px) {
  .call-modal {
    padding: 16px;
  }

  .call-modal-content {
    max-width: 100%;
  }

  .call-modal-header {
    padding: 16px 20px;
  }

  .call-modal-body {
    padding: 20px;
  }

  .call-modal-footer {
    padding: 16px 20px;
  }

  .call-contact-info {
    padding: 14px;
  }

  .call-contact-avatar {
    width: 48px;
    height: 48px;
    font-size: 18px;
  }
}

/* ============================================================
   SCOUT AGENTS - MOBILE RESPONSIVE
   ============================================================ */

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) and (min-width: 768px) {
  .sa-cmd-box {
    width: 100%;
    max-width: 600px;
  }

  .sa-recent-wrap {
    width: 100%;
    max-width: 600px;
  }

  .sa-split-left {
    width: 240px;
  }
}

/* Mobile (< 768px) */
@media (max-width: 767px) {
  #view-scout-agents.active {
    margin: 0;
    height: calc(100vh - 60px);
  }

  /* Entry screen */
  .sa-entry-wrap {
    padding: 8vh 16px 32px;
  }

  .sa-entry-hd {
    margin-bottom: 24px;
  }

  .sa-entry-title {
    font-size: 20px;
    line-height: 26px;
  }

  .sa-entry-sub {
    font-size: 12px;
  }

  .sa-cmd-box {
    width: 100%;
    border-radius: 12px;
  }

  .sa-cmd-input-row {
    padding: 14px 16px 12px;
    gap: 10px;
  }

  .sa-cmd-textarea {
    font-size: 14px;
  }

  .sa-cmd-divider {
    margin: 0 16px;
  }

  .sa-cmd-footer {
    padding: 8px 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .sa-try-row {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }

  .sa-try-chip {
    white-space: nowrap;
  }

  .sa-cmd-right {
    justify-content: space-between;
    width: 100%;
  }

  .sa-spawn-btn {
    padding: 10px 16px;
    flex: 1;
    justify-content: center;
  }

  .sa-info-row {
    width: 100%;
    font-size: 10px;
  }

  .sa-recent-wrap {
    width: 100%;
    margin-top: 24px;
  }

  /* Split view becomes stacked on mobile */
  .sa-split {
    flex-direction: column;
  }

  .sa-split-left {
    width: 100%;
    max-height: 50vh;
    border-right: none;
    border-bottom: none;
  }

  .sa-split-right {
    display: none;
  }

  .sa-pending-delete {
    display: none;
  }

  .sa-split-left-hd {
    padding: 12px 16px 10px;
  }

  #saOverviewDynamicRows {
    padding: 4px 0;
  }

  .sa-split-left .sa-agent-row {
    padding: 12px 16px;
  }

  .sa-split-left .sa-agent-name-row {
    flex-wrap: nowrap;
  }

  .sa-split-left .sa-agent-name {
    flex: 1;
    min-width: 0;
    white-space: normal;
  }

  .sa-split-left .sa-type-badge {
    flex-shrink: 0;
    margin-left: auto;
  }

  /* Detail view */
  .sa-detail-inner-hd {
    padding: 10px 16px;
  }

  .sa-query-banner {
    padding: 12px 16px;
    gap: 10px;
  }

  .sa-qb-text {
    font-size: 13px;
  }

  .sa-detail-body {
    padding: 12px 16px;
  }

  .sa-result-card {
    padding: 14px;
  }

  .sa-rc-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .sa-athlete-rows {
    gap: 10px;
  }

  .sa-athlete-card {
    padding: 12px;
  }

  /* Topbar */
  .sa-topbar {
    padding: 10px 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .sa-topbar-left {
    flex-wrap: wrap;
  }

  .sa-topbar-right {
    justify-content: flex-end;
  }

  /* Alert builder */
  .sa-alert-cols {
    flex-direction: column;
  }

  .sa-alert-log-col {
    width: 100%;
    max-height: 200px;
  }

  .sa-alert-cfg-col {
    width: 100%;
  }
}

/* Extra small mobile (< 480px) */
@media (max-width: 479px) {
  .sa-entry-wrap {
    padding: 6vh 12px 24px;
  }

  .sa-entry-title {
    font-size: 18px;
    line-height: 24px;
  }

  .sa-entry-sub {
    font-size: 11px;
  }

  .sa-cmd-input-row {
    padding: 12px 14px 10px;
  }

  .sa-cmd-footer {
    padding: 8px 10px;
  }

  .sa-spawn-btn {
    font-size: 11px;
    padding: 9px 14px;
  }

  .sa-split-left-hd {
    padding: 10px 12px;
  }

  .sa-split-left .sa-agent-row {
    padding: 10px 12px;
  }

  .sa-detail-inner-hd {
    padding: 8px 12px;
  }

  .sa-query-banner {
    padding: 10px 12px;
  }

  .sa-detail-body {
    padding: 10px 12px;
  }

  .sa-result-card {
    padding: 12px;
  }

  .sa-athlete-card {
    padding: 10px;
  }

  .sa-topbar {
    padding: 8px 12px;
  }
}

/* ============================================================
   GENERAL MOBILE ENHANCEMENTS FOR ALL VIEWS
   ============================================================ */

/* Mobile (< 768px) */
@media (max-width: 767px) {
  /* Filter bar enhancements */
  .filter-bar {
    flex-wrap: wrap;
    gap: 8px;
  }

  .filter-search-wrap {
    flex: 1 1 100%;
    min-width: 100%;
  }

  .filter-select {
    font-size: 14px;
  }

  .filter-reset {
    font-size: 14px;
    padding: 8px 14px;
  }

  /* Data tables */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .data-table {
    font-size: 13px;
    min-width: 700px;
  }
  #prospectsTable {
    min-width: 940px;
  }

  .data-table th,
  .data-table td {
    padding: 10px 12px;
  }

  .nav-oauth-row {
    display: none;
  }

  .sidebar-footer {
    /* Pinned above the bottom nav by the sidebar's padding — no magic offset. The old
       `margin-top: 110px` pushed it down into the bottom nav's territory. */
    margin-top: 0;
    flex-shrink: 0;
  }

  .pl-table-card {
    overflow-x: auto !important;
  }

  .pl-table-scroll {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .pl-table {
    font-size: 13px;
    min-width: 720px;
    table-layout: auto !important;
  }

  .pl-table th,
  .pl-table td {
    padding: 10px 12px;
  }

  /* Dashboard */
  .dash-body {
    flex-direction: column;
    gap: 16px;
  }

  .dash-charts-col {
    gap: 16px;
  }

  .dash-right-col {
    gap: 16px;
  }

  .dash-chart-card {
    padding: 16px;
  }

  .dash-leads-panel {
    padding: 16px;
  }

  .dash-notif-panel {
    padding: 16px;
  }

  .card-header h2 {
    font-size: 16px;
  }

  /* Source chips */
  .source-chips-row {
    flex-wrap: wrap;
  }

  .source-chips {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }

  .source-chip {
    white-space: nowrap;
    font-size: 12px;
    padding: 6px 12px;
  }

  /* Campaigns */
  .cmp-toolbar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .oct-filters {
    gap: 6px;
  }

  .oct-filter {
    font-size: 12px;
    padding: 6px 12px;
    white-space: nowrap;
  }

  /* Outreach / Sequences */
  .seq-hero {
    flex-direction: column;
    padding: 20px;
    gap: 24px;
  }

  .seq-hero-left {
    gap: 12px;
  }

  .seq-hero-headline {
    font-size: 20px;
  }

  .seq-hero-body {
    font-size: 12px;
  }

  .seq-feature-list {
    gap: 6px;
  }

  .seq-feature-list li {
    font-size: 12px;
  }

  .seq-preview {
    width: 100%;
  }

  .seq-templates {
    flex-direction: column;
    gap: 12px;
  }

  .seq-template-card {
    padding: 16px;
  }

  /* Sequence tables */
  .seq-active-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    min-width: 800px;
  }

  .seq-table-scroll-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Extra small mobile (< 480px) */
@media (max-width: 479px) {
  /* Stack filters 2-per-row */
  .filter-select {
    font-size: 13px;
    padding: 7px 10px;
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
  }

  #filterReset {
    flex: 1 1 calc(50% - 4px);
  }

  #exportCsvBtn {
    flex: 1 1 100%;
    margin-left: 0 !important;
    text-align: center;
  }

  .filter-reset {
    font-size: 13px;
    padding: 7px 12px;
  }

  .data-table {
    font-size: 12px;
  }

  .data-table th,
  .data-table td {
    padding: 8px 10px;
  }

  .dash-chart-card {
    padding: 14px;
  }

  .dash-leads-panel {
    padding: 14px;
  }

  .card-header h2 {
    font-size: 15px;
  }

  .source-chip {
    font-size: 11px;
    padding: 5px 10px;
  }

  .oct-filter {
    font-size: 11px;
    padding: 5px 10px;
  }

  /* Outreach / Sequences */
  .seq-hero {
    padding: 16px;
    gap: 20px;
  }

  .seq-hero-headline {
    font-size: 18px;
  }

  .seq-hero-body {
    font-size: 11px;
  }

  .seq-feature-list li {
    font-size: 11px;
  }

  .seq-template-card {
    padding: 14px;
  }

  .seq-unlock-btn {
    font-size: 12px;
    padding: 9px 16px;
  }
}

/* ─── WEEKLY REPORT ──────────────────────────────────────────────────────── */
#view-weekly-report { overflow-y: auto; }
.wr-wrap { max-width: 760px; margin: 0 auto; padding: 28px 24px 48px; }

.wr-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.wr-title { font-size: 18px; font-weight: 600; color: var(--text-primary); }
.wr-period { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.wr-refresh-btn { display: flex; align-items: center; gap: 6px; font-size: 12px; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--bg-raised); color: var(--text-secondary); cursor: pointer; }
.wr-refresh-btn:hover { background: var(--bg-hover); }

.wr-compose { background: var(--bg-surface); border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; }

.wr-field-row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; }
.wr-field-row--border { border-top: 1px solid var(--border); }
.wr-field-label { font-size: 12px; font-weight: 600; color: var(--text-muted); width: 52px; flex-shrink: 0; }
.wr-field-input { flex: 1; background: transparent; border: none; outline: none; font-size: 13px; color: var(--text-primary); font-family: inherit; }
.wr-field-input::placeholder { color: var(--text-faint); }

.wr-body { padding: 20px 24px; border-top: 1px solid var(--border); min-height: 120px; }
.wr-loading { display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-size: 13px; padding: 20px 0; }

/* Email preview styling */
.wr-preview { font-family: Arial, sans-serif; font-size: 14px; line-height: 1.65; color: var(--text-primary); }
.wr-preview-h1 { font-size: 18px; font-weight: 700; margin-bottom: 16px; color: var(--text-primary); }
.wr-preview-h2 { font-size: 14px; font-weight: 700; margin: 16px 0 6px; color: var(--text-primary); }
.wr-preview-section-label { font-weight: 700; font-size: 13px; margin: 16px 0 4px; color: var(--text-primary); }
.wr-preview-list { padding-left: 20px; margin: 0 0 4px; }
.wr-preview-list li { margin-bottom: 3px; font-size: 13px; }
.wr-preview-hr { border: none; border-top: 1px solid var(--border-strong); margin: 16px 0; }
.wr-preview-quote { color: #e05555; font-style: italic; margin-top: 16px; font-size: 13px; }
.wr-red { color: #e05555; }
.wr-hl { background: #FFE500; color: #111; padding: 0 3px; border-radius: 2px; }

/* Editable sections */
.wr-editable { padding: 0 24px 16px; }
.wr-section-divider { border-top: 1px solid var(--border); margin-bottom: 16px; }
.wr-editable-block { margin-bottom: 14px; }
.wr-editable-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.wr-editable-input { width: 100%; background: var(--bg-input); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; font-size: 13px; color: var(--text-primary); font-family: inherit; resize: vertical; outline: none; }
.wr-editable-input:focus { border-color: var(--border-strong); }

.wr-footer { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; border-top: 1px solid var(--border); background: var(--bg-raised); }
.wr-quote-preview { font-size: 11px; color: var(--text-muted); font-style: italic; max-width: 60%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.wr-send-btn { display: flex; align-items: center; gap: 6px; background: var(--accent); color: #fff; border: none; border-radius: 6px; padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer; transition: opacity 0.15s; }
.wr-send-btn:hover:not(:disabled) { opacity: 0.85; }
.wr-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Prior reports */
/* Calendar: the Kenko-sync note — the original teal box: accent-muted fill + accent border (the Gmail "Connect" tint). */
.wr-notice--kenko { background: var(--accent-muted); border-color: var(--border-accent); color: var(--text-secondary); }
.wr-notice--kenko strong { color: var(--accent); }

.wr-history { margin-top: 28px; }
.wr-history-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 10px; }
.wr-history-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.wr-history-table th { text-align: left; font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; padding: 6px 10px; border-bottom: 1px solid var(--border); }
.wr-history-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); color: var(--text-primary); }
.wr-history-table tr:last-child td { border-bottom: none; }
.wr-history-empty { color: var(--text-muted); font-style: italic; text-align: center; padding: 20px !important; }

/* --- Pipeline View --- */
.pl-source-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.pl-source-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  overflow: hidden;
  min-width: 0;
}

.pl-source-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.pl-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.pl-badge--fb  { background: rgba(24,119,242,0.15); color: #1877F2; }
.pl-badge--web { background: var(--accent-muted); color: var(--accent-light); }
.pl-badge--yelp { background: rgba(211, 35, 35, 0.12); color: #d32323; }
.pl-badge--out { background: var(--purple-muted); color: var(--purple); }

.pl-source-leads {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-bottom: 14px;
}

.pl-source-leads-num {
  font-size: 30px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.04em;
  line-height: 1;
}

.pl-source-leads-lbl {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pl-funnel-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.pl-funnel-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px solid var(--border);
}

.pl-funnel-row-num {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  width: 32px;
  text-align: right;
  flex-shrink: 0;
}

.pl-funnel-row-lbl {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  width: 76px;
  flex-shrink: 0;
}

.pl-funnel-bar-wrap {
  flex: 1;
  height: 4px;
  background: var(--bg-raised);
  border-radius: 2px;
  overflow: hidden;
}

.pl-funnel-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  min-width: 0;
}

.pl-funnel-bar--sold {
  background: var(--green);
}

.pl-funnel-row-pct {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
  width: 30px;
  text-align: right;
  flex-shrink: 0;
}

.pl-green { color: var(--green) !important; }

.pl-toggle {
  display: flex;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
  margin-left: 12px;
}

.pl-toggle-btn {
  padding: 5px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: all 150ms;
  font-family: var(--font);
  white-space: nowrap;
}

.pl-toggle-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}

.pl-lifecycle { display: flex; flex-direction: column; gap: 2px; }
.pl-lifecycle-pct { font-size: 14px; font-weight: 700; line-height: 1; }
.pl-lifecycle-label { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.sort-arrow-active { color: var(--accent); }

.pl-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: 0;
  flex-wrap: wrap;
}

.pl-stage-pills {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.pl-pill {
  padding: 5px 14px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 150ms;
  white-space: nowrap;
  font-family: var(--font);
}

.pl-pill:hover {
  color: var(--text-primary);
  background: var(--bg-raised);
}

.pl-pill.active {
  background: var(--accent-muted);
  border-color: rgba(32,128,141,0.3);
  color: var(--accent-light);
  font-weight: 600;
}

.pl-filters {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.pl-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px 28px 6px 10px;
  font-size: var(--text-sm);
  font-family: var(--font);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color var(--transition);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 5L6 8L9 5' stroke='%236b6f80' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.pl-select:focus { border-color: var(--border-strong); outline: none; }

.pl-search {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  font-size: var(--text-sm);
  font-family: var(--font);
  color: var(--text-primary);
  width: 200px;
  transition: border-color var(--transition);
}

.pl-search::placeholder { color: var(--text-faint); }
.pl-search:focus { border-color: var(--border-strong); outline: none; }

.pl-filter-select {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px 28px 6px 10px;
  font-size: var(--text-sm);
  font-family: var(--font);
  color: var(--text-secondary);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  transition: border-color var(--transition);
}
.pl-filter-select:focus { border-color: var(--border-strong); outline: none; }

.pl-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.pl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-base);
  table-layout: fixed;
}

.pl-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

.pl-table th {
  background: var(--bg-raised);
  padding: 10px var(--space-4);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-strong);
}

.pl-table td {
  padding: 12px var(--space-4);
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
  overflow: hidden;
}

.pl-table tbody tr { transition: background var(--transition); }
.pl-table tbody tr:hover { background: var(--bg-hover); }
.pl-table tbody tr:last-child td { border-bottom: none; }

.pl-empty {
  text-align: center;
  padding: 32px !important;
  color: var(--text-faint);
  font-size: 13px;
}

.pl-name-cell { display: flex; flex-direction: column; gap: 2px; }
.pl-athlete-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.pl-parent-name { font-size: 12px; color: var(--text-muted); }

@media (max-width: 768px) {
  /* Source cards: single column */
  .pl-source-cards { grid-template-columns: 1fr; }

  /* View header: stack title + toggle on mobile */
  #view-pipeline .view-header {
    flex-wrap: wrap;
    gap: 8px;
  }
  #view-pipeline .view-header h1 {
    flex: 1 1 auto;
  }
  #view-pipeline .view-header .pl-toggle {
    margin-left: 0;
  }
  #view-pipeline .view-header [style*="margin-left:auto"] {
    flex: 1 1 100%;
    margin-left: 0 !important;
    font-size: 11px;
    color: var(--text-muted);
  }

  /* Stage pills: scroll horizontally, don't wrap */
  .pl-stage-pills {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    max-width: 100%;
    padding-bottom: 2px;
  }
  .pl-stage-pills::-webkit-scrollbar { display: none; }

  /* Filters: stack vertically, full width */
  .pl-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .pl-filters {
    flex-wrap: wrap;
    gap: 8px;
  }
  .pl-filter-select {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    font-size: 14px;
  }
  .pl-search {
    flex: 1 1 100%;
    width: 100%;
  }
}

@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; transform-origin: center; }

.wr-inline-edit {
  outline: none;
  border-bottom: 1px dashed transparent;
  transition: border-color 0.15s;
  min-width: 40px;
  display: inline-block;
}
.wr-inline-edit:hover { border-bottom-color: var(--border-strong); }
.wr-inline-edit:focus { border-bottom-color: var(--accent); }
.wr-inline-edit:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  pointer-events: none;
}

/* ─── Ads Performance ────────────────────────────────────────────── */
.ads-tab-group {
  display: flex;
  gap: 3px;
  background: var(--bg-raised);
  border-radius: 8px;
  padding: 3px;
}
.ads-tab {
  background: none;
  border: none;
  padding: 5px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.ads-tab.active {
  background: var(--bg-overlay);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.ads-tab:hover:not(.active) { color: var(--text-secondary); }
.ads-cpl-lock {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  margin-top: 4px;
  text-transform: uppercase;
  cursor: default;
}
.ads-chart-lock {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-surface);
  border-radius: 4px;
}
.ads-chart-lock.visible {
  display: flex;
}
.ads-chart-lock-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.ads-chart-lock-hint {
  font-size: 11px;
  color: var(--text-faint);
  font-family: var(--font-mono);
}
.ads-stat-value--faint { color: var(--text-faint) !important; }
.ads-stat-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
}
.ads-stat {
  display: flex;
  flex-direction: column;
  padding: 20px 22px;
  border-right: 1px solid var(--border);
  gap: 3px;
}
.ads-stat:last-child { border-right: none; }
.ads-stat-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-bottom: 6px;
  flex-shrink: 0;
}
.ads-stat-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  text-transform: uppercase;
}
.ads-stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 2px 0 1px;
}
.ads-stat-value--hl { color: var(--accent); }
.ads-stat-sub {
  font-size: 12px;
  color: var(--text-faint);
  font-family: var(--font-mono);
}
.ads-charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.ads-bottom-row {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.ads-chart-canvas-wrap {
  position: relative;
  height: 260px;
}
.ads-donut-wrap {
  position: relative;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ads-donut-legend { margin-top: 10px; }
.ads-donut-legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
}
.ads-donut-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ads-donut-name {
  font-size: 12px;
  color: var(--text-secondary);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ads-donut-val {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-primary);
  flex-shrink: 0;
}
.ads-footnote {
  font-size: 11px;
  color: var(--text-faint);
  padding: 10px 16px 4px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
  font-family: var(--font-mono);
}

/* ── Action card ────────────────────────────────────── */
.ads-action-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.ads-action-item:last-child { border-bottom: none; padding-bottom: 0; }
.ads-action-item:first-child { padding-top: 0; }
.ads-action-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  flex-shrink: 0;
  margin-top: 2px;
  min-width: 60px;
  text-align: center;
}
.ads-action-badge--scale  { background: rgba(34,197,94,0.15);  color: #22c55e; }
.ads-action-badge--pause  { background: rgba(239,68,68,0.12);  color: #ef4444; }
.ads-action-badge--watch  { background: rgba(245,158,11,0.12); color: #f59e0b; }
.ads-action-badge--unlock { background: rgba(139,92,246,0.12); color: #8b5cf6; }
.ads-action-badge--info   { background: rgba(59,130,246,0.12); color: #3b82f6; }
.ads-action-body { flex: 1; min-width: 0; }
.ads-action-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 4px;
  line-height: 1.3;
}
.ads-action-sub {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0;
}
.ads-action-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 3px;
}
.ads-adset-winner td:first-child::before {
  content: "BEST";
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #22c55e;
  background: rgba(34,197,94,0.12);
  border-radius: 3px;
  padding: 1px 5px;
  margin-right: 7px;
  vertical-align: middle;
}

/* Keep tab group pinned right on all screen sizes */
#view-ads-performance .view-header {
  flex-wrap: nowrap;
  align-items: center;
}
#view-ads-performance .view-header > div:first-child {
  flex: 1 1 0;
  min-width: 0;
}
#view-ads-performance .view-header #adsViewSubtitle {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ads-tab-group { flex-shrink: 0; }

@media (max-width: 600px) {
  #view-ads-performance .view-header {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
  }
  #view-ads-performance .view-header #adsViewSubtitle {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }

  .ads-stat-row {
    grid-template-columns: repeat(3, 1fr);
  }
  .ads-stat {
    padding: 14px 12px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
  }
  .ads-stat:nth-child(3n)      { border-right: none; }
  .ads-stat:nth-last-child(-n+3) { border-bottom: none; }
  .ads-stat:last-child         { border-right: none; border-bottom: none; }
  .ads-stat-value              { font-size: 20px; }
  .ads-stat-sub                { font-size: 11px; }

  .ads-charts-row { grid-template-columns: 1fr; }
  .ads-bottom-row { grid-template-columns: 1fr; }

  .pb-header { flex-wrap: wrap; row-gap: 2px; }
  .pb-date   { margin-left: 0; width: 100%; }
  .pb-item   { font-size: 12px; }
}

/* ─── CALENDAR VIEW ──────────────────────────────────────────────────────── */
.cal-wrap {
  max-width: 780px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-6) 120px;
}

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}

.cal-month-label {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.cal-nav-btn {
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 5px 9px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  transition: all 0.12s;
}
.cal-nav-btn:hover { color: var(--text-primary); border-color: var(--border-strong); background: var(--bg-hover); }

.cal-grid-wrap {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.cal-dow-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--border-strong);
  background: var(--bg-raised);
}
.cal-dow {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 8px 0;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.cal-cell {
  min-height: 64px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 6px 6px 4px;
  cursor: pointer;
  transition: background 0.1s;
  position: relative;
  overflow: hidden;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell:hover { background: var(--bg-hover); }
.cal-cell--empty { background: var(--bg-raised); cursor: default; }
.cal-cell--empty:hover { background: var(--bg-raised); }

.cal-cell--today .cal-day-num {
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cal-cell--selected { background: var(--accent-muted); }
.cal-cell--selected:hover { background: var(--accent-muted); }
.cal-cell--selected .cal-day-num { color: var(--accent); font-weight: 600; }
.cal-cell--today.cal-cell--selected .cal-day-num { color: #fff; }

.cal-day-num {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  margin-bottom: 3px;
}

.cal-appt-dots { display: none; }
.cal-dot-more { display: none; }

.cal-appt-chip {
  display: block;
  font-size: 10px;
  font-weight: 500;
  color: #fff;
  background: var(--accent);
  border-radius: 3px;
  padding: 2px 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
  line-height: 1.4;
}

.cal-day-panel {
  margin-top: var(--space-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.cal-day-panel-header { display: none; }
.cal-day-appts { padding: 0; }

.cal-day-empty {
  padding: 24px 20px;
  font-size: 13px;
  color: var(--text-muted);
}

.cal-appt-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.cal-appt-row:last-child { border-bottom: none; }
.cal-appt-row:hover { background: var(--bg-hover); }

.cal-appt-time {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  min-width: 88px;
  padding-top: 2px;
  font-variant-numeric: tabular-nums;
}

.cal-appt-info { flex: 1; min-width: 0; }
.cal-appt-name { font-size: 14px; font-weight: 600; color: var(--text-primary); line-height: 1.3; }
.cal-appt-athlete { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.cal-appt-phone { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.cal-appt-notes { font-size: 12px; color: var(--text-muted); margin-top: 4px; font-style: italic; }

.cal-appt-badges { display: flex; flex-direction: column; gap: 3px; align-items: flex-end; padding-top: 2px; }
.cal-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  white-space: nowrap;
}
.cal-badge--sent { background: var(--green-muted); color: var(--green); }
.cal-badge--pending { background: var(--bg-overlay); color: var(--text-muted); }

.cal-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.cal-col { border-right: 1px solid var(--border-strong); }
.cal-col:last-child { border-right: none; }

.cal-col-header {
  padding: 14px 20px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-raised);
}
.cal-col-dow {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.cal-col-date {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

@media (max-width: 768px) {
  .cal-wrap { padding: var(--space-3) var(--space-3) 100px; }
  .cal-cell { min-height: 48px; padding: 4px; }
  .cal-month-label { font-size: var(--text-lg); }
  .cal-appt-chip { font-size: 9px; padding: 1px 4px; }

  .cal-col-header { padding: 10px 10px 8px; }
  .cal-col-dow { font-size: 9px; }
  .cal-col-date { font-size: 14px; }

  .cal-appt-row { padding: 10px 10px; gap: 6px; flex-wrap: wrap; }
  .cal-appt-time { font-size: 11px; min-width: unset; width: 100%; padding-top: 0; margin-bottom: 1px; }
  .cal-appt-name { font-size: 13px; }
  .cal-appt-athlete { font-size: 11px; }
  .cal-appt-badges { flex-direction: row; gap: 4px; padding-top: 0; width: 100%; }
  .cal-badge { font-size: 9px; padding: 1px 6px; }
  .cal-day-empty { padding: 16px 10px; font-size: 12px; }
}

/* Inline info tooltip (e.g. Monthly Performance metric definitions).
   The floating bubble is appended to <body> as #dka-tooltip (position:fixed) so
   it escapes any overflow:auto table wrapper that would otherwise clip it. */
.dka-tip { display: inline-block; color: var(--text-faint); cursor: help; font-size: 11px; line-height: 1; }
.dka-tip:hover { color: var(--text-secondary); }
#dka-tooltip {
  position: fixed;
  z-index: 4000;
  max-width: 240px;
  white-space: normal;
  background: var(--bg-overlay);
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
  padding: 7px 9px;
  border-radius: var(--radius-md);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.4;
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -100%);
  transition: opacity 0.08s ease;
}
#dka-tooltip.show { opacity: 1; }

/* Compact dashboard tables (Monthly Performance, Sold Leaderboard) on mobile. */
@media (max-width: 767px) {
  /* Sold Leaderboard fits its card (2 columns) — opt out of the wide min-width. */
  .dash-leaderboard-table { min-width: 0 !important; table-layout: fixed !important; font-size: 12px; }
  /* Monthly Performance keeps horizontal scroll (like Performance by Source) but
     at a width that shows the metric column + the first month before scrolling —
     not the full 720px the generic data tables use. */
  .dash-monthly-table { min-width: 460px !important; font-size: 12px; }
  .dash-monthly-table th, .dash-monthly-table td { padding: 8px 10px; }
  /* Stack dashboard 2-col rows full-width so they line up with the pipeline
     brief instead of overflowing via their desktop min-width. */
  .dash-row-2col > .card { min-width: 0 !important; flex-basis: 100% !important; }
}

/* ── Appointment-modal date field (flatpickr) ───────────────────────────────
   Custom picker instead of the native <input type=date> so the field + calendar
   render identically on desktop and iPhone — mm/dd/yyyy field, calendar icon,
   and Clear/Today buttons we control. The visible field is flatpickr's altInput,
   which carries the .ci-appt-date class. */
.ci-appt-date {
  width: 100%;
  padding: 9px 34px 9px 10px;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  font-size: 14px;
  color: #1a1a1a;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E") no-repeat right 10px center;
  background-size: 16px 16px;
  outline: none;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.ci-appt-date::placeholder { color: #757575; }

/* Calendar popup themed close to Chrome's native date popup */
.flatpickr-calendar { border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.18); border: none; }
/* Compact sizing — flatpickr's default day grid (~308px) is wider than the modal's
   content on a phone and spills past the edges. Shrink it to fit. */
.flatpickr-calendar,
.flatpickr-days,
.flatpickr-calendar .dayContainer {
  width: 266px !important;
  min-width: 266px !important;
  max-width: 266px !important;
}
.flatpickr-rContainer { width: 266px; }
.flatpickr-day { height: 36px; line-height: 36px; }
.flatpickr-weekday { font-size: 11px; }
.flatpickr-current-month { font-size: 15px; padding-top: 4px; }
.flatpickr-day.today { border-color: #2563eb; }
.flatpickr-day.selected,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange,
.flatpickr-day.endRange { background: #2563eb; border-color: #2563eb; color: #fff; }
.flatpickr-day:hover { background: #eef2ff; }
.flatpickr-months .flatpickr-month,
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year { color: #1a1a1a; font-weight: 600; }

/* Clear / Today footer buttons we inject into the calendar */
.ci-fp-actions { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px 10px; border-top: 1px solid #eee; }
.ci-fp-actions button { background: none; border: none; color: #2563eb; font-size: 13px; font-weight: 600; cursor: pointer; padding: 4px 6px; }
.ci-fp-actions button:active { opacity: .6; }

/* ============================================================
   ACTIVITY — sidebar bell panel (desktop) / Activity tab (mobile)
   ============================================================ */
.nav-item.active-panel { background: var(--accent-muted); color: var(--accent-light); }
.act-badge:not(:empty) { background: var(--red); border-color: transparent; color: #fff; }

.act-panel {
  position: fixed;
  top: 12px;
  bottom: 12px;
  left: calc(var(--sidebar-width) + 8px);
  width: 420px;
  max-width: calc(100vw - var(--sidebar-width) - 24px);
  z-index: 900;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.08);
  overflow: hidden;
}
.act-panel[hidden], .act-backdrop[hidden] { display: none !important; }
.act-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 10px 14px;
  border-bottom: 1px solid var(--border);
}
.act-title { display: none; margin: 0; font-size: 28px; font-weight: 700; color: var(--text-primary); }
.act-tabs { display: flex; gap: 4px; flex: 1; min-width: 0; }
.act-tab {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: 0;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  white-space: nowrap;
}
.act-tab.active { color: var(--text-primary); background: var(--bg-raised); }
.act-tab-count:not(:empty) {
  margin-left: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--amber-muted);
  color: var(--amber);
}
.act-tab:focus-visible, .act-btn:focus-visible, .act-item.linked:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.act-menu-wrap { position: relative; margin-left: auto; }
.act-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
/* Filled only while its menu is open. Hover styling only where there's a real pointer —
   on touch screens :hover sticks after a tap and made the button look pressed at rest. */
.act-icon-btn[aria-expanded="true"] { color: var(--text-primary); background: var(--bg-raised); border-color: var(--border-strong); }
@media (hover: hover) { .act-icon-btn:hover { color: var(--text-primary); border-color: var(--border-strong); } }
.act-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 5;
  min-width: 210px;
  padding: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.16);
  display: flex;
  flex-direction: column;
}
.act-menu[hidden] { display: none; }
.act-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  font: inherit;
  font-size: 14px;
  text-align: left;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--text-primary);
  cursor: pointer;
}
.act-menu-item:disabled { color: var(--text-faint); cursor: default; }
.act-menu-item.danger { color: var(--red); }
.act-icon-btn:focus-visible, .act-menu-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.act-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain; /* scrolling the list never drags the page behind it */
  display: flex;
  flex-direction: column;
}
/* Taps fire immediately (same fix as the Conversations chips) — no pause to check for zoom/scroll. */
.act-panel, .act-panel button, .act-item { touch-action: manipulation; }
.act-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
}
.act-item.linked { cursor: pointer; }
.act-ico {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.act-ico.tone-amber { background: var(--amber-muted); color: var(--amber); }
.act-ico.tone-green { background: var(--green-muted); color: var(--green); }
.act-ico.tone-red   { background: var(--red-muted); color: var(--red); }
.act-ico.tone-blue  { background: var(--blue-muted); color: var(--blue); }
.act-ico.tone-muted { background: var(--bg-raised); color: var(--text-muted); }
.act-ico.tone-purple { background: var(--purple-muted); color: var(--purple); }
.act-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.act-row1 { display: flex; align-items: baseline; gap: 8px; }
.act-name { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act-time { flex-shrink: 0; font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.act-dot { flex-shrink: 0; align-self: center; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.act-line {
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.act-kind { font-weight: 600; }
.act-kind.tone-amber { color: var(--amber); }
.act-kind.tone-green { color: var(--green); }
.act-kind.tone-red   { color: var(--red); }
.act-kind.tone-blue  { color: var(--blue); }
.act-kind.tone-muted { color: var(--text-muted); }
.act-kind.tone-purple { color: var(--purple); }
.act-sub { font-size: 12.5px; color: var(--text-muted); overflow-wrap: anywhere; }
.act-actions { display: flex; gap: 8px; margin-top: 8px; }
.act-btn {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
}
.act-btn:disabled { opacity: 0.6; cursor: default; }
.act-outcome { font-size: 12px; font-weight: 600; color: var(--green); background: var(--green-muted); border-radius: 6px; padding: 2px 8px; }
/* Showed and Sold stay green; a no-show must not read as a good outcome at a glance. */
.act-outcome--noshow { color: var(--red); background: var(--red-muted); }
.act-outcome--lost { color: var(--text-muted); background: rgba(127,127,127,0.12); }

.act-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  padding: 48px 24px;
  color: var(--text-faint);
}
.act-empty-title { margin: 8px 0 0; font-size: 17px; font-weight: 600; color: var(--text-primary); }
.act-empty-sub { margin: 0; font-size: 14px; color: var(--text-muted); max-width: 30ch; }

.act-backdrop { position: fixed; inset: 0; z-index: 899; background: transparent; }

@media (max-width: 768px) {
  .act-panel {
    top: 0;
    left: 0;
    right: 0;
    bottom: calc(70px + env(safe-area-inset-bottom));
    width: auto;
    max-width: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding-top: env(safe-area-inset-top);
    z-index: 9000;
  }
  .act-head { flex-wrap: wrap; padding: 16px 16px 10px; border-bottom: 0; }
  .act-title { display: block; flex: 1 0 auto; }
  .act-menu-wrap { order: 0; }
  .act-icon-btn { width: 40px; height: 40px; }
  .act-tabs { order: 1; flex-basis: 100%; }
  .act-tab { font-size: 14px; padding: 8px 12px; }
  .act-item { padding: 14px 16px; }
  .act-name { font-size: 16px; }
  .act-line { font-size: 15px; }
  .act-btn { padding: 9px 18px; font-size: 14px; }
  .bottom-nav-item { min-width: 0; flex: 1; padding: 8px 4px; }
}

/* Activity hover states — pointer devices only (on touch screens :hover sticks after a tap). */
@media (hover: hover) {
  .act-tab:hover { color: var(--text-primary); background: var(--bg-hover); }
  .act-item.linked:hover { background: var(--bg-hover); }
  .act-btn:hover:not(:disabled) { background: var(--bg-hover); }
  .act-menu-item:hover:not(:disabled) { background: var(--bg-hover); }
}
/* Touch feedback instead: a brief press state. */
.act-item.linked:active, .act-btn:active:not(:disabled), .act-menu-item:active:not(:disabled) { background: var(--bg-raised); }

/* Athlete drawer notes thread (Quo-style): "Notes N", author · time · text, composer at the bottom.
   The panel reuses .athlete-drawer-actions' slot, so its divider/padding are overridden to line up with the fields. */
.athlete-drawer-actions.sa-notes-panel { border-top: none; margin-top: 8px; padding: 20px 20px 28px; }
.sa-notes-panel { display: flex; flex-direction: column; gap: 16px; }
.sa-notes-head { font-size: 13px; color: var(--text-muted); }
.sa-notes-head span { margin-left: 6px; }
.sa-notes-list { display: flex; flex-direction: column; gap: 18px; }
.sa-notes-list:empty { display: none; }
.sa-notes-empty { font-size: 13px; color: var(--text-faint); }
.sa-note { display: flex; gap: 12px; align-items: flex-start; }
.sa-note-avatar { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 600; background: #3f4a55; color: #fff; }
.sa-note--legacy .sa-note-avatar { background: var(--bg-raised, rgba(127,127,127,0.15)); color: var(--text-muted); }
.sa-note-main { flex: 1; min-width: 0; padding-top: 1px; }
.sa-note-meta { display: flex; align-items: baseline; gap: 8px; }
.sa-note-author { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.sa-note-time { font-size: 12px; color: var(--text-muted); }
.sa-note-del { margin-left: auto; border: none; background: none; color: var(--text-faint); font-size: 16px; line-height: 1; cursor: pointer; padding: 0 2px; opacity: 0; transition: opacity .15s; }
.sa-note:hover .sa-note-del, .sa-note-del:focus { opacity: 1; }
@media (hover: none) { .sa-note-del { opacity: 1; } }
.sa-note-body { font-size: 14px; line-height: 1.45; color: var(--text-primary); white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
.sa-note-compose { display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--border-strong, var(--border)); border-radius: 12px; padding: 14px 12px 10px 16px; background: var(--bg-surface, transparent); transition: border-color .15s, box-shadow .15s; }
.sa-note-compose:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(32,128,141,0.15); }
.sa-note-compose textarea { width: 100%; border: none; outline: none; resize: none; background: transparent; color: var(--text-primary); font: inherit; font-size: 14px; line-height: 1.45; min-height: 22px; max-height: 160px; padding: 0; }
.sa-note-compose-bar { display: flex; justify-content: flex-end; }
.sa-note-post { width: 28px; height: 28px; border-radius: 50%; border: none; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; background: var(--accent); color: #fff; cursor: pointer; }
.sa-note-post:disabled { background: var(--bg-raised, rgba(127,127,127,0.2)); color: var(--text-faint); cursor: default; }

/* ── Leads (was Athlete List): two-pane layout only — rows reuse the table's own classes ── */
.cal-view-title { display: none; margin: 0 0 12px; font-size: 28px; font-weight: 700; color: var(--text-primary); } /* = .act-title; phone only (max-width: 900px block below) */
.leads-split { display: grid; grid-template-columns: minmax(360px, 460px) 1fr; gap: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; height: calc(100vh - 260px); min-height: 420px; background: var(--bg-surface); } /* one surface for list + detail (the list sat on the grey page) */
.leads-rows-col { overflow-y: auto; border-right: 1px solid var(--border); min-height: 0; padding: 6px 0; }

.leads-rows .leads-empty { padding: 24px; text-align: center; color: var(--text-faint); font-size: 13px; }
.leads-detail { position: relative; min-height: 0; overflow: hidden; }
.leads-detail-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--text-faint); font-size: 13px; }
/* The athlete drawer, docked into the right pane instead of sliding over the page */
.athlete-drawer.athlete-drawer--docked { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.athlete-drawer--docked.open { pointer-events: all; }
.athlete-drawer--docked .athlete-drawer-overlay { display: none; }
.athlete-drawer--docked .athlete-drawer-panel { width: 100%; border-left: 0; transform: none; transition: none; visibility: hidden; }
.athlete-drawer--docked.open .athlete-drawer-panel { visibility: visible; }
.athlete-drawer--docked .athlete-drawer-close { display: none; }
/* Leads panes: scrollbar hidden until the pointer is over the pane (the global ::-webkit-scrollbar rule
   otherwise keeps it always visible) */
.leads-rows-col::-webkit-scrollbar-thumb, .athlete-drawer--docked .athlete-drawer-panel::-webkit-scrollbar-thumb { background: transparent; }
.leads-rows-col:hover::-webkit-scrollbar-thumb, .athlete-drawer--docked .athlete-drawer-panel:hover::-webkit-scrollbar-thumb { background: var(--bg-overlay); }
/* Desktop: the split fills the rest of the window and only the two panes scroll — the page itself
   doesn't, so the bottom of the panes is never hidden under the fold */
@media (min-width: 901px) {
  .content:has(#view-prospects.active) { display: flex; flex-direction: column; overflow: hidden; }
  #view-prospects.active { display: flex; flex-direction: column; flex: 1; min-height: 0; }
  #view-prospects.active .leads-split { flex: 1; height: auto; min-height: 0; }
}
@media (max-width: 900px) {
  .leads-split { grid-template-columns: 1fr; height: auto; min-height: 0; }
  /* Phone: no pipeline strip on Leads or Calendar — the screen starts at the top (desktop keeps it) */
  .main-area:has(#view-prospects.active) #pipelineStripHeader,
  .main-area:has(#view-calendar.active) #pipelineStripHeader { display: none; }
  .cal-view-title { display: block; }
  .leads-rows-col { border-right: 0; overflow: visible; }
  .leads-detail { display: none; }
}
