:root {
  color-scheme: light;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-soft: #f1f5f9;
  --surface-strong: #e2e8f0;
  --ink: #0f172a;
  --ink-soft: #334155;
  --ink-faint: #64748b;
  --line: #e2e8f0;
  --line-soft: #f1f5f9;
  --line-strong: #cbd5e1;
  --brand: #2563eb;
  --brand-hover: #1d4ed8;
  --brand-active: #1e40af;
  --brand-soft: #eff6ff;
  --brand-line: #bfdbfe;
  --brand-ring: rgba(37, 99, 235, 0.2);
  --apollo-gold: #f59e0b;
  --apollo-gold-hover: #d97706;
  --apollo-gold-soft: #fef3c7;
  --apollo-gold-line: #fde68a;
  --ok: #10b981;
  --ok-soft: #ecfdf5;
  --ok-line: #a7f3d0;
  --warn: #f59e0b;
  --serious: #f97316;
  --critical: #ef4444;
  --critical-soft: #fef2f2;
  --critical-line: #fecaca;
  --tier-a: #f97316;
  --tier-b: #f59e0b;
  --tier-c: #2563eb;
  --tier-d: #64748b;
  --tier-x: #94a3b8;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.05);
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-pill: 9999px;

  /* Apollo Dark Sidebar Tokens */
  --sidebar-bg: #0b132b;
  --sidebar-border: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-text-hover: #f8fafc;
  --sidebar-hover-bg: rgba(255, 255, 255, 0.06);
  --sidebar-active-bg: rgba(37, 99, 235, 0.18);
  --sidebar-active-text: #ffffff;
  --sidebar-active-line: #3b82f6;
  --sidebar-badge-bg: #1e293b;
  --sidebar-badge-text: #cbd5e1;
  --sidebar-badge-active: #2563eb;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #090d16;
  --surface: #111827;
  --surface-soft: #1e293b;
  --surface-strong: #334155;
  --ink: #f8fafc;
  --ink-soft: #cbd5e1;
  --ink-faint: #94a3b8;
  --line: #1f293d;
  --line-soft: #162032;
  --line-strong: #334155;
  --brand: #3b82f6;
  --brand-hover: #60a5fa;
  --brand-active: #2563eb;
  --brand-soft: rgba(59, 130, 246, 0.12);
  --brand-line: rgba(59, 130, 246, 0.3);
  --brand-ring: rgba(59, 130, 246, 0.35);
  --apollo-gold: #fbbf24;
  --apollo-gold-hover: #f59e0b;
  --apollo-gold-soft: rgba(251, 191, 36, 0.12);
  --apollo-gold-line: rgba(251, 191, 36, 0.3);
  --ok: #10b981;
  --ok-soft: rgba(16, 185, 129, 0.12);
  --ok-line: rgba(16, 185, 129, 0.3);
  --warn: #fbbf24;
  --serious: #fb923c;
  --critical: #f87171;
  --critical-soft: rgba(239, 68, 68, 0.12);
  --critical-line: rgba(239, 68, 68, 0.3);
  --tier-a: #fb923c;
  --tier-b: #fbbf24;
  --tier-c: #60a5fa;
  --tier-d: #94a3b8;
  --tier-x: #64748b;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 12px 28px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.6);

  --sidebar-bg: #060913;
  --sidebar-border: #161f30;
  --sidebar-text: #94a3b8;
  --sidebar-text-hover: #ffffff;
  --sidebar-hover-bg: rgba(255, 255, 255, 0.07);
  --sidebar-active-bg: rgba(59, 130, 246, 0.2);
  --sidebar-active-text: #ffffff;
  --sidebar-active-line: #60a5fa;
  --sidebar-badge-bg: #1e293b;
  --sidebar-badge-text: #cbd5e1;
  --sidebar-badge-active: #3b82f6;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Plus Jakarta Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-size: 13px;
  line-height: 1.5;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: row;
  background: var(--bg);
  width: 100%;
  position: relative;
}

/* ── Apollo-style Deep Slate/Navy Sidebar Navigation ───────────────── */
.sidebar {
  width: 248px;
  min-width: 248px;
  max-width: 248px;
  height: 100vh;
  position: sticky;
  top: 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  padding: 18px 14px;
  z-index: 30;
  overflow-y: auto;
  transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.26s ease;
}

.sidebar-header {
  padding: 2px 4px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 14px;
}

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

.sidebar-logo {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 5px;
  flex-shrink: 0;
}

.sidebar-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
}

.sidebar-brand-name {
  font-weight: 700;
  font-size: 14.5px;
  color: #ffffff;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.sidebar-brand-desc {
  font-size: 11px;
  color: #60a5fa;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.sidebar-nav-section {
  display: flex;
  flex-direction: column;
}

.sidebar-section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #64748b;
  padding: 16px 8px 6px;
}

.sidebar-section-title:first-child {
  padding-top: 2px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tab.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  background: transparent;
  border: 1px solid transparent;
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  position: relative;
}

.tab.nav-item:hover {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-text-hover);
  transform: translateX(2px);
}

.tab.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  font-weight: 600;
  border-left: 3px solid var(--sidebar-active-line);
  border-radius: 4px var(--radius) var(--radius) 4px;
}

.tab.nav-item:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--brand);
}

.nav-icon {
  font-size: 15px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  opacity: 0.85;
}

.tab.nav-item.active .nav-icon {
  opacity: 1;
  color: #60a5fa;
}

.nav-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.count,
.nav-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 7px;
  border-radius: 10px;
  background: var(--sidebar-badge-bg);
  color: var(--sidebar-badge-text);
  font-size: 10.5px;
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.tab.nav-item.active .count,
.tab.nav-item.active .nav-badge {
  background: var(--sidebar-badge-active);
  color: #ffffff;
  border-color: transparent;
}

.sidebar-spacer {
  flex: 1;
  min-height: 20px;
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.sidebar-user {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.15s ease;
}

.sidebar-user:hover {
  background: rgba(255, 255, 255, 0.07);
}

.sidebar-user .user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.sidebar-user .user-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.sidebar-user .user-name {
  color: #ffffff;
  font-weight: 600;
  font-size: 12px;
}

.sidebar-user .user-role {
  font-size: 10px;
  color: #94a3b8;
  line-height: 1.1;
}

/* Mobile Sidebar Backdrop */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 28;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* ── Main Workspace Container ──────────────────────────────────── */
.main-container {
  flex: 1 1 0%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 56px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.mobile-nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
}

.mobile-nav-toggle:hover {
  background: var(--surface-soft);
  border-color: var(--line-strong);
}

.mobile-nav-toggle svg {
  width: 20px;
  height: 20px;
}

.page-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  min-width: 0;
}

.breadcrumb-root {
  color: var(--ink-faint);
  font-weight: 500;
}

.breadcrumb-sep {
  color: var(--line-strong);
  font-size: 12px;
}

