:root {
  --ink: #e9f1f5;
  --muted: #8da1ad;
  --muted-2: #617682;
  --panel: #0e171e;
  --panel-2: #111d25;
  --line: rgba(219, 239, 245, .09);
  --line-strong: rgba(219, 239, 245, .17);
  --teal: #39d7cd;
  --teal-deep: #0d9a96;
  --amber: #f5b454;
  --danger: #ff6e68;
  --sidebar-w: 392px;
  --font: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: #070d12;
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { overflow: hidden; }

button, input { font: inherit; }
button { color: inherit; }
a { color: inherit; }
svg { display: block; }

button:focus-visible,
input:focus-visible,
.map-viewport:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.app {
  height: 100dvh;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  overflow: hidden;
  background: #070d12;
}

/* ----------------------------- Sidebar ----------------------------- */

.sidebar {
  position: relative;
  z-index: 40;
  min-width: 0;
  overflow: hidden;
  border-right: 1px solid rgba(219, 239, 245, .08);
  background:
    linear-gradient(180deg, rgba(19, 34, 42, .62), transparent 30%),
    radial-gradient(120% 70% at 110% 0%, rgba(22, 184, 176, .10), transparent 60%),
    #091117;
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .3;
  background-image:
    linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 72%);
}

.sidebar-glow {
  position: absolute;
  top: -130px;
  right: -110px;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(39, 216, 206, .14), rgba(39, 216, 206, 0) 68%);
  pointer-events: none;
}

.side-scroll {
  position: relative;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 22px 22px 132px;
  scrollbar-width: thin;
  scrollbar-color: rgba(141, 161, 173, .35) transparent;
}

.side-scroll::-webkit-scrollbar { width: 7px; }
.side-scroll::-webkit-scrollbar-thumb { background: rgba(141, 161, 173, .28); border-radius: 8px; }
.side-scroll::-webkit-scrollbar-track { background: transparent; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  margin-bottom: 16px;
}

.site-back {
  display: inline-block;
  margin-bottom: 13px;
  color: #6e838b;
  font-size: 8.5px;
  letter-spacing: .04em;
  text-decoration: none;
}

.site-back:hover { color: var(--teal); }

.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  margin-bottom: 18px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(0, 0, 0, .15);
}

.mode-tabs a {
  padding: 7px 8px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .04em;
  text-align: center;
  text-decoration: none;
}

.mode-tabs a:hover { color: var(--text); background: rgba(255, 255, 255, .035); }
.mode-tabs a.is-active {
  border: 1px solid rgba(57, 215, 205, .24);
  background: rgba(57, 215, 205, .10);
  color: var(--teal);
}

.brand-mark {
  width: 43px;
  height: 43px;
  flex: 0 0 43px;
  color: var(--teal);
  border: 1px solid rgba(57, 215, 205, .22);
  border-radius: 12px;
  background: rgba(57, 215, 205, .06);
  padding: 6px;
}

.brand-mark svg { width: 100%; height: 100%; }

.brand-copy { min-width: 0; }

.eyebrow {
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .14em;
  line-height: 1.3;
  text-transform: uppercase;
}

.brand-name {
  margin-top: 3px;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -.025em;
  line-height: 1;
}

.brand-name span {
  color: var(--teal);
  font-weight: 500;
}

.icon-btn.sidebar-close { display: none; margin-left: auto; }

.intro { padding: 30px 0 22px; }

.project-kicker {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 12px;
  color: #b9cbd3;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(57, 215, 205, .11);
}

.intro h1 {
  margin: 0;
  font-size: clamp(35px, 3.1vw, 44px);
  font-weight: 560;
  letter-spacing: -.045em;
  line-height: .98;
}

.intro p {
  max-width: 330px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.product-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 13px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .01em;
  text-decoration: none;
  border-bottom: 1px solid rgba(57, 215, 205, .25);
  padding-bottom: 2px;
}

.product-link svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.product-link:hover { border-color: var(--teal); }

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stat {
  min-width: 0;
  padding: 12px 13px 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .018));
}

