/* ── Lumen — Permanent Lighting brand system ───────────────── */
:root {
  --night: #050505;
  --snow: #ffffff;
  --mist: #f4f2ed;
  --charcoal: #444444;
  --bg: var(--mist);
  --bg-raised: var(--snow);
  --bg-card: var(--snow);
  --border: #dedbd2;
  --text: #171717;
  --text-dim: #625e57;
  --amber: #f7a416;
  --amber-soft: rgba(247, 164, 22, 0.14);
  --green: #00a79d;
  --red: #d5475f;
  --blue: #1379be;
  --purple: #703d90;
  --pink: #e8348b;
  --lime: #87bd25;
  --brand-rainbow: linear-gradient(90deg, var(--blue) 0 20%, var(--lime) 20% 40%, var(--amber) 40% 60%, var(--pink) 60% 80%, var(--purple) 80%);
  --radius: 18px;
  --shadow-sm: 0 10px 28px rgba(5, 5, 5, 0.06);
  --shadow-lg: 0 24px 60px rgba(5, 5, 5, 0.18);
  font-size: 15px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Archivo", Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ── */
#sidebar {
  width: 248px;
  min-width: 248px;
  position: relative;
  background: var(--night);
  border-right: 1px solid rgba(255,255,255,0.12);
  display: flex;
  flex-direction: column;
  padding: 24px 14px 18px;
  color: var(--snow);
}
#sidebar::before,
#sidebar::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0 0 auto;
  height: 3px;
  pointer-events: none;
  background: var(--brand-rainbow);
}
#sidebar::after {
  opacity: 0;
  filter: blur(7px) brightness(1.35) saturate(1.2);
  transform: scaleY(1);
  transform-origin: top;
  transition: opacity 260ms ease, transform 360ms cubic-bezier(0.22, 1, 0.36, 1);
}
#sidebar:hover::after,
#sidebar:focus-within::after {
  opacity: 0.82;
  transform: scaleY(3.2);
}
#sidebar .brand-lockup {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 50px;
  padding: 0 12px;
}
#sidebar .brand-lockup img { width: 38px; height: 38px; object-fit: contain; }
#sidebar .logo {
  font-size: 1.08rem;
  font-weight: 800;
  padding: 0;
  letter-spacing: 0.16em;
}
#sidebar .brand-kicker { margin-top: 2px; color: rgba(255,255,255,0.48); font-size: 0.58rem; font-weight: 700; letter-spacing: 0.12em; }
#sidebar .tagline {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.54);
  padding: 4px 12px 23px 61px;
}
#sidebar nav { display: flex; flex-direction: column; gap: 2px; }
#sidebar nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.62);
  font-size: 0.88rem;
  font-family: inherit;
  font-weight: 500;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background 0.15s, color 0.15s;
}
#sidebar nav button:hover { background: rgba(255,255,255,0.07); color: var(--snow); }
#sidebar nav button.active { position: relative; background: rgba(247,164,22,0.14); color: var(--snow); font-weight: 700; }
#sidebar nav button.active::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--amber); }
#sidebar nav button .ico { width: 20px; text-align: center; filter: grayscale(1); opacity: 0.72; }
#sidebar nav button.active .ico { filter: none; opacity: 1; }
#sidebar .foot {
  margin-top: auto;
  font-size: 0.7rem;
  line-height: 1.6;
  color: rgba(255,255,255,0.48);
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.12);
}
#sidebar .foot b { color: rgba(255,255,255,0.78); font-size: 0.62rem; letter-spacing: 0.08em; }
#sidebar .foot .btn.ghost { color: rgba(255,255,255,0.72); border-color: rgba(255,255,255,0.2); }
#sidebar .foot .btn.ghost:hover { color: var(--amber); border-color: var(--amber); }

