/* Patrol map. Built for night use on a phone: dark surfaces to keep night vision,
   big thumb targets at the bottom, colour reserved for meaning:
   cone orange = you and your actions, green = on patrol, red = SOS only. */
:root {
  /* Algoa Park Neighbourhood Watch: black and gold (from the badge), Cinzel for the name, Inter for the rest. */
  --asphalt: #0A0A0B;
  --kerb: #151518;
  --kerb-2: #1E1E23;
  --line: #2C2C33;
  --reflector: #F5F2EA;
  --muted: #9C9AA3;
  --cone: #E2B355;
  --cone-2: #F4D58C;
  --cone-3: #B07B2B;
  --cone-ink: #1A1206;
  --gold-grad: linear-gradient(180deg, #F6DB95 0%, #E2B355 48%, #C08A33 100%);
  --royal: #111114;
  --live: #2FCB71;
  --siren: #E5383B;
  --sodium: #F0A030;
  --sky: #6FA8FF;
  --tabs-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --radius: 16px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-cond: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-brand: 'Cinzel', 'Times New Roman', serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--asphalt);
  color: var(--reflector);
  font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
.tool svg, .bottomnav svg { width: 22px; height: 22px; }
a { color: var(--cone); }

/* ---------- gate (login / pending) ---------- */
.gate { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; background: var(--asphalt); z-index: 50; }
.gate-card { max-width: 26rem; width: 100%; }
.gate-logo { width: 128px; height: 128px; display: block; filter: drop-shadow(0 4px 14px rgba(0, 0, 0, .45)); }
.gate h1 { font: 800 1.75rem/1.15 var(--font-cond); margin: 18px 0 8px; }
.gate p { color: var(--muted); margin: 0 0 20px; max-width: 34ch; }
.gate-actions { display: grid; gap: 10px; }
.gate-actions .note { font-size: .92rem; color: var(--muted); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: 12px; border: 0;
  font: 700 1rem/1.1 var(--font-cond); text-decoration: none;
  background: var(--kerb-2); color: var(--reflector);
}
.btn.small { min-height: 38px; padding: 0 12px; font-size: .95rem; border-radius: 10px; }
.btn.primary { background: var(--gold-grad); color: var(--cone-ink); box-shadow: 0 6px 18px rgba(226, 179, 85, .18); }
.btn.go { background: var(--live); color: #062012; }
.btn.danger { background: transparent; color: #FF8F8A; box-shadow: inset 0 0 0 1.5px #7A2E2C; }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.light { background: #fff; color: #23090A; }
.btn.ghost-light { background: transparent; color: #fff; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .6); }
.btn.sos-solid { background: #fff; color: var(--siren); font-size: 1.25rem; min-height: 58px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }

.tool {
  width: 46px; height: 46px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: rgba(20, 20, 23, .94); color: var(--reflector); box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
}
.tool.flat { background: transparent; box-shadow: none; }
.tool.active { color: var(--cone); }

/* ---------- map ---------- */
.app { position: fixed; inset: 0; }
.map { position: absolute; inset: 0; z-index: 0; background: #0B0B0D; }
.map.night .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.85) saturate(.4) sepia(.35) hue-rotate(185deg) saturate(1.5); }
.leaflet-container { font: 14px/1.4 var(--font); background: #0B0B0D; }
/* Google Maps (public/gmap.js): stop above the tabs so Google's logo and credits stay visible. */
.map.gmap { bottom: 0; }
.gm-icon { position: relative; }
.gm-tip { position: absolute; z-index: 5; pointer-events: none; padding: 3px 8px; border-radius: 8px; background: rgba(20, 20, 23, .94); color: var(--reflector); font: 600 .8rem/1.2 var(--font); white-space: nowrap; }
.gm-tip[hidden] { display: none; }
.leaflet-bottom.leaflet-right { bottom: 0; }
.leaflet-control-attribution {
  background: transparent !important; color: var(--muted) !important; font-size: 10px; line-height: 14px;
  margin: 0 !important; padding: 0 8px !important;
}
.leaflet-control-attribution a { color: var(--muted) !important; }
.leaflet-tooltip.route-label {
  background: var(--kerb); color: var(--reflector); border: 0; border-radius: 6px;
  font: 600 .8rem var(--font-cond); padding: 2px 6px; box-shadow: none;
}
.leaflet-tooltip.route-label::before { display: none; }

/* patroller pin */
.pm-pin {
  --c: var(--sky);
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--asphalt); border: 3px solid var(--c); color: var(--c);
  display: grid; place-items: center;
  font: 700 .82rem/1 var(--font-cond); letter-spacing: .02em;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, .35), 0 3px 8px rgba(0, 0, 0, .45);
  transition: opacity .3s;
}
.pm-pin.stale { opacity: .55; border-style: dashed; }
.pm-pin.sos { border-color: var(--siren); color: #fff; background: var(--siren); }
.pm-pin.mine { --c: var(--cone); }

/* you */
.pm-me { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 5px solid var(--cone); box-shadow: 0 0 0 3px rgba(226, 179, 85, .32), 0 2px 6px rgba(0, 0, 0, .5); }
.pm-me.off { border-color: var(--muted); box-shadow: 0 0 0 3px rgba(167, 178, 212, .25); }

/* SOS beacon */
.pm-beacon { position: relative; width: 26px; height: 26px; }
.pm-beacon i { position: absolute; inset: 0; border-radius: 50%; background: var(--siren); box-shadow: 0 0 0 3px #fff; }
.pm-beacon::before, .pm-beacon::after {
  content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 3px solid var(--siren);
  animation: beacon 1.6s ease-out infinite; opacity: 0;
}
.pm-beacon::after { animation-delay: .8s; }
@keyframes beacon { 0% { transform: scale(.6); opacity: .9; } 100% { transform: scale(3.2); opacity: 0; } }

.pm-endpoint { width: 14px; height: 14px; border-radius: 50%; border: 3px solid #fff; }

/* ---------- top bar ---------- */
.topbar {
  position: absolute; top: calc(var(--safe-t) + 10px); left: 10px; right: 10px; z-index: 500;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand {
  display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 6px 0 7px; border-radius: 23px;
  background: rgba(20, 20, 23, .94); box-shadow: 0 2px 10px rgba(0, 0, 0, .35); max-width: calc(100vw - 86px);
}
.watch-name { font: 800 1rem/1 var(--font-cond); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conn { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.conn.on { background: var(--live); }
.brand-mark { position: relative; width: 32px; height: 32px; flex: none; }
.brand-mark img { width: 32px; height: 32px; display: block; }
.brand-mark .conn { position: absolute; right: -2px; bottom: -1px; width: 11px; height: 11px; box-shadow: 0 0 0 2px var(--asphalt); }
.out-pill {
  border: 0; border-radius: 16px; min-height: 34px; padding: 0 11px; white-space: nowrap;
  background: var(--kerb-2); font: 600 .82rem/1 var(--font-cond);
}
.out-pill.has { background: rgba(52, 199, 123, .16); color: var(--live); }
.map-tools { display: grid; gap: 8px; }

/* ---------- banners ---------- */
.banners {
  position: absolute; z-index: 520; left: 10px; right: 66px; top: calc(var(--safe-t) + 64px);
  display: grid; gap: 8px; pointer-events: none;
}
.banner {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 14px; border-radius: 12px;
  background: var(--kerb); box-shadow: 0 4px 14px rgba(0, 0, 0, .4); max-width: 560px;
}
.banner .txt { flex: 1; min-width: 0; }
.banner b { display: block; font: 700 1.02rem/1.2 var(--font-cond); }
.banner small { display: block; color: var(--muted); font-size: .86rem; }
.banner.sos { background: var(--siren); color: #fff; }
.banner.sos small { color: rgba(255, 255, 255, .85); }
.banner.warn { box-shadow: inset 4px 0 0 var(--sodium), 0 4px 14px rgba(0, 0, 0, .4); }

/* ---------- drawing toolbar ---------- */
.drawbar {
  position: absolute; z-index: 560; left: 10px; right: 10px; top: calc(var(--safe-t) + 10px);
  background: var(--kerb); border-radius: var(--radius); padding: 12px; display: grid; gap: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .5); max-width: 520px;
}
.drawbar-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.drawbar-row:empty { display: none; }
.drawbar-title { font: 700 1.05rem/1.2 var(--font-cond); }
.drawbar-meta { color: var(--muted); font-size: .9rem; }
.drawbar label { display: flex; align-items: center; gap: 8px; font-size: .95rem; }
.drawbar input[type=range] { flex: 1; accent-color: var(--cone); }

.history-chip {
  position: absolute; z-index: 530; left: 50%; transform: translateX(-50%); top: calc(var(--safe-t) + 66px);
  display: flex; align-items: center; gap: 12px; padding: 6px 6px 6px 14px; border-radius: 24px;
  background: var(--kerb); box-shadow: 0 4px 14px rgba(0, 0, 0, .4); white-space: nowrap; font-weight: 500;
}

/* ---------- dock ---------- */
.dock {
  position: absolute; z-index: 500; left: 10px; right: 10px;
  bottom: 14px;
  display: flex; align-items: flex-end; gap: 10px; pointer-events: none;
}
.dock > * { pointer-events: auto; }
.patrol-card {
  flex: 1; min-width: 0; max-width: 460px; background: var(--kerb); border-radius: 18px; padding: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .45);
}
.pc-row { display: flex; align-items: center; gap: 10px; }
.pc-status { display: flex; align-items: center; gap: 8px; font: 600 .95rem/1 var(--font-cond); color: var(--muted); }
.pc-status .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.patrol-card.on .pc-status { color: var(--live); }
.patrol-card.on .pc-status .dot { background: var(--live); animation: livedot 1.8s ease-in-out infinite; }
@keyframes livedot { 50% { box-shadow: 0 0 0 6px rgba(52, 199, 123, 0); } 0% { box-shadow: 0 0 0 0 rgba(52, 199, 123, .55); } }
.pc-timer { font: 700 1.9rem/1 var(--font-cond); font-variant-numeric: tabular-nums; }
.pc-meta { color: var(--muted); font-size: .92rem; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-main { flex: 1; min-width: 0; }
.pc-route {
  border: 0; background: transparent; padding: 4px 0; color: var(--muted); font-size: .92rem; text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.pc-route b { color: var(--reflector); font-weight: 600; }
.pc-start { width: 100%; min-height: 54px; font-size: 1.15rem; margin-top: 8px; }
.pc-warn { margin-top: 8px; font-size: .88rem; color: var(--sodium); }

.sos-btn {
  position: relative; flex: none; width: 76px; height: 76px; border-radius: 50%; border: 0;
  background: var(--siren); color: #fff; font: 700 1.3rem/1 var(--font-cond); letter-spacing: .04em;
  box-shadow: 0 0 0 4px rgba(229, 37, 42, .25), 0 6px 18px rgba(0, 0, 0, .5);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.sos-btn span { position: relative; }
.sos-ring { position: absolute; inset: -6px; width: calc(100% + 12px); height: calc(100% + 12px); transform: rotate(-90deg); pointer-events: none; }
.sos-ring circle { fill: none; stroke: #fff; stroke-width: 5; stroke-dasharray: 289; stroke-dashoffset: 289; stroke-linecap: round; }
.sos-btn.holding .sos-ring circle { stroke-dashoffset: 0; transition: stroke-dashoffset 1.4s linear; }
.sos-btn.holding { transform: scale(.96); }

/* ---------- toast ---------- */
.toast {
  position: fixed; z-index: 990; left: 50%; top: calc(var(--safe-t) + 12px);
  transform: translate(-50%, -12px); opacity: 0; pointer-events: none; transition: .2s;
  background: var(--reflector); color: var(--asphalt); padding: 10px 16px; border-radius: 12px;
  font-weight: 600; max-width: calc(100vw - 32px); text-align: center; box-shadow: 0 6px 18px rgba(0, 0, 0, .4);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: #FFD9D7; color: #4A0D0B; }

/* ---------- sheet ---------- */
.sheet {
  position: absolute; z-index: 580; left: 0; right: 0; bottom: calc(var(--tabs-h) + var(--safe-b));
  max-height: min(68vh, 640px); display: flex; flex-direction: column;
  background: var(--kerb); border-radius: 20px 20px 0 0; box-shadow: 0 -8px 30px rgba(0, 0, 0, .45);
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 10px 6px 18px; }
.sheet-head h2 { margin: 0; font: 700 1.35rem/1.1 var(--font-cond); }
.sheet-body { overflow-y: auto; padding: 4px 18px 22px; -webkit-overflow-scrolling: touch; }
.sheet h3 { font: 700 1.05rem/1.2 var(--font-cond); margin: 18px 0 8px; color: var(--reflector); }
.sheet h3:first-child { margin-top: 4px; }
.sheet p.help { color: var(--muted); font-size: .92rem; margin: 4px 0 10px; }
.empty { color: var(--muted); padding: 10px 0; font-size: .95rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--kerb-2); }
.list li:last-child { border-bottom: 0; }
.list li.click { cursor: pointer; }
.list .main { flex: 1; min-width: 0; }
.list .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .sub { color: var(--muted); font-size: .88rem; }
.list .end { text-align: right; font: 600 .95rem/1.2 var(--font-cond); white-space: nowrap; }
.swatch { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.swatch.round { border-radius: 50%; }
.swatch.line { width: 22px; height: 4px; border-radius: 2px; }
.check { width: 22px; height: 22px; accent-color: var(--cone); flex: none; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--kerb-2); border-radius: 12px; padding: 10px 12px; }
.stat .v { font: 700 1.6rem/1.05 var(--font-cond); font-variant-numeric: tabular-nums; }
.stat .k { color: var(--muted); font-size: .85rem; }
.stat .s { color: var(--muted); font-size: .8rem; margin-top: 2px; }

.seg { display: inline-flex; background: var(--kerb-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font: 600 .9rem/1 var(--font-cond); color: var(--muted); }
.seg button.on { background: var(--asphalt); color: var(--reflector); }

/* forms */
.field { display: grid; gap: 6px; margin: 12px 0; }
.field > span { font-size: .9rem; color: var(--muted); }
.field input[type=text], .field input[type=number], .field input[type=datetime-local], .field input[type=date], .field select, .field textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--line);
  background: var(--asphalt); font-size: 16px;
}
.field textarea { min-height: 80px; resize: vertical; }
.toggle { display: flex; align-items: center; gap: 12px; margin: 12px 0; }
.toggle input { flex: none; width: 22px; height: 22px; accent-color: var(--cone); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 0; border-radius: 20px; padding: 8px 14px; background: var(--kerb-2); color: var(--reflector);
  display: inline-flex; align-items: center; gap: 8px; font: 600 .95rem/1 var(--font-cond);
}
.chip.on { box-shadow: inset 0 0 0 2px var(--cone); }
.colors { display: flex; flex-wrap: wrap; gap: 10px; }
.colors button { width: 34px; height: 34px; border-radius: 50%; border: 3px solid transparent; }
.colors button.on { border-color: #fff; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 800; background: rgba(0, 0, 0, .66); display: grid; align-items: end; justify-items: center; }
.modal-card {
  width: 100%; max-width: 480px; background: var(--kerb); border-radius: 20px 20px 0 0;
  padding: 20px 18px calc(18px + var(--safe-b)); box-shadow: 0 -8px 30px rgba(0, 0, 0, .5); max-height: 86vh; overflow-y: auto;
}
.modal-card h2 { font: 700 1.4rem/1.15 var(--font-cond); margin: 0 0 6px; }
.modal-card p { color: var(--muted); margin: 0 0 14px; }
.modal-actions { display: grid; gap: 10px; margin-top: 16px; }
.person-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.person-head .pm-pin { flex: none; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 10px 0; font-size: .95rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* ---------- SOS alarm ---------- */
.alarm { position: fixed; inset: 0; z-index: 950; background: var(--siren); color: #fff; display: grid; place-items: center; padding: 24px; overflow: hidden; }
.alarm-inner { position: relative; width: 100%; max-width: 420px; text-align: center; }
.alarm-beacon {
  position: relative; width: 96px; height: 96px; margin: 0 auto; border-radius: 50%;
  border: 4px solid #fff; display: grid; place-items: center; font: 700 1.5rem/1 var(--font-cond); letter-spacing: .05em;
}
.alarm-beacon::before, .alarm-beacon::after {
  content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .7);
  animation: alarm 1.6s ease-out infinite;
}
.alarm-beacon::after { animation-delay: .8s; }
@keyframes alarm { 0% { transform: scale(1); opacity: .9; } 100% { transform: scale(2.6); opacity: 0; } }
.alarm h2 { position: relative; font: 700 2.4rem/1.05 var(--font-cond); margin: 40px 0 10px; }
.alarm p { position: relative; font-size: 1.15rem; margin: 0 0 28px; color: rgba(255, 255, 255, .92); }
.alarm-actions { position: relative; display: grid; gap: 12px; }

/* ---------- wider screens ---------- */
@media (min-width: 900px) {
  .sheet { left: 12px; right: auto; width: 380px; top: calc(var(--safe-t) + 120px); bottom: calc(var(--tabs-h) + 16px); max-height: none; border-radius: 18px; }
  .dock { left: 12px; right: auto; width: 480px; }
  .banners { left: 50%; right: auto; width: 460px; transform: translateX(-50%); top: calc(var(--safe-t) + 10px); }
  .drawbar { left: 50%; right: auto; width: 460px; transform: translateX(-50%); }
  .modal { align-items: center; }
  .modal-card { border-radius: 20px; }
  .history-chip { top: calc(var(--safe-t) + 10px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; }
  .sos-btn.holding .sos-ring circle { transition-duration: 1.4s !important; }
}

/* ---------- private patrols, perimeter, app download ---------- */
.pc-alt {
  display: block; width: 100%; margin-top: 6px; border: 0; background: transparent; padding: 8px 0 2px;
  color: var(--muted); font: 600 .95rem/1 var(--font-cond); text-decoration: underline; text-underline-offset: 3px;
}
.pc-mode {
  display: flex; align-items: center; gap: 10px; margin-top: 6px; padding: 8px 10px; border-radius: 10px;
  background: var(--kerb-2); font-size: .88rem; color: var(--muted);
}
.pc-mode span { flex: 1; min-width: 0; }
.pc-mode.private { box-shadow: inset 3px 0 0 var(--sky); color: var(--reflector); }
.pc-outside { margin-top: 8px; font-size: .88rem; color: var(--sodium); }
.pm-pin.outside { box-shadow: 0 0 0 3px var(--sodium), 0 3px 8px rgba(0, 0, 0, .45); }
.tag { display: inline-block; padding: 0 6px; border-radius: 6px; background: var(--kerb-2); color: var(--reflector); font-size: .8rem; line-height: 1.5; }
.tag.amber { background: rgba(255, 159, 67, .16); color: var(--sodium); }
.warn-text { color: var(--sodium); }
.perimeter-note { display: flex; align-items: center; gap: 10px; }
.perimeter-note .swatch.line { background-image: repeating-linear-gradient(90deg, var(--reflector) 0 6px, transparent 6px 9px) !important; background-color: transparent !important; }
.pm-vertex { width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 4px solid var(--cone); box-shadow: 0 2px 6px rgba(0, 0, 0, .5); cursor: grab; }
.pm-mid { width: 18px; height: 18px; border-radius: 50%; background: rgba(226, 179, 85, .6); border: 2px solid #fff; cursor: grab; }
.pm-cross { width: 16px; height: 16px; border-radius: 4px; transform: rotate(45deg); border: 2px solid #fff; }
.pm-cross.left { background: var(--sodium); }
.pm-cross.returned { background: var(--live); }
.pm-cross.hidden { background: var(--sky); }

/* ---------- app-only patrols ---------- */
.pc-note { margin: 8px 0 0; font-size: .9rem; color: var(--muted); }
.modal-card ol.steps { list-style: none; counter-reset: s; margin: 4px 0 14px; padding: 0; display: grid; gap: 10px; }
.modal-card ol.steps li { counter-increment: s; display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; color: var(--reflector); }
.modal-card ol.steps li::before {
  content: counter(s); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--cone); color: var(--cone-ink); font: 700 .95rem/1 var(--font-cond);
}
.modal-card p.modal-note { font-size: .9rem; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--cone); font: inherit; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- how you're patrolling (sign-on message) and route chips ---------- */
.pc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pc-chip {
  border: 0; border-radius: 14px; min-height: 32px; padding: 0 11px; background: var(--kerb-2); color: var(--muted);
  font: 500 .9rem/1 var(--font); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pc-chip b { color: var(--reflector); font-weight: 600; }
.mode-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 14px; }
.mode-pick { display: inline-flex; align-items: center; border-radius: 18px; background: var(--kerb-2); overflow: hidden; }
.mode-pick button { border: 0; background: transparent; color: var(--reflector); font: 600 .98rem/1 var(--font); min-height: 40px; padding: 0 14px; }
.mode-pick .mode-del { padding: 0 12px 0 4px; color: var(--muted); font-size: 1.2rem; }
.mode-pick.on { background: var(--cone); }
.mode-pick.on button { color: var(--asphalt); }
.mode-add { display: flex; gap: 8px; margin-bottom: 6px; }
.mode-add input { flex: 1; min-width: 0; min-height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--asphalt); color: var(--reflector); padding: 0 12px; font: 400 1rem var(--font); }

/* ---------- tucked controls: a clear map, a small SOS, and the patrol timer ---------- */
#btn-tuck svg { transition: transform .2s; }
.app.tucked #btn-tuck svg { transform: rotate(180deg); }
.app.tucked .map-tools .tool:not(#btn-tuck):not(#loc-state),
.app.tucked .patrol-card,
.app.tucked .watch-name,
.app.tucked .out-pill { display: none; }
.app.tucked .brand { padding-right: 7px; }
.app.tucked .dock { justify-content: flex-end; align-items: center; }
.app.tucked .sos-btn { width: 56px; height: 56px; font-size: 1rem; }
.tuck-chip {
  display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 18px; min-height: 36px; padding: 0 12px;
  background: rgba(20, 20, 23, .94); color: var(--live); font: 700 1rem/1 var(--font-cond); font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
}
.tuck-chip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--live); }
.tuck-chip[hidden] { display: none; }

/* Google's logo and Terms sit at the bottom of the map: keep the panel and SOS above them. */
.map.gmap ~ .dock { bottom: 30px; }

/* ---------- group chat ---------- */
.badge {
  position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--siren); color: #fff; font: 700 .72rem/18px var(--font); font-style: normal; text-align: center;
}
.badge[hidden] { display: none; }
.sheet-foot { padding: 8px 10px calc(10px + 0px); border-top: 1px solid var(--kerb-2); }
.sheet-foot[hidden] { display: none; }
.chat-list { display: flex; flex-direction: column; gap: 8px; padding-bottom: 6px; }
.chat-older { display: block; margin: 0 auto 10px; }
.chat-note { background: var(--kerb-2); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; font-size: .92rem; color: var(--muted); }
.chat-note b { display: block; color: var(--reflector); margin-bottom: 4px; }
.chat-day { align-self: center; font: 600 .78rem/1 var(--font-cond); color: var(--muted); background: var(--kerb-2); padding: 5px 10px; border-radius: 10px; margin: 6px 0 2px; }
.chat-event { align-self: center; max-width: 92%; text-align: center; font-size: .86rem; color: var(--muted); }
.chat-event time { opacity: .75; margin-left: 4px; }
.chat-msg { align-self: flex-start; max-width: 84%; background: var(--kerb-2); border-radius: 4px 14px 14px 14px; padding: 7px 10px 6px; }
.chat-msg.mine { align-self: flex-end; background: #3A2E14; border-radius: 14px 4px 14px 14px; }
.chat-msg.bot { box-shadow: inset 3px 0 0 var(--cone); }
.chat-from { font: 700 .86rem/1.2 var(--font-cond); color: var(--sky); margin-bottom: 3px; }
.chat-text { white-space: normal; overflow-wrap: anywhere; line-height: 1.38; }
.chat-text a { color: var(--sky); }
.chat-sticker { font-size: 2.4rem; line-height: 1.1; }
.chat-meta { font-size: .72rem; color: var(--muted); text-align: right; margin-top: 3px; }
.chat-media { display: block; position: relative; border: 0; padding: 0; margin: 2px 0 4px; width: min(260px, 64vw); max-height: 320px; border-radius: 10px; overflow: hidden; background: var(--kerb-2); }
.chat-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.chat-media img:not([src]) { visibility: hidden; }
.chat-media .play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: rgba(0, 0, 0, .6); color: #fff; border-radius: 18px; padding: 7px 12px; font: 700 .9rem/1 var(--font-cond); }
.chat-file { display: block; border: 0; background: var(--kerb-2); color: var(--reflector); border-radius: 10px; padding: 9px 11px; margin: 2px 0 4px; text-align: left; font: 500 .92rem/1.3 var(--font); text-decoration: none; }
.chat-viewer { display: grid; place-items: center; margin: 4px 0 12px; }
.chat-viewer img, .chat-viewer video { max-width: 100%; max-height: 62vh; border-radius: 12px; }
.chat-viewer audio { width: 100%; }
.chat-compose { display: flex; align-items: flex-end; gap: 6px; }
.chat-compose textarea {
  flex: 1; min-width: 0; resize: none; min-height: 42px; max-height: 120px; border-radius: 21px; border: 1px solid var(--line);
  background: var(--asphalt); color: var(--reflector); padding: 10px 14px; font: 400 1rem/1.3 var(--font);
}
.chat-attach input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.chat-attach { position: relative; cursor: pointer; }
.chat-send { background: var(--gold-grad); color: var(--cone-ink); }

@media (min-width: 900px) {
  .map.gmap ~ .dock { bottom: 40px; }
}

/* ---------- beacons: quick reports on the map ---------- */
.dock-side { flex: none; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.report-btn {
  width: 58px; height: 58px; border-radius: 50%; border: 0; padding: 0; background: var(--gold-grad); color: var(--cone-ink);
  display: grid; place-items: center; align-content: center; gap: 2px; font: 700 .6rem/1 var(--font-cond); letter-spacing: .04em; text-transform: uppercase;
  box-shadow: 0 0 0 4px rgba(226, 179, 85, .22), 0 6px 18px rgba(0, 0, 0, .5);
}
.report-btn svg { width: 24px; height: 24px; }
.app.tucked .report-btn { width: 46px; height: 46px; }
.app.tucked .report-btn span { display: none; }
.app.placing .dock, .app.placing .bottomnav, .app.placing .map-chips, .app.placing .banners, .app.placing .map-tools .tool:not(#btn-layer) { display: none; }

/* the pin: a teardrop in the beacon's colour with its icon; its tip is the spot */
.pm-bcn { --c: var(--sky); position: relative; width: 40px; height: 48px; }
.pm-bcn::before {
  content: ''; position: absolute; left: 2px; top: 0; width: 36px; height: 36px; box-sizing: border-box;
  border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--c); border: 3px solid #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .5);
}
.pm-bcn span { position: absolute; left: 0; top: 0; width: 40px; height: 36px; display: grid; place-items: center; font-size: 18px; line-height: 1; z-index: 1; }
.pm-bcn.new::after {
  content: ''; position: absolute; left: 2px; top: 0; width: 36px; height: 36px; box-sizing: border-box; border-radius: 50%;
  border: 3px solid var(--c); animation: beacon 1.6s ease-out infinite; opacity: 0;
}
.pm-bcn.ending { opacity: .62; }
.pm-bcn.past { opacity: .55; filter: grayscale(.7); }
.person-head .pm-bcn { flex: none; }
.crosshair { position: fixed; z-index: 540; transform: translate(-50%, -100%); pointer-events: none; }
.crosshair::after {
  content: ''; position: absolute; left: 50%; bottom: -5px; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 2px rgba(0, 0, 0, .45);
}
.bcn-dot {
  --c: var(--sky); flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--kerb-2);
  box-shadow: inset 0 0 0 2px var(--c); display: grid; place-items: center; font-size: 1.1rem;
}
.list li.past { opacity: .72; }
.bcn-kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0 4px; }
.bcn-kind {
  --c: var(--sky); border: 0; border-radius: 12px; min-height: 50px; padding: 8px 10px; background: var(--kerb-2); color: var(--reflector);
  display: flex; align-items: center; gap: 10px; font: 600 .92rem/1.15 var(--font-cond); text-align: left; box-shadow: inset 5px 0 0 var(--c);
}
.bcn-kind span { font-size: 1.35rem; line-height: 1; }
.bcn-kind.on { box-shadow: inset 0 0 0 2px var(--cone), inset 7px 0 0 var(--c); background: var(--line); }
.bcn-icons { display: flex; flex-wrap: wrap; gap: 6px; }
.bcn-icons button { width: 42px; height: 42px; border-radius: 10px; border: 0; background: var(--kerb-2); font-size: 1.3rem; line-height: 1; padding: 0; }
.bcn-icons button.on { box-shadow: inset 0 0 0 2px var(--cone); background: var(--line); }
.chip:disabled { opacity: .5; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }

/* ---------- route loops ---------- */
.pc-route-prog { margin-top: 6px; font: 600 .92rem/1.2 var(--font-cond); color: var(--cone); }
.pc-route-prog.done { color: var(--live); }
.chips.loops { gap: 6px; }
.chips.loops .chip { min-width: 40px; justify-content: center; padding: 8px 0; }

/* ---------- chat: emojis, @mentions, editing ---------- */
.chat-box { position: relative; flex: 1; min-width: 0; display: flex; }
.chat-box textarea { padding-right: 44px !important; width: 100%; }
.chat-emoji-btn {
  position: absolute; right: 4px; bottom: 3px; width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: transparent; font-size: 1.3rem; line-height: 1; padding: 0; cursor: pointer;
}
.chat-emoji { margin-bottom: 8px; background: var(--asphalt); border-radius: 14px; padding: 6px; }
.emoji-tabs { display: flex; gap: 4px; padding-bottom: 6px; border-bottom: 1px solid var(--kerb-2); margin-bottom: 6px; }
.emoji-tabs button { border: 0; background: transparent; font-size: 1.15rem; width: 38px; height: 32px; border-radius: 8px; padding: 0; opacity: .6; }
.emoji-tabs button.on { background: var(--kerb-2); opacity: 1; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); max-height: 168px; overflow-y: auto; }
.emoji-grid button { border: 0; background: transparent; font-size: 1.45rem; height: 42px; padding: 0; border-radius: 8px; line-height: 1; }
.emoji-grid button:active { background: var(--kerb-2); }
.chat-mention { display: grid; margin-bottom: 8px; background: var(--asphalt); border-radius: 12px; overflow: hidden; }
.chat-mention button {
  display: flex; align-items: center; gap: 10px; border: 0; background: transparent; color: var(--reflector);
  padding: 10px 12px; font: 600 .95rem/1.2 var(--font); text-align: left; border-bottom: 1px solid var(--kerb-2);
}
.chat-mention button:last-child { border-bottom: 0; }
.chat-mention small { color: var(--muted); font-weight: 400; }
.chat-editing { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; padding: 2px 2px 2px 12px; border-left: 3px solid var(--cone); color: var(--cone); font: 600 .9rem/1.2 var(--font-cond); }
.chat-editing .tool { width: 34px; height: 34px; }
.mention { color: var(--cone); font-weight: 600; }
.mention.me { background: rgba(226, 179, 85, .18); border-radius: 4px; padding: 0 2px; }
.chat-msg.for-me { box-shadow: inset 3px 0 0 var(--cone); }
.chat-msg { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.chat-quote { background: var(--asphalt); border-radius: 10px; padding: 8px 10px; color: var(--reflector) !important; white-space: pre-wrap; }

/* ---------- location symbol (under ») and "find my location" ---------- */
.loc-state { width: 36px; height: 36px; justify-self: center; position: relative; }
.loc-state svg, .loc-badge svg { width: 17px; height: 17px; }
.loc-state[data-state="shared"], .loc-badge[data-state="shared"] { color: var(--live); box-shadow: 0 0 0 2px rgba(52, 199, 123, .55), 0 2px 10px rgba(0, 0, 0, .35); }
.loc-state[data-state="on"], .loc-badge[data-state="on"] { color: var(--sky); }
.loc-state[data-state="weak"], .loc-badge[data-state="weak"] { color: var(--sodium); }
.loc-state[data-state="finding"], .loc-badge[data-state="finding"] { color: var(--muted); animation: locfind 1.4s ease-in-out infinite; }
.loc-state[data-state="idle"], .loc-badge[data-state="idle"] { color: var(--muted); }
.loc-state[data-state="off"], .loc-badge[data-state="off"] { color: var(--siren); box-shadow: 0 0 0 2px rgba(229, 37, 42, .8), 0 2px 10px rgba(0, 0, 0, .35); }
@keyframes locfind { 50% { opacity: .45; } }
.loc-badge { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--asphalt); }
.loc-badge svg { width: 20px; height: 20px; }
.pm-findme { position: relative; width: 140px; height: 140px; pointer-events: none; }
.pm-findme i {
  position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%;
  border: 3px solid var(--cone); animation: findme 1.5s ease-out 2 forwards; opacity: 0;
}
.pm-findme i + i { animation-delay: .5s; }
@keyframes findme { 0% { transform: scale(.4); opacity: .95; } 100% { transform: scale(4.4); opacity: 0; } }

/* ---------- chat: voice notes ---------- */
.chat-compose:not(.has-text) .chat-send { display: none; }
.chat-compose.has-text .chat-mic { display: none; }
.chat-mic { background: var(--cone); color: var(--asphalt); }
.chat-rec { display: flex; align-items: center; gap: 6px; }
.rec-info {
  flex: 1; min-width: 0; height: 42px; display: flex; align-items: center; gap: 10px; padding: 0 14px;
  background: var(--asphalt); border: 1px solid var(--line); border-radius: 21px;
}
.rec-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--siren); animation: rec-pulse 1.2s ease-in-out infinite; }
.rec-time { flex: none; min-width: 2.7em; font: 700 1.02rem/1 var(--font-cond); font-variant-numeric: tabular-nums; }
.rec-level { flex: 1; min-width: 24px; height: 6px; border-radius: 3px; background: var(--kerb-2); overflow: hidden; }
.rec-level i { display: block; height: 100%; background: var(--cone); transform-origin: left center; transform: scaleX(.05); transition: transform .08s linear; }
.rec-note { flex: none; max-width: 45%; font-size: .82rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-cancel { color: #FF8F8A; }
.chat-rec[data-state="sending"] .rec-dot, .chat-rec[data-state="failed"] .rec-dot { animation: none; background: var(--muted); }
.chat-rec[data-state="sending"] .rec-level, .chat-rec[data-state="failed"] .rec-level { display: none; }
.chat-rec[data-state="failed"] .rec-info { height: auto; min-height: 42px; padding-block: 6px; }
.chat-rec[data-state="failed"] .rec-note { flex: 1; max-width: none; white-space: normal; color: #FF8F8A; }
@keyframes rec-pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .rec-dot { animation: none; } .rec-level i { transition: none; } }

.voice { --p: 0; display: flex; align-items: center; gap: 10px; width: min(250px, 62vw); margin: 2px 0 4px; }
.voice-btn {
  flex: none; width: 40px; height: 40px; border: 0; border-radius: 50%; padding: 0; display: grid; place-items: center;
  background: var(--cone); color: var(--asphalt); cursor: pointer;
}
.voice-btn svg { width: 20px; height: 20px; }
.voice.loading .voice-btn { opacity: .55; }
.voice-track { flex: 1; min-width: 0; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 8px; padding: 10px 0; cursor: pointer; }
.voice-name { grid-column: 1 / -1; font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-bar { position: relative; height: 4px; border-radius: 2px; background: rgba(244, 246, 251, .22); overflow: hidden; }
.voice-bar i { position: absolute; inset: 0; background: var(--cone); transform-origin: left center; transform: scaleX(var(--p)); }
.voice-time { font: 600 .8rem/1 var(--font-cond); color: var(--muted); font-variant-numeric: tabular-nums; }
.chat-msg.mine .voice-time { color: #C7D3F5; }

/* =====================================================================================
   The watch app shell (Algoa Park design): welcome, home, alerts, report, messages, profile.
   ===================================================================================== */
body { background: var(--asphalt); }
.mapview, .screen { position: absolute; left: 0; right: 0; top: 0; bottom: calc(var(--tabs-h) + var(--safe-b)); }
.mapview { z-index: 1; }
.screen { z-index: 700; background: var(--asphalt); display: flex; flex-direction: column; }
.app[data-tab="map"] .screen { display: none; }
.app:not([data-tab="map"]) .mapview { visibility: hidden; }
.app:not([data-tab="map"]) .sheet { display: none; }

/* bottom navigation */
.bottomnav {
  position: absolute; z-index: 720; left: 0; right: 0; bottom: 0; height: calc(var(--tabs-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: flex; align-items: stretch; background: #0E0E10; border-top: 1px solid #222228;
}
.bottomnav button {
  position: relative; flex: 1; border: 0; background: transparent; color: var(--muted);
  display: grid; place-items: center; align-content: center; gap: 4px; font: 500 .74rem/1 var(--font);
}
.bottomnav button.active { color: var(--cone); }
.bottomnav .nav-shield { flex: 1.1; }
.bottomnav .nav-shield img {
  width: 66px; height: 66px; padding: 11px 13px 12px; margin-top: -26px; border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #2A2112, #0E0E10 70%); box-shadow: 0 0 0 2px #C99A45, 0 0 0 5px #0E0E10, 0 8px 22px rgba(226, 179, 85, .28);
}
.bottomnav .nav-shield.active img { box-shadow: 0 0 0 2px #F4D58C, 0 0 0 5px #0E0E10, 0 8px 26px rgba(244, 213, 140, .45); }
.bottomnav .badge { top: 8px; left: calc(50% + 4px); }

/* map: patrol tools under the brand, for patrollers */
.map-chips { position: absolute; z-index: 505; left: 10px; top: calc(var(--safe-t) + 62px); display: flex; gap: 6px; }
.map-chips button {
  display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 18px; min-height: 34px; padding: 0 12px;
  background: rgba(20, 20, 23, .94); color: var(--reflector); font: 600 .82rem/1 var(--font); box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
}
.map-chips svg { width: 16px; height: 16px; color: var(--cone); }
.map-chips[hidden] { display: none; }
.app.resident .banners { top: calc(var(--safe-t) + 64px); }
.app:not(.resident) .banners { top: calc(var(--safe-t) + 104px); }

/* shell header */
.shell-head {
  flex: none; display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; gap: 6px;
  padding: calc(var(--safe-t) + 8px) 10px 8px; background: var(--asphalt);
}
.shell-head .hbtn { width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: var(--reflector); display: grid; place-items: center; position: relative; }
.shell-head .hbtn svg { width: 24px; height: 24px; }
.shell-head .hbtn.gold { color: var(--cone); }
.shell-head .hbtn .badge { top: 4px; left: 26px; }
.shell-title { text-align: center; min-width: 0; }
.shell-title .brand-name { font: 600 1.25rem/1 var(--font-brand); letter-spacing: .08em; background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; white-space: nowrap; }
.shell-title .brand-sub { font: 600 .58rem/1 var(--font); letter-spacing: .22em; color: var(--reflector); margin-top: 4px; }
.shell-title .page-title { font: 600 1.02rem/1.1 var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--cone); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.screen-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 6px 16px 28px; }
.screen-body > * { max-width: 640px; margin-left: auto; margin-right: auto; }
.screen-foot { flex: none; padding: 8px 10px 10px; border-top: 1px solid var(--kerb-2); background: var(--kerb); }
.screen-foot > * { max-width: 640px; margin-left: auto; margin-right: auto; }
.screen-foot[hidden] { display: none; }

/* cards */
.card { background: linear-gradient(180deg, #17171A, #131316); border: 1px solid #26262C; border-radius: var(--radius); padding: 16px; margin: 0 0 12px; }
.card h3 { margin: 0 0 8px; font: 700 .82rem/1.2 var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--cone); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.card-head h3 { margin: 0; }
.linkbtn { border: 0; background: transparent; color: var(--cone); font: 600 .88rem/1 var(--font); padding: 4px 0; cursor: pointer; }
.muted { color: var(--muted); }
.gold { color: var(--cone); }

.greet { margin: 6px 0 14px; }
.greet h1 { font: 600 1.45rem/1.2 var(--font); margin: 0 0 4px; }
.greet p { margin: 0; color: #D8D4CB; font-size: .98rem; }

/* area status */
.area { position: relative; overflow: hidden; display: flex; align-items: center; gap: 12px; min-height: 132px; }
.area .txt { flex: 1; min-width: 0; position: relative; z-index: 1; }
.area h3 { color: var(--cone); }
.area .level { font: 700 1.9rem/1.05 var(--font); margin: 2px 0 6px; }
.area .where { font-size: .98rem; }
.area .when { color: var(--muted); font-size: .82rem; display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.area .when i { width: 7px; height: 7px; border-radius: 50%; background: var(--live); display: inline-block; }
.area .ring { position: relative; flex: none; width: 104px; height: 104px; border-radius: 50%; display: grid; place-items: center; }
.area .ring::before, .area .ring::after { content: ''; position: absolute; border-radius: 50%; border: 1.5px solid currentColor; opacity: .25; }
.area .ring::before { inset: 0; } .area .ring::after { inset: 14px; opacity: .45; }
.area .ring svg { width: 46px; height: 46px; filter: drop-shadow(0 0 12px currentColor); }
.area[data-level="clear"] { --lc: var(--live); }
.area[data-level="caution"] { --lc: var(--sodium); }
.area[data-level="alert"], .area[data-level="emergency"] { --lc: var(--siren); }
.area .level, .area .ring { color: var(--lc); }
.area .ring { background: radial-gradient(circle, color-mix(in srgb, var(--lc) 18%, transparent), transparent 70%); }
.area[data-level="emergency"] { border-color: rgba(229, 56, 59, .55); }

/* the four tiles */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.tile {
  position: relative; display: grid; grid-template-rows: auto 1fr; gap: 10px; min-height: 124px; padding: 14px; border-radius: var(--radius);
  background: linear-gradient(180deg, #17171A, #131316); border: 1px solid #26262C; color: var(--reflector); text-align: left; cursor: pointer;
}
.tile svg.ic { width: 30px; height: 30px; }
.tile .t { font: 700 .86rem/1.2 var(--font); letter-spacing: .05em; text-transform: uppercase; }
.tile .s { color: var(--muted); font-size: .84rem; line-height: 1.3; margin-top: 4px; padding-right: 18px; }
.tile .chev { position: absolute; right: 12px; bottom: 14px; width: 18px; height: 18px; color: var(--reflector); }
.tile .badge { left: auto; right: 12px; top: 12px; }
.tile.red svg.ic, .tile.red .t { color: #FF5A4E; }
.tile.gold svg.ic, .tile.gold .t { color: var(--cone); }
.tile.blue svg.ic { color: #6FA8FF; } .tile.blue .t { color: #8EBBFF; }

.community { display: flex; align-items: center; gap: 12px; }
.community .ic { width: 40px; height: 40px; flex: none; color: #B18CFF; }
.community .big { font: 700 1.45rem/1 var(--font); }
.community .k { color: #B18CFF; font: 700 .8rem/1 var(--font); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 4px; }
.avatars { display: flex; align-items: center; margin-left: auto; }
.avatars span { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 700 .7rem/1 var(--font); color: #111; margin-left: -8px; box-shadow: 0 0 0 2px #151518; }
.avatars .more { background: #2A2A30; color: var(--reflector); }

.acts { list-style: none; margin: 0; padding: 0; }
.acts li { display: flex; gap: 10px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid #222228; font-size: .93rem; }
.acts li:last-child { border-bottom: 0; }
.acts .dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--live); transform: translateY(-1px); }
.acts .dot.incident { background: var(--sodium); } .acts .dot.sos { background: var(--siren); } .acts .dot.member, .acts .dot.notice { background: var(--sky); }
.acts .x { flex: 1; min-width: 0; }
.acts time { color: var(--muted); font-size: .8rem; white-space: nowrap; }

/* payments banner on home */
.paycard { border-color: rgba(226, 179, 85, .45); background: linear-gradient(180deg, #221B0E, #15120C); }
.paycard.locked { border-color: rgba(229, 56, 59, .5); background: linear-gradient(180deg, #2A1010, #170B0B); }
.paycard .row { display: flex; align-items: center; gap: 12px; }
.paycard .row .x { flex: 1; }
.paycard b { display: block; font-size: 1rem; }
.paycard small { color: #D8D4CB; }

/* lists of alerts */
.alert-row { display: flex; gap: 12px; align-items: center; padding: 12px; margin-bottom: 10px; border-radius: 14px; background: #151518; border: 1px solid #26262C; cursor: pointer; }
.alert-row .sev { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--sc) 16%, transparent); color: var(--sc); }
.alert-row .sev svg { width: 26px; height: 26px; }
.alert-row .x { flex: 1; min-width: 0; }
.alert-row .t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alert-row .s { color: var(--muted); font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alert-row.past { opacity: .62; }
[data-sev="low"] { --sc: #6FA8FF; } [data-sev="medium"] { --sc: #F0A030; } [data-sev="high"] { --sc: #FF4D4F; } [data-sev="critical"] { --sc: #FF2D55; } [data-sev="sos"] { --sc: #FF2D55; }
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 8px; padding: 3px 8px; font: 700 .72rem/1.2 var(--font); letter-spacing: .02em; }
.pill.live { background: #E5383B; color: #fff; }
.pill.live::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.pill.sev { background: color-mix(in srgb, var(--sc) 18%, transparent); color: var(--sc); }
.pill.done { background: #1F2E24; color: var(--live); }
.pill.tag { background: #1E1E23; color: #D8D4CB; font-weight: 600; }
.seg.wide { display: flex; width: 100%; margin: 4px 0 14px; }
.seg.wide button { flex: 1; padding: 9px 6px; }

/* alert details */
.alert-hero { border-color: rgba(229, 56, 59, .45); background: linear-gradient(180deg, #2A1213, #1A0E0F); }
.alert-hero.resolved { border-color: #26262C; background: linear-gradient(180deg, #17171A, #131316); }
.alert-hero .top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.alert-hero .top .ago { margin-left: auto; color: var(--muted); font-size: .82rem; }
.alert-hero .row { display: flex; gap: 12px; }
.alert-hero h2 { margin: 0 0 4px; font: 700 1.35rem/1.2 var(--font); }
.alert-hero .place { display: flex; align-items: center; gap: 6px; color: #D8D4CB; font-size: .92rem; margin-bottom: 10px; }
.alert-hero .place svg { width: 16px; height: 16px; color: var(--cone); flex: none; }
.alert-hero p { margin: 0; line-height: 1.45; }
.alert-hero .big-ic { flex: none; width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; color: var(--sc); background: color-mix(in srgb, var(--sc) 14%, transparent); }
.alert-hero .big-ic svg { width: 32px; height: 32px; }
.alert-map { position: relative; height: 190px; border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; border: 1px solid #26262C; background: #111; }
.alert-map .mini { position: absolute; inset: 0; }
.alert-map .near { position: absolute; z-index: 500; right: 10px; top: 10px; background: rgba(15, 15, 18, .92); border-radius: 14px; padding: 5px 10px; font: 600 .8rem/1.2 var(--font); }
.alert-map .near b { color: var(--live); }
.meta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: .9rem; color: #D8D4CB; }
.meta-row svg { width: 16px; height: 16px; color: var(--muted); vertical-align: -3px; margin-right: 4px; }
.updates { list-style: none; margin: 0; padding: 0; }
.updates li { display: grid; grid-template-columns: 46px 1fr; gap: 10px; padding: 8px 0; font-size: .92rem; border-bottom: 1px solid #222228; }
.updates li:last-child { border-bottom: 0; }
.updates time { color: var(--muted); font-variant-numeric: tabular-nums; }
.updates .who { color: var(--muted); font-size: .8rem; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.photos button { border: 0; padding: 0; border-radius: 10px; overflow: hidden; aspect-ratio: 1; background: #1E1E23; }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.btn.outline-gold { background: transparent; color: var(--cone); box-shadow: inset 0 0 0 1.5px var(--cone); }
.btn.big { min-height: 56px; font-size: 1.02rem; letter-spacing: .05em; text-transform: uppercase; }

/* report wizard */
.steps-bar { display: flex; justify-content: space-between; position: relative; margin: 6px 4px 14px; }
.steps-bar::before { content: ''; position: absolute; left: 22px; right: 22px; top: 17px; height: 1.5px; background: #2C2C33; }
.steps-bar .st { position: relative; z-index: 1; display: grid; justify-items: center; gap: 6px; font: 600 .68rem/1 var(--font); letter-spacing: .06em; color: var(--muted); width: 64px; }
.steps-bar .st i { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font: 700 .95rem/1 var(--font); background: #1E1E23; color: var(--reflector); box-shadow: 0 0 0 1px #34343C; }
.steps-bar .st.on { color: var(--cone); }
.steps-bar .st.on i { background: var(--gold-grad); color: var(--cone-ink); box-shadow: 0 0 0 4px rgba(226, 179, 85, .2); }
.steps-bar .st.done i { background: #3A2E14; color: var(--cone); box-shadow: 0 0 0 1px var(--cone-3); }
.live-note { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: #0F1D14; border: 1px solid #1B3A26; color: #CDEBD8; font-size: .92rem; margin-bottom: 14px; }
.live-note i { width: 9px; height: 9px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 4px rgba(47, 203, 113, .18); }
.wlabel { font: 600 .95rem/1.2 var(--font); margin: 14px 0 8px; }
.types { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.type { display: grid; justify-items: center; align-content: center; gap: 8px; min-height: 96px; padding: 8px 4px; border-radius: 12px; border: 1px solid #2C2C33; background: #151518; color: #CFCBD2; font: 500 .8rem/1.2 var(--font); text-align: center; }
.type svg { width: 30px; height: 30px; color: #BDB9C1; }
.type.on { border-color: var(--cone); box-shadow: inset 0 0 0 1px var(--cone); color: var(--reflector); }
.type.on svg { color: var(--cone); }
.wbox { position: relative; }
.wbox textarea, .wbox input[type=text], .wbox input[type=datetime-local], .wbox input[type=tel], .wbox input[type=number], .wbox select {
  width: 100%; border-radius: 12px; border: 1px solid #2C2C33; background: #151518; color: var(--reflector); padding: 14px; font: 400 1rem/1.4 var(--font);
}
.wbox textarea { min-height: 96px; resize: vertical; }
.wbox .count { position: absolute; right: 12px; bottom: 10px; color: var(--muted); font-size: .78rem; }
.wbox svg.in { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; color: var(--cone); pointer-events: none; }
.sevs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sevs button { min-height: 46px; border-radius: 10px; border: 1px solid #2C2C33; background: #151518; color: var(--sc); font: 600 .9rem/1 var(--font); }
.sevs button[data-sev="low"] { color: #8FD8A8; --sc: #2FCB71; }
.sevs button.on { border-color: var(--sc); background: color-mix(in srgb, var(--sc) 16%, #151518); color: #fff; }
.secure-note { display: flex; justify-content: center; align-items: center; gap: 8px; color: var(--muted); font-size: .84rem; margin: 14px 0 4px; }
.secure-note svg { width: 14px; height: 14px; }
.tagpick { display: flex; flex-wrap: wrap; gap: 6px; }
.tagpick button { border: 1px solid #2C2C33; background: #151518; color: #D8D4CB; border-radius: 16px; padding: 7px 11px; font: 500 .84rem/1 var(--font); }
.tagpick button.on { border-color: var(--cone); color: var(--cone); }
.pickmap { height: 260px; border-radius: 14px; overflow: hidden; position: relative; border: 1px solid #2C2C33; }
.pickmap .pin { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -100%); z-index: 500; pointer-events: none; }
.thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.thumbs .th { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #1E1E23; }
.thumbs .th img { width: 100%; height: 100%; object-fit: cover; }
.thumbs .th button { position: absolute; right: 4px; top: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .7); color: #fff; }
.thumbs label.add { aspect-ratio: 1; border-radius: 10px; border: 1.5px dashed #3A3A42; display: grid; place-items: center; align-content: center; gap: 6px; color: var(--muted); font-size: .78rem; cursor: pointer; }
.thumbs label.add svg { width: 26px; height: 26px; color: var(--cone); }
.thumbs label.add input { display: none; }
.review dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0; font-size: .95rem; }
.review dt { color: var(--muted); }
.review dd { margin: 0; }
.wnav { display: grid; grid-template-columns: auto 1fr; gap: 10px; margin-top: 18px; }

/* messages */
.chan { display: flex; gap: 8px; margin: 0 0 10px; }
.chan button { flex: 1; min-height: 40px; border-radius: 20px; border: 1px solid #2C2C33; background: #151518; color: var(--muted); font: 600 .9rem/1 var(--font); position: relative; }
.chan button.on { border-color: var(--cone); color: var(--cone); }
.chan .badge { top: -6px; left: auto; right: 10px; }

/* profile */
.me-head { display: flex; align-items: center; gap: 14px; }
.avatar { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; font: 700 1.2rem/1 var(--font); color: #111; flex: none; }
.me-head h2 { margin: 0; font: 700 1.25rem/1.2 var(--font); }
.me-head .sub { color: var(--muted); font-size: .9rem; }
.rows { list-style: none; padding: 0; margin: 0; }
.rows li, .rows a.row, .rows button.row, .rows label.row { display: flex; align-items: center; gap: 12px; padding: 13px 2px; border-bottom: 1px solid #222228; width: 100%; background: transparent; border-left: 0; border-right: 0; border-top: 0; color: var(--reflector); text-decoration: none; text-align: left; font: inherit; cursor: pointer; }
.rows li:last-child, .rows > :last-child { border-bottom: 0; }
.rows svg.ic { width: 22px; height: 22px; color: var(--cone); flex: none; }
.rows .x { flex: 1; min-width: 0; }
.rows .x small { display: block; color: var(--muted); font-size: .84rem; }
.rows svg.chev { width: 16px; height: 16px; color: var(--muted); }
.status-pill { border-radius: 8px; padding: 4px 9px; font: 700 .75rem/1 var(--font); }
.status-pill.paid, .status-pill.exempt { background: #12301F; color: #6EE7A2; }
.status-pill.due { background: #3A2A0C; color: #F5C46A; }
.status-pill.locked, .status-pill.overdue { background: #3A1213; color: #FF8A8C; }
.status-pill.off { background: #1E1E23; color: var(--muted); }
.bank { display: grid; grid-template-columns: auto 1fr auto; gap: 8px 12px; align-items: center; font-size: .95rem; }
.bank dt { color: var(--muted); }
.bank dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.copy { border: 0; background: #1E1E23; color: var(--cone); border-radius: 8px; padding: 6px 9px; font: 600 .78rem/1 var(--font); }
.ref-big { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px; border-radius: 12px; background: #221B0E; border: 1px dashed var(--cone-3); margin: 10px 0; }
.ref-big b { font: 700 1.6rem/1 var(--font); letter-spacing: .08em; color: var(--cone-2); }

/* emergency */
.em-sos { display: grid; justify-items: center; gap: 12px; padding: 18px 0 10px; text-align: center; }
.em-sos .sos-btn { width: 150px; height: 150px; font-size: 2.2rem; }
.em-sos p { margin: 0; color: var(--muted); font-size: .92rem; max-width: 30ch; }
.calls a { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; background: #151518; border: 1px solid #26262C; color: var(--reflector); text-decoration: none; margin-bottom: 10px; }
.calls a svg { width: 22px; height: 22px; color: var(--live); flex: none; }
.calls a .x { flex: 1; }
.calls a b { display: block; }
.calls a small { color: var(--muted); }

/* tips */
.tip { display: flex; gap: 12px; }
.tip .n { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #221B0E; color: var(--cone); font: 700 .9rem/1 var(--font); }
.tip h4 { margin: 2px 0 4px; font-size: 1rem; }
.tip p { margin: 0; color: #D0CCC4; font-size: .93rem; line-height: 1.45; }

/* drawer menu */
.drawer { position: fixed; inset: 0; z-index: 900; background: rgba(0, 0, 0, .55); }
.drawer-card { position: absolute; left: 0; top: 0; bottom: 0; width: min(84vw, 320px); background: #111114; border-right: 1px solid #26262C; padding: calc(var(--safe-t) + 18px) 16px 20px; overflow-y: auto; }
.drawer-card .dh { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.drawer-card .dh img { width: 42px; }
.drawer-card .dh b { font: 600 1rem/1.2 var(--font-brand); letter-spacing: .06em; color: var(--cone); }

/* admin */
.atabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px 12px; padding: 0 16px; scrollbar-width: none; }
.atabs button { flex: none; border: 1px solid #2C2C33; background: #151518; color: var(--muted); border-radius: 18px; padding: 9px 14px; font: 600 .86rem/1 var(--font); position: relative; }
.atabs button.on { border-color: var(--cone); color: var(--cone); }
.atabs .badge { top: -6px; left: auto; right: -4px; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.kpi { background: #151518; border: 1px solid #26262C; border-radius: 12px; padding: 10px; }
.kpi .v { font: 700 1.4rem/1 var(--font); }
.kpi .k { color: var(--muted); font-size: .76rem; margin-top: 4px; }
.kpi.g .v { color: var(--live); } .kpi.a .v { color: var(--sodium); } .kpi.r .v { color: #FF6B6E; }
.search { width: 100%; min-height: 44px; border-radius: 12px; border: 1px solid #2C2C33; background: #151518; color: var(--reflector); padding: 10px 14px; font: 400 1rem/1 var(--font); margin-bottom: 10px; }
.stmt { width: 100%; border-collapse: collapse; font-size: .86rem; }
.stmt td { padding: 8px 4px; border-bottom: 1px solid #222228; vertical-align: top; }
.stmt td.amt { text-align: right; white-space: nowrap; font-weight: 600; }
.stmt select { max-width: 150px; background: #151518; color: var(--reflector); border: 1px solid #2C2C33; border-radius: 8px; padding: 4px; }
.copyline { display: flex; gap: 8px; align-items: center; background: #151518; border: 1px solid #26262C; border-radius: 12px; padding: 10px 12px; word-break: break-all; font-size: .88rem; }
.copyline span { flex: 1; }

/* welcome and gates */
.gate { position: fixed; inset: 0; z-index: 50; display: block; padding: 0; background: radial-gradient(120% 70% at 50% 100%, #2A1D08 0%, #0A0A0B 55%) #0A0A0B; overflow-y: auto; }
.gate-glow { position: fixed; left: 0; right: 0; bottom: 0; height: 52vh; pointer-events: none; opacity: .9;
  background: url(/skyline.svg) center bottom / auto 100% no-repeat; mask-image: linear-gradient(to top, #000 55%, transparent); -webkit-mask-image: linear-gradient(to top, #000 55%, transparent); }
.gate-body { position: relative; z-index: 1; min-height: 100%; max-width: 30rem; margin: 0 auto; padding: calc(var(--safe-t) + 36px) 24px calc(var(--safe-b) + 28px); display: flex; flex-direction: column; }
.gate-body.center { align-items: center; text-align: center; }
.gate-logo { width: 120px; height: auto; display: block; filter: drop-shadow(0 8px 30px rgba(226, 179, 85, .35)); }
.gate-loading { color: var(--muted); }
.wel-name { font: 600 2.2rem/1.05 var(--font-brand); letter-spacing: .08em; background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; margin: 22px 0 6px; }
.wel-sub { font: 500 .78rem/1 var(--font); letter-spacing: .34em; color: var(--reflector); }
.wel-tag, .gate .wel-tag { font: 500 1.4rem/1.35 var(--font); margin: 44px 0 0; color: var(--reflector); max-width: none; }
.wel-tag span { color: var(--cone); }
.gate-actions { margin-top: auto; display: grid; gap: 14px; padding-top: 30px; }
.gate-actions .btn { min-height: 56px; }
.gate-alt { text-align: center; color: #D8D4CB; font-size: .95rem; }
.gate-alt button { border: 0; background: transparent; color: var(--cone); font: 700 .95rem/1 var(--font); letter-spacing: .05em; text-transform: uppercase; padding: 6px 4px; }
.gate h1 { font: 700 1.6rem/1.15 var(--font); margin: 18px 0 8px; }
.gate p { color: #CFCBD2; margin: 0 0 16px; }
.gate .field input, .gate .field textarea { background: #151518; border-color: #2C2C33; }
.gate .formcard { background: rgba(21, 21, 24, .92); border: 1px solid #26262C; border-radius: 18px; padding: 18px; text-align: left; width: 100%; }
.gate .formcard .field { margin: 10px 0; }
.gate .back { align-self: flex-start; border: 0; background: transparent; color: var(--reflector); display: flex; align-items: center; gap: 6px; padding: 6px 0; font: 600 .95rem/1 var(--font); margin-bottom: 8px; }
.gate .back svg { width: 20px; height: 20px; }
.gate .note { color: var(--muted); font-size: .86rem; }
.gate .btn.ghost, .gate .btn.ghost-light { background: rgba(14, 14, 16, .94); }
.gate .btn.danger-ghost, .gate .btn.sos-ghost { background: rgba(30, 10, 11, .94); }
input[type=date], input[type=datetime-local], input[type=time] { color-scheme: dark; }
.field input[type=tel], .field input[type=email], .field input[type=password] {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--asphalt); font-size: 16px;
}
.waiting-spin { width: 46px; height: 46px; border-radius: 50%; border: 3px solid #2C2C33; border-top-color: var(--cone); animation: spin 1s linear infinite; margin: 10px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.locked-ic { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; background: #2A1213; color: #FF8A8C; margin: 0 auto 6px; }
.locked-ic svg { width: 36px; height: 36px; }

@media (min-width: 900px) {
  .bottomnav { left: 50%; right: auto; width: 560px; transform: translateX(-50%); border: 1px solid #222228; border-bottom: 0; border-radius: 18px 18px 0 0; }
}
/* the small maps on alert details and in the report (always OpenStreetMap, darkened) */
.night-tiles .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.85) saturate(.35); }
.night-tiles.leaflet-container { background: #0B0B0D; }
.map-chips button.active { box-shadow: inset 0 0 0 1.5px var(--cone); }
.steps { margin: 0 0 6px; padding-left: 1.2rem; color: #D8D4CB; }
.steps li { margin: 6px 0; }
.pc-note { color: var(--muted); font-size: .9rem; margin: 6px 0 0; }
.patrol-card[hidden] { display: none; }