.breadcrumb-current {
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.main-content {
  flex: 1;
  min-width: 0;
}

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

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.8);
}

.status-text {
  font-size: 11px;
  color: var(--ink-soft);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.action-btn,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 500;
  transition: all 0.16s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
  user-select: none;
  cursor: pointer;
}

.action-btn:hover,
.btn:hover {
  background: var(--surface-soft);
  border-color: var(--line-strong);
  color: var(--ink);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.action-btn:active,
.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.action-btn:focus-visible,
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-ring);
}

.action-btn.primary,
.btn.primary {
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-hover) 100%);
  border-color: var(--brand-hover);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.action-btn.primary:hover,
.btn.primary:hover {
  background: linear-gradient(180deg, var(--brand-hover) 0%, var(--brand-active) 100%);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px var(--brand-ring);
}

.action-btn.primary:active,
.btn.primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  border-radius: var(--radius);
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.15s ease;
  cursor: pointer;
  user-select: none;
}

.ghost-btn:hover {
  background: var(--surface-soft);
  color: var(--ink);
  border-color: var(--line-soft);
  transform: translateY(-1px);
}

.ghost-btn:active {
  transform: translateY(0);
}

.ghost-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-ring);
}

main {
  flex: 1;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.content-wrap {
  max-width: 1680px;
  margin: 0 auto;
  padding: 18px;
}

.narrow {
  max-width: 960px;
}

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  margin-bottom: 14px;
}

.kpi-card {
  padding: 16px 18px;
  border-right: 1px solid var(--line-soft);
}

.kpi-card:last-child {
  border-right: 0;
}

.kpi-value {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-family: "Archivo", sans-serif;
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -0.04em;
  margin-bottom: 2px;
}

.kpi-value small {
  font-size: 14px;
  color: var(--ink-faint);
  font-weight: 600;
}

.kpi-sub {
  font-size: 11px;
  color: var(--ink-faint);
}

.kpi-sub strong {
  color: var(--ink-soft);
}

.meter {
  margin-top: 8px;
  width: 100%;
  height: 4px;
  background: var(--surface-strong);
  border-radius: 999px;
  overflow: hidden;
}

.meter > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--brand), #7d8ef5);
  border-radius: inherit;
}

.two-col {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
}

.panel-header h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.panel-body {
  padding: 14px;
}

.nopad {
  padding: 0;
}

.eyebrow {
  font-family: "Archivo", sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.mt-20 {
  margin-top: 20px;
}

.stackbar {
  display: flex;
  width: 100%;
  height: 24px;
  border-radius: 5px;
  overflow: hidden;
  gap: 2px;
  background: var(--surface-soft);
}

.stackbar > span {
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 10px;
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
}

.tier-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.tier-table th,
.tier-table td {
  padding: 6px 0;
  border-top: 1px solid var(--line-soft);
  text-align: left;
  font-size: 12px;
}

.tier-table th {
  color: var(--ink-faint);
  font-family: "Archivo", sans-serif;
  letter-spacing: 0.08em;
  font-size: 10px;
  text-transform: uppercase;
}

.tier-table td:last-child,
.tier-table th:last-child {
  text-align: right;
}

.tier-name {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
}

.color-dot {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  display: inline-block;
}

.score-box {
  margin-top: 18px;
}

.histogram {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 6px;
  align-items: end;
  height: 90px;
  margin-top: 8px;
  padding-top: 8px;
  border-bottom: 1px solid var(--line-soft);
}

.hist-bar {
  display: flex;
  flex-direction: column;
  justify-content: end;
  align-items: center;
  gap: 4px;
  height: 100%;
}

.hist-bar span {
  color: var(--ink-faint);
  font-size: 10px;
  font-family: "IBM Plex Mono", monospace;
}

.hist-bar i {
  display: block;
  width: 100%;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, #8aa9f9, var(--brand));
  opacity: 0.9;
}

.data-bars {
  margin-top: 8px;
}

.source-row {
  display: grid;
  grid-template-columns: 120px 1fr 40px;
  gap: 10px;
  align-items: center;
  margin: 8px 0;
}

.source-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 12px;
}

.source-marker {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  display: inline-block;
}

.source-track {
  position: relative;
  height: 9px;
  background: var(--surface-soft);
  border-radius: 0 4px 4px 0;
  overflow: hidden;
}

.source-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.source-value {
  text-align: right;
  font-size: 11px;
  font-family: "IBM Plex Mono", monospace;
}

.hygiene-list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.hygiene-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-top: 1px solid var(--line-soft);
}

.hygiene-item:first-child {
  border-top: 0;
}

.hygiene-icon {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  color: white;
  font-size: 10px;
  font-weight: 700;
  font-family: "IBM Plex Mono", monospace;
}

.hygiene-text {
  flex: 1;
  font-size: 12px;
  color: var(--ink-soft);
}

.hygiene-count {
  font-size: 11px;
  font-family: "IBM Plex Mono", monospace;
  color: var(--ink-faint);
}

.filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  margin-top: 6px;
  box-shadow: var(--shadow-sm);
  overflow: visible !important;
}

.search-box {
  position: relative;
  min-width: 240px;
  flex: 1;
  max-width: 380px;
}

.search-box svg {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 15px;
  height: 15px;
  transform: translateY(-50%);
  stroke: var(--ink-faint);
  fill: none;
  stroke-width: 2.2;
  pointer-events: none;
  transition: stroke 0.15s ease;
}

.search-box:focus-within svg {
  stroke: var(--brand);
}

.search-box input,
.filters select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 8px 12px 8px 36px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  transition: all 0.16s ease;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
}

.search-box input:hover,
.filters select:hover {
  border-color: var(--line-strong);
}

.search-box input:focus,
.filters select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
  background: var(--surface);
}

.filters select {
  padding: 8px 12px;
  min-width: 110px;
  width: auto;
  cursor: pointer;
}

.chip-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

@media (min-width: 1280px) {
  .filters { flex-wrap: wrap; gap: 8px; padding: 10px 14px; overflow: visible !important; }
  .filters .search-box { min-width: 180px; max-width: 240px; flex: 1 1 200px; }
  .filters .chip-list { flex-wrap: nowrap; flex: 0 0 auto; gap: 4px; }
  .filters .chip { padding: 5px 10px; white-space: nowrap; }
  .filters select { flex: 0 1 120px; min-width: 95px; width: auto; padding: 7px 8px; font-size: 12px; }
  .filters #clearFiltersBtn, .filters #btnExportFilteredCsv, .filters .view-switcher { flex-shrink: 0; white-space: nowrap; }
  .filters .view-switcher { margin-left: auto !important; }
}

.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  font-size: 11.5px;
  font-weight: 600;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.chip:hover {
  background: var(--surface-soft);
  border-color: var(--line-strong);
  color: var(--ink);
  transform: translateY(-1px);
}

.chip:active {
  transform: translateY(0);
}

.chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 8px var(--brand-ring);
}

#clearFiltersBtn {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.15s ease;
  background: var(--surface);
}

#clearFiltersBtn:hover {
  background: var(--surface-soft);
  border-color: var(--line-strong);
  color: var(--ink);
  transform: translateY(-1px);
}

.btn-export-filtered {
  background: linear-gradient(180deg, #0284c7 0%, #0369a1 100%) !important;
  color: #ffffff !important;
  border: 1px solid #0369a1 !important;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 12px;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  transition: all 0.16s ease;
}

.btn-export-filtered:hover {
  background: linear-gradient(180deg, #0369a1 0%, #075985 100%) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

.btn-export-filtered:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.view-switcher {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--surface-soft);
  padding: 3px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  margin-left: auto;
}

.view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.view-toggle:hover {
  color: var(--ink);
  background: rgba(0, 0, 0, 0.04);
}

.view-toggle.active {
  background: var(--surface) !important;
  color: var(--brand) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
  font-weight: 700;
}

.bulk-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: #eef5ff;
  border: 1px solid #bfdbfe;
  border-top: 0;
  color: #1e3a8a;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: inset 0 1px 2px rgba(37, 99, 235, 0.05);
}

.bulk-bar select {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid #93c5fd;
  background: #ffffff;
  color: #1e293b;
}

.bulk-bar .btn {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 4px;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: auto;
}

.lead-grid {
  width: 100%;
  min-width: 1080px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.lead-grid:not(.compact-grid) th:nth-child(1), .lead-grid:not(.compact-grid) td:nth-child(1) { width: 38px; }
.lead-grid:not(.compact-grid) th:nth-child(2), .lead-grid:not(.compact-grid) td:nth-child(2) { width: 36px; }
.lead-grid:not(.compact-grid) th:nth-child(3), .lead-grid:not(.compact-grid) td:nth-child(3) { width: 170px; }
.lead-grid:not(.compact-grid) th:nth-child(4), .lead-grid:not(.compact-grid) td:nth-child(4) { width: 150px; }
.lead-grid:not(.compact-grid) th:nth-child(5), .lead-grid:not(.compact-grid) td:nth-child(5) { width: 140px; }
.lead-grid:not(.compact-grid) th:nth-child(6), .lead-grid:not(.compact-grid) td:nth-child(6) { width: 100px; }
.lead-grid:not(.compact-grid) th:nth-child(7), .lead-grid:not(.compact-grid) td:nth-child(7) { width: 105px; }
.lead-grid:not(.compact-grid) th:nth-child(8), .lead-grid:not(.compact-grid) td:nth-child(8) { width: 90px; }
.lead-grid:not(.compact-grid) th:nth-child(9), .lead-grid:not(.compact-grid) td:nth-child(9) { width: 115px; }
.lead-grid:not(.compact-grid) th:nth-child(10), .lead-grid:not(.compact-grid) td:nth-child(10) { width: 136px; }
.lead-grid:not(.compact-grid) .lead-email,
.lead-grid:not(.compact-grid) .company-block,
.lead-grid:not(.compact-grid) td:nth-child(4) small,
.lead-grid:not(.compact-grid) .source-sub { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.lead-grid:not(.compact-grid) .owner-select,
.lead-grid:not(.compact-grid) .stage-select { width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; }

.lead-grid thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-soft);
  color: var(--ink-soft);
  text-align: left;
  font-size: 10.5px;
  font-family: "Archivo", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 9px 10px;
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
}

.lead-grid tbody td {
  padding: 10px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
  overflow: hidden;
}

.lead-grid tbody tr:hover td {
  background: var(--surface-soft);
}

.lead-grid tbody tr.selected td {
  background: var(--brand-soft);
}

.lead-name {
  font-weight: 600;
  font-size: 12.5px;
  color: var(--ink);
}

.lead-email {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--ink-faint);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-block {
  font-size: 12px;
  color: var(--ink);
}

.company-block small {
  display: block;
  margin-top: 2px;
  font-family: "IBM Plex Mono", monospace;
  color: var(--ink-faint);
  font-size: 10px;
}

.owner-select,
.stage-select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 4px;
  padding: 5px 6px;
  color: var(--ink);
  font-size: 11.5px;
  transition: all 0.15s ease;
}

.owner-select:hover,
.stage-select:hover {
  border-color: var(--brand);
  background: var(--surface-soft);
}

.score-cell {
  display: flex;
  align-items: center;
  gap: 7px;
}

.score-cell strong {
  width: 26px;
  text-align: right;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  color: var(--ink);
}

.score-meter {
  width: 48px;
  height: 6px;
  background: var(--surface-soft);
  border-radius: 999px;
  overflow: hidden;
}

.score-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), #6a8cf8);
}

.tier-pill,
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--surface);
  white-space: nowrap;
}

