/* Bell Data Intelligence — Portal styles */

:root {
  --bg: #0a0d14;                /* deeper black */
  --bg-elev: #131826;
  --bg-elev-2: #1a2034;
  --border: #2b3346;
  --text: #e6e9ef;
  --text-muted: #8a93a6;
  --text-dim: #5a6275;
  --accent: #5b8cff;
  --accent-bright: #8bb0ff;     /* high-contrast link color on dark bg */
  --accent-fade: #5b8cff20;
  --accent-glow: 0 0 12px rgba(91, 140, 255, .35);
  --green: #4ade80;
  --green-glow: 0 0 10px rgba(74, 222, 128, .35);
  --red: #f87171;
  --amber: #fbbf24;
  --shadow: 0 6px 24px rgba(0,0,0,.45);
  --shadow-glow: 0 0 24px rgba(91, 140, 255, .12);
  --row-h: 36px;
}

* { box-sizing: border-box; }

/* Custom scrollbars — match the dark theme everywhere. */
* {
  scrollbar-width: thin;                       /* Firefox */
  scrollbar-color: #2b2f3d transparent;
}
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: #2b2f3d;
  border-radius: 5px;
  border: 2px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: #3a4055;
  background-clip: content-box;
}
*::-webkit-scrollbar-corner {
  background: transparent;
}

html, body {
  margin: 0; padding: 0;
  font: 14px/1.4 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  height: 100%;
}

#root { height: 100%; display: flex; flex-direction: column; }

/* ============================================================
   App shell: left sidebar + main pane
   ============================================================ */
.app-shell {
  display: flex;
  height: 100vh;
  width: 100%;
}
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background:
    linear-gradient(180deg, #0c1120 0%, #0a0d14 100%);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: relative;
}
.sidebar::after {
  /* faint glow line along the right edge */
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0; width: 1px;
  background: linear-gradient(180deg, transparent, rgba(91, 140, 255, .25) 30%, rgba(91, 140, 255, .25) 70%, transparent);
}

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 14px 12px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand .brand-mark {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent) 0%, #8b5bff 100%);
  border-radius: 7px;
  font-weight: 800; font-size: 11px; letter-spacing: .5px;
  color: white;
  box-shadow: 0 0 16px rgba(91, 140, 255, .35);
}
.sidebar-brand .brand-name {
  font-size: 12px; font-weight: 700; letter-spacing: .3px;
}
.sidebar-brand .brand-tagline {
  font-size: 10px; color: var(--accent-bright);
  letter-spacing: 1.5px; text-transform: uppercase; margin-top: 1px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 8px 8px;
}
.nav-section { margin-bottom: 18px; }
.nav-section-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 1.4px;
  color: #7d8aa6;          /* brighter than text-dim — readable section labels */
  padding: 0 10px 6px;
  font-weight: 700;
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  padding: 7px 10px;
  border: 0; background: transparent;
  color: #c9d2e6;                  /* brighter than text-muted for readability on dark rail */
  font: inherit; font-size: 13px; font-weight: 500;
  text-align: left; cursor: pointer;
  border-radius: 6px;
  margin-bottom: 2px;
  transition: background .12s ease, color .12s ease;
}
.nav-item:hover { background: rgba(91, 140, 255, .12); color: #ffffff; }
.nav-item.active {
  background: var(--accent-fade);
  color: var(--accent-bright);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--accent);
}
.nav-item .nav-icon {
  display: inline-flex; align-items: center; justify-content: center;
  color: inherit;
  width: 16px; height: 16px;
  opacity: .85;
}
.nav-item.active .nav-icon { opacity: 1; }
.nav-item .nav-label { flex: 1; }
.nav-item .nav-soon {
  font-size: 9px; padding: 1px 6px;
  border-radius: 3px;
  background: var(--bg-elev-2);
  color: var(--text-dim);
  text-transform: uppercase; letter-spacing: .6px;
  border: 1px solid var(--border);
}
.nav-item .nav-count {
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--bg-elev-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  min-width: 28px;
  text-align: center;
}
.nav-item.active .nav-count {
  background: var(--accent-fade);
  color: var(--accent-bright);
  border-color: transparent;
}
.nav-item.placeholder { color: #8b95ad; }   /* placeholders still dimmer than real items, but readable */
.nav-item.placeholder:hover { color: #c9d2e6; }

/* Sidebar footer */
.sidebar-foot {
  border-top: 1px solid var(--border);
  padding: 10px;
  background: rgba(0, 0, 0, .25);
}
.sidebar-foot .db-status {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px;
  font-size: 11px;
}
.sidebar-foot .db-status .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px rgba(74, 222, 128, .6);
}
.sidebar-foot .db-status .dot.down { background: var(--red); box-shadow: 0 0 6px rgba(248, 113, 113, .6); }

.user-tile {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 8px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 6px;
}
.user-avatar {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #6f5bff, #5b8cff);
  border-radius: 50%;
  font-weight: 700; font-size: 13px; color: white;
}
.user-meta { flex: 1; min-width: 0; }
.user-name {
  font-size: 12px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-plan {
  font-size: 10px; color: var(--text-dim);
  letter-spacing: .5px; text-transform: uppercase;
}
.user-dots {
  background: transparent; border: 0; color: var(--text-muted);
  font-size: 16px; cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}
.user-dots:hover { background: var(--bg-elev-2); color: var(--text); }
.user-menu {
  position: absolute;
  bottom: 110%;
  right: 4px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px;
  min-width: 140px;
  box-shadow: var(--shadow);
  z-index: 10;
}
.user-menu-item {
  display: block; width: 100%;
  padding: 6px 10px;
  background: transparent; border: 0; color: var(--text);
  text-align: left; cursor: pointer; font: inherit; font-size: 12px;
  border-radius: 4px;
}
.user-menu-item:hover { background: var(--bg-elev-2); }

/* Page header inside main pane */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
}
.page-title {
  font-size: 14px; font-weight: 700; letter-spacing: .4px;
  text-transform: uppercase;
}
.page-stats-inline {
  display: flex; gap: 18px;
  font-size: 11px; color: var(--text-muted);
}
.page-stats-inline b { color: var(--text); font-weight: 600; }

.credit-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--border);
  font-size: 12px; color: var(--text-muted); white-space: nowrap;
}
.credit-pill b { color: var(--text); font-weight: 700; }
.credit-pill .credit-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #2ecc71; box-shadow: 0 0 6px rgba(46,204,113,.6);
}

