.plattegrond-page { padding: 0; max-width: none; width: 100%; }

.plattegrond-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
  justify-content: space-between;
  padding: .75rem min(2vw, 1rem);
  background: #1a2e1f;
  color: #fff;
}

.plattegrond-toolbar--admin {
  background: #fff;
  color: var(--admin-text, #222);
  border: 1px solid var(--admin-border, #d8dee4);
  border-radius: 8px;
  padding: .85rem 1rem;
  margin-bottom: 1rem;
}

.plattegrond-toolbar--admin h1 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
}

.plattegrond-toolbar h1 { margin: 0; font-size: 1rem; font-weight: 600; }

.plattegrond-edit-layout {
  display: flex;
  gap: 1rem;
  align-items: stretch;
}

.plattegrond-map-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.plattegrond-edit-layout .map-viewport {
  flex: 1;
  width: 100%;
  height: auto;
  min-height: min(72vh, 820px);
}

.plattegrond-edit-layout .edit-sidebar {
  position: static;
  flex: 0 0 min(320px, 30vw);
  width: min(320px, 30vw);
  max-height: none;
  align-self: stretch;
  overflow-y: auto;
  display: block;
  border-radius: 8px;
  border: 2px solid #1e73be;
  box-shadow: none;
}

.map-viewport--admin {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--admin-border, #d8dee4);
}

.legend-hint {
  margin: .5rem 0 0;
  font-size: .72rem;
  color: #555;
}

.toolbar-actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }

.map-viewport {
  width: 96vw;
  max-width: 100%;
  margin: 0 auto;
  height: min(78vh, 900px);
  overflow: hidden;
  background: #111;
  position: relative;
  cursor: grab;
  touch-action: none;
}
.map-viewport.dragging { cursor: grabbing; }

.map-stage {
  position: absolute;
  left: 0; top: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.map-stage img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  pointer-events: none;
}

.map-stage svg.map-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.edit-mode .map-stage svg.map-overlay {
  pointer-events: all;
}

