:root {
  --ink: #16201c;
  --muted: #65706b;
  --line: #d9e0dc;
  --surface: #f7f8f4;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-dark: #0b5c55;
  --heritage: #9d3a35;
  --mobility: #2f6690;
  --services: #7b4e9f;
  --green: #4d7c37;
  --building: #8c6f4a;
  --land: #8a7d37;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--surface);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: auto;
  padding: 20px;
  border-right: 1px solid var(--line);
  background: rgba(247, 248, 244, 0.96);
}

.brand p {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.brand h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.05;
}

.panel {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 24px rgba(22, 32, 28, 0.05);
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}

.panel h2 {
  margin: 0;
  font-size: 16px;
}

.panel-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

label {
  display: block;
  margin-top: 11px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  margin-top: 6px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(15, 118, 110, 0.16);
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

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

button:hover {
  border-color: var(--accent-dark);
}

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

.layer-toggle {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 9px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfa;
}

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.layer-toggle input {
  width: 18px;
  min-height: 18px;
  margin: 0;
}

.layer-name {
  font-size: 14px;
  font-weight: 750;
}

.layer-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.details {
  display: grid;
  gap: 8px;
  font-size: 14px;
}

.details.empty {
  color: var(--muted);
}

.details h3 {
  margin: 0;
  font-size: 18px;
}

.tag-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.tag-key {
  color: var(--muted);
  font-weight: 800;
}

.detail-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 6px 0;
}

.detail-actions.single {
  grid-template-columns: 1fr;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.edit-badge {
  width: fit-content;
  padding: 5px 8px;
  border-radius: 6px;
  color: #0b5c55;
  background: rgba(15, 118, 110, 0.12);
  font-size: 12px;
  font-weight: 850;
}

.edit-badge.strong {
  color: #6d312d;
  background: rgba(157, 58, 53, 0.13);
}

.edit-badge.muted {
  color: var(--muted);
  background: #eef1ee;
}

.warning-box {
  padding: 10px;
  border: 1px solid rgba(157, 58, 53, 0.32);
  border-radius: 8px;
  color: #6d312d;
  background: rgba(157, 58, 53, 0.08);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.editor-group {
  display: grid;
  gap: 4px;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.editor-group h4 {
  margin: 0;
  font-size: 14px;
}

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

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

.status {
  position: absolute;
  right: 16px;
  bottom: 18px;
  max-width: min(520px, calc(100% - 32px));
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 25px rgba(22, 32, 28, 0.14);
  font-size: 14px;
  font-weight: 700;
}

.maplibregl-popup-content {
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  box-shadow: 0 12px 28px rgba(22, 32, 28, 0.22);
}

.popup-title {
  margin: 0 0 4px;
  font-weight: 850;
}

.popup-meta {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    max-height: 52vh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  #map {
    height: 48vh;
  }
}
