html.sap-locked, html.sap-locked body { overflow: hidden !important; }
html.sap-locked body { position: fixed; left: 0; right: 0; width: 100%; }
.sap { --bg:#1d2129; --card:#2a2f39; --line:#3a404c; --ink:#f3f1ec; --mute:#a6adba; --blue:#2f6fe4; --red:#d9473a; --ok:#3fbf8a;
  position: fixed; inset: 0; z-index: 100050; font-family: "DM Sans", system-ui, sans-serif; color: var(--ink); }
.sap[hidden], .sap [hidden] { display: none !important; }
.sap button { font: inherit; color: inherit; cursor: pointer; }
.sap button:disabled { opacity: .5; cursor: not-allowed; }
.sap :focus-visible { outline: 2px solid #8fb4ff; outline-offset: 2px; }
.sap button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sap-backdrop { position: absolute; inset: 0; background: rgba(12,14,18,.55); animation: sapFade .2s ease; }
.sap-sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 86dvh; display: flex; flex-direction: column; margin: 0 auto; max-width: 560px;
  background: var(--bg); border-radius: 24px 24px 0 0; padding: 20px 20px calc(16px + env(safe-area-inset-bottom)); animation: sapUp .26s cubic-bezier(.2,.8,.2,1); }
.sap-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.sap-sheet-head h2 { margin: 0; font-size: 21px; font-weight: 700; color: var(--ink); }
.sap-x { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--card); display: grid; place-items: center; }
.sap-sheet-body { overflow-y: auto; overscroll-behavior: contain; flex: 1; min-height: 80px; }
.sap-addr { list-style: none; margin: 0; padding: 0; }
.sap-addr li { display: grid; grid-template-columns: 1fr auto; align-items: start; border-bottom: 1px solid var(--line); padding: 12px 0; }
.sap-addr li:last-child { border-bottom: 0; }
.sap-addr li.is-pending { opacity: .6; }
.sap-pick { display: flex; gap: 14px; text-align: left; background: none; border: 0; padding: 4px 0; line-height: 1.4; font-size: 15px; }
.sap-pick b { font-size: 16px; } .sap-pick em { font-style: normal; font-size: 12px; color: var(--mute); margin-left: 8px; }
.sap-pick small { display: block; }
.sap-radio { flex: none; width: 22px; height: 22px; margin-top: 2px; border-radius: 50%; border: 2px solid #6b7280; }
.is-cur .sap-radio { border-color: var(--blue); box-shadow: inset 0 0 0 4px var(--bg); background: var(--blue); }
.sap-del { width: 40px; height: 40px; border: 0; border-radius: 12px; background: none; color: var(--mute); display: grid; place-items: center; }
.sap-del:hover { background: var(--card); color: var(--red); }
.sap-err, .sap-warn { grid-column: 1 / -1; color: #ff8a7a; font-size: 13px; margin-top: 4px; }
.sap-msg { min-height: 1em; margin: 8px 0 0; font-size: 13px; color: var(--mute); }
.sap-msg.is-err { color: #ff8a7a; }
.sap-cta { margin-top: 12px; width: 100%; border: 0; border-radius: 14px; background: #1f3a5c; padding: 12px; display: flex; flex-direction: column; align-items: center; }
.sap-cta b { color: #7fb0ff; font-size: 17px; } .sap-cta span { color: #6f9ee6; font-size: 13px; }
.sap-empty { padding: 20px 4px; color: var(--mute); text-align: center; line-height: 1.45; }
.sap-empty b { color: var(--ink); }
.sap-ghost { margin-top: 8px; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 10px 18px; }
.sap-skel { height: 58px; border-radius: 12px; margin: 10px 0; background: linear-gradient(90deg, var(--card), #343a46, var(--card)); background-size: 200% 100%; animation: sapShim 1.2s infinite linear; }
.sap-spin { width: 16px; height: 16px; border: 2px solid var(--mute); border-top-color: transparent; border-radius: 50%; animation: sapRot .7s linear infinite; }

.sap-full { position: absolute; inset: 0; background: #e9e6df; display: flex; flex-direction: column; animation: sapFade .2s ease; }
.sap-top { position: relative; z-index: 2; background: var(--bg); display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 14px 10px; }
.sap-back { width: 40px; height: 40px; border: 0; background: none; display: grid; place-items: center; color: var(--mute); }
.sap-seg { flex: 1; max-width: 360px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; background: #0f1115; border-radius: 14px; padding: 4px; }
.sap-seg button { border: 0; background: none; border-radius: 11px; padding: 11px 6px; font-size: 16px; }
.sap-seg button.is-on { background: var(--blue); color: #fff; }
.sap-map-stage { position:relative; flex:1; min-height:120px; }
.sap-map { position:absolute; inset:0; }
.sap-tools { position: absolute; right: 14px; bottom: 14px; z-index: 1000; display: flex; flex-direction: row; gap: 10px; }
.sap-tools button { width: 52px; height: 52px; border-radius: 12px; border: 0; background: var(--bg); display: grid; place-items: center; box-shadow: 0 6px 16px rgba(0,0,0,.25); }
.sap-legend { position: absolute; left: 10px; top: 10px; z-index: 1000; max-width: min(320px, calc(100% - 150px)); max-height:calc(100% - 24px); overflow-y:auto; display: flex; flex-direction: column; gap: 4px;
  background: rgba(29,33,41,.9); border-radius: 12px; padding: 8px 10px; font-size: 12px; line-height: 1.35; }
.sap-legend span { display: flex; gap: 6px; align-items: center; } .sap-legend .is-off { color: #ffb4a8; }
.sap-legend i { flex: none; width: 10px; height: 10px; border-radius: 50%; } .sap-legend i.b { background: var(--blue); } .sap-legend i.r { background: var(--red); }
.sap-legend a { color: #9cc0ff; }
.sap-bottom { position: relative; flex:none; z-index: 1001; background: var(--bg); border-radius: 22px 22px 0 0; margin-top: 0; padding: 18px 20px calc(16px + env(safe-area-inset-bottom));
  max-height: 42dvh; overflow-y: auto; overscroll-behavior: contain; }
.sap-bottom h3 { margin: 0 0 6px; font-size: 22px; color: var(--ink); }
.sap-sub { margin: 0 0 10px; color: var(--mute); font-size: 14px; }
.sap-link { background: none; border: 0; padding: 0; color: #7fb0ff !important; text-decoration: underline; }
.sap-field { display: block; background: var(--card); border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; line-height: 1.4; }
.sap-input span { display: block; font-size: 12px; color: var(--mute); margin-bottom: 4px; }
.sap-input input { width: 100%; background: none; border: 0; outline: 0; color: var(--ink); font: inherit; font-size: 16px; }
.sap-confirm { width: 100%; border: 0; border-radius: 14px; background: var(--blue); color: #fff !important; padding: 15px; font-size: 17px; font-weight: 600; }
.sap-alert { display: flex; gap: 10px; align-items: flex-start; background: rgba(217,71,58,.16); border: 1px solid rgba(217,71,58,.5); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; font-size: 14px; }
.sap-alert input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--red); }
.sap-ok { color: var(--ok); margin: 0 0 12px; font-size: 14px; }
.sap-search input { width: 100%; box-sizing: border-box; background: var(--card); border: 1px solid var(--line); color: var(--ink); border-radius: 12px; padding: 12px; font-size: 16px; }
.sap-search ul { list-style: none; margin: 8px 0 14px; padding: 0; max-height: 34dvh; overflow-y: auto; }
.sap-search li button { display: flex; gap: 10px; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 10px 2px; font-size: 14px; line-height: 1.35; }
.sap-search li button i { flex: none; width: 12px; height: 12px; margin-top: 4px; border-radius: 50%; background: var(--blue); }
.sap-search li button.is-red i { background: var(--red); }
.sap-search li button[aria-pressed="true"] { background: rgba(47,111,228,.15); }
.sap-search small { display: block; color: #ff8a7a; }
.sap-none { color: var(--mute); padding: 10px 0; }
.sap-pin span { display: block; width: 26px; height: 26px; border-radius: 50%; background: #2f6fe4; border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); transition: transform .15s; }
.sap-pin.is-red span { background: #d9473a; }
.sap-pin.is-sel span { transform: scale(1.35); box-shadow: 0 0 0 4px rgba(29,33,41,.5); }
.sap-home-pin span { display: block; width: 32px; height: 32px; margin: 2px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: #d6336c; border: 3px solid #fff; box-shadow: 0 3px 8px rgba(0,0,0,.35); }
.sap .leaflet-popup-content { color: #1d2129; font-size: 13px; }
@media (min-width: 768px) { .sap-bottom { width:100%; max-width:760px; align-self:center; border-radius:22px 22px 0 0; } }
@media (max-height: 500px) {
  .sap-bottom { max-height:40dvh; padding:10px 14px; }
  .sap-tools button { width:44px; height:44px; }
  .sap .leaflet-top.leaflet-right { right:124px; }
  .sap-legend { max-width:calc(100% - 190px); font-size:11px; }
}
@keyframes sapUp { from { transform: translateY(100%); } }
@keyframes sapFade { from { opacity: 0; } }
@keyframes sapShim { to { background-position: -200% 0; } }
@keyframes sapRot { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .sap * { animation: none !important; transition: none !important; } }