.status-badge {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.status-clean { background: #dcfce7; border-color: #86efac; color: #15803d; }
.status-warn { background: #fef3c7; border-color: #fcd34d; color: #b45309; }
.status-suspect { background: #ffedd5; border-color: #fdba74; color: #c2410c; }
.status-fail { background: #fee2e2; border-color: #fca5a5; color: #b91c1c; }

[data-theme="dark"] .status-clean { background: rgba(28,168,100,0.12); border-color: rgba(28,168,100,0.4); color: var(--ok); }
[data-theme="dark"] .status-warn { background: rgba(245,166,35,0.12); border-color: rgba(245,166,35,0.5); color: #f5a623; }
[data-theme="dark"] .status-suspect { background: rgba(235,125,56,0.12); border-color: rgba(235,125,56,0.6); color: #eb7d38; }
[data-theme="dark"] .status-fail { background: rgba(217,73,95,0.12); border-color: rgba(217,73,95,0.4); color: var(--critical); }

.mono {
  font-family: "IBM Plex Mono", monospace;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(560px, 100%);
  z-index: 70;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
  transform: translateX(102%);
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex;
  flex-direction: column;
}

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

.close-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.close-btn:hover {
  background: var(--surface-soft);
  color: var(--ink);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(11, 12, 17, 0.45);
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
}

.scrim.show {
  opacity: 1;
  pointer-events: auto;
}

#drawerContent {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.drawer-header {
  padding: 16px 20px 14px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  position: relative;
}

.drawer-header .who h2 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--ink);
}

.drawer-header .who .role {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 2px;
}

.drawer-header .who .em {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 4px;
  word-break: break-all;
}

.drawer-header .dscore {
  margin-left: auto;
  text-align: right;
  flex: none;
}

.drawer-header .dscore .n {
  font-family: "Archivo", sans-serif;
  font-weight: 700;
  font-size: 32px;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.drawer-header .dscore .l {
  font-size: 10px;
  color: var(--ink-faint);
  font-family: "Archivo", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 3px;
}

.dbody {
  overflow-y: auto;
  padding: 0 16px 28px;
  flex: 1;
}

.sect {
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
}

.sect:last-child {
  border-bottom: none;
}

.sect > .eyebrow {
  margin-bottom: 9px;
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  font-family: "Archivo", sans-serif;
}

.brk {
  display: grid;
  grid-template-columns: 118px 1fr 52px;
  gap: 8px;
  align-items: center;
  padding: 4px 0;
  font-size: 12px;
}

.brk .lab {
  color: var(--ink-soft);
}

.brk .track {
  height: 6px;
  background: var(--surface-soft);
  border-radius: 3px;
  overflow: hidden;
}

.brk .track i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--brand);
}

.brk .pts {
  text-align: right;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11.5px;
  color: var(--ink-faint);
}

.brk .pts b {
  color: var(--ink);
  font-weight: 600;
}

.why {
  grid-column: 1 / -1;
  font-size: 11px;
  color: var(--ink-faint);
  margin: -2px 0 4px 0;
  padding-left: 0;
}

.flag {
  display: flex;
  gap: 9px;
  padding: 7px 0;
  border-top: 1px solid var(--line-soft);
  font-size: 12px;
}

.flag:first-of-type {
  border-top: none;
}

.flag .ic {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  flex: none;
  font-family: "IBM Plex Mono", monospace;
  margin-top: 2px;
}

.flag .tx b {
  display: block;
  font-weight: 600;
  font-size: 12px;
  color: var(--ink);
}

.flag .tx span {
  color: var(--ink-faint);
  font-size: 11.5px;
}

.flag .tx .hygiene-check-codes {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.hygiene-check-codes code {
  color: var(--ink-faint);
  background: var(--surface-soft);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  padding: 1px 5px;
  font: 10px "IBM Plex Mono", monospace;
}

.flag .code {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  color: var(--ink-faint);
  margin-left: auto;
  flex: none;
  background: var(--surface-soft);
  border-radius: 3px;
  padding: 1px 5px;
  height: fit-content;
}

.kv {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 4px 10px;
  font-size: 12px;
  margin: 0;
}

.kv dt {
  color: var(--ink-faint);
}

.kv dd {
  margin: 0;
  color: var(--ink);
}

.play {
  background: var(--surface-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 11px 12px;
}

.play h4 {
  font-size: 12.5px;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--ink);
}

.play p {
  margin: 0 0 7px;
  font-size: 11.5px;
  color: var(--ink-soft);
}

.play ul {
  margin: 0;
  padding-left: 16px;
  font-size: 11.5px;
  color: var(--ink-soft);
}

.play ul li {
  margin-bottom: 2px;
}

.draft-type-toggle {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}

.draft-type-btn {
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.14s ease;
  font-family: inherit;
}

.draft-type-btn:hover {
  color: var(--ink);
  background: var(--surface-soft);
}

.draft-type-btn.active {
  background: var(--surface);
  color: var(--brand);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.draft-variant-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
  margin-bottom: 9px;
}

.draft-variant-btn {
  padding: 4px 11px;
  font-size: 11.5px;
  font-weight: 500;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: all 0.12s ease;
  font-family: inherit;
}

.draft-variant-btn:hover {
  background: var(--surface-soft);
  border-color: var(--line);
}

.draft-variant-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
  font-weight: 600;
}

.draftbox {
  margin-top: 6px;
}

.draftbox .subj {
  width: 100%;
  margin-bottom: 6px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}

.draftbox textarea {
  width: 100%;
  min-height: 160px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  font-size: 12.5px;
  line-height: 1.6;
  resize: vertical;
  color: var(--ink);
  font-family: inherit;
}

.draftmeta {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 7px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--ink-faint);
}

.fieldrow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  font-family: "Archivo", sans-serif;
  margin-bottom: 4px;
}

.field select,
.field input,
.field textarea {
  width: 100%;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  font-size: 12.5px;
  color: var(--ink);
  font-family: inherit;
}

.field select:focus,
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--brand);
}

.field textarea {
  min-height: 68px;
  resize: vertical;
}

.tierpill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
}

