:root {
  color-scheme: light;
  font-family: Inter, 'Segoe UI', system-ui, sans-serif;
  color: #172a2c;
  background: #e2e9e7;
  --accent: #147365;
  --muted: #546969;
  --line: #dce5e2;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 300px; }
button, select, input { font: inherit; }
button, select { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #36a899; outline-offset: 3px; }

.masthead {
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 24px;
  background: #132c2e;
  color: #f8fbfa;
}

.identity { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  aspect-ratio: 1;
  border: 1px solid #8bb9ad;
  border-radius: 10px;
  color: #c7e7dd;
  font-size: 22px;
  font-weight: 700;
}
.identity h1 { margin: 0; font-size: 20px; line-height: 1.15; letter-spacing: -.025em; }
.identity p { margin: 3px 0 0; color: #b9cdca; font-size: 13px; }
.share { border: 1px solid #5b7976; background: #203e40; color: #f5faf8; }
button, select { border-radius: 9px; padding: 9px 12px; font-size: 14px; font-weight: 600; }
.share:hover { background: #2c5152; }

.workspace { display: grid; grid-template-columns: 318px minmax(0, 1fr); height: calc(100dvh - 70px); }
.sidebar { z-index: 2; background: #f7faf8; box-shadow: 2px 0 14px #172f2a1a; overflow: auto; }
.site-summary, .layer-panel, .basemap-panel { margin: 0; padding: 22px; border-bottom: 1px solid var(--line); }
.location { color: var(--muted); margin: 0 0 8px; font-size: 13px; }
.site-summary h2 { font-size: 24px; line-height: 1.2; margin: 0 0 12px; letter-spacing: -.035em; }
.parcel-number { color: #0b6357; font-size: 14px; font-weight: 650; text-underline-offset: 3px; }
.parcel-summary { margin: 12px 0 0; color: var(--muted); font-size: 14px; line-height: 1.4; }
.layer-panel summary, .basemap-panel > label { font-size: 15px; font-weight: 700; }
.layer-panel summary { cursor: pointer; }
.layer-list { margin-top: 10px; }
.layer-row { display: grid; grid-template-columns: 18px minmax(0, 1fr) 18px; gap: 10px; padding: 10px 0; align-items: start; }
.layer-row strong { display: block; font-size: 14px; line-height: 1.25; }
.layer-row small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; line-height: 1.35; }
.swatch { width: 14px; height: 14px; border-radius: 4px; margin-top: 1px; }
.topo-swatch { background: #f3e4bd; border: 1px solid #9c773a; }
.parcel-swatch { background: #cbebde; border: 2px solid var(--accent); }
.layer-row input { margin: 0; width: 17px; height: 17px; accent-color: var(--accent); }
.opacity-panel { margin: 1px 0 6px 28px; font-size: 13px; color: var(--muted); }
.opacity-panel div { display: flex; justify-content: space-between; gap: 8px; }
.opacity-panel output { font-variant-numeric: tabular-nums; }
.opacity-panel input { display: block; width: 100%; margin: 6px 0; accent-color: var(--accent); }
.basemap-panel select { display: block; width: 100%; margin-top: 10px; border: 1px solid #c6d6d1; color: inherit; background: #fff; }

.map-frame { position: relative; min-height: 0; isolation: isolate; }
#map { position: absolute; inset: 0; background: #dfe8e5; }
.map-actions, .measurement, .map-coordinates, .notice { position: absolute; z-index: 900; }
.map-actions { top: 15px; right: 15px; display: flex; gap: 8px; }
.map-actions button, .measurement button {
  border: 1px solid #c2d2ce;
  background: #fff;
  color: #1a3433;
  box-shadow: 0 2px 6px #172f2a26;
}
.map-actions button:hover, .measurement button:hover { background: #e8f3ef; }
.map-actions button[aria-pressed="true"] { background: #136e61; color: #fff; border-color: #0d6559; }
.measurement { display: flex; align-items: center; gap: 12px; top: 62px; right: 15px; background: #f7faf8; padding: 9px; border-radius: 9px; box-shadow: 0 2px 7px #132c2e40; font-size: 13px; }
.measurement button { padding: 5px 8px; box-shadow: none; }
.map-coordinates { pointer-events: none; left: 10px; bottom: 34px; padding: 4px 7px; background: #f7faf8eb; border-radius: 4px; color: #233b3a; font: 12px ui-monospace, monospace; }
.notice { left: 50%; bottom: 55px; transform: translateX(-50%); width: max-content; max-width: min(92%, 435px); padding: 10px 13px; color: #fff; background: #132c2e; border-radius: 8px; font-size: 14px; }
.leaflet-control-attribution { max-width: calc(100vw - 26px); }
.leaflet-control-scale { margin-bottom: 15px; }
.leaflet-control-zoom { margin-bottom: 24px !important; }
.leaflet-container.measuring, .leaflet-container.measuring .leaflet-interactive { cursor: crosshair; }
.parcel-popup p { margin: 6px 0; }

@media (max-width: 680px) {
  .masthead { height: 62px; padding: 0 12px; }
  .workspace { height: calc(100dvh - 62px); grid-template-columns: 1fr; grid-template-rows: auto minmax(290px, 1fr); }
  .sidebar { display: grid; grid-template-columns: 1fr 1fr; }
  .site-summary { padding: 10px 14px; }
  .site-summary h2 { font-size: 17px; margin-bottom: 4px; }
  .location, .parcel-summary { font-size: 12px; margin: 0 0 4px; }
  .basemap-panel { display: flex; flex-direction: column; justify-content: center; padding: 9px 14px; }
  .basemap-panel select { margin-top: 4px; padding: 6px; }
  .layer-panel { grid-column: 1 / -1; grid-row: 2; padding: 8px 14px; }
  .layer-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; margin-top: 4px; }
  .layer-row { padding: 5px 0; }
  .opacity-panel { grid-row: 2; grid-column: 1 / -1; margin: 1px 0; }
  .map-actions { top: 8px; right: 8px; }
  .measurement { top: 54px; right: 8px; }
}