/* ── Main ── */
#main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
#topbar {
  position: relative;
  isolation: isolate;
  height: 70px;
  min-height: 70px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 0 30px;
  background: var(--night);
  color: var(--snow);
}
#topbar::before,
#topbar::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0 0 auto;
  height: 3px;
  pointer-events: none;
  background: var(--brand-rainbow);
}
#topbar::after {
  opacity: 0;
  filter: blur(7px) brightness(1.35) saturate(1.2);
  transform: scaleY(1);
  transform-origin: top;
  transition: opacity 260ms ease, transform 360ms cubic-bezier(0.22, 1, 0.36, 1);
}
#topbar:hover::after,
#topbar:focus-within::after {
  opacity: 0.82;
  transform: scaleY(3.2);
}
#topbar h1 { font-size: 1.08rem; font-weight: 700; letter-spacing: -0.015em; }
#topbar .goal-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.54);
}
#topbar .goal-chip .bar {
  width: 160px; height: 8px;
  background: rgba(255,255,255,0.13);
  border-radius: 99px;
  overflow: hidden;
}
#topbar .goal-chip .bar > div {
  height: 100%;
  background: var(--amber);
  border-radius: 99px;
  transition: width 0.6s ease;
}
#topbar .goal-chip strong { color: var(--amber); }

#view { flex: 1; overflow-y: auto; padding: 30px; }
#view.no-pad { padding: 0; overflow: hidden; }

/* ── Shared components ── */
.grid { display: grid; gap: 18px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 22px; }
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 21px;
  box-shadow: var(--shadow-sm);
}
.card h3 { font-size: 0.7rem; color: var(--text-dim); font-weight: 800; text-transform: uppercase; letter-spacing: 0.09em; margin-bottom: 10px; }
.card .big { font-size: 1.8rem; font-weight: 800; letter-spacing: -0.035em; }
.card .sub { font-size: 0.78rem; color: var(--text-dim); margin-top: 4px; }
.card .big.amber { color: var(--amber); }
.card .big.green { color: var(--green); }

