/* ---------- palette ---------- */
:root {
  --bg-0: #04060d;
  --bg-1: #08101e;
  --bg-2: #0d1830;
  --line: #1a2745;
  --line-hot: #2a3f6e;
  --text: #cfeaf7;
  --text-dim: #6e8ab0;
  --cyan: #00f0ff;
  --cyan-soft: #57e1ff;
  --magenta: #ff2bd6;
  --pink: #ff2a6d;
  --green: #00ff9d;
  --yellow: #ffd400;
  --orange: #ff9a3c;
  --purple: #b48cff;
  --red: #ff3355;
  --shadow: 0 0 12px rgba(0, 240, 255, 0.35);
  --shadow-mag: 0 0 14px rgba(255, 43, 214, 0.4);
}

* { box-sizing: border-box; }

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

body {
  background: var(--bg-0);
  color: var(--text);
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  overflow: hidden;
  position: relative;
}

/* ---------- atmospheric layers ---------- */
.grid-bg {
  position: fixed; inset: 0;
  background-image:
    linear-gradient(rgba(0, 240, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, 0.05) 1px, transparent 1px),
    radial-gradient(circle at 20% 30%, rgba(255, 43, 214, 0.12), transparent 50%),
    radial-gradient(circle at 80% 75%, rgba(0, 240, 255, 0.18), transparent 55%);
  background-size: 50px 50px, 50px 50px, auto, auto;
  pointer-events: none;
  z-index: -2;
}
.scanlines {
  position: fixed; inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.012) 0,
    rgba(255, 255, 255, 0.012) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  z-index: 1000;
  mix-blend-mode: overlay;
}

/* ---------- topbar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  height: 56px;
  padding: 0 16px;
  background: linear-gradient(180deg, rgba(8,16,30,0.98), rgba(8,16,30,0.78));
  border-bottom: 1px solid var(--line-hot);
  position: relative;
  z-index: 5;
}
.topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0.55;
}

.navlink {
  display: inline-flex; align-items: center;
  gap: 6px;
  height: 28px; padding: 0 10px;
  margin-left: 6px;
  border: 1px solid var(--line-hot);
  border-radius: 4px;
  font: 700 11px 'Orbitron', 'JetBrains Mono', monospace;
  letter-spacing: 0.18em;
  text-decoration: none;
  color: var(--cyan);
  background: rgba(0, 240, 255, 0.04);
  transition: background 80ms, color 80ms, opacity 80ms;
  cursor: pointer;
}
.navlink:hover { background: var(--cyan); color: var(--bg-0); }
.navlink:disabled { opacity: 0.6; cursor: progress; }
.navlink:disabled:hover { background: rgba(0, 240, 255, 0.04); color: var(--cyan); }
.navlink .refresh-icon { display: inline-block; line-height: 1; font-size: 14px; }
.navlink.refreshing .refresh-icon {
  animation: refresh-spin 0.8s linear infinite;
  color: var(--green);
}
.navlink.refreshing { border-color: var(--green); color: var(--green); }
@keyframes refresh-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.brand { display: flex; align-items: center; gap: 12px; color: var(--cyan); }
.brand-mark { width: 32px; height: 32px; filter: drop-shadow(0 0 6px var(--cyan)); }
.brand-mark svg { width: 100%; height: 100%; }

.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-glitch {
  font-family: 'Orbitron', 'JetBrains Mono', monospace;
  font-weight: 900;
  letter-spacing: 0.18em;
  font-size: 18px;
  color: var(--cyan);
  text-shadow: 0 0 6px rgba(0, 240, 255, 0.5);
  position: relative;
}
.brand-glitch::before, .brand-glitch::after {
  content: attr(data-text);
  position: absolute; top: 0; left: 0;
  width: 100%; opacity: 0.7; pointer-events: none;
  mix-blend-mode: screen;
}
.brand-glitch::before { color: var(--magenta); transform: translate(1px, 0); clip-path: inset(0 0 60% 0); }
.brand-glitch::after  { color: var(--green);   transform: translate(-1px, 0); clip-path: inset(60% 0 0 0); }
.brand-sub {
  font-size: 10px; color: var(--text-dim); letter-spacing: 0.32em; margin-top: 4px;
}

.status-strip {
  display: flex; align-items: center; gap: 18px;
  padding: 6px 12px;
  background: rgba(8, 16, 30, 0.6);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.stat { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 56px; }
.stat-label { font-size: 9px; letter-spacing: 0.22em; color: var(--text-dim); text-transform: uppercase; }
.stat-label.ok { color: var(--green); }
.stat-label.warn { color: var(--yellow); }
.stat-value {
  font-family: 'Orbitron', monospace; font-weight: 700; font-size: 16px;
  color: var(--cyan); letter-spacing: 0.06em;
}
.stat-value.pill {
  padding: 2px 8px; border: 1px solid currentColor; border-radius: 999px;
  font-size: 11px; letter-spacing: 0.2em;
}
.stat-value.pill[data-state="boot"]   { color: var(--yellow); }
.stat-value.pill[data-state="up"]     { color: var(--green); box-shadow: 0 0 10px rgba(0,255,157,0.3) inset; }
.stat-value.pill[data-state="down"]   { color: var(--red); }

/* ---------- layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 320px 1fr 360px;
  height: calc(100vh - 56px - 28px);
  min-height: 0;
}

.sidebar, .detail {
  background: rgba(8, 16, 30, 0.82);
  border: 1px solid var(--line);
  border-top: 0; border-bottom: 0;
  display: flex; flex-direction: column; min-height: 0;
}
.sidebar { border-left: 0; }
.detail  { border-right: 0; }

.panel-head {
  padding: 10px 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(0,240,255,0.05), transparent 60%);
}
.panel-head h2 {
  margin: 0;
  font-family: 'Orbitron', monospace; font-size: 12px; letter-spacing: 0.32em;
  color: var(--cyan); text-shadow: 0 0 4px rgba(0,240,255,0.4);
}
.panel-head .close {
  background: transparent; border: 1px solid var(--line); color: var(--text-dim);
  width: 24px; height: 24px; border-radius: 4px; cursor: pointer; font-size: 16px; line-height: 1;
}
.panel-head .close:hover { color: var(--pink); border-color: var(--pink); }

#workspace-filter {
  background: rgba(0,0,0,0.45); color: var(--text);
  border: 1px solid var(--line); border-radius: 3px; padding: 4px 6px;
  font-family: inherit; font-size: 11px; max-width: 130px;
}
#workspace-filter:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 6px rgba(0,240,255,0.4); }

/* ---------- workspace list ---------- */
.workspace-list { list-style: none; padding: 0; margin: 0; overflow-y: auto; flex: 1; }
.workspace-list .loading { padding: 14px; color: var(--text-dim); }

