/* Pontos — native-feeling mobile shell. No framework: tokens + a handful of components. */

:root {
  --bg: #f2f2f6;
  --surface: #ffffff;
  --surface-2: #f7f7f9;
  --elevated: rgba(255, 255, 255, 0.82);
  --separator: rgba(60, 60, 67, 0.14);
  --text: #111114;
  --text-2: #5e5e66;
  --text-3: #9a9aa3;
  --ink: #111114;
  --on-ink: #ffffff;
  --fill: rgba(118, 118, 128, 0.12);
  --fill-press: rgba(118, 118, 128, 0.22);
  --good: #1f9d55;
  --good-bg: rgba(31, 157, 85, 0.12);
  --warn: #d97706;
  --warn-bg: rgba(217, 119, 6, 0.13);
  --bad: #dc2626;
  --bad-bg: rgba(220, 38, 38, 0.1);
  --info: #2563eb;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-2: 0 8px 28px rgba(0, 0, 0, 0.16), 0 2px 6px rgba(0, 0, 0, 0.08);
  --radius: 14px;
  --radius-lg: 22px;
  --tabbar-h: 56px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --elevated: rgba(28, 28, 30, 0.82);
    --separator: rgba(84, 84, 88, 0.5);
    --text: #f4f4f6;
    --text-2: #a8a8b0;
    --text-3: #6e6e76;
    --ink: #f4f4f6;
    --on-ink: #111114;
    --fill: rgba(118, 118, 128, 0.24);
    --fill-press: rgba(118, 118, 128, 0.36);
    --good: #34c46e;
    --good-bg: rgba(52, 196, 110, 0.16);
    --warn: #f5a524;
    --warn-bg: rgba(245, 165, 36, 0.16);
    --bad: #ff5a52;
    --bad-bg: rgba(255, 90, 82, 0.16);
    --info: #5b8cff;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-2: 0 10px 30px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

body {
  position: fixed;
  inset: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { flex-shrink: 0; }
[hidden] { display: none !important; }

/* Interface chrome is not text to select; content is. */
.app, .tabbar, .fab, .btn, .chip, .cell, .sheet-handle { user-select: none; -webkit-user-select: none; }
.selectable { user-select: text; -webkit-user-select: text; }

.icon { width: 22px; height: 22px; }
.icon-sm { width: 18px; height: 18px; }
.icon-xs { width: 15px; height: 15px; }

/* ------------------------------------------------------------ shell */

.app {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 24px);
}

.navbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: calc(var(--safe-top) + 8px) 16px 8px;
  background: var(--bg);
  transition: background 0.2s, box-shadow 0.2s;
}
.navbar.scrolled {
  background: var(--elevated);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 0.5px 0 var(--separator);
}
.navbar-row { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.navbar-back {
  display: inline-flex; align-items: center; gap: 2px;
  margin-left: -8px; padding: 6px 8px; border-radius: 10px;
  color: var(--info); font-size: 17px;
}
.navbar-back:active { background: var(--fill); }
.large-title {
  margin: 4px 0 0;
  font-size: 32px;
  line-height: 1.1;
  font-weight: 750;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.subtitle { margin: 4px 0 0; color: var(--text-2); font-size: 15px; }

.content { padding: 8px 16px 0; display: flex; flex-direction: column; gap: 24px; }

/* ------------------------------------------------------------ tab bar */

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  background: var(--elevated);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 -0.5px 0 var(--separator);
}
.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-3);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.tab[aria-current="page"] { color: var(--ink); }
.tab:active .icon { transform: scale(0.88); }
.tab .icon { transition: transform 0.12s; }
.tab-badge {
  position: absolute;
  top: 5px;
  left: calc(50% + 6px);
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--bad);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px var(--surface);
}

/* ------------------------------------------------------------ grouped lists */

