*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
.hidden { display: none !important; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #1e1e1e;
  color: #f0f0f0;
}

/* ── Topbar ── */
#topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 48px;
  background: rgba(22, 22, 22, 0.95);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 16px;
  z-index: 100;
}

#btn-sidebar-toggle {
  background: none;
  border: none;
  color: #888;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.15s;
}
#btn-sidebar-toggle:hover { color: #fff; }

#plan-title {
  font-size: 15px;
  font-weight: 600;
  color: #e0e0e0;
  letter-spacing: 0.02em;
}

#warning-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 7px;
  border-radius: 10px;
  background: #fe615a;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(254,97,90,0.5);
  transition: background 0.15s;
  position: relative;
}
#warning-badge:hover { background: #e84d46; }
#warning-badge.hidden { display: none !important; }

#warning-badge-wrap {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

#warning-list {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: #252525;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.55);
  min-width: 220px;
  max-width: 320px;
  z-index: 200;
  overflow: hidden;
}
#warning-list::before {
  content: '';
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 7px solid rgba(255,255,255,0.12);
}
#warning-list::after {
  content: '';
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid #252525;
}
#warning-list.hidden { display: none !important; }

#warning-list-inner {
  padding: 6px 0;
  max-height: 260px;
  overflow-y: auto;
}

.wl-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  font-size: 13px;
  color: #e0e0e0;
  transition: background 0.12s;
}
.wl-item:hover { background: rgba(255,255,255,0.05); }

.wl-kind {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #fe615a;
  flex-shrink: 0;
  width: 36px;
}
.wl-name { color: #d0d0d0; }

#toolbar {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.toolbar-group {
  display: flex;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.15);
}

/* Layer-Switching-Buttons */
.btn-layer {
  background: rgba(255,255,255,0.07);
  color: #ccc;
  border: none;
  padding: 0 14px;
  height: 32px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border-right: 1px solid rgba(255,255,255,0.1);
}
.btn-layer:last-child { border-right: none; }
.btn-layer:hover { background: rgba(255,255,255,0.14); color: #fff; }
.btn-layer.active {
  background: rgba(100, 160, 255, 0.25);
  color: #a8cfff;
  font-weight: 600;
}

/* ── Status Bar ── */
#statusbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 32px;
  background: rgba(18, 18, 18, 0.97);
  backdrop-filter: blur(6px);
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 0;
  z-index: 100;
  font-size: 12px;
  color: #888;
}

.sb-left, .sb-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.sb-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}

.sb-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #555;
}

#sb-plan-name {
  color: #c0c0c0;
  font-weight: 500;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#sb-sel-name {
  color: #e0e0e0;
  font-weight: 500;
}

#sb-sel-dims {
  color: #888;
}

#sb-zoom-val {
  color: #c0c0c0;
  font-weight: 500;
  min-width: 28px;
}

.sb-sep {
  width: 1px;
  height: 16px;
  background: rgba(255,255,255,0.1);
  margin: 0 4px;
}

/* Snap/Raster als Pills in der Statusbar */
.sb-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: #666;
  height: 22px;
  padding: 0 8px;
  font-size: 11px;
  border-radius: 11px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.sb-pill:hover { background: rgba(255,255,255,0.1); color: #ccc; }
.sb-pill.active {
  background: rgba(245,158,11,0.18);
  border-color: rgba(245,158,11,0.4);
  color: #fbbf24;
}

/* ── App body (sidebar + map) ── */
#app-body {
  position: fixed;
  top: 48px; left: 0; right: 0; bottom: 32px;
  display: flex;
}

/* ── Sidebar ── */
#layer-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #181818;
  border-right: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.2s ease;
}

#app-body.sidebar-collapsed #layer-sidebar { width: 0; }

#sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #888;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

#btn-add-layer {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  color: #ccc;
  width: 22px; height: 22px;
  border-radius: 4px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
#btn-add-layer:hover { background: rgba(255,255,255,0.14); color: #fff; }

#layer-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  padding: 4px 0;
}

.layer-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  transition: background 0.1s;
}
.layer-item:hover { background: rgba(255,255,255,0.04); }
.layer-item.layer-hidden { opacity: 0.45; }

.layer-color-swatch {
  width: 18px; height: 18px;
  border: none;
  border-radius: 3px;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
}
.layer-color-swatch::-webkit-color-swatch-wrapper { padding: 0; border-radius: 3px; }
.layer-color-swatch::-webkit-color-swatch { border: none; border-radius: 3px; }

