:root {
  --bg: #0c1017;
  --panel: #151c27;
  --panel2: #1b2433;
  --border: #2a3648;
  --text: #e8eef6;
  --muted: #8b9bb0;
  --green: #2d6a4f;
  --green2: #40916c;
  --gold: #e9c46a;
  --red: #c1121f;
  --blue: #4ea8de;
  --orange: #f4a261;
  --radius: 12px;
  --shadow: 0 8px 24px rgba(0,0,0,.35);
  --topbar: #0f1520;
  font-family: "Segoe UI", system-ui, sans-serif;
}
/* Light theme — overrides the surface tokens; accent colors carry over. */
:root[data-theme="light"] {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --panel2: #eef2f7;
  --border: #d3dbe6;
  --text: #16202e;
  --muted: #5b6a7d;
  --green: #2d6a4f;
  --green2: #40916c;
  --shadow: 0 8px 24px rgba(20,30,50,.12);
  --topbar: #ffffff;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
a { color: var(--blue); }
button, select, input, textarea {
  font: inherit;
  color: var(--text);
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}
button {
  cursor: pointer;
  background: var(--green);
  border-color: transparent;
  font-weight: 600;
}
button.secondary { background: var(--panel2); border-color: var(--border); }
button.danger { background: #6b1d24; }
button.ghost { background: transparent; border-color: var(--border); }
button:disabled { opacity: .5; cursor: wait; }
button.star { background: transparent; border: none; font-size: 1.25rem; padding: 2px 6px; }
button.star.on { color: var(--gold); }

.topbar {
  position: relative; /* anchor for the account dropdown */
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--topbar);
  flex: 0 0 auto;
  z-index: 20;
}
.topbar-primary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
}
.brand {
  font-weight: 800;
  letter-spacing: .02em;
  font-size: 15px;
  flex: 0 0 auto;
  white-space: nowrap;
}
.brand span { color: var(--green2); }
/* Table / Cards / Map — primary 3-way control */
.view-seg {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel2);
}
.seg-btn {
  flex: 1 1 0;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 8px 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  min-width: 0;
}
.seg-btn + .seg-btn { border-left: 1px solid var(--border); }
.seg-btn.active {
  background: var(--green);
  color: #fff;
}
.icon-btn {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
  font-weight: 700;
  border-radius: 10px;
}
.topbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-search input[type="search"] {
  flex: 1 1 auto;
  min-width: 0;
  padding: 9px 12px;
  border-radius: 10px;
}
.chip-btn {
  flex: 0 0 auto;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
  white-space: nowrap;
  position: relative;
}
.chip-btn.open {
  border-color: var(--green2);
  color: #d8f3dc;
}
.filter-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  margin-left: 5px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--orange);
  color: #1a1208;
  font-size: 11px;
  font-weight: 800;
}
.filter-badge[hidden] { display: none !important; }
.stats {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  flex: 0 0 auto;
}
.more-panel,
.filters-panel {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  padding: 10px;
}
/* Account menu — an anchored dropdown under the avatar (was a full-width band). */
.more-panel {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  position: absolute;
  top: calc(100% - 6px);
  right: 12px;
  width: 208px;
  max-width: calc(100vw - 24px);
  z-index: 40;
  box-shadow: var(--shadow);
}
/* Compact action row: icon buttons instead of stacked text buttons. */
.menu-actions { display: flex; gap: 6px; }
.more-panel .menu-actions .icon-btn {
  width: auto;
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 0;
}
.more-panel .menu-actions .icon-btn svg { width: 18px; height: 18px; }
/* User avatar (initials) + profile header in the settings menu */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  background: var(--green2);
  border: 1px solid rgba(255, 255, 255, .18);
  flex: 0 0 auto;
  padding: 0;
  user-select: none;
}
.avatar[hidden] { display: none; }
.avatar-sm { width: 32px; height: 32px; font-size: 12px; cursor: pointer; }
.avatar-lg { width: 44px; height: 44px; font-size: 16px; }
.profile-head {
  flex: 0 0 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 4px 10px;
  border-bottom: 1px solid var(--border);
}
.profile-head[hidden] { display: none; }
.profile-meta { min-width: 0; }
.profile-name {
  font-weight: 700;
  color: var(--text);
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-role { margin-top: 3px; }
.role-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 999px;
  text-transform: capitalize;
  color: var(--muted);
  background: var(--panel2);
  border: 1px solid var(--border);
}
.role-badge.admin { color: var(--gold); border-color: var(--gold); }
.role-badge.sales { color: var(--blue); border-color: var(--blue); }
/* Offline indicator (PWA) */
.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2000;
  background: #b45309;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  padding: 6px 12px;
  padding-top: calc(6px + env(safe-area-inset-top, 0px));
  box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}
