:root {
  --brand: #0e5a70;
  --brand-dark: #0a4052;
  --panel: #ffffff;
  --ink: #173033;
  --muted: #647174;
  --line: rgba(16, 42, 45, 0.18);
  --shadow: 0 14px 34px rgba(6, 32, 39, 0.24);
}

* {
  box-sizing: border-box;
}

html,
body,
.map-shell,
.map {
  width: 100%;
  height: 100%;
}

html,
body {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.map-shell {
  position: relative;
  background: #dce6dc;
}

.map {
  z-index: 1;
}

.brand-card {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  left: 12px;
  z-index: 650;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: min(520px, calc(100vw - 24px));
  padding: 10px 12px;
  border-radius: 0 0 10px 0;
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 3px solid rgba(255, 255, 255, 0.88);
  border-radius: 50%;
  background: linear-gradient(135deg, #61c774, #2a7eb7);
  font-weight: 800;
}

.brand-card p,
.brand-card h1 {
  margin: 0;
}

.brand-card p {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand-card h1 {
  margin-top: 3px;
  font-size: 20px;
  line-height: 1.18;
}

.brand-card button {
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.side-layer-tab {
  position: absolute;
  top: 42%;
  left: 0;
  z-index: 640;
  min-height: 96px;
  padding: 10px 6px;
  border-radius: 0 8px 8px 0;
  background: var(--brand);
  color: #fff;
  font-size: 16px;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  box-shadow: var(--shadow);
}

.map-controls {
  position: absolute;
  top: 110px;
  right: 12px;
  z-index: 640;
  display: grid;
  gap: 10px;
}

.map-controls button {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(14, 90, 112, 0.96);
  color: #fff;
  font-size: 22px;
  box-shadow: var(--shadow);
}

.layer-panel {
  position: absolute;
  top: 110px;
  left: 44px;
  z-index: 700;
  display: none;
  width: min(360px, calc(100vw - 72px));
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.layer-panel.open {
  display: block;
}

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

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

.panel-head button,
.lookup-grid button {
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
}

.layer-panel label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 0;
  font-size: 14px;
}

.hidden-toggle {
  display: none !important;
}

.layer-panel p,
.note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.lookup-panel {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 630;
  max-width: 680px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.lookup-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.lookup-title p,
.lookup-title h2 {
  margin: 0;
}

.lookup-title p {
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.lookup-title h2 {
  margin-top: 2px;
  font-size: 19px;
}

.lookup-title span {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.lookup-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 72px;
  gap: 8px;
}

.lookup-grid input {
  min-width: 0;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #cdd8d5;
  border-radius: 8px;
  background: #fff;
}

.map-legend {
  position: absolute;
  right: 12px;
  bottom: 16px;
  z-index: 620;
  display: grid;
  gap: 7px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 22px rgba(6, 32, 39, 0.15);
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-size: 12px;
}

.map-legend i {
  display: inline-block;
  width: 24px;
  height: 0;
  border-top: 4px solid currentColor;
}

.legend-planning {
  color: #b55f19;
}

.legend-parcel {
  color: #647b44;
}

.legend-ward {
  color: #0f5f7a;
}

.leaflet-control-attribution {
  display: none;
}

.leaflet-popup-content {
  min-width: 210px;
  font-size: 13px;
  line-height: 1.45;
}

@media (max-width: 720px) {
  .brand-card {
    grid-template-columns: 48px minmax(0, 1fr) auto;
    gap: 9px;
    padding: 9px;
  }

  .brand-mark {
    width: 48px;
    height: 48px;
    font-size: 14px;
  }

  .brand-card p {
    font-size: 11px;
  }

  .brand-card h1 {
    font-size: 17px;
  }

  .brand-card button {
    display: none;
  }

  .map-controls {
    top: 116px;
    right: 9px;
    gap: 8px;
  }

  .map-controls button {
    width: 42px;
    height: 42px;
    font-size: 20px;
  }

  .lookup-panel {
    left: 10px;
    right: 10px;
    padding: 12px;
  }

  .lookup-grid {
    grid-template-columns: 1fr 1fr 62px;
  }

  .map-legend {
    display: none;
  }
}
