:root {
  /* shadcn/ui — zinc (light) */
  --radius: 8px;
  --bg: #fafafa;          /* page background */
  --panel: #ffffff;       /* card / popover */
  --muted-bg: #f4f4f5;    /* secondary / subtle fills */
  --line: #e4e4e7;        /* border / input */
  --text: #09090b;        /* foreground */
  --muted: #71717a;       /* muted-foreground */
  --primary: #3f3f46;     /* primary button — dark grey */
  --primary-fg: #fafafa;
  --ring: rgba(24,24,27,.35);
  /* tier data colours (kept – semantic) */
  --t1: #6f42c1; --t2: #2563eb; --t3: #f59e0b;
  /* legacy aliases now resolve to the neutral palette */
  --navy: #18181b; --blue: #18181b; --teal: #18181b;
}
:root[data-theme="dark"] {
  --bg: #09090b;
  --panel: #18181b;
  --muted-bg: #27272a;
  --line: #27272a;
  --text: #fafafa;
  --muted: #a1a1aa;
  --primary: #fafafa;
  --primary-fg: #18181b;
  --ring: rgba(228,228,231,.30);
  --navy: #18181b; --blue: #e4e4e7; --teal: #e4e4e7;
}
:root[data-theme="dark"] body { color: var(--text); }
:root[data-theme="dark"] .legend { background: rgba(24,24,27,.92); color: var(--text); }
:root[data-theme="dark"] .modal-box { background: var(--panel); }
/* form controls + surfaces theme automatically via the variables above */
.list li:hover { background: var(--muted-bg); }
.list li.active { background: var(--muted-bg); }
.ds-opt:hover, .imp-row:hover { background: var(--muted-bg); }
.score-bars .bar-track { background: var(--muted-bg); }
.profile { background: var(--panel); }
.eng-item { border-color: var(--line); color: var(--text); }
.eng-notes { color: var(--muted); }
.close { color: var(--muted); }

/* base form controls — shadcn input style + focus ring */
input[type=search], input[type=text], input[type=email], input[type=password],
input[type=date], input[type=number], select, textarea {
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--radius);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--muted); box-shadow: 0 0 0 3px var(--ring);
}

* { box-sizing: border-box; }
/* shadcn-style scrollbars (themed for light + dark) */
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); border-width: 2px; }
::-webkit-scrollbar-corner { background: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  display: flex; flex-direction: column; height: 100vh; overflow: hidden;
}

/* top bar */
#topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px; background: var(--panel); color: var(--text);
  border-bottom: 1px solid var(--line); z-index: 20; position: relative;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 26px; color: var(--text); }
#topbar h1 { font-size: 18px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
.brand-home { cursor: pointer; }
.brand-home:hover { opacity: .7; }
.tagline { margin: 0; font-size: 11.5px; color: var(--muted); }
.stats { display: flex; gap: 6px; }
.stat { text-align: center; background: none; border: 1px solid transparent; color: var(--text); font: inherit;
  cursor: pointer; padding: 4px 10px; border-radius: var(--radius); transition: background .15s, border-color .15s; }
.stat:hover { background: var(--muted-bg); }
.stat.active { background: var(--muted-bg); border-color: var(--line); }
.stat b { display: block; font-size: 18px; line-height: 1.1; }
.stat span { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }

/* layout */
#layout { flex: 1; display: flex; min-height: 0; position: relative; }

/* sidebar */
#sidebar {
  width: 330px; background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}