.btn {
  background: var(--amber);
  color: var(--night);
  border: none;
  padding: 9px 17px;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.88rem;
  cursor: pointer;
  transition: transform 0.15s, filter 0.15s, box-shadow 0.15s;
}
.btn:hover { filter: brightness(1.04); transform: translateY(-1px); box-shadow: 0 8px 18px rgba(247,164,22,0.2); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn.ghost:hover { border-color: var(--amber); color: var(--amber); }
.btn.sm { padding: 6px 11px; font-size: 0.8rem; }
.btn.green { background: var(--green); color: #06230f; }
.btn.danger { color: var(--red); border-color: rgba(248,113,113,0.45); }
.btn.danger:hover { color: var(--red); border-color: var(--red); background: rgba(248,113,113,0.1); }

table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
th { text-align: left; color: var(--text-dim); font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; padding: 9px 10px; border-bottom: 1px solid var(--border); }
td { padding: 11px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tr.row-click { cursor: pointer; }
tr.row-click:hover td { background: rgba(247,164,22,0.09); }

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
.pill.identified      { background: #ece9e2; color: #5b5750; }
.pill.enriched        { background: rgba(19,121,190,0.12); color: #0d659e; }
.pill.mockup_sent     { background: var(--amber-soft); color: #9d6200; }
.pill.in_conversation { background: rgba(112,61,144,0.12); color: var(--purple); }
.pill.proposal        { background: rgba(0,167,157,0.12); color: #007d75; }
.pill.won             { background: rgba(0,167,157,0.14); color: #007d75; }
.pill.connected  { background: rgba(0,167,157,0.14); color: #007d75; }
.pill.voicemail  { background: var(--amber-soft); color: #9d6200; }
.pill.no_answer  { background: #ece9e2; color: #5b5750; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 0 14px;
}
.section-head h2 { font-size: 1rem; font-weight: 800; letter-spacing: -0.02em; }
.muted { color: var(--text-dim); font-size: 0.82rem; }

/* ── Map view ── */
#map-wrap { display: flex; height: 100%; }
#map { flex: 1; background: #0a0d12; }
#map-panel {
  width: 360px;
  min-width: 360px;
  border-left: 1px solid var(--border);
  background: var(--bg-raised);
  overflow-y: auto;
  padding: 18px;
}
#scan-controls {
  position: absolute;
  z-index: 900;
  top: 14px;
  left: 60px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}
#scan-controls .btn { white-space: nowrap; }
#scan-controls .scene-select { background: rgba(255, 255, 255, 0.96); }
.multi-select { position: relative; }
.multi-select > button { text-align: left; min-width: 170px; }
.multi-panel {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 1000;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  min-width: 210px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.multi-panel.open { display: block; }
.multi-panel label {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 5px 4px;
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: 6px;
}
.multi-panel label:hover { background: var(--amber-soft); }
.multi-panel input { accent-color: var(--amber); }
#geo-box {
  display: flex;
  gap: 6px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
}
#geo-box input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 0.85rem;
  padding: 4px 8px;
  width: 170px;
  font-family: inherit;
}
#search-return {
  min-height: 30px;
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
#search-return:empty { display: none; }
#search-return .muted {
  font-size: 0.76rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#scan-status {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.82rem;
  display: none;
  align-items: center;
  gap: 8px;
}
#scan-status.on { display: flex; }
.spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--amber-soft);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.prop-row {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.prop-row:hover, .prop-row.sel { border-color: var(--amber); background: var(--amber-soft); }
.prop-row .nm { font-weight: 600; font-size: 0.9rem; margin-bottom: 3px; }
.prop-row .meta { font-size: 0.76rem; color: var(--text-dim); display: flex; gap: 10px; flex-wrap: wrap; }
.score-badge {
  float: right;
  background: var(--amber-soft);
  color: var(--amber);
  font-weight: 700;
  font-size: 0.78rem;
  padding: 2px 8px;
  border-radius: 6px;
}

/* ── Detail drawer ── */
#drawer {
  position: fixed;
  top: 0; right: -480px;
  width: 480px;
  height: 100vh;
  background: var(--bg-raised);
  border-left: 1px solid var(--border);
  z-index: 1200;
  transition: right 0.28s ease;
  overflow-y: auto;
  padding: 22px;
  box-shadow: none;
}
#drawer.open { right: 0; box-shadow: -12px 0 40px rgba(0,0,0,0.22); }
#drawer .close {
  position: absolute;
  top: 14px; right: 16px;
  background: none; border: none;
  color: var(--text-dim);
  font-size: 1.3rem;
  cursor: pointer;
}
#drawer h2 { font-size: 1.1rem; margin-bottom: 2px; padding-right: 30px; }
#drawer .addr { color: var(--text-dim); font-size: 0.82rem; margin-bottom: 14px; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.stat-grid .cell { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.stat-grid .cell .lb { font-size: 0.68rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.4px; }
.stat-grid .cell .vl { font-size: 1.05rem; font-weight: 700; margin-top: 2px; }
.contact-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin: 12px 0;
  font-size: 0.86rem;
  line-height: 1.55;
}
.contact-box .who { font-weight: 700; }
.enrich-anim { color: var(--text-dim); font-size: 0.82rem; display: flex; gap: 8px; align-items: center; }
#mockup-box { margin: 14px 0; }
.mockup-photo {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  display: block;
  cursor: zoom-in;
}
#lightbox {
  position: fixed;
  inset: 0;
  z-index: 1900;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(4, 8, 14, 0.88);
  cursor: zoom-out;
}
#lightbox.on { display: flex; }
#lightbox img {
  max-width: 94vw;
  max-height: 94vh;
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.7);
}
.mockup-photo.dim { opacity: 0.75; }
.kw-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg);
  font-size: 0.8rem;
}
.kw-chip button {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0;
}
.kw-chip button:hover { color: var(--red); }
#kw-input,
.set-num {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 10px;
  font-size: 0.85rem;
}
.set-num { width: 110px; }
.ai-badge {
  margin-top: 6px;
  padding: 4px 8px;
  border: 1px solid var(--amber);
  border-radius: 6px;
  color: var(--amber);
  background: rgba(255, 182, 72, 0.08);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.real-badge {
  margin-top: 6px;
  padding: 4px 8px;
  border: 1px solid var(--green);
  border-radius: 6px;
  color: var(--green);
  background: rgba(63, 185, 80, 0.08);
  font-size: 0.72rem;
  font-weight: 600;
}
.photo-empty {
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 22px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.88rem;
}
.photo-empty .ico { font-size: 1.6rem; opacity: 0.6; }
.waterfall { display: flex; flex-direction: column; gap: 4px; margin: 4px 0; }
.wf-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.82rem;
  background: var(--bg-card);
}
.wf-row.checking { border-color: var(--amber); }
.wf-row .wf-name { flex: 1; }
.wf-row .wf-status { font-size: 0.76rem; white-space: nowrap; }
.wf-row .spinner { width: 11px; height: 11px; }
#mockup-toggle { display: flex; gap: 6px; margin-top: 8px; }
.scene-select {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 11px;
  font-size: 0.88rem;
  font-family: inherit;
  cursor: pointer;
}
.scene-select:hover, .scene-select:focus { border-color: var(--amber); outline: none; }
.attach-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
  flex-wrap: wrap;
}
.attach-row img {
  height: 64px;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.drawer-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }

/* warm roofline glow animation on leaflet SVG paths */
.roofline-glow {
  filter: drop-shadow(0 0 6px #ffb648) drop-shadow(0 0 14px #ff9d1f);
  animation: glowpulse 2.2s ease-in-out infinite;
}
@keyframes glowpulse {
  0%, 100% { filter: drop-shadow(0 0 5px #ffb648) drop-shadow(0 0 12px #ff9d1f); }
  50%      { filter: drop-shadow(0 0 9px #ffcf7d) drop-shadow(0 0 22px #ffb648); }
}
.roofline-dots {
  stroke-dasharray: 1 14;
  stroke-linecap: round;
  animation: marquee 1.6s linear infinite;
}
@keyframes marquee { to { stroke-dashoffset: -15; } }

/* ── Kanban ── */
#kanban { display: flex; gap: 14px; align-items: flex-start; overflow-x: auto; padding-bottom: 12px; }
.kcol {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 250px;
  width: 250px;
  padding: 12px;
}
.kcol h3 { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-dim); margin-bottom: 10px; display: flex; justify-content: space-between; }
.kcol.dragover { border-color: var(--amber); }
.kcard {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px;
  margin-bottom: 8px;
  cursor: grab;
  font-size: 0.84rem;
}
.kcard:active { cursor: grabbing; }
.kcard .nm { font-weight: 600; margin-bottom: 4px; }
.kcard .meta { color: var(--text-dim); font-size: 0.74rem; }
.kcard .val { color: var(--amber); font-weight: 600; font-size: 0.78rem; margin-top: 5px; }

/* ── Campaigns ── */
.campaign-card { margin-bottom: 14px; }
.campaign-card .stats { display: flex; gap: 22px; margin-top: 10px; font-size: 0.84rem; }
.campaign-card .stats b { font-size: 1.05rem; display: block; }
.email-preview {
  background: #10151d;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  font-size: 0.84rem;
  white-space: pre-wrap;
  line-height: 1.55;
  color: #c7d0dc;
  margin-top: 10px;
}

/* ── Modal ── */
#modal-veil {
  position: fixed; inset: 0;
  background: rgba(5, 8, 12, 0.72);
  z-index: 1400;
  display: none;
  align-items: center;
  justify-content: center;
}
#modal-veil.on { display: flex; }
#modal {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 560px;
  max-width: 92vw;
  max-height: 86vh;
  overflow-y: auto;
  padding: 22px;
}
#modal h2 { font-size: 1.05rem; margin-bottom: 14px; }
.modal-x {
  position: sticky;
  top: -22px;
  float: right;
  margin: -22px -22px 0 12px;
  background: var(--bg-raised);
  border: none;
  color: var(--text-dim);
  font-size: 1.2rem;
  line-height: 1;
  padding: 10px 12px;
  cursor: pointer;
  border-radius: 0 14px 0 10px;
}
.modal-x:hover { color: var(--amber); }
#modal label { display: block; font-size: 0.78rem; color: var(--text-dim); margin: 12px 0 5px; }
#modal input[type="text"], #modal input[type="email"], #modal input[type="tel"], #modal textarea, #modal select, #modal input[type="number"], #modal input[type="date"] {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 11px;
  font-size: 0.88rem;
  font-family: inherit;
}
#modal textarea { min-height: 130px; resize: vertical; }
.check-list { display: flex; flex-direction: column; gap: 6px; max-height: 180px; overflow-y: auto; }
.check-list label { display: flex; gap: 8px; align-items: center; margin: 0; font-size: 0.85rem; color: var(--text); cursor: pointer; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.paste-zone {
  border: 1px dashed var(--amber);
  background: var(--amber-soft);
  border-radius: 8px;
  padding: 22px;
  text-align: center;
  outline: none;
}
.paste-zone:focus {
  box-shadow: 0 0 0 2px rgba(255, 182, 72, 0.25);
}
.paste-zone b {
  display: block;
  margin-bottom: 4px;
}
.paste-zone span {
  color: var(--text-dim);
  font-size: 0.82rem;
}
.photo-pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  max-height: 62vh;
  overflow: auto;
  padding-right: 2px;
}
.photo-pick {
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 8px;
  padding: 0;
  color: var(--text);
  cursor: pointer;
  overflow: hidden;
  text-align: left;
}
.photo-pick:hover {
  border-color: var(--amber);
  box-shadow: 0 0 0 2px var(--amber-soft);
}
.photo-pick img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: #0b111c;
}
.photo-pick span {
  display: block;
  padding: 8px;
  font-size: 0.78rem;
}
.photo-pick small {
  display: block;
  color: var(--text-dim);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── VA view ── */
.va-cards { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-bottom: 20px; }
.va-card .who { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.va-card .avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--amber-soft);
  color: var(--amber);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.va-card .nm { font-weight: 700; }
.va-card .rl { font-size: 0.76rem; color: var(--text-dim); }
.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .two-col { grid-template-columns: 1fr; } }
.kb-item { border-bottom: 1px solid var(--border); padding: 12px 0; }
.kb-item:last-child { border-bottom: none; }
.kb-item .t { font-weight: 600; font-size: 0.9rem; margin-bottom: 4px; }
.kb-item .b { font-size: 0.82rem; color: var(--text-dim); line-height: 1.5; }
.kb-item .m { font-size: 0.7rem; color: var(--text-dim); margin-top: 6px; opacity: 0.75; }