.tierpill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.toast-notice {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast-notice.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast-notice.has-action { pointer-events: auto; display: flex; align-items: center; gap: 12px; }
.first-touch-panel { margin: 16px 0; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ui-icon { display: inline-block; width: 16px; height: 16px; flex: 0 0 16px; vertical-align: -3px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-icon .ui-icon { width: 18px; height: 18px; flex-basis: 18px; }
.user-avatar .ui-icon { width: 17px; height: 17px; flex-basis: 17px; }
.stat-icon .ui-icon { width: 14px; height: 14px; flex-basis: 14px; }
.source-label .ui-icon { width: 14px; height: 14px; flex-basis: 14px; margin-right: 2px; }
.activity-icon .ui-icon { width: 14px; height: 14px; flex-basis: 14px; }
.theme-toggle-icon .ui-icon { width: 15px; height: 15px; flex-basis: 15px; }
.first-touch-medians { display: grid; grid-template-columns: repeat(4, minmax(110px, 1fr)); gap: 12px; }
.first-touch-tier { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.first-touch-tier strong { margin-left: auto; font-size: 18px; }
.first-touch-tier small { color: var(--ink-faint); }
.owner-suggestion { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.accept-owner-suggestion { padding: 3px 7px; font-size: 10px; line-height: 1.2; }
.signal-gaps { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 10px 0; font-size: 11px; color: var(--ink-soft); }
.signal-gap-chip { padding: 4px 7px; border: 1px solid var(--warn); border-radius: 999px; color: var(--ink); background: color-mix(in srgb, var(--warn) 10%, var(--surface)); }
.all-signals { margin-top: 8px; }
.all-signals summary { cursor: pointer; color: var(--brand); font-size: 12px; font-weight: 600; }
.all-signal-list { margin-top: 8px; }
.signal-row-gap { padding: 5px 7px; border-left: 2px solid var(--warn); background: color-mix(in srgb, var(--warn) 6%, var(--surface)); }
@media (max-width: 620px) { .first-touch-medians { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.toast-undo { border: 0; background: transparent; color: var(--brand); font: inherit; font-weight: 700; cursor: pointer; padding: 2px 4px; }
.toast-undo:disabled { opacity: .6; cursor: wait; }
.disqualify-dialog-form { min-width: min(360px, 80vw); padding: 20px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; }
.disqualify-dialog-form h3 { margin: 0 0 14px; }
.disqualify-dialog-form label { display: block; margin-bottom: 6px; font-size: 13px; }
.disqualify-dialog-form select { width: 100%; min-height: 40px; padding: 8px; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); }
.disqualify-dialog-form .dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

.drop, .dropzone {
  margin-top: 18px;
  border: 1.5px dashed var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 34px 20px;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}

.drop.hot, .dropzone.hot {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.drop h3, .dropzone h3 {
  font-size: 15px;
  margin: 0 0 6px;
  color: var(--ink);
}

.drop p, .dropzone p {
  margin: 0 0 16px;
  color: var(--ink-soft);
  font-size: 12px;
}

.maptable {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.maptable th {
  text-align: left;
  font-family: "Archivo", sans-serif;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-faint);
  padding: 0 8px 7px 0;
}

.maptable td {
  padding: 6px 8px 6px 0;
  border-top: 1px solid var(--line-soft);
  vertical-align: middle;
}

.maptable select {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
  font-size: 12px;
  color: var(--ink);
}

.maptable select:focus {
  outline: none;
  border-color: var(--brand);
}

.maptable .samp {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--ink-faint);
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note {
  font-size: 11.5px;
  color: var(--ink-faint);
  margin-top: 9px;
  line-height: 1.5;
}

.modelgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 18px 0;
}

@media (max-width: 980px) {
  .two-col,
  .modelgrid,
  .model-grid {
    grid-template-columns: 1fr;
  }

  .kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filters {
    align-items: flex-start;
  }
}

.wrow {
  display: grid;
  grid-template-columns: 1fr 118px 54px;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--line-soft);
}

.wrow:first-of-type {
  border-top: none;
}

.wrow .n {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
}

.wrow .n small {
  display: block;
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 400;
  margin-top: 2px;
}

.wrow input[type="range"] {
  width: 100%;
  accent-color: var(--brand);
  cursor: pointer;
}

.wrow input[type="number"] {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  text-align: right;
}

.total-bar {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--line-soft);
  font-size: 12px;
  color: var(--ink-soft);
  flex-wrap: wrap;
}

.total-number {
  font-family: "Archivo", sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
}

.total-note {
  font-size: 11.5px;
  color: var(--ink-faint);
}

.panel-footer-note {
  padding: 10px 18px;
  border-top: 1px solid var(--line-soft);
  font-size: 11.5px;
  color: var(--ink-faint);
}

.listedit {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dict-group {
  display: flex;
  flex-direction: column;
}

.dict-label {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-faint);
  font-family: "Archivo", sans-serif;
  margin-bottom: 6px;
}

.dict-sub {
  color: var(--ink-faint);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  font-size: 10px;
}
.dict-chip-list { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 40px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.dict-chips { display: contents; }
.dict-chip { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 4px 7px; border: 1px solid color-mix(in srgb, var(--brand) 32%, var(--line)); border-radius: 999px; background: color-mix(in srgb, var(--brand) 9%, var(--surface)); color: var(--ink); font-size: 11px; overflow-wrap: anywhere; }
.dict-chip button { border: 0; padding: 0; background: transparent; color: var(--ink-faint); font-size: 15px; line-height: 1; cursor: pointer; }
.dict-chip-input { flex: 1 1 180px; min-width: 150px; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-size: 12px; }
.dict-match-count { display: block; margin-top: 4px; color: var(--ink-faint); font-size: 10px; }

.listedit textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11.5px;
  line-height: 1.6;
  resize: vertical;
  transition: border-color 0.15s ease;
}

.listedit textarea:focus {
  outline: none;
  border-color: var(--brand);
}

.model-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0 40px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  font-size: 12.5px;
  font-weight: 500;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  transition: background 0.12s ease, border-color 0.12s ease;
  cursor: pointer;
}

.btn:hover {
  background: var(--surface-soft);
  border-color: var(--line);
}

.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
  font-weight: 600;
}

.btn.primary:hover {
  filter: brightness(1.1);
}

.model-note {
  font-size: 12px;
  color: var(--ink-soft);
}

.model-note.saving {
  color: var(--brand);
}

.model-note.success {
  color: var(--ok);
}

.model-note.error {
  color: var(--critical);
}

.docs {
  max-width: 860px;
  margin: 0 auto;
}

.docs h2 {
  font-size: 18px;
  margin: 20px 0 8px;
  color: var(--ink);
}

.docs h3 {
  font-size: 13px;
  margin: 16px 0 6px;
  color: var(--ink);
}

.docs p,
.docs li {
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.65;
}

.docs code {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11.5px;
  background: var(--surface-soft);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--ink);
}

.docs ol,
.docs ul {
  padding-left: 20px;
}

/* Pagination Bar */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  font-size: 12.5px;
  color: var(--ink-soft);
}

.pagination-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagination-info strong {
  color: var(--ink);
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
}

.pagination-badge {
  display: inline-block;
  padding: 2px 7px;
  font-size: 11px;
  font-family: "IBM Plex Mono", monospace;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink-faint);
  margin-left: 4px;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 30px;
  padding: 0 8px;
  font-size: 12px;
  font-family: inherit;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.page-btn:hover:not(:disabled):not(.active) {
  background: var(--surface-strong);
  border-color: var(--brand-line);
  color: var(--ink);
}

.page-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
  font-weight: 600;
}

.page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.page-ellipsis {
  padding: 0 4px;
  color: var(--ink-faint);
  user-select: none;
}

/* Source Origin Tags */
.source-badge-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: flex-start;
  min-width: 0;
  max-width: 100%;
}

.source-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
  letter-spacing: 0.02em;
  line-height: 1.4;
}

.source-tag.tag-web {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.source-tag.tag-csv {
  background: #f5f3ff;
  color: #6d28d9;
  border: 1px solid #ddd6fe;
}

[data-theme="dark"] .source-tag.tag-web {
  background: rgba(28, 168, 100, 0.14);
  color: #2bd685;
  border: 1px solid rgba(28, 168, 100, 0.35);
}

[data-theme="dark"] .source-tag.tag-csv {
  background: rgba(138, 92, 246, 0.16);
  color: #c4b5fd;
  border: 1px solid rgba(138, 92, 246, 0.4);
}

.source-tag .source-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

.source-sub {
  font-size: 11px;
  color: var(--ink-faint);
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}



/* ── Live stat bar ─────────────────────────────────────────────────────────── */
.live-stat-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 0 4px;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px 5px 9px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  font-family: inherit;
  color: var(--ink-soft);
  transition: border-color 0.15s, box-shadow 0.15s;
  user-select: none;
}
.stat-pill[style*="cursor:pointer"]:hover {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(47,122,224,0.15);
  color: var(--ink);
}
.stat-pill .stat-icon { font-size: 13px; }
.stat-pill .stat-value { font-weight: 700; font-size: 14px; color: var(--ink); }
.stat-pill .stat-label { font-size: 11px; color: var(--ink-faint); }