.stat-value {
  overflow: hidden;
  color: #f2f7f9;
  font-size: 22px;
  font-weight: 580;
  letter-spacing: -.03em;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-value.accent { color: var(--teal); }
.stat-value.is-warning { color: var(--amber); }
.stat-label { margin-top: 4px; color: var(--muted-2); font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase; }

.panel {
  margin-top: 19px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 13px;
}

.panel-head h2 {
  margin: 0;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.panel-hint {
  color: var(--muted-2);
  font-size: 9.5px;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
}

.control-row label { color: #c7d5dc; font-size: 11.5px; }
.control-row output { color: var(--teal); font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; }

.range {
  --p: 50%;
  width: 100%;
  height: 18px;
  margin: 0;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
}

.range::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(57, 215, 205, .8) 0 var(--p), rgba(57, 215, 205, .14) var(--p) 100%);
}

.range::-moz-range-track {
  height: 3px;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(57, 215, 205, .8) 0 var(--p), rgba(57, 215, 205, .14) var(--p) 100%);
}

.range::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  margin-top: -5.5px;
  appearance: none;
  -webkit-appearance: none;
  border: 2px solid #0b151b;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 3px rgba(57, 215, 205, .14);
}

.range::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 2px solid #0b151b;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 3px rgba(57, 215, 205, .14);
}

.range-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 1px;
  color: #536773;
  font-size: 8.5px;
  font-variant-numeric: tabular-nums;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .01em;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}

.btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn:active { transform: translateY(1px); }

.btn-primary {
  width: 100%;
  margin-top: 13px;
  color: #041313;
  background: var(--teal);
  box-shadow: 0 8px 22px -12px rgba(57, 215, 205, .7);
}

.btn-primary:hover { background: #63e4dc; }

.auto-note {
  margin: 8px 0 0;
  color: var(--muted-2);
  font-size: 9.5px;
  line-height: 1.45;
  text-align: center;
}

.model-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 10px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, .15);
}

.model-switch button {
  min-width: 0;
  padding: 8px 6px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .03em;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.model-switch button:hover { background: rgba(255, 255, 255, .035); }
.model-switch button.is-active {
  border-color: rgba(57, 215, 205, .24);
  background: rgba(57, 215, 205, .10);
  color: var(--teal);
}

.target-select {
  width: 100%;
  height: 33px;
  margin-bottom: 8px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #0e171e;
  color: #dcebed;
  font-size: 10.5px;
  outline: none;
  cursor: pointer;
}

.target-select:focus { border-color: rgba(57, 215, 205, .5); }

.range-modes { margin-bottom: 7px; }
.range-modes .seg span { font-size: 7.2px; }
.range-modes .seg b { font-size: 10px; }

.range-values {
  margin: 0 0 5px;
  color: #9db3bb;
  font-family: "Cascadia Mono", "Consolas", ui-monospace, monospace;
  font-size: 9px;
  line-height: 1.55;
}

.source-note {
  margin: 0 0 8px;
  color: #5f747f;
  font-size: 8.5px;
  line-height: 1.45;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  margin-bottom: 13px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, .15);
}