/* ── Renewals ── */
.goal-hero { text-align: center; padding: 30px 18px; }
.goal-hero .num { font-size: 2.6rem; font-weight: 800; color: var(--amber); }
.goal-hero .of { color: var(--text-dim); font-size: 0.9rem; margin-top: 4px; }
.goal-hero .bar { height: 14px; background: var(--bg); border-radius: 99px; overflow: hidden; margin: 18px auto 8px; max-width: 520px; border: 1px solid var(--border); }
.goal-hero .bar > div { height: 100%; background: linear-gradient(90deg, var(--amber), var(--green)); transition: width 0.8s ease; }

/* ── Records — CRUD tabs ── */
.rec-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.rec-tab {
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text-dim);
  padding: 8px 16px; border-radius: 9px; font-size: 0.86rem; font-weight: 600; cursor: pointer;
}
.rec-tab:hover { border-color: var(--amber); color: var(--text); }
.rec-tab.on { background: var(--amber-soft); border-color: var(--amber); color: var(--amber); }
.rec-search {
  flex: 1; max-width: 340px; background: var(--bg); border: 1px solid var(--border);
  color: var(--text); padding: 7px 12px; border-radius: 8px; font: inherit; font-size: 0.86rem;
}
.rec-search:focus { outline: none; border-color: var(--amber); }
.rec-actions { white-space: nowrap; text-align: right; }
.rec-actions .btn { margin-left: 4px; }
.rec-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* toast */
#toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translate(-50%, 80px);
  background: var(--bg-card);
  border: 1px solid var(--amber);
  color: var(--text);
  padding: 11px 20px;
  border-radius: 10px;
  font-size: 0.88rem;
  z-index: 2000;
  transition: transform 0.25s ease;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}
#toast.on { transform: translate(-50%, 0); }

/* leaflet dark-ish popup tweaks */
.leaflet-popup-content-wrapper { background: var(--bg-card); color: var(--text); border-radius: 10px; }
.leaflet-popup-tip { background: var(--bg-card); }
.leaflet-container { font: inherit; }