.section-label {
  margin: 0 0 6px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.section-foot { margin: 6px 16px 0; font-size: 13px; color: var(--text-2); }

.group {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
}
.cell {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 10px 16px;
  width: 100%;
  background: none;
  border: 0;
  text-align: left;
}
.cell + .cell::before, .cell + form > .cell::before, form + .cell::before, form + form > .cell::before {
  content: "";
  position: absolute;
  top: 0; right: 0;
  left: var(--sep-inset, 16px);
  border-top: 0.5px solid var(--separator);
}
.group > form { display: block; }
a.cell:active, button.cell:active, .cell.tappable:active { background: var(--fill); }
.cell-icon {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: grid; place-items: center;
  color: #fff;
  flex-shrink: 0;
}
.cell-icon .icon { width: 18px; height: 18px; }
.cell-body { flex: 1; min-width: 0; }
.cell-title { font-size: 16px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-sub { font-size: 13px; color: var(--text-2); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-value { color: var(--text-2); font-size: 15px; font-variant-numeric: tabular-nums; }
.cell-chevron { color: var(--text-3); width: 18px; height: 18px; }
.cell.destructive .cell-title { color: var(--bad); }

/* ------------------------------------------------------------ buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 50px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--radius);
  font-size: 17px;
  font-weight: 650;
  background: var(--fill);
  color: var(--text);
  transition: transform 0.1s, opacity 0.15s, background 0.15s;
}
.btn:active { transform: scale(0.97); background: var(--fill-press); }
.btn:disabled, .btn.htmx-request { opacity: 0.45; pointer-events: none; }
.btn-block { width: 100%; }
.btn-primary { background: var(--ink); color: var(--on-ink); }
.btn-primary:active { background: var(--ink); opacity: 0.85; }
.btn-good { background: var(--good); color: #fff; }
.btn-good:active { background: var(--good); opacity: 0.85; }
.btn-danger { background: var(--bad-bg); color: var(--bad); }
.btn-danger:active { background: var(--bad-bg); }
.btn-sm { height: 36px; padding: 0 14px; font-size: 15px; border-radius: 10px; }
.btn-row .btn { white-space: nowrap; padding: 0 12px; min-width: 0; }
.btn-row { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; }

.icon-btn {
  width: 36px; height: 36px;
  border-radius: 18px;
  border: 0;
  display: grid; place-items: center;
  background: var(--fill);
  color: var(--text-2);
}
.icon-btn:active { background: var(--fill-press); }

/* ------------------------------------------------------------ form fields */

.field {
  display: block;
  width: 100%;
  min-height: 50px;
  padding: 13px 16px;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 17px; /* >= 16px keeps iOS from zooming in on focus */
  outline: none;
  box-shadow: inset 0 0 0 1px transparent;
  transition: box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
}
.field:focus { box-shadow: inset 0 0 0 2px var(--ink); }
.sheet .field, .place-panel .field { background: var(--surface-2); }
textarea.field { min-height: 84px; resize: none; line-height: 1.4; }
select.field {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239a9aa3' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}
.field-label { display: block; margin: 0 0 6px 4px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.form-error {
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--bad-bg);
  color: var(--bad);
  font-size: 15px;
}

/* ------------------------------------------------------------ chips, pills */

.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 16px;
  scrollbar-width: none;
  padding: 2px 16px;
  margin: 0 -16px;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  scroll-snap-align: start;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px 0 12px;
  border-radius: 18px;
  border: 0;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow-1);
  transition: transform 0.1s, background 0.15s, color 0.15s;
}
.chip:active { transform: scale(0.95); }
.chip[aria-pressed="true"], .chip[aria-current="true"] { background: var(--ink); color: var(--on-ink); }
.chip-count { font-weight: 500; opacity: 0.6; font-variant-numeric: tabular-nums; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.7); }
.chip[aria-pressed="true"] .dot, .chip[aria-current="true"] .dot { box-shadow: 0 0 0 1.5px var(--on-ink); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 10px;
  border-radius: 13px;
  font-size: 13px;
  font-weight: 600;
  background: var(--fill);
  color: var(--text-2);
  white-space: nowrap;
}
.pill-good { background: var(--good-bg); color: var(--good); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-bad { background: var(--bad-bg); color: var(--bad); }

.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex-shrink: 0; }
.live-dot[data-state="ok"] { background: var(--good); box-shadow: 0 0 0 3px var(--good-bg); }
.live-dot[data-state="err"] { background: var(--bad); }

.progress { height: 4px; border-radius: 2px; background: var(--fill); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--good); transition: width 0.4s var(--ease); }

/* ------------------------------------------------------------ map screen */

.map-screen { position: absolute; inset: 0; }
#map { position: absolute; inset: 0; background: var(--surface-2); }

.map-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 10;
  padding: calc(var(--safe-top) + 10px) 16px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.map-top > * { pointer-events: auto; }
