* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  color: #172026;
  font: 14px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #eef1f3;
}

.edit-shell {
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr;
  width: 100%;
  height: 100vh;
  min-height: 560px;
}

.edit-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  padding: 16px;
  overflow: auto;
  background: #f8faf9;
  border-right: 1px solid #cfd7d9;
}

.edit-brand {
  display: grid;
  gap: 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid #d9e0e2;
}

.edit-brand strong {
  font-size: 18px;
  font-weight: 700;
}

.edit-brand span {
  color: #5d6b72;
}

.project-switcher {
  display: grid;
  gap: 6px;
}

.project-switcher span {
  color: #5d6b72;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.project-switcher select {
  width: 100%;
  min-height: 36px;
  padding: 6px 30px 6px 8px;
  color: #172026;
  background: #ffffff;
  border: 1px solid #c9d3d6;
  border-radius: 6px;
}

.panel-section {
  display: grid;
  gap: 10px;
}

.panel-section h1 {
  margin: 0;
  color: #39474e;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.layer-list {
  display: grid;
  gap: 8px;
}

.layer-item {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 8px;
  align-items: center;
  min-height: 36px;
  padding: 8px;
  background: #ffffff;
  border: 1px solid #d7dee0;
  border-radius: 6px;
}

.layer-item input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.layer-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layer-item small {
  color: #6a7880;
  font-size: 12px;
}

.feature-details {
  display: grid;
  gap: 8px;
  margin: 0;
}

.feature-details div {
  display: grid;
  grid-template-columns: minmax(92px, 120px) 1fr;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #dfe5e7;
}

.feature-details dt {
  color: #5d6b72;
  font-weight: 600;
}

.feature-details dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.map-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
}

#map {
  width: 100%;
  height: 100%;
}

.map-status {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 500;
  max-width: min(420px, calc(100% - 28px));
  padding: 8px 10px;
  color: #223037;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #ccd5d8;
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(17, 29, 34, 0.12);
}

.map-status[data-state="error"] {
  color: #7d1e1e;
  border-color: #e4b2b2;
}

.map-status[data-state="ok"] {
  color: #1d5637;
  border-color: #a9d3ba;
}

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

.popup-table {
  border-collapse: collapse;
}

.popup-table th,
.popup-table td {
  padding: 3px 6px;
  text-align: left;
  vertical-align: top;
}

.popup-table th {
  color: #5d6b72;
  font-weight: 700;
}

@media (max-width: 800px) {
  .edit-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(220px, 34vh) 1fr;
  }

  .edit-sidebar {
    order: 2;
    border-top: 1px solid #cfd7d9;
    border-right: 0;
  }

  .map-stage {
    order: 1;
  }
}