/* ── Roofline segmentation + measure tool ── */
.seg-list { display: flex; flex-direction: column; gap: 4px; margin: 6px 0 8px; }
.seg-row { display: grid; grid-template-columns: 20px 1fr auto auto; align-items: center; gap: 10px; padding: 7px 9px; background: var(--bg-raised); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.seg-row:hover { border-color: var(--amber); }
.seg-row input { accent-color: var(--amber); cursor: pointer; }
.seg-name { font-weight: 600; }
.seg-len { color: var(--amber); font-variant-numeric: tabular-nums; }
.seg-dir { font-size: 0.8rem; }
.seg-total { margin-top: 8px; font-size: 0.92rem; line-height: 1.5; }
#measure-readout { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 600; padding: 8px 12px; background: var(--bg-card); border: 1px solid var(--amber); border-radius: 9px; font-size: 0.86rem; box-shadow: 0 6px 22px rgba(0,0,0,0.5); cursor: move; user-select: none; white-space: nowrap; touch-action: none; }
#measure-readout.dragging { opacity: 0.92; }
#measure-readout .drag-grip { color: var(--text-dim); cursor: move; margin-right: 2px; }
#measure-readout button { cursor: pointer; }
#map.measuring { cursor: crosshair; }
.measure-lbl { color: var(--night); background: var(--amber); border-radius: 6px; padding: 1px 6px; font: 600 11px/1.4 "Archivo", Arial, sans-serif; white-space: nowrap; box-shadow: 0 1px 4px rgba(0,0,0,0.45); }

/* ── R-10 · Design Studio (conversational mockup editor) ──────────── */
#studio-veil { position: fixed; inset: 0; background: rgba(5,8,12,0.82); z-index: 1600; display: none; }
#studio-veil.on { display: flex; align-items: center; justify-content: center; }
#studio {
  background: var(--bg-raised); border: 1px solid var(--border); border-radius: 14px;
  width: 1100px; max-width: 96vw; height: 88vh; max-height: 88vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.st-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.st-body { display: flex; flex: 1; min-height: 0; }
.st-log { width: 300px; flex-shrink: 0; border-right: 1px solid var(--border); overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--bg); }
.st-msg { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 8px; cursor: pointer; transition: border-color 0.12s; }
.st-msg:hover { border-color: var(--amber); }
.st-msg.cur { border-color: var(--amber); box-shadow: 0 0 0 1px var(--amber-soft); }
.st-msg-role { font-size: 0.63rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-dim); }
.st-msg-text { font-size: 0.82rem; margin: 3px 0 6px; }
.st-thumb { width: 100%; border-radius: 6px; display: block; }
.st-stage { flex: 1; display: flex; flex-direction: column; min-width: 0; padding: 14px; gap: 10px; }
.st-canvas { flex: 1; min-height: 0; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; }
#st-img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; }
.st-step { position: absolute; bottom: 8px; left: 10px; background: rgba(5,8,12,0.72); color: rgba(255,255,255,0.75); padding: 3px 8px; border-radius: 6px; font-size: 0.72rem; }
.st-quote { font-size: 0.85rem; }
.st-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.st-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.st-chip { background: var(--bg-card); border: 1px solid var(--border); color: var(--text); border-radius: 20px; padding: 5px 12px; font-size: 0.8rem; cursor: pointer; font-family: inherit; }
.st-chip:hover { border-color: var(--amber); color: var(--amber); }
.st-input { display: flex; gap: 8px; }
.st-input input { flex: 1; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; color: var(--text); padding: 10px 12px; font-size: 0.9rem; font-family: inherit; }
.st-input input:focus { outline: none; border-color: var(--amber); }
@media (max-width: 820px) {
  #studio { height: 92vh; max-height: 92vh; }
  .st-body { flex-direction: column; }
  .st-log { width: auto; max-height: 150px; border-right: none; border-bottom: 1px solid var(--border); }
}

