html, body { height: 100%; margin: 0; overflow: hidden; font-size: 14px; }
.form-control.bg-dark::placeholder { color: #6c7a9c; opacity: 1; }
#app { display: flex; flex-direction: column; height: 100vh; }
#topbar { flex-shrink: 0; background: #1a1a2e; border-bottom: 1px solid #333; padding: 6px 12px; }
#main { display: flex; flex: 1; overflow: hidden; }
#sidebar {
  width: 290px; min-width: 290px;
  scrollbar-gutter: stable;
  background: #16213e; color: #cdd3de; border-right: 1px solid #333;
  display: flex; flex-direction: column; gap: 0;
}
#map { flex: 1; }

.panel { padding: 12px 14px; border-bottom: 1px solid #2a2a4a; }
.panel-title {
  font-size: 0.65rem; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: #6c7a9c; margin-bottom: 8px;
}

.layer-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; cursor: pointer; }
.layer-row:hover { color: #fff; }
.layer-swatch { width: 14px; height: 14px; border-radius: 3px; flex-shrink: 0; }

#props-content { font-size: 0.8rem; }
#props-content table { width: 100%; border-collapse: collapse; }
#props-content td { padding: 2px 4px; vertical-align: top; }
#props-content td:first-child { color: #6c7a9c; white-space: nowrap; padding-right: 8px; }
#props-content tr:hover td { background: #1e2d50; }

.ann-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 0; border-bottom: 1px solid #2a2a4a; font-size: 0.78rem;
}
.ann-item:last-child { border-bottom: none; }
.ann-id { color: #6c7a9c; font-size: 0.68rem; }

.mode-btn { font-size: 0.78rem; }
.mode-btn.active { background: #0d6efd; border-color: #0d6efd; color: #fff; }

#status { font-size: 0.75rem; }
.leaflet-draw { z-index: 500; }

.mode-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed !important;
  pointer-events: none;
}

/* Static demo (GitHub Pages): dimmed server-only controls + badge */
#topbar .btn:disabled, #topbar .form-select:disabled { opacity: 0.4; cursor: not-allowed; }
.demo-pill {
  background: #16213e; color: #ffca28; border: 1px solid #ffca28;
  border-radius: 5px; font-size: 0.78rem; padding: 3px 8px;
  flex-shrink: 0; text-decoration: none; white-space: nowrap;
}
.demo-pill:hover { color: #ffca28; background: #1f2b52; }

.subtype-btn { background: none; border: none; color: #6c7a9c; font-size: 0.7rem;
               padding: 0 2px; cursor: pointer; line-height: 1; margin-left: auto; }
.subtype-btn:hover { color: #cdd3de; }
.subtype-panel { display: none; padding: 1px 4px 4px 22px; }
.subtype-row { display: flex; align-items: center; gap: 6px; padding: 2px 0;
               font-size: 0.78rem; cursor: pointer; min-height: 20px; }
.subtype-row:hover { color: #fff; }
.st-check {
  appearance: none; -webkit-appearance: none;
  width: 14px; height: 14px; flex-shrink: 0;
  border: 1.5px solid #6c7a9c; border-radius: 2px;
  background: transparent; cursor: pointer;
  position: relative; display: inline-block; vertical-align: middle;
  transition: background 0.1s, border-color 0.1s;
}
.st-check:checked {
  background: #0d6efd; border-color: #0d6efd;
}
.st-check:checked::after {
  content: '';
  position: absolute; left: 3px; top: 0px;
  width: 5px; height: 9px;
  border: 2px solid #fff; border-top: none; border-left: none;
  transform: rotate(45deg);
}
.subtype-cnt { color: #6c7a9c; font-size: 0.68rem; margin-left: auto; }

.node-list { max-height: 200px; overflow-y: auto; margin-top: 4px; }
.node-list-item {
  display: flex; align-items: baseline; gap: 5px;
  padding: 2px 3px; font-size: 0.74rem; cursor: pointer;
  border-bottom: 1px solid #1e2d50;
}
.node-list-item:hover { background: #1e2d50; color: #fff; }
.node-list-item:last-child { border-bottom: none; }
.node-list-item.sel { background: #1e2d50; color: #f0a500; }
.node-list-item.sel .node-idx { color: #f0a500; }
.node-idx { color: #6c7a9c; font-size: 0.68rem; flex-shrink: 0; min-width: 20px; }
.node-tag-hint { color: #6c7a9c; font-size: 0.68rem; margin-left: auto; white-space: nowrap;
                 overflow: hidden; text-overflow: ellipsis; max-width: 90px; }

.change-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 0; border-bottom: 1px solid #2a2a4a; font-size: 0.78rem;
}
.change-item:last-child { border-bottom: none; }
.change-id { color: #6c7a9c; font-size: 0.68rem; }

/* Collapsible panels at the bottom of the sidebar */
.bottom-panel { border-top: 1px solid #2a2a4a; }
.bottom-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; cursor: pointer; background: #1a2747;
}
.bottom-panel-header:hover { background: #1e2d50; }
.bottom-panel-title {
  font-size: 0.65rem; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: #6c7a9c; margin: 0;
}
.bottom-panel-body { padding: 4px 14px 12px 14px; background: #16213e; max-height: 200px; overflow-y: auto; }
.panel-toggle-icon { font-size: 0.6rem; color: #6c7a9c; }

/* Planner Sidebar Integration */
.planner-sidebar-buttons .btn {
  text-align: left;
  justify-content: flex-start;
  display: flex;
  align-items: center;
  gap: 8px;
}

.planner-options .form-check-label {
  cursor: pointer;
}

/* Drag and Drop Zone */
.dropzone {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background-color: rgba(13, 110, 253, 0.3); z-index: 2000;
  display: none; justify-content: center; align-items: center; pointer-events: none;
}
.dropzone.active { display: flex; pointer-events: all; }
.dropzone-content {
  background: #1a1a2e; padding: 30px; border-radius: 12px;
  text-align: center; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  border: 2px dashed #0d6efd;
}
.dropzone-icon { font-size: 40px; color: #0d6efd; margin-bottom: 15px; }
.dropzone-text { font-size: 1.2rem; font-weight: bold; color: #fff; }

/* Context menu styles */
.planner-popup .leaflet-popup-content-wrapper {
  background: transparent;
  padding: 0;
  box-shadow: none;
}
.planner-popup .leaflet-popup-content {
  margin: 0;
}
.planner-popup .leaflet-popup-tip-container {
  display: none;
}

.context-menu {
  display: flex; flex-direction: column; background: #1a1a2e; border-radius: 4px;
  overflow: hidden; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5); border: 1px solid #333;
}
.context-menu button {
  background: none; border: none; padding: 8px 12px; cursor: pointer;
  text-align: left; color: #cdd3de; font-size: 0.8rem;
}
.context-menu button:hover { background-color: #16213e; color: #fff; }

/* Dialog styles */
.dialog-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7); display: flex; justify-content: center; align-items: center;
  z-index: 2000; backdrop-filter: blur(3px);
}
.dialog-content {
  background: #1a1a2e; border-radius: 12px; padding: 24px; width: 90%; max-width: 400px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); text-align: center;
  border: 1px solid #333; color: #cdd3de;
}
.dialog-content h2 { margin-top: 0; font-size: 1.4rem; color: #fff; }
.dialog-close-btn {
  margin-top: 15px; padding: 8px 20px; border: none; border-radius: 4px;
  background: #0d6efd; color: white; cursor: pointer;
}
.wormhole-code {
  font-family: monospace; font-size: 1.4rem; background: #16213e;
  padding: 12px; border-radius: 4px; margin: 15px 0;
  color: #ffca28; font-weight: bold; border: 1px solid #333;
}