.workspace {
  border-bottom: 1px solid var(--line);
}
.workspace > .ws-head {
  display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px; align-items: center;
  padding: 9px 14px; cursor: pointer; user-select: none;
  transition: background 0.15s;
}
.workspace > .ws-head:hover { background: rgba(0, 240, 255, 0.06); }
.workspace.open > .ws-head { background: rgba(0, 240, 255, 0.1); }
.workspace.ws-hidden > .ws-head .ws-name { color: var(--text-dim); text-decoration: line-through; opacity: 0.6; }
.ws-eye {
  background: transparent; border: 1px solid var(--line); border-radius: 3px;
  width: 20px; height: 20px; padding: 0; cursor: pointer;
  color: var(--text-dim); font-size: 12px; line-height: 1;
}
.ws-eye:hover { color: var(--cyan); border-color: var(--cyan); }
.ws-eye.on { color: var(--cyan); border-color: rgba(0,240,255,0.35); box-shadow: 0 0 4px rgba(0,240,255,0.25); }
.ws-name {
  color: var(--text); font-size: 12px; letter-spacing: 0.04em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ws-counts { display: flex; gap: 4px; }
.badge {
  font-size: 9px; letter-spacing: 0.12em; padding: 1px 6px;
  border-radius: 999px; border: 1px solid var(--line);
  color: var(--text-dim); background: rgba(0,0,0,0.3);
}
.badge.drone { color: var(--cyan); border-color: rgba(0,240,255,0.4); }
.badge.dock  { color: var(--magenta); border-color: rgba(255,43,214,0.4); }
.badge.live  { color: var(--green); border-color: rgba(0,255,157,0.5); box-shadow: 0 0 6px rgba(0,255,157,0.35); }

.ws-chevron { color: var(--text-dim); font-size: 10px; transition: transform 0.15s; }
.workspace.open .ws-chevron { transform: rotate(90deg); color: var(--cyan); }

.ws-children { display: none; padding: 4px 0 8px 26px; }
.workspace.open .ws-children { display: block; }
.drone-item {
  display: grid; grid-template-columns: 14px 1fr auto; gap: 8px; align-items: center;
  padding: 5px 12px 5px 6px; cursor: pointer; border-radius: 3px;
  font-size: 11.5px; color: var(--text-dim);
}
.drone-item:hover { background: rgba(0,240,255,0.08); color: var(--text); }
.drone-item.active { background: rgba(0,240,255,0.14); color: var(--cyan); }
.drone-item .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim);
  border: 1px solid currentColor;
}
.drone-item.online .dot   { background: var(--green); box-shadow: 0 0 6px var(--green); }
.drone-item.offline .dot  { background: transparent; border-color: var(--text-dim); }
.drone-item .role {
  font-size: 9px; padding: 1px 6px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--text-dim);
}
.drone-item .drone-owner {
  display: block; font-size: 9.5px; color: var(--cyan-soft);
  opacity: 0.85; letter-spacing: 0.03em;
}
.drone-item .role.drone { color: var(--cyan); border-color: rgba(0,240,255,0.35); }
.drone-item .role.dock  { color: var(--magenta); border-color: rgba(255,43,214,0.35); }
.drone-item .role.rc    { color: var(--yellow); border-color: rgba(255,212,0,0.35); }

