/* Scout — territory map & campaign dashboard. Plain, bright, standard UI. */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f3f4f6;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-2: #d1d5db;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-ink: #ffffff;
  --accent-soft: #eff6ff;
  --danger: #dc2626;
  --focus: #2563eb;
  --shadow: 0 4px 16px rgba(17, 24, 39, .12);
  --shadow-sm: 0 1px 3px rgba(17, 24, 39, .10);
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --top: 56px;
  --rail: 360px;
  --detail: 380px;
  /* map status colors (colorblind-checked set) */
  --st-selected: #2a78d6;
  --st-mailed: #eda100;
  --st-delivered: #1baf7a;
  --st-followup: #e34948;
  --st-muted: #9ca3af;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--bg); overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.num, .mono { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
[hidden] { display: none !important; }

/* Header */
.top {
  position: fixed; inset: 0 0 auto 0; height: var(--top); z-index: 1000;
  display: flex; align-items: center; gap: 16px; padding: 0 16px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; white-space: nowrap; }
.brand-mark { width: 30px; height: 30px; border-radius: 6px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.brand small { font-weight: 400; color: var(--muted); font-size: 14px; }
.appnav { display: flex; gap: 4px; margin-left: 8px; }
.appnav a { text-decoration: none; color: var(--ink-2); padding: 8px 12px; border-radius: 6px; font-size: 14px; }
.appnav a:hover { background: var(--surface-2); }
.appnav a[aria-current="page"] { color: var(--accent); font-weight: 600; background: var(--accent-soft); }
.top .spacer { flex: 1; }
.proj-switch { display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 340px; border: 1px solid var(--line-2); background: var(--surface); border-radius: 6px; padding: 7px 12px; font-weight: 500; }
.proj-switch span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-switch:hover { background: var(--surface-2); }
.shared-badge { font-size: 14px; color: var(--ink-2); display: flex; gap: 10px; align-items: center; min-width: 0; }
.shared-badge b { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 500; font-size: 14px; white-space: nowrap; color: var(--ink); text-decoration: none; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--danger); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.icon { width: 36px; padding: 0; }
.btn svg { width: 16px; height: 16px; flex: none; }
.input, select.input, textarea.input { width: 100%; height: 36px; padding: 0 10px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--surface); outline: none; }
textarea.input { height: auto; min-height: 76px; padding: 8px 10px; resize: vertical; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 6px; overflow: hidden; flex-wrap: wrap; }
.seg button { border: 0; background: var(--surface); height: 32px; padding: 0 12px; font-size: 13px; color: var(--ink-2); border-right: 1px solid var(--line-2); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.seg button:disabled { color: var(--muted); cursor: not-allowed; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; font-size: 14px; cursor: pointer; }
.switch input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; flex: none; }
.label { font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 0 0 8px; }

/* Dual range */
.range2 { position: relative; height: 28px; }
.range2 input[type=range] { position: absolute; inset: 0; width: 100%; appearance: none; background: none; pointer-events: none; margin: 0; }
.range2 input[type=range]::-webkit-slider-thumb { appearance: none; pointer-events: auto; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); cursor: grab; position: relative; z-index: 2; }
.range2 input[type=range]::-moz-range-thumb { pointer-events: auto; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); cursor: grab; }
.range2 .track { position: absolute; left: 0; right: 0; top: 12px; height: 4px; border-radius: 4px; background: var(--line); }
.range2 .fill { position: absolute; top: 12px; height: 4px; border-radius: 4px; background: var(--accent); }
.range-read { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); }