.filters { padding: 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.filters input[type=search] {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px;
}
.filter-row { display: flex; gap: 8px; align-items: center; }
.filter-row select {
  flex: 1; padding: 7px 8px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 12.5px; background: var(--panel); color: var(--text);
}
.score-filter { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.score-filter input[type=range] { width: 90px; }
.list-meta { padding: 8px 12px; font-size: 11.5px; color: var(--muted); border-bottom: 1px solid var(--line); }

.list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.list li {
  padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; display: flex; gap: 10px; align-items: center;
}
.list li:hover { background: var(--muted-bg); }
.list li.active { background: var(--muted-bg); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
}
img.avatar { object-fit: cover; background: var(--muted-bg); }
.flag { width: 18px; height: 13px; object-fit: cover; border-radius: 2px; margin-right: 6px; vertical-align: -2px; box-shadow: 0 0 0 1px rgba(0,0,0,.08); }
.p-photo { width: 46px; height: 46px; font-size: 15px; }
.dc-avatar { width: 38px; height: 38px; font-size: 13px; }
.p-logo { height: 14px; width: auto; vertical-align: -2px; margin-right: 6px; border-radius: 2px; }
.li-main { flex: 1; min-width: 0; }
.li-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-sub { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tier-badge { font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 10px; color: #fff; }
.tier-1 { background: #6f42c1; }
.tier-2 { background: var(--t2); }
.tier-3 { background: var(--t3); }
.score-pill { font-size: 11px; font-weight: 700; color: var(--text); }

/* map */
#map-wrap { flex: 1; position: relative; min-width: 0; }
#map { position: absolute; inset: 0; }
.legend {
  position: absolute; bottom: 14px; left: 14px; background: rgba(255,255,255,.92);
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 11px; font-size: 12px;
  display: flex; gap: 14px; z-index: 2;
}
.legend .dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 4px; }
.dot.t1 { background: #6f42c1; } .dot.t2 { background: var(--t2); } .dot.t3 { background: var(--t3); }
.map-controls { position: absolute; top: 14px; left: 14px; z-index: 2; display: flex; flex-direction: column; gap: 6px; }
.map-ctrl-btn {
  width: 38px; height: 38px; border-radius: 8px; border: 1px solid rgba(0,0,0,.15);
  background: #fff; color: #1d2433; font-size: 15px; font-weight: 700; cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.2); display: flex; align-items: center; justify-content: center;
}
.map-ctrl-btn:hover { background: #f0f4fb; }
.map-ctrl-btn.active { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.map-banner {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  background: #fff7e6; border: 1px solid #f2c879; color: #7a5300;
  padding: 8px 14px; border-radius: 8px; font-size: 12.5px; z-index: 3; max-width: 80%;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}

/* profile panel */
.profile {
  position: absolute; top: 0; right: 0; height: 100%; width: 380px; background: var(--panel);
  border-left: 1px solid var(--line); box-shadow: -4px 0 18px rgba(0,0,0,.10);
  z-index: 6; overflow-y: auto; padding: 18px;
}
.close {
  position: absolute; top: 10px; right: 12px; border: none; background: none;
  font-size: 24px; cursor: pointer; color: var(--muted); line-height: 1;
}
.hidden { display: none !important; }

/* dedicated full-page profile */
.profile.full-page { width: 100%; left: 0; right: 0; box-shadow: none; padding: 24px 28px; }
.profile.full-page #profile-body { max-width: 760px; margin: 0 auto; }
.profile.full-page .close { display: none; } /* page, not a popup — use the Back button */
.p-back { margin-bottom: 12px; }

.p-head { display: flex; gap: 12px; align-items: center; margin-bottom: 4px; }
.p-id { flex: 1; min-width: 0; }
.p-headright { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; padding-right: 28px; }
.p-enrich-btn { padding: 0 18px; }
.p-complogo { max-height: 56px; max-width: 160px; width: auto; object-fit: contain; border-radius: 4px; }
.profile.full-page .p-complogo { max-height: 72px; max-width: 220px; }
.p-name { font-size: 18px; font-weight: 700; margin: 0; }
.p-meta { font-size: 12.5px; color: var(--muted); margin: 2px 0 0; }
.p-title { font-size: 13px; color: var(--text); font-weight: 500; margin: 2px 0 0; }
.p-tags { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.tag { font-size: 11px; background: var(--muted-bg); color: var(--text); padding: 3px 9px; border-radius: 12px; }
.p-bio { font-size: 13px; line-height: 1.5; color: #333; }

.composite-box { display: flex; align-items: center; gap: 14px; margin: 14px 0; padding: 12px; background: var(--muted-bg); border: 1px solid var(--line); border-radius: var(--radius); }
.composite-num { font-size: 30px; font-weight: 800; color: var(--text); }
.composite-box .meta { font-size: 12px; color: var(--muted); }

.score-bars { margin: 10px 0 4px; }
.score-bars .bar-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 12px; }
.score-bars .bar-label { width: 78px; color: var(--muted); }
.score-bars .bar-track { flex: 1; display: block; height: 9px; background: var(--muted-bg); border-radius: 5px; overflow: hidden; }
.score-bars .bar-fill { display: block; height: 100%; background: #2563eb; border-radius: 5px; }
.score-bars .bar-val { width: 26px; text-align: right; font-weight: 600; }

h3.section { font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--text); margin: 18px 0 8px; border-bottom: 1px solid var(--line); padding-bottom: 4px; }

.eng-list { list-style: none; padding: 0; margin: 0; }
.eng-item { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 7px; font-size: 12px; position: relative; }
.eng-item .eng-top { display: flex; justify-content: space-between; gap: 8px; }
.eng-type { font-weight: 600; }
.eng-status { font-size: 10.5px; padding: 1px 7px; border-radius: 10px; }
.st-Completed { background: #e3f6e8; color: #1c7a3a; }
.st-Planned { background: #fff3d6; color: #8a6100; }
.st-Declined { background: #fde2e2; color: #a52222; }
.eng-date { color: var(--muted); font-size: 11px; }
.eng-notes { margin-top: 4px; color: #444; }
.eng-del { position: absolute; bottom: 6px; right: 8px; border: none; background: none; color: #c44; cursor: pointer; font-size: 11px; }

.eng-form { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 8px; }
.eng-form select, .eng-form input, .eng-form textarea {
  padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; font-family: inherit;
}
.eng-form textarea { grid-column: 1 / -1; resize: vertical; min-height: 40px; }
.eng-form .full { grid-column: 1 / -1; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--primary); color: var(--primary-fg); border: 1px solid var(--primary); padding: 0 16px; height: 36px;
  border-radius: var(--radius); font-size: 13px; line-height: 1; cursor: pointer; font-weight: 500; transition: opacity .15s, background .15s;
}
.btn:hover:not(:disabled) { opacity: .9; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ring); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: transparent; color: var(--text); border: 1px solid var(--line); padding: 0 14px; height: 36px;
  border-radius: var(--radius); font-size: 13px; line-height: 1; font-weight: 500; cursor: pointer; transition: background .15s;
}
.btn-ghost:hover:not(:disabled) { background: var(--muted-bg); }
.btn-ghost:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ring); }
.btn-ghost:disabled { opacity: .5; cursor: not-allowed; }
.btn.full, .btn-ghost.full { width: 100%; }

.loading { padding: 24px; text-align: center; color: var(--muted); }

/* login gate */
.login-overlay { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1f3864, #0f1420); }
.login-box { background: var(--panel); border-radius: 14px; padding: 32px 30px; width: 340px; max-width: 90vw;
  display: flex; flex-direction: column; gap: 12px; box-shadow: 0 16px 48px rgba(0,0,0,.4); }
.login-box h1 { margin: 0; font-size: 26px; color: var(--navy); text-align: center; }
:root[data-theme="dark"] .login-box h1 { color: var(--text); }
.login-sub { margin: 0 0 6px; text-align: center; color: var(--muted); font-size: 13px; }
.login-box input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 7px; font-size: 14px; }
:root[data-theme="dark"] .login-box input { background: #0f1420; color: var(--text); }
.login-box .btn { padding: 10px; font-size: 14px; }
.login-err { color: #c0392b; font-size: 12.5px; min-height: 16px; text-align: center; }
/* user chip */
.user-chip { margin-left: 14px; color: var(--muted); font-size: 12px; background: var(--muted-bg);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 5px 11px; white-space: nowrap; text-transform: capitalize; }

/* right-side dropdown menu */
.hmenu { position: relative; margin-left: 14px; }
.menu-trigger { width: 40px; height: 38px; border-radius: var(--radius); border: 1px solid var(--line);
  background: transparent; color: var(--text); font-size: 18px; cursor: pointer; transition: background .15s; }
.menu-trigger:hover { background: var(--muted-bg); }
.theme-icon-btn { width: 38px; height: 38px; margin-left: 14px; border-radius: var(--radius);
  border: 1px solid var(--line); background: transparent; color: var(--text); font-size: 16px;
  cursor: pointer; transition: background .15s; }
.theme-icon-btn:hover { background: var(--muted-bg); }
.menu-panel { position: fixed; right: 14px; top: 52px; min-width: 210px; z-index: 1000;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px;
  box-shadow: 0 12px 32px rgba(0,0,0,.18); display: flex; flex-direction: column; }
.menu-user { font-size: 11.5px; color: var(--muted); padding: 6px 10px 8px; border-bottom: 1px solid var(--line);
  margin-bottom: 4px; text-transform: capitalize; }
.menu-item { display: block; width: 100%; text-align: left; background: none; border: none; color: var(--text);
  padding: 9px 12px; border-radius: 6px; font-size: 13px; cursor: pointer; }
.menu-item:hover { background: var(--muted-bg); }
:root[data-theme="dark"] .menu-item:hover { background: #1d2740; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 16px);
  background: #1d2433; color: #fff; padding: 11px 18px; border-radius: 8px; font-size: 13px;
  box-shadow: 0 6px 22px rgba(0,0,0,.3); z-index: 100; opacity: 0; transition: opacity .25s, transform .25s;
  max-width: 80vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* import button + modal */
.import-btn {
  margin-left: 16px; background: var(--teal); color: #fff; border: none;
  padding: 7px 12px; border-radius: 6px; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.import-btn:hover { background: #257070; }
.modal {
  position: fixed; inset: 0; background: rgba(15,22,40,.55); z-index: 50;
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto;
}
.modal-box {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); width: 720px; max-width: 100%; padding: 22px 24px;
  position: relative; box-shadow: 0 12px 40px rgba(0,0,0,.3);
}
.modal-box h2 { margin: 0 0 4px; font-size: 18px; color: var(--text); }
:root[data-theme="dark"] .modal-box h2 { color: var(--text); }
:root[data-theme="dark"] .csv-h { color: #cfe0f5; }
.modal-sub { margin: 0 0 12px; font-size: 12px; color: var(--muted); }
.import-status { font-size: 12.5px; padding: 8px 10px; border-radius: 6px; margin-bottom: 12px; }
.import-status.ok { background: #e3f6e8; color: #1c7a3a; }
.import-status.warn { background: #fff3d6; color: #8a6100; }
.imp-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
.imp-form label { font-size: 11.5px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.imp-form input, .imp-form select {
  padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; color: var(--text);
}
.imp-form .btn { grid-column: 1 / -1; }
.imp-results { margin-top: 14px; max-height: 320px; overflow-y: auto; }
.imp-row {
  display: grid; grid-template-columns: 22px 1.4fr 2fr 1.2fr; gap: 8px; align-items: center;
  padding: 7px 4px; border-bottom: 1px solid var(--line); font-size: 12.5px; cursor: pointer;
}
.imp-row:hover { background: var(--muted-bg); }
.imp-name { font-weight: 600; }
.imp-meta { color: #444; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.imp-loc { color: var(--muted); text-align: right; }
.imp-loc .nomatch { color: #c0392b; font-style: normal; }
.imp-src {
  display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 10px;
  background: var(--muted-bg); color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .02em;
}
.imp-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.imp-all { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.hunt-sources { display: flex; flex-wrap: wrap; gap: 10px 14px; }
.hunt-sources label { flex-direction: row !important; align-items: center; gap: 5px; font-size: 12.5px !important; color: var(--text) !important; }
.hunt-sources input:disabled + .hunt-src-label { color: var(--muted); }
.hunt-bulk-panel { margin-top: 14px; border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.hunt-bulk-head { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; margin-bottom: 8px; }
.hunt-bulk-bar { height: 6px; border-radius: 3px; background: var(--muted-bg); overflow: hidden; margin-bottom: 10px; }
.hunt-bulk-bar-fill { height: 100%; background: var(--navy); width: 0%; transition: width .3s; }
.hunt-bulk-log { max-height: 180px; overflow-y: auto; font-size: 11.5px; color: var(--muted); font-family: monospace; }
.csv-h { font-size: 13px; color: var(--navy); margin: 0 0 4px; }
.csv-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.csv-row input[type=file] { font-size: 12px; flex: 1; min-width: 160px; }
.csv-row select { padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; font-size: 12.5px; }
.csv-result { margin-top: 10px; }

/* settings */
.settings-btn {
  margin-left: 8px; background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.3);
  padding: 7px 12px; border-radius: 6px; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.settings-btn:hover { background: rgba(255,255,255,.24); }
.settings-box { width: 460px; }
.ds-options { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.ds-opt {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-size: 13.5px;
}
.ds-opt:hover { background: var(--muted-bg); }
.ds-label { flex: 1; font-weight: 600; }
.ds-status { font-size: 11px; padding: 2px 9px; border-radius: 10px; }
.ds-status.ok { background: #e3f6e8; color: #1c7a3a; }
.ds-status.warn { background: #fff3d6; color: #8a6100; }

/* profile CRM fields + tasks */
.crm-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.crm-fields label { font-size: 11px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.crm-fields label.full, .crm-fields .full { grid-column: 1 / -1; }
.crm-fields select, .crm-fields input { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
.task-list { list-style: none; padding: 0; margin: 0 0 8px; }
.task-item { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.task-item.done .task-title { text-decoration: line-through; color: var(--muted); }
.task-title { flex: 1; }
.task-due { font-size: 11px; color: var(--muted); }
.task-due.overdue { color: #c0392b; font-weight: 700; }
.task-del { border: none; background: none; color: #c44; cursor: pointer; font-size: 14px; }

/* LinkedIn block in profile */
.li-block { font-size: 12.5px; }
.li-links { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.li-link { color: #0a66c2; font-weight: 600; text-decoration: none; }
.li-link:hover { text-decoration: underline; }
.li-search { color: var(--blue); text-decoration: none; }
.li-search:hover { text-decoration: underline; }
.li-none { color: var(--muted); }
.li-edit { display: flex; gap: 6px; }
.li-edit input { flex: 1; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; }
.li-enrich { margin-top: 8px; background: var(--teal); color: #fff; border: none; padding: 7px 12px; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; }
.li-enrich:hover { background: #257070; }
.li-enrich:disabled { opacity: .6; cursor: default; }
.p-details { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; }
.p-details .pd b { color: var(--muted); font-weight: 600; margin-right: 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .3px; }
.src-note { font-size: 10px; color: var(--muted); text-transform: none; letter-spacing: 0; font-weight: 400; }
.pub-list { list-style: none; padding: 0; margin: 8px 0 0; }
.pub-list li { padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.pub-list a { color: var(--blue); text-decoration: none; display: block; }
.pub-list a:hover { text-decoration: underline; }
.pub-meta { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
:root[data-theme="dark"] .pub-list a { color: #4d9be0; }
.pub-list .pub-head { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--muted); }
.link-btn { background: none; border: none; color: var(--blue); font-size: 11px; cursor: pointer; padding: 0; }
.link-btn:hover { text-decoration: underline; }
:root[data-theme="dark"] .link-btn { color: #4d9be0; }
.li-ico { vertical-align: -3px; margin-right: 4px; }
.li-link, .dc-li, .cc-li { display: inline-flex; align-items: center; }
.cc-li { color: #0a66c2; margin-top: 6px; }
.cc-li:hover { color: #084d93; }
:root[data-theme="dark"] .cc-li { color: #4d9be0; }
.dc-li { display: inline-block; margin-bottom: 8px; color: #0a66c2; font-weight: 600; font-size: 11.5px; text-decoration: none; }
:root[data-theme="dark"] .li-edit input { background: #0f1420; color: var(--text); border-color: var(--line); }
:root[data-theme="dark"] .li-link, :root[data-theme="dark"] .dc-li { color: #4d9be0; }

/* CRM board + table modal */
.crm-box { width: 1100px; max-width: 96vw; }
.crm-head { display: flex; align-items: center; gap: 18px; }
.crm-head h2 { margin: 0; font-size: 18px; color: var(--navy); }
.crm-tabs { display: flex; gap: 6px; }
.crm-tab { border: 1px solid var(--line); background: transparent; color: var(--text); padding: 5px 14px; border-radius: 6px; cursor: pointer; font-size: 12.5px; }
.crm-tab.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.crm-summary { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.crm-chip { font-size: 11.5px; background: var(--muted-bg); color: var(--text); padding: 3px 10px; border-radius: 12px; }
.crm-chip.warn { background: #fde2e2; color: #a52222; }
.crm-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-height: 65vh; overflow-y: auto; }
.crm-col { background: var(--muted-bg); border-radius: 8px; padding: 6px; }
.crm-col-head { font-size: 12px; font-weight: 700; color: var(--text); padding: 4px 6px; display: flex; justify-content: space-between; }
.crm-col-head span { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 0 7px; font-size: 11px; }
.crm-col-body { min-height: 60px; display: flex; flex-direction: column; gap: 6px; padding: 4px; border-radius: 6px; }
.crm-col-body.drag-over { background: var(--muted-bg); outline: 2px dashed var(--muted); }
.crm-card { background: var(--panel); border: 1px solid var(--line); border-radius: 7px; padding: 8px; cursor: grab; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.crm-card:active { cursor: grabbing; }
.cc-name { font-weight: 600; font-size: 12.5px; }
.cc-sub { font-size: 11px; color: var(--muted); }
.cc-owner { font-size: 11px; color: var(--blue); margin-top: 2px; }
.cc-task { font-size: 10.5px; margin-top: 4px; color: var(--muted); }
.cc-task.overdue { color: #c0392b; font-weight: 600; }
.crm-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; table-layout: fixed; }
.crm-tbl th, .crm-tbl td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); overflow: hidden; text-overflow: ellipsis; }
/* fixed column widths so sorting/data changes don't reflow the layout */
.crm-tbl th.ct-selcol { width: 30px; }
.crm-tbl thead th:nth-child(2) { width: 30px; }   /* map pin */
.crm-tbl th[data-col="name"] { width: 13%; }
.crm-tbl th[data-col="composite"] { width: 60px; }
.crm-tbl th[data-col="city"] { width: 11%; }
.crm-tbl th[data-col="email"] { width: 16%; }
.crm-tbl th[data-col="phone"] { width: 12%; }
.crm-tbl th[data-col="title"] { width: 11%; }
.crm-tbl th[data-col="department"] { width: 9%; }
.crm-tbl th[data-col="institution"] { width: 11%; }
.crm-tbl th[data-col="company_size"] { width: 6%; }
.crm-tbl th[data-col="role_start"] { width: 6%; }
.crm-tbl th[data-col="linkedin_url"] { width: 56px; }
.crm-tbl th[data-col="pub_count"] { width: 60px; }
.crm-tbl th[data-col="coauthor_count"] { width: 66px; }
.crm-tbl th[data-col="stage"] { width: 120px; }
.crm-tbl th[data-col="source"] { width: 90px; }
.crm-tbl thead th:last-child { width: 84px; }     /* actions */
.crm-tbl th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.crm-tbl th.sortable { cursor: pointer; user-select: none; }
.crm-tbl th.sortable:hover { color: var(--blue); }
.crm-tbl .ct-name { font-weight: 600; color: var(--blue); cursor: pointer; }
.crm-tbl .ct-name:hover { text-decoration: underline; }
.ct-mapcell { text-align: center; }
.ct-maplink { color: var(--blue); cursor: pointer; display: inline-flex; }
.ct-maplink:hover { color: #245d92; }
:root[data-theme="dark"] .ct-maplink { color: #4d9be0; }
.crm-tbl td.overdue { color: #c0392b; font-weight: 600; }
.ct-stage { padding: 4px 6px; border: 1px solid var(--line); border-radius: 5px; font-size: 12px; width: 100%; box-sizing: border-box; }
.crm-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 0; flex-wrap: wrap; }
.crm-toolbar #crm-search { flex: 1; min-width: 220px; max-width: 420px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
.crm-toolbar select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; color: var(--text); background: var(--panel); }
.crm-pager { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.pg-btn { border: 1px solid var(--line); background: var(--panel); color: var(--text); padding: 5px 11px; border-radius: 6px; cursor: pointer; font-size: 12.5px; }
.pg-btn:hover:not(:disabled) { background: var(--muted-bg); }
.pg-btn:disabled { opacity: .45; cursor: default; }
/* numbered page nav below the table */
.crm-pagenav { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 16px 0 6px; flex-wrap: wrap; }
.pg-numbers { display: flex; align-items: center; gap: 4px; }
.pg-num { min-width: 32px; height: 32px; padding: 0 8px; border: 1px solid var(--line); background: var(--panel);
  color: var(--text); border-radius: var(--radius); cursor: pointer; font-size: 12.5px; }
.pg-num:hover { background: var(--muted-bg); }
.pg-num.active { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); font-weight: 600; }
.pg-ellipsis { padding: 0 4px; color: var(--muted); }
.ct-empty { text-align: center; color: var(--muted); padding: 18px; }
:root[data-theme="dark"] .crm-toolbar #crm-search { background: #0f1420; color: var(--text); }
:root[data-theme="dark"] .crm-toolbar select { background: #0f1420; color: var(--text); }
:root[data-theme="dark"] .pg-btn:hover:not(:disabled) { background: #1d2740; }
.crm-tbl-scroll { overflow-x: auto; }
.ct-selcol { width: 28px; text-align: center; }
/* selection bar */
.crm-selbar { display: flex; align-items: center; gap: 10px; background: var(--muted-bg); border: 1px solid var(--line); border-radius: 8px; padding: 5px 12px; font-size: 12.5px; }
.crm-selbar #sel-count { font-weight: 600; color: var(--text); }
:root[data-theme="dark"] .crm-selbar { background: #1d2740; border-color: #2b3447; }
:root[data-theme="dark"] .crm-selbar #sel-count { color: #cfe0f5; }
/* add-to-list modal */
.addlist-existing { display: flex; flex-direction: column; gap: 6px; max-height: 200px; overflow-y: auto; margin: 6px 0 4px; }
.al-opt { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; cursor: pointer; font-size: 13px; }
.al-opt:hover { background: var(--muted-bg); }
.al-name { font-weight: 600; flex: 1; }
.al-meta { font-size: 11px; color: var(--muted); }
.addlist-new { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.addlist-new input, .addlist-new select { padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
.addlist-new #nl-name { grid-column: 1 / -1; }
:root[data-theme="dark"] .addlist-new input, :root[data-theme="dark"] .addlist-new select { background: #0f1420; color: var(--text); }
/* lists page */
.lists-create { display: flex; gap: 8px; margin: 12px 0 16px; flex-wrap: wrap; }
.lists-create input { flex: 1; min-width: 200px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
.lists-create select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
:root[data-theme="dark"] .lists-create input, :root[data-theme="dark"] .lists-create select { background: #0f1420; color: var(--text); }
/* Campaign Lists — list (table) format */
.lists-table { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.list-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: var(--muted-bg); }
.lr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.lr-name { background: none; border: none; padding: 0; text-align: left; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--text); }
.lr-name:hover { text-decoration: underline; }
.lr-meta { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.lr-count { background: var(--muted-bg); border: 1px solid var(--line); color: var(--text); border-radius: 12px; padding: 1px 10px; font-size: 11px; font-weight: 600; }
.lr-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.lr-actions .btn-ghost, .ld-head .btn-ghost { padding: 5px 10px; font-size: 12px; text-decoration: none; }
.btn-ghost.danger { color: #c0392b; }
.ld-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.crm-tbl td, .crm-tbl th { white-space: nowrap; }
.crm-tbl .ct-net { color: var(--muted); text-align: center; }
.ct-enrich { background: #2563eb; color: #fff; border: none; padding: 4px 10px; border-radius: 5px; font-size: 11.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.ct-enrich:hover:not(:disabled) { background: #1d4ed8; }
.ct-enrich:disabled { opacity: .6; cursor: default; }
.ct-li { color: #0a66c2; display: inline-flex; }
:root[data-theme="dark"] .ct-li { color: #4d9be0; }
.ct-yt { color: #ff0000; display: inline-flex; margin-left: 6px; vertical-align: middle; }
.ct-gmaps { display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; margin-left: 6px;
  background: #4285f4; color: #fff; border-radius: 50%; font-weight: 700; font-size: 11px; text-decoration: none; vertical-align: middle; }
.ct-gmaps:hover { background: #3367d6; }
.ct-unscored { color: var(--muted); }
.not-scored { border: 1px dashed var(--line); border-radius: var(--radius); padding: 14px; margin: 14px 0; font-size: 13px; color: var(--muted); line-height: 1.5; }

/* Roadmap page */
.rm-overall { display: flex; align-items: center; gap: 20px; border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; margin: 16px 0 24px; background: var(--panel); }
.rm-overall-num { font-size: 40px; font-weight: 800; line-height: 1; color: var(--text); letter-spacing: -.02em; }
.rm-overall-mid { flex: 1; }
.rm-overall-cap { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.rm-overall-bar, .rm-bar { height: 8px; background: var(--muted-bg); border-radius: 999px; overflow: hidden; }
.rm-fill { height: 100%; border-radius: 999px; transition: width .4s ease; }
.rm-fill.done { background: #16a34a; } .rm-fill.mid { background: #2563eb; } .rm-fill.low { background: #f59e0b; }
.extra-page h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 24px 0 12px; }
.rm-modules { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.rm-mod { border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: var(--panel); transition: box-shadow .15s, border-color .15s; }
.rm-mod:hover { border-color: var(--muted); box-shadow: 0 4px 16px rgba(0,0,0,.06); }
.rm-mod-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.rm-mod-name { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; line-height: 1.3; }
.rm-num { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: var(--primary-fg); font-size: 11px; font-weight: 700; }
.rm-badge { flex: none; font-size: 10.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.rm-badge.done { background: #dcfce7; color: #15803d; } .rm-badge.mid { background: #dbeafe; color: #1d4ed8; } .rm-badge.low { background: #fef3c7; color: #b45309; }
:root[data-theme="dark"] .rm-badge.done { background: rgba(22,163,74,.2); color: #4ade80; }
:root[data-theme="dark"] .rm-badge.mid { background: rgba(37,99,235,.2); color: #60a5fa; }
:root[data-theme="dark"] .rm-badge.low { background: rgba(245,158,11,.2); color: #fbbf24; }
.rm-mod .rm-bar { margin-bottom: 12px; }
.rm-detail { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.rm-detail b { color: var(--text); font-weight: 600; }
/* phase timeline */
.rm-phases { list-style: none; margin: 0; padding: 0 0 0 6px; }
.rm-phases li { position: relative; padding: 0 0 18px 26px; border-left: 2px solid var(--line); }
.rm-phases li:last-child { border-left-color: transparent; padding-bottom: 0; }
.rm-phases li::before { content: ""; position: absolute; left: -7px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--primary); border: 3px solid var(--bg); }
.rm-phases li b { font-size: 13.5px; }
.rm-phases li div { font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.5; }

/* AI Agents page */
.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; margin: 16px 0; }
.agent-card { border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: var(--panel); transition: box-shadow .15s, border-color .15s; }
.agent-card:hover { border-color: var(--muted); box-shadow: 0 4px 16px rgba(0,0,0,.06); }
.agent-top { display: flex; align-items: center; gap: 12px; }
.agent-avatar { flex: none; width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: #fff; letter-spacing: .02em; }
.agent-avatar.done { background: #16a34a; } .agent-avatar.mid { background: #2563eb; } .agent-avatar.low { background: #64748b; }
.agent-id { flex: 1; min-width: 0; }
.agent-name { font-weight: 700; font-size: 15px; }
.agent-role { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.agent-status { flex: none; font-size: 10.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.agent-status.done { background: #dcfce7; color: #15803d; } .agent-status.mid { background: #dbeafe; color: #1d4ed8; } .agent-status.low { background: var(--muted-bg); color: var(--muted); }
:root[data-theme="dark"] .agent-status.done { background: rgba(22,163,74,.2); color: #4ade80; }
:root[data-theme="dark"] .agent-status.mid { background: rgba(37,99,235,.2); color: #60a5fa; }
.agent-mission { font-size: 13px; color: var(--text); line-height: 1.5; margin: 12px 0 8px; }
.agent-does { font-size: 12px; color: var(--muted); line-height: 1.5; }
.agent-does b { color: var(--text); font-weight: 600; }
.agent-skills-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 12px 0 6px; }
.agent-skills { display: flex; flex-wrap: wrap; gap: 6px; }
.agent-skills-empty { font-size: 12px; color: var(--muted); }
.skill-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; background: var(--muted-bg); border: 1px solid var(--line); color: var(--text); padding: 3px 9px; border-radius: 999px; }
.skill-x { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1; padding: 0; }
.skill-x:hover { color: #b3261e; }
.skill-add { display: flex; gap: 6px; margin-top: 10px; }
.skill-add .skill-input { flex: 1; padding: 6px 9px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 12.5px; background: var(--panel); color: var(--text); }
.skill-add-btn { height: auto; padding: 6px 12px; font-size: 12px; }
.agent-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.agent-modules { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.agent-spec { font-size: 12px; font-weight: 600; color: var(--blue); text-decoration: none; white-space: nowrap; }
.agent-spec:hover { text-decoration: underline; }

/* How It Works (flow) page */
.flow-steps { margin: 18px 0; }
.flow-step { display: flex; gap: 16px; }
.flow-num { flex: none; position: relative; display: flex; flex-direction: column; align-items: center; }
.flow-num > .flow-dot { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: var(--primary-fg); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; z-index: 1; }
.flow-num::after { content: ""; flex: 1; width: 2px; background: var(--line); margin-top: 2px; }
.flow-step:last-child .flow-num::after { display: none; }
.flow-card { flex: 1; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; background: var(--panel); }
.flow-title { font-weight: 700; font-size: 15px; }
.flow-desc { font-size: 13px; color: var(--muted); line-height: 1.5; margin-top: 4px; }
.ct-score { display: inline-block; min-width: 26px; text-align: center; font-weight: 700; font-size: 12px; padding: 1px 7px; border-radius: 10px; color: #fff; }
.ct-score.tier-1 { background: #6f42c1; } .ct-score.tier-2 { background: var(--t2); } .ct-score.tier-3 { background: var(--t3); }
.yt-block { font-size: 13px; }
.yt-block h3 .yt-ico { color: #ff0000; vertical-align: -3px; }
.yt-channel { color: var(--blue); text-decoration: none; font-weight: 600; display: inline-block; margin-bottom: 8px; }
.yt-channel:hover { text-decoration: underline; }
.yt-stats { display: flex; gap: 10px; }
.yt-stat { flex: 1; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; text-align: center; background: var(--panel); }
.yt-stat b { display: block; font-size: 17px; }
.yt-stat span { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.p-company { font-size: 13px; }
.pc-line { margin: 4px 0; line-height: 1.45; }
.pc-line b { color: var(--muted); font-weight: 600; margin-right: 6px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; }
.pc-line a { color: var(--blue); text-decoration: none; }
.pc-line a:hover { text-decoration: underline; }
.pc-attr { font-size: 11px; color: var(--muted); margin-top: 6px; }

/* enrichment feedback popup */
.enrich-box { width: 460px; max-width: 96vw; }
.enrich-progress { font-size: 13px; color: var(--text); margin: 6px 0 10px; display: flex; align-items: center; gap: 8px; }
.enrich-log { max-height: 50vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.er-src { display: flex; gap: 10px; font-size: 13px; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius); }
.er-src-name { font-weight: 600; min-width: 70px; }
.er-src.ok { border-left: 3px solid #1f7a3a; }
.er-src.warn { border-left: 3px solid #b3261e; }
.hi-fields { display: flex; flex-direction: column; gap: 8px; }
.hi-field { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.hi-field .hi-label { min-width: 64px; font-weight: 600; font-size: 13px; color: var(--text); }
.hi-field .hi-input { flex: 1; padding: 4px 8px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 13px; background: var(--panel); color: var(--text); }
.hi-field .hi-input:disabled { opacity: 0.5; }
.hi-field .hi-src { font-size: 11px; color: var(--muted); min-width: 90px; text-align: right; }
.hi-note { font-size: 12px; color: var(--muted); margin-top: 8px; }
.hi-note.hi-warn { color: #b3261e; }
.hi-actions { margin-top: 12px; display: flex; justify-content: flex-end; }
.er-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.er-row.ok { color: var(--text); }
.er-row.fail { color: #b3261e; }
.er-bits { color: var(--muted); font-size: 11.5px; }
.er-spin { width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--text); border-radius: 50%; display: inline-block; animation: er-spin 0.7s linear infinite; }
@keyframes er-spin { to { transform: rotate(360deg); } }

/* dark mode: CRM */
:root[data-theme="dark"] .crm-head h2 { color: var(--text); }
:root[data-theme="dark"] .crm-tab { color: var(--text); }
:root[data-theme="dark"] .crm-chip { background: #1d2740; color: #cfe0f5; }
:root[data-theme="dark"] .crm-col { background: #11182a; }
:root[data-theme="dark"] .crm-col-head { color: var(--text); }
:root[data-theme="dark"] .crm-col-head span { background: #0f1420; }
:root[data-theme="dark"] .crm-card { background: #182030; border-color: var(--line); }
:root[data-theme="dark"] .crm-fields select, :root[data-theme="dark"] .crm-fields input,
:root[data-theme="dark"] .ct-stage { background: #0f1420; color: var(--text); border-color: var(--line); }

/* view tabs (Map | Board | Table) in the top bar */
#topbar > .brand { flex: 1; }
.viewtabs { display: flex; gap: 2px; margin-left: 18px; background: var(--muted-bg); padding: 3px; border-radius: var(--radius); }
.vtab {
  background: transparent; color: var(--muted); border: none;
  padding: 6px 14px; border-radius: 6px; cursor: pointer; font-size: 12.5px; font-weight: 500; transition: background .15s, color .15s;
}
.vtab:hover { color: var(--text); }
.vtab.active { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.10); font-weight: 600; }

/* CRM as a full page */
.crm-page { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 22px; background: var(--bg); }

/* settings / compliance full pages */
.extra-page { flex: 1; min-height: 0; overflow-y: auto; background: var(--bg); }
.page-pad { max-width: 820px; margin: 0 auto; padding: 22px 26px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.page-head h2 { margin: 0; font-size: 20px; color: var(--navy); }
:root[data-theme="dark"] .page-head h2 { color: var(--text); }
.compliance h3 { font-size: 15px; font-weight: 600; color: var(--text); margin: 26px 0 12px; padding-left: 11px; border-left: 3px solid var(--primary); line-height: 1.3; text-transform: none; letter-spacing: 0; }
.compliance > .page-pad > p, .compliance p.modal-sub { font-size: 13.5px; line-height: 1.6; }
.compliance ul { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.compliance li { position: relative; padding: 11px 14px 11px 36px; font-size: 13px; line-height: 1.55; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.compliance li::before { content: ""; position: absolute; left: 15px; top: 17px; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); }
.compliance li b { color: var(--text); font-weight: 600; }
.api-doc { border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin: 12px 0; background: var(--panel); }
.api-doc h3 { margin: 0 0 8px; }
.api-tag { font-size: 10.5px; font-weight: 600; background: var(--muted-bg); color: var(--text); padding: 2px 8px; border-radius: 10px; text-transform: none; letter-spacing: 0; margin-left: 6px; }
:root[data-theme="dark"] .api-tag { background: #1d2740; color: #cfe0f5; }
.api-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.api-tbl td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.api-tbl tr td:first-child { color: var(--muted); font-weight: 600; width: 130px; white-space: nowrap; }
.api-tbl code, .compliance code { background: rgba(46,117,182,.12); color: var(--blue); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.api-tbl a, .compliance a { color: var(--blue); }
.feeds-list { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.feed { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; background: var(--panel); }
.feed-top { display: flex; align-items: center; justify-content: space-between; }
.feed-name { font-weight: 700; font-size: 14.5px; }
.feed-status { font-size: 11px; padding: 2px 9px; border-radius: 10px; }
.feed-status.ok { background: #e3f6e8; color: #1c7a3a; }
.feed-status.warn { background: #fff3d6; color: #8a6100; }
.feed-desc { font-size: 12.5px; color: var(--muted); margin: 6px 0; }
.feed-edit { display: flex; gap: 8px; margin-top: 8px; }
.feed-edit input { flex: 1; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
:root[data-theme="dark"] .feed-edit input { background: #0f1420; color: var(--text); }
.tier-rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 8px 0; }
.tier-rules label { font-size: 11.5px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.tier-rules input { padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
.tier-rules .full { grid-column: 1 / -1; }
:root[data-theme="dark"] .tier-rules input { background: #0f1420; color: var(--text); }
.src-badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 10px; background: var(--muted-bg); color: var(--text); border: 1px solid var(--line); }
.src-badge.ok { background: #e3f6e8; color: #1c7a3a; border-color: transparent; }
.src-badge.warn { background: #fff3d6; color: #8a6100; border-color: transparent; }
.src-enr { font-size: 11px; color: var(--muted); margin-left: 4px; }
:root[data-theme="dark"] .src-badge { background: #1a2030; color: #c8d2e0; }
.definitions .def-note { border: 1px solid var(--line); border-left: 4px solid #6f42c1; border-radius: 8px; padding: 12px 14px; margin: 14px 0; font-size: 13px; line-height: 1.5; background: var(--card, #fff); }
.definitions .def-block { border: 1px solid var(--line); border-radius: 10px; padding: 4px 18px 14px; margin: 16px 0; background: var(--card, #fff); }
.definitions .def-block.t2 { border-left: 4px solid #1f7a3a; }
.definitions .def-block.t3 { border-left: 4px solid #b8860b; }
.definitions .def-block h3 { margin-top: 16px; }
.definitions h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 14px 0 6px; }
.definitions .def-block ul { margin-top: 4px; }
:root[data-theme="dark"] .definitions .def-note, :root[data-theme="dark"] .definitions .def-block { background: #0f1420; }
.title-edit { display: flex; gap: 8px; margin: 8px 0; max-width: 420px; }
.title-edit input { flex: 1; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 13px; }
.section-toggles { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.sec-toggle { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text); cursor: pointer; }
.sec-toggle input { width: 16px; height: 16px; cursor: pointer; }
.method-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin: 8px 0; }
.method-card { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; background: var(--card, #fff); }
.method-dim { font-size: 13px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }
.method-live { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 1px 7px; border-radius: 9px; }
.method-live.on { background: #e3f6e8; color: #1c7a3a; }
.method-live.partial { background: #fff3d6; color: #8a6100; }
.method-cue { font-size: 12px; color: var(--text); margin-top: 6px; line-height: 1.4; }
.method-src { font-size: 11px; color: var(--muted); margin-top: 6px; }
:root[data-theme="dark"] .method-card { background: #0f1420; }
.feed-actions { display: flex; align-items: center; gap: 10px; margin-top: 9px; flex-wrap: wrap; }
.feed-test-result { font-size: 12px; }
.feed-test-result.ok { color: #1c7a3a; }
.feed-test-result.err { color: #b3261e; }
.lusha-usage { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 8px 0; }
.usage-card { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; background: var(--card, #fff); }
.usage-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.usage-type { font-size: 13px; font-weight: 600; color: var(--text); }
.usage-rem { font-size: 13px; font-weight: 700; color: #1c7a3a; }
.usage-rem.low { color: #b3261e; }
.usage-bar { height: 7px; border-radius: 4px; background: var(--line); margin: 9px 0 6px; overflow: hidden; }
.usage-fill { height: 100%; background: #2e7d32; border-radius: 4px; }
.usage-fill.low { background: #b3261e; }
.usage-sub { font-size: 11.5px; color: var(--muted); }
.usage-loading, .usage-empty { font-size: 12.5px; color: var(--muted); padding: 6px 0; }
:root[data-theme="dark"] .usage-card { background: #0f1420; }
.crm-page .crm-board { max-height: none; }

/* Mapbox / MapLibre doctor popup card */
.doc-popup .mapboxgl-popup-content, .doc-popup .maplibregl-popup-content {
  padding: 0; border-radius: 10px; overflow: hidden; box-shadow: 0 6px 24px rgba(0,0,0,.22);
}
.doc-card { padding: 12px 14px; font-family: "Segoe UI", Arial, sans-serif; width: 250px; }
.dc-head { display: flex; gap: 10px; align-items: center; }
.dc-avatar { width: 38px; height: 38px; font-size: 13px; }
.dc-name { font-weight: 700; font-size: 13.5px; color: var(--text); }
.dc-inst { font-size: 11.5px; color: var(--muted); }
.dc-meta { font-size: 11.5px; color: var(--muted); margin: 8px 0; }
.dc-row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.dc-score { font-size: 11.5px; font-weight: 600; color: var(--text); }
.dc-stage { font-size: 10.5px; background: var(--muted-bg); color: var(--text); padding: 2px 8px; border-radius: 10px; }
.mp-btn { width: 100%; background: var(--primary); color: var(--primary-fg); border: none; padding: 7px; border-radius: var(--radius); font-size: 12px; cursor: pointer; font-weight: 500; }
.mp-btn:hover { opacity: .9; }

/* Dark mode for the map popup card */
:root[data-theme="dark"] .doc-popup .mapboxgl-popup-content,
:root[data-theme="dark"] .doc-popup .maplibregl-popup-content { background: #0f1420; box-shadow: 0 6px 24px rgba(0,0,0,.5); }
:root[data-theme="dark"] .doc-popup .dc-name { color: #e6ebf5; }
:root[data-theme="dark"] .doc-popup .dc-inst,
:root[data-theme="dark"] .doc-popup .dc-meta { color: #93a1b5; }
:root[data-theme="dark"] .doc-popup .dc-score { color: #7eb3e8; }
:root[data-theme="dark"] .doc-popup .dc-stage { background: #1d2740; color: #c8d2e0; }
/* popup tip (arrow) — colour the pointing side to match the dark card */
:root[data-theme="dark"] .doc-popup.mapboxgl-popup-anchor-top .mapboxgl-popup-tip,
:root[data-theme="dark"] .doc-popup.mapboxgl-popup-anchor-top-left .mapboxgl-popup-tip,
:root[data-theme="dark"] .doc-popup.mapboxgl-popup-anchor-top-right .mapboxgl-popup-tip,
:root[data-theme="dark"] .doc-popup.maplibregl-popup-anchor-top .maplibregl-popup-tip,
:root[data-theme="dark"] .doc-popup.maplibregl-popup-anchor-top-left .maplibregl-popup-tip,
:root[data-theme="dark"] .doc-popup.maplibregl-popup-anchor-top-right .maplibregl-popup-tip { border-bottom-color: #0f1420; }
:root[data-theme="dark"] .doc-popup.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip,
:root[data-theme="dark"] .doc-popup.mapboxgl-popup-anchor-bottom-left .mapboxgl-popup-tip,
:root[data-theme="dark"] .doc-popup.mapboxgl-popup-anchor-bottom-right .mapboxgl-popup-tip,
:root[data-theme="dark"] .doc-popup.maplibregl-popup-anchor-bottom .maplibregl-popup-tip,
:root[data-theme="dark"] .doc-popup.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,
:root[data-theme="dark"] .doc-popup.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip { border-top-color: #0f1420; }
:root[data-theme="dark"] .doc-popup.mapboxgl-popup-anchor-left .mapboxgl-popup-tip,
:root[data-theme="dark"] .doc-popup.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: #0f1420; }
:root[data-theme="dark"] .doc-popup.mapboxgl-popup-anchor-right .mapboxgl-popup-tip,
:root[data-theme="dark"] .doc-popup.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: #0f1420; }
:root[data-theme="dark"] .doc-popup .mapboxgl-popup-close-button,
:root[data-theme="dark"] .doc-popup .maplibregl-popup-close-button { color: #93a1b5; }