.stat-pill.stat-hot {
  border-color: rgba(239,68,68,0.4);
  background: rgba(239,68,68,0.07);
}
.stat-pill.stat-hot .stat-value { color: #ef4444; }

.stat-pill.stat-warm {
  border-color: rgba(245,158,11,0.4);
  background: rgba(245,158,11,0.07);
}
.stat-pill.stat-warm .stat-value { color: #d97706; }

.stat-pill.stat-warn {
  border-color: rgba(245,158,11,0.4);
  background: rgba(245,158,11,0.06);
}
.stat-pill.stat-warn .stat-value { color: #b45309; }

/* ── Activity timeline & notes in drawer ───────────────────────────────────── */
.activity-item {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
  flex-shrink: 0;
  width: 22px;
  text-align: center;
  font-size: 14px;
  margin-top: 1px;
}
.activity-body { flex: 1; min-width: 0; }
.activity-text { color: var(--ink); line-height: 1.5; word-break: break-word; }
.activity-meta { color: var(--ink-faint); font-size: 11px; margin-top: 2px; }

.note-item {
  background: rgba(47,122,224,0.05);
  border-radius: var(--radius);
  padding: 7px 9px;
  border: 1px solid rgba(47,122,224,0.12) !important;
  margin-bottom: 4px;
}

/* ── Critical / Disqualify button ──────────────────────────────────────────── */
.btn.critical, button.btn.sm.critical {
  background: rgba(217,72,95,0.1);
  border: 1px solid rgba(217,72,95,0.35);
  color: #d9485f;
}
.btn.critical:hover, button.btn.sm.critical:hover {
  background: rgba(217,72,95,0.18);
  border-color: #d9485f;
}

/* ── View Switcher & Kanban Board ─────────────────────────────────────────── */
.view-toggle {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s ease;
}

.view-toggle:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.view-toggle.active {
  background: #2563eb !important;
  color: #ffffff !important;
  border-color: #2563eb !important;
}

.kanban-wrap {
  display: grid;
  grid-template-columns: repeat(6, minmax(260px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding: 16px 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  min-height: 520px;
}

.kanban-col {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  max-height: 750px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.kanban-col-head {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-soft);
  border-radius: 8px 8px 0 0;
}

.kanban-col-title {
  font-weight: 700;
  font-size: 12px;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kanban-col-badge {
  background: var(--surface-strong);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 12px;
}

.kanban-card-list {
  padding: 10px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kanban-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.kanban-card:hover {
  border-color: var(--brand);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
  transform: translateY(-1px);
}

.kanban-card-name {
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
  margin-bottom: 2px;
}

.kanban-card-sub {
  font-size: 11px;
  color: var(--ink-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 8px;
}

.kanban-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--line-soft);
}

.kanban-advance-btn {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.15s ease;
}

.kanban-advance-btn:hover {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand);
}

/* ── Authentication & User Pill (LD-15) ────────────────────────── */
.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 11.5px;
  color: var(--ink);
}

.user-pill .user-avatar {
  font-size: 12px;
}

.user-pill .user-name {
  font-weight: 600;
  color: var(--ink);
}

.btn-logout {
  background: transparent;
  border: none;
  color: #dc2626;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 4px;
  transition: all 0.15s ease;
  margin-left: 2px;
}

.btn-logout:hover {
  background: rgba(220, 38, 38, 0.1);
  color: #b91c1c;
}

.auth-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.auth-modal-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 32px 28px;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25), 0 0 0 1px var(--line);
  animation: authCardPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes authCardPop {
  0% {
    transform: scale(0.96) translateY(8px);
    opacity: 0;
  }
  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.auth-brand {
  text-align: center;
  margin-bottom: 24px;
}

.auth-brand-badge {
  display: inline-block;
  padding: 3px 9px;
  background: var(--brand-soft);
  border: 1px solid var(--brand-line);
  border-radius: 12px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--brand);
  margin-bottom: 8px;
}

.auth-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 6px 0;
  letter-spacing: -0.02em;
}

.auth-subtitle {
  font-size: 12.5px;
  color: var(--ink-faint);
  margin: 0;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-error-banner {
  padding: 9px 12px;
  background: #fee2e2;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  font-size: 12px;
  color: #b91c1c;
  font-weight: 500;
}

.auth-error-banner.hidden {
  display: none;
}

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

.auth-field label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
}

.auth-field input {
  padding: 10px 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font-size: 13.5px;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.auth-field input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.btn-auth-submit {
  margin-top: 6px;
  padding: 11px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border: none;
  border-radius: 6px;
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.btn-auth-submit:hover {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.45);
}

.btn-auth-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 10.5px;
  color: #64748b;
}

/* ── Theme Toggle Button ─────────────────────────────────────────── */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 5px 11px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.15s ease;
  user-select: none;
}

.theme-toggle-btn:hover {
  background: var(--surface-soft);
  border-color: var(--brand);
}

.theme-toggle-icon {
  font-size: 13px;
  line-height: 1;
}

.sync-health-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 11px;
  color: var(--ink-soft);
  font-weight: 500;
}

.btn-export-all {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%) !important;
  color: #ffffff !important;
  border: 1px solid #1d4ed8 !important;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: all 0.16s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.btn-export-all:hover {
  background: linear-gradient(180deg, #1d4ed8 0%, #1e40af 100%) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35) !important;
}

.btn-export-all:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08) !important;
}

.lead-name.muted { color: var(--ink-faint); font-weight: 500; }
.no-name-tag { margin-left: 5px; font-size: 10px; font-weight: 500; color: var(--ink-faint); }
.sla-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  margin: 2px 0 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.sla-ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.sla-warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.sla-critical { color: var(--critical); background: color-mix(in srgb, var(--critical) 13%, transparent); }
.tier-empty-hint { align-self: center; color: var(--ink-faint); font-size: 11px; padding: 0 4px; }
.import-batch-label { display: block; color: var(--ink-faint); font-size: 11px; margin-top: 2px; }
.drawer-actions { padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.drawer-actions > .eyebrow { display: none; }
.drawer-actions .fieldrow { gap: 8px; }
.drawer-actions .field { margin: 0; }
.drawer-quick-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }

/* ── Custom Interactive Apollo Dropdowns ──────────────────────────── */
.apollo-dropdown {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
}

.apollo-dropdown.open {
  z-index: 125;
}

.filters .apollo-dropdown {
  flex: 0 1 auto;
}

.apollo-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  min-width: 110px;
  max-width: 230px;
  cursor: pointer;
  transition: all 0.16s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
  user-select: none;
}

.apollo-dropdown-trigger:hover {
  background: var(--surface-soft);
  border-color: var(--line-strong);
  color: var(--ink);
  transform: translateY(-1px);
}

.apollo-dropdown.open .apollo-dropdown-trigger,
.apollo-dropdown-trigger:focus-visible {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
  background: var(--surface);
}

.apollo-dropdown-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  text-align: left;
}

.apollo-dropdown-chevron {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--ink-faint);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.apollo-dropdown.open .apollo-dropdown-chevron {
  transform: rotate(180deg);
  color: var(--brand);
}

.apollo-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: 320px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 14px 34px -4px rgba(15, 23, 42, 0.18), 0 6px 14px -2px rgba(15, 23, 42, 0.08);
  padding: 5px;
  z-index: 999999;
  max-height: 290px;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transform: translateY(-4px) scale(0.98);
  transition: opacity 0.14s cubic-bezier(0.16, 1, 0.3, 1), transform 0.14s cubic-bezier(0.16, 1, 0.3, 1);
}