.offline-banner[hidden] { display: none; }
/* Avatar notification dot + journal trigger */
.avatar { position: relative; }
.journal-btn { cursor: pointer; }
.avatar-dot {
  position: absolute;
  top: -1px;
  right: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e63946;
  border: 2px solid var(--topbar);
}
.avatar-dot[hidden] { display: none; }
.profile-hint { font-size: 11px; color: var(--muted); margin-top: 3px; }
/* Journal modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(6, 9, 14, .62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay[hidden] { display: none; }
.modal-panel {
  width: min(460px, 96vw);
  max-height: min(82vh, 660px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--border);
}
.modal-head-meta { flex: 1 1 auto; min-width: 0; }
.modal-title { font-weight: 700; color: var(--text); font-size: 15px; }
.modal-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.modal-body { padding: 6px 14px 16px; overflow-y: auto; }

/* Help / glossary */
.help-panel { width: min(560px, 96vw); max-height: min(88vh, 760px); }
.help-body, #help-body { font-size: 13px; line-height: 1.5; }
#help-body h4 {
  margin: 16px 0 6px; font-size: 13.5px; color: var(--text);
  border-bottom: 1px solid var(--border); padding-bottom: 4px;
}
#help-body h4:first-child { margin-top: 4px; }
.help-note {
  background: var(--chip, rgba(120,160,255,.10));
  border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 11px; font-size: 12.5px; color: var(--text); margin: 4px 0 10px;
}
.help-p { color: var(--muted); font-size: 12.5px; margin: 2px 0 6px; }
.help-dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 2px 0; }
.help-dl dt { font-weight: 700; color: var(--text); white-space: nowrap; }
.help-dl dd { margin: 0; color: var(--muted); }
.help-dl dd b { color: var(--text); }
.help-dl .tag {
  display: inline-block; font-size: 10.5px; font-weight: 700; padding: 1px 6px;
  border-radius: 999px; margin-right: 6px; vertical-align: 1px; text-transform: uppercase; letter-spacing: .02em;
}
.help-dl .tag.good { background: rgba(46,160,90,.16); color: #37b26b; }
.help-dl .tag.weak { background: rgba(200,90,60,.16); color: #d67a5c; }
.fld-help {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 999px; border: 1px solid var(--border);
  background: transparent; color: var(--muted); font-size: 11px; font-weight: 700;
  cursor: pointer; padding: 0; line-height: 1; vertical-align: middle;
}
.fld-help:hover { color: var(--text); border-color: var(--muted); }
@media (max-width: 460px) {
  .help-dl { grid-template-columns: 1fr; gap: 1px 0; }
  .help-dl dt { margin-top: 7px; }
}
.jr-section { margin-top: 14px; }
.jr-section h4 {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}
.jr-badge-due {
  display: inline-block;
  background: #e63946;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 7px;
  margin-left: 6px;
}
.jr-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
}
.jr-row:last-child { border-bottom: none; }
.jr-row .jr-when { color: var(--muted); font-size: 11.5px; white-space: nowrap; flex: 0 0 auto; }
.jr-row.due .jr-main { color: #f4a261; font-weight: 600; }
.jr-empty { color: var(--muted); font-size: 12.5px; padding: 4px 0; }
/* Light theme: status chips use pale (dark-designed) text — darken for contrast. */
:root[data-theme="light"] .badge,
:root[data-theme="light"] .chip { background: #eef2f7; border-color: #d3dbe6; }
:root[data-theme="light"] .badge.score,
:root[data-theme="light"] .badge.fresh-active,
:root[data-theme="light"] .chip.ok { color: #1b6b47; border-color: #86c9a8; }
:root[data-theme="light"] .badge.pipe,
:root[data-theme="light"] .badge.pipe-visit,
:root[data-theme="light"] .chip[class*="pipe-"] { color: #1a6a8a; border-color: #9dc7d8; }
:root[data-theme="light"] .badge.fresh-quiet,
:root[data-theme="light"] .badge.warn,
:root[data-theme="light"] .chip.warn { color: #8a5a0a; border-color: #e0c48a; }
:root[data-theme="light"] .badge.fresh-stale { color: #9a3412; border-color: #f0b48f; }
:root[data-theme="light"] .badge.fresh-dead,
:root[data-theme="light"] .chip.bad { color: #9b2226; border-color: #eaa39a; }
:root[data-theme="light"] .chip.solar-yes,
:root[data-theme="light"] .badge.solar-yes { color: #7a5c00; border-color: #e0c060; background: rgba(233, 196, 106, .18); }
:root[data-theme="light"] .chip.solar-unknown,
:root[data-theme="light"] .badge.solar-unknown { color: #1a6a8a; border-color: #9dc7d8; }
:root[data-theme="light"] .chip.solar-no,
:root[data-theme="light"] .badge.solar-no { color: #566575; border-color: #cbd5e1; }
.more-panel[hidden],
.filters-panel[hidden],
.map-legend-panel[hidden] { display: none !important; }
.more-panel button { flex: 0 0 auto; width: 100%; min-width: 0; }
.more-panel .avatar-lg { width: 44px; height: 44px; flex: 0 0 auto; } /* keep avatar a circle, not a full-width button */
.role-seg {
  display: flex;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 4px;
}
/* sales accounts must never see this switcher (overrides display:flex) */
.role-seg[hidden],
.role-seg.sales-locked {
  display: none !important;
}
.role-seg .role-btn {
  flex: 1;
  border: none;
  border-radius: 0;
  min-width: 0;
  background: var(--panel2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  padding: 8px 6px;
}
.role-seg .role-btn + .role-btn { border-left: 1px solid var(--border); }
.role-seg .role-btn.active {
  background: var(--green);
  color: #fff;
}

/* Sales lead detail */
.sales-hero .sales-action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.sales-act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--panel2);
  cursor: pointer;
  font: inherit;
}
.sales-act.wa {
  background: rgba(37, 211, 102, 0.2);
  border-color: #25d366;
  color: #6ee7b7;
}
.sales-act.call {
  background: rgba(59, 130, 246, 0.18);
  border-color: #3b82f6;
  color: #93c5fd;
}
.sales-act.maps,
.sales-act.drive {
  background: rgba(233, 196, 106, 0.12);
  border-color: #b45309;
  color: #fcd34d;
}
.sales-act.sm { padding: 8px 10px; font-size: 12px; }
.sales-act.email {
  background: rgba(167, 139, 250, 0.14);
  border-color: #8b5cf6;
  color: #c4b5fd;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sales-tabs .dtab { flex: 1 1 0; min-width: 0; font-size: 12px; padding: 8px 4px; }
.sales-block {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
}
.sales-block h4 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.sales-block textarea {
  width: 100%;
  resize: vertical;
  min-height: 72px;
}
.sales-edit .fld { margin-bottom: 0; }
.sales-contact-card {
  background: var(--panel2);
  border-radius: 10px;
  padding: 10px;
  border: 1px solid var(--border);
}
.sales-contact-card.empty {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}
.sales-contact-name { font-weight: 700; margin-bottom: 8px; }
.sales-contact-acts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.sales-kv { font-size: 13px; }
.sales-reasons { margin: 8px 0 0; padding-left: 18px; font-size: 12px; color: var(--muted); }
.sales-save-main {
  width: 100%;
  padding: 12px;
  margin-bottom: 16px;
  font-size: 15px;
}
.sales-thumbs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.sales-thumb {
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #0a0e14;
}
.sales-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.sales-person {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.sales-person:last-child { border-bottom: none; }
.sales-log-item {
  padding: 8px 0;
  border-bottom: 1px solid #222a36;
  font-size: 12px;
}
.sales-log-item div { margin-top: 2px; color: var(--text); }
@media (max-width: 520px) {
  .sales-thumbs { grid-template-columns: repeat(3, 1fr); }
  .sales-act { flex: 1 1 40%; }
}
.filters-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
  margin-bottom: 10px;
}
.filters-grid label {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 4px 0;
}
.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.filters-row select,
.filters-row input {
  flex: 1 1 120px;
  min-width: 0;
  max-width: 100%;
}
.filters-row button { flex: 0 0 auto; }
/* legacy aliases kept for any leftover classes */
.view-tabs { display: none; }
.toolbar { display: none; }
.mode-toggle { display: none; }
.filters { display: none; }
a.btn-link {
  display: inline-block;
  padding: 8px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  background: var(--panel2);
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 13px;
}

/* Map view */
.map-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  width: 100%;
}
.map-view[hidden] { display: none !important; }
#view-board[hidden] { display: none !important; }
.map-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: #0f1520;
  flex: 0 0 auto;
}
.map-legend-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  flex: 0 0 auto;
}
.map-legend {
  font-size: 12px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.map-legend .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #333;
}
.map-legend .dot.fav { background: #e9c46a; }
.map-legend .dot.visit { background: #f4a261; }
.map-legend .dot.high { background: #2d6a4f; }
.map-legend .dot.mid { background: #4ea8de; }
.map-legend .dot.low { background: #8b9bb0; }
#map {
  flex: 1;
  min-height: 0;
  width: 100%;
  background: #1a2332;
  z-index: 1;
}
.leaflet-container { font: inherit; background: #1a2332; }
.leaflet-popup-content-wrapper {
  background: #151c27;
  color: #e8eef6;
  border-radius: 10px;
  border: 1px solid #2a3648;
}
.leaflet-popup-tip { background: #151c27; }
.leaflet-popup-content { margin: 10px 12px; font-size: 13px; line-height: 1.35; }
.leaflet-popup-content strong { font-size: 14px; }
.leaflet-popup-content .pop-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.leaflet-popup-content .pop-actions a,
.leaflet-popup-content .pop-actions button {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #2a3648;
  background: #1b2433;
  color: #e8eef6;
  text-decoration: none;
  cursor: pointer;
  font-weight: 600;
}
.map-legend .dot.mun {
  background: transparent;
  border: 2px dashed #e76f51;
  border-radius: 2px;
}

.map-legend .dot.power {
  background: transparent;
  border: 2px solid #fb923c;
  border-radius: 1px;
  transform: rotate(45deg);
}
.power-sub {
  width: 12px;
  height: 12px;
  background: #0f141d;
  border: 2px solid #fb923c;
  transform: rotate(45deg);
  box-shadow: 0 1px 4px rgba(0,0,0,.5);
}
.ci.energy {
  background: rgba(251, 191, 36, 0.12);
  border-color: #b45309;
  color: #fcd34d;
  font-size: 9px;
  min-width: 28px;
  padding: 0 4px;
  width: auto;
}
.energy-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}
.energy-links .btn-link {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  background: var(--panel2);
  color: var(--text);
}
.energy-links .energy-cfe {
  border-color: #b45309;
  color: #fcd34d;
  background: rgba(251, 191, 36, 0.1);
}
.energy-hint { margin: 0; font-size: 11px; }
.chip.cfe-ok, .badge.cfe-ok {
  background: rgba(251, 191, 36, 0.14);
  border: 1px solid #b45309;
  color: #fcd34d;
}
.chip.cfe-missing {
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid #475569;
  color: #94a3b8;
}
.cfe-kv { margin: 8px 0 12px; }
.cfe-paste-label {
  display: block;
  font-size: 12px;
  color: var(--muted, #8b9bb0);
  margin-top: 8px;
}
.cfe-paste-label textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  min-height: 96px;
  font: inherit;
  font-size: 12px;
  line-height: 1.4;
  resize: vertical;
  background: var(--panel-2, #121820);
  color: inherit;
  border: 1px solid var(--border, #2a3544);
  border-radius: 8px;
  padding: 8px 10px;
}
.cfe-coverage-pre {
  white-space: pre-wrap;
  font-size: 12px;
  max-height: 50vh;
  overflow: auto;
  margin: 8px 0;
  padding: 8px;
  background: rgba(0,0,0,.25);
  border-radius: 8px;
}
.map-legend .dot.cp {
  background: rgba(233, 196, 106, 0.45);
  border: 1.5px solid #f4a261;
  border-radius: 3px;
}
.cp-tooltip {
  background: #151c27;
  color: #e9c46a;
  border: 1px solid #f4a261;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}
.cp-tooltip::before {
  border-top-color: #151c27;
}
.leaflet-control-layers {
  background: #151c27;
  color: #e8eef6;
  border: 1px solid #2a3648;
  border-radius: 8px;
}
.leaflet-control-layers-expanded {
  padding: 8px 10px;
  font-size: 12px;
}
.leaflet-control-layers label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 3px 0;
  cursor: pointer;
}
.leaflet-control-layers-separator {
  border-top-color: #2a3648;
}
.pin-icon {
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}
/* North compass control (bottom-right) — decorative; map is always north-up */
.map-compass {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(21, 28, 39, 0.92);
  border: 1px solid #2a3648;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px !important;
  margin-right: 10px !important;
}
.map-compass svg { display: block; }
.map-compass .compass-ring {
  fill: #151c27;
  stroke: #3d4f66;
  stroke-width: 1.5;
}
.map-compass .compass-n { fill: #e63946; }
.map-compass .compass-s { fill: #e8eef6; }
.map-compass .compass-arc {
  stroke: #8b9bb0;
  stroke-width: 1.5;
  opacity: 0.7;
}
.map-compass .compass-label {
  fill: #e8eef6;
  font-size: 7px;
  font-weight: 800;
  font-family: system-ui, sans-serif;
}
.leaflet-popup-content .pop-actions button.pop-drive {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #2a3648;
  background: #2d6a4f;
  color: #e8eef6;
  cursor: pointer;
  font-weight: 600;
}
.links button.linkish {
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #2a3648;
  background: #2d6a4f;
  color: #e8eef6;
  cursor: pointer;
}
.badge.pipe-lost { background: #9b2226; color: #fff; }
.badge.pipe-skip { background: #6c757d; color: #fff; }

/* —— Business vitality (open vs closed) —— */
.vitality-chip {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  white-space: nowrap;
}
.vitality-chip.tone-open { background: rgba(45, 106, 79, 0.35); color: #95d5b2; border-color: #2d6a4f; }
.vitality-chip.tone-lean-open { background: rgba(45, 106, 79, 0.2); color: #b7e4c7; border-color: #40916c; }
.vitality-chip.tone-uncertain { background: rgba(233, 196, 106, 0.15); color: #e9c46a; border-color: #b08900; }
.vitality-chip.tone-lean-closed { background: rgba(244, 162, 97, 0.18); color: #f4a261; border-color: #e76f51; }
.vitality-chip.tone-closed { background: rgba(155, 34, 38, 0.25); color: #f4a0a0; border-color: #9b2226; }

.vitality-card {
  border-radius: 12px;
  padding: 14px 14px 12px;
  border: 1px solid #2a3648;
  background: #121820;
}
.vitality-card.tone-open { border-color: #2d6a4f; background: linear-gradient(160deg, rgba(45,106,79,.18), #121820 55%); }
.vitality-card.tone-lean-open { border-color: #40916c; }
.vitality-card.tone-uncertain { border-color: #b08900; background: linear-gradient(160deg, rgba(233,196,106,.1), #121820 55%); }
.vitality-card.tone-lean-closed { border-color: #e76f51; }
.vitality-card.tone-closed { border-color: #9b2226; background: linear-gradient(160deg, rgba(155,34,38,.2), #121820 55%); }

.vitality-verdict {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.vitality-badge {
  display: inline-block;
  font-size: 15px;
  font-weight: 800;
  padding: 6px 12px;
  border-radius: 8px;
  line-height: 1.2;
}
.vitality-badge.tone-open { background: #2d6a4f; color: #fff; }
.vitality-badge.tone-lean-open { background: #40916c; color: #fff; }
.vitality-badge.tone-uncertain { background: #b08900; color: #1a1a1a; }
.vitality-badge.tone-lean-closed { background: #e76f51; color: #1a1a1a; }
.vitality-badge.tone-closed { background: #9b2226; color: #fff; }
.vitality-conf {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: #8b9bb0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.vitality-score {
  font-size: 28px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #e8eef6;
  line-height: 1;
  min-width: 3ch;
  text-align: right;
}
.vitality-action {
  margin: 10px 0 12px;
  font-size: 13px;
  line-height: 1.4;
  color: #c5d0de;
}
.vitality-meter { margin-bottom: 14px; }
.vitality-meter-track {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #9b2226 0%, #e9c46a 50%, #2d6a4f 100%);
  opacity: 0.85;
}
.vitality-meter-fill {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #151c27;
  box-shadow: 0 1px 4px rgba(0,0,0,.5);
}
.vitality-meter-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #8b9bb0;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.vitality-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 10px;
}
@media (max-width: 520px) {
  .vitality-cols { grid-template-columns: 1fr; }
}
.sig-h {
  margin: 0 0 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}
.sig-h.open { color: #95d5b2; }
.sig-h.closed { color: #f4a0a0; }
.sig-list {
  margin: 0;
  padding: 0 0 0 16px;
  font-size: 12px;
  line-height: 1.4;
  color: #c5d0de;
}
.sig-list li { margin-bottom: 4px; }
.sig-list .sig-open::marker { color: #2d6a4f; }
.sig-list .sig-closed::marker { color: #9b2226; }
.vitality-evidence {
  margin-top: 4px;
  border-top: 1px solid #2a3648;
  padding-top: 8px;
}
.vitality-evidence summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: #8b9bb0;
  user-select: none;
}
.vitality-evidence summary:hover { color: #e8eef6; }
.vitality-evidence[open] summary { margin-bottom: 8px; color: #e8eef6; }
.vitality-evidence .kv { font-size: 12px; }
.hero-chips .vitality-chip { font-size: 12px; padding: 4px 10px; }
.layout.map-mode { grid-template-columns: 1fr minmax(320px, 36vw); }
.layout.map-mode .map-view { min-width: 0; }
@media (max-width: 900px) {
  .layout.map-mode { grid-template-columns: 1fr; }
}
/* Contacts live on the lead — no global contacts grid */
.ch-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 3px 0;
  font-size: 13px;
}
.ch-row .ch-del,
.ch-row .p-ch-del {
  padding: 2px 6px;
  font-size: 11px;
  min-width: auto;
}
.ch-list { font-size: 13px; }

/* Mobile table → stacked list (no horizontal scroll) */
.leads-list-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}
.leads-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lead-list-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 10px 10px 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
  max-width: 100%;
  overflow: hidden;
}
.lead-list-row:hover { border-color: var(--green2); }
.lead-list-row.selected {
  outline: 2px solid var(--blue);
  outline-offset: -1px;
}
.lead-list-row.fav { border-color: #8a6d1f; }
.ll-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
  padding-top: 2px;
}
.ll-left input { width: 16px; height: 16px; }
.ll-left .star-btn {
  background: transparent;
  border: none;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  color: var(--muted);
}
.ll-left .star-btn.on { color: var(--gold); }
.ll-main {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}
.ll-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  justify-content: space-between;
}
.ll-name {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.25;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  word-break: break-word;
}
.ll-name a { color: inherit; text-decoration: none; }
.ll-score {
  flex: 0 0 auto;
  font-size: 13px;
  min-width: 2.2em;
  text-align: center;
}
.ll-meta {
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.ll-contacts {
  margin-top: 7px;
  min-height: 28px;
}
.ll-contacts .contact-icons { gap: 6px; }
.ll-contacts .ci { width: 32px; height: 32px; }

/* Desktop table — contacts per row */
.leads-table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}
.leads-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.leads-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #0f1520;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.leads-table tbody tr {
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.leads-table tbody tr:hover { background: rgba(45, 106, 79, 0.12); }
.leads-table tbody tr.selected {
  background: rgba(59, 130, 246, 0.12);
  outline: 1px solid var(--blue);
  outline-offset: -1px;
}
.leads-table td {
  padding: 10px;
  vertical-align: top;
}
.leads-table .col-check,
.leads-table .col-star {
  width: 36px;
  text-align: center;
  vertical-align: middle;
}
.leads-table .col-score,
.leads-table .col-people,
.leads-table .col-pipe,
.leads-table .col-web,
.leads-table .col-fresh {
  white-space: nowrap;
}
.leads-table .col-contact {
  min-width: 88px;
  max-width: 140px;
  line-height: 1.2;
}
.leads-table .tbl-name {
  font-weight: 650;
  font-size: 13.5px;
  line-height: 1.3;
}
.leads-table .tbl-name .meta { margin-top: 2px; }
.contact-icons {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  vertical-align: middle;
}
.ci {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border);
  text-decoration: none;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  flex: 0 0 auto;
  transition: transform 0.1s ease, border-color 0.1s ease;
}
.ci:hover { transform: translateY(-1px); }
.ci .ci-ico { line-height: 1; pointer-events: none; }
.ci.wa {
  background: rgba(37, 211, 102, 0.16);
  border-color: #25d366;
  color: #6ee7b7;
}
.ci.phone {
  background: rgba(59, 130, 246, 0.14);
  border-color: #3b82f6;
  color: #93c5fd;
}
.ci.email {
  background: rgba(167, 139, 250, 0.14);
  border-color: #8b5cf6;
  color: #c4b5fd;
}
.ci.web {
  background: rgba(148, 163, 184, 0.12);
  border-color: #64748b;
  color: #cbd5e1;
}
.card-contacts {
  font-size: 12px;
  margin: 4px 0 8px;
  line-height: 1.2;
  min-height: 1.2em;
}
.card-contacts .meta { margin: 0; }
.card-contacts .ci { width: 26px; height: 26px; font-size: 10px; }
.score-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}
.badge.fresh-active { color: #b7e4c7; border-color: #2d6a4f; }
.badge.fresh-quiet { color: #e9c46a; border-color: #8a6d1f; }
.badge.fresh-stale { color: #f4a261; border-color: #9a3412; }
.badge.fresh-dead { color: #f8ad9d; border-color: #9b2226; }
.people-card {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 6px;
}

/* Drive tab — Chula Vista → lead */
.drive-panel { min-height: 80px; }
.drive-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.drive-stat {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 10px;
  text-align: center;
}
.drive-stat-val {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1.2;
}
.drive-stat-lbl {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
@media (max-width: 520px) {
  .drive-stats { grid-template-columns: 1fr; }
}
.form-grid {
  display: grid;
  gap: 8px;
}
.form-grid label { font-size: 12px; color: var(--muted); display: block; }
.form-grid input, .form-grid select, .form-grid textarea {
  width: 100%;
  margin-top: 3px;
}

.layout {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  flex: 1 1 auto;
  min-height: 0;
}
.layout.split {
  grid-template-columns: 1fr minmax(360px, 44vw);
}
.board {
  padding: 10px 12px 32px;
  overflow-y: auto;
  min-height: 0;
}
.bulk-bar {
  display: none;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
  padding: 8px 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.bulk-bar.show { display: flex; flex-wrap: wrap; }
.bulk-bar button { padding: 6px 10px; font-size: 12px; }

/* Desktop: slightly roomier topbar */
@media (min-width: 900px) {
  .topbar { padding: 12px 16px; gap: 10px; }
  .brand { font-size: 17px; min-width: 100px; }
  .seg-btn { padding: 8px 14px; font-size: 13px; }
  .topbar-search input[type="search"] { max-width: 360px; }
  .filters-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .more-panel button { flex: 0 0 auto; }
}
@media (max-width: 520px) {
  .brand { font-size: 13px; max-width: 72px; overflow: hidden; text-overflow: ellipsis; }
  .seg-btn { font-size: 12px; padding: 8px 4px; }
  .stats { display: none; } /* space: count lives in filters when open / more */
  .topbar { padding: 8px 10px; }
  .board { padding: 8px 10px 28px; }
  .card .thumb-wrap, .card img.thumb, .card .thumb-empty { height: 150px; }
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: border-color .15s, transform .12s;
  position: relative;
}
.card:hover { border-color: var(--green2); transform: translateY(-1px); }
.card.selected { outline: 2px solid var(--blue); }
.card.fav { border-color: #8a6d1f; }
.card .thumb-wrap {
  width: 100%;
  height: 130px;
  overflow: hidden;
  background: #0a0e14;
}
.card img.thumb {
  width: 100%;
  height: 130px;
  object-fit: cover;
  background: #0a0e14;
  display: block;
}
.card .thumb-empty {
  width: 100%;
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #121820 0%, #1a2332 50%, #0e141c 100%);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.card .thumb-empty span {
  opacity: 0.65;
}
.card .body { padding: 10px 12px 12px; }
.card h3 {
  margin: 0 0 4px;
  font-size: 14px;
  line-height: 1.25;
  display: flex;
  justify-content: space-between;
  gap: 6px;
}
.meta { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
/* Lead name as a website link (card + hero) */
.name-link { color: inherit; text-decoration: none; }
.name-link:hover { color: var(--blue); text-decoration: underline; }
.name-link .ext { font-size: .78em; color: var(--blue); opacity: .85; vertical-align: super; }
.dead-flag {
  font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 999px;
  background: rgba(155,34,38,.22); border: 1px solid #9b2226; color: #f8ad9d;
  vertical-align: middle; white-space: nowrap; margin-left: 4px;
}
.badges { display: flex; flex-wrap: wrap; gap: 4px; }
.badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--muted);
}
.badge.score { color: #b7e4c7; border-color: #2d6a4f; }
.badge.pipe { color: #caf0f8; }
.badge.warn { color: var(--orange); }
.card .check {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
}
.leads-table .star-btn {
  position: static;
  background: transparent;
  border: none;
  font-size: 1rem;
  padding: 2px 4px;
  color: var(--muted);
  cursor: pointer;
}
.leads-table .star-btn.on { color: var(--gold); }
.card .star-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
}

.detail {
  border-left: 1px solid var(--border);
  background: #0f141d;
  display: none;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  position: relative; /* containing block for the drag peek */
  isolation: isolate; /* scope the peek's negative z-index inside the panel */
}
/* Neighbour preview shown behind the card during a live drag (reveals where you're going). */
.deck-peek {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  display: flex;
}
.deck-peek-card {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--panel, #0f141d);
}
.deck-peek-media {
  flex: 1 1 auto;
  min-height: 45%;
  background-size: cover;
  background-position: center;
  background-color: #12161f;
}
.deck-peek-body { padding: 16px 18px 22px; }
.deck-peek-hint {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent, #6ea8fe);
  margin-bottom: 4px;
}
.deck-peek-name {
  font-size: 20px;
  font-weight: 800;
  color: var(--text, #e8edf5);
  line-height: 1.15;
}
.deck-peek-sub { font-size: 13px; color: var(--muted, #9aa7b8); margin-top: 3px; }
.deck-peek-arrow {
  position: absolute;
  top: 42%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(20, 26, 36, 0.55);
  z-index: 2;
}
.deck-peek-arrow.right { right: 16px; }
.deck-peek-arrow.left { left: 16px; }
/* Outgoing-card snapshot used for the swipe fling (positioned/sized inline as a fixed
   overlay so the panel re-render underneath can't wipe it). */
.swipe-ghost {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  pointer-events: none;
  will-change: transform;
}
/* Let vertical scrolling pass through while the JS drag owns horizontal gestures. */
.detail-hero,
.detail-scroll { touch-action: pan-y; }
.layout.split .detail { display: flex; }

/* Hero — compact ID bar */
.detail-hero {
  flex: 0 0 auto;
  position: relative;
  min-height: 140px;
  background-size: cover;
  background-position: center;
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}
.detail-hero.compact { min-height: 128px; }
.detail-hero.no-photo { background: linear-gradient(135deg, #223049, #0f141d); }
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; }
.hero-top-right { display: flex; gap: 4px; align-items: center; }
.hero-top .star { background: rgba(0,0,0,.4); border-radius: 8px; line-height: 1; }
.hero-close { background: rgba(0,0,0,.55); border-color: rgba(255,255,255,.15); font-size: 12px; padding: 4px 8px; }
.hero-info h2 { margin: 0 0 2px; font-size: 1.2rem; line-height: 1.15; text-shadow: 0 2px 10px rgba(0,0,0,.85); }
.hero-sub { font-size: 12px; color: #d3ddea; text-shadow: 0 1px 6px rgba(0,0,0,.85); margin-bottom: 6px; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }
.hero-contacts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.hero-contacts .ci { width: 32px; height: 32px; font-size: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.section-head h4 { margin: 0; }
.panel-primary { padding-top: 4px; }
.panel-compact h4 { margin: 0; font-size: 13px; }
.panel-fold {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  background: var(--panel2);
}
.panel-fold summary {
  cursor: pointer;
  font-weight: 650;
  font-size: 13px;
  color: var(--text);
  list-style: none;
}
.panel-fold summary::-webkit-details-marker { display: none; }
.panel-fold summary::before {
  content: "▸ ";
  color: var(--muted);
  font-size: 11px;
}
.panel-fold[open] summary::before { content: "▾ "; }
/* Folds stacked directly in a tab pane (admin Intel) */
.tabpane > .panel-fold { margin-bottom: 10px; }
.tabpane > .panel-fold summary { min-height: 32px; display: flex; align-items: center; gap: 4px; }
.people-card.compact { padding: 10px 12px; }
.people-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}
.people-card-actions { display: flex; gap: 2px; }
.people-card .ch-list { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ch-icon-wrap {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.ch-icon-wrap .p-ch-del {
  padding: 0 4px;
  font-size: 12px;
  opacity: 0.55;
  min-width: 0;
}
.ch-icon-wrap .p-ch-del:hover { opacity: 1; color: #f8ad9d; }
.add-ch-row { margin-top: 8px; gap: 6px; }
.add-ch-row select { width: 64px; flex: 0 0 auto; }
.gal-more { margin: 8px 0 0; }
.chip {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(15,20,29,.82);
  border: 1px solid rgba(255,255,255,.16);
  color: #e8eef6;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.chip small { font-weight: 500; opacity: .7; font-size: 9px; text-transform: uppercase; letter-spacing: .04em; }
.chip.score-chip { background: var(--green); border-color: transparent; font-size: 14px; padding: 3px 10px; }
.chip.ok { color: #b7e4c7; border-color: #2d6a4f; }
.chip.bad { color: #f8ad9d; border-color: #9b2226; }
.chip.warn { color: var(--orange); border-color: #9a3412; }
.chip[class*="pipe-"] { color: #caf0f8; }
.chip.solar-yes,
.badge.solar-yes { color: #ffd166; border-color: #b08900; background: rgba(255, 209, 102, 0.12); }
.chip.solar-no,
.badge.solar-no { color: #a8b2c1; border-color: #4a5568; }
.chip.solar-unknown,
.badge.solar-unknown { color: #caf0f8; border-color: #457b9d; }
.solar-section .solar-actions button.solar-yes {
  background: linear-gradient(135deg, #b08900, #ca6702);
  border-color: transparent;
  color: #1a1200;
  font-weight: 700;
}
.solar-section .solar-actions button.solar-no { border-color: #4a5568; }

/* Tabs */
.detail-tabs {
  flex: 0 0 auto;
  display: flex;
  gap: 2px;
  padding: 0 8px;
  background: #0f1520;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.dtab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  padding: 11px 13px;
  white-space: nowrap;
}
.dtab:hover { color: var(--text); }
.dtab.active { color: var(--text); border-bottom-color: var(--green2); }

/* Single scroll area */
.detail-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px 16px;
}
.tabpane[hidden] { display: none; }

/* Edit form — two-column, label-on-top, easy to scan and edit */
.edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fld { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.fld input, .fld select, .fld textarea { width: 100%; }
.fld.wide, .fld.full { grid-column: 1 / -1; }
.collapsible h4 { cursor: default; }

/* Sticky action bar so Save is always reachable */
.detail-actionbar {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: #0f1520;
}
.detail-actionbar #d-save { flex: 1; }
.section {
  margin-bottom: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}
.section h4 {
  margin: 0 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}
.row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; align-items: center; }
.row label { font-size: 12px; color: var(--muted); min-width: 70px; }
.row input, .row select, .row textarea { flex: 1; min-width: 120px; }
.row textarea { min-height: 70px; width: 100%; }
.reasons { font-size: 12px; color: var(--muted); margin: 0; padding-left: 1.1em; }
.reasons li { margin-bottom: 3px; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 4px 8px; font-size: 12px; }
.kv div:nth-child(odd) { color: var(--muted); }
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 6px;
}
.gallery a {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.gallery img { width: 100%; height: 100%; object-fit: cover; }
.gallery-rich {
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}
.gal-item {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.gal-thumb {
  display: block;
  width: 100%;
  padding: 0;
  margin: 0;
  aspect-ratio: 1;
  border: none !important;
  border-radius: 0 !important;
  background: #0a0e14;
  cursor: zoom-in;
  overflow: hidden;
}
.gal-thumb:hover img { transform: scale(1.04); }
.gal-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.15s ease;
  pointer-events: none;
  user-select: none;
}

/* Full-screen in-page photo carousel */
body.lb-open { overflow: hidden; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(6, 9, 14, 0.94);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 56px 56px;
  box-sizing: border-box;
}
.lightbox[hidden] { display: none !important; }
.lb-stage {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lb-stage img {
  max-width: min(96vw, 1200px);
  max-height: calc(100vh - 120px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.55);
  user-select: none;
  -webkit-user-drag: none;
}
.lb-close {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid #2a3648;
  background: #151c27;
  color: #e8eef6;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}
.lb-close:hover { background: #1e2a3a; }
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 48px;
  height: 64px;
  border: 1px solid #2a3648;
  border-radius: 10px;
  background: rgba(21, 28, 39, 0.9);
  color: #e8eef6;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.lb-nav:hover:not(:disabled) { background: #243044; }
.lb-nav:disabled { opacity: 0.25; cursor: default; }
.lb-prev { left: 12px; }
.lb-next { right: 12px; }
.lb-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 12px 18px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
  font-size: 13px;
  color: #c5d0de;
}
.lb-counter {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #e9c46a;
}
.lb-caption { flex: 1; min-width: 120px; }
.lb-source {
  color: #4ea8de;
  text-decoration: none;
  font-weight: 600;
  font-size: 12px;
}
.lb-source:hover { text-decoration: underline; }
@media (max-width: 640px) {
  .lightbox { padding: 40px 8px 64px; }
  .lb-nav { width: 36px; height: 48px; font-size: 26px; }
  .lb-prev { left: 4px; }
  .lb-next { right: 4px; }
}
.gal-item {
  position: relative;
}
.gal-del {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.35);
  background: rgba(107, 29, 36, 0.92);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.gal-del:hover { background: #9b2226; }
.gal-upload-label { display: inline-flex; align-items: center; }
.sales-gal.gal-item { aspect-ratio: 1; }
.sales-gal .gal-thumb,
.sales-gal .sales-thumb {
  width: 100%;
  height: 100%;
  padding: 0;
  border: none;
  border-radius: 8px;
  overflow: hidden;
  display: block;
}
.sales-gal .gal-thumb img,
.sales-gal .sales-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.gal-meta {
  padding: 4px 6px 6px;
  font-size: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.gal-kind {
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: .04em;
}
.src-link {
  color: var(--blue) !important;
  text-decoration: none;
  border: none !important;
  aspect-ratio: auto !important;
  display: inline !important;
  font-size: 10px;
}
.src-link.muted { color: var(--muted) !important; }
.src-page { color: var(--green2) !important; font-size: 10px; text-decoration: none; border: none !important; aspect-ratio: auto !important; display: inline !important; }

.social-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.social-card {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}
.social-top {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 4px;
}
.social-stats { font-size: 12px; margin: 4px 0; }
.social-bio { font-size: 11px; color: var(--muted); line-height: 1.35; }
.links { display: flex; flex-wrap: wrap; gap: 6px; }
.links a {
  font-size: 12px;
  text-decoration: none;
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--text);
}
.activity { font-size: 12px; color: var(--muted); max-height: 160px; overflow: auto; }
.activity div { padding: 4px 0; border-bottom: 1px solid #222a36; }

/* toast + modal — no native dialogs */
.toast-wrap {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: #1b4332;
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-size: 13px;
  animation: in .2s ease;
}
.toast.err { background: #6b1d24; }
@keyframes in { from { opacity: 0; transform: translateY(8px);} to { opacity: 1; transform: none;} }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 90;
  padding: 16px;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow);
}
.modal h3 { margin: 0 0 8px; }
.modal p { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; }

.empty {
  color: var(--muted);
  padding: 40px 20px;
  text-align: center;
}
/* "Why this lead" brief bar under the detail hero */
.lead-brief {
  padding: 9px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.55;
}
.lead-brief .brief-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--green2);
  margin-right: 4px;
}
.lead-brief .brief-warn {
  margin-top: 5px;
  color: var(--orange);
  font-weight: 600;
  font-size: 11.5px;
}
.lead-brief .brief-summary {
  margin-top: 5px;
  color: var(--muted);
  font-style: italic;
  font-size: 12px;
  line-height: 1.45;
}
/* Solar ROI quick-calc card */
.roi-wrap { padding: 0 14px; }
.roi-card {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 8px;
  font-size: 12.5px;
}
.roi-card.roi-empty { color: var(--muted); }
.roi-head { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.roi-head .roi-note { font-weight: 500; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.roi-head .roi-prop {
  margin-left: auto;
  width: auto;
  flex: 0 0 auto;
  padding: 4px 10px;
  font-size: 11.5px;
  border-radius: 7px;
  background: var(--green);
  color: #fff;
  border: none;
  cursor: pointer;
}
.roi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.roi-grid > div { text-align: center; }
.roi-grid b { display: block; font-size: 16px; color: var(--green2); line-height: 1.2; }
.roi-grid span { font-size: 10px; color: var(--muted); }
.roi-assumptions { margin-top: 8px; font-size: 10.5px; color: var(--muted); }
/* Log-visit card (Feature 4) */
.visit-wrap { padding: 0 14px; }
.visit-card {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 8px;
}
.visit-head { font-weight: 700; color: var(--text); font-size: 12.5px; margin-bottom: 8px; }
.visit-head .visit-when { font-weight: 500; color: var(--muted); font-size: 11px; }
.visit-outcomes { display: flex; flex-wrap: wrap; gap: 6px; }
.visit-outcomes .visit-btn {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  padding: 7px 8px;
  font-size: 11.5px;
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer;
}
.visit-outcomes .visit-btn.active { color: #fff; border-color: transparent; }
.visit-outcomes .visit-btn.active.won { background: var(--green2); }
.visit-outcomes .visit-btn.active.lost { background: var(--red); }
.visit-outcomes .visit-btn.active.proposal_left { background: var(--blue); }
.visit-outcomes .visit-btn.active.interested { background: var(--green); }
.visit-outcomes .visit-btn.active.not_interested,
.visit-outcomes .visit-btn.active.not_open { background: #6c757d; }
.visit-fields { display: flex; gap: 6px; margin-top: 8px; }
.visit-fields input { flex: 1 1 0; min-width: 0; font-size: 12px; padding: 7px 9px; }
/* Conversion summary in the journal (Feature 5) */
.conv-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 4px; }
.conv-grid > div { text-align: center; }
.conv-grid b { display: block; font-size: 16px; color: var(--green2); line-height: 1.2; }
.conv-grid span { font-size: 10px; color: var(--muted); }
.conv-tariff { margin-top: 8px; }
@media (max-width: 900px) {
  .layout.split { grid-template-columns: 1fr; }
  .detail {
    position: fixed;
    inset: 0;
    top: 0;
    max-height: 100vh;
    z-index: 30;
    border: none;
  }
}

/* ── Sales account: minimal chrome ─────────────────────────
   Inputs stay in the DOM (loadMapPins/bind read them) — hidden only. */
body.sales-account #mode-table,
body.sales-account .topbar-search,
body.sales-account #filters-panel,
body.sales-account #btn-reload,
body.sales-account #bulk,
body.sales-account #btn-map-legend-toggle,
body.sales-account #map-legend-panel,
body.sales-account #btn-open-gmaps-area { display: none !important; }

/* (The account menu is now an anchored dropdown for all roles — see .more-panel.) */

/* Sales: "Fit" floats over the map instead of claiming a toolbar band */
body.sales-account #map-stats { display: none; }
body.sales-account .map-view { position: relative; }
body.sales-account .map-toolbar {
  position: absolute;
  left: 12px;
  bottom: 16px;
  z-index: 500;
  padding: 0;
  border-bottom: none;
  background: transparent;
}
body.sales-account .map-toolbar #btn-map-fit { box-shadow: var(--shadow); }
/* When a lead detail is open, the floating map "Fit" button must not poke through the
   detail panel / its bottom action bar. */
.layout.split .map-toolbar { display: none; }

/* Sales detail: sticky bottom action bar (thumb-reachable; Close lives here) */
.sales-actionbar {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  background: #0f1520;
}
.sab {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 11px 4px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}
.sab svg { width: 22px; height: 22px; display: block; }
.sab.wa { background: rgba(37, 211, 102, 0.18); border-color: #25d366; color: #6ee7b7; }
.sab.call { background: rgba(59, 130, 246, 0.16); border-color: #3b82f6; color: #93c5fd; }
.sab.email { background: rgba(167, 139, 250, 0.16); border-color: #8b5cf6; color: #c4b5fd; }
.sab.drive { background: rgba(233, 196, 106, 0.14); border-color: #b45309; color: #fcd34d; }
.sab.close { background: var(--panel2); border-color: var(--border); color: var(--muted); }
/* Missing contact channel: keep the icon in place but grey it out and disable it */
.sab.disabled {
  background: var(--panel2);
  border-color: var(--border);
  color: var(--muted);
  opacity: 0.45;
  pointer-events: none;
  cursor: default;
}

/* Location: embedded Google map preview (tap anywhere to open Google Maps) */
.loc-map {
  position: relative;
  display: block;
  width: 100%;
  height: 200px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
}
.loc-map iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  pointer-events: none; /* taps pass through to the wrapping link */
}
.loc-map-open {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: rgba(12, 16, 23, 0.82);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

/* Collapsed "Next step" one-line preview */
.sales-fold .fold-count { min-width: 0; }
.next-preview {
  display: inline-block;
  max-width: 190px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

/* Sales contacts: show the number, not a cryptic icon */
.who-num {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 13px;
  margin-top: 2px;
}
.sales-person { padding: 10px 0; border-bottom: 1px solid var(--border); }
.sales-person:last-child { border-bottom: none; }
.sales-person-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.person-nums {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

/* Map pin popup → mini-card matching the list card */
.leaflet-popup-content .pop-card { min-width: 168px; }
.leaflet-popup-content .pop-card-head { display: flex; gap: 8px; align-items: center; }
.leaflet-popup-content .pop-thumb {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 8px;
  overflow: hidden;
  background: #0a0e14;
  border: 1px solid var(--border);
}
.leaflet-popup-content .pop-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.leaflet-popup-content .pop-card-info { min-width: 0; }
.leaflet-popup-content .pop-card-info strong { display: block; }
.leaflet-popup-content .pop-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
}
.leaflet-popup-content .pop-card .pop-open { background: var(--green2); border-color: var(--green2); color: #fff; }
.leaflet-popup-content .pop-card .pop-actions { margin-top: 8px; }
.leaflet-popup-content .pop-card .pop-actions button { flex: 1 1 0; text-align: center; }

/* Sales cards: rank pill + stage/due chips */
.rank-pill {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: rgba(12, 16, 23, 0.78);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
}
.chip.stage {
  border-color: var(--green2);
  color: #9ad3b5;
}
.chip.due {
  color: var(--gold);
  border-color: var(--gold);
  font-weight: 700;
}
.sales-card .meta-line {
  color: var(--muted);
  font-size: 12px;
  margin: 2px 0 6px;
}
.sales-card h3 { margin: 0 0 2px; }

/* Sales card: open-full-screen affordance (bottom-right, clear of star/rank) */
.expand-btn {
  position: absolute;
  bottom: 6px;
  right: 6px;
  z-index: 2;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(12, 16, 23, 0.78);
  color: var(--muted);
  cursor: pointer;
}
.expand-btn svg { width: 15px; height: 15px; }
.expand-btn:hover { color: var(--text); border-color: var(--muted); }
.sales-card .card-contacts { padding-right: 34px; }

/* Full-screen lead reader */
body.detail-fullscreen .detail {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: flex !important;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  padding-top: 50px;
  border-left: none;
}
.detail-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 50px;
  z-index: 1500;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  padding-top: env(safe-area-inset-top, 0);
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.25);
}
.detail-nav[hidden] { display: none; }
.dn-btn {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2, rgba(255, 255, 255, 0.04));
  color: var(--text);
  cursor: pointer;
  font-size: 16px;
}
.dn-btn svg { width: 20px; height: 20px; }
.dn-btn:hover { border-color: var(--muted); }
.dn-btn:disabled { opacity: 0.32; cursor: default; }
.dn-close { margin-left: 2px; }
.dn-title {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.15;
}
.dn-pos { font-size: 11px; color: var(--muted); }
.dn-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  max-width: 60vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Map popup: primary open button (sales) */
.leaflet-popup .pop-open {
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  background: var(--green2);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

/* ── Sales mission card (detail) ─────────────────────────── */
.why-line {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.45;
  color: #d3ddea;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Compact single-row pipeline track (was a tall pill row + a separate "Mark lost" row). */
.sales-stepper {
  display: flex;
  gap: 4px;
  padding: 7px 10px;
  background: #0f1520;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.sales-stepper::-webkit-scrollbar { display: none; }
.stepper-step {
  flex: 1 1 0;
  min-width: 0;
  min-height: 30px;
  padding: 5px 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel2);
  color: var(--muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stepper-step.done {
  border-color: var(--green);
  color: #6aa88a;
  background: rgba(45, 106, 79, 0.14);
}
.stepper-step.active {
  background: var(--green);
  border-color: var(--green2);
  color: #fff;
}
/* Lost: a compact outcome chip at the end of the same row (✕ until set). */
.stepper-lost {
  flex: 0 0 auto;
  min-width: 34px;
  color: var(--muted);
}
.stepper-lost.active {
  background: rgba(190, 70, 70, 0.16);
  border-color: #a24b52;
  color: #f28b93;
}
/* Peek media with no photo → a subtle gradient, never raw black. */
.deck-peek-media.no-photo {
  background-image: linear-gradient(160deg, #1b2331, #10151e 70%);
}

/* Review snippets: date shown clearly, newest first. */
.review-snip { padding: 7px 0; border-top: 1px solid var(--border); }
.review-snip:first-child { border-top: none; padding-top: 2px; }
.review-snip-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.review-snip-head > b { font-size: 12.5px; }
.review-date { font-size: 12px; font-weight: 700; color: var(--text); }
.review-author { font-size: 12px; color: var(--muted); }

/* Prev / next deal navigation in the hero */
.hero-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(12, 16, 23, 0.5);
  border-radius: 999px;
  padding: 2px 4px;
}
.hero-navbtn {
  background: none;
  border: none;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  padding: 2px 8px;
  cursor: pointer;
  border-radius: 999px;
}
.hero-pos {
  font-size: 12px;
  font-weight: 700;
  color: #d3ddea;
  min-width: 30px;
  text-align: center;
}

.sales-contact-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
}
.sales-contact-row .who { font-weight: 700; min-width: 0; }
.sales-contact-row .who .meta { font-weight: 400; }

.interest-stars {
  display: inline-flex;
  gap: 2px;
}
.interest-stars button {
  background: none;
  border: none;
  padding: 4px;
  font-size: 20px;
  line-height: 1;
  color: var(--border);
  cursor: pointer;
  min-width: 32px;
}
.interest-stars button.on { color: var(--gold); }

.sales-fold {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 10px;
  overflow: hidden;
}
.sales-fold > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  user-select: none;
}
.sales-fold > summary::-webkit-details-marker { display: none; }
/* Chevron caret (not a bullet): points right when closed, down when open */
.sales-fold > summary::before {
  content: "";
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  margin: 0 2px 2px 0;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}
.sales-fold[open] > summary::before { transform: rotate(45deg); }
.sales-fold .fold-count {
  margin-left: auto;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}
.sales-fold .fold-body { padding: 0 12px 12px; }

/* Admin detail reuses the sales shell; neutralize wrappers that carry their own
   horizontal padding so they don't double-indent inside a fold body. */
.detail-admin .fold-body .roi-wrap,
.detail-admin .fold-body .visit-wrap { padding: 0; }
.sales-fold .fold-body > .roi-wrap,
.sales-fold .fold-body > .visit-wrap { padding: 0; }
.sales-fold .fold-body .section-head { margin-bottom: 4px; }
.sales-fold .fold-body .edit-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
.sales-fold .fold-body textarea { width: 100%; }

.research-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.sales-act.web {
  background: rgba(78, 168, 222, 0.14);
  border-color: var(--blue);
  color: #9ecfef;
}

/* Mobile: detail feels like a bottom sheet */
@media (max-width: 900px) {
  .detail {
    border-radius: 16px 16px 0 0;
    animation: sheet-up 0.22s ease;
  }
  .sheet-handle {
    display: block;
    width: 36px;
    height: 4px;
    border-radius: 999px;
    background: var(--border);
    margin: 6px auto 0;
  }
}
@media (min-width: 901px) {
  .sheet-handle { display: none; }
}
@keyframes sheet-up {
  from { transform: translateY(24px); opacity: 0.6; }
  to { transform: none; opacity: 1; }
}