.reveal-btn {
  font-size: 11px; padding: 3px 10px; border-radius: 6px;
  border: 1px solid var(--accent, #3b82f6); color: var(--accent, #3b82f6);
  background: transparent; cursor: pointer; white-space: nowrap;
}
.reveal-btn:hover { background: var(--accent, #3b82f6); color: #fff; }
.revealed-badge { font-size: 11px; color: #2ecc71; white-space: nowrap; }

.plan-status { padding: 2px 2px 6px; }
.plan-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.plan-line .plan-name { font-size: 12px; font-weight: 600; color: var(--text); text-transform: capitalize; }
.plan-line .plan-credits { font-size: 11px; color: var(--text-muted); }
.plan-line .plan-credits b { color: var(--text); }

.contact-locked-cell { display: inline-flex; align-items: center; gap: 8px; }
.contact-icon.locked { opacity: .75; cursor: default; }

.user-role-line { font-size: 10.5px; color: var(--text-dim); text-transform: capitalize; }

.locked-value { color: var(--text-muted); font-size: 12px; }

/* ── Market Feed ─────────────────────────────────────────────────────────── */
.feed-scanbar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; margin-bottom: 12px;
  border: 1px solid var(--border); border-radius: 10px;
  background: linear-gradient(180deg, rgba(59,130,246,.08), rgba(59,130,246,.02));
  font-size: 12px; color: var(--text-muted);
}
.feed-scanbar .spacer { flex: 1; }
.feed-scan-label { font-weight: 600; color: var(--text); letter-spacing: .2px; }
.feed-stat { white-space: nowrap; }
.feed-stat b { color: var(--text); }
.feed-pulse { width: 9px; height: 9px; border-radius: 50%; background: #22c55e; animation: feedpulse 1.8s infinite; }
.feed-pulse[data-on="1"] { background: #22c55e; animation-duration: 1s; }
@keyframes feedpulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.6);} 70%{box-shadow:0 0 0 7px rgba(34,197,94,0);} 100%{box-shadow:0 0 0 0 rgba(34,197,94,0);} }

.feed-warn { margin-bottom: 12px; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--amber, #f59e0b); background: rgba(245,158,11,.08); color: var(--amber, #f59e0b); font-size: 12px; }
.feed-warn code { background: rgba(255,255,255,.08); padding: 1px 5px; border-radius: 4px; }

.feed-ticker { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; overflow: hidden; }
.feed-ticker-tag { font-size: 10px; font-weight: 800; letter-spacing: .1em; color: #fff; background: #ef4444; padding: 3px 8px; border-radius: 5px; white-space: nowrap; }
.feed-ticker-track { display: flex; gap: 28px; overflow: hidden; white-space: nowrap; mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent); }
.feed-ticker-item { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }
.feed-ticker-item::before { content: '•'; margin-right: 10px; color: var(--text-dim); }

.feed-filters { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.feed-filters .spacer { flex: 1; }
.feed-chip { font-size: 12px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--text-muted); cursor: pointer; white-space: nowrap; }
.feed-chip.active { background: var(--accent, #3b82f6); border-color: var(--accent, #3b82f6); color: #fff; }
.feed-search { padding: 6px 12px; min-width: 200px; border-radius: 8px; border: 1px solid var(--border); background: rgba(255,255,255,.03); color: var(--text); font-size: 12.5px; }

.feed-stream { display: flex; flex-direction: column; gap: 12px; }
.feed-card { display: flex; gap: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-elev); overflow: hidden; transition: border-color .15s; }
.feed-card:hover { border-color: var(--accent, #3b82f6); }
.feed-card-img { width: 120px; flex-shrink: 0; background-size: cover; background-position: center; }
.feed-card-body { flex: 1; min-width: 0; padding: 12px 14px; }
.feed-card-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.feed-card-meta .spacer { flex: 1; }
.feed-kind { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); }
.feed-cat { font-size: 10px; font-weight: 600; text-transform: capitalize; border: 1px solid; border-radius: 4px; padding: 1px 7px; }
.feed-sent { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.feed-card-title { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.35; }
.feed-card-title:hover { color: var(--accent, #3b82f6); }
.feed-card-summary { font-size: 12.5px; color: var(--text-muted); margin-top: 5px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.feed-card-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.feed-company-chip { font-size: 11px; padding: 3px 9px; border-radius: 6px; border: 1px solid var(--accent, #3b82f6); color: var(--accent, #3b82f6); background: transparent; cursor: pointer; }
.feed-company-chip:hover { background: var(--accent, #3b82f6); color: #fff; }
.feed-loadmore { align-self: center; margin: 8px 0 16px; padding: 8px 22px; border-radius: 8px; border: 1px solid var(--border); background: transparent; color: var(--text-muted); cursor: pointer; }

.feed-aside { width: 240px; flex-shrink: 0; border-left: 1px solid var(--border); padding-left: 16px; position: sticky; top: 0; }
.feed-aside-title { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); margin-bottom: 10px; }
.feed-trend-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 7px 8px; border-radius: 7px; border: none; background: transparent; color: var(--text); cursor: pointer; text-align: left; }
.feed-trend-row:hover { background: rgba(255,255,255,.04); }
.feed-trend-name { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-trend-count { font-size: 11px; font-weight: 700; color: var(--accent, #3b82f6); background: rgba(59,130,246,.12); border-radius: 999px; padding: 1px 8px; }

/* News detail drawer */
.news-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 60; display: flex; justify-content: flex-end; }
.news-drawer { width: min(900px, 96vw); height: 100%; background: var(--bg-elev); border-left: 1px solid var(--border); overflow-y: auto; position: relative; animation: newsslide .18s ease; }

/* Bell Data Intelligence scale/freshness stats (Market Feed sidebar) */
.feed-bdi-stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 18px; }
.feed-bdi-stat { flex: 1 1 96px; min-width: 90px; background: var(--bg-elev-2, var(--bg-elev)); border: 1px solid var(--border); border-radius: 9px; padding: 10px 11px; display: flex; flex-direction: column; gap: 2px; }
.feed-bdi-stat b { font-size: 17px; line-height: 1; color: var(--text); font-feature-settings: "tnum"; white-space: nowrap; }
.feed-bdi-stat span { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.feed-bdi-stat.feed-bdi-fresh b { color: var(--green, #6fcf97); }
@keyframes newsslide { from { transform: translateX(20px); opacity: .6; } to { transform: none; opacity: 1; } }
.news-close { position: absolute; top: 12px; right: 12px; z-index: 2; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border); background: var(--bg); color: var(--text-muted); cursor: pointer; }
.news-hero { width: 100%; height: 180px; background-size: cover; background-position: center; }
.news-drawer-body { padding: 18px 20px 28px; }
.news-title { font-size: 19px; line-height: 1.3; margin: 8px 0 6px; color: var(--text); }
.news-sub { font-size: 12px; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.news-summary { font-size: 13.5px; line-height: 1.6; color: var(--text-muted); }
.news-section-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); margin: 16px 0 8px; }
.news-source-link { display: inline-block; margin-top: 18px; padding: 9px 16px; border-radius: 8px; background: var(--accent, #3b82f6); color: #fff; font-size: 13px; font-weight: 600; text-decoration: none; }
.news-source-link:hover { filter: brightness(1.1); }

.reveal-banner {
  margin-top: 10px; padding: 10px 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  background: var(--bg-elev-2, rgba(255,255,255,0.03));
  border: 1px dashed var(--border); border-radius: 8px;
  font-size: 12px; color: var(--text-muted);
}

/* ComingSoon placeholder */
.coming-soon {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: 80px 40px;
  color: var(--text-muted);
  flex: 1;
}
.coming-soon .cs-mark {
  font-size: 48px;
  color: var(--accent);
  margin-bottom: 12px;
  text-shadow: 0 0 24px rgba(91, 140, 255, .4);
}
.coming-soon h2 {
  margin: 0 0 8px;
  font-size: 18px; color: var(--text);
  letter-spacing: .3px;
}
.coming-soon p { max-width: 420px; font-size: 13px; }

.boot-loader {
  display: flex; align-items: center; justify-content: center;
  height: 100vh; color: var(--text-muted);
}

/* Top bar — command-center feel */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 18px;
  background:
    linear-gradient(180deg, #161b2c 0%, var(--bg-elev) 100%);
  border-bottom: 1px solid var(--border);
  box-shadow: inset 0 -1px 0 rgba(91, 140, 255, .12);
}
.topbar .brand {
  font-weight: 700; letter-spacing: 1.5px;
  font-size: 13px;
  text-transform: uppercase;
}
.topbar .brand .sub {
  color: var(--accent-bright); font-weight: 500; margin-left: 6px;
  letter-spacing: 2px; font-size: 11px;
}
.topbar nav { display: flex; gap: 4px; margin-left: 16px; }
.topbar nav button {
  background: transparent; border: 1px solid transparent;
  color: var(--text-muted); padding: 6px 12px; border-radius: 6px;
  cursor: pointer; font: inherit;
}
.topbar nav button:hover { color: var(--text); background: var(--bg-elev-2); }
.topbar nav button.active {
  color: var(--text); background: var(--accent-fade);
  border-color: var(--accent);
  box-shadow: var(--accent-glow);
  text-shadow: 0 0 8px rgba(139, 176, 255, .5);
}
.topbar .spacer { flex: 1; }
.topbar .status {
  font-size: 12px; color: var(--text-muted);
  display: flex; align-items: center; gap: 6px;
}
.topbar .status .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green);
}
.topbar .status .dot.down { background: var(--red); }

/* Stat cards row */
.stats-row {
  display: grid; gap: 12px; padding: 12px 18px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  background: var(--bg);
}
.stat-card {
  position: relative;
  background:
    linear-gradient(135deg, rgba(91, 140, 255, .05) 0%, transparent 60%),
    var(--bg-elev);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 14px;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: .4;
}
.stat-card .label {
  color: var(--text-muted); font-size: 10px; text-transform: uppercase; letter-spacing: 1.2px;
  font-weight: 600;
}
.stat-card .value {
  font-size: 24px; font-weight: 700; margin-top: 4px;
  font-feature-settings: "tnum";
  letter-spacing: -.3px;
}
.stat-card .sub { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

/* Toolbar above the grid */
.grid-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
}
.grid-toolbar input[type="text"],
.grid-toolbar select {
  background: var(--bg-elev-2); border: 1px solid var(--border);
  color: var(--text); padding: 6px 10px; border-radius: 6px;
  font: inherit;
}
.grid-toolbar input[type="text"] { min-width: 240px; }
.grid-toolbar .count { color: var(--text-muted); font-size: 12px; }
.grid-toolbar .spacer { flex: 1; }
.grid-toolbar button {
  background: var(--bg-elev-2); border: 1px solid var(--border);
  color: var(--text); padding: 6px 12px; border-radius: 6px;
  cursor: pointer; font: inherit;
}
.grid-toolbar button:hover { border-color: var(--accent); }
.grid-toolbar button:disabled { opacity: .4; cursor: default; }

/* Bulk action bar (appears when rows are selected) */
.bulk-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 18px;
  background: var(--accent-fade);
  border-bottom: 1px solid var(--accent);
  font-size: 13px;
}
.bulk-bar strong { color: var(--text); }
.bulk-bar .spacer { flex: 1; }
.bulk-bar button {
  background: var(--bg-elev-2); color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 10px; border-radius: 6px;
  cursor: pointer; font: inherit;
}
.bulk-bar button:hover { border-color: var(--accent); }
.bulk-bar button.accent {
  background: var(--accent); color: white; border-color: var(--accent);
}

/* Per-row pick column (checkboxes) */
.grid th.pick, .grid td.pick { width: 28px; padding-right: 0; }
.grid tr.selected td { background: var(--accent-fade); }
.grid input[type="checkbox"] {
  width: 14px; height: 14px; cursor: pointer;
  accent-color: var(--accent);
}

/* Data grid */
.grid-wrap {
  flex: 1; overflow: auto;
  background: var(--bg);
}
.grid {
  width: 100%; border-collapse: separate; border-spacing: 0;
  font-size: 13px;
  table-layout: fixed;            /* fixed widths so rows don't jump across pages */
}
.grid th, .grid td {
  border-bottom: 1px solid var(--border);
  padding: 6px 8px;
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;        /* truncate long values, full value visible in drawer */
}

/* Per-column widths for the Companies grid (and Archived) */
.grid col.pick      { width: 30px; }
.grid col.logo      { width: 32px; }
.grid col.name      { width: 200px; }
.grid col.sources   { width: 90px; }
.grid col.status    { width: 100px; }
.grid col.industry  { width: 148px; }
.grid col.city      { width: 96px; }
.grid col.employees { width: 96px; }
.grid col.contacts  { width: 168px; }
.grid col.bellscore { width: 62px; }
.grid col.stages    { width: 96px; }
/* Don't clip the Reveal button / stage bar (esp. Safari) — overflow into the
   trailing flex spacer is fine since it's empty. */
.grid td.stages-cell, .grid th:nth-last-child(2) { overflow: visible; }
/* Trailing spacer absorbs leftover width so real columns stay snug + left-packed
   with no extra gaps between them. */
.grid col.flex      { width: auto; }
.grid th.flex, .grid td.flex { padding: 0; border-bottom: 1px solid var(--border); }
.grid td.employees, .grid td.bellscore { text-align: left; font-feature-settings: "tnum"; }

/* Make links inside the grid pop on dark background */
.grid td a {
  color: var(--accent-bright);
  text-decoration: underline;
  text-decoration-color: rgba(139, 176, 255, .4);
}
.grid td a:hover { text-decoration-color: var(--accent-bright); }

/* Contact icons (Email / Phone / LinkedIn / Instagram / Facebook) */
.contact-icons {
  display: inline-flex; gap: 6px; align-items: center;
}
.contact-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px;
  border-radius: 4px;
  color: var(--text-dim);
  background: transparent;
  transition: color .12s ease, background .12s ease;
  cursor: default;
}
.contact-icon.on {
  color: var(--accent-bright);
  background: rgba(91, 140, 255, .12);
}
.contact-icon.on:hover { background: rgba(91, 140, 255, .25); }
a.contact-icon.on { cursor: pointer; text-decoration: none; position: relative; }
.contact-count {
  position: absolute;
  top: -4px; right: -6px;
  min-width: 13px; height: 13px;
  padding: 0 3px;
  border-radius: 7px;
  background: var(--accent-bright);
  color: #0d1018;
  font-size: 9px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 1;
}
.grid th {
  position: sticky; top: 0; z-index: 1;
  background: var(--bg-elev);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.grid tr:hover td { background: var(--bg-elev); }
.grid td.editable { cursor: text; }
.grid td.editable:hover { background: var(--accent-fade); }
.grid td.bin { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text-muted); }
.grid td.unassembled { color: var(--text-dim); font-style: italic; }
.grid td input.cell-edit {
  width: 100%;
  background: var(--bg-elev-2);
  border: 1px solid var(--accent);
  color: var(--text); padding: 4px 6px; border-radius: 4px;
  font: inherit;
}
.grid td.linkedin a { color: var(--accent); text-decoration: none; }
.grid td.linkedin a:hover { text-decoration: underline; }

/* Company name cell — name on first line, source badges below */
.name-cell { display: flex; flex-direction: column; gap: 3px; line-height: 1.25; min-width: 0; }
.name-cell-main { font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.source-records-line { display: flex; flex-wrap: wrap; gap: 2px; line-height: 1.2; }

/* ----- ContactsList (drawer Contact group) ----- */
.contacts-list { display: flex; flex-direction: column; gap: 10px; }
.contact-group { display: flex; flex-direction: column; gap: 4px; }
.contact-group-h {
  font-size: 11px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--text-muted); margin-bottom: 2px;
}
.contact-group-empty { padding: 2px 0 4px 4px; opacity: .5; font-style: italic; }
.contact-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; padding: 5px 8px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 12px;
}
.contact-row-main { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.contact-row-main a { color: var(--accent-bright); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-row-main a:hover { text-decoration: underline; }
.contact-row-meta { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.contact-primary-pill {
  background: var(--accent-fade); color: var(--accent-bright);
  font-size: 9px; font-weight: 600; padding: 1px 5px; border-radius: 3px;
  text-transform: uppercase; letter-spacing: .5px;
}
.linkbtn {
  background: none; border: 0; color: var(--text-muted); cursor: pointer;
  padding: 2px 5px; font-size: 12px; border-radius: 3px;
}
.linkbtn:hover { background: var(--bg-elev); color: var(--text); }
.linkbtn.danger:hover { color: var(--red); }

.contact-add {
  display: flex; gap: 6px; align-items: center;
  margin-top: 4px; padding: 6px;
  background: var(--bg-elev-2); border: 1px dashed var(--border);
  border-radius: 5px;
}
.contact-add select, .contact-add input {
  background: var(--bg-elev); border: 1px solid var(--border);
  color: var(--text); padding: 4px 6px; border-radius: 4px; font: inherit;
  font-size: 12px;
}
.contact-add input { flex: 1; min-width: 0; }
.contact-add button {
  background: var(--accent); color: white; border: 0; border-radius: 4px;
  padding: 4px 10px; cursor: pointer; font-size: 12px; font-weight: 500;
}
.contact-add button:disabled { opacity: .4; cursor: not-allowed; }

/* Stage badges (5 dots per row) */
.stage-bar { display: inline-flex; gap: 3px; }
.stage-dot {
  width: 12px; height: 12px; border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elev-2);
}
.stage-dot.pending { background: var(--bg-elev-2); }
.stage-dot.running { background: var(--amber); animation: pulse 1.4s ease-in-out infinite; box-shadow: 0 0 8px rgba(251, 191, 36, .6); }
.stage-dot.done    { background: var(--green); box-shadow: var(--green-glow); }
.stage-dot.no_data { background: var(--text-dim); }
.stage-dot.failed  { background: var(--red); box-shadow: 0 0 8px rgba(248, 113, 113, .5); }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* Pills */
.pill {
  display: inline-block; padding: 2px 8px;
  border-radius: 10px; font-size: 11px;
  background: var(--bg-elev-2); border: 1px solid var(--border);
  color: var(--text-muted);
}
.pill.active { color: var(--green); border-color: var(--green); }
.pill.inactive { color: var(--text-dim); border-color: var(--border); }

/* Settings — full-height shell with secondary sidebar + scrolling body */
.settings-shell {
  display: flex;
  flex: 1;
  width: 100%;
  min-height: 0;
  overflow: hidden;
}
.settings-rail {
  width: 220px; flex-shrink: 0;
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  padding: 18px 12px;
  display: flex; flex-direction: column; gap: 2px;
  overflow-y: auto;
}
.settings-rail-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--text-dim);
  padding: 0 10px 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.settings-rail-item {
  display: block;
  width: 100%; padding: 9px 12px;
  background: transparent; border: 0; border-radius: 6px;
  color: #c9d2e6;
  font: inherit; font-size: 13px; font-weight: 500;
  text-align: left; cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.settings-rail-item:hover { background: var(--bg-elev-2); color: #ffffff; }
.settings-rail-item.active {
  background: var(--accent-fade);
  color: var(--accent-bright);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--accent);
}

.settings-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
  display: flex; flex-direction: column; gap: 20px;
  /* Full available width — no max-width cap. */
}
.settings-body h2 { margin: 0 0 8px; font-size: 16px; }
.settings-body .card {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 8px;
  padding: 18px 20px;
  scroll-margin-top: 12px;
}
.settings-body .row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.settings-body .row label { width: 160px; color: var(--text-muted); font-size: 13px; }
.settings-body .row input {
  flex: 1; background: var(--bg-elev-2); border: 1px solid var(--border);
  color: var(--text); padding: 8px 12px; border-radius: 6px; font: inherit;
}
.settings-body .row .actions { display: flex; gap: 6px; align-items: center; }
.settings-body button {
  background: var(--accent); color: white; border: 0;
  padding: 8px 14px; border-radius: 6px; cursor: pointer; font: inherit;
}
.settings-body button.danger { background: var(--bg-elev-2); color: var(--red); border: 1px solid var(--red); }
.settings-body .hint { color: var(--text-dim); font-size: 12px; margin-top: 6px; }
.settings-body .key-status {
  font-size: 12px;
  padding: 2px 8px; border-radius: 10px;
  background: var(--bg-elev-2); border: 1px solid var(--border);
  color: var(--text-muted);
}
.settings-body .key-status.set { color: var(--green); border-color: var(--green); }

/* Toast (saved confirmation) */
.toast {
  position: fixed; bottom: 20px; right: 20px;
  background: var(--bg-elev); border: 1px solid var(--border);
  padding: 10px 16px; border-radius: 8px;
  box-shadow: var(--shadow);
  font-size: 13px;
}
.toast.success { border-color: var(--green); color: var(--green); }
.toast.error   { border-color: var(--red); color: var(--red); }

.empty {
  text-align: center; padding: 60px 20px;
  color: var(--text-dim);
}

.linkbtn {
  background: none; border: 0; color: var(--accent);
  cursor: pointer; padding: 0; font: inherit;
}
.linkbtn:hover { text-decoration: underline; }

.muted { color: var(--text-muted); }
.small { font-size: 12px; }

/* Sources tab */
.sources-wrap { padding: 18px; }
.sources-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.source-card {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.source-card.is-running { border-color: var(--amber); }
.source-card-head { display: flex; align-items: baseline; justify-content: space-between; }
.source-card-title strong { font-size: 16px; margin-right: 8px; }
.source-card-body {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.source-stat { background: var(--bg-elev-2); border-radius: 6px; padding: 8px 10px; }
.source-stat .label { color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.source-stat .value { font-size: 18px; font-weight: 600; margin-top: 4px; }
.source-stat .sub   { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.source-card-actions { display: flex; gap: 8px; }
.source-card-actions button {
  flex: 1;
  background: var(--bg-elev-2); color: var(--text);
  border: 1px solid var(--border);
  padding: 8px; border-radius: 6px; cursor: pointer; font: inherit;
}
.source-card-actions button:hover:not(:disabled) { border-color: var(--accent); }
.source-card-actions button:disabled { opacity: .5; cursor: not-allowed; }
.source-card-recent {
  display: flex; flex-direction: column; gap: 4px;
  border-top: 1px dashed var(--border); padding-top: 8px;
}
.recent-job {
  display: grid; grid-template-columns: 60px 80px 1fr auto; gap: 6px;
  font-size: 12px;
}
.recent-job .kind { color: var(--text-muted); text-transform: uppercase; font-size: 10px; padding-top: 1px; }
.recent-job .status { font-weight: 500; }
.recent-job.running .status   { color: var(--amber); }
.recent-job.completed .status { color: var(--green); }
.recent-job.failed .status    { color: var(--red); }
.recent-job .summary { color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Job log panel */
.job-log {
  position: fixed;
  bottom: 0; right: 18px;
  width: min(720px, calc(100% - 36px));
  max-height: 50vh;
  background: var(--bg-elev); border: 1px solid var(--border); border-bottom: 0;
  border-radius: 8px 8px 0 0;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow);
  z-index: 5;
}
.job-log-head {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev-2);
}
.job-log-head .spacer { flex: 1; }
.job-log-head button { margin-left: 8px; }
.job-log-body {
  overflow: auto; padding: 10px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}
.log-line {
  display: flex; gap: 12px; padding: 1px 0;
  color: var(--text);
}
.log-line .ts { color: var(--text-dim); flex-shrink: 0; }
.log-line.muted { color: var(--text-dim); }

/* Grid + detail panel split layout */
.grid-pane {
  flex: 1;
  display: flex;
  min-height: 0;          /* allow children to shrink for overflow */
  position: relative;     /* anchor for the floating filter panel */
}
.grid-pane .grid-wrap {
  flex: 1;
  min-width: 0;
  border-right: 1px solid var(--border);
}

/* Company logo (cell + placeholder) */
.company-logo {
  display: inline-flex;
  align-items: center; justify-content: center;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: white;
  font-weight: 600;
  vertical-align: middle;
  flex-shrink: 0;
  object-fit: cover;
}
.company-logo.placeholder { font-family: ui-sans-serif, system-ui; }

.grid th.logo-col, .grid td.logo-col { width: 34px; padding-right: 0; padding-left: 6px; }

.grid tr { cursor: pointer; }
/* Map view (Mapbox GL JS) */
.map-shell {
  position: relative;
  flex: 1;
  display: flex;
  min-height: 0;
  background: var(--bg);
}
.map-container {
  flex: 1;
  width: 100%;
  height: 100%;
}
.map-loading {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 14px;
  z-index: 1;
  pointer-events: none;
}
.map-overlay {
  position: absolute; inset: 0;
  background: rgba(13, 16, 24, 0.92);
  display: flex; align-items: center; justify-content: center;
  z-index: 10;
}
.map-overlay-card {
  max-width: 480px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px 26px;
  box-shadow: 0 8px 40px rgba(0,0,0,.6);
}
.map-overlay-card h3 { margin: 0 0 8px; font-size: 17px; }
.map-overlay-card p { margin: 6px 0; }
.map-overlay-card a { color: var(--accent-bright); }
.map-stats {
  /* Bottom-right corner — sits ABOVE the ScaleControl (which Mapbox renders
     at bottom-right with ~24px height) so they don't overlap. */
  position: absolute; bottom: 38px; right: 12px;
  background: rgba(20, 24, 36, 0.92);
  border: 1px solid var(--border);
  padding: 6px 12px; border-radius: 6px;
  font-size: 12px; color: var(--text);
  z-index: 2;
  backdrop-filter: blur(4px);
}

/* Custom popup styling — overrides Mapbox's default light theme so the popup
   matches the rest of the dark UI. Class .map-popup is set in MapTab.js. */
.map-popup .mapboxgl-popup-content {
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.55);
  font: 13px/1.45 system-ui, -apple-system, sans-serif;
}
.map-popup .mapboxgl-popup-tip {
  border-top-color: var(--bg-elev);
  border-bottom-color: var(--bg-elev);
}
.map-popup .mapboxgl-popup-close-button {
  color: var(--text-muted);
  font-size: 18px; line-height: 1;
  padding: 6px 8px;
  background: transparent;
}
.map-popup .mapboxgl-popup-close-button:hover {
  color: var(--text);
  background: var(--bg-elev-2);
  border-radius: 4px;
}
.map-popup-body { padding-right: 14px; /* leave room for close button */ }
.map-popup-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);                  /* full-strength text — readable */
  margin-bottom: 6px;
  line-height: 1.3;
}
.map-popup-line {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.map-popup-link {
  display: inline-block;
  margin-top: 8px;
  color: var(--accent-bright);
  text-decoration: none;
  font-weight: 500;
  font-size: 12.5px;
}
.map-popup-link:hover { text-decoration: underline; }

/* Attribution + logo — Mapbox TOS requires both stay visible, so we minimise
   them via opacity. Hover reveals at full strength. */
.mapboxgl-ctrl-bottom-left .mapboxgl-ctrl-logo,
.mapboxgl-ctrl-attrib.mapboxgl-compact {
  opacity: 0.32;
  transition: opacity .15s ease;
}
.mapboxgl-ctrl-bottom-left:hover .mapboxgl-ctrl-logo,
.mapboxgl-ctrl-bottom-left:hover .mapboxgl-ctrl-attrib.mapboxgl-compact {
  opacity: 1;
}
.mapboxgl-ctrl-attrib.mapboxgl-compact {
  background: rgba(20, 24, 36, 0.78);
  border-radius: 12px;
}
.mapboxgl-ctrl-attrib.mapboxgl-compact-show {
  background: rgba(20, 24, 36, 0.95);
  color: var(--text);
  opacity: 1;
}
.mapboxgl-ctrl-attrib a { color: var(--accent-bright); }

/* Layer / source control panel (top-left under the geocoder) */
.map-controls {
  position: absolute;
  top: 60px; left: 10px;
  z-index: 3;
  background: rgba(20, 24, 36, 0.92);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 10px;
  min-width: 200px;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
.map-controls-section { display: flex; flex-direction: column; gap: 6px; }
.map-controls-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--text-dim); font-weight: 700;
}
.map-toggle {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; font-size: 12px; color: var(--text);
  user-select: none;
}
.map-toggle input { accent-color: var(--accent-bright); cursor: pointer; }
.map-source-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.map-source-chip {
  background: rgba(13, 16, 24, 0.55);
  border: 1px solid;          /* color set inline */
  padding: 3px 8px; border-radius: 10px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .3px;
  cursor: pointer;
  transition: background .12s ease, opacity .12s ease;
}
.map-source-chip.off { opacity: 0.4; border-color: var(--border) !important; }
.map-source-chip:hover { background: rgba(91, 140, 255, 0.15); }
.map-flyto-btn,
.map-tool-btn,
.map-tool-btn-secondary {
  background: var(--bg-elev-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 5px 10px;
  font-size: 11.5px;
  border-radius: 5px; cursor: pointer;
  transition: color .12s ease, border-color .12s ease, background .12s ease;
  text-align: left;
}
.map-flyto-btn:hover,
.map-tool-btn:hover,
.map-tool-btn-secondary:hover { color: var(--text); border-color: var(--accent); }
.map-tool-btn.active {
  background: var(--accent-fade);
  color: var(--accent-bright);
  border-color: var(--accent-bright);
}
.map-tool-btn-secondary {
  font-size: 10.5px;
  padding: 3px 10px;
  color: var(--text-dim);
}

.map-toggle-hint {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--text-dim);
  margin-left: auto;
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 3px;
}

.map-year-row { display: flex; align-items: center; gap: 8px; }
.map-year-val {
  font-size: 11px; font-weight: 700;
  color: var(--accent-bright);
  min-width: 38px;
  font-variant-numeric: tabular-nums;
}
.map-year-slider {
  flex: 1; min-width: 0;
  accent-color: var(--accent-bright);
  height: 4px;
}

/* Lasso result panel — bottom-center */
.map-lasso-result {
  position: absolute;
  bottom: 50px; left: 50%; transform: translateX(-50%);
  z-index: 3;
  background: rgba(20, 24, 36, 0.96);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 10px 16px;
  display: flex; align-items: center; gap: 14px;
  backdrop-filter: blur(8px);
  box-shadow: 0 6px 24px rgba(0,0,0,.55);
  max-width: 720px;
}
.map-lasso-count {
  font-size: 14px; color: var(--text);
}
.map-lasso-count strong {
  color: var(--accent-bright);
  font-size: 18px;
  margin-right: 4px;
}

/* Mapbox Draw plugin — match dark theme */
.mapboxgl-canvas-container.mapboxgl-interactive.mouse-pointer { cursor: pointer; }
.mapbox-gl-draw_polygon {
  background-color: var(--bg-elev) !important;
}
/* Draw vertices/lines: keep the plugin defaults — they're already visible. */

/* Geocoder (search box) — re-skin to match dark theme.
   Must sit ABOVE .map-controls (z-index 3) so its suggestion dropdown isn't
   clipped behind the layer panel. */
.mapboxgl-ctrl-top-left { z-index: 10; }
.mapboxgl-ctrl-geocoder {
  background: rgba(20, 24, 36, 0.95);
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
  min-width: 260px;
  border-radius: 8px;
  color: var(--text);
}
.mapboxgl-ctrl-geocoder input {
  background: transparent;
  color: var(--text);
  font: inherit; font-size: 13px;
  padding: 9px 35px;
}
.mapboxgl-ctrl-geocoder input::placeholder { color: var(--text-muted); }
.mapboxgl-ctrl-geocoder svg { fill: var(--text-muted); }
.mapboxgl-ctrl-geocoder--icon-search { left: 10px; top: 9px; }
.suggestions {
  background: var(--bg-elev) !important;
  border: 1px solid var(--border) !important;
  border-radius: 6px !important;
  margin-top: 4px !important;
}
.suggestions > li > a {
  color: var(--text) !important;
  background: transparent !important;
  border-bottom: 1px solid var(--border) !important;
  font-size: 12.5px !important;
}
.suggestions > li > a:hover,
.suggestions > .active > a {
  background: var(--accent-fade) !important;
  color: var(--accent-bright) !important;
}

/* Spider expand markers */
.map-spider-marker {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid #0d1018;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,.6);
  transition: transform .12s ease;
}
.map-spider-marker:hover { transform: scale(1.4); }

/* Editable kv rows in drawers — double-click to edit */
.kv.editable-kv          { cursor: text; border-radius: 4px; padding: 2px 4px; margin: 0 -4px; transition: background .12s ease; }
.kv.editable-kv:hover    { background: var(--accent-fade); }
.kv.editable-kv.editing  { background: var(--bg-elev-2); }
.kv.readonly             { color: var(--text-muted); }
.kv-edit-input {
  width: 100%;
  background: var(--bg-elev-2);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 4px 6px; border-radius: 4px;
  font: inherit; font-size: 13px;
}
.kv-bool-toggle {
  background: none; border: 0; padding: 0; cursor: pointer;
}
.readonly-json {
  margin: 0; font-size: 11px; color: var(--text-muted);
  max-height: 200px; overflow: auto;
  background: var(--bg); padding: 6px 8px; border-radius: 4px;
}

/* Dedup Queue (Phase 5) */
.dedup-shell {
  display: flex; flex-direction: column;
  flex: 1; min-height: 0;
}
.dedup-header {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
}
.dedup-header-stats { flex: 1; min-width: 0; font-size: 13px; color: var(--text); }
.dedup-header-stats strong { color: var(--accent-bright); }
.dedup-header-actions { display: flex; gap: 8px; }
.dedup-header-actions button {
  background: var(--bg-elev-2); color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 6px 12px; border-radius: 5px; cursor: pointer; font: inherit; font-size: 12px;
}
.dedup-header-actions button:hover { color: var(--text); border-color: var(--accent); }
.dedup-header-actions button.accent {
  background: var(--accent); color: white; border: 0; font-weight: 500;
}
.dedup-header-actions button.accent:disabled { opacity: .5; cursor: not-allowed; }

.dedup-list {
  flex: 1; overflow-y: auto;
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 14px;
}
.dedup-list .empty {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted); line-height: 1.6;
}

.dedup-pair {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.dedup-pair-head {
  display: flex; align-items: center; gap: 14px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev-2);
}
.dedup-pair-score strong { color: var(--accent-bright); font-size: 18px; }
.dedup-pair-reasons { flex: 1; display: flex; flex-wrap: wrap; gap: 3px; }

.dedup-pair-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
}
.dedup-side {
  background: var(--bg-elev);
  padding: 12px 14px;
}
.dedup-side.empty { color: var(--text-dim); padding: 20px; text-align: center; }
.dedup-side-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--accent-bright); font-weight: 700;
  margin-bottom: 8px;
}
.dedup-side-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.dedup-side-table th {
  text-align: left;
  color: var(--text-muted); font-weight: 500;
  padding: 3px 0; width: 130px; vertical-align: top;
}
.dedup-side-table td {
  color: var(--text);
  padding: 3px 0;
  word-break: break-word;
}

.dedup-pair-actions {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}
.dedup-pair-actions button {
  background: var(--bg-elev); color: var(--text);
  border: 1px solid var(--accent); padding: 6px 12px;
  font: inherit; font-size: 12px; font-weight: 500;
  border-radius: 5px; cursor: pointer;
  transition: background .12s ease;
}
.dedup-pair-actions button:hover:not(:disabled) {
  background: var(--accent-fade);
}
.dedup-pair-actions button:disabled { opacity: .4; cursor: not-allowed; }
.dedup-pair-actions button.ghost {
  border-color: var(--border); color: var(--text-muted);
}
.dedup-pair-actions .spacer { flex: 1; }

/* ---------------------------------------------------------------------------
   Dense Dedup Queue listing (added 2026-05-23). Replaces the old stacked
   .dedup-pair cards with one compact row per pair + click-to-expand body.
   --------------------------------------------------------------------------- */
.dedup-list-wrap {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 12px 16px 24px;
}
.dedup-list-empty {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted); line-height: 1.6;
}

.dedup-listing {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elev);
  overflow: hidden;
}
.dedup-listing-head,
.dedup-line-summary {
  display: grid;
  grid-template-columns: 64px minmax(0, 1.4fr) minmax(0, 1fr) 28px;
  align-items: center;
  gap: 12px;
}
.dedup-listing-head {
  padding: 8px 14px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-muted);
  background: var(--bg-elev-2);
  border-bottom: 1px solid var(--border);
}
.dedup-listing-foot {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-elev-2);
  text-align: center;
}

.dedup-line { border-bottom: 1px solid var(--border); }
.dedup-line:last-of-type { border-bottom: 0; }

.dedup-line-summary {
  width: 100%;
  padding: 9px 14px;
  background: transparent;
  border: 0;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .12s ease;
}
.dedup-line-summary:hover { background: var(--bg-elev-2); }
.dedup-line.open > .dedup-line-summary { background: var(--bg-elev-2); }

.dl-col-score {
  font-weight: 700;
  font-size: 13px;
  text-align: center;
  padding: 2px 0;
  border-radius: 4px;
}
.dl-col-score.score-high { color: #fff;        background: var(--accent); }
.dl-col-score.score-med  { color: #fbbf24;     background: rgba(251,191,36,.10); }
.dl-col-score.score-low  { color: var(--text-muted); background: rgba(255,255,255,.04); }

.dl-col-names {
  display: flex; align-items: center; gap: 8px;
  min-width: 0;
  font-size: 13px;
}
.dl-name {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dl-arrow { flex: 0 0 auto; font-size: 11px; }

.dl-col-reasons {
  display: flex; flex-wrap: wrap; gap: 3px;
  min-width: 0;
}
.dl-col-toggle {
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
}

.dedup-line-body {
  padding: 0 0 12px 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
}
.dedup-line-body .dedup-pair-body {
  margin: 0;
}
.dedup-line-body .dedup-pair-actions {
  border-top: 1px solid var(--border);
}

/* Toolbar toggle button (e.g. "View Archived" / "View Active") */
.toolbar-toggle {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 5px 11px;
  border-radius: 5px;
  font: inherit; font-size: 12px; font-weight: 500;
  cursor: pointer;
  transition: color .12s ease, border-color .12s ease, background .12s ease;
}
.toolbar-toggle:hover {
  color: var(--text);
  border-color: var(--accent);
  background: var(--accent-fade);
}

/* Selection states — clear-but-professional. Solid tint across the whole row,
   bright left accent on the opened row, and a faint right accent for selected.
   No harsh column separations.
   - .opened   : the row currently shown in the side drawer
   - .selected : multi-select checkbox checked  */
.grid tr.selected td {
  background: rgba(91, 140, 255, 0.18);
}
.grid tr.opened td {
  background: rgba(91, 140, 255, 0.22);
  color: var(--text);
}
.grid tr.opened td:first-child {
  box-shadow: inset 3px 0 0 var(--accent-bright);
}
.grid tr.selected td:last-child {
  box-shadow: inset -2px 0 0 rgba(139, 176, 255, .6);
}
.grid tr.selected.opened td {
  background: rgba(91, 140, 255, 0.26);
}
.grid tr.selected.opened td:first-child {
  box-shadow: inset 3px 0 0 var(--accent-bright);
}
.grid tr.opened:hover td   { background: rgba(91, 140, 255, 0.28); }
.grid tr.selected:hover td { background: rgba(91, 140, 255, 0.22); }
/* Make the row text slightly stronger when selected */
.grid tr.selected td,
.grid tr.opened   td { font-weight: 500; }

/* Embedded detail panel (persistent right-side pane) */
.detail-side {
  width: 420px; flex-shrink: 0;
  display: flex; flex-direction: column;
  background:
    radial-gradient(circle at top right, rgba(91, 140, 255, .06), transparent 60%),
    var(--bg-elev);
  overflow: hidden;
  border-left: 1px solid var(--border);
  box-shadow: inset 1px 0 0 rgba(91, 140, 255, .08);
}
.detail-side.empty-state {
  align-items: center; justify-content: center;
  padding: 24px;
  text-align: center;
}

.detail-head {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap;                /* let the admin buttons drop below rather than squeeze the name */
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev-2);
}
.detail-head .detail-title {
  display: flex; flex-direction: column; gap: 2px;
  min-width: 140px; flex: 1 1 60%;   /* floor so the name never collapses to one-letter-per-line */
}
.detail-head .detail-title .bin {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text-muted); font-size: 11px;
}
.detail-head .detail-title strong {
  font-size: 14px;
  white-space: normal; overflow-wrap: break-word; word-break: normal; line-height: 1.3;
}
.detail-status-row { display: flex; gap: 4px; flex-wrap: wrap; }

/* archive button row removed — feature deferred */

.detail-tabs {
  display: flex; gap: 2px;
  padding: 6px 8px; border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
}
.detail-tabs button {
  flex: 1;
  background: transparent; border: 1px solid transparent;
  color: var(--text-muted);
  padding: 5px 8px; border-radius: 5px; cursor: pointer; font: inherit;
  font-size: 12px;
  white-space: nowrap;
}
.detail-tabs button.active {
  color: var(--text);
  background: var(--accent-fade);
  border-color: var(--accent);
}
.detail-body { flex: 1; overflow: auto; padding: 12px 14px; }

.overview .group {
  background: var(--bg-elev-2); border: 1px solid var(--border);
  border-radius: 8px; margin-bottom: 12px; padding: 10px 12px;
}
.overview .group h3 {
  margin: 0 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-muted); font-weight: 500;
}
.overview dl { display: grid; grid-template-columns: 130px 1fr; gap: 4px 10px; margin: 0; }
.overview .kv { display: contents; }
.overview dt {
  color: var(--text-muted); padding: 3px 0; font-size: 11px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.overview dd {
  margin: 0; padding: 3px 0; word-break: break-word; font-size: 12px;
  border-bottom: 1px dashed var(--border);
  min-width: 0; overflow: hidden;
}
.overview dd a { color: var(--accent-bright); text-decoration: underline; text-decoration-color: rgba(139, 176, 255, .35); }
.overview dd a:hover { text-decoration-color: var(--accent-bright); }
.overview dd pre {
  background: var(--bg); border-radius: 4px; padding: 5px 7px;
  font-size: 10px; white-space: pre-wrap; word-break: break-word; overflow: auto;
  max-height: 180px; margin: 0;
}
.source-block details.rawpayload {
  margin-top: 6px;
  background: var(--bg); border-radius: 4px; padding: 5px 7px;
}
.source-block details.rawpayload summary { cursor: pointer; color: var(--accent); font-size: 11px; }
.source-block details.rawpayload[open] pre {
  background: transparent; padding: 5px 0; max-height: 320px;
}

/* Link / slug-guess list in the LinkedIn Discovery card */
.link-list { margin: 4px 0 0; padding-left: 4px; list-style: none; font-size: 12px; }
.link-list li {
  margin-bottom: 6px; padding: 4px 6px;
  background: var(--bg); border-radius: 4px;
  display: block;
}
.link-list .use-url-btn {
  display: inline-block;
  background: var(--accent); color: white; border: 0;
  padding: 1px 8px; border-radius: 4px;
  font-size: 10px; font-weight: 600;
  cursor: pointer;
  margin-right: 6px;
}
.link-list .use-url-btn:hover { background: #6e9eff; }
.link-list a { color: var(--accent-bright); word-break: break-all; text-decoration: underline; }

/* Org chart in the company drawer People tab */
.org-chart-wrap { padding-top: 2px; }
.org-chart-summary {
  /* Not sticky — when sticky it floated over the next level's rows as
     the user scrolled, which made names disappear behind it. The summary
     is fine living at the top of the scroll. */
  padding: 6px 0 10px;
  background: var(--bg-elev);
  font-size: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.org-level {
  background: var(--bg-elev-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; margin-bottom: 10px;
}
.org-level-h {
  display: flex; align-items: baseline; gap: 8px;
  margin: 0 0 6px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--text-muted);
}
.org-level-bar {
  display: inline-block;
  width: 3px; height: 14px;
  border-radius: 2px;
  background: var(--accent-bright);
}
.org-level-1 .org-level-bar { background: #fbbf24; box-shadow: 0 0 6px rgba(251,191,36,.4); }
.org-level-2 .org-level-bar { background: #d09bff; box-shadow: 0 0 6px rgba(208,155,255,.35); }
.org-level-3 .org-level-bar { background: #7ec8ff; box-shadow: 0 0 6px rgba(126,200,255,.35); }
.org-level-4 .org-level-bar { background: #7be3a8; box-shadow: 0 0 6px rgba(123,227,168,.3); }
.org-level-5 .org-level-bar { background: #8a93a6; }
.org-level-x .org-level-bar { background: var(--text-dim); }

.org-grid {
  font-size: 12px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
}
.org-grid th {
  background: var(--bg-elev); color: var(--text-muted);
  font-size: 10px; letter-spacing: .5px;
  padding: 5px 8px;
  /* NOT sticky — each level is its own bounded card, so a sticky header
     here would float over the next card's rows when scrolling. */
}
.org-grid td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
}
.org-grid tr.person-row { cursor: pointer; transition: background .12s ease; }
.org-grid tr.person-row:hover td { background: var(--accent-fade); }
.org-grid tr.person-row:hover .person-name { color: var(--accent-bright); }
.org-grid td.person-name { font-weight: 500; }
.org-grid td.person-title { color: var(--text-muted); }
.org-grid td.person-link a { color: var(--accent-bright); font-size: 11px; }

/* Similar companies list */
.similar-list { margin: 0; padding: 0; list-style: none; }
.similar-list li {
  display: flex; gap: 10px; align-items: center; justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.similar-list li:last-child { border-bottom: 0; }
.similar-row { flex: 1; min-width: 0; }
.similar-row a { color: var(--accent-bright); word-break: break-word; text-decoration: underline; }
.similar-actions { display: flex; gap: 4px; flex-shrink: 0; }
.similar-actions button {
  font-size: 11px; padding: 3px 8px; border-radius: 4px;
  border: 1px solid var(--border); background: var(--bg-elev-2); color: var(--text);
  cursor: pointer;
}
.similar-actions button.accent {
  background: var(--accent); color: white; border-color: var(--accent);
}
.similar-actions button:hover { border-color: var(--accent); }

/* ============================================================================
   System pages (Billing / Settings) — full-bleed, modern, Bell vibe.
   ============================================================================ */

/* Align the sidebar brand header bottom border with the content page-header
   bottom border (same height, same baseline). */
.sidebar-brand { height: 56px; padding: 0 14px; box-sizing: border-box; }
.page-header   { height: 56px; padding: 0 18px; box-sizing: border-box; }

/* A system page fills the whole content area (no floating boxes / outer gaps). */
.sys-page { display: flex; flex: 1; width: 100%; min-height: 0; overflow: hidden; }
.sys-body {
  flex: 1; overflow-y: auto; padding: 26px 34px;
}
/* Sections flow as one cohesive surface, separated by a hairline — not cards. */
.sys-section { padding-bottom: 26px; margin-bottom: 26px; border-bottom: 1px solid var(--border); }
.sys-section:last-child { border-bottom: 0; margin-bottom: 0; }
.sys-section > h2 { margin: 0 0 3px; font-size: 15px; font-weight: 700; letter-spacing: .2px; }
.sys-hint { color: var(--text-dim); font-size: 12px; margin: 0 0 18px; max-width: 640px; line-height: 1.5; }

.sys-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; max-width: 760px; }
.sys-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; max-width: 600px; }
.sys-field.full { grid-column: 1 / -1; max-width: 760px; }
.sys-field > label { font-size: 12px; color: var(--text-muted); font-weight: 600; letter-spacing: .2px; }

/* Modern inputs / selects / textareas. */
.sys-input, .sys-select, .sys-textarea {
  width: 100%; box-sizing: border-box;
  background: var(--bg-elev-2); border: 1px solid var(--border); border-radius: 9px;
  color: var(--text); font: inherit; font-size: 13.5px; padding: 10px 13px;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.sys-input::placeholder, .sys-textarea::placeholder { color: var(--text-dim); }
.sys-input:focus, .sys-select:focus, .sys-textarea:focus {
  outline: none; border-color: var(--accent);
  background: var(--bg-elev);
  box-shadow: 0 0 0 3px var(--accent-fade);
}
.sys-input:disabled { opacity: .55; }
.sys-select {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%238a93a6' stroke-width='1.7' stroke-linecap='round'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.sys-textarea { min-height: 96px; resize: vertical; line-height: 1.55; }

/* Buttons */
.sys-btn {
  background: var(--accent); color: #fff; border: 0; border-radius: 9px;
  padding: 10px 18px; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: filter .15s ease, transform .05s ease;
}
.sys-btn:hover { filter: brightness(1.12); }
.sys-btn:active { transform: translateY(1px); }
.sys-btn:disabled { opacity: .55; cursor: default; }
.sys-btn-secondary { background: var(--bg-elev-2); color: var(--text); border: 1px solid var(--border); }
.sys-btn-secondary:hover { filter: none; border-color: var(--accent); }
.sys-actions { display: flex; gap: 10px; margin-top: 6px; }

/* Toggle rows (notifications) */
.sys-toggle { display: flex; align-items: flex-start; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); max-width: 700px; }
.sys-toggle:last-of-type { border-bottom: 0; }
.sys-toggle .sw { margin-top: 2px; }
.sys-toggle .t-title { font-weight: 600; font-size: 13.5px; }
.sys-toggle .t-desc { color: var(--text-dim); font-size: 12px; margin-top: 2px; }

/* Key/value rows used by Billing overview */
.sys-kv { display: flex; align-items: center; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--border); max-width: 640px; font-size: 13.5px; }
.sys-kv:last-of-type { border-bottom: 0; }
.sys-kv .k { width: 180px; color: var(--text-muted); }
.sys-kv .v { color: var(--text); font-weight: 600; }
.sys-pill { padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--border); }

/* Simple table (invoices / ledger) */
.sys-table { width: 100%; border-collapse: collapse; font-size: 13px; max-width: 820px; }
.sys-table th { text-align: left; color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; padding: 8px; font-weight: 600; }
.sys-table td { padding: 10px 8px; border-top: 1px solid var(--border); }
.sys-bar { height: 8px; background: var(--bg-elev-2); border-radius: 999px; overflow: hidden; max-width: 640px; margin: 12px 0 4px; }
.sys-bar > span { display: block; height: 100%; background: var(--accent); }

/* Full-bleed page scaffold (CRM / Research / Market Feed) — fills the content
   area edge-to-edge like the Companies grid: a flush top bar + a filling body. */
.page-fill   { height: 100%; display: flex; flex-direction: column; min-height: 0; }
.page-bar    { display: flex; align-items: center; gap: 16px; padding: 12px 22px;
               border-bottom: 1px solid var(--border); background: var(--bg-elev);
               flex-wrap: wrap; flex-shrink: 0; }
.page-scroll { flex: 1; overflow: auto; padding: 18px 22px; min-height: 0; }
.page-scroll.flush { padding: 0; }

/* The global header must NEVER be compressed by a greedy full-height page body.
   (A flex child with height:100% squeezes its siblings — this kept the header
   from staying its fixed 56px on CRM / Market Feed.) */
.page-header   { flex-shrink: 0; min-height: 56px; }
.sidebar-brand { flex-shrink: 0; min-height: 56px; }
/* Full-bleed pages fill the REMAINING column space, not 100% of it. */
.page-fill { height: auto; flex: 1; min-height: 0; }

/* Market Feed — prominent primary type switch (News / Research / …) + a flush,
   de-boxed status bar so it reads as part of the page, not a floating card. */
.feed-tabs { display: inline-flex; background: var(--bg-elev-2); border: 1px solid var(--border);
             border-radius: 10px; padding: 3px; gap: 2px; margin-bottom: 12px; }
.feed-tab  { padding: 8px 18px; border: 0; border-radius: 8px; background: transparent;
             color: var(--text-muted); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
             transition: background .15s ease, color .15s ease; }
.feed-tab:hover { color: var(--text); }
.feed-tab.active { background: var(--accent); color: #fff; box-shadow: 0 1px 8px rgba(91,140,255,.35); }
.feed-tab.research.active { background: #1f8a5a; box-shadow: 0 1px 8px rgba(31,138,90,.4); }
.feed-cats-label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-dim); margin-right: 6px; }

/* De-box the live-intelligence bar (was a bordered gradient card). */
.feed-scanbar { border: 0; border-radius: 0; background: transparent;
                padding: 2px 0 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }

/* ── Dedup Audit modal ─────────────────────────────────────────────────── */
.audit-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.55); backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 20px; overflow-y: auto;
}
.audit-modal {
  width: min(960px, 100%); background: var(--bg-elev);
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.audit-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg-elev); border-radius: 12px 12px 0 0;
}
.audit-modal-title { font-size: 16px; font-weight: 700; }
.audit-modal-actions { display: flex; gap: 8px; }
.audit-modal-body { padding: 8px 20px 24px; }
.audit-loading { padding: 40px; text-align: center; color: var(--text-dim); }

.audit-verdict {
  margin: 14px 0; padding: 12px 16px; border-radius: 8px; font-weight: 600;
  display: flex; align-items: center; gap: 10px; font-size: 13.5px;
}
.audit-verdict.ok   { background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green); border: 1px solid color-mix(in srgb, var(--green) 40%, transparent); }
.audit-verdict.fail { background: color-mix(in srgb, var(--red)   14%, transparent); color: var(--red);   border: 1px solid color-mix(in srgb, var(--red)   40%, transparent); }
.audit-verdict-icon { font-size: 18px; font-weight: 800; }

.audit-section { margin: 22px 0; }
.audit-section-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.audit-section-title { font-size: 13px; font-weight: 700; letter-spacing: .2px; }

.audit-checks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
@media (max-width: 680px) { .audit-checks { grid-template-columns: 1fr; } }
.audit-check {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 7px; border: 1px solid var(--border);
  background: var(--bg-elev-2); font-size: 12.5px;
}
.audit-check.ok   .audit-check-dot { color: var(--green); }
.audit-check.fail { border-color: color-mix(in srgb, var(--red) 50%, transparent); background: color-mix(in srgb, var(--red) 8%, transparent); }
.audit-check.fail .audit-check-dot { color: var(--red); }
.audit-check-dot { font-weight: 800; }
.audit-check-label { flex: 1; color: var(--text-dim); }
.audit-check-val { font-weight: 700; font-variant-numeric: tabular-nums; }

.audit-stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
@media (max-width: 760px) { .audit-stats { grid-template-columns: repeat(3, 1fr); } }
.audit-stat { padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-elev-2); }
.audit-stat-val { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.audit-stat-label { font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }

.audit-persource { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.audit-chip { font-size: 11px; padding: 3px 9px; border-radius: 20px; background: var(--bg-elev-2); border: 1px solid var(--border); color: var(--text-dim); }
.audit-chip strong { color: var(--text); }

.audit-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.audit-table th { text-align: left; color: var(--text-muted); font-weight: 600; padding: 6px 10px; border-bottom: 1px solid var(--border); }
.audit-table td { padding: 6px 10px; border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent); vertical-align: top; }
.audit-table tr:last-child td { border-bottom: none; }

.audit-status { font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 4px; text-transform: uppercase; letter-spacing: .3px; }
.audit-status.canonical  { background: color-mix(in srgb, var(--green) 18%, transparent); color: var(--green); }
.audit-status.merged_into { background: color-mix(in srgb, var(--amber) 18%, transparent); color: var(--amber); }
.audit-status.standalone { background: var(--bg-elev-2); color: var(--text-dim); }

/* ── Dedup Companies/People queue toggle ───────────────────────────────── */
.dedup-mode-toggle { display: inline-flex; gap: 2px; background: var(--bg-elev-2); border: 1px solid var(--border); border-radius: 8px; padding: 2px; }
.dedup-mode-toggle button {
  background: transparent; border: none; color: var(--text-dim);
  padding: 4px 12px; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.dedup-mode-toggle button.on { background: var(--accent-fade); color: var(--accent-bright); }

/* ── Friendly value formatting in drawers (chips / readable lines) ─────── */
.val-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.val-chip {
  display: inline-block; padding: 1px 8px; border-radius: 10px;
  background: var(--bg-elev-2); border: 1px solid var(--border);
  font-size: 11px; color: var(--text-dim); line-height: 1.6;
}
.val-lines { font-size: 12.5px; }
.val-lines > div { line-height: 1.5; }

/* ── Compact URL button (drawer fields) ───────────────────────────────── */
.url-btn {
  display: inline-block; padding: 1px 9px; border-radius: 5px;
  background: var(--bg-elev-2); border: 1px solid var(--border);
  font-size: 11px; font-weight: 600; color: var(--accent-bright); text-decoration: none;
}
.url-btn:hover { border-color: var(--accent); }

/* ── Social brand icons (contacts) ────────────────────────────────────── */
.social-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 6px;
  font-size: 12px; font-weight: 800; text-decoration: none; line-height: 1;
}

/* ── View banners (archived / review) ─────────────────────────────────── */
.view-banner {
  margin: 0 0 8px; padding: 8px 14px; border-radius: 8px;
  font-size: 12.5px; font-weight: 600;
}
.archived-banner { background: color-mix(in srgb, var(--amber) 14%, transparent); color: var(--amber); border: 1px solid color-mix(in srgb, var(--amber) 38%, transparent); }
.review-banner   { background: rgba(91,140,255,0.10); color: rgb(120 160 255); border: 1px solid rgba(91,140,255,0.34); }

/* ── Inline social icon row ───────────────────────────────────────────── */
.social-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 2px; }
.social-chip { display: inline-flex; align-items: center; gap: 1px; }
.social-x { font-size: 12px; padding: 0 2px; }

/* ── Bell Score chip ──────────────────────────────────────────────────── */
.bell-score { display: inline-flex; align-items: center; gap: 6px; }
.bell-score-bar {
  width: 38px; height: 5px; border-radius: 3px; overflow: hidden;
  background: var(--bg-elev-2); border: 1px solid var(--border); flex-shrink: 0;
}
.bell-score-bar > span { display: block; height: 100%; border-radius: 3px; }
.bell-score-num { font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 18px; }

/* ── Drawer People tab (org chart) rows ───────────────────────────────── */
.org-grid td { white-space: normal; vertical-align: middle; overflow: visible; }
.org-grid td.person-main { cursor: pointer; }
.org-grid td.person-main .person-name { font-weight: 500; }
.org-grid td.person-main .person-title { margin-top: 1px; }
.org-grid td.person-contacts { text-align: right; }
.org-grid td.person-contacts .contact-icons { justify-content: flex-end; }

/* ── Request-details (drawer box + admin queue) ───────────────────────── */
.request-box h3 { color: var(--accent-bright); }
.request-pill {
  display: inline-block; padding: 2px 10px; border-radius: 12px;
  font-size: 11px; font-weight: 700; border: 1px solid var(--border);
  text-transform: capitalize;
}
.dr-shell { display: flex; flex-direction: column; height: 100%; }
.dr-list { padding: 12px; display: flex; flex-direction: column; gap: 10px; overflow: auto; }
.dr-card {
  border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px;
  background: var(--bg-elev);
}
.dr-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.dr-note { margin: 8px 0 4px; font-size: 13px; color: var(--text); font-style: italic; }
.dr-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* ── Advanced filters: floating panel over the rows (between sidebar + drawer) ── */
@keyframes bdiFilterDrop {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
/* Anchored inside .grid-pane: floats above the rows only and stops at the 420px
   drawer, so opening it does NOT push the rows or the drawer down. */
.bdi-filter-anchor { position: absolute; top: 0; left: 0; right: 420px; z-index: 30; max-height: 100%; display: flex; }
.bdi-filter-drop {
  flex: 1; min-width: 0;
  animation: bdiFilterDrop .16s ease;
  display: flex; flex-direction: column; max-height: 100%;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  box-shadow: 0 16px 36px rgba(0, 0, 0, .5);
}
.bdi-filter-head {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-bottom: 1px solid var(--border);
  background: var(--bg-elev-2);
}
.bdi-filter-head strong { font-size: 12.5px; font-weight: 600; letter-spacing: .02em; }
.bdi-filter-head .spacer { flex: 1; }
.bdi-filter-clear { background: var(--bg-elev-2); border: 1px solid var(--border); color: var(--text-muted); border-radius: 6px; padding: 4px 10px; font: inherit; font-size: 11.5px; cursor: pointer; }
.bdi-filter-x { background: var(--bg-elev-2); border: 1px solid var(--border); color: var(--text-muted); width: 26px; height: 26px; border-radius: 6px; cursor: pointer; }
.bdi-filter-clear:hover, .bdi-filter-x:hover { border-color: var(--accent); color: var(--text); }
.bdi-filter-body { padding: 14px 18px; overflow: auto; }
.bdi-filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px 22px; align-items: start; }
.bdi-filter-sec { min-width: 0; }
.bdi-filter-label { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--text-dim); margin-bottom: 7px; }
.bdi-chiprow { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-chip { padding: 4px 10px; border-radius: 6px; font: inherit; font-size: 11.5px; cursor: pointer; border: 1px solid var(--border); background: var(--bg-elev-2); color: var(--text-muted); transition: border-color .12s, background .12s, color .12s; }
.filter-chip:hover { border-color: var(--accent); color: var(--text); }
.filter-chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.bdi-filter-input { background: var(--bg-elev-2); border: 1px solid var(--border); color: var(--text); padding: 6px 9px; border-radius: 6px; font: inherit; font-size: 12px; }
.bdi-filter-input:focus { outline: none; border-color: var(--accent); }
.bdi-filter-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 18px; border-top: 1px solid var(--border); background: var(--bg-elev-2); }
.bdi-filter-cancel { background: var(--bg-elev-2); border: 1px solid var(--border); color: var(--text-muted); border-radius: 6px; padding: 7px 15px; font: inherit; font-size: 12px; cursor: pointer; }
.bdi-filter-cancel:hover { border-color: var(--accent); color: var(--text); }
.bdi-filter-apply { background: var(--accent); border: 1px solid var(--accent); color: #fff; border-radius: 6px; padding: 7px 18px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.bdi-filter-apply:hover { filter: brightness(1.08); }

/* searchable multi-select (industry) */
.bdi-ms { position: relative; }
.bdi-ms-trigger { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--bg-elev-2); border: 1px solid var(--border); color: var(--text); padding: 7px 11px; border-radius: 6px; font: inherit; font-size: 12.5px; cursor: pointer; }
.bdi-ms-trigger:hover { border-color: var(--accent); }
.bdi-ms-caret { color: var(--text-dim); font-size: 10px; }
.bdi-ms-panel { margin-top: 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-elev-2); overflow: hidden; }
.bdi-ms-search { width: 100%; box-sizing: border-box; border: none; border-bottom: 1px solid var(--border); background: var(--bg-elev); color: var(--text); padding: 8px 11px; font: inherit; font-size: 12.5px; outline: none; }
.bdi-ms-list { max-height: 200px; overflow: auto; padding: 4px; }
.bdi-ms-opt { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 5px; font-size: 12.5px; color: var(--text-muted); cursor: pointer; }
.bdi-ms-opt:hover { background: rgba(255, 255, 255, .04); color: var(--text); }
.bdi-ms-opt.on { color: var(--text); }
.bdi-ms-opt input { accent-color: var(--accent); }
.bdi-ms-opt > span:first-of-type { flex: 1; }
.bdi-ms-n { color: var(--text-dim); font-size: 11px; }
.bdi-ms-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.bdi-ms-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 6px; background: var(--accent-fade, rgba(91, 140, 255, .15)); border: 1px solid rgba(91, 140, 255, .42); color: var(--text); font-size: 11px; }
.bdi-ms-chip button { background: transparent; border: none; color: var(--text-dim); cursor: pointer; font-size: 12px; line-height: 1; padding: 0; }
.bdi-ms-chip button:hover { color: var(--text); }
