.marker-type-filter-panel {
  position: absolute;
  top: 232px;
  left: 10px;
  width: 220px;
  max-height: 180px;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 6px;
  z-index: 30;
  display: none;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}

.marker-type-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 5px 8px;
  margin: 0 0 4px 0;
  border-radius: 999px;
  border: 0;
  font-size: 11px;
  line-height: 1.2;
  font-weight: 700;
  cursor: pointer;
}

:root {
  --bg: #f3f6fa;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --border: #d9e2ec;
  --text: #1f2937;
  --muted: #64748b;
  --accent: #2563eb;
  --success: #15803d;
  --warn: #b45309;
  --danger: #b91c1c;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 Arial, sans-serif;
  height: 100%;
}

body { padding: 0; }
code { font-family: Consolas, Monaco, monospace; }

.app-shell {
  max-width: none;
  width: 100%;
  margin: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  gap: 0;
}

.panel-card, .app-header, .status-banner {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel-card, .status-banner { padding: 10px 10px; }
h1, h2, h3, p { margin-top: 0; }
.subtitle, .hint { color: var(--muted); }

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  height: 32px;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  margin-bottom: 8px;
}

.header-left {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.header-left span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  gap: 6px;
}

.header-right .file-btn {
  padding: 4px 8px;
  font-size: 11px;
  line-height: 1;
  border-radius: 6px;
  min-height: 24px;
}

.collapsible > .collapsible-body {
  display: none !important;
}

.collapsible.open > .collapsible-body {
  display: block !important;
}

.collapsible.open > .meta-list.collapsible-body,
.collapsible.open > .legend-list.collapsible-body,
.collapsible.open > .preview-grid.collapsible-body {
  display: grid !important;
}

.collapsible-header {
  cursor: pointer;
  user-select: none;
}

.summary-grid {
  display: none;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.summary-card {
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}

.summary-card .label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.toolbar {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
  align-items: start;
}

.toolbar-block--right { display: grid; gap: 10px; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; }
button, input, select { font: inherit; }

button, .file-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 700;
}


/* put this AFTER the rule above */
.header-right button.file-btn#openAdminBtn {
  background: #b91c1c !important;
  color: #ffffff !important;
  border-color: #b91c1c !important;
}

.header-right button.file-btn#openAdminBtn:hover {
  background: #991b1b !important;
  border-color: #991b1b !important;
}

button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }

input[type="text"], select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
}

.field { display: grid; gap: 6px; }
.field label { font-size: 13px; font-weight: 700; }

.status-banner {
  font-weight: 700;
  margin-top: 0;
  margin-bottom: 0;
}
.status-banner--neutral { background: #fff; color: var(--text); }
.status-banner--ok { background: #dcfce7; border-color: #86efac; color: #166534; }
.status-banner--warn { background: #fef3c7; border-color: #fcd34d; color: #92400e; }
.status-banner--blocked { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.app-shell > .status-banner:last-child { margin-bottom: 0; }

.main-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

.main-grid.full {
  grid-template-columns: 1fr;
}

.main-grid:not(.full) {
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.55fr);
}

.side-panel.hidden {
  display: none;
}

.map-panel {
  position: relative;
  padding: 0;
  overflow: hidden;
  height: 100%;
}

#map {
  width: 100%;
  height: calc(100vh - 80px);
  min-height: 500px;
}

.side-panel {
  display: none;
  gap: 14px;
}

.main-grid:not(.full) .side-panel {
  display: grid;
}

.legend-list, .meta-list { display: grid; gap: 10px; }

.legend-item {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-soft);
}

.legend-swatch {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.18);
}

.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-soft);
}

.empty-state {
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--muted);
  background: #fff;
}

.preview-grid {
  display: grid;
  gap: 8px;
}

.preview-row {
  display: grid;
  gap: 2px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.preview-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.preview-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.preview-value {
  word-break: break-word;
}

.maplibregl-popup-content {
  max-width: 340px;
  font: 13px/1.45 Arial, sans-serif;
}

.popup-title { margin-bottom: 8px; }
.popup-line { margin-bottom: 5px; }
.popup-label { font-weight: 700; }
.popup-meta {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #d9e2ec;
  color: #64748b;
  font-size: 12px;
}

.map-cursor-info {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 20;
  pointer-events: none;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(217, 226, 236, 0.95);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
  color: var(--text);
  font: 12px/1.2 Consolas, Monaco, monospace;
  white-space: nowrap;
}

.raw-search-btn {
  position: absolute;
  top: 110px;
  left: 10px;
  z-index: 30;
  padding: 6px 10px;
  font-size: 12px;
  background: white;
  border: 1px solid #ccc;
  border-radius: 6px;
  cursor: pointer;
  width: 102px;
  height: 26px;
}

.raw-search-panel {
  position: absolute;
  top: 100px;
  left: 120px;
  width: 220px;
  max-height: 220px;
  overflow-y: auto;
  background: white;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 8px;
  z-index: 30;
  display: none;
}

.raw-search-panel input {
  width: 100%;
  padding: 6px;
  margin-bottom: 6px;
}

.raw-search-result {
  padding: 6px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
}

.raw-search-result:hover {
  background: #f3f4f6;
}

.raw-search-result-meta {
  font-size: 12px;
  color: #555;
}

.marker-type-filter-btn {
  position: absolute;
  top: 248px;
  left: 10px;
  z-index: 30;
  padding: 6px 10px;
  font-size: 12px;
  background: white;
  border: 1px solid #ccc;
  border-radius: 6px;
  cursor: pointer;
  width: 102px;
  height: 26px;
}

.marker-type-filter-panel {
  position: absolute;
  top: 282px;
  left: 10px;
  width: 180px;
  max-height: 180px;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 6px;
  z-index: 30;
  display: none;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}

.marker-type-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 5px 8px;
  margin: 0 0 4px 0;
  border-radius: 999px;
  border: 0;
  font-size: 11px;
  line-height: 1.2;
  font-weight: 700;
  cursor: pointer;
}

.marker-type-toggle--on {
  background: #15803d;
  color: #fff;
}

.marker-type-toggle--off {
  background: #b91c1c;
  color: #fff;
}

.marker-type-filter-empty {
  font-size: 11px;
  color: var(--muted);
  padding: 4px 2px;
}

.maplibregl-ctrl-bottom-right {
  bottom: 40px;
  color: var(--accent);
}

.maplibregl-ctrl-attrib {
  margin: 0 10px 4px 0;
  font-size: 11px;
}

@media (max-width: 1100px) {
  .toolbar, .main-grid { grid-template-columns: 1fr; }
  #map { height: 60vh; min-height: 420px; }
}

@media (max-width: 760px) {
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .summary-grid { grid-template-columns: 1fr; }

  .map-cursor-info {
    right: 8px;
    bottom: 8px;
    max-width: calc(100% - 16px);
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
.external-map-links-panel {
  position: absolute;
  top: 150px;
  left: 10px;   /* ← move to left */
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.external-map-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  border: 1px solid #ccc;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}

.external-map-link-btn:hover {
  background: #f8fafc;
}