:root {
  --bg: #07111f;
  --panel: rgba(11, 18, 32, .94);
  --panel2: rgba(30, 41, 59, .62);
  --line: rgba(255,255,255,.1);
  --text: #f8fafc;
  --muted: #94a3b8;
  --blue: #38bdf8;
  --yellow: #facc15;
  --green: #22c55e;
  --red: #ef4444;
}

html, body, #map {
  height: 100%;
  width: 100%;
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
}

#sidebar {
  position: absolute;
  top: 16px;
  left: 16px;
  bottom: 16px;
  width: 380px;
  max-width: calc(100vw - 32px);
  z-index: 1000;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 22px 70px rgba(0,0,0,.38);
  backdrop-filter: blur(12px);
  overflow-y: auto;
  transition: transform .22s ease;
}

#sidebar.collapsed {
  transform: translateX(calc(-100% - 22px));
}

.brand {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 18px 18px 8px;
  border-bottom: 1px solid var(--line);
}

h1, h2, p {
  margin: 0;
}

h1 {
  font-size: 22px;
  letter-spacing: -.03em;
}

h2 {
  font-size: 14px;
  margin-bottom: 10px;
  color: #e2e8f0;
}

.brand p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.status {
  font-size: 11px;
  font-weight: 800;
  background: rgba(148,163,184,.18);
  color: #cbd5e1;
  padding: 6px 9px;
  border-radius: 999px;
}

.status.online {
  background: rgba(34,197,94,.18);
  color: #86efac;
}

.status.saving {
  background: rgba(250,204,21,.18);
  color: #fde68a;
}

.status.error {
  background: rgba(239,68,68,.18);
  color: #fecaca;
}

.panel {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

label {
  display: block;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 700;
  margin: 9px 0 5px;
}

input, textarea, select {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(148,163,184,.24);
  background: rgba(15,23,42,.92);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 11px;
  outline: none;
}

textarea {
  resize: vertical;
}

button {
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 800;
  cursor: pointer;
  background: #f8fafc;
  color: #0f172a;
  box-shadow: 0 8px 18px rgba(0,0,0,.18);
}

button.secondary {
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid rgba(255,255,255,.09);
}

button.danger {
  background: #ef4444;
  color: white;
}

button:hover {
  filter: brightness(1.04);
}

.row {
  display: flex;
  gap: 8px;
}

.row > input {
  flex: 1;
}

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

.check {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 8px 0;
}

.check input {
  width: auto;
}

.muted, .hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  margin-top: 8px;
}

.hidden {
  display: none;
}

.metric {
  margin: 11px 0;
  background: rgba(56,189,248,.12);
  color: #bae6fd;
  border: 1px solid rgba(56,189,248,.22);
  border-radius: 12px;
  padding: 9px 10px;
  font-size: 12px;
}

.buttons {
  margin-top: 12px;
  flex-wrap: wrap;
}

#topbar {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 999;
  display: flex;
  gap: 8px;
  align-items: center;
  background: rgba(7,17,31,.86);
  color: white;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  padding: 8px;
  box-shadow: 0 14px 40px rgba(0,0,0,.28);
  backdrop-filter: blur(10px);
}

#topbar button {
  border-radius: 999px;
  padding: 8px 12px;
}

#measureOutput {
  color: #fde68a;
  font-size: 13px;
  font-weight: 800;
  padding-right: 10px;
}

.popup {
  min-width: 220px;
}

.popup .pname {
  display: block;
  font-size: 15px;
  margin-bottom: 5px;
}

.pmeta {
  color: #475569;
  font-size: 12px;
  margin-bottom: 6px;
}

.pnotes {
  font-size: 12px;
  color: #0f172a;
  white-space: pre-wrap;
  margin-bottom: 8px;
}

.popupBtns {
  display: flex;
  gap: 6px;
}

.popupBtns button {
  padding: 7px 9px;
  border-radius: 10px;
  background: #0f172a;
  color: white;
}

.marker {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  color: white;
  border: 2px solid white;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(0,0,0,.35);
  font-size: 13px;
}

