:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  --blue: #087bff;
  --blue-dark: #0066df;
  --ink: #10202b;
  --muted: #60717c;
  --glass: rgba(248, 252, 255, .72);
  --glass-strong: rgba(250, 253, 255, .88);
  --line: rgba(255, 255, 255, .78);
  --shadow: 0 18px 50px rgba(29, 58, 73, .19), 0 2px 8px rgba(29, 58, 73, .09);
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { background: #dcebf1; color: var(--ink); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.app-shell { position: relative; width: 100%; height: 100%; min-height: 100dvh; overflow: hidden; }
#map { position: absolute; inset: 0; z-index: 0; background: linear-gradient(145deg, #d7e8ed, #edf2e9); }
.leaflet-container { font: inherit; }
.leaflet-control-zoom { display: none; }
.leaflet-control-attribution { margin: 0 8px 8px 0 !important; padding: 2px 7px !important; border-radius: 8px; background: rgba(255,255,255,.7) !important; font-size: 9px; backdrop-filter: blur(10px); }

.glass { border: 1px solid var(--line); background: var(--glass); box-shadow: var(--shadow); -webkit-backdrop-filter: blur(24px) saturate(165%); backdrop-filter: blur(24px) saturate(165%); }
.top-bar { position: absolute; z-index: 500; top: max(14px, env(safe-area-inset-top)); left: 14px; right: 14px; height: 62px; border-radius: 22px; display: flex; align-items: center; justify-content: space-between; padding: 9px 10px 9px 12px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 13px; color: white; background: linear-gradient(145deg, #2397ff, #006bf0); box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 8px 18px rgba(0,110,240,.28); }
.brand-mark svg { width: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 16px; letter-spacing: -.2px; }
.brand span { color: var(--muted); font-size: 11px; margin-top: 1px; }
.icon-button { width: 42px; height: 42px; border: 0; border-radius: 14px; display: grid; place-items: center; color: var(--ink); background: rgba(255,255,255,.6); cursor: pointer; }
.icon-button svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.header-actions { display: flex; gap: 6px; }

.search-bar { position: absolute; z-index: 510; top: calc(max(14px, env(safe-area-inset-top)) + 72px); left: 14px; right: 14px; min-height: 52px; display: flex; align-items: center; gap: 9px; border-radius: 18px; padding: 6px 7px 6px 14px; }
.search-bar > svg { flex: 0 0 auto; width: 20px; fill: none; stroke: #73838c; stroke-width: 2; stroke-linecap: round; }
.search-bar input { min-width: 0; flex: 1; height: 38px; border: 0; outline: 0; padding: 0; background: transparent; color: var(--ink); font-size: 16px; }
.search-bar input::placeholder { color: #75858e; }
#clearSearch { border: 0; border-radius: 50%; width: 24px; height: 24px; padding: 0; color: white; background: #9aa8af; line-height: 20px; }
.search-submit { height: 38px; border: 0; border-radius: 12px; padding: 0 13px; color: white; background: var(--blue); font-size: 13px; font-weight: 700; cursor: pointer; }
.search-results { position: absolute; top: calc(100% + 8px); left: 0; right: 0; overflow: hidden; border: 1px solid rgba(255,255,255,.85); border-radius: 18px; background: rgba(249,252,254,.94); box-shadow: var(--shadow); backdrop-filter: blur(24px); }
.search-result { width: 100%; display: flex; gap: 10px; align-items: flex-start; border: 0; border-bottom: 1px solid rgba(20,50,65,.08); padding: 12px 14px; text-align: left; color: var(--ink); background: transparent; cursor: pointer; }
.search-result:last-child { border-bottom: 0; }
.search-result strong { display: block; font-size: 14px; }
.search-result span { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; line-height: 1.3; }

.map-control { position: absolute; z-index: 490; right: 16px; bottom: calc(338px + env(safe-area-inset-bottom)); width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; border: 1px solid var(--line); color: var(--blue); cursor: pointer; }
.map-control svg { width: 23px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.shift-pin { width: 48px; height: 48px; position: relative; filter: drop-shadow(0 7px 7px rgba(20,54,70,.24)); transform: translateY(-4px); }
.shift-pin::before { content: ""; position: absolute; inset: 1px 1px 10px; border: 3px solid white; border-radius: 50% 50% 50% 8px; background: var(--blue); transform: rotate(-45deg); }
.shift-pin::after { content: ""; position: absolute; width: 11px; height: 11px; top: 13px; left: 18px; border-radius: 50%; background: white; }

.bottom-sheet { position: absolute; z-index: 520; left: 10px; right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); border-radius: 28px; padding: 8px 18px 16px; }
.sheet-handle { width: 38px; height: 5px; margin: 0 auto 13px; border-radius: 9px; background: rgba(44,67,78,.2); }
.sheet-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.eyebrow { display: block; color: #71828b; font-size: 10px; font-weight: 800; letter-spacing: .09em; }
h1, h2, p { margin: 0; }
h1 { margin-top: 3px; font-size: 20px; line-height: 1.15; letter-spacing: -.5px; }
h2 { margin-top: 3px; font-size: 25px; letter-spacing: -.6px; }
.status-badge { flex: 0 0 auto; border-radius: 999px; padding: 6px 9px; color: #217240; background: rgba(53,199,103,.13); font-size: 11px; font-weight: 700; }
.status-badge.off { color: #6f7b82; background: rgba(80,98,108,.1); }
.status-badge.busy { color: #8a5c00; background: rgba(255,177,23,.15); }
.coordinates { display: flex; align-items: center; margin: 15px 0 9px; padding: 10px 13px; border: 1px solid rgba(20,50,65,.08); border-radius: 17px; background: rgba(255,255,255,.48); }
.coordinates label { flex: 1; min-width: 0; }
.coordinates label span { display: block; margin-bottom: 3px; color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.coordinates input { width: 100%; border: 0; outline: 0; padding: 0; background: transparent; color: var(--ink); font-size: 15px; font-variant-numeric: tabular-nums; }
.coordinate-divider { width: 1px; height: 31px; margin: 0 13px; background: rgba(20,50,65,.1); }
.status-copy { min-height: 17px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.primary-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; margin-top: 12px; }
.button { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 0; border-radius: 16px; padding: 0 17px; text-decoration: none; font-weight: 750; cursor: pointer; transition: transform .15s ease, opacity .15s ease; }
.button:active { transform: scale(.98); }
.button:disabled { opacity: .55; cursor: wait; }
.button svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.button.primary { color: white; background: linear-gradient(180deg, #168bff, #0674ee); box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 9px 20px rgba(0,105,230,.24); }
.button.secondary { color: #33464f; background: rgba(255,255,255,.62); box-shadow: inset 0 0 0 1px rgba(20,50,65,.08); }
.button.full { width: 100%; }
.advanced { margin-top: 9px; }
.advanced summary { padding: 4px 2px; color: var(--muted); font-size: 11px; text-align: center; cursor: pointer; list-style: none; }
.advanced summary::-webkit-details-marker { display: none; }
.advanced[open] summary { margin-bottom: 8px; }
.advanced pre { max-height: 78px; overflow: auto; margin: 8px 0 0; border-radius: 12px; padding: 10px; color: #d9e5ea; background: rgba(13,29,36,.88); font: 10px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; }

.setup-dialog { width: min(420px, calc(100% - 24px)); max-height: calc(100dvh - 32px); border: 1px solid white; border-radius: 30px; padding: 0; color: var(--ink); background: var(--glass-strong); }
.setup-dialog::backdrop { background: rgba(19,39,49,.26); backdrop-filter: blur(7px); }
.dialog-content { padding: 20px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; }
.setup-steps { display: grid; gap: 15px; margin: 22px 0; padding: 0; list-style: none; }
.setup-steps li { display: flex; align-items: flex-start; gap: 12px; }
.setup-steps li > span { flex: 0 0 30px; height: 30px; display: grid; place-items: center; border-radius: 10px; color: white; background: var(--blue); font-size: 13px; font-weight: 800; }
.setup-steps strong { display: block; font-size: 14px; }
.setup-steps p, .safety-note { margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.safety-note { margin: 12px 8px 0; text-align: center; }
.login-dialog { text-align: center; }
.login-dialog::backdrop { background: rgba(13,35,47,.42); backdrop-filter: blur(14px); }
.login-mark { margin: 0 auto 18px; width: 56px; height: 56px; border-radius: 18px; }
.login-mark svg { width: 30px; }
.login-copy { margin: 8px auto 20px; max-width: 280px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.login-field { display: block; margin-bottom: 12px; text-align: left; }
.login-field span { display: block; margin: 0 0 6px 4px; color: var(--muted); font-size: 11px; font-weight: 700; }
.login-field input { width: 100%; height: 50px; border: 1px solid rgba(20,50,65,.12); border-radius: 15px; outline: 0; padding: 0 14px; color: var(--ink); background: rgba(255,255,255,.65); font-size: 17px; }
.login-field input:focus { border-color: rgba(8,123,255,.55); box-shadow: 0 0 0 3px rgba(8,123,255,.12); }
.login-error { margin: 0 0 10px; color: #c63b38; font-size: 12px; }
.toast { position: fixed; z-index: 1000; left: 50%; top: calc(max(14px, env(safe-area-inset-top)) + 138px); width: max-content; max-width: calc(100% - 32px); transform: translateX(-50%); border-radius: 999px; padding: 10px 15px; color: var(--ink); font-size: 12px; font-weight: 650; }

@media (min-width: 720px) {
  .top-bar, .search-bar { left: 24px; right: auto; width: 390px; }
  .bottom-sheet { left: auto; right: 24px; bottom: 24px; width: 400px; padding: 10px 20px 18px; }
  .map-control { right: 440px; bottom: 28px; }
}
@media (max-height: 690px) {
  .bottom-sheet { padding-bottom: 10px; }
  .coordinates { margin-top: 10px; }
  .advanced { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