.status-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--elevated);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: var(--shadow-1);
}
.status-card .progress { margin-top: 6px; }
.status-title { font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.status-sub { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }

.map-fabs {
  position: absolute;
  right: 16px;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 92px);
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.fab {
  width: 48px; height: 48px;
  border-radius: 24px;
  border: 0;
  display: grid; place-items: center;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-2);
  transition: transform 0.12s;
}
.fab:active { transform: scale(0.92); }
.fab[aria-pressed="true"] { color: var(--info); }
.fab-primary { width: 56px; height: 56px; border-radius: 18px; background: var(--ink); color: var(--on-ink); }

.next-card {
  position: absolute;
  left: 16px; right: 80px;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 14px);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-2);
  text-align: left;
  transition: transform 0.12s;
}
.next-card:active { transform: scale(0.98); }
.next-badge {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: grid; place-items: center;
  color: #fff;
  font-weight: 750;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.next-label { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; }
.next-title { font-size: 16px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* placement mode: pick a spot by moving the map under a fixed pin */
.placing .map-top, .placing .map-fabs, .placing .next-card, .placing ~ .tabbar { display: none; }
.place-pin {
  position: absolute;
  left: 50%; top: 50%;
  z-index: 15;
  width: 44px; height: 44px;
  margin: -44px 0 0 -22px;
  pointer-events: none;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.3));
  transition: transform 0.15s var(--ease);
}
.map-moving .place-pin { transform: translateY(-10px); }
.place-pin-shadow {
  position: absolute;
  left: 50%; top: 50%;
  z-index: 14;
  width: 10px; height: 4px;
  margin: -2px 0 0 -5px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
.place-hint {
  position: absolute;
  top: calc(var(--safe-top) + 12px);
  left: 16px; right: 16px;
  z-index: 15;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--elevated);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-1);
  font-size: 15px;
  text-align: center;
}
.place-panel {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 15;
  padding: 16px 16px calc(var(--safe-bottom) + 16px);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--surface);
  box-shadow: var(--shadow-2);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: rise 0.3s var(--ease);
}
.place-zone { display: flex; align-items: center; gap: 10px; font-weight: 650; }
.place-zone .muted { font-weight: 500; }

/* MapLibre: keep attribution, make it quiet; hide the default geolocate button (we drive it). */
.maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { bottom: calc(var(--tabbar-h) + var(--safe-bottom)); }
.maplibregl-ctrl-attrib { font-size: 10px; background: transparent !important; }
.maplibregl-ctrl-attrib a { color: var(--text-3) !important; }
.maplibregl-ctrl-geolocate { display: none !important; }
.maplibregl-ctrl-group:has(.maplibregl-ctrl-geolocate) { display: none; }
.maplibregl-user-location-dot { width: 18px; height: 18px; }

/* ------------------------------------------------------------ bottom sheet */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.32);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
}
.sheet-open .sheet-backdrop { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 61;
  max-height: calc(100dvh - var(--safe-top) - 24px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-2);
  transform: translateY(105%);
  transition: transform 0.38s var(--ease);
  will-change: transform;
}
.sheet-open .sheet { transform: translateY(var(--drag, 0px)); }
.sheet.dragging { transition: none; }
.sheet-handle {
  flex-shrink: 0;
  padding: 8px 0 4px;
  touch-action: none;
  cursor: grab;
}
.sheet-handle::before {
  content: "";
  display: block;
  width: 38px; height: 5px;
  margin: 0 auto;
  border-radius: 3px;
  background: var(--separator);
}
.sheet-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 20px calc(var(--safe-bottom) + 20px);
}
.sheet-loading { padding: 32px 0; display: grid; place-items: center; color: var(--text-3); }

