/* ═══════════════════════════════════════════════════════════
   Department Views — dept- prefix
   Shared styling for all 16 department-specific pages.
   ═══════════════════════════════════════════════════════════ */

/* ── Page Header ─────────────────────────────────────────── */
.dept-header {
  padding: 28px 32px 8px;
}
.dept-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.dept-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dept-icon svg { width: 22px; height: 22px; color: #fff; }
.dept-icon.sales { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.dept-icon.marketing { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.dept-icon.cs { background: linear-gradient(135deg, #10b981, #059669); }
.dept-icon.events { background: linear-gradient(135deg, #f59e0b, #d97706); }
.dept-icon.content { background: linear-gradient(135deg, #ec4899, #db2777); }
.dept-icon.digital { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.dept-icon.editorial { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.dept-icon.subs { background: linear-gradient(135deg, #14b8a6, #0d9488); }
.dept-icon.executive { background: linear-gradient(135deg, #1e293b, #0f172a); }
.dept-icon.revops { background: linear-gradient(135deg, #0ea5e9, #0284c7); }
.dept-icon.navigator { background: linear-gradient(135deg, #f97316, #ea580c); }
.dept-icon.finance { background: linear-gradient(135deg, #22c55e, #16a34a); }
.dept-icon.programs { background: linear-gradient(135deg, #a855f7, #9333ea); }
.dept-icon.design { background: linear-gradient(135deg, #e879f9, #c026d3); }
.dept-icon.engineering { background: linear-gradient(135deg, #64748b, #475569); }
.dept-icon.people { background: linear-gradient(135deg, #fb923c, #ea580c); }
.dept-icon.product { background: linear-gradient(135deg, #2dd4bf, #14b8a6); }
.dept-icon.audience { background: linear-gradient(135deg, #06b6d4, #0891b2); }

.dept-title {
  font-size: var(--font-3xl, 1.875rem);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.dept-subtitle {
  font-size: var(--font-sm, 0.875rem);
  color: var(--text-muted);
  margin-top: 4px;
  padding-left: 52px;
  font-style: italic;
}
.dept-refresh-btn {
  margin-left: auto;
  padding: 6px 14px;
  font-size: var(--font-xs, 0.75rem);
  border: 1px solid var(--border);
  border-radius: var(--radius, 6px);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition, 0.15s ease);
  display: flex;
  align-items: center;
  gap: 6px;
}
.dept-refresh-btn:hover { border-color: var(--accent); color: var(--accent); }
.dept-refresh-btn svg { width: 14px; height: 14px; }

/* ── KPI Strip ───────────────────────────────────────────── */
.dept-kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  padding: 16px 32px;
}
.dept-kpi {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius, 6px);
  padding: 18px 20px;
  transition: var(--transition, 0.15s ease);
  position: relative;
  overflow: hidden;
}
.dept-kpi::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  opacity: 0;
  transition: opacity 0.2s;
}
.dept-kpi:hover { border-color: var(--border-light); transform: translateY(-1px); }
.dept-kpi:hover::before { opacity: 1; }
.dept-kpi.accent-blue::before { background: #3b82f6; }
.dept-kpi.accent-green::before { background: #10b981; }
.dept-kpi.accent-purple::before { background: #8b5cf6; }
.dept-kpi.accent-amber::before { background: #f59e0b; }
.dept-kpi.accent-rose::before { background: #f43f5e; }
.dept-kpi.accent-cyan::before { background: #06b6d4; }

.dept-kpi-label {
  font-size: var(--font-2xs, 0.625rem);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
  font-weight: 600;
}
.dept-kpi-value {
  font-size: var(--font-2xl, 1.5rem);
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-primary);
}
.dept-kpi-value.loading {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--border) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: dept-shimmer 1.5s infinite;
  border-radius: 4px;
  color: transparent;
  user-select: none;
}
@keyframes dept-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.dept-kpi-delta {
  font-size: var(--font-xs, 0.75rem);
  margin-top: 4px;
  font-weight: 500;
}
.dept-kpi-delta.up { color: #10b981; }
.dept-kpi-delta.down { color: #f43f5e; }
.dept-kpi-delta.neutral { color: var(--text-muted); }
.dept-kpi-note {
  font-size: var(--font-2xs, 0.625rem);
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Tab Bar ─────────────────────────────────────────────── */
.dept-tabs {
  display: flex;
  gap: 0;
  padding: 0 32px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.dept-tab {
  padding: 12px 20px;
  font-size: var(--font-sm, 0.875rem);
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition, 0.15s ease);
  white-space: nowrap;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}
.dept-tab:hover { color: var(--text-primary); }
.dept-tab.active {
  color: var(--accent, #3b82f6);
  border-bottom-color: var(--accent, #3b82f6);
  font-weight: 600;
}

/* ── Tab Content ─────────────────────────────────────────── */
.dept-content {
  padding: 24px 32px;
}
.dept-panel { display: none; }
.dept-panel.active { display: block; }

/* ── Section Cards ───────────────────────────────────────── */
.dept-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius, 6px);
  margin-bottom: 16px;
  overflow: hidden;
}
.dept-section-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.dept-section-title {
  font-size: var(--font-base, 1rem);
  font-weight: 600;
  color: var(--text-primary);
}
.dept-section-badge {
  font-size: var(--font-2xs, 0.625rem);
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.dept-section-badge.live { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.dept-section-badge.ml { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; }
.dept-section-badge.ai { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.dept-section-body { padding: 20px; }

/* ── Data Table ──────────────────────────────────────────── */
.dept-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.dept-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-sm, 0.875rem);
}
.dept-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: var(--font-2xs, 0.625rem);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.dept-table th:hover { color: var(--text-primary); }
.dept-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.03));
  color: var(--text-secondary);
  vertical-align: middle;
}
.dept-table tr:hover td {
  background: var(--bg-hover, rgba(255,255,255,0.02));
}
.dept-table .mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--font-xs, 0.75rem);
}
.dept-table .text-right { text-align: right; }
.dept-table .text-center { text-align: center; }

/* ── Status Badges ───────────────────────────────────────── */
.dept-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: var(--font-2xs, 0.625rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.dept-badge.green { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.dept-badge.amber { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.dept-badge.red { background: rgba(244, 63, 94, 0.15); color: #f43f5e; }
.dept-badge.blue { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.dept-badge.purple { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; }
.dept-badge.gray { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }

/* ── Metric Bars ─────────────────────────────────────────── */
.dept-bar-track {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}
.dept-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.dept-bar-fill.blue { background: #3b82f6; }
.dept-bar-fill.green { background: #10b981; }
.dept-bar-fill.amber { background: #f59e0b; }
.dept-bar-fill.purple { background: #8b5cf6; }
.dept-bar-fill.rose { background: #f43f5e; }
.dept-bar-fill.cyan { background: #06b6d4; }

/* ── Insight Cards ───────────────────────────────────────── */
.dept-insight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.dept-insight {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius, 6px);
  padding: 18px;
  transition: var(--transition, 0.15s ease);
}
.dept-insight:hover { border-color: var(--border-light); }
.dept-insight-label {
  font-size: var(--font-2xs, 0.625rem);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 600;
}
.dept-insight-value {
  font-size: var(--font-xl, 1.25rem);
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}
.dept-insight-detail {
  font-size: var(--font-xs, 0.75rem);
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.5;
}

/* ── Value Proposition Banner ────────────────────────────── */
.dept-value-banner {
  margin: 0 32px 16px;
  padding: 20px 24px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(139, 92, 246, 0.08));
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-radius: var(--radius, 6px);
  display: flex;
  align-items: center;
  gap: 16px;
}
.dept-value-banner.sales { background: linear-gradient(135deg, rgba(59,130,246,0.08), rgba(37,99,235,0.04)); border-color: rgba(59,130,246,0.15); }
.dept-value-banner.marketing { background: linear-gradient(135deg, rgba(139,92,246,0.08), rgba(124,58,237,0.04)); border-color: rgba(139,92,246,0.15); }
.dept-value-banner.cs { background: linear-gradient(135deg, rgba(16,185,129,0.08), rgba(5,150,105,0.04)); border-color: rgba(16,185,129,0.15); }
.dept-value-banner.events { background: linear-gradient(135deg, rgba(245,158,11,0.08), rgba(217,119,6,0.04)); border-color: rgba(245,158,11,0.15); }
.dept-value-banner.content { background: linear-gradient(135deg, rgba(236,72,153,0.08), rgba(219,39,119,0.04)); border-color: rgba(236,72,153,0.15); }
.dept-value-banner.digital { background: linear-gradient(135deg, rgba(6,182,212,0.08), rgba(8,145,178,0.04)); border-color: rgba(6,182,212,0.15); }
.dept-value-banner.editorial { background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(79,70,229,0.04)); border-color: rgba(99,102,241,0.15); }
.dept-value-banner.subs { background: linear-gradient(135deg, rgba(20,184,166,0.08), rgba(13,148,136,0.04)); border-color: rgba(20,184,166,0.15); }
.dept-value-banner.executive { background: linear-gradient(135deg, rgba(30,41,59,0.12), rgba(15,23,42,0.06)); border-color: rgba(100,116,139,0.2); }
.dept-value-banner.revops { background: linear-gradient(135deg, rgba(14,165,233,0.08), rgba(2,132,199,0.04)); border-color: rgba(14,165,233,0.15); }
.dept-value-banner.navigator { background: linear-gradient(135deg, rgba(249,115,22,0.08), rgba(234,88,12,0.04)); border-color: rgba(249,115,22,0.15); }
.dept-value-banner.finance { background: linear-gradient(135deg, rgba(34,197,94,0.08), rgba(22,163,74,0.04)); border-color: rgba(34,197,94,0.15); }
.dept-value-banner.programs { background: linear-gradient(135deg, rgba(168,85,247,0.08), rgba(147,51,234,0.04)); border-color: rgba(168,85,247,0.15); }
.dept-value-banner.design { background: linear-gradient(135deg, rgba(232,121,249,0.08), rgba(192,38,211,0.04)); border-color: rgba(232,121,249,0.15); }
.dept-value-banner.engineering { background: linear-gradient(135deg, rgba(100,116,139,0.08), rgba(71,85,105,0.04)); border-color: rgba(100,116,139,0.15); }
.dept-value-banner.people { background: linear-gradient(135deg, rgba(251,146,60,0.08), rgba(234,88,12,0.04)); border-color: rgba(251,146,60,0.15); }
.dept-value-banner.product { background: linear-gradient(135deg, rgba(45,212,191,0.08), rgba(20,184,166,0.04)); border-color: rgba(45,212,191,0.15); }
.dept-value-banner.audience { background: linear-gradient(135deg, rgba(6,182,212,0.08), rgba(8,145,178,0.04)); border-color: rgba(6,182,212,0.15); }

.dept-value-text {
  font-size: var(--font-sm, 0.875rem);
  color: var(--text-secondary);
  line-height: 1.6;
}
.dept-value-text strong { color: var(--text-primary); font-weight: 600; }

/* ── Empty / Loading States ──────────────────────────────── */
.dept-loading {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.dept-loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent, #3b82f6);
  border-radius: 50%;
  animation: dept-spin 0.8s linear infinite;
  margin: 0 auto 12px;
}
@keyframes dept-spin { to { transform: rotate(360deg); } }
.dept-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
  font-size: var(--font-sm, 0.875rem);
}

/* ── Donut / Pie Viz ─────────────────────────────────────── */
.dept-donut-row {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
}
.dept-donut-legend {
  flex: 1;
  min-width: 200px;
}
.dept-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: var(--font-sm, 0.875rem);
}
.dept-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}
.dept-legend-label { flex: 1; color: var(--text-secondary); }
.dept-legend-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--font-xs, 0.75rem);
  color: var(--text-primary);
  font-weight: 600;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .dept-header { padding: 20px 16px 8px; }
  .dept-subtitle { padding-left: 0; margin-top: 8px; }
  .dept-kpi-strip { padding: 12px 16px; grid-template-columns: repeat(2, 1fr); }
  .dept-tabs { padding: 0 16px; }
  .dept-content { padding: 16px; }
  .dept-value-banner { margin: 0 16px 12px; flex-direction: column; }
  .dept-insight-grid { grid-template-columns: 1fr; }
  .dept-title { font-size: var(--font-2xl, 1.5rem); }
}

/* ── Highlight Rows ──────────────────────────────────────── */
.dept-table tr.highlight-row td { background: rgba(59, 130, 246, 0.05); }
.dept-table tr.risk-row td { background: rgba(244, 63, 94, 0.05); }

/* ── Sparkline inline ────────────────────────────────────── */
.dept-sparkbar {
  display: flex;
  gap: 2px;
  height: 20px;
  align-items: flex-end;
}
.dept-sparkbar-seg {
  flex: 1;
  min-width: 4px;
  border-radius: 2px 2px 0 0;
  background: var(--accent, #3b82f6);
  opacity: 0.7;
  transition: opacity 0.15s;
}
.dept-sparkbar-seg:hover { opacity: 1; }

/* ── Quick Action Buttons ────────────────────────────────── */
.dept-action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 0;
}
.dept-action-btn {
  padding: 8px 16px;
  font-size: var(--font-sm, 0.875rem);
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius, 6px);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition, 0.15s ease);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.dept-action-btn:hover { border-color: var(--accent); color: var(--accent); }
.dept-action-btn.primary {
  background: var(--accent, #3b82f6);
  color: #fff;
  border-color: var(--accent, #3b82f6);
}
.dept-action-btn.primary:hover { opacity: 0.9; }
.dept-action-btn svg { width: 14px; height: 14px; }

/* ── Stat Row (horizontal stats) ─────────────────────────── */
.dept-stat-row {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  padding: 12px 0;
}
.dept-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dept-stat-label {
  font-size: var(--font-2xs, 0.625rem);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.dept-stat-val {
  font-size: var(--font-lg, 1.125rem);
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}

/* ── Account Card (for drill-down) ───────────────────────── */
.dept-account-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius, 6px);
  padding: 16px 20px;
  margin-bottom: 10px;
  transition: var(--transition, 0.15s ease);
  cursor: pointer;
}
.dept-account-card:hover { border-color: var(--accent); }
.dept-account-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.dept-account-meta {
  font-size: var(--font-xs, 0.75rem);
  color: var(--text-muted);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

/* ── Power BI Embed Containers ──────────────────────────────────── */
.dept-pbi-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius, 6px);
  margin-bottom: 16px;
  overflow: hidden;
  position: relative;
}
.dept-pbi-section-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.dept-pbi-section-title {
  font-size: var(--font-base, 1rem);
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.dept-pbi-section-title svg { color: var(--text-muted); }
.dept-pbi-fs-btn {
  padding: 4px 10px;
  font-size: var(--font-2xs, 0.625rem);
  border: 1px solid var(--border);
  border-radius: var(--radius, 6px);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition, 0.15s ease);
  display: flex;
  align-items: center;
  gap: 4px;
}
.dept-pbi-fs-btn:hover { border-color: var(--accent); color: var(--accent); }

.dept-pbi-slot {
  position: relative;
  min-height: 500px;
}
.dept-pbi-header {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.dept-pbi-label {
  font-size: var(--font-sm, 0.875rem);
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.dept-pbi-label svg { color: var(--text-muted); }
.dept-pbi-status {
  font-size: var(--font-2xs, 0.625rem) !important;
  padding: 2px 8px !important;
}

.dept-pbi-report {
  width: 100%;
  height: 600px;
  min-height: 500px;
}
.dept-pbi-report iframe {
  border: none !important;
  border-radius: 0 !important;
}

.dept-pbi-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: var(--font-sm, 0.875rem);
}
.dept-pbi-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: var(--font-sm, 0.875rem);
}
.dept-pbi-error svg { color: #f59e0b; }

.dept-pbi-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 20px;
  color: var(--text-muted);
  font-size: var(--font-sm, 0.875rem);
  text-align: center;
}
.dept-pbi-empty-state svg { opacity: 0.4; }

/* Fullscreen mode */
.dept-pbi-section.dept-pbi-fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  margin: 0;
  border-radius: 0;
  overflow: auto;
}
.dept-pbi-section.dept-pbi-fullscreen .dept-pbi-report {
  height: calc(100vh - 100px);
}

@media (max-width: 768px) {
  .dept-pbi-report { height: 400px; min-height: 300px; }
  .dept-pbi-section.dept-pbi-fullscreen .dept-pbi-report { height: calc(100vh - 80px); }
}

/* ═══════════════════════════════════════════════════════════
   Newsletters tab — HubSpot CampaignEmail browser
   ═══════════════════════════════════════════════════════════ */

.dept-section-meta {
  margin-left: auto;
  font-size: var(--font-xs, 0.75rem);
  color: var(--text-muted);
}

/* Filter bar — responsive grid */
.nl-filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px 14px;
  padding: 14px;
  background: var(--surface-2, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  margin-bottom: 14px;
}
.nl-filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.nl-filter-group label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #64748b);
  font-weight: 600;
}
.nl-filter-group select,
.nl-filter-group input {
  width: 100%;
  padding: 6px 8px;
  font-size: 13px;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 6px;
  background: var(--surface, #fff);
  color: var(--text-primary, #0f172a);
  min-width: 0;
}
.nl-filter-group.nl-filter-grow {
  grid-column: span 2;
}
.nl-filter-group.nl-filter-actions {
  align-self: end;
  justify-content: flex-end;
  flex-direction: row;
  gap: 12px;
  align-items: center;
}
.nl-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-primary, #0f172a);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.nl-checkbox input { margin: 0; }
.nl-dim { color: var(--text-muted, #94a3b8); }

.nl-btn {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border, #cbd5e1);
  background: var(--surface, #fff);
  color: var(--text-primary, #0f172a);
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.12s, border-color 0.12s;
}
.nl-btn:hover { background: var(--surface-2, #f1f5f9); }
.nl-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.nl-btn.primary {
  background: linear-gradient(135deg, #ec4899, #db2777);
  color: #fff;
  border-color: transparent;
}
.nl-btn.primary:hover { filter: brightness(1.05); }

/* Recipient lookup */
.nl-recipient-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.nl-recipient-row label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary, #0f172a);
}
.nl-recipient-row input {
  flex: 1 1 240px;
  min-width: 200px;
  padding: 6px 10px;
  font-size: 13px;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 6px;
  background: var(--surface, #fff);
}
.nl-help {
  font-size: 11px;
  color: var(--text-muted, #94a3b8);
  font-style: italic;
}

/* Newsletter table */
.nl-table-wrap { max-height: 60vh; overflow: auto; }
.nl-table { font-size: 13px; }
.nl-table thead th {
  position: sticky;
  top: 0;
  background: var(--surface-2, #f8fafc);
  z-index: 1;
}
.nl-table tbody tr.nl-row { cursor: pointer; }
.nl-table tbody tr.nl-row:hover { background: var(--surface-2, #f1f5f9); }
.nl-table .mono {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.nl-pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-muted, #64748b);
}

/* Modals */
.nl-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 24px;
}
.nl-modal-overlay[hidden] { display: none; }
.nl-modal {
  background: var(--surface, #fff);
  width: min(800px, 100%);
  max-height: 86vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(2, 6, 23, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.nl-modal-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border, #e2e8f0);
}
.nl-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary, #0f172a);
}
.nl-modal-subtitle {
  font-size: 13px;
  color: var(--text-muted, #64748b);
  margin-top: 2px;
}
.nl-modal-close {
  margin-left: auto;
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  padding: 0 4px;
}
.nl-modal-close:hover { color: var(--text-primary, #0f172a); }
.nl-modal-body {
  padding: 16px 20px;
  overflow-y: auto;
}
.nl-modal-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  font-size: 13px;
  flex-wrap: wrap;
}
.nl-modal-controls input {
  padding: 4px 8px;
  font-size: 13px;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 6px;
  margin-left: 6px;
}

.nl-recipient-input-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.nl-recipient-input-row label { font-size: 13px; font-weight: 600; }
.nl-recipient-input-row input {
  flex: 1 1 220px;
  padding: 6px 10px;
  font-size: 13px;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 6px;
}

/* Modal stats strip */
.nl-modal-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 10px 14px;
  background: var(--surface-2, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  margin-bottom: 14px;
}
.nl-stat { display: flex; flex-direction: column; min-width: 70px; }
.nl-stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #64748b);
  font-weight: 600;
}
.nl-stat-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary, #0f172a);
  font-variant-numeric: tabular-nums;
}

/* Event timeline */
.nl-event-timeline { font-size: 13px; }
.nl-event-list { list-style: none; margin: 0; padding: 0; }
.nl-event {
  display: grid;
  grid-template-columns: 150px 90px 1fr;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border-light, #f1f5f9);
  word-break: break-word;
}
.nl-event:last-child { border-bottom: none; }
.nl-event-campaign {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--text-muted, #64748b);
  font-weight: 600;
}
.nl-event-time {
  font-size: 12px;
  color: var(--text-muted, #64748b);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}
.nl-event-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-align: center;
  width: fit-content;
}
.nl-event-pill.ev-sent      { background: #e0e7ff; color: #3730a3; }
.nl-event-pill.ev-delivered { background: #d1fae5; color: #047857; }
.nl-event-pill.ev-open      { background: #dbeafe; color: #1d4ed8; }
.nl-event-pill.ev-click     { background: #fef3c7; color: #92400e; }
.nl-event-pill.ev-bounce    { background: #fee2e2; color: #b91c1c; }
.nl-event-pill.ev-unsub     { background: #fce7f3; color: #9d174d; }
.nl-event-pill.ev-soft      { background: #f1f5f9; color: #475569; }

.nl-event-detail {
  font-size: 12px;
  color: var(--text-muted, #64748b);
  word-break: break-all;
}
.nl-event-detail a {
  color: #2563eb;
  text-decoration: none;
}
.nl-event-detail a:hover { text-decoration: underline; }

@media (max-width: 768px) {
  .nl-event { grid-template-columns: 1fr; }
  .nl-event-time { font-size: 11px; }
}

/* ──────────────────────────────────────────────────────────────────
   Newsletter Pulse view — KPI cards, trend chart, leaderboards
   ────────────────────────────────────────────────────────────────── */

/* Pulse / Browse segmented toggle */
.nl-view-toggle {
  display: inline-flex;
  background: var(--surface-2, #f1f5f9);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}
.nl-view-btn {
  appearance: none;
  border: none;
  background: transparent;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted, #64748b);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.nl-view-btn:hover { color: var(--text-primary, #0f172a); }
.nl-view-btn.active {
  background: var(--surface, #fff);
  color: var(--text-primary, #0f172a);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.nl-view { animation: nl-fade-in 0.18s ease-out; }
@keyframes nl-fade-in {
  from { opacity: 0; transform: translateY(2px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* KPI strip */
.nl-kpi-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 6px;
}
@media (max-width: 1100px) {
  .nl-kpi-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .nl-kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.nl-kpi-card {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 80px;
}
.nl-kpi-card[data-loading] { opacity: 0.5; }

.nl-kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #64748b);
  font-weight: 600;
}
.nl-kpi-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary, #0f172a);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.nl-kpi-sub {
  font-size: 11px;
  color: var(--text-muted, #94a3b8);
  font-variant-numeric: tabular-nums;
}
.nl-kpi-delta {
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  gap: 4px;
}
.nl-kpi-delta.up    { color: #047857; }
.nl-kpi-delta.down  { color: #b91c1c; }
.nl-kpi-delta.flat  { color: #64748b; }
/* For bounce rate, "up" is bad. We flip semantics via .invert. */
.nl-kpi-delta.up.invert    { color: #b91c1c; }
.nl-kpi-delta.down.invert  { color: #047857; }

.nl-kpi-footnote {
  font-size: 11px;
  color: var(--text-muted, #94a3b8);
  margin: 4px 2px 16px;
}

/* Trend chart */
.nl-trend-card {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  padding: 14px 16px 18px;
  margin-bottom: 18px;
}
.nl-trend-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 12px;
  flex-wrap: wrap;
}
.nl-trend-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary, #0f172a);
}
.nl-trend-legend {
  display: flex;
  gap: 14px;
  font-size: 11px;
  color: var(--text-muted, #64748b);
}
.nl-legend-item { display: inline-flex; align-items: center; gap: 5px; }
.nl-legend-bar {
  width: 10px; height: 10px;
  background: #6366f1;
  border-radius: 2px;
  display: inline-block;
}
.nl-legend-line {
  width: 14px; height: 2px;
  background: #f59e0b;
  display: inline-block;
}
.nl-trend-chart {
  width: 100%;
  height: 220px;
  position: relative;
}
.nl-trend-chart svg {
  display: block;
  width: 100%;
  height: 100%;
}
.nl-trend-bar {
  fill: #6366f1;
  opacity: 0.85;
  transition: opacity 0.12s;
}
.nl-trend-bar:hover { opacity: 1; fill: #4f46e5; }
.nl-trend-line {
  fill: none;
  stroke: #f59e0b;
  stroke-width: 1.6;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.nl-trend-axis {
  stroke: #cbd5e1;
  stroke-width: 1;
}
.nl-trend-grid {
  stroke: #e2e8f0;
  stroke-width: 1;
  stroke-dasharray: 2 3;
}
.nl-trend-axis-label {
  fill: #94a3b8;
  font-size: 10px;
  font-family: inherit;
}
.nl-trend-tooltip {
  position: absolute;
  background: rgba(15, 23, 42, 0.92);
  color: #f8fafc;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  display: none;
  z-index: 10;
}
.nl-trend-tooltip strong { color: #fff; font-weight: 700; }

/* Two-column pulse grid */
.nl-pulse-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}
@media (max-width: 900px) {
  .nl-pulse-grid { grid-template-columns: 1fr; }
}

.nl-pulse-card {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  padding: 12px 14px;
}
.nl-pulse-card-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary, #0f172a);
  margin-bottom: 10px;
}
.nl-pulse-card-meta {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted, #94a3b8);
  letter-spacing: 0;
  text-transform: none;
}

/* Mini-tables (top brands / types) */
.nl-mini-table th,
.nl-mini-table td {
  padding: 6px 8px;
  font-size: 12px;
}
.nl-mini-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #64748b);
}

/* Leader-list (top performers / biggest misses) */
.nl-leader-list { display: flex; flex-direction: column; gap: 6px; }
.nl-leader-row {
  display: grid;
  grid-template-columns: 64px 1fr 84px;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border-light, #f1f5f9);
  border-radius: 8px;
  background: var(--surface, #fff);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.nl-leader-row:hover {
  border-color: #c7d2fe;
  background: #f8faff;
}
.nl-leader-metric {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary, #0f172a);
  font-variant-numeric: tabular-nums;
}
.nl-leader-metric.warn { color: #b91c1c; }
.nl-leader-body { min-width: 0; }
.nl-leader-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary, #0f172a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nl-leader-meta {
  font-size: 11px;
  color: var(--text-muted, #64748b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nl-leader-volume {
  text-align: right;
  font-size: 11px;
  color: var(--text-muted, #64748b);
  font-variant-numeric: tabular-nums;
}

/* Browse-view summary row (small bar above filter bar in browse mode) */
.nl-browse-summary-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 6px;
}

/* ═══════════════════════════════════════════════════════════
   Audience Builder (dept_audience.html)
   Scoped under .aud-* — no leakage into other dept pages.
   ═══════════════════════════════════════════════════════════ */

.aud-intro {
  font-size: var(--font-sm, 0.875rem);
  color: var(--text-secondary, #475569);
  line-height: 1.55;
  margin-bottom: 14px;
  max-width: 820px;
}

.aud-query-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.aud-query-input {
  width: 100%;
  min-height: 70px;
  padding: 12px 14px;
  font-size: var(--font-sm, 0.875rem);
  line-height: 1.5;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius, 6px);
  background: var(--bg-card, #fff);
  color: var(--text-primary, #0f172a);
  resize: vertical;
  transition: border-color 0.15s ease;
  font-family: inherit;
}
.aud-query-input:focus {
  outline: none;
  border-color: #06b6d4;
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.12);
}
.aud-query-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.aud-control-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--font-xs, 0.75rem);
  color: var(--text-muted, #64748b);
}
.aud-control-input {
  width: 64px;
  padding: 4px 8px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 4px;
  font-size: var(--font-xs, 0.75rem);
  background: var(--bg-card, #fff);
  color: var(--text-primary, #0f172a);
}
.aud-control-toggle {
  cursor: pointer;
  user-select: none;
  padding: 4px 10px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 999px;
  background: #f1f5f9;
  color: #0f172a;
  transition: background 0.15s;
}
.aud-control-toggle:hover { background: #e2e8f0; }
.aud-control-toggle input[type="checkbox"] {
  margin: 0;
  accent-color: var(--accent-primary, #2563eb);
}
.aud-control-toggle:has(input[type="checkbox"]:checked) {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e3a8a;
}
.aud-mini-stat-sector { background: #f0fdf4; border-color: #86efac; }
.aud-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.aud-preset-btn {
  padding: 5px 10px;
  font-size: var(--font-2xs, 0.6875rem);
  font-weight: 500;
  border: 1px solid var(--border, #e2e8f0);
  background: var(--bg-card, #fff);
  color: var(--text-secondary, #475569);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.aud-preset-btn:hover {
  border-color: #06b6d4;
  color: #0891b2;
  background: #ecfeff;
}
.aud-run-btn {
  margin-left: auto;
  padding: 8px 18px;
  font-size: var(--font-sm, 0.875rem);
  font-weight: 600;
  border: 0;
  border-radius: var(--radius, 6px);
  background: linear-gradient(135deg, #06b6d4, #0891b2);
  color: #fff;
  cursor: pointer;
  transition: all 0.15s ease;
}
.aud-run-btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.aud-run-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}
.aud-secondary-btn {
  padding: 8px 14px;
  font-size: var(--font-xs, 0.75rem);
  font-weight: 500;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius, 6px);
  background: var(--bg-card, #fff);
  color: var(--text-secondary, #475569);
  cursor: pointer;
}
.aud-secondary-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.aud-secondary-btn:not(:disabled):hover { border-color: #06b6d4; color: #0891b2; }

.aud-status {
  padding: 10px 14px;
  border-radius: var(--radius, 6px);
  font-size: var(--font-xs, 0.75rem);
  margin-bottom: 14px;
  background: #f1f5f9;
  color: var(--text-secondary, #475569);
  border-left: 3px solid #94a3b8;
}
.aud-status-info { background: #eff6ff; border-left-color: #3b82f6; color: #1e40af; }
.aud-status-ok { background: #ecfdf5; border-left-color: #10b981; color: #065f46; }
.aud-status-warn { background: #fffbeb; border-left-color: #f59e0b; color: #92400e; }
.aud-status-error { background: #fef2f2; border-left-color: #ef4444; color: #991b1b; }

.aud-spin {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -2px;
  margin-right: 8px;
  animation: aud-spin 0.7s linear infinite;
}
@keyframes aud-spin { to { transform: rotate(360deg); } }

.aud-summary {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius, 6px);
  background: var(--bg-card, #fff);
  padding: 14px 16px;
  margin-bottom: 18px;
}
.aud-summary-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
  align-items: start;
}
.aud-summary-row:last-child { border-bottom: 0; }
.aud-summary-label {
  font-size: var(--font-2xs, 0.6875rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #64748b);
  padding-top: 4px;
}
.aud-summary-value {
  font-size: var(--font-sm, 0.875rem);
  color: var(--text-primary, #0f172a);
  line-height: 1.5;
}
.aud-mute { color: var(--text-muted, #64748b); font-weight: 400; }

.aud-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.aud-chip {
  display: inline-block;
  padding: 3px 9px;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  font-size: var(--font-2xs, 0.6875rem);
  font-weight: 500;
}
.aud-chip-more { background: #fff; color: var(--text-muted, #64748b); font-style: italic; }

.aud-mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}
.aud-mini-stat {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 8px 10px;
}
.aud-mini-stat-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted, #64748b);
  margin-bottom: 4px;
}
.aud-mini-stat-value {
  font-size: var(--font-base, 1rem);
  font-weight: 700;
  color: var(--text-primary, #0f172a);
  font-family: 'JetBrains Mono', monospace;
}
.aud-mini-stat-tier { background: #ecfeff; border-color: #67e8f9; }

.aud-results-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 4px;
  margin-bottom: 10px;
}
.aud-results-count {
  font-size: var(--font-sm, 0.875rem);
  color: var(--text-secondary, #475569);
}
.aud-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-muted, #64748b);
  background: var(--bg-card, #fff);
  border: 1px dashed var(--border, #e2e8f0);
  border-radius: var(--radius, 6px);
}

.aud-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.aud-row {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius, 6px);
  background: var(--bg-card, #fff);
  padding: 12px 14px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.aud-row:hover {
  border-color: #67e8f9;
  transform: translateY(-1px);
}
.aud-row-head {
  display: grid;
  grid-template-columns: 36px 1fr 200px 220px auto;
  gap: 14px;
  align-items: center;
}
.aud-row-rank {
  font-size: var(--font-xs, 0.75rem);
  font-weight: 700;
  color: var(--text-muted, #64748b);
  font-family: 'JetBrains Mono', monospace;
  text-align: right;
}
.aud-row-name-line {
  font-size: var(--font-base, 1rem);
  font-weight: 600;
  color: var(--text-primary, #0f172a);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.aud-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.aud-meta-pill {
  display: inline-block;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 500;
  background: #f1f5f9;
  border-radius: 3px;
  color: #475569;
}
.aud-meta-owner { background: #fef3c7; color: #92400e; }

.aud-tier {
  display: inline-block;
  padding: 1px 8px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.aud-tier-a { background: #047857; color: #fff; }
.aud-tier-b { background: #0891b2; color: #fff; }
.aud-tier-c { background: #94a3b8; color: #fff; }

.aud-row-score {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.aud-score-num {
  font-size: var(--font-lg, 1.125rem);
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-primary, #0f172a);
}
.aud-score-bar {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
}
.aud-score-fill {
  height: 100%;
  background: linear-gradient(90deg, #06b6d4, #0891b2);
  transition: width 0.3s ease;
}

.aud-row-stats {
  font-size: var(--font-xs, 0.75rem);
  color: var(--text-muted, #64748b);
  font-family: 'JetBrains Mono', monospace;
  text-align: right;
}

.aud-expand-btn {
  padding: 5px 12px;
  font-size: var(--font-2xs, 0.6875rem);
  font-weight: 500;
  border: 1px solid var(--border, #e2e8f0);
  background: var(--bg-card, #fff);
  color: var(--text-secondary, #475569);
  border-radius: 4px;
  cursor: pointer;
}
.aud-expand-btn:hover { border-color: #06b6d4; color: #0891b2; }

.aud-row-signals {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #f1f5f9;
}
.aud-sig {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 500;
  border-radius: 3px;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #e2e8f0;
}
.aud-sig-pts {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: #0891b2;
}
.aud-sig-tag { background: #ecfeff; border-color: #67e8f9; color: #155e75; }
.aud-sig-agency_function { background: #f0f9ff; border-color: #bae6fd; color: #075985; }
.aud-sig-bi_text { background: #faf5ff; border-color: #d8b4fe; color: #6b21a8; }
.aud-sig-semantic { background: #fef3c7; border-color: #fcd34d; color: #92400e; }
.aud-sig-award_category { background: #ecfdf5; border-color: #6ee7b7; color: #065f46; }
.aud-sig-sponsorship_history { background: #fdf2f8; border-color: #f9a8d4; color: #9d174d; }

.aud-row-excerpt {
  margin-top: 8px;
  padding: 8px 10px;
  background: #f8fafc;
  border-left: 3px solid #67e8f9;
  border-radius: 3px;
  font-size: var(--font-xs, 0.75rem);
  color: var(--text-secondary, #475569);
  line-height: 1.5;
  font-style: italic;
}

.aud-row-detail {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.aud-detail-block {
  font-size: var(--font-xs, 0.75rem);
}
.aud-detail-h {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #64748b);
  margin-bottom: 6px;
}
.aud-reason-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-primary, #0f172a);
  line-height: 1.55;
}
.aud-reason-list li { margin-bottom: 3px; }

.aud-ev-block {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 8px 10px;
  margin-bottom: 6px;
}
.aud-ev-name {
  font-size: 11px;
  font-weight: 700;
  color: #0891b2;
  margin-bottom: 3px;
}
.aud-ev-detail {
  font-size: 11px;
  color: var(--text-secondary, #475569);
  margin-bottom: 5px;
}
.aud-ev-items {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.aud-ev-tag {
  display: inline-block;
  padding: 1px 6px;
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 3px;
  color: #475569;
}
.aud-ev-tag b { color: #1e293b; font-weight: 600; }

.aud-outreach {
  padding: 10px 12px;
  background: #ecfeff;
  border-left: 3px solid #06b6d4;
  border-radius: 3px;
  color: #155e75;
  font-size: var(--font-xs, 0.75rem);
  line-height: 1.55;
}

.aud-detail-id {
  font-size: 10px;
  color: var(--text-muted, #64748b);
}
.aud-detail-id code {
  background: #f1f5f9;
  padding: 1px 6px;
  border-radius: 3px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
}

@media (max-width: 1080px) {
  .aud-row-head {
    grid-template-columns: 28px 1fr auto;
    grid-template-rows: auto auto;
    row-gap: 8px;
  }
  .aud-row-score, .aud-row-stats {
    grid-column: 1 / -1;
    text-align: left;
  }
}

/* ─────────────────────────────────────────────────────────────────
   Gap Analysis tab — gap-* namespace
   Sibling of the aud-* styles. Reuses .aud-row / .aud-chip / .aud-status
   shells where possible and adds gap-specific tints + the inline
   ZoomInfo panel.
   ──────────────────────────────────────────────────────────────── */

/* Scope filter bar ─────────────────────────────────────────────────── */
.gap-scope-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.gap-scope-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-secondary, #f3f4f6);
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-muted, #6b7280);
  white-space: nowrap;
  transition: background 0.15s;
}
.gap-scope-toggle:hover {
  background: var(--bg-hover, #e9eaed);
  color: var(--text-primary, #111827);
}
.gap-scope-icon { font-size: 0.88em; }
.gap-scope-caret { font-size: 0.72em; }
.gap-scope-active-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
}
.gap-scope-chip {
  background: var(--accent-subtle, #eff6ff);
  border: 1px solid var(--accent-border, #bfdbfe);
  color: var(--accent-text, #1d4ed8);
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 0.73rem;
  font-weight: 500;
}
.gap-scope-panel {
  background: var(--bg-secondary, #f9fafb);
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 12px;
}
.gap-scope-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 10px;
}
.gap-scope-field { display: flex; flex-direction: column; gap: 4px; }
.gap-scope-label {
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--text-muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.gap-scope-actions { display: flex; justify-content: flex-end; }

/* Multiselect widget */
.gap-multiselect {
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 6px;
  background: var(--bg-primary, #fff);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.gap-multiselect-search {
  border: none;
  border-bottom: 1px solid var(--border, #e0e0e0);
  padding: 5px 8px;
  font-size: 0.78rem;
  outline: none;
  background: transparent;
}
.gap-multiselect-list {
  max-height: 140px;
  overflow-y: auto;
  padding: 4px 0;
}
.gap-ms-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  font-size: 0.78rem;
  cursor: pointer;
  user-select: none;
}
.gap-ms-item:hover { background: var(--bg-hover, #f3f4f6); }
.gap-ms-item input[type=checkbox] { cursor: pointer; }

.gap-presets-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0 10px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 6px;
  flex-wrap: wrap;
}
.gap-presets-label {
  font-size: var(--font-xs, 0.75rem);
  font-weight: 600;
  color: var(--text-muted, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.gap-presets-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.gap-preset-chip {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: var(--font-xs, 0.75rem);
  font-weight: 600;
  color: #0f172a;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.gap-preset-chip:hover {
  background: #f0f9ff;
  border-color: #38bdf8;
  transform: translateY(-1px);
}
.gap-preset-meta {
  font-weight: 400;
  color: var(--text-muted, #64748b);
  margin-left: 4px;
}

.gap-row {
  border-left: 3px solid #fb923c;
}

.gap-row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.gap-zi-btn {
  white-space: nowrap;
  padding: 6px 12px !important;
}
.gap-inline-toggle {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
  font-weight: bold;
}
.gap-inline-toggle[aria-expanded="true"] {
  background: #fef3c7;
  border-color: #fbbf24;
}

.gap-missing-pill {
  display: inline-block;
  padding: 2px 8px;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fbbf24;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  margin-left: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.gap-present-chip {
  display: inline-block;
  padding: 2px 8px;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #6ee7b7;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  margin-left: 6px;
}

/* reachable_count pill — only shown when it differs from total_contacts,
   indicating some contacts are excluded by privacy/reachable gate */
.gap-reachable-pill {
  background: #fef9c3;
  color: #713f12;
  border-color: #fde047;
  cursor: help;
}

.gap-rationale {
  margin-top: 8px;
  padding: 8px 10px;
  background: #f8fafc;
  border-left: 3px solid #fb923c;
  border-radius: 3px;
  color: #334155;
  font-size: var(--font-xs, 0.75rem);
  line-height: 1.55;
}

.gap-chip {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  color: #0369a1;
}

/* Inline ZoomInfo quick-search panel */
.gap-inline-zi {
  margin-top: 10px;
  padding: 10px 12px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 4px;
  font-size: var(--font-xs, 0.75rem);
}
.gap-inline-zi[hidden] {
  display: none;
}
.gap-inline-spin {
  font-style: italic;
  color: #9a3412;
}
.gap-inline-empty {
  color: #6b7280;
}
.gap-inline-head {
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  color: #9a3412;
}
.gap-inline-link {
  color: #ea580c;
  text-decoration: underline;
  font-weight: 500;
}
.gap-inline-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid #fed7aa;
  border-radius: 3px;
  overflow: hidden;
}
.gap-inline-table thead {
  background: #ffedd5;
}
.gap-inline-table th,
.gap-inline-table td {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid #fde9c7;
  vertical-align: top;
}
.gap-inline-table tbody tr:last-child td {
  border-bottom: none;
}

/* Campaign List tab — cl-* namespace */
.cl-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.cl-row {
  border: 1px solid var(--border-subtle, #e2e8f0);
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: var(--bg-surface, #fff);
}
.cl-row-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}
.cl-row-title { flex: 1; min-width: 200px; }
.cl-source-chips { margin-left: 8px; }
.aud-chip-pipeline { background: #ecfdf5; border-color: #6ee7b7; color: #047857; }
.aud-chip-prospect { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; }
.cl-multi-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}
.cl-row-meta {
  font-size: var(--font-xs, 0.75rem);
  color: var(--text-muted, #64748b);
  margin: 4px 0 8px;
}
.cl-row-body {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}
@media (max-width: 900px) {
  .cl-row-body { grid-template-columns: 1fr; }
}
.cl-col-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #64748b);
  margin-bottom: 4px;
}
.cl-mini-list {
  margin: 0;
  padding-left: 16px;
  font-size: var(--font-xs, 0.75rem);
  line-height: 1.5;
}
.cl-contact-email { font-size: var(--font-xs, 0.75rem); color: var(--text-muted, #64748b); }
.cl-rationale {
  margin-top: 8px;
  font-size: var(--font-xs, 0.75rem);
  color: #475569;
  border-left: 3px solid #6b8e60;
  padding-left: 8px;
}
