:root {
  --bg: #0e1116;
  --panel: #171c24;
  --panel-2: #1f2630;
  --text: #e8ecf1;
  --muted: #8b96a5;
  --line: #2a323d;
  --accent: #ff5a4f;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button { font: inherit; color: inherit; cursor: pointer; }
#map { position: fixed; inset: 0; background: var(--bg); }

#topbar { position: fixed; top: 0; left: 0; right: 0; z-index: 1000; display: flex; align-items: center; gap: 12px;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px; background: linear-gradient(var(--bg), transparent);
  pointer-events: none; }
#topbar > * { pointer-events: auto; }
#topbar h1 { font-size: 17px; margin: 0; letter-spacing: .02em; }
#views { display: flex; gap: 6px; flex-wrap: wrap; }
#views button { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 13px; }
#views button:hover { border-color: var(--muted); }

#panel { position: fixed; top: 54px; left: 12px; z-index: 1000; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px; display: grid; gap: 8px; font-size: 14px; max-width: 220px; }
#panel label { display: flex; align-items: center; gap: 8px; }
#panel label.select { display: grid; gap: 4px; color: var(--muted); font-size: 12px; }
#panel select { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 5px; }
#panel summary { cursor: pointer; color: var(--muted); font-size: 12px; }
#legend { display: grid; gap: 4px; margin-top: 6px; font-size: 12px; color: var(--muted); }
#legend div { display: flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.ship { background: #ff9f1c; } .dot.drone { background: var(--accent); }

#report-btn { position: fixed; z-index: 1001; right: 16px; bottom: calc(20px + env(safe-area-inset-bottom));
  background: var(--accent); color: #fff; border: 0; border-radius: 999px; padding: 14px 22px; font-weight: 600; font-size: 16px;
  box-shadow: 0 6px 20px rgba(0,0,0,.45); }
body.reporting #report-btn { display: none; }

#sheet { position: fixed; z-index: 1002; left: 0; right: 0; bottom: 0; max-width: 520px; margin: 0 auto;
  background: var(--panel); border: 1px solid var(--line); border-bottom: 0; border-radius: 16px 16px 0 0;
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); display: grid; gap: 10px; max-height: 70vh; overflow-y: auto; }
#sheet[hidden] { display: none; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
#sheet-close { background: none; border: 0; font-size: 18px; color: var(--muted); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.small-label { color: var(--muted); font-size: 12px; justify-content: flex-start; margin-bottom: -4px; }
#where-text.set { color: #6ee7a0; }
#use-location { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; white-space: nowrap; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }
.chips button.on { border-color: var(--accent); background: #3a1f1f; }
#kind-row button { flex: 1 1 calc(33% - 6px); text-align: center; min-height: 52px; }
#kind-row small { display: block; color: var(--muted); font-size: 11px; }
#more summary { cursor: pointer; color: var(--muted); font-size: 13px; padding: 4px 0; }
#more { display: grid; gap: 8px; }
#more[open] > * { margin-top: 8px; }
#count { width: 70px; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
#note { width: 100%; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 9px; }
#error { color: #ff8a80; min-height: 0; font-size: 13px; }
#send { background: var(--accent); border: 0; border-radius: 12px; padding: 13px; font-weight: 600; font-size: 16px; color: #fff; }
#send:disabled { background: var(--panel-2); color: var(--muted); cursor: not-allowed; }
.fine { color: var(--muted); font-size: 11px; margin: 0; }

#toast { position: fixed; z-index: 2000; left: 50%; bottom: 90px; transform: translateX(-50%); background: #123524; color: #bff5d4;
  border: 1px solid #1f6b46; border-radius: 10px; padding: 10px 16px; opacity: 0; pointer-events: none; transition: opacity .25s; }
#toast.show { opacity: 1; }

/* Leaflet popup, dark */
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel); color: var(--text); }
.leaflet-popup-content { margin: 12px 14px; font-size: 13px; line-height: 1.45; }
.leaflet-popup-content h3 { margin: 0 0 4px; font-size: 15px; }
.leaflet-popup-content .meta { color: var(--muted); }
.leaflet-popup-content a { color: #7cc4ff; }
.leaflet-popup-content button { margin-top: 8px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.badge { display: inline-block; background: #3a2f10; color: #ffd166; border-radius: 6px; padding: 1px 6px; font-size: 11px; margin-bottom: 4px; }
.leaflet-container.picking { cursor: crosshair; }
.dark-tiles { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9) saturate(.6); }
.leaflet-container { background: #0e1116; }
.drone-icon { background: none; border: 0; }

@media (max-width: 520px) {
  #topbar h1 { display: none; }
  #panel { top: 50px; }
}