.sheet-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 16px; }
.sheet-badge {
  width: 52px; height: 52px;
  border-radius: 16px;
  display: grid; place-items: center;
  color: #fff;
  font-size: 22px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.sheet-kicker { font-size: 13px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.sheet-title { margin: 2px 0 6px; font-size: 24px; font-weight: 750; letter-spacing: -0.01em; line-height: 1.15; }
.sheet-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.sheet-notes {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 15px;
  white-space: pre-line;
}
.sheet-section { margin-top: 22px; }
.sheet-section .group { background: var(--surface-2); }
.sheet-page[hidden] { display: none; }
.sheet-page { animation: fade 0.2s ease; }

.choice { display: flex; align-items: center; gap: 12px; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice .radio {
  width: 22px; height: 22px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px var(--text-3);
  flex-shrink: 0;
  transition: box-shadow 0.15s;
}
.choice input:checked + .radio { box-shadow: inset 0 0 0 7px var(--ink); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 10px; padding: 8px 0; font-size: 14px; color: var(--text-2); }
.timeline li + li { border-top: 0.5px solid var(--separator); }
.timeline strong { color: var(--text); font-weight: 600; }
.timeline time { margin-left: auto; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ point list */

.point-cell { --sep-inset: 68px; }
.point-num {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: grid; place-items: center;
  font-weight: 750;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  color: #fff;
  flex-shrink: 0;
}
.point-cell.done .point-num { background: var(--fill) !important; color: var(--text-3); }
.point-cell.done .cell-title { color: var(--text-2); }
.check-btn {
  width: 44px; height: 44px;
  border-radius: 22px;
  border: 0;
  display: grid; place-items: center;
  background: var(--fill);
  color: var(--text-2);
  flex-shrink: 0;
  transition: transform 0.12s, background 0.15s;
}
.check-btn:active { transform: scale(0.88); }
.check-btn.on { background: var(--good-bg); color: var(--good); }

.zone-head { display: flex; align-items: center; gap: 12px; padding: 4px 4px 0; }
.zone-head .progress { flex: 1; }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-2);
}
.empty .icon { width: 40px; height: 40px; color: var(--text-3); }
.empty-title { font-size: 17px; font-weight: 650; color: var(--text); }

.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface);
  min-width: 0;
}
.stat-label { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { margin-top: 4px; font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-sub { font-size: 13px; color: var(--text-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ink);
  color: var(--on-ink);
  font-size: 26px;
  font-weight: 700;
  text-transform: uppercase;
}

.request-card { background: var(--surface); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.request-map { height: 140px; border-radius: 12px; overflow: hidden; background: var(--surface-2); }

/* ------------------------------------------------------------ snackbar */

.toasts {
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px);
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.sheet-open .toasts { bottom: calc(var(--safe-bottom) + 12px); }
.placing-active .toasts { top: calc(var(--safe-top) + 72px); bottom: auto; }
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 440px;
  min-height: 48px;
  padding: 8px 8px 8px 16px;
  border-radius: var(--radius);
  background: #1f1f23;
  color: #f4f4f6;
  font-size: 15px;
  box-shadow: var(--shadow-2);
  animation: rise 0.3s var(--ease);
}
@media (prefers-color-scheme: dark) { .toast { background: #3a3a3e; } }
.toast-msg { flex: 1; padding: 6px 0; }
.toast[data-kind="error"] { background: var(--bad); color: #fff; }
.toast-action {
  border: 0;
  background: none;
  color: #8ab4ff;
  font-weight: 700;
  font-size: 15px;
  padding: 8px 10px;
  border-radius: 8px;
}
.toast[data-kind="error"] .toast-action { color: #fff; }
.toast.leaving { opacity: 0; transform: translateY(8px); transition: opacity 0.2s, transform 0.2s; }

/* ------------------------------------------------------------ install card */

.install-card {
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px);
  z-index: 75;
  max-width: 440px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-2);
  animation: rise 0.3s var(--ease);
}
body:not([data-user]) .install-card { bottom: calc(var(--safe-bottom) + 12px); }
.sheet-open .install-card, .placing-active .install-card, .navigating-active .install-card { display: none; }
.install-card.leaving { opacity: 0; transform: translateY(8px); transition: opacity 0.2s, transform 0.2s; }
.install-icon { width: 48px; height: 48px; border-radius: 12px; }
.install-title { font-size: 16px; font-weight: 650; }
.install-sub { font-size: 14px; line-height: 1.35; color: var(--text-2); margin-top: 2px; }
.install-sub .icon-xs { vertical-align: -2px; }
.install-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; }

/* ------------------------------------------------------------ login */

.login {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 28px;
  padding: calc(var(--safe-top) + 24px) 24px calc(var(--safe-bottom) + 24px);
  max-width: 420px;
  margin: 0 auto;
}
.app-icon { width: 76px; height: 76px; border-radius: 20px; box-shadow: var(--shadow-1); }

/* ------------------------------------------------------------ motion */

@keyframes rise { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2.5px solid var(--fill-press);
  border-top-color: var(--text-2);
  animation: spin 0.7s linear infinite;
}

::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.18s; }

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

:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }

@media (min-width: 600px) {
  .screen > .navbar, .screen > .content { max-width: 560px; margin-left: auto; margin-right: auto; width: 100%; }
  .sheet { left: 50%; right: auto; width: 480px; margin-left: -240px; }
  .tabbar { padding-left: calc(50% - 240px); padding-right: calc(50% - 240px); }
}

/* expandable cell (people list) */
.cell-details > summary { list-style: none; }
.cell-details > summary::-webkit-details-marker { display: none; }
.cell-details[open] > summary .cell-chevron { transform: rotate(90deg); }
.cell-chevron { transition: transform 0.2s var(--ease); }
.cell-details + .cell-details > summary::before {
  content: ""; position: absolute; top: 0; right: 0; left: 16px; border-top: 0.5px solid var(--separator);
}
.placing-active .tabbar { display: none; }
.muted { color: var(--text-2); }

/* reservation */
.pill-info { background: rgba(37, 99, 235, 0.12); color: var(--info); }
.reserve-note {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding: 10px 10px 10px 14px;
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 14px;
  color: var(--text-2);
}
.reserve-note > span:first-child:not(.avatar) { flex: 1; }
.reserve-note .avatar { flex: none; }
.reserve-note.taken { margin-top: 0; padding: 12px 14px; color: var(--text); font-size: 15px; }
.reserve-note.taken .avatar { background: var(--info); color: #fff; }
.point-cell.taken .point-num { opacity: 0.45; }
.check-btn:disabled { opacity: 0.35; pointer-events: none; }

/* full screen (map in the field): bars hidden, map under the camera cutout */
.fab .when-off { display: grid; place-items: center; }
.fab .when-on { display: none; place-items: center; }
.fab[aria-pressed="true"] .when-off { display: none; }
.fab[aria-pressed="true"] .when-on { display: grid; }

/* segmented control (feature flags) */
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 2px; border-radius: 10px; background: var(--fill); }
.segment { height: 34px; border: 0; border-radius: 8px; background: transparent; font-size: 14px; font-weight: 600; color: var(--text-2); }
.segment[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }

/* in-app navigation */
.navigating .map-top, .navigating .map-fabs, .navigating .next-card, .navigating-active .tabbar { display: none; }
.nav-banner {
  position: absolute;
  top: calc(var(--safe-top) + 10px);
  left: 12px; right: 12px;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: #1d4ed8;
  color: #fff;
  box-shadow: var(--shadow-2);
}
.nav-arrow-wrap { width: 48px; height: 48px; display: grid; place-items: center; flex-shrink: 0; }
#nav-arrow { width: 40px; height: 40px; transition: transform 0.3s var(--ease); }
#nav-arrow[data-kind="arrive"] { transform: none !important; }
.nav-instruction { display: block; font-size: 20px; font-weight: 750; line-height: 1.2; text-wrap: balance; }
.nav-distance { display: block; margin-top: 2px; font-size: 15px; opacity: 0.85; font-variant-numeric: tabular-nums; }
.nav-panel {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 15;
  padding: 14px 16px calc(var(--safe-bottom) + 14px);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--surface);
  box-shadow: var(--shadow-2);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.nav-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.nav-remaining { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.nav-modes { min-width: 150px; }
.nav-me { width: 44px; height: 44px; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.35)); }
.nav-me svg { width: 100%; height: 100%; display: block; }
.nav-actions .btn { font-size: 15px; gap: 6px; padding: 0 8px; }
.route-btn { background: rgba(37, 99, 235, 0.12); color: var(--info); }

/* iOS-style switch */
.switch {
  appearance: none; -webkit-appearance: none;
  position: relative; flex-shrink: 0;
  width: 51px; height: 31px; margin: 0;
  border-radius: 16px;
  background: var(--fill-press);
  transition: background 0.2s;
  cursor: pointer;
}
.switch::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, 0.2);
  transition: transform 0.2s var(--ease);
}
.switch:checked { background: var(--good); }
.switch:checked::after { transform: translateX(20px); }
.toggle-cell .cell-title { font-weight: 500; }