/* ---------- map ---------- */
.map-area { position: relative; background: var(--bg-0); }
#map { position: absolute; inset: 0; background: #03050b; }
.leaflet-container { background: #03050b !important; font-family: inherit; }
.leaflet-control-attribution {
  background: rgba(8,16,30,0.75) !important;
  color: var(--text-dim) !important;
  font-size: 9px !important;
  border-top: 1px solid var(--line);
}
.leaflet-control-attribution a { color: var(--cyan-soft) !important; }
.leaflet-control-zoom a {
  background: rgba(8,16,30,0.85) !important;
  color: var(--cyan) !important;
  border: 1px solid var(--line) !important;
}
.leaflet-control-zoom a:hover {
  background: rgba(0,240,255,0.18) !important;
  border-color: var(--cyan) !important;
}

.map-overlay {
  position: absolute; z-index: 500;
  background: rgba(8, 16, 30, 0.85);
  border: 1px solid var(--line);
  border-radius: 4px;
  backdrop-filter: blur(4px);
  font-size: 11px;
}
.map-overlay.top-left    { top: 12px; left: 56px; padding: 8px 10px; }
.map-overlay.top-right   { top: 12px; right: 12px; padding: 4px; display: flex; gap: 4px; }
.map-overlay.bottom-left { bottom: 28px; left: 12px; padding: 8px 10px; }

.legend-row { display: flex; align-items: center; gap: 8px; line-height: 1.7; color: var(--text-dim); }
.legend-dot {
  width: 10px; height: 10px; border-radius: 50%; border: 1px solid currentColor;
}
.legend-dot.drone { background: var(--cyan); box-shadow: 0 0 6px var(--cyan); color: var(--cyan); }
.legend-dot.dock  { background: var(--magenta); color: var(--magenta); border-radius: 2px; }
.legend-dot.rc    { background: var(--orange); color: var(--orange); border-radius: 2px;
  box-shadow: 0 0 6px var(--orange); }
.legend-dot.home  { background: transparent; color: var(--green); width: 11px; height: 11px;
  transform: rotate(45deg); border-radius: 0; box-shadow: 0 0 4px var(--green) inset; }
.legend-dot.poi   { background: var(--yellow); color: var(--yellow); border-radius: 2px; }
.legend-dot.gps-est { background: var(--purple); color: var(--purple); box-shadow: 0 0 6px var(--purple); }

.toggle {
  background: transparent; color: var(--text-dim); border: 1px solid var(--line);
  border-radius: 3px; padding: 5px 9px; font-family: inherit; font-size: 10px;
  letter-spacing: 0.18em; cursor: pointer;
}
.toggle:hover { color: var(--cyan); border-color: var(--cyan); }
.toggle.on { color: var(--cyan); border-color: var(--cyan); box-shadow: 0 0 6px rgba(0,240,255,0.3); }
.toggle-sep { width: 1px; align-self: stretch; background: var(--line); margin: 2px 2px; }

/* ---------- markers ---------- */
.drone-marker {
  width: 18px; height: 18px;
  position: relative;
}
.drone-marker .core {
  position: absolute; inset: 4px; border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan), 0 0 20px var(--cyan);
}
.drone-marker .ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1px solid var(--cyan); opacity: 0.7;
  animation: pulse 1.6s ease-out infinite;
}
.drone-marker.dock .core { background: var(--magenta); box-shadow: 0 0 10px var(--magenta), 0 0 20px var(--magenta); }
.drone-marker.dock .ring { border-color: var(--magenta); }
.drone-marker.offline .core { background: var(--text-dim); box-shadow: none; opacity: 0.6; }
.drone-marker.offline .ring { animation: none; opacity: 0.2; }
.drone-marker.gps-est .core { background: var(--purple); box-shadow: 0 0 10px var(--purple), 0 0 20px var(--purple); }
.drone-marker.gps-est .ring { border-color: var(--purple); }

