:root {
  --bg: #eef2f5;
  --surface: rgba(255, 255, 255, 0.94);
  --text: #17212b;
  --muted: #70808f;
  --line: #dce4ea;
  --telegram: #2aabee;
  --telegram-dark: #168acd;
  --green: #36b37e;
  --amber: #f4a72c;
  --gray: #aab5be;
  --shadow: 0 12px 36px rgba(23, 33, 43, 0.12);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overscroll-behavior: none;
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app-shell { width: min(100%, 820px); margin: 0 auto; padding: 14px 14px 28px; }

.topbar { display: flex; align-items: center; justify-content: space-between; padding: 4px 2px 12px; }
.topbar h1 { margin: 1px 0 0; font-size: 24px; letter-spacing: -0.5px; }
.eyebrow { margin: 0; color: var(--telegram-dark); font-size: 11px; font-weight: 800; letter-spacing: 1.2px; }
.icon-button { border: 0; width: 38px; height: 38px; border-radius: 50%; color: var(--muted); background: #fff; cursor: pointer; box-shadow: 0 4px 14px rgba(23, 33, 43, .08); }

.floor-switcher { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; padding: 4px; background: #dfe7ec; border-radius: 16px; }
.floor-button { display: flex; justify-content: center; align-items: baseline; gap: 8px; padding: 10px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); cursor: pointer; }
.floor-button span { font-size: 18px; font-weight: 800; }
.floor-button small { font-size: 11px; }
.floor-button.active { color: var(--text); background: #fff; box-shadow: 0 3px 12px rgba(23, 33, 43, .09); }
.floor-button[hidden] { display: none; }
.floor-switcher:has(.floor-button[hidden]) { grid-template-columns: 1fr; }

.search-panel { padding: 12px; margin-bottom: 10px; border-radius: 18px; background: var(--surface); box-shadow: 0 5px 18px rgba(23, 33, 43, .06); }
.search-box { height: 44px; display: grid; grid-template-columns: 24px 1fr 28px; align-items: center; padding: 0 10px; border: 1px solid var(--line); border-radius: 13px; background: #f6f8fa; color: var(--muted); }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); }
.search-box button { border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.filter-row { display: flex; gap: 7px; margin-top: 10px; overflow-x: auto; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.filter-chip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 99px; background: #fff; color: var(--muted); padding: 7px 11px; font-size: 12px; cursor: pointer; }
.filter-chip.active { border-color: #a9dcf7; background: #eaf7fe; color: #147db6; font-weight: 700; }

.map-card { position: relative; height: min(61vh, 610px); min-height: 430px; overflow: hidden; border-radius: 22px; background: #dfe5e8; box-shadow: var(--shadow); }
.map-viewport { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: grab; }
.map-viewport.dragging { cursor: grabbing; }
.map-stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; user-select: none; }
.floor-plan { position: absolute; inset: 0; background: #e9eef1; }
.floor-plan svg { display: block; width: 100%; height: 100%; }
.floor-shell { fill: #f7f9fa; stroke: #71808c; stroke-width: 8; }
.floor-wall { fill: none; stroke: #83919c; stroke-width: 6; stroke-linecap: square; stroke-linejoin: miter; }
.parking-space { cursor: pointer; transition: opacity .18s, filter .18s; }
.parking-space .stall { stroke-width: 2.5; transition: fill .18s, stroke .18s; }
.parking-space.available .stall { fill: #9aefc9; stroke: #159b67; filter: drop-shadow(0 2px 3px rgba(21, 155, 103, .32)); }
.parking-space.available .stall-label { fill: #075f40; }
.parking-space.unavailable .stall { fill: #cfd6db; stroke: #98a4ad; }
.parking-space.unavailable .stall-label { fill: #6f7a83; }
.parking-space.hidden { opacity: .08; pointer-events: none; }
.parking-space.selected .stall { fill: #5bd4ff; stroke: #087fb7; stroke-width: 5; }
.stall-label { font-size: 11px; font-weight: 800; text-anchor: middle; dominant-baseline: middle; pointer-events: none; }
.gate-line { stroke: #2aabee; stroke-width: 9; stroke-linecap: round; stroke-dasharray: 9 7; }
.gate-label { fill: #168acd; font-size: 15px; font-weight: 800; text-anchor: middle; }
.gate-direction { fill: #168acd; font-size: 11px; font-weight: 900; text-anchor: middle; }
.marker-layer { position: absolute; inset: 0; }

.zone-marker { position: absolute; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 5px; padding: 6px 8px; border: 2px solid #fff; border-radius: 10px; background: #51697e; color: #fff; box-shadow: 0 4px 12px rgba(23,33,43,.2); font-size: 10px; font-weight: 700; white-space: nowrap; }
.zone-marker b { color: #9de0ff; }

.map-badge { position: absolute; left: 12px; top: 12px; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: rgba(255,255,255,.94); box-shadow: 0 5px 18px rgba(23,33,43,.13); }
.map-badge span { display: grid; place-items: center; min-width: 31px; height: 31px; border-radius: 9px; background: var(--telegram); color: white; font-weight: 800; }
.map-badge small { color: var(--muted); }
.zoom-controls { position: absolute; right: 12px; top: 12px; display: grid; overflow: hidden; border-radius: 13px; background: rgba(255,255,255,.94); box-shadow: 0 5px 18px rgba(23,33,43,.13); }
.zoom-controls button { width: 39px; height: 39px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); font-size: 20px; cursor: pointer; }
.zoom-controls button:last-child { border-bottom: 0; color: var(--telegram-dark); }
.map-hint { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); padding: 7px 11px; border-radius: 99px; background: rgba(23,33,43,.72); color: #fff; font-size: 11px; white-space: nowrap; transition: opacity .3s; }
.map-hint.hide { opacity: 0; }
.map-notice { position: absolute; left: 50%; bottom: 46px; z-index: 8; width: max-content; max-width: calc(100% - 32px); transform: translate(-50%, 12px); padding: 10px 14px; border: 1px solid rgba(255,255,255,.75); border-radius: 13px; background: rgba(23,33,43,.92); color: #fff; box-shadow: 0 8px 24px rgba(23,33,43,.24); font-size: 12px; font-weight: 700; text-align: center; opacity: 0; pointer-events: none; transition: .22s; }
.map-notice.show { opacity: 1; transform: translate(-50%, 0); }

.legend-card { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin-top: 10px; padding: 13px 14px; border-radius: 17px; background: var(--surface); color: var(--muted); font-size: 12px; }
.legend-card div { display: flex; align-items: center; gap: 7px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.dot.green { background: var(--green); }.dot.amber { background: var(--amber); }.dot.gray { background: var(--gray); }
.zone-symbol { color: #51697e; font-size: 15px; }

.bottom-sheet { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
.bottom-sheet.open { pointer-events: auto; }
.sheet-scrim { position: absolute; inset: 0; width: 100%; border: 0; background: rgba(23,33,43,.32); opacity: 0; transition: opacity .25s; }
.bottom-sheet.open .sheet-scrim { opacity: 1; }
.sheet-card { position: absolute; left: 50%; bottom: 0; width: min(100%, 620px); padding: 9px 18px max(20px, env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; background: #fff; box-shadow: 0 -12px 42px rgba(23,33,43,.16); transform: translate(-50%, 105%); transition: transform .3s cubic-bezier(.2,.8,.2,1); }
.bottom-sheet.open .sheet-card { transform: translate(-50%, 0); }
.sheet-handle { width: 38px; height: 4px; margin: 0 auto 14px; border-radius: 4px; background: #d5dce1; }
.sheet-heading { display: flex; justify-content: space-between; align-items: flex-start; }
.sheet-heading h2 { margin: 4px 0 0; font-size: 23px; }
.status-pill { display: inline-block; margin: 14px 0; padding: 7px 10px; border-radius: 99px; font-size: 12px; font-weight: 800; }
.status-pill.available { color: #16875f; background: #e1f7ef; }.status-pill.unavailable { color: #6e7982; background: #edf0f2; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 18px; }
.detail-grid div { padding: 11px; border-radius: 12px; background: #f5f7f9; }
.detail-grid dt { color: var(--muted); font-size: 10px; margin-bottom: 4px; }.detail-grid dd { margin: 0; font-size: 13px; font-weight: 700; }
.primary-button { width: 100%; min-height: 50px; border: 0; border-radius: 14px; background: var(--telegram); color: #fff; font-weight: 800; cursor: pointer; }
.primary-button:disabled { background: #ccd5db; color: #7f8b94; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 30; transform: translate(-50%, 20px); padding: 10px 14px; border-radius: 12px; background: rgba(23,33,43,.92); color: #fff; font-size: 12px; opacity: 0; pointer-events: none; transition: .22s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 520px) {
  .app-shell { padding: 10px 9px 22px; }
  .topbar h1 { font-size: 21px; }
  .floor-button small { display: none; }
  .map-card { min-height: 410px; height: 59vh; border-radius: 18px; }
  .legend-card { grid-template-columns: 1fr 1fr; }
}

@media (prefers-color-scheme: dark) {
  :root { --bg: #17212b; --surface: rgba(35, 48, 59, .96); --text: #f3f7fa; --muted: #9fb0bd; --line: #3b4b57; }
  .floor-switcher { background: #243440; }.floor-button.active, .icon-button, .filter-chip { background: #263743; }
  .search-box, .detail-grid div { background: #1e2b35; }
  .map-card { background: #38444d; }
  .floor-plan { background: #33424d; }
  .floor-shell { fill: #25343f; stroke: #8fa0ac; }
  .floor-wall { stroke: #95a5b0; }
  .parking-space.available .stall { fill: #23694f; stroke: #52d49c; }
  .parking-space.available .stall-label { fill: #d8ffef; }
  .parking-space.unavailable .stall { fill: #46545e; stroke: #687782; }
  .parking-space.unavailable .stall-label { fill: #aab6be; }
  .map-badge, .zoom-controls { background: rgba(35,48,59,.95); }
  .sheet-card { background: #22303b; }.search-box input { color: var(--text); }
}