.seg {
  min-width: 0;
  padding: 7px 4px 6px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.seg span {
  display: block;
  overflow: hidden;
  font-size: 8px;
  letter-spacing: .05em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.seg b { display: block; margin-top: 2px; color: #d6e4e9; font-size: 11px; font-weight: 600; }
.seg:hover { background: rgba(255, 255, 255, .035); }
.seg.is-active { border-color: rgba(57, 215, 205, .24); background: rgba(57, 215, 205, .10); }
.seg.is-active b { color: var(--teal); }
.seg.is-active span { color: #b7cbd3; }

.spec-note {
  margin: 8px 0 0;
  color: #5f747f;
  font-size: 9.5px;
  line-height: 1.5;
}

.count-pill {
  display: inline-grid;
  min-width: 22px;
  height: 20px;
  place-items: center;
  border: 1px solid rgba(57, 215, 205, .18);
  border-radius: 20px;
  background: rgba(57, 215, 205, .07);
  color: var(--teal);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.selected-editor {
  margin-bottom: 8px;
  padding: 11px;
  border: 1px solid rgba(245, 180, 84, .22);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(245, 180, 84, .075), rgba(245, 180, 84, .02));
}

.selected-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--amber);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.name-field { display: block; margin-top: 8px; }
.name-field span { display: block; margin-bottom: 4px; color: var(--muted-2); font-size: 8.5px; letter-spacing: .08em; text-transform: uppercase; }

.name-field input {
  width: 100%;
  height: 31px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: rgba(5, 12, 16, .48);
  color: var(--ink);
  font-size: 12px;
}

.coord-line {
  margin-top: 8px;
  color: #c0d3da;
  font-family: "Cascadia Mono", "Consolas", ui-monospace, monospace;
  font-size: 9.5px;
  letter-spacing: .015em;
}

.coord-hint { margin-top: 5px; color: #6d818b; font-size: 9px; line-height: 1.4; }

.camera-list {
  display: flex;
  max-height: 238px;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(141, 161, 173, .28) transparent;
}

.camera-list::-webkit-scrollbar { width: 5px; }
.camera-list::-webkit-scrollbar-thumb { background: rgba(141, 161, 173, .28); border-radius: 6px; }

.camera-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 8px 7px 8px 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  transition: background .14s ease, border-color .14s ease;
}

.camera-row:hover { background: rgba(255, 255, 255, .035); }
.camera-row.is-selected { border-color: rgba(245, 180, 84, .22); background: rgba(245, 180, 84, .055); }

.row-index {
  display: grid;
  width: 25px;
  height: 25px;
  flex: 0 0 25px;
  place-items: center;
  border: 1px solid rgba(57, 215, 205, .25);
  border-radius: 50%;
  background: rgba(57, 215, 205, .07);
  color: var(--teal);
  font-family: "Cascadia Mono", "Consolas", ui-monospace, monospace;
  font-size: 8.5px;
}

.camera-row.is-selected .row-index { border-color: rgba(245, 180, 84, .34); background: rgba(245, 180, 84, .12); color: var(--amber); }

.row-main { min-width: 0; flex: 1; }
.row-main b { display: block; overflow: hidden; font-size: 11.5px; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.row-main small { display: block; overflow: hidden; margin-top: 2px; color: #607681; font-family: "Cascadia Mono", "Consolas", ui-monospace, monospace; font-size: 8.5px; text-overflow: ellipsis; white-space: nowrap; }
.row-delete { flex: 0 0 auto; opacity: 0; }

.camera-row:hover .row-delete,
.camera-row.is-selected .row-delete { opacity: 1; }

.empty-state {
  padding: 15px 8px;
  color: var(--muted-2);
  font-size: 10.5px;
  line-height: 1.5;
  text-align: center;
}

.btn-ghost {
  margin-top: 8px;
  border-color: var(--line-strong);
  background: transparent;
  color: #b6c8cf;
}

.btn-ghost:hover { border-color: rgba(57, 215, 205, .3); background: rgba(57, 215, 205, .045); color: var(--teal); }
.btn-ghost.is-armed { border-color: rgba(245, 180, 84, .45); background: rgba(245, 180, 84, .08); color: #ffd18c; }
.btn-full { width: 100%; }

.btn-soft {
  border-color: var(--line);
  background: rgba(255, 255, 255, .045);
  color: #d6e4e9;
}

.btn-soft:hover { background: rgba(255, 255, 255, .075); }

.presentation-btn {
  width: 100%;
  min-height: 42px;
  margin-top: 19px;
  border-color: rgba(57, 215, 205, .3);
  background: linear-gradient(135deg, rgba(57, 215, 205, .13), rgba(57, 215, 205, .045));
  color: #8ff4eb;
  font-size: 10.5px;
  letter-spacing: .015em;
}

.presentation-btn:hover { border-color: rgba(57, 215, 205, .55); background: rgba(57, 215, 205, .18); }
.presentation-btn:disabled { opacity: .65; cursor: wait; }
.presentation-btn svg { width: 17px; height: 17px; }

.side-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.side-actions .btn-soft { flex: 1; }

.icon-btn {
  display: inline-grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #9db0b9;
  cursor: pointer;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
}

.icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { color: var(--ink); background: rgba(255, 255, 255, .06); }
.icon-btn.bordered { border-color: var(--line); background: rgba(255, 255, 255, .035); }
.icon-btn.bordered:hover { border-color: var(--line-strong); }
.icon-btn.danger:hover { color: var(--danger); background: rgba(255, 110, 104, .08); }

.save-status {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
  color: #617681;
  font-size: 9px;
}

.status-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 3px rgba(57, 215, 205, .08); }
.save-status.is-error .status-dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(255, 110, 104, .08); }

.side-footer {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: #4f626c;
  font-size: 8.5px;
  line-height: 1.5;
}

.side-footer p { margin: 0 0 5px; }
.side-footer p:last-child { margin-bottom: 0; }

.sidebar-contact {
  position: absolute;
  z-index: 8;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px 14px;
  border-top: 1px solid rgba(57, 215, 205, .13);
  background:
    linear-gradient(180deg, rgba(9, 17, 23, .72), rgba(9, 17, 23, .97) 38%),
    #091117;
  box-shadow: 0 -14px 35px rgba(5, 12, 16, .28);
  backdrop-filter: blur(14px);
}

.contact-monogram {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border: 1px solid rgba(57, 215, 205, .3);
  border-radius: 50%;
  background: rgba(57, 215, 205, .08);
  color: var(--teal);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
}

.contact-body { min-width: 0; }
.contact-body strong { display: block; color: #edf6f7; font-size: 11px; font-weight: 600; }
.contact-body span { display: block; margin-top: 2px; color: #71868f; font-size: 8.5px; line-height: 1.3; white-space: normal; }
.contact-body a { display: inline-block; margin-top: 3px; color: var(--teal); font-family: "Cascadia Mono", "Consolas", ui-monospace, monospace; font-size: 9.5px; text-decoration: none; }
.contact-body a:hover { text-decoration: underline; }

/* ------------------------------- Map ------------------------------- */

.map-shell {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 45%, #dce7e1, #c5d3cc 100%);
}

.map-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  background: #cfdcd6;
}

.map-viewport.is-panning { cursor: grabbing; }
.map-viewport.is-adding { cursor: crosshair; }

.map-world {
  position: absolute;
  top: 0;
  left: 0;
  width: 2768px;
  height: 2768px;
  transform-origin: 0 0;
  will-change: transform;
}

.map-world.is-animating {
  transition: transform .46s cubic-bezier(.2, .8, .2, 1);
}

.map-image {
  display: block;
  width: 2768px;
  height: 2768px;
  user-select: none;
  pointer-events: none;
  filter: saturate(.84) contrast(1.01) brightness(.945);
}

.map-overlay {
  position: absolute;
  inset: 0;
  overflow: visible;
  pointer-events: none;
}

.map-vignette {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(7, 17, 22, .16), transparent 19%, transparent 76%, rgba(7, 17, 22, .14)),
    radial-gradient(115% 90% at 50% 42%, transparent 54%, rgba(6, 16, 21, .16) 100%);
}

.map-watermark {
  position: absolute;
  z-index: 11;
  top: 50%;
  right: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(9, 39, 44, .13);
  font-size: 46px;
  font-weight: 700;
  letter-spacing: .18em;
  line-height: 1;
  pointer-events: none;
  transform: translateY(-50%) rotate(90deg);
  transform-origin: center;
  user-select: none;
  white-space: nowrap;
}

.map-watermark span {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
  opacity: .75;
}

.extent-ring {
  fill: none;
  stroke: #0d8f8e;
  stroke-width: 1.2;
  stroke-dasharray: 2 11;
  stroke-opacity: .38;
  vector-effect: non-scaling-stroke;
}

.extent-ring-halo {
  fill: none;
  stroke: #0d8f8e;
  stroke-width: 9;
  stroke-opacity: .035;
  vector-effect: non-scaling-stroke;
}

.extent-tag rect {
  fill: rgba(9, 21, 27, .74);
  stroke: rgba(57, 215, 205, .18);
  stroke-width: 1;
}

.extent-tag text {
  fill: #d7ecee;
  font-family: var(--font);
  font-size: 34px;
  font-weight: 600;
  letter-spacing: 5px;
}

.zones-layer .zone { transition: opacity .2s ease; }
.zones-layer.is-hidden { opacity: 0; }

.zone-fill {
  fill: url(#zoneFill);
  transition: fill .2s ease;
}

.zone-line {
  fill: none;
  stroke: #0d8f8e;
  stroke-width: 1.65;
  stroke-dasharray: 9 7;
  stroke-linecap: round;
  stroke-opacity: .62;
  vector-effect: non-scaling-stroke;
}

.zone-tick {
  stroke: #0d8f8e;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-opacity: .55;
  vector-effect: non-scaling-stroke;
}

.zone.is-selected .zone-fill { fill: url(#zoneFillSelected); }
.zone.is-selected .zone-line { stroke: #d6912d; stroke-opacity: .95; stroke-dasharray: 2 6; }
.zone.is-selected .zone-tick { stroke: #d6912d; stroke-opacity: .9; }

.gap-layer path {
  fill: none;
  stroke: var(--danger);
  stroke-width: 4;
  stroke-dasharray: 7 7;
  stroke-linecap: round;
  stroke-opacity: .9;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 3px rgba(255, 80, 74, .45));
}

.markers-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.marker {
  position: absolute;
  z-index: 5;
  width: 54px;
  height: 54px;
  margin: -27px 0 0 -27px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  pointer-events: auto;
  cursor: grab;
  transform: scale(var(--inv, 1));
  transform-origin: center center;
  touch-action: none;
}

.marker.is-selected { z-index: 8; }
.marker.is-dragging { cursor: grabbing; z-index: 10; }

.marker-pin {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 1.5px solid rgba(57, 215, 205, .92);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, rgba(63, 229, 218, .18), transparent 52%),
    #0b171d;
  color: #a8f4ed;
  box-shadow:
    0 0 0 5px rgba(10, 26, 30, .16),
    0 10px 24px rgba(3, 12, 16, .36),
    inset 0 0 0 1px rgba(255, 255, 255, .06);
  transition: border-color .16s ease, color .16s ease, box-shadow .16s ease;
}

.marker-pin svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.55; stroke-linecap: round; stroke-linejoin: round; }

.marker-index {
  position: absolute;
  right: -7px;
  bottom: -3px;
  display: grid;
  min-width: 21px;
  height: 19px;
  place-items: center;
  padding: 0 4px;
  border: 1.5px solid #0b171d;
  border-radius: 10px;
  background: var(--amber);
  color: #211604;
  font-family: "Cascadia Mono", "Consolas", ui-monospace, monospace;
  font-size: 8px;
  font-weight: 700;
  line-height: 1;
}

.marker-name {
  position: absolute;
  top: 61px;
  left: 50%;
  max-width: 118px;
  overflow: hidden;
  padding: 4px 7px;
  border: 1px solid rgba(255, 255, 255, .11);
  border-radius: 6px;
  background: rgba(8, 19, 24, .86);
  box-shadow: 0 5px 14px rgba(3, 10, 13, .22);
  color: #dbebef;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .015em;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
  transform: translateX(-50%);
  backdrop-filter: blur(7px);
}

.marker:hover .marker-pin { border-color: #8ff8ef; }
.marker.is-selected .marker-pin {
  border-color: var(--amber);
  color: #ffd58f;
  box-shadow:
    0 0 0 5px rgba(245, 180, 84, .15),
    0 0 0 9px rgba(245, 180, 84, .06),
    0 12px 28px rgba(3, 12, 16, .4);
}

.marker.is-selected .marker-index { background: #fff1d8; }
.marker.is-selected .marker-name { border-color: rgba(245, 180, 84, .3); color: #ffe4b6; }

.map-topbar {
  position: absolute;
  z-index: 15;
  top: 18px;
  right: 20px;
  left: 20px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  pointer-events: none;
}

.map-heading {
  min-width: 0;
  padding: 11px 15px 12px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 13px;
  background: rgba(9, 21, 27, .79);
  box-shadow: 0 10px 30px rgba(7, 16, 20, .16);
  color: #eaf4f6;
  backdrop-filter: blur(14px) saturate(1.1);
  pointer-events: auto;
}

.map-heading .eyebrow { color: #8fa5ae; font-size: 8px; }
.map-title { margin-top: 3px; font-size: 12.5px; font-weight: 600; letter-spacing: -.005em; }

.map-top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  pointer-events: auto;
}

.layer-chip {
  display: inline-flex;
  height: 32px;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 8px;
  background: rgba(9, 21, 27, .79);
  color: #d8e8ec;
  font-size: 10px;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.layer-dot { width: 6px; height: 6px; border-radius: 50%; background: #6b7e87; }
.layer-chip.is-active .layer-dot { background: var(--teal); box-shadow: 0 0 0 3px rgba(57, 215, 205, .13); }
.layer-chip:hover { border-color: rgba(255, 255, 255, .25); background: rgba(9, 21, 27, .9); }
.layer-chip:not(.is-active) { color: #8c9fa8; }

.map-top-actions .icon-btn {
  border-color: rgba(255, 255, 255, .15);
  background: rgba(9, 21, 27, .79);
  color: #d8e8ec;
  backdrop-filter: blur(12px);
}

.map-top-actions .icon-btn:hover { background: rgba(9, 21, 27, .94); }

.coverage-pill {
  position: absolute;
  z-index: 12;
  top: 82px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 20px;
  background: rgba(9, 21, 27, .78);
  color: #c9e4e1;
  font-size: 9.5px;
  font-weight: 550;
  backdrop-filter: blur(12px);
  pointer-events: none;
}

.coverage-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 3px rgba(57, 215, 205, .12); }
.coverage-pill.is-warning { color: #ffd0ad; border-color: rgba(255, 145, 85, .28); }
.coverage-pill.is-warning .coverage-dot { background: #ff8f5b; box-shadow: 0 0 0 3px rgba(255, 143, 91, .12); }

.map-controls {
  position: absolute;
  z-index: 12;
  right: 20px;
  bottom: 104px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 10px;
  background: rgba(9, 21, 27, .82);
  box-shadow: 0 8px 24px rgba(3, 11, 14, .18);
  backdrop-filter: blur(14px);
}

.map-control {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: #d8e8ec;
  cursor: pointer;
}

.map-control:hover { background: rgba(255, 255, 255, .08); }
.map-control svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.control-70 { font-family: "Cascadia Mono", "Consolas", ui-monospace, monospace; font-size: 10px; font-weight: 700; letter-spacing: -.02em; }
.control-70::after { content: " км"; color: #75909a; font-size: 7px; font-weight: 500; letter-spacing: 0; }
.controls-divider { height: 1px; margin: 0 7px; background: rgba(255, 255, 255, .1); }

.scalebar {
  position: absolute;
  z-index: 12;
  bottom: 22px;
  left: 22px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: #334b52;
  font-family: "Cascadia Mono", "Consolas", ui-monospace, monospace;
  font-size: 9px;
  pointer-events: none;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .35);
}

.scalebar-line {
  height: 4px;
  border-right: 1px solid #2d474e;
  border-bottom: 2px solid #2d474e;
  border-left: 1px solid #2d474e;
  width: 110px;
}

.map-legend {
  position: absolute;
  z-index: 12;
  right: 20px;
  bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 9px 11px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 9px;
  background: rgba(9, 21, 27, .77);
  color: #c3d6dc;
  font-size: 9px;
  backdrop-filter: blur(12px);
  pointer-events: none;
}

.legend-item { display: flex; align-items: center; gap: 7px; }
.legend-item b { font-weight: 600; }
.legend-marker { display: grid; width: 13px; height: 13px; place-items: center; border: 1px solid var(--teal); border-radius: 50%; background: #0b171d; }
.legend-marker i { width: 3px; height: 3px; border-radius: 50%; background: var(--teal); }
.legend-zone { width: 13px; height: 13px; border: 1px dashed #4cc9c4; border-radius: 50%; background: transparent; }
.legend-extent { width: 13px; height: 13px; border: 1px dotted #4e8e90; border-radius: 50%; }

.map-attribution {
  position: absolute;
  z-index: 12;
  bottom: 7px;
  left: 22px;
  color: #40575f;
  font-size: 8px;
  letter-spacing: .01em;
  text-decoration: none;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .35);
}

.map-attribution:hover { color: #1f3b43; text-decoration: underline; }

.edit-hint {
  position: absolute;
  z-index: 12;
  bottom: 24px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px 8px 8px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 20px;
  background: rgba(9, 21, 27, .82);
  color: #d1e2e6;
  font-size: 9.5px;
  white-space: nowrap;
  transform: translateX(-50%);
  backdrop-filter: blur(12px);
  transition: opacity .35s ease, transform .35s ease;
}

.edit-hint.is-hidden { opacity: 0; transform: translate(-50%, 8px); pointer-events: none; }
.edit-hint-icon { display: grid; width: 22px; height: 22px; place-items: center; border-radius: 50%; background: rgba(57, 215, 205, .10); color: var(--teal); }
.edit-hint-icon svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.hint-close { width: 18px; height: 18px; margin-left: 1px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #748a93; font-size: 14px; line-height: 1; cursor: pointer; }
.hint-close:hover { background: rgba(255, 255, 255, .08); color: #fff; }

.add-banner {
  position: absolute;
  z-index: 18;
  top: 86px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px 9px 13px;
  border: 1px solid rgba(245, 180, 84, .35);
  border-radius: 9px;
  background: rgba(28, 22, 12, .92);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .22);
  color: #ffe0ad;
  font-size: 10.5px;
  white-space: nowrap;
  transform: translateX(-50%);
  backdrop-filter: blur(12px);
}

.add-pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); animation: pulse 1.4s ease-in-out infinite; }
.add-banner button { margin-left: 3px; padding: 4px 7px; border: 1px solid rgba(245, 180, 84, .25); border-radius: 5px; background: transparent; color: #f8c77a; font-size: 9px; cursor: pointer; }
.add-banner button:hover { background: rgba(245, 180, 84, .1); }

.toast {
  position: absolute;
  z-index: 40;
  bottom: 76px;
  left: 50%;
  max-width: min(420px, calc(100% - 40px));
  padding: 9px 13px;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 8px;
  background: rgba(8, 18, 23, .94);
  box-shadow: 0 12px 35px rgba(0, 0, 0, .26);
  color: #daebef;
  font-size: 10.5px;
  line-height: 1.4;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity .2s ease, transform .2s ease;
  backdrop-filter: blur(12px);
}

.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.help-popover {
  position: absolute;
  z-index: 35;
  top: 70px;
  right: 20px;
  width: min(355px, calc(100% - 40px));
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 12px;
  background: rgba(9, 21, 27, .95);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .3);
  backdrop-filter: blur(18px);
}

.help-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.help-head h3 { margin: 1px 0 0; font-size: 12.5px; font-weight: 600; }
.help-head .icon-btn { width: 24px; height: 24px; flex-basis: 24px; }
.help-popover ul { margin: 11px 0 0; padding: 0 0 0 15px; color: #adc2c9; font-size: 10.5px; line-height: 1.55; }
.help-popover li { margin-bottom: 5px; }
.help-popover li::marker { color: var(--teal); }
.help-popover b { color: #e0edf0; font-weight: 600; }
.help-note { margin: 11px 0 0; padding-top: 9px; border-top: 1px solid var(--line); color: #657983; font-size: 9px; line-height: 1.5; }

.menu-btn { display: none; flex: 0 0 auto; border-color: rgba(255, 255, 255, .15); background: rgba(9, 21, 27, .8); color: #dcecef; backdrop-filter: blur(12px); }

.sidebar-scrim {
  position: fixed;
  z-index: 39;
  inset: 0;
  background: rgba(3, 9, 12, .55);
  backdrop-filter: blur(2px);
}

/* ------------------------------ Dialog ----------------------------- */

.reset-dialog {
  width: min(390px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 15px;
  background: #0d171e;
  color: var(--ink);
  box-shadow: 0 28px 90px rgba(0, 0, 0, .52);
}

.reset-dialog::backdrop { background: rgba(3, 9, 12, .66); backdrop-filter: blur(4px); }
.reset-dialog form { padding: 22px; }
.dialog-icon { display: grid; width: 38px; height: 38px; margin-bottom: 14px; place-items: center; border: 1px solid rgba(245, 180, 84, .22); border-radius: 10px; background: rgba(245, 180, 84, .08); color: var(--amber); }
.dialog-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.reset-dialog h2 { margin: 0 0 8px; font-size: 17px; font-weight: 600; letter-spacing: -.02em; }
.reset-dialog p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.dialog-actions .btn { min-width: 92px; }
.dialog-actions .btn-primary { width: auto; margin: 0; }

@keyframes pulse {
  0%, 100% { opacity: .55; transform: scale(.9); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* ---------------------------- Responsive --------------------------- */

@media (max-width: 1180px) {
  :root { --sidebar-w: 360px; }
  .intro h1 { font-size: 38px; }
  .side-scroll { padding-right: 19px; padding-left: 19px; }
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    z-index: 50;
    inset: 0 auto 0 0;
    width: min(390px, 92vw);
    border-right-color: rgba(255, 255, 255, .12);
    box-shadow: 25px 0 70px rgba(0, 0, 0, .34);
    transform: translateX(-104%);
    transition: transform .24s cubic-bezier(.2, .8, .2, 1);
  }
  .sidebar.is-open { transform: none; }
  .icon-btn.sidebar-close { display: inline-grid; }
  .sidebar-scrim:not([hidden]) { display: block; }
  .menu-btn { display: inline-grid; }
  .map-heading { padding: 9px 12px 10px; }
  .map-topbar { top: 12px; right: 12px; left: 12px; }
  .coverage-pill { top: 66px; right: 12px; }
  .map-controls { right: 12px; bottom: 92px; }
  .map-legend { right: 12px; bottom: 12px; }
  .scalebar { bottom: 16px; left: 14px; }
  .map-attribution { bottom: 5px; left: 14px; }
  #zoomRegion { display: none; }
  .edit-hint { display: none; }
  .help-popover { top: 58px; right: 12px; }
  .toast { bottom: 66px; }
}

@media (max-width: 600px) {
  .side-scroll { padding: 18px 17px 128px; }
  .intro { padding-top: 24px; }
  .intro h1 { font-size: 36px; }
  .map-heading .eyebrow { display: none; }
  .map-title { margin-top: 0; font-size: 11px; }
  .map-heading { border-radius: 10px; }
  .layer-chip { padding: 0 9px; }
  .coverage-pill { top: 60px; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .map-legend { display: none; }
  .map-controls { bottom: 14px; }
  .scalebar { bottom: 16px; }
  .add-banner { top: 60px; max-width: calc(100% - 24px); flex-wrap: wrap; justify-content: center; white-space: normal; text-align: center; }
  .add-banner button { margin-left: 0; }
  .stat-value { font-size: 20px; }
}

/* ------------------------- OpenFreeMap / MapLibre ------------------ */

.osm-map {
  position: absolute;
  z-index: 0;
  inset: 0;
  background: #dfe8e2;
  font-family: var(--font);
}

.zone-gradient-canvas {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.maplibregl-map {
  background: #dfe8e2;
  font-family: var(--font);
}

.maplibregl-canvas { outline: none; }

#map.is-adding .maplibregl-canvas { cursor: crosshair !important; }
.maplibregl-marker { z-index: 2; cursor: pointer; }

.map-fatal {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 30px;
  background: #dfe8e2;
  color: #30474e;
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}

.map-file-warning {
  align-content: center;
  gap: 7px;
  max-width: none;
  background: #e7efe9;
}

.map-file-warning b { font-size: 16px; color: #17343b; }
.map-file-warning span { display: block; max-width: 430px; }
.map-file-warning code {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 5px;
  background: rgba(9, 21, 27, .08);
  font-family: "Cascadia Mono", "Consolas", ui-monospace, monospace;
  font-size: 11px;
}
.map-file-warning a {
  display: inline-block;
  margin-top: 4px;
  padding: 8px 13px;
  border-radius: 7px;
  background: #0f8f8a;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
}

.camera-icon {
  width: 54px;
  height: 54px;
  background: transparent;
  border: 0;
  overflow: visible;
  pointer-events: auto;
}

.camera-pin {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 1.5px solid rgba(57, 215, 205, .92);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, rgba(63, 229, 218, .18), transparent 52%),
    #0b171d;
  color: #a8f4ed;
  box-shadow:
    0 0 0 5px rgba(10, 26, 30, .16),
    0 10px 24px rgba(3, 12, 16, .36),
    inset 0 0 0 1px rgba(255, 255, 255, .06);
  transition: border-color .16s ease, color .16s ease, box-shadow .16s ease;
}

.camera-pin svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.camera-pin svg .icon-fill { fill: currentColor; stroke: none; }
.camera-pin svg .icon-stroke { fill: none; stroke: currentColor; }

.camera-icon:hover .camera-pin { border-color: #8ff8ef; }

.camera-icon.is-selected .camera-pin {
  border-color: var(--amber);
  color: #ffd58f;
  box-shadow:
    0 0 0 5px rgba(245, 180, 84, .15),
    0 0 0 9px rgba(245, 180, 84, .06),
    0 12px 28px rgba(3, 12, 16, .4);
}

.camera-icon .marker-name {
  pointer-events: none;
}

.camera-icon.is-selected .marker-name {
  border-color: rgba(245, 180, 84, .3);
  color: #ffe4b6;
}

.camera-icon .marker-index { pointer-events: none; }

/* Круги и линии рисуются Leaflet в SVG */
.zone-circle {
  transition: stroke .15s ease, fill-opacity .15s ease;
}

.leaflet-interactive {
  outline: none;
}

/* Убираем стандартные контролы и атрибуцию — используем свои */
.leaflet-control-container { display: none; }

/* ---------------------------- Responsive --------------------------- */

@media (max-width: 900px) {
  .map-attribution { left: 14px; bottom: 5px; }
  .osm-map { border-radius: 0; }
}

@media (max-width: 600px) {
  .camera-icon .marker-name { font-size: 8.5px; }
  .map-attribution { font-size: 7px; }
  .map-watermark { right: 7px; font-size: 34px; opacity: .8; }
}

@media (max-width: 900px) {
  .sidebar-contact { padding-right: 17px; padding-left: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