/* RC controller marker — small "handheld" body with an antenna */
.rc-marker {
  width: 18px; height: 20px; position: relative;
}
.rc-marker .rc-body {
  position: absolute; left: 3px; top: 8px; width: 12px; height: 9px;
  background: var(--orange); border-radius: 2px;
  box-shadow: 0 0 6px var(--orange), 0 0 12px rgba(255,154,60,0.5);
}
.rc-marker .rc-ant {
  position: absolute; left: 8px; top: 0; width: 2px; height: 9px;
  background: var(--orange); box-shadow: 0 0 4px var(--orange);
}
.rc-marker .rc-ant::after {
  content: ""; position: absolute; left: -2px; top: -3px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--orange); box-shadow: 0 0 6px var(--orange);
}
.rc-marker.offline .rc-body,
.rc-marker.offline .rc-ant,
.rc-marker.offline .rc-ant::after {
  background: var(--text-dim); box-shadow: none; opacity: 0.6;
}
.rc-marker.gps-est .rc-body,
.rc-marker.gps-est .rc-ant,
.rc-marker.gps-est .rc-ant::after {
  background: var(--purple); box-shadow: 0 0 6px var(--purple);
}
@keyframes pulse {
  0%   { transform: scale(0.6); opacity: 0.9; }
  100% { transform: scale(2.8); opacity: 0; }
}

.home-marker {
  width: 14px; height: 14px;
  background: transparent;
  border: 2px solid var(--green);
  transform: rotate(45deg);
  box-shadow: 0 0 6px rgba(0,255,157,0.6);
}
.home-marker.poi { border-color: var(--yellow); box-shadow: 0 0 6px rgba(255,212,0,0.5); }
.home-marker.gps-est { border-color: var(--purple); box-shadow: 0 0 6px var(--purple); }
.home-marker.poi.gps-est { border-color: var(--purple); box-shadow: 0 0 6px var(--purple); }

/* ---------- detail panel ---------- */
.detail-body { padding: 12px 14px 18px; overflow-y: auto; flex: 1; }
.detail-body .hint { color: var(--text-dim); line-height: 1.6; }
.detail-section {
  margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px dashed var(--line);
}
.detail-section h3 {
  margin: 0 0 8px; font-family: 'Orbitron', monospace; font-size: 10px;
  letter-spacing: 0.3em; color: var(--magenta);
}
.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.kv { display: flex; flex-direction: column; gap: 1px; }
.kv-key { color: var(--text-dim); font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase; }
.kv-val { color: var(--text); font-size: 13px; font-family: 'Orbitron', monospace; letter-spacing: 0.04em; }
.kv-val.cyan { color: var(--cyan); }
.kv-val.mag  { color: var(--magenta); }
.kv-val.green { color: var(--green); }
.kv-val.warn { color: var(--yellow); }
.kv-val.bad  { color: var(--red); }

.battery { display: flex; align-items: center; gap: 8px; }
.battery-bar {
  flex: 1; height: 8px; background: rgba(255,255,255,0.06);
  border: 1px solid var(--line); border-radius: 2px; overflow: hidden;
}
.battery-fill {
  height: 100%; background: linear-gradient(90deg, var(--green), var(--cyan));
  box-shadow: 0 0 6px rgba(0,255,157,0.6);
  width: 0%;
  transition: width 0.4s;
}
.battery-fill.low { background: linear-gradient(90deg, var(--yellow), var(--pink)); }
.battery-fill.crit { background: linear-gradient(90deg, var(--red), var(--pink)); }