.marker.camera { background: #2563eb; }
.marker.truck { background: #ef4444; }
.marker.power { background: #f59e0b; color: #111827; }
.marker.network { background: #06b6d4; color: #082f49; }
.marker.marshal { background: #16a34a; }
.marker.danger { background: #dc2626; }
.marker.note { background: #64748b; }
.marker.default { background: #334155; }

.cursor-label {
  background: rgba(15,23,42,.86);
  color: white;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

@media (max-width: 900px) {
  #topbar {
    left: 12px;
    right: 12px;
    top: auto;
    bottom: 12px;
    flex-wrap: wrap;
    border-radius: 18px;
  }

  #sidebar {
    width: 360px;
  }
}


.help-list {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.measure-point {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: #facc15;
  color: #0f172a;
  border: 2px solid white;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(0,0,0,.32);
}

.measure-point:hover {
  background: #fb7185;
  color: white;
}

.linked {
  color: #86efac;
  font-weight: 800;
}


/* v1.3 inline editor */
.inline-editor {
  width: 285px;
  color: #0f172a;
}

.inline-editor .ie-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.inline-editor .ie-title {
  font-weight: 900;
  font-size: 14px;
  line-height: 1.15;
  color: #0f172a;
}

.inline-editor .ie-badge {
  font-size: 10px;
  font-weight: 900;
  background: #e0f2fe;
  color: #075985;
  border-radius: 999px;
  padding: 4px 7px;
  white-space: nowrap;
}

.inline-editor label {
  display: block;
  color: #475569;
  font-size: 10px;
  font-weight: 900;
  margin: 7px 0 3px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.inline-editor input,
.inline-editor textarea,
.inline-editor select {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #cbd5e1;
  background: white;
  color: #0f172a;
  border-radius: 8px;
  padding: 7px 8px;
  font-size: 12px;
  outline: none;
}

.inline-editor textarea {
  resize: vertical;
  min-height: 64px;
}

.inline-editor .ie-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.inline-editor .ie-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 9px;
}

.inline-editor button {
  box-shadow: none;
  border-radius: 9px;
  padding: 7px 9px;
  font-size: 12px;
  background: #0f172a;
  color: white;
}

.inline-editor button.ie-danger {
  background: #dc2626;
}

.inline-editor .ie-metric {
  margin-top: 8px;
  padding: 7px 8px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 9px;
  color: #1e3a8a;
  font-size: 11px;
  line-height: 1.25;
}

.inline-editor .ie-autosave {
  margin-top: 7px;
  font-size: 11px;
  color: #64748b;
}

.inline-editor .ie-link {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 6px;
  font-size: 11px;
  color: #475569;
}

.inline-editor .ie-link input {
  width: auto;
}

.leaflet-popup-content {
  margin: 12px 14px;
}

.selected-feature-glow {
  filter: drop-shadow(0 0 10px rgba(250, 204, 21, .95));
}


/* v2.0 report/import UI */
#mapSelect {
  font-weight: 800;
}

.inline-editor .ie-wide {
  grid-column: 1 / -1;
}

.inline-editor .ie-smallnote {
  margin-top: 5px;
  color: #64748b;
  font-size: 10px;
}

.report-page {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f8fafc;
  color: #0f172a;
}

.report-wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px;
}

.report-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 20px;
  margin: 14px 0;
  box-shadow: 0 12px 40px rgba(15,23,42,.07);
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.report-stat {
  background: #f1f5f9;
  border-radius: 14px;
  padding: 15px;
}

.report-stat .k {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.report-stat .v {
  font-size: 26px;
  font-weight: 900;
  margin-top: 4px;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.report-table th,
.report-table td {
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
  padding: 8px;
  vertical-align: top;
}

.report-table th {
  color: #475569;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

@media print {
  #reportActions { display: none; }
  .report-card { box-shadow: none; }
}


/* v2.1 collaboration locks */
.inline-editor input:disabled,
.inline-editor textarea:disabled,
.inline-editor select:disabled {
  background: #f1f5f9;
  color: #64748b;
  cursor: not-allowed;
}


/* v2.2 tabs and wireless icons */
.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(11, 18, 32, .96);
  backdrop-filter: blur(10px);
}

.tabBtn {
  padding: 9px 5px;
  border-radius: 11px;
  font-size: 12px;
  box-shadow: none;
  background: rgba(30, 41, 59, .86);
  color: #cbd5e1;
}

.tabBtn.active {
  background: #f8fafc;
  color: #0f172a;
}

.tabPanel {
  display: none;
}

.tabPanel.active {
  display: block;
}

.panel.compact {
  padding-top: 10px;
  padding-bottom: 10px;
}

.quickGroupTitle {
  margin: 12px 0 7px;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.marker.wireless,
.marker.holyland_tx,
.marker.holyland_rx,
.marker.dji_sdr_tx,
.marker.dji_sdr_rx,
.marker.dji_tx,
.marker.dji_rx,
.marker.p2p_lan,
.marker.wireless_tx,
.marker.wireless_rx,
.marker.ap {
  background: #7c3aed;
}

.marker.holyland_tx,
.marker.holyland_rx {
  background: #9333ea;
}

.marker.dji_sdr_tx,
.marker.dji_sdr_rx,
.marker.dji_tx,
.marker.dji_rx {
  background: #0f766e;
}

.marker.p2p_lan {
  background: #0284c7;
}

.marker.ap {
  background: #16a34a;
}

.marker.wireless_tx {
  background: #ea580c;
}

.marker.wireless_rx {
  background: #0891b2;
}


/* v2.3 bottom equipment bar, inventory chips and wireless warnings */
#equipmentBottomBar {
  position: absolute;
  left: 430px;
  right: 18px;
  bottom: 18px;
  z-index: 990;
  background: rgba(7,17,31,.88);
  color: white;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 18px;
  box-shadow: 0 18px 60px rgba(0,0,0,.35);
  backdrop-filter: blur(10px);
  max-height: 190px;
  overflow: hidden;
  transition: max-height .2s ease, transform .2s ease;
}

#equipmentBottomBar.collapsed {
  max-height: 42px;
}

.equipHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.equipHead strong {
  font-size: 13px;
}

.equipHead button {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  box-shadow: none;
}

#equipmentList {
  padding: 8px 10px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  overflow-y: auto;
  max-height: 137px;
}

.equipChip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(30,41,59,.92);
  border: 1px solid rgba(255,255,255,.12);
  color: #e2e8f0;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.equipChip:hover,
.equipChip.active {
  background: #facc15;
  color: #111827;
}

.equipChip .count {
  background: rgba(255,255,255,.18);
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 10px;
}

.equipment-highlight {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 4px solid #facc15;
  box-shadow: 0 0 0 14px rgba(250,204,21,.28), 0 10px 30px rgba(0,0,0,.35);
}

.inventoryPicker {
  max-height: 120px;
  overflow-y: auto;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 6px;
  background: #f8fafc;
}

.inventoryPicker label {
  display: flex;
  gap: 6px;
  align-items: center;
  color: #0f172a;
  font-size: 11px;
  font-weight: 800;
  text-transform: none;
  letter-spacing: 0;
  margin: 4px 0;
}

.inventoryPicker input {
  width: auto;
}

.wirelessWarning {
  margin-top: 8px;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  color: #92400e;
  border-radius: 9px;
  padding: 7px 8px;
  font-size: 11px;
  font-weight: 800;
}

.wirelessOk {
  margin-top: 8px;
  background: #dcfce7;
  border: 1px solid #22c55e;
  color: #14532d;
  border-radius: 9px;
  padding: 7px 8px;
  font-size: 11px;
  font-weight: 800;
}

.rangeFieldGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

@media (max-width: 900px) {
  #equipmentBottomBar {
    left: 12px;
    right: 12px;
    bottom: 92px;
  }
}


/* v2.4 floating transparent draggable editor */
.floatingEditor {
  position: absolute;
  z-index: 1200;
  top: 120px;
  right: 90px;
  width: 360px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 120px);
  overflow: hidden;
  border-radius: 18px;
  background: rgba(255, 255, 255, .70);
  border: 1px solid rgba(15, 23, 42, .18);
  box-shadow: 0 22px 70px rgba(0,0,0,.32);
  backdrop-filter: blur(11px);
}

.floatingEditor.hidden {
  display: none;
}

.floatEditorHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  background: rgba(15, 23, 42, .86);
  color: white;
  cursor: move;
  user-select: none;
}

.floatEditorHeader strong {
  font-size: 13px;
  line-height: 1.2;
}

#floatEditorCloseBtn {
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(255,255,255,.16);
  color: white;
  box-shadow: none;
}

#floatingEditorBody {
  overflow: auto;
  max-height: calc(100vh - 175px);
  padding: 10px 12px 12px;
}

.floatingEditor .inline-editor {
  width: auto;
}

.floatingEditor .inline-editor .ie-head {
  display: none;
}

.equipChip .gear {
  margin-left: 2px;
  background: rgba(255,255,255,.16);
  border-radius: 999px;
  padding: 2px 5px;
}

.equipChip.active .gear {
  background: rgba(0,0,0,.12);
}

.map-selected-hint {
  pointer-events: none;
}


/* v2.5 camera coverage / bottom bar spacing */
.inline-editor .inventoryPicker {
  max-height: 150px;
}

#equipmentBottomBar .equipHead {
  cursor: default;
}