/* ── R-09 · Jobber import ─────────────────────────────────────────── */
.jmap-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin-bottom: 12px; }
.jmap-row { display: flex; flex-direction: column; gap: 3px; }
.jmap-row label { margin: 0; font-size: 0.72rem; color: var(--text-dim); }
.jmap-sel { width: 100%; background: var(--bg-card); border: 1px solid var(--border); border-radius: 7px; color: var(--text); padding: 6px 8px; font-size: 0.8rem; font-family: inherit; }
.jmap-sel:focus { outline: none; border-color: var(--amber); }
.jcounts { display: flex; gap: 8px; margin: 4px 0 10px; }
.jbadge { font-size: 0.72rem; font-weight: 600; padding: 2px 9px; border-radius: 20px; text-transform: capitalize; }
.jbadge.create { background: #10391f; color: var(--green); }
.jbadge.update { background: #3a2d10; color: var(--amber); }
.jbadge.skip { background: rgba(139,152,171,0.15); color: var(--text-dim); }
.jprev-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
.jprev { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.jprev th { padding: 7px 9px; font-size: 0.66rem; }
.jprev td { padding: 7px 9px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.jprev tr:last-child td { border-bottom: none; }
.jresult { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; font-size: 0.9rem; margin-top: 6px; }
.jresult b { color: var(--amber); font-size: 1.05rem; }
@media (max-width: 560px) { .jmap-grid, .jresult { grid-template-columns: 1fr; } }

/* ── R-08 · AI Assistant ──────────────────────────────────────────── */
#assistant-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 1500;
  width: 56px; height: 56px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.14); cursor: pointer;
  background: var(--night); color: var(--snow);
  font-size: 1.5rem; box-shadow: 0 10px 30px rgba(0,0,0,0.28);
}
#assistant-fab::after { content: ""; position: absolute; inset: -3px; border: 2px solid var(--amber); border-radius: inherit; opacity: 0; transition: opacity 0.15s; }
#assistant-fab:hover::after { opacity: 1; }
#assistant-fab img { width: 31px; height: 31px; object-fit: contain; }
#assistant-panel {
  position: fixed; right: 0; top: 0; bottom: 0; width: 400px; max-width: 94vw;
  background: var(--bg-raised); border-left: 1px solid var(--border);
  z-index: 1550; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform 0.22s ease; box-shadow: none;
}
#assistant-panel.open { transform: translateX(0); box-shadow: -8px 0 28px rgba(0,0,0,0.18); }
.asst-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.asst-brand { display: flex; align-items: center; gap: 9px; }
.asst-head-btns { display: flex; align-items: center; gap: 6px; }
.asst-brand img { width: 30px; height: 30px; object-fit: contain; }
#asst-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 9px; }
.asst-msg { max-width: 88%; padding: 9px 12px; border-radius: 12px; font-size: 0.86rem; line-height: 1.4; white-space: pre-wrap; word-wrap: break-word; }
.asst-msg.user { align-self: flex-end; background: var(--amber); color: var(--night); border-bottom-right-radius: 4px; }
.asst-msg.bot { align-self: flex-start; background: var(--bg-card); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.asst-tool { align-self: flex-start; font-size: 0.75rem; color: var(--text-dim); padding: 2px 8px; }
.asst-think { font-style: italic; opacity: 0.7; }
.asst-confirm { align-self: stretch; background: var(--bg-card); border: 1px solid var(--amber); border-radius: 12px; padding: 11px 13px; }
.asst-confirm-h { font-size: 0.8rem; font-weight: 600; color: var(--amber); margin-bottom: 6px; }
.asst-confirm ul { margin: 0 0 10px; padding-left: 18px; font-size: 0.83rem; }
.asst-confirm ul li { margin-bottom: 3px; }
.asst-confirm-btns { display: flex; gap: 8px; }
.asst-chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 14px 8px; }
.asst-chip { background: var(--bg-card); border: 1px solid var(--border); color: var(--text-dim); border-radius: 16px; padding: 4px 10px; font-size: 0.74rem; cursor: pointer; font-family: inherit; }
.asst-chip:hover { border-color: var(--amber); color: var(--amber); }
.asst-input-bar { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--border); }
.asst-input-bar input { flex: 1; background: var(--bg-card); border: 1px solid var(--border); border-radius: 9px; color: var(--text); padding: 10px 12px; font-size: 0.86rem; font-family: inherit; }
.asst-input-bar input:focus { outline: none; border-color: var(--amber); }
@media (max-width: 560px) { #assistant-panel { width: 100vw; } }

/* ── R-13 · auth + roles ──────────────────────────────────────────── */
#auth-veil { position: fixed; inset: 0; background: rgba(5,8,12,0.92); z-index: 2000; display: none; align-items: center; justify-content: center; }
#auth-veil.on { display: flex; }
#auth-box { position: relative; overflow: hidden; background: var(--bg-raised); border: 1px solid var(--border); border-radius: 22px; padding: 30px; width: 360px; max-width: 92vw; box-shadow: var(--shadow-lg); }
#auth-box::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--brand-rainbow); }
#auth-box .auth-logo { display: flex; align-items: center; gap: 10px; font-size: 1.08rem; font-weight: 800; letter-spacing: 0.1em; margin-bottom: 8px; }
#auth-box .auth-logo img { width: 34px; height: 34px; object-fit: contain; }
#auth-box input { width: 100%; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; color: var(--text); padding: 10px 12px; font-size: 0.9rem; font-family: inherit; margin-top: 8px; }
#auth-box input:focus { outline: none; border-color: var(--amber); }
.auth-err { color: var(--red); font-size: 0.8rem; min-height: 16px; margin-top: 6px; }
#user-chip { display: flex; align-items: center; gap: 8px; margin-left: auto; }
#user-chip .uc-name { font-size: 0.82rem; color: var(--snow); }
#user-chip .uc-role { font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.5px; padding: 2px 8px; border-radius: 20px; font-weight: 600; }
#user-chip .uc-role.admin { background: var(--amber-soft); color: var(--amber); }
#user-chip .uc-role.va { background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.7); }
#topbar #user-chip .btn.ghost { color: rgba(255,255,255,0.78); border-color: rgba(255,255,255,0.2); }
#topbar #user-chip .btn.ghost:hover { color: var(--amber); border-color: var(--amber); }
.ro-note { background: var(--amber-soft); color: var(--amber); border-radius: 8px; padding: 8px 11px; font-size: 0.8rem; margin-bottom: 10px; }
input:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Lead engine · category business search (map panel) ─────────────── */
#biz-search {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
#biz-zip {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.85rem;
  padding: 6px 10px;
  width: 130px;
  font-family: inherit;
  outline: none;
}
#biz-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 8px 0 4px;
}
#biz-cats label {
  font-size: 0.78rem;
  color: var(--text-dim);
  display: flex;
  gap: 5px;
  align-items: center;
  cursor: pointer;
}
#biz-results { margin-top: 6px; max-height: 46vh; overflow-y: auto; }
.biz-row {
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.biz-row:hover { background: rgba(255, 255, 255, 0.03); }
.biz-row.rejected { opacity: 0.45; }
.biz-row .nm { font-weight: 600; font-size: 0.85rem; }
.biz-row .meta {
  font-size: 0.74rem;
  color: var(--text-dim);
  margin-top: 2px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.biz-row .meta a { color: var(--blue); }
.biz-row .actions { margin-top: 6px; display: flex; gap: 6px; }

/* ── ZIP coverage view ──────────────────────────────────────────────── */
#zc-q {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.82rem;
  padding: 6px 10px;
  font-family: inherit;
  outline: none;
}
.zc-status-sel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.78rem;
  padding: 4px 6px;
  font-family: inherit;
}
tr.zc-done-row td { opacity: 0.55; }
#biz-cov { margin: 6px 0 2px; }