pre.osd-raw {
  margin: 6px 0 0; padding: 8px;
  font-size: 10.5px; line-height: 1.4;
  color: var(--text-dim);
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--line); border-radius: 3px;
  max-height: 220px; overflow: auto;
  white-space: pre-wrap; word-break: break-word;
}

.title-online::before {
  content: "● "; color: var(--green); text-shadow: 0 0 6px var(--green);
}
.title-offline::before {
  content: "○ "; color: var(--text-dim);
}

/* ---------- bottombar ---------- */
.bottombar {
  height: 28px;
  display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: rgba(8,16,30,0.92); border-top: 1px solid var(--line-hot);
  font-size: 11px; color: var(--text-dim); letter-spacing: 0.06em;
}
.bottombar .spacer { flex: 1; }

/* ---------- scrollbars ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,240,255,0.18); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,240,255,0.4); }

/* ---------- live video card ---------- */
.video-card {
  position: absolute; z-index: 600;
  top: 60px; right: 12px;
  width: 360px; max-width: 60vw;
  background: rgba(4, 6, 13, 0.96);
  border: 1px solid var(--cyan);
  border-radius: 5px;
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.45), 0 6px 30px rgba(0,0,0,0.6);
  display: flex; flex-direction: column;
  overflow: hidden;
  user-select: none;
}
.video-card.large { width: 720px; max-width: 92vw; }
.video-card.minimized .video-body,
.video-card.minimized .video-controls,
.video-card.minimized .video-foot { display: none; }
.video-card.minimized .video-head { border-bottom: 0; }
.video-head {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  background: linear-gradient(90deg, rgba(0,240,255,0.15), transparent 70%);
  border-bottom: 1px solid var(--line);
  cursor: move;
  font-family: 'Orbitron', monospace; font-size: 10px; letter-spacing: 0.22em;
}
.video-head .video-title { color: var(--cyan); display: block; }
.video-head .video-title-block { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.video-head .video-meta {
  display: block; color: var(--text-dim); font-size: 9px;
  letter-spacing: 0.16em; text-transform: none;
}
.video-head .spacer { flex: 1; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.seg-btn {
  background: transparent; color: var(--text-dim); border: 0;
  padding: 2px 8px; font-family: inherit; font-size: 10px; letter-spacing: 0.18em;
  cursor: pointer;
}
.seg-btn + .seg-btn { border-left: 1px solid var(--line); }
.seg-btn:hover { color: var(--cyan); }
.seg-btn.on {
  color: var(--bg-0); background: var(--cyan);
  text-shadow: 0 0 4px rgba(255,255,255,0.4);
}
.video-led {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--text-dim); transition: background 0.2s, box-shadow 0.2s;
}
.video-led.live { background: var(--red); box-shadow: 0 0 6px var(--red); animation: blink 1.4s infinite; }
.video-led.warm { background: var(--yellow); box-shadow: 0 0 6px var(--yellow); }
@keyframes blink { 50% { opacity: 0.35; } }

.vbtn {
  background: transparent; color: var(--text-dim); border: 1px solid var(--line);
  padding: 2px 8px; font-family: inherit; font-size: 10px; letter-spacing: 0.18em;
  border-radius: 3px; cursor: pointer;
}
.vbtn:hover { color: var(--cyan); border-color: var(--cyan); }
.vbtn.close:hover { color: var(--pink); border-color: var(--pink); }
#video-start:hover { color: var(--green); border-color: var(--green); }
#video-stop:hover  { color: var(--pink);  border-color: var(--pink);  }

.video-body {
  position: relative;
  background: #000;
  aspect-ratio: 16 / 9;
}
.video-body video {
  width: 100%; height: 100%; object-fit: contain; display: block; background: #000;
}
.video-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  color: var(--text-dim);
  text-shadow: 0 0 6px rgba(0,0,0,0.8);
  background:
    repeating-linear-gradient(45deg, rgba(0,240,255,0.05) 0 10px, transparent 10px 20px),
    rgba(0,0,0,0.55);
  pointer-events: none;
  text-align: center; padding: 0 16px;
}
.video-overlay.hidden { display: none; }
.video-overlay.error { color: var(--pink); }