.pitch-poly {
  fill: rgba(120, 190, 100, 0.55);
  stroke: rgba(60, 120, 50, 0.95);
  stroke-width: 0.25;
  cursor: grab;
  vector-effect: non-scaling-stroke;
  touch-action: none;
}
.edit-mode .pitch-poly { cursor: grab; }
.edit-mode .pitch-poly:active { cursor: grabbing; }
.pitch-poly:hover { fill: rgba(120, 190, 100, 0.75); }
.pitch-poly.selected { fill: rgba(120, 190, 100, 0.82); stroke: #ff6b35; stroke-width: 0.45; }

.facility-poly {
  fill: rgba(180, 180, 180, 0.4);
  stroke: rgba(100, 100, 100, 0.8);
  stroke-width: 0.2;
  cursor: grab;
  touch-action: none;
}
.edit-mode .facility-poly { cursor: grab; }
.facility-poly.type-sanitary { fill: rgba(60, 120, 200, 0.45); stroke: rgba(40, 90, 170, 0.9); }
.facility-poly.type-building { fill: rgba(139, 90, 43, 0.35); stroke: rgba(100, 60, 20, 0.8); }
.facility-poly.type-horse { fill: rgba(220, 180, 60, 0.35); stroke: rgba(180, 140, 30, 0.8); }
.facility-poly.type-trees { fill: rgba(60, 140, 60, 0.4); stroke: rgba(40, 100, 40, 0.85); }
.facility-poly.type-parking, .facility-poly.type-entrance { fill: rgba(180, 180, 180, 0.45); }
.facility-poly.type-communal { fill: rgba(100, 160, 220, 0.4); stroke: rgba(60, 120, 180, 0.85); }

.pitch-label {
  font-size: 2.8px;
  font-weight: 700;
  fill: #fff;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
  paint-order: stroke;
  stroke: rgba(0,0,0,.45);
  stroke-width: 0.15;
}

.vertex-handle-hit {
  fill: transparent;
  stroke: none;
  cursor: move;
  display: none;
  touch-action: none;
}
.edit-mode .vertex-handle-hit { display: block; }

.vertex-handle {
  fill: #fff;
  stroke: #ff6b35;
  stroke-width: 0.25;
  cursor: move;
  display: none;
  pointer-events: none;
}
.edit-mode .vertex-handle { display: block; }

.legend-panel {
  position: absolute;
  top: .65rem;
  left: .65rem;
  z-index: 10;
  max-width: min(260px, 42vw);
  background: rgba(255, 252, 245, 0.88);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(0,0,0,.1);
  border-radius: 8px;
  padding: .6rem .75rem;
  font-size: .78rem;
  line-height: 1.35;
  pointer-events: auto;
}
.legend-panel h2 { margin: 0 0 .35rem; font-size: .88rem; }
.legend-panel ul { margin: 0; padding: 0; list-style: none; }
.legend-panel li { display: flex; align-items: center; gap: .4rem; margin-bottom: .25rem; }
.legend-item {
  cursor: pointer;
  border-radius: 4px;
  padding: .15rem .3rem;
  margin: 0 -.3rem;
  transition: background .15s;
  user-select: none;
}
.legend-item:hover { background: rgba(30, 115, 190, 0.1); }
.legend-item--active {
  background: rgba(30, 115, 190, 0.16);
  font-weight: 600;
}
.swatch { width: 14px; height: 10px; border-radius: 2px; background: rgba(120,190,100,.7); border: 1px solid #507842; flex-shrink: 0; }

.legend-indicator-group {
  pointer-events: none;
  animation: legend-arrow-in .35s ease-out forwards;
}
.legend-indicator-shaft {
  stroke-width: 0.55;
  stroke-linecap: round;
  opacity: 0.85;
}
.legend-indicator-head {
  opacity: 0.9;
}
@keyframes legend-arrow-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.pitch-poly.legend-highlighted {
  stroke: rgba(255, 120, 60, 0.95) !important;
  stroke-width: 0.42;
  filter: drop-shadow(0 0 0.4px rgba(255, 120, 60, 0.5));
}
.facility-poly.legend-highlighted {
  stroke: rgba(255, 120, 60, 0.95) !important;
  stroke-width: 0.38;
  filter: drop-shadow(0 0 0.4px rgba(255, 120, 60, 0.5));
}

.detail-panel {
  position: absolute;
  top: .65rem;
  right: .65rem;
  z-index: 10;
  width: min(320px, 42vw);
  max-height: calc(100% - 1.3rem);
  overflow-y: auto;
  background: rgba(255,255,255,.97);
  border-radius: 8px;
  padding: .85rem;
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
  display: none;
}
.detail-panel--edit {
  display: block;
  border: 2px solid #1e73be;
}
.detail-panel.open { display: block; }
.detail-panel h3 { margin: 0 0 .65rem; font-size: 1rem; }
.detail-panel .close-btn {
  position: absolute; top: .4rem; right: .5rem;
  border: none; background: none; font-size: 1.2rem; cursor: pointer;
  line-height: 1;
}

.inline-edit-form label {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  margin-bottom: .65rem;
}
.inline-edit-form input,
.inline-edit-form textarea,
.inline-edit-form select {
  display: block;
  width: 100%;
  margin-top: .25rem;
  padding: .4rem .5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font: inherit;
  font-weight: 400;
}
.checkbox-fieldset {
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: .5rem .65rem;
  margin: 0 0 .65rem;
}
.checkbox-fieldset legend { font-size: .78rem; font-weight: 600; padding: 0 .25rem; }
.checkbox-inline {
  display: flex !important;
  align-items: center;
  gap: .4rem;
  font-weight: 400 !important;
  margin-bottom: .25rem !important;
}
.checkbox-inline input { width: auto; margin: 0; }

.panel-hint { font-size: .85rem; color: #555; margin: 0 0 .5rem; }
.panel-hint-list { margin: 0; padding-left: 1.1rem; font-size: .82rem; color: #555; }
.panel-hint-list li { margin-bottom: .35rem; }

.panel-actions { margin-top: .75rem; padding-top: .65rem; border-top: 1px solid #eee; }
.panel-actions-row {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin-bottom: .65rem;
}
.btn-panel-save {
  background: var(--admin-primary, #1e73be);
  color: #fff;
  border: none;
  padding: .5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
}
.btn-panel-save:hover { filter: brightness(0.95); }
.btn-panel-save:disabled { opacity: .6; cursor: wait; }
.item-save-status {
  font-size: .78rem;
  color: #666;
}
.item-save-status.unsaved {
  color: #c0392b;
  font-weight: 600;
}
.btn-panel-danger {
  background: #fff;
  border: 1px solid #c0392b;
  color: #c0392b;
  padding: .4rem .75rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: .82rem;
}
.btn-panel-danger:hover { background: #fdecea; }

.popup-menu {
  position: fixed;
  z-index: 200;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  min-width: 140px;
  display: none;
}
.popup-menu.open { display: block; }
.popup-menu button {
  display: block; width: 100%; text-align: left;
  border: none; background: #fff; padding: .55rem .75rem; cursor: pointer; font: inherit;
}
.popup-menu button:hover { background: #f5f5f5; }
.popup-menu button.danger { color: #c0392b; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 300; display: none;
}
.modal-backdrop.open { display: block; }
.modal-box {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: #fff; border-radius: 12px; padding: 1.25rem;
  width: min(400px, 92vw); z-index: 301; display: none;
}
.modal-box.open { display: block; }
.modal-box label { display: block; font-size: .8rem; font-weight: 600; margin: .5rem 0 .2rem; }
.modal-box input, .modal-box textarea, .modal-box select {
  width: 100%; padding: .45rem; border: 1px solid #ccc; border-radius: 6px; font: inherit;
}
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }

@media (max-width: 640px) {
  .map-viewport { height: 65vh; width: 100vw; }
  .detail-panel { width: calc(100% - 1.3rem); right: .65rem; left: .65rem; }
}