/* Layout */
.rail { position: fixed; top: var(--top); bottom: 0; left: 0; width: var(--rail); z-index: 900; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.tabs { display: flex; padding: 0 12px; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; background: none; padding: 12px 12px 10px; font-weight: 500; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; gap: 6px; align-items: center; }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.tabs .count { font-size: 12px; background: var(--surface-2); color: var(--ink-2); border-radius: 10px; padding: 0 7px; }
.panel { flex: 1; overflow-y: auto; padding: 16px 16px 80px; overscroll-behavior: contain; }
.panel section + section { margin-top: 20px; }
#map { position: fixed; top: var(--top); left: var(--rail); right: 0; bottom: 0; z-index: 1; background: #e5e7eb; }
body.detail-open #map { right: var(--detail); }
.detail { position: fixed; top: var(--top); bottom: 0; right: 0; width: var(--detail); z-index: 950; background: var(--surface); border-left: 1px solid var(--line); overflow-y: auto; overscroll-behavior: contain; transform: translateX(100%); transition: transform .2s ease; }
body.detail-open .detail { transform: none; }

/* Map overlays */
.mapbar { position: fixed; top: calc(var(--top) + 12px); left: calc(var(--rail) + 12px); z-index: 600; display: flex; gap: 8px; flex-wrap: wrap; pointer-events: none; }
.mapbar > * { pointer-events: auto; }
.toolgroup { display: flex; background: var(--surface); border: 1px solid var(--line-2); border-radius: 6px; box-shadow: var(--shadow-sm); overflow: hidden; }
.toolgroup button { border: 0; border-right: 1px solid var(--line); background: var(--surface); height: 34px; min-width: 34px; padding: 0 10px; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.toolgroup button:last-child { border-right: 0; }
.toolgroup button:hover { background: var(--surface-2); }
.toolgroup button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.toolgroup svg { width: 16px; height: 16px; }
.legend { position: fixed; left: calc(var(--rail) + 12px); bottom: 28px; z-index: 600; background: var(--surface); border: 1px solid var(--line-2); border-radius: 6px; box-shadow: var(--shadow-sm); padding: 10px 12px; font-size: 13px; max-width: 280px; }
.lg-title { display: none; font-weight: 600; font-size: 13px; cursor: pointer; }
.legend .row { display: flex; align-items: center; gap: 8px; margin: 3px 0; color: var(--ink-2); }
.legend .ramp { display: flex; height: 8px; border-radius: 3px; overflow: hidden; margin: 6px 0 3px; }
.legend .ramp i { flex: 1; }
.legend .ends { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; box-shadow: 0 0 0 1.5px #fff; }
.dot.ring { background: transparent !important; box-shadow: inset 0 0 0 2px var(--st-muted); }
.selbar { position: fixed; left: calc((100vw + var(--rail)) / 2); bottom: 28px; transform: translateX(-50%); z-index: 650; display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px; box-shadow: var(--shadow); font-weight: 500; white-space: nowrap; }
body.detail-open .selbar { left: calc((100vw + var(--rail) - var(--detail)) / 2); }
.map-hint { position: fixed; top: calc(var(--top) + 58px); left: calc(var(--rail) + 12px); z-index: 600; background: var(--surface); border: 1px solid var(--line-2); color: var(--ink-2); padding: 6px 10px; border-radius: 6px; font-size: 13px; box-shadow: var(--shadow-sm); }
.leaflet-container { font-family: var(--font); }
.leaflet-control-attribution { font-size: 10px; }
.leaflet-bar { border: 1px solid var(--line-2) !important; box-shadow: var(--shadow-sm) !important; }
.area-label { background: transparent; border: 0; box-shadow: none; padding: 0; font-weight: 600; font-size: 12px; color: #111827; text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff; white-space: nowrap; }
.area-label::before { display: none; }
.sat .area-label { color: #fff; text-shadow: 0 0 3px #000, 0 0 3px #000; }
.leaflet-tooltip.tip { background: var(--surface); color: var(--ink); border: 1px solid var(--line-2); border-radius: 6px; box-shadow: var(--shadow); font-size: 13px; padding: 6px 10px; }
.leaflet-tooltip.tip::before { display: none; }
.dragbox { position: absolute; border: 2px dashed var(--accent); background: rgba(37, 99, 235, .08); z-index: 640; pointer-events: none; }

/* Lists */
.searchbox { position: relative; }
.searchbox svg { position: absolute; left: 10px; top: 10px; width: 16px; height: 16px; color: var(--muted); }
.searchbox .input { padding-left: 34px; }
.search-results { margin-top: 6px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow-sm); }
.search-results button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 12px; border-top: 1px solid var(--line); font-size: 14px; }
.search-results button:first-child { border-top: 0; }
.search-results button:hover { background: var(--surface-2); }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.list-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.area-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; width: 100%; text-align: left; border: 1px solid transparent; background: none; padding: 10px; border-radius: 6px; border-bottom-color: var(--line); }
.area-row:hover { background: var(--surface-2); }
.area-row.active { background: var(--accent-soft); border-color: #bfdbfe; }
.area-row .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.area-row .ct { font-size: 13px; text-align: right; font-weight: 600; }
.area-row .meta { grid-column: 1 / -1; display: flex; gap: 10px; font-size: 13px; color: var(--muted); align-items: center; flex-wrap: wrap; }
.agebar { height: 5px; border-radius: 3px; background: var(--line); position: relative; width: 64px; flex: none; }
.agebar i { position: absolute; top: 0; bottom: 0; border-radius: 3px; background: var(--accent); }
.tag { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 4px; font-size: 12px; font-weight: 500; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.tag.accent { background: var(--accent-soft); color: var(--accent); }
.tag.warn { background: #fef3c7; color: #92400e; }

/* Stats */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { background: var(--surface); padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 18px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 12px; color: var(--muted); font-weight: 400; }

/* Histogram */
.hist { display: flex; align-items: flex-end; gap: 2px; height: 80px; padding-top: 4px; border-bottom: 1px solid var(--line-2); }
.hist .b { flex: 1; background: var(--st-selected); border-radius: 3px 3px 0 0; min-height: 1px; }
.hist .b:hover { opacity: .8; }
.hist .b.dim { background: var(--line-2); }
.hist-axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Funnel */
.funnel { display: grid; gap: 4px; }
.funnel .stage { display: grid; grid-template-columns: 120px 1fr 44px; align-items: center; gap: 10px; font-size: 14px; border: 0; background: none; padding: 4px 6px; border-radius: 6px; text-align: left; width: 100%; }
.funnel .stage:hover { background: var(--surface-2); }
.funnel .stage[aria-pressed="true"] { background: var(--accent-soft); }
.funnel .stage .nm { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.funnel .bar { height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.funnel .bar i { display: block; height: 100%; border-radius: 5px; min-width: 2px; }
.funnel .n { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Home list */
.home-row { display: grid; grid-template-columns: 18px 1fr auto; gap: 2px 10px; align-items: center; padding: 10px 6px; border-bottom: 1px solid var(--line); font-size: 14px; cursor: pointer; }
.home-row:hover { background: var(--surface-2); }
.home-row .addr { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-row .sub { grid-column: 2 / -1; font-size: 13px; color: var(--muted); }
.home-row input[type=checkbox] { margin: 0; accent-color: var(--accent); width: 16px; height: 16px; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.bulk { position: sticky; top: -16px; z-index: 5; background: var(--surface); padding: 8px 0; margin: -6px 0 6px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; border-bottom: 1px solid var(--line); }

/* Detail panel */
.d-head { padding: 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 5; }
.d-head h2 { margin: 6px 0 4px; font-size: 20px; font-weight: 700; line-height: 1.25; padding-right: 36px; }
.d-close { position: absolute; top: 12px; right: 12px; }
.d-body { padding: 16px 16px 90px; }
.d-body section + section { margin-top: 22px; }
.photo { width: 100%; aspect-ratio: 16 / 10; border-radius: 6px; overflow: hidden; background: var(--surface-2); position: relative; border: 1px solid var(--line); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo .cap { position: absolute; left: 8px; bottom: 8px; background: rgba(17, 24, 39, .75); color: #fff; font-size: 12px; padding: 2px 8px; border-radius: 4px; }
.sat-crop { position: relative; overflow: hidden; }
.sat-crop .tiles { position: absolute; }
.sat-crop .tiles img { position: absolute; width: 256px; height: 256px; max-width: none; }
.sat-crop .pin { position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(0, 0, 0, .35); }
.gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gallery .photo { aspect-ratio: 4 / 3; cursor: pointer; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: grid; grid-template-columns: 14px 1fr auto; gap: 10px; align-items: start; padding: 0 0 12px; position: relative; font-size: 14px; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 14px; bottom: -2px; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .mk { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-2); background: #fff; margin-top: 3px; position: relative; z-index: 1; }
.timeline li.done .mk { background: var(--accent); border-color: var(--accent); }
.timeline li.now .mk { box-shadow: 0 0 0 4px var(--accent-soft); }
.timeline .t { color: var(--muted); font-size: 13px; white-space: nowrap; }
.timeline .s { color: var(--muted); font-size: 13px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 500; }
.decide { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.decide .btn[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Notes */
.note { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.note .who { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 2px; }
.note .who b { color: var(--ink); font-weight: 600; }
.note .txt { white-space: pre-wrap; word-wrap: break-word; }
.note .ctx { font-size: 13px; color: var(--accent); cursor: pointer; }
.activity { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.activity li { padding: 7px 0; border-bottom: 1px solid var(--line); color: var(--ink-2); display: flex; justify-content: space-between; gap: 10px; }
.activity li span:last-child { color: var(--muted); white-space: nowrap; }

/* Callouts */
.empty { text-align: center; padding: 24px 16px; color: var(--ink-2); border: 1px dashed var(--line-2); border-radius: 8px; font-size: 14px; }
.empty b { display: block; color: var(--ink); margin-bottom: 4px; }
.callout { border: 1px solid #bfdbfe; background: var(--accent-soft); border-radius: 8px; padding: 12px; font-size: 14px; color: var(--ink-2); }
.callout b { color: var(--ink); }
.hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; }

/* Dialogs, menus, toasts */
dialog { border: 0; border-radius: 10px; padding: 0; background: var(--surface); color: var(--ink); box-shadow: 0 20px 50px rgba(0, 0, 0, .25); width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 40px); }
dialog::backdrop { background: rgba(17, 24, 39, .45); }
.dlg-h { padding: 16px 20px 8px; display: flex; align-items: center; justify-content: space-between; }
.dlg-h h3 { margin: 0; font-size: 18px; font-weight: 600; }
.dlg-b { padding: 8px 20px 16px; }
.dlg-f { padding: 12px 20px 16px; display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--line); }
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--ink-2); }
.share-link { display: flex; gap: 6px; }
.share-item { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.share-item .u { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu { position: fixed; z-index: 2000; background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px; box-shadow: var(--shadow); min-width: 260px; max-height: 60vh; overflow-y: auto; padding: 4px; }
.menu button { display: flex; width: 100%; text-align: left; border: 0; background: none; padding: 9px 12px; border-radius: 4px; gap: 8px; align-items: center; justify-content: space-between; }
.menu button:hover { background: var(--surface-2); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 3000; display: grid; gap: 8px; }
.toast { background: #111827; color: #fff; padding: 10px 16px; border-radius: 6px; box-shadow: var(--shadow); font-size: 14px; max-width: 360px; }
.toast.err { background: var(--danger); }
.loading-veil { position: fixed; inset: var(--top) 0 0 0; z-index: 1500; display: grid; place-items: center; background: var(--bg); }
.loading-veil .box { text-align: center; color: var(--ink-2); }
.spin { width: 24px; height: 24px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: sp .7s linear infinite; margin: 0 auto 10px; }
@keyframes sp { to { transform: rotate(360deg); } }
.gate { position: fixed; inset: 0; z-index: 5000; background: var(--bg); display: grid; place-items: center; }
.gate form { width: min(360px, calc(100vw - 32px)); background: var(--surface); padding: 28px; border-radius: 10px; border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.gate h1 { font-size: 20px; margin: 0 0 4px; }
.sheet-handle { display: none; }

/* Mid-size screens: detail panel overlays the map instead of squeezing it */
@media (min-width: 901px) and (max-width: 1280px) {
  body.detail-open #map { right: 0; }
  body.detail-open .selbar { left: calc((100vw + var(--rail)) / 2); }
  .detail { box-shadow: -6px 0 24px rgba(17, 24, 39, .12); }
}

/* Mobile */
@media (max-width: 900px) {
  :root { --top: 52px; }
  .appnav, .brand small, .top .hide-m { display: none; }
  .proj-switch { max-width: 50vw; }
  #map, body.detail-open #map { left: 0; right: 0; bottom: 0; }
  .rail { top: auto; bottom: 0; left: 0; right: 0; width: auto; height: var(--sheet-h, 42vh); border-right: 0; border-top: 1px solid var(--line); border-radius: 12px 12px 0 0; box-shadow: 0 -6px 24px rgba(0, 0, 0, .12); transition: height .22s ease; }
  .rail.dragging { transition: none; }
  .sheet-handle { display: block; height: 20px; flex: none; cursor: grab; touch-action: none; position: relative; }
  .sheet-handle::after { content: ""; position: absolute; left: 50%; top: 8px; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: var(--line-2); }
  .tabs { overflow-x: auto; }
  .detail { top: auto; bottom: 0; left: 0; width: auto; height: 80vh; border-left: 0; border-top: 1px solid var(--line); border-radius: 12px 12px 0 0; transform: translateY(105%); box-shadow: 0 -6px 24px rgba(0, 0, 0, .18); }
  body.detail-open .detail { transform: none; }
  .mapbar { left: 12px; right: 12px; }
  .legend, .map-hint { left: 12px; }
  .legend { bottom: calc(var(--sheet-h, 42vh) + 10px); max-width: 60vw; }
  .legend.collapsed .rows { display: none; }
  .lg-title { display: block; }
  .lg-title::after { content: ' ▾'; color: var(--muted); }
  .selbar, body.detail-open .selbar { left: 50%; bottom: calc(var(--sheet-h, 42vh) + 12px); max-width: calc(100vw - 20px); }
  .toolgroup button span.txt { display: none; }
  .toasts { left: 12px; right: 12px; bottom: auto; top: calc(var(--top) + 10px); }
  .leaflet-control-zoom { display: none; }
}
@media print {
  .top, .rail, .mapbar, .legend, .selbar, .detail { display: none !important; }
  #map { inset: 0 !important; }
}

/* ── Simplified layout helpers ─────────────────────────────────── */
.intro { margin: 0 0 14px; color: var(--ink-2); font-size: 14px; }
.tabs .stepnum { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--surface-2); color: var(--ink-2); font-size: 12px; font-weight: 600; }
.tabs button[aria-selected="true"] .stepnum { background: var(--accent); color: #fff; }
.results-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.results-head .big { font-size: 22px; font-weight: 700; }
details.more { border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; margin-top: 16px; background: var(--surface); }
details.more > summary { cursor: pointer; padding: 10px 0; font-weight: 600; font-size: 14px; color: var(--ink-2); list-style: none; }
details.more > summary::before { content: '▸ '; color: var(--muted); }
details.more[open] > summary::before { content: '▾ '; }
details.more > summary::-webkit-details-marker { display: none; }
details.more[open] { padding-bottom: 12px; }
details.more section + section { margin-top: 16px; }
.steps-ol { text-align: left; margin: 10px 0 0; padding-left: 20px; line-height: 1.7; }
.menu-title { padding: 6px 12px 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.ramp-mini { display: inline-flex; width: 30px; height: 10px; border-radius: 2px; overflow: hidden; flex: none; }
.ramp-mini i { flex: 1; }
.help-steps { margin: 0; padding-left: 20px; line-height: 1.6; }
.help-steps li { margin-bottom: 8px; }
.help-colors { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; font-size: 14px; }
.help-colors div { display: flex; align-items: center; gap: 8px; }
.legend .lg-title { display: block; margin-bottom: 4px; color: var(--ink); }

/* ── Guided tour ───────────────────────────────────────────────── */
.tour-shade { position: fixed; z-index: 4000; background: rgba(17, 24, 39, .55); pointer-events: auto; transition: all .2s ease; }
.tour-shade.hole { background: transparent; border-radius: 8px; box-shadow: 0 0 0 9999px rgba(17, 24, 39, .55); outline: 3px solid #fff; }
.tour-card { position: fixed; z-index: 4001; background: #fff; border-radius: 10px; box-shadow: 0 16px 40px rgba(0, 0, 0, .25); padding: 16px 18px 14px; transition: top .2s ease, left .2s ease; }
.tour-card h3 { margin: 4px 0 6px; font-size: 17px; }
.tour-card p { margin: 0 0 14px; color: var(--ink-2); font-size: 14px; line-height: 1.55; }
.tour-step { font-size: 12px; color: var(--accent); font-weight: 600; }
.tour-actions { display: flex; gap: 8px; align-items: center; }
@media (max-width: 900px) {
  .tabs button { padding: 10px 8px; }
}
.why { font-size: 14px; color: var(--ink-2); background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px; padding: 10px 12px; line-height: 1.55; }
.callout.warn { background: #fef3c7; border-color: #fde68a; color: #92400e; }