/* center crosshair (+) drawn over the video stream */
.video-crosshair {
  position: absolute;
  top: 50%; left: 50%;
  width: 28px; height: 28px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0.85;
}
.video-crosshair::before,
.video-crosshair::after {
  content: "";
  position: absolute;
  background: var(--cyan);
  box-shadow: 0 0 4px rgba(0,240,255,0.6), 0 0 1px rgba(0,0,0,0.9);
}
.video-crosshair::before { /* horizontal */
  top: 50%; left: 0; right: 0; height: 1.5px;
  transform: translateY(-50%);
}
.video-crosshair::after {  /* vertical */
  left: 50%; top: 0; bottom: 0; width: 1.5px;
  transform: translateX(-50%);
}

.video-foot {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 8px;
  border-top: 1px solid var(--line);
  background: rgba(8,16,30,0.6);
  font-size: 10px; letter-spacing: 0.16em; color: var(--text-dim);
}
.video-foot .spacer { flex: 1; }

.video-controls {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 8px;
  border-top: 1px solid var(--line);
  background: rgba(8,16,30,0.45);
  font-family: 'Orbitron', monospace; font-size: 9px; letter-spacing: 0.2em;
  color: var(--text-dim);
}
.video-controls .spacer { flex: 1; }
.video-controls .vc-group { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.video-controls .vc-label { color: var(--text-dim); opacity: 0.85; }
.seg-btn.small { padding: 2px 6px; font-size: 9px; letter-spacing: 0.14em; }
.seg-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.seg-btn:disabled:hover { color: var(--text-dim); }

.vc-select {
  background: rgba(0,0,0,0.55); color: var(--text);
  border: 1px solid var(--line); border-radius: 3px;
  padding: 2px 6px; font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 0.04em;
  max-width: 180px;
}
.vc-select:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 6px rgba(0,240,255,0.4); }
.vc-select option { background: #06090f; color: var(--text); }

.modal-advanced {
  border: 1px solid var(--line); border-radius: 3px;
  padding: 6px 10px; font-size: 11px; color: var(--text-dim);
}
.modal-advanced summary {
  cursor: pointer; font-family: 'Orbitron', monospace; font-size: 10px;
  letter-spacing: 0.2em; color: var(--text-dim);
}
.modal-advanced summary:hover { color: var(--cyan); }
.modal-advanced[open] { padding-bottom: 10px; }
.modal-advanced .modal-label { display: block; margin-top: 8px; }
.modal-advanced input { width: 100%; margin-top: 2px; }

/* live-feed section in the detail panel */
.live-action { display: flex; gap: 6px; align-items: center; }
.btn-live {
  font-family: 'Orbitron', monospace; font-size: 11px; letter-spacing: 0.22em;
  color: var(--cyan); background: transparent; border: 1px solid var(--cyan);
  padding: 6px 10px; border-radius: 3px; cursor: pointer;
  box-shadow: 0 0 8px rgba(0,240,255,0.25);
}
.btn-live:hover { color: var(--bg-0); background: var(--cyan); }
.btn-live.streaming { color: var(--red); border-color: var(--red); box-shadow: 0 0 8px rgba(255,51,85,0.35); }
.btn-live.streaming:hover { color: var(--bg-0); background: var(--red); }
.btn-live.off { color: var(--text-dim); border-color: var(--line-hot); box-shadow: none; }
.btn-live.off:hover { color: var(--cyan); border-color: var(--cyan); background: transparent; }

.los-slider-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.los-slider-row .kv-key { min-width: 40px; }
.los-slider-row #los-dist-slider {
  flex: 1; appearance: none; -webkit-appearance: none;
  height: 3px; background: var(--line-hot); border-radius: 2px; outline: none;
}
.los-slider-row #los-dist-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--cyan); cursor: pointer;
  box-shadow: 0 0 6px rgba(0,240,255,0.5);
}
.los-slider-row #los-dist-slider::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%; border: 0;
  background: var(--cyan); cursor: pointer;
  box-shadow: 0 0 6px rgba(0,240,255,0.5);
}
.los-slider-row #los-dist-readout { min-width: 56px; text-align: right; font-size: 12px; }

/* distance-measure tooltip on the yellow drone→point line */
.leaflet-tooltip.measure-tooltip {
  background: rgba(8,16,30,0.92);
  border: 1px solid var(--yellow);
  color: var(--yellow);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  letter-spacing: 0.06em;
  box-shadow: 0 0 8px rgba(255,212,0,0.4);
}
.leaflet-tooltip.measure-tooltip:before { display: none; }