.layer-name {
  flex: 1;
  font-size: 13px;
  color: #ddd;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  outline: none;
  min-width: 0;
  border-radius: 3px;
  padding: 1px 3px;
}
.layer-name:focus {
  background: rgba(255,255,255,0.08);
  color: #fff;
  text-overflow: clip;
}
.layer-item.layer-locked .layer-name { color: #888; }

.layer-btn {
  background: none;
  border: none;
  color: #666;
  padding: 3px;
  cursor: pointer;
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: color 0.1s, background 0.1s;
  font-size: 13px;
  line-height: 1;
}
.layer-btn:hover { color: #ccc; background: rgba(255,255,255,0.07); }

.layer-drag-handle {
  color: #444;
  font-size: 14px;
  cursor: grab;
  padding: 2px 2px 2px 0;
  flex-shrink: 0;
  user-select: none;
  line-height: 1;
}
.layer-drag-handle:active { cursor: grabbing; }
.layer-item.layer-dragging { opacity: 0.35; }
.layer-item.layer-drag-over-top { box-shadow: inset 0 2px 0 #3b82f6; }
.layer-item.layer-drag-over-bot { box-shadow: inset 0 -2px 0 #3b82f6; }
.layer-btn.active { color: #f59e0b; }
.layer-btn.vis-on  { color: #60a5fa; }
.layer-btn.vis-off { color: #374151; }
.layer-btn.vis-off:hover { color: #6b7280; }
.layer-del:hover { color: #ef4444; }

/* ── Map ── */
#map {
  flex: 1;
  position: relative;
  min-width: 0;
}

/* ── Object Inspector ── */
#inspector {
  width: 260px;
  flex-shrink: 0;
  background: #1e1e1e;
  border-left: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#inspector.hidden { display: none; }

.insp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

.insp-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 10px;
  background: rgba(255,255,255,0.08);
  color: #aaa;
}
.insp-badge-rect  { background: rgba(59,130,246,0.2);  color: #93c5fd; }
.insp-badge-line  { background: rgba(168,85,247,0.2);  color: #d8b4fe; }
.insp-badge-poly  { background: rgba(34,197,94,0.2);   color: #86efac; }

#insp-close {
  background: none; border: none; color: #666;
  font-size: 14px; cursor: pointer; padding: 2px 6px;
  border-radius: 4px; transition: color 0.15s;
}
#insp-close:hover { color: #fff; }

.insp-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.insp-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.insp-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #555;
}

.insp-body input[type="text"],
.insp-body input[type="number"],
.insp-body textarea,
.insp-body select {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 5px;
  color: #e0e0e0;
  font-size: 13px;
  padding: 6px 8px;
  width: 100%;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}
.insp-body input:focus,
.insp-body textarea:focus,
.insp-body select:focus {
  border-color: rgba(100,160,255,0.5);
  background: rgba(255,255,255,0.09);
}
.insp-body select option { background: #252525; }
.insp-body textarea { resize: vertical; }
.insp-body input.attr-auto { color: #888; cursor: default; }

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

.insp-computed {
  font-size: 11px;
  color: #666;
  text-align: right;
  margin-top: -4px;
}

.insp-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #444;
  padding-top: 4px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.insp-field-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: #999;
}
.insp-checkbox-label {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.insp-checkbox-label input[type="checkbox"] {
  width: auto;
  accent-color: #3b82f6;
}

.insp-custom-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 4px;
  align-items: center;
}
.insp-del-row {
  background: none; border: none; color: #555;
  font-size: 16px; cursor: pointer; padding: 0 4px;
  line-height: 1; border-radius: 3px; transition: color 0.15s;
}
.insp-del-row:hover { color: #ef4444; }

.insp-add-attr {
  background: none;
  border: 1px dashed rgba(255,255,255,0.12);
  color: #555;
  font-size: 12px;
  padding: 6px;
  border-radius: 5px;
  cursor: pointer;
  width: 100%;
  transition: color 0.15s, border-color 0.15s;
}
.insp-add-attr:hover { color: #aaa; border-color: rgba(255,255,255,0.25); }

.insp-footer {
  padding: 10px 12px;
  border-top: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

.insp-delete-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.2);
  color: #f87171;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 5px;
  cursor: pointer;
  width: 100%;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}
.insp-delete-btn:hover { background: rgba(239,68,68,0.2); border-color: rgba(239,68,68,0.4); }

/* MapLibre controls über Statusbar heben */
.maplibregl-ctrl-bottom-left,
.maplibregl-ctrl-bottom-right {
  bottom: 36px !important;
}

/* ── North arrow ── */
.north-arrow-ctrl {
  padding: 4px 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.north-arrow svg {
  display: block;
  transition: transform 0.1s linear;
}

/* ── Toolbar extras ── */
.btn-primary {
  background: #3b82f6;
  color: #fff;
  border: none;
  padding: 0 14px;
  height: 32px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover { background: #2563eb; }

.toolbar-sep {
  width: 1px;
  height: 24px;
  background: rgba(255,255,255,0.15);
  align-self: center;
}

.btn-snap {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  color: #888;
  padding: 0 12px;
  height: 32px;
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-snap:hover { background: rgba(255,255,255,0.14); color: #ccc; }
.btn-snap.active {
  background: rgba(245,158,11,0.2);
  border-color: rgba(245,158,11,0.5);
  color: #fbbf24;
}

/* Icon-only Buttons (30×30) */
.btn-snap.btn-icon {
  width: 30px;
  height: 30px;
  padding: 0;
  justify-content: center;
  border-radius: 6px;
}

/* Luftbild/Karte-Switch als Sidebar-Footer */
#sidebar-map-switch {
  display: flex;
  flex-shrink: 0;
  border-top: 1px solid rgba(255,255,255,0.07);
}

.btn-maplayer {
  flex: 1;
  background: rgba(255,255,255,0.04);
  border: none;
  color: #666;
  height: 36px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border-right: 1px solid rgba(255,255,255,0.07);
}
.btn-maplayer:last-child { border-right: none; }
.btn-maplayer:hover { background: rgba(255,255,255,0.09); color: #ccc; }
.btn-maplayer.active {
  background: rgba(100,160,255,0.18);
  color: #93c5fd;
  font-weight: 600;
}

/* ── Modal ── */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
#modal-overlay.hidden { display: none; }

#modal {
  background: #252525;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 24px;
  width: 380px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

#modal h3 {
  font-size: 16px;
  font-weight: 600;
  color: #e0e0e0;
  margin: 0;
}

#modal label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  color: #aaa;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#modal input, #modal select {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  color: #f0f0f0;
  font-size: 14px;
  padding: 8px 10px;
  outline: none;
  transition: border-color 0.15s;
}
#modal input:focus, #modal select:focus {
  border-color: #3b82f6;
}
#modal select option { background: #252525; }

.modal-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.req { color: #ef4444; }

/* ── Attribute section ── */
.section-divider {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #555;
  border-top: 1px solid rgba(255,255,255,0.07);
  padding-top: 12px;
  margin-top: 2px;
}

#attr-section { display: flex; flex-direction: column; gap: 10px; }
#attr-section.hidden { display: none; }

#modal textarea {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  color: #f0f0f0;
  font-size: 14px;
  padding: 8px 10px;
  outline: none;
  resize: vertical;
  font-family: inherit;
  transition: border-color 0.15s;
}
#modal textarea:focus { border-color: #3b82f6; }

.custom-attr-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 6px;
  align-items: center;
}
.custom-attr-row input { margin: 0; }

.btn-del-attr {
  background: none;
  border: none;
  color: #555;
  font-size: 16px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.15s;
}
.btn-del-attr:hover { color: #ef4444; }

#btn-add-attr {
  background: none;
  border: 1px dashed rgba(255,255,255,0.2);
  border-radius: 6px;
  color: #666;
  font-size: 12px;
  padding: 6px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  text-align: center;
}
#btn-add-attr:hover { color: #aaa; border-color: rgba(255,255,255,0.35); }

#modal-error {
  font-size: 12px;
  color: #f87171;
  min-height: 16px;
  margin: -6px 0;
}

.modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.modal-buttons button {
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.07);
  color: #ccc;
  transition: background 0.15s;
}
.modal-buttons button:hover { background: rgba(255,255,255,0.13); }
.modal-buttons .btn-primary { border-color: #3b82f6; }

/* ── Draw live label ── */
#draw-live-label {
  display: none;
  position: absolute;
  background: rgba(0,0,0,0.72);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  pointer-events: none;
  z-index: 50;
  transform: translate(-50%, -160%);
  white-space: nowrap;
}

/* ── Info Popup ── */
.custom-popup .maplibregl-popup-content {
  background: #252525;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 8px 32px rgba(0,0,0,0.55);
  color: #f0f0f0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.custom-popup .maplibregl-popup-tip {
  border-top-color: #252525;
}
.custom-popup .maplibregl-popup-close-button {
  color: #888;
  font-size: 16px;
  padding: 4px 8px;
  line-height: 1;
}
.custom-popup .maplibregl-popup-close-button:hover { color: #fff; }

.info-popup { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }

.ip-header { display: flex; align-items: center; gap: 7px; }
.ip-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.ip-name { font-size: 14px; font-weight: 600; color: #e0e0e0; }

.ip-meta { font-size: 11px; color: #888; margin-left: 17px; }

.ip-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 2px; }
.ip-key { color: #888; padding: 2px 8px 2px 17px; white-space: nowrap; vertical-align: top; }
.ip-val { color: #ddd; padding: 2px 0; }

.ip-fence { margin-top: 4px; }
.ip-fence-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #f59e0b;
  margin-bottom: 2px;
}

.ip-edit-btn {
  align-self: flex-end;
  margin-top: 4px;
  background: rgba(59,130,246,0.2);
  border: 1px solid rgba(59,130,246,0.4);
  color: #93c5fd;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s;
}
.ip-edit-btn:hover { background: rgba(59,130,246,0.35); color: #bfdbfe; }

/* ── MapLibre overrides ── */
.maplibregl-ctrl-attrib {
  font-size: 10px;
  background: rgba(255,255,255,0.75) !important;
}

.maplibregl-ctrl-scale {
  background: rgba(255,255,255,0.8);
  border: 2px solid #555;
  border-top: none;
  font-size: 11px;
  font-weight: 600;
  color: #222;
  padding: 1px 4px;
}

/* ── Schema-aware attribute fields ── */

.section-sub-divider {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #444;
  padding-top: 8px;
  margin-top: 4px;
}

.attr-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #aaa;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.attr-checkbox-label input[type="checkbox"] {
  width: 16px; height: 16px;
  cursor: pointer;
  accent-color: #3b82f6;
  flex-shrink: 0;
}
.attr-checkbox-label span { text-transform: uppercase; letter-spacing: 0.04em; }

.attr-auto {
  background: rgba(245,158,11,0.08) !important;
  border-color: rgba(245,158,11,0.25) !important;
  color: #fbbf24 !important;
  cursor: default;
}

/* ── New Layer Modal ── */

#new-layer-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 300;
}
#new-layer-overlay.hidden { display: none; }

#new-layer-modal {
  background: #252525;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 24px;
  width: 340px;
  display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
#new-layer-modal h3 { font-size: 16px; font-weight: 600; color: #e0e0e0; }

#nl-error { font-size: 12px; color: #f87171; min-height: 14px; margin: -6px 0; }

/* ── Schema Editor Modal ── */

.schema-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 400;
}

.schema-modal {
  background: #252525;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 24px;
  width: 520px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.schema-modal h3 { font-size: 15px; font-weight: 600; color: #e0e0e0; }

.schema-field-list { display: flex; flex-direction: column; gap: 6px; }

.schema-field-row {
  display: grid;
  grid-template-columns: 20px 1fr 150px auto auto;
  gap: 6px;
  align-items: start;
}
.schema-field-row .sf-label,
.schema-field-row .sf-type {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  color: #f0f0f0;
  font-size: 13px;
  padding: 7px 9px;
  outline: none;
}
.schema-field-row .sf-label:focus,
.schema-field-row .sf-type:focus { border-color: #3b82f6; }
.schema-field-row .sf-type option { background: #252525; }

.sf-extra { grid-column: 1 / -1; }
.sf-extra textarea,
.sf-extra select {
  width: 100%;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  color: #d1d5db;
  font-size: 12px;
  padding: 6px 8px;
  outline: none;
  resize: vertical;
  font-family: inherit;
}
.sf-extra textarea { min-height: 60px; }
.sf-extra select option { background: #252525; }

.schema-add-field-btn {
  background: none;
  border: 1px dashed rgba(255,255,255,0.2);
  border-radius: 6px;
  color: #666;
  font-size: 12px;
  padding: 7px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  text-align: center;
}
.schema-add-field-btn:hover { color: #aaa; border-color: rgba(255,255,255,0.35); }

.schema-error { font-size: 12px; color: #f87171; min-height: 14px; margin: -6px 0; }

/* Schema field drag handle */
.schema-drag-handle {
  cursor: grab;
  color: #555;
  font-size: 14px;
  text-align: center;
  user-select: none;
  padding-top: 7px;
  line-height: 1;
}
.schema-drag-handle:hover { color: #aaa; }
.schema-drag-handle:active { cursor: grabbing; }

/* Schema row drag states */
.schema-row-dragging { opacity: 0.35; }
.schema-row-drag-over {
  outline: 2px solid #3b82f6;
  border-radius: 6px;
  background: rgba(59,130,246,0.06);
}

/* Required field toggle */
.sf-required-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #888;
  white-space: nowrap;
  padding-top: 9px;
  cursor: pointer;
}
.sf-required-wrap input[type="checkbox"] {
  accent-color: #f59e0b;
  width: 13px; height: 13px;
  flex-shrink: 0;
  cursor: pointer;
}

/* Warning badge on map elements (DOM marker) */
.warning-map-badge {
  width: 26px;
  height: 26px;
  background: #fe615a;
  color: #fff;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0,0,0,0.5);
  line-height: 1;
}

/* Warning note in info popup */
.ip-warning {
  font-size: 11px;
  color: #f59e0b;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 0 1px 17px;
}

/* ── Login-Seite ─────────────────────────────────────────────────────────────── */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

#login-wrap {
  width: 100%;
  max-width: 360px;
  padding: 0 16px;
}

#login-box {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 36px 32px;
}

#login-box h1 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 28px;
  text-align: center;
  color: #f0f0f0;
}

#login-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: #aaa;
  margin-bottom: 16px;
}

#login-form input {
  padding: 9px 12px;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06);
  color: #f0f0f0;
  font-size: 14px;
  outline: none;
}

#login-form input:focus {
  border-color: #3b82f6;
  background: rgba(59,130,246,0.08);
}

#login-form .btn-primary {
  width: 100%;
  margin-top: 8px;
  padding: 10px;
  font-size: 14px;
}

#login-error {
  color: #fe615a;
  font-size: 12px;
  min-height: 16px;
  margin-bottom: 4px;
}

/* ── Save-Status ─────────────────────────────────────────────────────────────── */

.save-status {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 500;
  white-space: nowrap;
}

.save-status.status-saved   { color: #4ade80; }
.save-status.status-saving  { color: #94a3b8; }
.save-status.status-unsaved { color: #f59e0b; }
.save-status.status-error   { color: #fe615a; }

/* ── Plan-Selektor ───────────────────────────────────────────────────────────── */

#plan-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}

#plan-modal {
  background: #252525;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 28px 24px;
  width: 420px;
  max-width: 95vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#plan-modal h2 {
  font-size: 17px;
  font-weight: 700;
  color: #f0f0f0;
}

#plan-list-ul {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 60px;
}

.plan-list-item {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  transition: background 0.15s;
}

.plan-list-item:hover { background: rgba(59,130,246,0.12); border-color: #3b82f6; }

.plan-list-name  { font-size: 14px; font-weight: 500; color: #f0f0f0; }
.plan-list-date  { font-size: 11px; color: #666; }
.plan-btn-rename,
.plan-btn-delete {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  opacity: 0.5;
  padding: 2px 4px;
  border-radius: 4px;
}
.plan-btn-rename:hover, .plan-btn-delete:hover { opacity: 1; background: rgba(255,255,255,0.1); }

.plan-list-loading,
.plan-list-empty  { font-size: 13px; color: #666; padding: 12px; text-align: center; }

.plan-overlay-error { font-size: 12px; color: #fe615a; min-height: 16px; }

/* ── Share Modal ──────────────────────────────────────────────────────────── */

#share-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}

#share-modal {
  background: #252525;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 24px;
  width: 480px;
  max-width: 95vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.share-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.share-modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: #f0f0f0;
}

.share-close-btn {
  background: none;
  border: none;
  color: #888;
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.15s;
}
.share-close-btn:hover { color: #fff; }

.share-hint {
  font-size: 12px;
  color: #888;
  line-height: 1.4;
}

#share-token-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  max-height: 280px;
  min-height: 40px;
}

.share-token-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 10px 12px;
}

.share-token-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.share-token-date {
  font-size: 11px;
  color: #666;
}

.share-token-url {
  font-size: 12px;
  color: #93c5fd;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 340px;
}

.share-token-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.share-btn-copy,
.share-btn-revoke {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  opacity: 0.6;
  padding: 4px 6px;
  border-radius: 4px;
  transition: opacity 0.15s, background 0.15s;
}
.share-btn-copy:hover, .share-btn-revoke:hover {
  opacity: 1;
  background: rgba(255,255,255,0.1);
}

.share-token-empty {
  font-size: 13px;
  color: #666;
  padding: 12px;
  text-align: center;
}

.share-modal-footer {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 12px;
}

/* ── View-Fehler-Overlay (view.html) ──────────────────────────────────────── */

#view-error {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}

#view-error-box {
  background: #252525;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 32px 40px;
  text-align: center;
}

#view-error-msg {
  font-size: 15px;
  color: #fe615a;
}