.floatingEditor:hover {
  background: rgba(255, 255, 255, .82);
}


/* v2.6 inventory/rotation/signal */
.marker.signal_a1 { background: #e6007e; }
.marker.signal_telekom { background: #0ea5e9; }
.marker.signal_telemach { background: #ef4444; }

.rotate-handle {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #facc15;
  color: #111827;
  border: 3px solid white;
  box-shadow: 0 8px 22px rgba(0,0,0,.35);
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight: 900;
  cursor: grab;
}

.inventorySuggest {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.inventorySuggest button {
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 11px;
  box-shadow: none;
  background: #e0f2fe;
  color: #075985;
}

.equipChip[draggable="true"] {
  cursor: grab;
}

.equipChip.dragging {
  opacity: .55;
}

.dropHint {
  position: absolute;
  z-index: 1300;
  pointer-events: none;
  background: rgba(15,23,42,.9);
  color: white;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.cameraSubtypeRow {
  margin-top: 7px;
}


/* v2.7 sidebar editor + structured inventory */
.inventoryCatalogBox {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.inventoryCatalogBox h3 {
  margin: 0 0 8px;
  color: #e2e8f0;
  font-size: 13px;
}

.inventoryCatalog {
  margin-top: 10px;
  max-height: 220px;
  overflow: auto;
  border: 1px solid rgba(148,163,184,.24);
  border-radius: 12px;
  background: rgba(15,23,42,.45);
}

.inventoryRow {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 6px;
  align-items: center;
  padding: 7px 8px;
  border-bottom: 1px solid rgba(148,163,184,.16);
  color: #e2e8f0;
  font-size: 12px;
}

.inventoryRow:last-child {
  border-bottom: 0;
}

.inventoryRow .invMeta {
  color: #94a3b8;
  font-size: 10px;
  margin-top: 2px;
}

.inventoryRow button {
  padding: 5px 8px;
  border-radius: 8px;
  box-shadow: none;
  font-size: 11px;
}

#coverageFields {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid rgba(56,189,248,.25);
  border-radius: 12px;
  background: rgba(14,165,233,.08);
}

.rotateModeActive {
  outline: 3px solid #facc15 !important;
}

.rotate-handle {
  z-index: 1500;
}

#sidebar {
  z-index: 1100;
}

#equipmentBottomBar {
  left: 430px;
}


/* v2.8 compact tabs + equipment autocomplete */
.tabs {
  grid-template-columns: repeat(5, 1fr);
}

.tabBtn {
  font-size: 17px;
  line-height: 1;
}

.sidebarSuggest {
  margin: 7px 0 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sidebarSuggest button {
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 11px;
  box-shadow: none;
  background: #e0f2fe;
  color: #075985;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebarSuggest button.addNew {
  background: #dcfce7;
  color: #14532d;
}

.assignedEquipmentChips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 7px 0 10px;
}

.assignedChip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 8px;
  background: rgba(30,41,59,.95);
  border: 1px solid rgba(148,163,184,.35);
  color: #e2e8f0;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.assignedChip button {
  padding: 2px 6px;
  border-radius: 999px;
  box-shadow: none;
  background: #ef4444;
  color: white;
  font-size: 10px;
}

.inventoryRow button {
  min-width: 34px;
}

.inventoryCatalogBox .grid2 input {
  min-width: 0;
}

.rotateModeActive {
  cursor: crosshair !important;
}


/* v2.8 dedicated equipment tab + assignment search */
.tabs {
  grid-template-columns: repeat(5, 1fr);
}

.tabBtn {
  font-size: 17px;
  padding: 9px 3px;
}

.equipmentAssignBox {
  border: 1px solid rgba(56,189,248,.22);
  background: rgba(14,165,233,.06);
  border-radius: 12px;
  padding: 8px;
}

.equipmentSearchResults {
  margin-top: 7px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.eqResult {
  border: 1px solid rgba(148,163,184,.25);
  background: rgba(30,41,59,.9);
  color: #e2e8f0;
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.eqResult:hover {
  background: #38bdf8;
  color: #082f49;
}

.assignedEquipmentChips {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.assignedChip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #0f766e;
  color: white;
  border-radius: 999px;
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 900;
}

.assignedChip button {
  padding: 1px 5px;
  border-radius: 999px;
  box-shadow: none;
  background: rgba(255,255,255,.18);
  color: white;
}

#addMissingEquipmentBtn {
  margin-top: 8px;
  width: 100%;
}

.inventoryCatalog {
  max-height: 300px;
}

.inventoryRow {
  grid-template-columns: 1fr auto auto auto;
}

.invUseBtn {
  background: #0ea5e9;
  color: white;
}

.hidden {
  display: none !important;
}