/* leaflet popup */
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: rgba(8,16,30,0.95) !important;
  color: var(--text) !important;
  border: 1px solid var(--cyan);
  box-shadow: 0 0 10px rgba(0,240,255,0.3);
  border-radius: 4px !important;
}
.leaflet-popup-content { font-family: inherit !important; font-size: 11px !important; margin: 8px 12px !important; }
.leaflet-popup-content b { color: var(--cyan); letter-spacing: 0.06em; }
.leaflet-popup-content .dim { color: var(--text-dim); }
.leaflet-popup-content .err { color: var(--red); }
.leaflet-popup-close-button { color: var(--text-dim) !important; }

/* unbind / confirmation modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(2, 4, 12, 0.78);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
}
.modal-backdrop[hidden] { display: none; }
.modal-card {
  width: min(420px, 92vw);
  background: linear-gradient(180deg, rgba(13,24,48,0.98), rgba(8,16,30,0.98));
  border: 1px solid var(--red);
  box-shadow: 0 0 24px rgba(255,51,85,0.35), 0 0 4px rgba(255,51,85,0.6) inset;
  border-radius: 6px;
  display: flex; flex-direction: column;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--line-hot);
  background: linear-gradient(90deg, rgba(255,51,85,0.12), transparent 70%);
}
.modal-head h2 {
  margin: 0;
  font-family: 'Orbitron', monospace; font-size: 12px; letter-spacing: 0.32em;
  color: var(--red); text-shadow: 0 0 4px rgba(255,51,85,0.5);
}
.modal-head .close {
  background: transparent; border: 1px solid var(--line); color: var(--text-dim);
  width: 24px; height: 24px; border-radius: 4px; cursor: pointer; font-size: 16px; line-height: 1;
}
.modal-head .close:hover { color: var(--red); border-color: var(--red); }
.modal-body { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.modal-warn { margin: 0; font-size: 12px; line-height: 1.5; color: var(--text); }
.modal-hint { margin: 0; font-size: 11px; color: var(--text-dim); letter-spacing: 0.04em; }
.modal-label {
  font-family: 'Orbitron', monospace; font-size: 9px; letter-spacing: 0.22em;
  color: var(--text-dim); text-transform: uppercase;
}
.modal-body input {
  background: rgba(0,0,0,0.55); color: var(--text);
  border: 1px solid var(--line-hot); border-radius: 3px; padding: 8px 10px;
  font-family: 'JetBrains Mono', monospace; font-size: 13px; letter-spacing: 0.04em;
}
.modal-body input:focus {
  outline: none; border-color: var(--cyan); box-shadow: 0 0 6px rgba(0,240,255,0.4);
}
.modal-error {
  font-size: 11px; color: var(--red); letter-spacing: 0.04em;
}
.modal-foot {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 10px 14px; border-top: 1px solid var(--line);
  background: rgba(8,16,30,0.6);
}
.btn-modal {
  font-family: 'Orbitron', monospace; font-size: 11px; letter-spacing: 0.22em;
  color: var(--cyan); background: transparent; border: 1px solid var(--line-hot);
  padding: 6px 14px; border-radius: 3px; cursor: pointer;
}
.btn-modal:hover { color: var(--bg-0); background: var(--cyan); border-color: var(--cyan); }
.btn-modal.danger { color: var(--red); border-color: var(--red); box-shadow: 0 0 8px rgba(255,51,85,0.3); }
.btn-modal.danger:hover { color: var(--bg-0); background: var(--red); }
.btn-modal:disabled {
  opacity: 0.45; cursor: not-allowed;
  box-shadow: none;
}
.btn-modal:disabled:hover { color: var(--red); background: transparent; border-color: var(--red); }

/* danger variant of detail-panel action buttons (e.g. UNBIND) */
.btn-live.danger {
  color: var(--red); border-color: var(--red); box-shadow: 0 0 8px rgba(255,51,85,0.25);
}
.btn-live.danger:hover { color: var(--bg-0); background: var(--red); }

/* map right-click context menu */
.map-ctx-menu {
  position: fixed;
  z-index: 1000;
  min-width: 160px;
  background: rgba(8,16,30,0.96);
  border: 1px solid var(--cyan);
  box-shadow: 0 0 10px rgba(0,240,255,0.3);
  border-radius: 4px;
  padding: 4px 0;
  font-family: 'JetBrains Mono', monospace;
}
.map-ctx-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--text);
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.08em;
  padding: 6px 12px;
  cursor: pointer;
}
.map-ctx-item:hover { background: rgba(0,240,255,0.12); color: var(--cyan); }