.apollo-dropdown-menu.open,
.apollo-dropdown.open .apollo-dropdown-menu {
  opacity: 1 !important;
  pointer-events: auto !important;
  visibility: visible !important;
  display: block !important;
  transform: translateY(0) scale(1) !important;
}

/* Compact In-Table Apollo Dropdowns */
.apollo-dropdown.compact {
  display: inline-flex;
  width: 100%;
  min-width: 0;
  vertical-align: middle;
}

.apollo-dropdown.compact .apollo-dropdown-trigger {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 4px 8px;
  height: 28px;
  font-size: 11.5px;
  font-weight: 500;
  border-radius: 6px;
  box-shadow: none;
  background: var(--surface);
  border: 1px solid var(--line);
}

.apollo-dropdown.compact .apollo-dropdown-chevron {
  width: 12px;
  height: 12px;
}

.apollo-dropdown.compact .apollo-dropdown-label {
  font-size: 11.5px;
}

/* Stage color badge styling */
.apollo-dropdown[data-stage="new"] .apollo-dropdown-trigger {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
  font-weight: 600;
}
.apollo-dropdown[data-stage="working"] .apollo-dropdown-trigger {
  background: #fffbeb;
  border-color: #fde68a;
  color: #b45309;
  font-weight: 600;
}
.apollo-dropdown[data-stage="meeting booked"] .apollo-dropdown-trigger {
  background: #f5f3ff;
  border-color: #ddd6fe;
  color: #6d28d9;
  font-weight: 600;
}
.apollo-dropdown[data-stage="opportunity"] .apollo-dropdown-trigger {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
  font-weight: 600;
}
.apollo-dropdown[data-stage="nurture"] .apollo-dropdown-trigger {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #15803d;
  font-weight: 600;
}
.apollo-dropdown[data-stage="closed lost"] .apollo-dropdown-trigger {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #64748b;
  font-weight: 600;
}

/* Dark mode stage tinting */
[data-theme="dark"] .apollo-dropdown[data-stage="new"] .apollo-dropdown-trigger {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.35);
  color: #93c5fd;
}
[data-theme="dark"] .apollo-dropdown[data-stage="working"] .apollo-dropdown-trigger {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fcd34d;
}
[data-theme="dark"] .apollo-dropdown[data-stage="meeting booked"] .apollo-dropdown-trigger {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.35);
  color: #c4b5fd;
}
[data-theme="dark"] .apollo-dropdown[data-stage="opportunity"] .apollo-dropdown-trigger {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.35);
  color: #6ee7b7;
}
[data-theme="dark"] .apollo-dropdown[data-stage="nurture"] .apollo-dropdown-trigger {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.35);
  color: #86efac;
}
[data-theme="dark"] .apollo-dropdown[data-stage="closed lost"] .apollo-dropdown-trigger {
  background: rgba(100, 116, 139, 0.15);
  border-color: rgba(100, 116, 139, 0.35);
  color: #94a3b8;
}

.apollo-dropdown-item {
  padding: 7px 10px;
  font-size: 12.5px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  transition: all 0.12s ease;
  user-select: none;
}

.apollo-dropdown-item:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.apollo-dropdown-item.selected {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}

.apollo-item-check {
  width: 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.apollo-item-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.apollo-dropdown > select {
  position: absolute !important;
  opacity: 0 !important;
  pointer-events: none !important;
  width: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}

/* ── Premium Apollo Restore / Undisqualify Lead Button ────────────── */
.btn-restore-lead,
.btn-undisqualify,
#d-undisqualify {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  background: linear-gradient(180deg, #10b981 0%, #059669 100%) !important;
  color: #ffffff !important;
  border: 1px solid #047857 !important;
  border-radius: 6px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  padding: 6px 14px !important;
  white-space: nowrap !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.22) !important;
  cursor: pointer !important;
  transition: all 0.16s cubic-bezier(0.16, 1, 0.3, 1) !important;
  letter-spacing: 0.01em !important;
}

.btn-restore-lead:hover,
.btn-undisqualify:hover,
#d-undisqualify:hover {
  background: linear-gradient(180deg, #059669 0%, #047857 100%) !important;
  border-color: #065f46 !important;
  color: #ffffff !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35) !important;
}

.btn-restore-lead:active,
.btn-undisqualify:active,
#d-undisqualify:active {
  transform: translateY(0) !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08) !important;
}

.btn-restore-lead:focus-visible,
.btn-undisqualify:focus-visible,
#d-undisqualify:focus-visible {
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.3) !important;
}

.btn-restore-lead svg,
.btn-undisqualify svg,
#d-undisqualify svg {
  width: 13px !important;
  height: 13px !important;
}

.btn.critical, button.btn.sm.critical, #d-disqualify {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  background: #fef2f2 !important;
  color: #dc2626 !important;
  border: 1px solid #fecaca !important;
  border-radius: 6px !important;
  font-weight: 600 !important;
  font-size: 11.5px !important;
  padding: 5px 12px !important;
  cursor: pointer !important;
  transition: all 0.16s cubic-bezier(0.16, 1, 0.3, 1) !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

.btn.critical:hover, button.btn.sm.critical:hover, #d-disqualify:hover {
  background: #ef4444 !important;
  color: #ffffff !important;
  border-color: #dc2626 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 3px 10px rgba(239, 68, 68, 0.3) !important;
}

.btn.critical:active, button.btn.sm.critical:active, #d-disqualify:active {
  transform: translateY(0) !important;
  box-shadow: none !important;
}

