  :root {
    --panel: rgba(17, 24, 39, .84);
    --panel-border: rgba(255,255,255,.12);
    --text: #e5e7eb;
    --muted: #9ca3af;
    --accent: #38bdf8;
  }
  * { box-sizing: border-box; }
  html, body, #map { height: 100%; margin: 0; font-family: -apple-system, "Segoe UI", Roboto, Inter, sans-serif; }
  #map { background: #0b1220; }

  .panel {
    position: absolute; z-index: 1000; color: var(--text);
    background: var(--panel); border: 1px solid var(--panel-border);
    border-radius: 14px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 8px 30px rgba(0,0,0,.45);
  }

  #sidebar { top: 12px; left: 12px; width: 320px; max-height: calc(100% - 24px);
    display: flex; flex-direction: column; overflow: hidden; }
  #sidebar header { padding: 14px 16px 10px; border-bottom: 1px solid var(--panel-border); position: relative; }
  #sidebar h1 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: .3px; }
  #sidebar h1 span { color: var(--accent); }
  #sidebar .sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
  #sidebar .body { padding: 10px 16px 14px; overflow-y: auto; }
  #sidebar .body::-webkit-scrollbar { width: 6px; }
  #sidebar .body::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 3px; }

  h3 { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 14px 0 6px; }
  h3:first-child { margin-top: 2px; }

  .toggle { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 13px; cursor: pointer; }
  .toggle input { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }
  .toggle .dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }

  input[type=range] { width: 100%; accent-color: var(--accent); }

  .basemaps { display: flex; gap: 6px; }
  .basemaps button { flex: 1; padding: 6px 4px; font-size: 11px; border-radius: 8px; cursor: pointer;
    background: rgba(255,255,255,.07); color: var(--text); border: 1px solid var(--panel-border); }
  .basemaps button.active { background: var(--accent); color: #082f49; font-weight: 700; border-color: transparent; }

  #search { width: 100%; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--panel-border);
    background: rgba(255,255,255,.07); color: var(--text); font-size: 12px; outline: none; margin-bottom: 6px; }
  #search::placeholder { color: var(--muted); }

  .grp { margin-bottom: 2px; }
  .grp-head { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700;
    color: var(--text); padding: 6px 4px 3px; cursor: pointer; user-select: none; }
  .grp-head .chev { color: var(--muted); font-size: 9px; transition: transform .15s; }
  .grp.closed .chev { transform: rotate(-90deg); }
  .grp.closed .grp-units { display: none; }
  .grp-head .gsw { width: 10px; height: 10px; border-radius: 2px; }

  .unit { display: flex; align-items: center; gap: 7px; padding: 3px 6px 3px 14px; font-size: 12px;
    border-radius: 6px; cursor: pointer; }
  .unit:hover { background: rgba(255,255,255,.08); }
  .unit.off { opacity: .32; }
  .unit.sel { background: rgba(56,189,248,.18); }
  .unit i { width: 13px; height: 13px; border-radius: 3px; flex: none; border: 1px solid rgba(0,0,0,.4); }
  .unit .code { font-weight: 700; min-width: 44px; }
  .unit .uname { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
  .unit .eye { color: var(--muted); font-size: 11px; padding: 0 2px; }
  .unit-actions { display: flex; gap: 10px; margin: 4px 0 6px; }
  .unit-actions a { font-size: 11px; color: var(--accent); cursor: pointer; }

  /* Detail panel */
  #detail { bottom: 12px; right: 12px; width: 360px; max-height: 46vh; overflow-y: auto;
    padding: 14px 16px; font-size: 12.5px; line-height: 1.55; display: none; }
  #detail h4 { margin: 0 0 2px; font-size: 15px; color: var(--accent); }
  #detail .code-chip { display: inline-block; padding: 1px 8px; border-radius: 20px; font-weight: 700;
    font-size: 11px; color: #0b1220; margin-right: 6px; vertical-align: 1px; }
  #detail .meta { color: var(--muted); font-size: 11.5px; margin: 4px 0 8px; }
  #detail .meta b { color: var(--text); }
  #detail .lith { color: var(--text); }
  #detail .warn { margin-top: 8px; padding: 6px 9px; border-radius: 8px; font-size: 11px;
    background: rgba(251,191,36,.12); color: #fcd34d; border: 1px solid rgba(251,191,36,.3); }
  #detail .close { position: absolute; top: 8px; right: 12px; cursor: pointer; color: var(--muted);
    font-size: 15px; pointer-events: auto; }
  #detail .src { margin-top: 8px; font-size: 10.5px; color: var(--muted); }

  #info { top: 12px; right: 12px; width: 250px; padding: 12px 14px; font-size: 12px; display: none; pointer-events: none; }
  #info h4 { margin: 0 0 6px; font-size: 13px; color: var(--accent); }
  #info .kv { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; color: var(--muted); }
  #info .kv b { color: var(--text); font-weight: 600; text-align: right; }

  #collapse { position: absolute; top: 10px; right: 10px; background: none; border: none;
    color: var(--muted); cursor: pointer; font-size: 14px; }

  .leaflet-container .leaflet-control-attribution { background: rgba(17,24,39,.7); color: var(--muted); }
  .leaflet-container .leaflet-control-attribution a { color: var(--accent); }
  .leaflet-control-zoom { border: none !important; }
  .leaflet-control-zoom a { background: var(--panel) !important; color: var(--text) !important;
    border: 1px solid var(--panel-border) !important; backdrop-filter: blur(8px); }
  .leaflet-control-scale-line { background: rgba(17,24,39,.7); color: var(--text); border-color: var(--muted); }

  .dzo-label { background: none; border: none; box-shadow: none; color: #fff; font-weight: 700;
    font-size: 11px; text-shadow: 0 0 4px #000, 0 0 4px #000; text-transform: uppercase; letter-spacing: .5px; }

  .leaflet-popup-content-wrapper { background: var(--panel); color: var(--text); border-radius: 10px;
    backdrop-filter: blur(10px); border: 1px solid var(--panel-border); }
  .leaflet-popup-content { margin: 12px 16px; font-size: 12.5px; line-height: 1.5; max-height: 260px; overflow-y: auto; }
  .leaflet-popup-tip { background: rgba(17,24,39,.9); }
  .leaflet-popup-content b { color: var(--accent); }
  .leaflet-popup-content .pmeta { color: var(--muted); font-size: 11px; }
