:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1c1e21;
  --muted: #67707b;
  --border: #e1e4e8;
  --primary: #1f6feb;
  --primary-dark: #1a5fd0;
  --danger: #c93c37;
  --ok: #2da44e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.45;
}

.topbar {
  background: #172335;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.topbar h1 { font-size: 1.15rem; margin: 0; }

.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 16px;
}

/* Tabs */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; }
.tab {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 16px;
  cursor: pointer;
}
.tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Status strip */
.email-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 12px;
}
.email-status strong { color: var(--text); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.dot-ok { background: var(--ok); }
.dot-warn { background: #d4a72c; }

/* Summary chips */
.summary-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.summary-chip {
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  background: #57606a;
}
.summary-chip.c-active { background: var(--ok); }
.summary-chip.c-growth { background: var(--primary); }
.summary-chip.c-sms { background: #6d4aa8; }
.summary-chip.c-churn { background: #b3564d; }

/* Unsubscribe notices */
.notice-box {
  background: #fff8e6;
  border: 1px solid #f0d48a;
  border-radius: 10px;
  padding: 4px 8px;
  margin-bottom: 12px;
}
.notice-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px;
  font-size: 0.88rem;
}
.notice-row + .notice-row { border-top: 1px solid #f0e4c0; }
.notice-dismiss { color: var(--muted); }
.summary-chip.c-unsub { background: #b3b9c0; }
.summary-chip.c-bounced { background: #e16f24; }
.summary-chip.c-complained { background: var(--danger); }

/* Toolbar rows */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar input[type="search"], .toolbar select {
  margin: 0; width: auto; flex: 1; min-width: 140px;
}
.toolbar .btn { white-space: nowrap; }

/* Subscriber rows */
.sub-list { display: flex; flex-direction: column; gap: 8px; }
.sub-row {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 2px 12px;
  align-items: center;
  cursor: pointer;
}
.sub-row:hover { border-color: #c8ccd1; }
.sub-name { font-weight: 700; }
.sub-email { color: var(--muted); font-size: 0.85rem; grid-column: 1; overflow-wrap: anywhere; }
.sub-geo { color: var(--text); font-size: 0.9rem; text-align: right; grid-row: 1; grid-column: 2; white-space: nowrap; }

.badge {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border-radius: 4px;
  padding: 2px 7px;
  background: #eef1f4;
  color: #57606a;
  grid-row: 1 / span 2;
  grid-column: 3;
  justify-self: end;
}
.badge.st-active { background: #dcf5e4; color: #1a6f3c; }
.badge.st-unsubscribed { background: #e8e8e8; color: #666; }
.badge.st-bounced { background: #ffe8d9; color: #9a4a12; }
.badge.st-complained { background: #ffdfdd; color: #9c1f1a; }
.badge.st-draft { background: #eef1f4; color: #57606a; }
.badge.st-sending { background: #dcebff; color: #1a4f9c; }
.badge.st-sent { background: #dcf5e4; color: #1a6f3c; }
.badge.st-dryrun { background: #fff3d6; color: #8a6a12; }

/* Campaign cards */
.camp-list { display: flex; flex-direction: column; gap: 10px; }
.camp-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
}
.camp-card:hover { border-color: #c8ccd1; }
.camp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.camp-subject { font-weight: 700; }
.camp-meta { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }
.camp-stats { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 0.85rem; color: var(--muted); }
.camp-stats strong { color: var(--text); font-size: 1rem; }

/* Audience preview box */
.aud-preview {
  background: #f4f8ff;
  border: 1px solid #d7e4f7;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.85rem;
  margin-top: 10px;
}
.aud-preview strong { font-size: 1rem; }

/* Progress bar */
.progress { background: #eef1f4; border-radius: 999px; height: 10px; overflow: hidden; margin-top: 8px; }
.progress-fill { background: var(--primary); height: 100%; transition: width 0.4s; }

/* Subscriber table */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
.sub-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.sub-table th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 2px solid var(--border);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--card);
}
.sub-table th:hover { color: var(--text); }
.sub-table th.sorted { color: var(--primary); }
.sub-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.sub-table td.td-email { overflow-wrap: anywhere; white-space: normal; }
.sub-table tbody tr { cursor: pointer; }
.sub-table tbody tr:hover { background: #f4f8ff; }
.sub-table .badge { grid-row: auto; grid-column: auto; }

/* Hotspot map */
.hotspot-map {
  height: 560px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
}
.map-legend {
  background: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.7;
  box-shadow: 0 1px 6px rgba(0,0,0,.2);
}
.map-legend .dot { display: inline-block; border-radius: 50%; margin-right: 6px; vertical-align: middle; }

/* Zones: rail + live map, one surface */
.zones-layout { display: grid; grid-template-columns: 235px 1fr; gap: 12px; }
/* Grid children default to min-width:auto, so a wide child (29 zone pills in a
   row) sizes its whole track to the content and drags the map out with it.
   This is what kept the page 4,000px wide on a phone. */
.zones-layout > * { min-width: 0; }
.zone-rail-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; max-height: 600px; overflow-y: auto; }
.zone-pill {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 7px 10px; background: var(--card); border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer; font-size: 0.88rem; font-weight: 600;
}
.zone-pill:hover { border-color: #c8ccd1; }
.zone-pill.sel { border-color: var(--primary); background: #eaf2ff; }
.zone-pill.spec { opacity: 0.75; }
.zp-n { color: var(--muted); font-weight: 700; }
.zone-detail {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 12px; margin-bottom: 10px; min-height: 44px;
}
.zone-detail input { width: auto; flex: 1; min-width: 130px; margin: 0; font-weight: 700; }
.zone-detail .badge { grid-row: auto; grid-column: auto; }
.zones-map { height: 560px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); }
/* Setup-spot marker (the one emoji the owner wants kept) */
.setup-pin { font-size: 26px; line-height: 30px; text-align: center; filter: drop-shadow(0 2px 2px rgba(0,0,0,.35)); }

/* Autopilot schedule boxes */
.auto-box {
  border: 1px solid var(--border); border-radius: 10px; background: #fafbfc;
  padding: 10px 12px 12px; margin-top: 12px;
}
.auto-box-head {
  font-size: 0.78rem; font-weight: 800; letter-spacing: 0.04em;
  color: var(--primary); text-transform: uppercase; margin-bottom: 2px;
}
.auto-box .row { gap: 12px; }
.auto-box label { margin-top: 6px; }

/* Text inbox */
.tab-count {
  display: inline-block; margin-left: 6px; min-width: 18px; padding: 0 5px;
  background: var(--danger); color: #fff; border-radius: 999px;
  font-size: 0.72rem; font-weight: 800; line-height: 18px; text-align: center;
}
.inbox-layout { display: grid; grid-template-columns: 250px 1fr; gap: 12px; }
.thread-list { display: flex; flex-direction: column; gap: 6px; max-height: 560px; overflow-y: auto; }
.thread-pill {
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; cursor: pointer;
}
.thread-pill:hover { border-color: #c8ccd1; }
.thread-pill.sel { border-color: var(--primary); background: #eaf2ff; }
.th-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.th-name { font-weight: 700; font-size: 0.88rem; }
.th-unread {
  background: var(--danger); color: #fff; border-radius: 999px;
  font-size: 0.7rem; font-weight: 800; padding: 0 6px;
}
.th-last { color: var(--muted); font-size: 0.78rem; margin-top: 2px; overflow-wrap: anywhere; }
.thread-view {
  display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 12px;
}
.thread-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.thread-head .hint { display: block; margin: 2px 0 0; }
.thread-msgs { flex: 1; min-height: 300px; max-height: 420px; overflow-y: auto; padding: 12px 2px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 78%; }
.msg.in { align-self: flex-start; }
.msg.out { align-self: flex-end; text-align: right; }
.msg-body { padding: 8px 12px; border-radius: 14px; font-size: 0.9rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.in .msg-body { background: #eef1f4; color: var(--text); border-bottom-left-radius: 4px; }
.msg.out .msg-body { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.msg-at { font-size: 0.7rem; color: var(--muted); margin-top: 2px; }
.thread-reply { display: flex; gap: 8px; align-items: flex-end; border-top: 1px solid var(--border); padding-top: 10px; }
.thread-reply textarea { flex: 1; margin: 0; }
@media (max-width: 760px) {
  .inbox-layout { grid-template-columns: 1fr; }
  .thread-list { flex-direction: row; overflow-x: auto; max-height: none; }
  .thread-pill { min-width: 170px; }
}

/* Scheduled-send banners on a campaign card */
.sched-lines { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.sched-line {
  font-size: 0.82rem; font-weight: 700;
  padding: 5px 10px; border-radius: 6px; border-left: 4px solid;
}
.sched-line.email { background: #eaf2ff; border-color: #1f6feb; color: #14448f; }
.sched-line.text { background: #e7f7ec; border-color: #2da44e; color: #16663a; }

/* Corner badge stack: email above, text below */
.badge-stack { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.badge.bd-email { background: #dcebff; color: #14448f; }
.badge.bd-text { background: #dcf5e4; color: #16663a; }
.badge.sched { background: #fff; box-shadow: inset 0 0 0 1px currentColor; }

/* Schedule row */
.sched-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: 10px; padding: 10px 12px; background: #f4f8ff; border: 1px solid #d7e4f7; border-radius: 8px; }
.sched-row input { margin-top: 4px; width: auto; }
.sched-row .hint { flex-basis: 100%; margin: 0; }
@media (max-width: 760px) {
  .zones-layout { grid-template-columns: 1fr; }
  /* Zones wrap into rows you can thumb through instead of one endless strip. */
  .zone-rail-list {
    flex-flow: row wrap; align-content: flex-start;
    max-height: 34vh; overflow-y: auto; overflow-x: hidden;
    padding: 2px; margin-top: 8px;
  }
  .zone-pill { white-space: nowrap; flex: 1 1 auto; min-width: 0; font-size: 0.82rem; padding: 8px 10px; }
  .zone-pill span:first-child { overflow: hidden; text-overflow: ellipsis; }
  /* Tall enough to be usable, short enough that the rail stays reachable. */
  .zones-map { height: clamp(300px, 52vh, 460px); }
  .zone-detail { padding: 8px 10px; }
  .zone-detail input { flex: 1 1 100%; min-width: 0; }
}

/* Image upload preview */
.img-preview img { max-width: 240px; border-radius: 8px; display: block; margin: 8px 0 6px; border: 1px solid var(--border); }

/* "opted in to texts" tag in the subscriber table */
.tag-sms {
  display: inline-block;
  background: #6d4aa8; color: #fff;
  font-size: 0.64rem; font-weight: 800; letter-spacing: 0.06em;
  padding: 2px 6px; border-radius: 4px;
}

/* Zone member list */
.member-list {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 10px;
  font-size: 0.85rem;
}
.member-row {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}
.member-row:last-child { border-bottom: none; }
.member-row .m-geo { color: var(--muted); white-space: nowrap; }

/* Empty state */
.empty-state {
  text-align: center;
  color: var(--muted);
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 36px 20px;
}
.empty-emoji { font-size: 2.2rem; margin: 0 0 6px; }

/* Buttons */
.btn {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
}
.btn:hover { background: #f3f4f6; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: #fff; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: #fdeeee; }
.btn-sm { padding: 5px 10px; font-size: 0.8rem; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* Sheets (modals) */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 30, 0.5);
  z-index: 2000; /* above Leaflet: its panes go to 400 and its controls to 1000 */
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 20px 10px;
}
.sheet {
  background: var(--card);
  border-radius: 12px;
  width: 100%;
  max-width: 640px;
  padding: 18px 20px 22px;
}
.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.sheet-head h2 { margin: 0; font-size: 1.15rem; }
.btn-ghost { border: none; background: transparent; font-size: 1.1rem; cursor: pointer; }

fieldset {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 0 0 14px;
  padding: 10px 14px 14px;
}
legend { font-weight: 700; font-size: 0.9rem; padding: 0 6px; }

label { display: block; font-size: 0.85rem; font-weight: 600; color: #3a4149; margin-top: 10px; }
input, select, textarea {
  display: block;
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  margin-top: 4px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: 0;
  border-color: var(--primary);
}
textarea { resize: vertical; }
input[type="checkbox"] { width: auto; display: inline-block; margin: 0 6px 0 0; }

.row { display: flex; gap: 10px; }
.grow { flex: 1; }

.hint { font-size: 0.8rem; color: var(--muted); margin: 6px 0 0; }

.form-errors {
  background: #fdeeee;
  border: 1px solid #f1c4c2;
  color: #9c1f1a;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 0.9rem;
}
.form-success {
  background: #dcf5e4;
  border: 1px solid #b7e4c7;
  color: #1a6f3c;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 0.9rem;
}

.sheet-actions { display: flex; gap: 10px; align-items: center; margin-top: 4px; flex-wrap: wrap; }
.spacer { flex: 1; }

.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin-top: 14px; }
.check input { width: auto; margin-top: 3px; }

/* Signup link card */
.link-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 12px;
}
.link-card code {
  display: block;
  background: #eef1f4;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.85rem;
  overflow-wrap: anywhere;
  margin: 8px 0;
}

iframe.preview-frame {
  width: 100%;
  height: 480px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

@media (max-width: 480px) {
  .topbar h1 { font-size: 1rem; }
  .sheet { padding: 14px; }
  .row { flex-direction: column; gap: 0; }
  .sub-geo { display: none; }
}

/* Assistant's suggested reply, sitting between the conversation and the reply box. */
.ai-card {
  border: 1px solid #cfe0f7;
  background: #f5f9ff;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.ai-card.idle {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: transparent; border-style: dashed; border-color: var(--border);
}
.ai-card.hold { background: #fff8ec; border-color: #f0dcb4; }
.ai-label {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 4px;
}
.ai-text { margin: 0 0 6px; font-size: 0.92rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-reason { margin: 0 0 8px; font-size: 0.78rem; color: var(--muted); }
.ai-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* New-text alerts: corner toasts + the permission prompt in the Inbox. */
.toast-host {
  position: fixed; right: 16px; bottom: 16px; z-index: 200;
  display: flex; flex-direction: column-reverse; gap: 8px;
  max-width: min(340px, calc(100vw - 32px));
}
.toast {
  background: #172335; color: #fff; border-radius: 10px;
  padding: 10px 13px; cursor: pointer;
  box-shadow: 0 10px 30px -8px rgba(23, 35, 53, 0.55);
  animation: toast-in 0.18s ease-out;
}
.toast:hover { background: #22334a; }
.toast-title { font-weight: 700; font-size: 0.83rem; margin-bottom: 2px; }
.toast-body { font-size: 0.84rem; opacity: 0.85; overflow-wrap: anywhere; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.alerts-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  flex-wrap: wrap;
  background: #f5f9ff; border: 1px solid #cfe0f7; border-radius: 10px;
  padding: 9px 12px; margin-bottom: 12px;
  font-size: 0.85rem; color: var(--muted);
}

/* Template sheet: rendered preview vs raw HTML */
.tpl-view { margin-top: 4px; }
.tpl-tabs { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.tpl-tab {
  font: inherit; font-size: 0.8rem; font-weight: 700; cursor: pointer;
  background: var(--bg); color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px;
}
.tpl-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
#tPreviewPane iframe.preview-frame { height: 520px; background: #fff; }

/* In-app dialog — replaces confirm(), so buttons can say what they do and the
   browser can't switch them off. Sits above sheets. */
.ask-overlay { z-index: 2010; align-items: center; padding: 16px; }
.ask {
  background: var(--card); border-radius: 12px;
  width: 100%; max-width: 400px; padding: 18px 20px 16px;
  box-shadow: 0 18px 50px -12px rgba(15, 20, 30, 0.45);
}
.ask h3 { margin: 0 0 6px; font-size: 1.05rem; }
.ask p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.ask-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }
.ask-actions .btn { min-width: 96px; justify-content: center; }

/* Metro/rural picker — two labelled choices instead of OK/Cancel */
.kind-pick { display: flex; gap: 8px; flex-wrap: wrap; margin: 2px 0 4px; }
.kind-btn {
  flex: 1 1 180px; min-width: 0; text-align: left; cursor: pointer;
  font: inherit; color: var(--text);
  background: var(--card); border: 2px solid var(--border); border-radius: 10px;
  padding: 9px 12px;
}
.kind-btn strong { display: block; font-size: 0.95rem; }
.kind-btn span { display: block; font-size: 0.78rem; color: var(--muted); }
.kind-btn:hover { border-color: #c8ccd1; }
.kind-btn.sel { border-color: var(--primary); background: #eaf2ff; }
.zd-addr { flex: 1 1 100%; display: flex; align-items: center; gap: 8px; margin: 2px 0 0; font-size: 0.78rem; color: var(--muted); white-space: nowrap; }
.zd-addr input { flex: 1; margin: 0; font-size: 0.85rem; font-weight: 400; min-width: 0; }
/* The zone's own set-up pin, a touch bigger than the calendar ones */
.setup-pin.zone-pin { font-size: 30px; line-height: 34px; filter: drop-shadow(0 2px 3px rgba(0,0,0,.45)); }
.zd-addr .addr-warn { color: var(--danger); font-weight: 700; white-space: nowrap; }
.zd-addr .addr-ok { color: var(--ok); font-weight: 700; white-space: nowrap; }

/* Drop-a-pin mode */
.pin-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: #172335; color: #fff; border-radius: 10px;
  padding: 10px 14px; margin-bottom: 8px; font-size: 0.9rem; font-weight: 600;
}
#zmMap.pin-dropping, #zmMap.pin-dropping .leaflet-interactive { cursor: crosshair !important; }

/* Reminder half of a stop card */
.sched-line.reminder { background: #fdf3e3; border-color: #e8590c; color: #8a4a08; }
.badge.bd-rem { background: #fdeadb; color: #8a4a08; }

/* The wordmark is the way home — plain reload, back to the first tab */
.topbar .home-link { color: inherit; text-decoration: none; }
.topbar .home-link:hover { color: #ffb02e; }

/* "What are we making?" chooser behind + New campaign */
.pick-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.pick {
  text-align: left; cursor: pointer; font: inherit; color: var(--text);
  background: var(--card); border: 2px solid var(--border); border-radius: 10px;
  padding: 12px 14px;
}
.pick:hover { border-color: var(--primary); background: #f4f8ff; }
.pick strong { display: block; font-size: 1rem; }
.pick span { display: block; font-size: 0.84rem; color: var(--muted); margin-top: 2px; }

/* --- account chrome (Phase 3) --- */
.topbar-right { display: flex; align-items: center; gap: 10px; }
.whoami { color: var(--muted); font-size: 0.82rem; white-space: nowrap; }
.btn-quiet {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  text-decoration: none; display: inline-flex; align-items: center;
}
.btn-quiet:hover { color: var(--text); border-color: var(--muted); }
.verify-strip {
  background: #fff4e0; border: 1px solid #f0d9a8; color: #6b4d10;
  border-radius: 10px; padding: 10px 14px; margin-bottom: 14px;
  font-size: 0.9rem; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.verify-strip button {
  font: inherit; font-weight: 600; background: #6b4d10; color: #fff;
  border: none; border-radius: 7px; padding: 6px 12px; cursor: pointer;
}
@media (max-width: 640px) {
  .whoami { display: none; }
}

/* --- Connections tab (Phase 4) --- */
.conn-row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.conn-row label { flex: 1; min-width: 220px; }
.conn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.mt { margin-top: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem; }
.copyable {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; overflow-x: auto; white-space: nowrap; user-select: all;
}
.pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.78rem;
  font-weight: 600; background: var(--bg); border: 1px solid var(--border); color: var(--muted);
  white-space: nowrap;
}
.pill-ok { background: #e7efe9; border-color: #b9d3c2; color: #1f4733; }
.pill-wait { background: #fff4e0; border-color: #f0d9a8; color: #6b4d10; }
.pill-bad { background: #fdeceb; border-color: #f3c2be; color: #7d2620; }
.conn-note { border-radius: 8px; padding: 10px 12px; font-size: 0.9rem; margin-bottom: 14px; }
.conn-note.good { background: #e7efe9; border: 1px solid #b9d3c2; color: #1f4733; }
.conn-note.bad { background: #fdeceb; border: 1px solid #f3c2be; color: #7d2620; }
.table-scroll { overflow-x: auto; margin-top: 10px; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.mini-table th, .mini-table td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--border); }
.mini-table th { color: var(--muted); font-weight: 600; }
@media (max-width: 640px) {
  .conn-grid { grid-template-columns: 1fr; }
}

/* --- radius zones (Phase 4.5) --- */
.zd-radius {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.85rem; color: var(--muted); white-space: nowrap;
}
.zd-radius input[type="number"] { width: 4.5rem; margin: 0; padding: 4px 6px; }
.zd-radius input[type="checkbox"] { margin: 0; }
.radius-note {
  background: #e7efe9; border: 1px solid #b9d3c2; color: #1f4733;
  border-radius: 8px; padding: 7px 11px; font-size: 0.84rem; margin-top: 8px;
}

/* --- list-building kit (Phase 4.6) --- */
.kit-warn {
  background: #fff4e0; border: 1px solid #f0d9a8; color: #6b4d10;
  border-radius: 10px; padding: 11px 15px; font-size: 0.9rem; margin-bottom: 14px;
}
.kit-copy { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; }
.kit-copy code {
  flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 11px; font-size: 0.85rem;
  white-space: pre-wrap; word-break: break-all; user-select: all;
}
.kit-copy .btn { white-space: nowrap; }
.kit-qr { display: flex; gap: 20px; align-items: flex-start; margin-top: 12px; flex-wrap: wrap; }
.kit-qr img {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 8px; background: #fff; flex: none;
}
.kit-qr-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; min-width: 240px; }
.kit-qr-actions .hint { margin: 2px 0 0; }

/* --- billing (Phase 5) --- */
.bill-status { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 10px; }
.bill-blocked {
  background: #fdeceb; border: 1px solid #f3c2be; color: #7d2620;
  border-radius: 8px; padding: 9px 12px; font-size: 0.9rem;
}
.bill-warn {
  background: #fff4e0; border: 1px solid #f0d9a8; color: #6b4d10;
  border-radius: 8px; padding: 9px 12px; font-size: 0.9rem;
}
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin-top: 12px; }
.plan { border: 1px solid var(--border); border-radius: 12px; padding: 16px; background: var(--bg); }
.plan h3 { margin: 0 0 6px; font-size: 1.05rem; }
.plan-price { font-size: 1.9rem; font-weight: 800; margin: 0; letter-spacing: -0.02em; }
.plan-price span { font-size: 0.95rem; font-weight: 600; color: var(--muted); }
.plan-alt { color: var(--muted); font-size: 0.86rem; margin: 2px 0 10px; }
.plan ul { margin: 0 0 14px; padding-left: 18px; color: var(--muted); font-size: 0.88rem; }
.plan ul li { margin-bottom: 3px; }
.plan .btn { width: 100%; margin-bottom: 6px; }
.usage { margin-bottom: 14px; }
.usage-head { display: flex; justify-content: space-between; font-size: 0.86rem; margin-bottom: 5px; }
.usage-head span:last-child { color: var(--muted); }
.usage-track { height: 8px; border-radius: 999px; background: var(--border); overflow: hidden; }
.usage-fill { height: 100%; background: #2F6F4E; border-radius: 999px; transition: width .3s ease; }
.usage-fill.near { background: #d99a2b; }
.usage-fill.over { background: #c4453b; }