/* ── contact verification (R-12) ────────────────────────────────────── */
.agent-warn {
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--amber);
  border-left-width: 4px;
  border-radius: 10px;
  background: #21190d;
  color: var(--snow);
  box-shadow: 0 8px 20px rgba(5, 5, 5, 0.12);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.45;
}
.agent-warn b { color: var(--amber); }

/* ── Jobs module ────────────────────────────────────────────────────── */
.job-card { margin-bottom: 14px; }
.job-card a { color: var(--blue); }
.site-note { padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 0.82rem; }
.site-note-input {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.82rem;
  padding: 6px 10px;
  font-family: inherit;
  outline: none;
}
.site-photos { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.site-photo { margin: 0; max-width: 180px; }
.site-photo img { width: 100%; border-radius: 8px; border: 1px solid var(--border); cursor: zoom-in; }
.site-photo figcaption { font-size: 0.7rem; margin-top: 2px; }

/* ── quote (lease vs purchase) ──────────────────────────────────────── */
.quote-opts { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 4px; }
.quote-opt {
  flex: 1;
  min-width: 150px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(244, 242, 237, 0.72);
}

/* Compact navigation preserves the full operating surface on smaller screens. */
@media (max-width: 900px) {
  #sidebar { width: 76px; min-width: 76px; padding: 20px 8px 14px; }
  #sidebar .brand-lockup { justify-content: center; padding: 0; }
  #sidebar .brand-lockup > div, #sidebar .tagline, #sidebar .foot { display: none; }
  #sidebar nav { margin-top: 14px; gap: 5px; }
  #sidebar nav button { justify-content: center; gap: 0; padding: 11px 8px; font-size: 0; }
  #sidebar nav button .ico { width: auto; font-size: 1rem; }
  #sidebar nav button.active::before { top: 6px; bottom: 6px; }
  #topbar { padding: 0 20px; }
  #topbar .goal-chip { display: none; }
  #view { padding: 22px; }
}

@media (max-width: 620px) {
  #sidebar { width: 62px; min-width: 62px; padding-inline: 6px; }
  #sidebar .brand-lockup img { width: 34px; height: 34px; }
  #topbar { height: 60px; min-height: 60px; padding: 0 14px; }
  #user-chip .uc-name, #user-chip .uc-role { display: none; }
  #view { padding: 16px; }
  .card { padding: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  #sidebar::after,
  #topbar::after { transition: none; }
}
.quote-opt .big { font-size: 1.15rem; font-weight: 700; }
