/* Cache Maps — Cash App inspired UI */

/* ===== tokens ===== */
:root {
  color-scheme: light;
  --ink: #0A0A0A;
  --ink-2: #6E6E6E;
  --ink-3: #A8A8A8;
  --surface: #FFFFFF;
  --section: #F5F5F5;
  --fill: #F2F2F2;
  --fill-2: #E6E6E6;
  --green: #00D632;
  --green-ink: #008A20;
  --green-soft: #E3FBE8;
  --red: #EA4335;
  --danger: #E0261B;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --t: 180ms;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --panel-w: 400px;
  --peek: 35dvh;
  --sheet-h: 0px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  font: 15px/1.4 var(--font);
  color: var(--ink);
  background: var(--surface);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-2); }

/* ===== layout ===== */
.app { position: fixed; inset: 0; display: flex; }
.panel {
  position: relative; z-index: 10;
  width: var(--panel-w); flex: 0 0 var(--panel-w); height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--surface);
  box-shadow: 1px 0 0 rgba(0, 0, 0, .06);
}
.list-mode, .view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.map-wrap { position: relative; flex: 1; min-width: 0; }
#map { position: absolute; inset: 0; background: #ECECEC; }
#map:not(.ready)::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.45) 50%, transparent 70%);
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite;
}
#map.failed::after { display: none; }

/* ===== sheet grab handle (hidden on desktop) ===== */
.grab {
  display: none; flex: none; width: 100%; height: 26px; border: 0; padding: 0;
  background: none; cursor: grab; align-items: center; justify-content: center; touch-action: none;
}
.grab span { width: 40px; height: 5px; border-radius: 999px; background: var(--fill-2); }

/* ===== brand row ===== */
.brand { display: flex; align-items: center; gap: 12px; padding: 20px 16px 14px 20px; }
.logo {
  width: 36px; height: 36px; border-radius: 11px; background: var(--green); color: #fff;
  display: grid; place-items: center; flex: none;
}
.brand h1 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; flex: 1; }

/* ===== icon button ===== */
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent;
  display: grid; place-items: center; cursor: pointer; color: var(--ink); flex: none;
  transition: background var(--t) var(--ease);
}
.icon-btn:hover { background: var(--fill); }
.icon-btn:active { background: var(--fill-2); }

/* ===== search pill ===== */
.search {
  display: flex; align-items: center; gap: 10px; height: 48px; margin: 0 16px;
  padding: 0 6px 0 16px; border-radius: 999px; background: var(--fill); color: var(--ink-2);
  transition: box-shadow var(--t) var(--ease), background var(--t) var(--ease);
}
.search:focus-within { box-shadow: 0 0 0 2px var(--green); background: var(--surface); }
.search input {
  flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none;
  font: 500 16px var(--font); color: var(--ink);
}
.search input::placeholder { color: var(--ink-2); }
.search input::-webkit-search-cancel-button { display: none; }
.search .icon-btn { width: 36px; height: 36px; color: var(--ink-2); }

/* ===== segmented control ===== */
.seg { display: flex; gap: 2px; padding: 4px; border-radius: 999px; background: var(--fill); }
.seg button {
  flex: 1; height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: none; cursor: pointer;
  font-weight: 600; font-size: 14px; color: var(--ink-2); white-space: nowrap;
  transition: background var(--t) var(--ease), color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.list-mode > .seg { margin: 12px 16px 4px; }
.seg.toggles button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.seg.toggles button svg { display: none; color: var(--green); }
.seg.toggles button[aria-pressed="true"] svg { display: block; }

/* ===== list ===== */
.scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 8px calc(24px + var(--safe-b)); }
.sec {
  display: flex; align-items: baseline; gap: 6px;
  font-size: 20px; font-weight: 800; letter-spacing: -.02em; padding: 16px 8px 6px;
}
.sec .count { font-size: 15px; font-weight: 600; color: var(--ink-2); letter-spacing: 0; }
.caps { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }

.row {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 12px; min-height: 68px;
  border: 0; border-radius: 16px; background: none; text-align: left; cursor: pointer; color: var(--ink);
  transition: background var(--t) var(--ease);
}
.row:hover { background: var(--section); }
.row:active { background: var(--fill-2); }
.row.is-sel { background: var(--fill); }
.row > svg { color: var(--ink-3); flex: none; }
.row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.row-title { font-weight: 700; font-size: 16px; letter-spacing: -.01em; display: flex; align-items: center; gap: 6px; min-width: 0; }
.row-title .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { color: var(--ink-2); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub.warn { color: var(--danger); }
.row.split { padding: 0; gap: 0; cursor: default; }
.row.split:hover { background: none; }
.row.split > .row { flex: 1; min-width: 0; }
.row.split > .icon-btn { margin-right: 6px; color: var(--ink-2); }
.tag { flex: none; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; color: var(--green-ink); background: var(--green-soft); }

/* ===== avatars ===== */
.av {
  position: relative; flex: none; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px; letter-spacing: .01em;
  background: var(--ink);
}
.av.sq { border-radius: 14px; background: var(--fill); color: var(--ink); }
.av.sq.in-range { box-shadow: 0 0 0 2px var(--green); }
.av.sq.pending { color: var(--ink-3); }
.av.sq.failed { color: var(--danger); }
.av.gray { background: var(--fill); color: var(--ink-2); }
.av .badge { position: absolute; right: -3px; bottom: -3px; width: 14px; height: 14px; border-radius: 50%; border: 2.5px solid var(--surface); }
.av-lg { width: 72px; height: 72px; font-size: 26px; }
.av-lg.sq { border-radius: 22px; }

/* ===== skeleton ===== */
.sk-row { display: flex; align-items: center; gap: 14px; padding: 12px; }
.sk { background: var(--fill); border-radius: 999px; position: relative; overflow: hidden; }
.sk::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.7) 50%, transparent 70%);
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite;
}
.sk-av { width: 44px; height: 44px; border-radius: 50%; flex: none; }
.sk-lines { flex: 1; display: grid; gap: 8px; }
.sk-l1 { height: 14px; width: 55%; } .sk-l2 { height: 12px; width: 80%; }
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }

/* ===== empty states ===== */
.empty { text-align: center; padding: 40px 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .art { width: 72px; height: 72px; border-radius: 50%; background: var(--fill); display: grid; place-items: center; margin-bottom: 6px; }
.empty h3 { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.empty p { color: var(--ink-2); max-width: 280px; }
.empty .btn { margin-top: 10px; }

/* ===== buttons ===== */
.btn {
  height: 52px; padding: 0 24px; border: 0; border-radius: 999px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 700; font-size: 16px; letter-spacing: -.01em; white-space: nowrap;
  transition: transform var(--t) var(--ease), background var(--t) var(--ease), opacity var(--t) var(--ease);
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { background: #00C22D; }
.btn-black { background: var(--ink); color: #fff; }
.btn-black:hover { background: #262626; }
.btn-gray { background: var(--fill); color: var(--ink); }
.btn-gray:hover { background: var(--fill-2); }
.btn-danger { background: var(--fill); color: var(--danger); }
.btn-danger:hover { background: #FDECEB; }
.btn-block { width: 100%; }
.btn-sm { height: 40px; padding: 0 18px; font-size: 14px; }

/* ===== views (detail / forms / pickers) ===== */
.vwrap { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.vwrap.enter { animation: slideIn var(--t) ease-out; }
@keyframes slideIn { from { opacity: 0; transform: translateX(16px); } }
.vhead { display: flex; align-items: center; gap: 8px; padding: 12px 12px 4px; flex: none; }
.vhead h2 { font-size: 20px; font-weight: 800; letter-spacing: -.02em; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vscroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 16px calc(28px + var(--safe-b)); }
.vscroll.list { padding: 0 8px calc(28px + var(--safe-b)); }
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 8px 8px 20px; }
.hero h2 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; margin-top: 8px; word-break: break-word; }
.hero p { color: var(--ink-2); font-size: 15px; }
.card { background: var(--section); border-radius: 20px; padding: 6px 16px; margin-bottom: 12px; }
.card.pad { padding: 16px; }
.ctl { display: flex; align-items: center; gap: 12px; min-height: 60px; }
.ctl + .ctl { border-top: 1px solid var(--fill-2); }
.ctl label { flex: 1; font-weight: 600; cursor: pointer; }
.num { display: flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 14px; font-weight: 600; }
.num input {
  width: 64px; height: 40px; border: 0; border-radius: 12px; background: var(--surface); text-align: center;
  font: 700 16px var(--font); color: var(--ink);
}
.num input:disabled { opacity: .4; }
.num input:focus { outline: 2px solid var(--green); }
.readout { font-size: 14px; color: var(--ink-2); padding: 10px 0 12px; border-top: 1px solid var(--fill-2); }
.readout b { color: var(--ink); }
.readout.warn { color: var(--danger); }
.notice { display: flex; align-items: center; gap: 12px; background: var(--section); border-radius: 20px; padding: 14px 16px; margin-bottom: 12px; }
.notice .nb { flex: 1; min-width: 0; }
.notice b { display: block; }
.notice.err { color: var(--danger); }
.notice.err .muted { color: var(--ink-2); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.stat { background: var(--section); border-radius: 20px; padding: 14px; min-width: 0; }
.stat .caps { font-size: 11px; }
.stat .v { font-size: 18px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; overflow-wrap: anywhere; }
.stat.wide { grid-column: 1 / -1; }
.vsec { font-size: 20px; font-weight: 800; letter-spacing: -.02em; margin: 20px 0 4px; display: flex; gap: 6px; align-items: baseline; }
.vsec .count { font-size: 15px; font-weight: 600; color: var(--ink-2); }
.rows { margin: 0 -8px; }
.inline-status { font-size: 14px; color: var(--ink-2); }
.actions { display: grid; gap: 10px; margin-top: 24px; }
.hstack { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pk-search { padding: 4px 0 8px; }
.dd-intro { font-size: 14px; margin: 4px 0 14px; }
.dd { display: flex; flex-direction: column; }
.dd .caps { font-size: 11px; }
.dd-item { display: flex; flex-direction: column; gap: 1px; padding: 6px 0 10px; min-width: 0; }
.dd-item b { font-weight: 700; letter-spacing: -.01em; overflow-wrap: anywhere; }
.dd-item .muted { font-size: 14px; overflow-wrap: anywhere; }
.dd-item.del b { color: var(--danger); }
.dd-item + .dd-item { border-top: 1px solid var(--fill-2); padding-top: 10px; }
.dd-was { font-size: 13px; margin: -6px 0 8px; }
.dd-gets { font-size: 13px; font-weight: 600; color: var(--green-ink); margin: -4px 0 10px; }
.dd-del-h { border-top: 1px solid var(--fill-2); padding-top: 12px; }
.tools-sec { padding: 0 12px; }
.tools-note { font-size: 13px; padding: 12px 12px 0; }
.csv-stats { grid-template-columns: repeat(3, 1fr); }
.csv-stats .stat.bad .v { color: var(--danger); }
.csv-msgs { list-style: none; margin: 0; padding: 4px 14px; max-height: 260px; overflow-y: auto; background: var(--section); border-radius: 16px; font-size: 14px; }
.csv-msgs li { padding: 8px 0; overflow-wrap: anywhere; }
.csv-msgs li + li { border-top: 1px solid var(--fill-2); }
.csv-msgs b { margin-right: 6px; }
.csv-msgs.err b { color: var(--danger); }
.pk-search .search { margin: 0 16px; }

/* ===== switch ===== */
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch .trk { position: absolute; inset: 0; border-radius: 999px; background: var(--fill-2); transition: background var(--t) var(--ease); }
.switch .trk::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform var(--t) var(--ease);
}
.switch input:checked + .trk { background: var(--green); }
.switch input:checked + .trk::after { transform: translateX(20px); }
.switch input:focus-visible + .trk { outline: 2px solid var(--green); outline-offset: 2px; }

/* ===== forms ===== */
.form { padding-top: 8px; }
.fld { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.flabel, .fld > label { font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-2); }
.inp {
  width: 100%; height: 52px; padding: 0 16px; border: 0; border-radius: 14px; background: var(--fill);
  font: 500 16px var(--font); color: var(--ink); transition: background var(--t) var(--ease);
  -webkit-appearance: none; appearance: none;
}
.inp::placeholder { color: var(--ink-3); }
.inp:focus { outline: 2px solid var(--green); outline-offset: 0; background: var(--surface); }
select.inp {
  padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236E6E6E' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.g3 { display: grid; grid-template-columns: 1.3fr 1fr .8fr; gap: 10px; }
.status { min-height: 20px; margin: 4px 0 12px; font-size: 14px; color: var(--ink-2); font-weight: 500; }
.status.err { color: var(--danger); }
.status.ok { color: var(--green-ink); }
.colors { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.swatch {
  width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--surface); cursor: pointer; padding: 0;
  box-shadow: 0 0 0 1px var(--fill-2); transition: box-shadow var(--t) var(--ease);
}
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ink); }
.hexrow { display: flex; gap: 10px; align-items: center; margin-top: 10px; }
.hexrow .inp { width: 140px; text-transform: uppercase; }
.color-pick { width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; flex: none; }
.color-pick::-webkit-color-swatch-wrapper { padding: 0; }
.color-pick::-webkit-color-swatch { border: 0; border-radius: 50%; }
.color-pick::-moz-color-swatch { border: 0; border-radius: 50%; }
.inp[aria-invalid="true"] { outline: 2px solid var(--danger); background: var(--surface); }
.pin-chip { position: absolute; left: -3px; bottom: -3px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.color-prev { width: 40px; height: 40px; border-radius: 50%; flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  height: 38px; padding: 0 16px; border-radius: 999px; border: 0; background: var(--fill); cursor: pointer;
  font-weight: 600; font-size: 14px; color: var(--ink); transition: background var(--t) var(--ease), color var(--t) var(--ease);
}
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; }
.freq-detail { margin-top: 10px; }
.freq-detail:empty { display: none; }
.freq-line { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-weight: 600; }
.freq-line .inp { width: auto; flex: 1; }
.freq-line .inp.n { flex: 0 0 80px; text-align: center; }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days .chip { width: 50px; padding: 0; }

/* ===== address autocomplete ===== */
.ac-wrap { position: relative; }
.ac-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30; max-height: 260px; overflow-y: auto;
  background: var(--surface); border-radius: 16px; box-shadow: 0 12px 36px rgba(0,0,0,.16); padding: 6px;
}
.ac-item { padding: 10px 12px; border-radius: 12px; cursor: pointer; line-height: 1.35; }
.ac-item:hover, .ac-item.active { background: var(--fill); }
.ac-main { font-weight: 600; }
.ac-sub, .ac-note { color: var(--ink-2); font-size: 13px; }
.ac-note { padding: 10px 12px; }

/* ===== map chrome ===== */
.map-brand, .map-style { position: absolute; top: calc(12px + var(--safe-t)); z-index: 5; }
.map-style { right: 12px; background: var(--surface); box-shadow: 0 4px 16px rgba(0,0,0,.14); }
.map-style button { height: 32px; font-size: 13px; }
.map-style button[aria-pressed="true"] { background: var(--ink); color: #fff; box-shadow: none; }
.map-brand {
  left: 12px; display: none; align-items: center; gap: 8px; padding: 4px 4px 4px 4px;
  border-radius: 999px; background: var(--surface); box-shadow: 0 4px 16px rgba(0,0,0,.14);
}
.map-brand .logo { width: 32px; height: 32px; border-radius: 50%; }
.map-brand b { font-weight: 800; letter-spacing: -.02em; font-size: 15px; padding-right: 4px; }
.map-brand .icon-btn { width: 32px; height: 32px; }
.legend {
  position: absolute; left: 12px; bottom: calc(28px + var(--sheet-h)); z-index: 5;
  display: flex; align-items: center; gap: 12px; padding: 7px 14px; border-radius: 999px;
  background: rgba(255,255,255,.94); backdrop-filter: blur(8px); box-shadow: 0 4px 16px rgba(0,0,0,.12);
  font-size: 12px; font-weight: 600; color: var(--ink-2); white-space: nowrap;
}
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg-c { width: 10px; height: 10px; border-radius: 50%; background: var(--ink); }
.lg-p { width: 10px; height: 10px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--red); }
.lg-a { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.fab {
  position: absolute; right: 16px; bottom: calc(36px + var(--sheet-h)); z-index: 5;
  width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--ink); color: #fff; display: grid; place-items: center;
  box-shadow: 0 8px 24px rgba(0,0,0,.28); transition: transform var(--t) var(--ease), background var(--t) var(--ease);
}
.fab:hover { background: #262626; }
.fab:active { transform: scale(.95); }
.mapboxgl-ctrl-top-right { top: calc(52px + var(--safe-t)) !important; }
.mapboxgl-ctrl-group { border-radius: 14px !important; box-shadow: 0 4px 16px rgba(0,0,0,.14) !important; overflow: hidden; }
.mapboxgl-ctrl-logo { display: none !important; }

/* ===== map markers ===== */
/* Mapbox positions markers via absolute + transform; never let a stray rule override it. */
.mapboxgl-marker { position: absolute !important; top: 0; left: 0; }
.mapboxgl-marker:hover { z-index: 9 !important; }
.mk { position: relative; cursor: pointer; }
.mk-cl {
  width: 30px; height: 30px; border-radius: 50%; border: 3px solid #fff; display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 13px; box-shadow: 0 2px 8px rgba(0,0,0,.35);
  transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.mk-cl.sel { transform: scale(1.15); box-shadow: 0 0 0 5px rgba(10,10,10,.2), 0 2px 8px rgba(0,0,0,.45); }
.mk-pr { width: 28px; height: 34px; }
.pin {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: var(--red); border: 2.5px solid #fff; box-shadow: 0 4px 10px rgba(0,0,0,.3);
}
.pin-dot { width: 9px; height: 9px; border-radius: 50%; background: #fff; }
.pin.inrange { box-shadow: 0 0 0 5px rgba(0,214,50,.35), 0 4px 10px rgba(0,0,0,.35); }
.pin.sel { box-shadow: 0 0 0 5px rgba(10,10,10,.22), 0 4px 10px rgba(0,0,0,.35); }
.pin-badge { position: absolute; top: -3px; right: -3px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.tip {
  display: none; position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 12px; white-space: nowrap;
  font-size: 12px; font-weight: 500; line-height: 1.4; pointer-events: none; text-align: left;
}
.tip b { font-weight: 700; }
@media (hover: hover) { .mk:hover .tip { display: block; } }

/* ===== toast ===== */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); z-index: 80;
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  max-width: calc(100vw - 32px); padding: 14px 22px; border-radius: 999px;
  background: var(--ink); color: #fff; font-weight: 600; font-size: 14px; text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #FF4D3D; margin-right: 10px; vertical-align: 1px; }

/* ===== confirm dialog ===== */
.scrim { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.4); display: grid; place-items: center; padding: 16px; animation: fade var(--t) ease-out; }
.dialog { width: 100%; max-width: 360px; background: var(--surface); border-radius: 24px; padding: 24px; animation: rise var(--t) ease-out; }
.dialog h3 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.dialog p { color: var(--ink-2); margin: 8px 0 20px; }
.dialog .actions { margin-top: 0; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

/* ===== login ===== */
.login { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: var(--section); overflow-y: auto; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: 24px; padding: 32px 24px 24px; box-shadow: 0 10px 40px rgba(0,0,0,.06); }
.login-card .logo { width: 48px; height: 48px; border-radius: 14px; margin-bottom: 18px; }
.login-card h1 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.login-card > p { color: var(--ink-2); margin: 4px 0 22px; }
.or { display: flex; align-items: center; gap: 12px; margin: 14px 0; color: var(--ink-3); font-size: 12px; font-weight: 700; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--fill-2); }

/* ===== tablet landscape ===== */
@media (min-width: 640px) and (max-width: 1023px) and (orientation: landscape) {
  :root { --panel-w: 360px; }
}

/* ===== sheet mode: phone + tablet portrait ===== */
@media (min-width: 640px) and (max-width: 1023px) and (orientation: portrait) {
  :root { --peek: 45dvh; }
}
@media (max-width: 639px), (max-width: 1023px) and (orientation: portrait) {
  .app { display: block; }
  .map-wrap { position: absolute; inset: 0; }
  .panel {
    position: fixed; left: 0; right: 0; bottom: 0; width: auto; height: var(--peek);
    border-radius: 24px 24px 0 0; box-shadow: 0 -8px 32px rgba(0,0,0,.14);
    transition: height var(--t) var(--ease);
  }
  .panel[data-snap="mid"] { height: 55dvh; }
  .panel[data-snap="full"] { height: 90dvh; }
  .panel.dragging { transition: none; }
  .grab { display: flex; }
  .brand { display: none; }
  .list-mode > .seg { margin-top: 10px; }
  .vhead { padding-top: 0; }
  .map-brand { display: flex; }
  .panel[data-snap="full"] ~ .map-wrap .fab, .panel[data-snap="full"] ~ .map-wrap .legend { opacity: 0; pointer-events: none; }
  .fab, .legend { transition: opacity var(--t) var(--ease), transform var(--t) var(--ease), background var(--t) var(--ease); }
  .mapboxgl-ctrl-top-right { display: none; }
  .hero { padding-bottom: 14px; }
  .hero h2 { font-size: 24px; }
  .toast { bottom: auto; top: calc(64px + var(--safe-t)); transform: translate(-50%, -16px); }
  .toast.show { transform: translate(-50%, 0); }
  .scrim { place-items: end center; }
  .dialog { max-width: 520px; margin-bottom: var(--safe-b); }
}
@media (max-width: 380px) {
  .g3 { grid-template-columns: 1fr 1fr; }
  .g3 > :first-child { grid-column: 1 / -1; }
  .legend .lg-extra { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}

/* ===== local demo mode pill ===== */
.demo-pill { flex: none; font-size: 11px; font-weight: 700; color: var(--ink-2); background: var(--fill); border-radius: 999px; padding: 3px 9px; }
.login-card .status { margin-bottom: 0; }