.tier-pill-a, .tierpill-a { color: var(--tier-a) !important; border-color: color-mix(in srgb, var(--tier-a) 45%, transparent) !important; background: color-mix(in srgb, var(--tier-a) 12%, transparent) !important; }
.tier-pill-b, .tierpill-b { color: var(--tier-b) !important; border-color: color-mix(in srgb, var(--tier-b) 45%, transparent) !important; background: color-mix(in srgb, var(--tier-b) 12%, transparent) !important; }
.tier-pill-c, .tierpill-c { color: var(--tier-c) !important; border-color: color-mix(in srgb, var(--tier-c) 45%, transparent) !important; background: color-mix(in srgb, var(--tier-c) 12%, transparent) !important; }
.tier-pill-d, .tierpill-d { color: var(--tier-d) !important; border-color: color-mix(in srgb, var(--tier-d) 45%, transparent) !important; background: color-mix(in srgb, var(--tier-d) 12%, transparent) !important; }
.tier-pill-x, .tierpill-x { color: var(--tier-x) !important; border-color: color-mix(in srgb, var(--tier-x) 45%, transparent) !important; background: color-mix(in srgb, var(--tier-x) 12%, transparent) !important; }
.chip-tier-a { color: var(--tier-a); border-color: color-mix(in srgb, var(--tier-a) 42%, transparent); }
.chip-tier-b { color: var(--tier-b); border-color: color-mix(in srgb, var(--tier-b) 42%, transparent); }
.chip-tier-c { color: var(--tier-c); border-color: color-mix(in srgb, var(--tier-c) 42%, transparent); }
.chip-tier-d { color: var(--tier-d); border-color: color-mix(in srgb, var(--tier-d) 42%, transparent); }
.chip-tier-a.active { background: color-mix(in srgb, var(--tier-a) 18%, var(--surface)); }
.chip-tier-b.active { background: color-mix(in srgb, var(--tier-b) 18%, var(--surface)); }
.chip-tier-c.active { background: color-mix(in srgb, var(--tier-c) 18%, var(--surface)); }
.chip-tier-d.active { background: color-mix(in srgb, var(--tier-d) 18%, var(--surface)); }
.sortable-header { border: 0; padding: 0; background: transparent; color: inherit; font: inherit; font-weight: inherit; cursor: pointer; transition: color 0.15s ease; }
.sortable-header:hover { color: var(--brand); }
.lead-age { white-space: nowrap; color: var(--ink-faint); font-size: 11px; }
.route-hint { display: block; color: var(--ink-faint); font-size: 10px; margin-top: 3px; }
.rescale-option { display: flex; align-items: flex-start; gap: 8px; padding: 12px 0 2px; color: var(--ink); font-size: 12px; }
.rescale-option small { display: block; color: var(--ink-faint); font-size: 11px; margin-left: auto; }
.no-data-label { display: block; color: var(--ink-faint); font-size: 10px; font-weight: 500; }
.excluded-signals { margin-top: 8px; color: var(--ink-faint); font-size: 11px; }

/* ── Drawer Top Control Bar ────────────────────────────────────────── */
.drawer-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  gap: 12px;
}

.drawer-top-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.drawer-kicker-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
}

.drawer-top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.drawer-record-nav {
  position: static !important;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.drawer-record-nav button,
.drawer-nav-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.drawer-record-nav button:hover,
.drawer-nav-btn:hover {
  background: var(--surface-soft);
  color: var(--ink);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.drawer-top-divider {
  width: 1px;
  height: 16px;
  background: var(--line);
  margin: 0 4px;
}

/* ── Apollo Results Intelligence Dashboard ────────────────────────── */
.results-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 4px 0 16px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 16px;
}

.results-header-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.results-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.results-period-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.results-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.results-kpi-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
}

.results-kpi-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.results-kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.results-kpi-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
}

.results-kpi-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.results-kpi-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
  line-height: 1.1;
  margin-bottom: 6px;
}

.results-kpi-sub {
  font-size: 11.5px;
  color: var(--ink-faint);
  display: flex;
  align-items: center;
  gap: 6px;
}

.results-kpi-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
}

.results-kpi-meter {
  height: 4px;
  border-radius: 999px;
  background: var(--surface-soft);
  margin-top: 10px;
  overflow: hidden;
}

.results-kpi-meter > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  transition: width 0.4s ease;
}

/* Funnel Card */
.results-funnel-card {
  padding: 20px 24px;
  margin-bottom: 20px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.results-funnel-header {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.results-funnel-stages {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  position: relative;
}

.funnel-stage-box {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  position: relative;
}

.funnel-stage-name {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  margin-bottom: 6px;
}

.funnel-stage-num {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 6px;
}

.funnel-stage-rate {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ok);
  display: flex;
  align-items: center;
  gap: 4px;
}

.funnel-arrow {
  position: absolute;
  right: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-faint);
  font-size: 10px;
  z-index: 2;
}

/* Dimensions Grid */
.results-dimensions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.results-dimension-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.results-dimension-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--line-strong);
}

.results-dimension-head {
  padding: 14px 18px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.results-dimension-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.results-dimension-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-faint);
  background: var(--surface);
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.results-table {
  width: 100%;
  border-collapse: collapse;
}

.results-table th {
  padding: 9px 14px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.results-table th:last-child,
.results-table td:last-child {
  text-align: right;
}

.results-table td {
  padding: 10px 14px;
  font-size: 12px;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}

.results-table tbody tr:hover td {
  background: var(--surface-soft);
}

.results-group-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--ink);
}

.results-mini-bar {
  flex: 1;
  max-width: 70px;
  height: 4px;
  background: var(--surface-soft);
  border-radius: 999px;
  overflow: hidden;
  margin-left: 6px;
}

.results-mini-bar > i {
  display: block;
  height: 100%;
  background: var(--brand);
  border-radius: inherit;
}

.conv-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.conv-meeting {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.conv-opp {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.quarantine-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--ink-soft); font-size: 12px; }
.role-hidden { display: none !important; }
.quarantine-controls label { display: inline-flex; align-items: center; gap: 6px; }
.quarantine-controls select, .quarantine-release-reason { min-height: 34px; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); font-weight: 500; }
.quarantine-controls select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.quarantine-release-btn { margin-left: 6px; white-space: nowrap; padding: 6px 12px; font-size: 11.5px; }
.quarantine-release-btn:disabled { opacity: .6; cursor: wait; }

/* ── SaaS Full Responsiveness Breakpoints ─────────────────────────── */
@media (max-width: 1100px) {
  .two-col {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .modelgrid {
    grid-template-columns: 1fr !important;
  }
  .kpi-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .results-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .results-funnel-stages {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .funnel-arrow {
    display: none;
  }
  .results-dimensions-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .mobile-nav-toggle {
    display: inline-flex;
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: -268px;
    bottom: 0;
    width: 260px;
    min-width: 260px;
    max-width: 85vw;
    z-index: 100;
    box-shadow: none;
  }
  .sidebar.mobile-open {
    transform: translateX(268px);
    box-shadow: 12px 0 32px rgba(0, 0, 0, 0.45);
  }
  .app-topbar {
    padding: 0 14px;
    height: 52px;
  }
  .content-wrap {
    padding: 12px;
  }
  .kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .kpi-card {
    border-bottom: 1px solid var(--line-soft);
  }
  .filters {
    padding: 10px 12px;
    gap: 8px;
  }
  .filters .search-box {
    min-width: 100%;
    max-width: 100%;
  }
  .filters select {
    flex: 1 1 calc(50% - 6px);
    min-width: 120px;
  }
  .view-switcher {
    margin-left: 0;
    width: 100%;
    justify-content: center;
  }
  .view-toggle {
    flex: 1;
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .drawer {
    width: 100vw !important;
    max-width: 100vw !important;
  }
  .kpi-strip {
    grid-template-columns: 1fr;
  }
  .kpi-card {
    border-right: 0;
  }
  .topbar-actions {
    gap: 6px;
  }
  .btn-export-all {
    padding: 6px 10px;
    font-size: 11.5px;
  }
  .drawer-header {
    padding: 14px 16px;
  }
  .drawer-body {
    padding: 14px 16px;
  }
}
