:root {
  color-scheme: light;
  --paper: #f6f1e4;
  --ink: #182016;
  --muted: #6f735f;
  --moss: #44614a;
  --moss-dark: #263d2d;
  --amber: #d88b12;
  --hazard: #c84b31;
  --line: rgba(24, 32, 22, 0.16);
  --panel: rgba(255, 252, 243, 0.94);
  --focus: #1d5f9f;
}

* {
  box-sizing: border-box;
}

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

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

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

button,
input,
select,
textarea {
  font: inherit;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.shell {
  display: grid;
  grid-template-columns: minmax(360px, 420px) 1fr;
}

.panel {
  position: relative;
  z-index: 600;
  min-width: 0;
  overflow: auto;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(68, 97, 74, 0.12), transparent 34%),
    var(--panel);
  padding: 22px;
  box-shadow: 12px 0 28px rgba(24, 32, 22, 0.12);
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 20px;
}

.mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 40px;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  padding-top: 8px;
  background: var(--amber);
  color: #2b1a03;
  font-weight: 900;
  font-size: 22px;
}

.kicker {
  margin: 0 0 2px;
  color: var(--moss);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.05;
}

h2 {
  font-size: 16px;
}

.notice {
  border: 1px solid rgba(200, 75, 49, 0.35);
  background: #fff5df;
  padding: 13px 14px;
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.freshness {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  border: 1px solid rgba(68, 97, 74, 0.2);
  background: rgba(255, 255, 255, 0.54);
  padding: 9px 11px;
  color: var(--moss-dark);
  font-size: 12px;
  font-weight: 760;
  line-height: 1.35;
}

.freshness-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
  background: #2f8d55;
  box-shadow: 0 0 0 3px rgba(47, 141, 85, 0.14);
}

.freshness.stale {
  border-color: rgba(200, 75, 49, 0.3);
  color: #7a3124;
}

.freshness.stale .freshness-dot {
  background: var(--hazard);
  box-shadow: 0 0 0 3px rgba(200, 75, 49, 0.14);
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.stats div {
  border-top: 3px solid var(--moss);
  background: rgba(255, 255, 255, 0.52);
  padding: 10px 8px;
}

.stats span {
  display: block;
  font-size: 23px;
  font-weight: 850;
}

.stats small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.controls,
.report,
.sources {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-top: 16px;
}

.section-label {
  margin-bottom: 9px;
  color: var(--moss-dark);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 14px;
}

.preset {
  min-height: 44px;
  padding: 8px 9px;
  font-size: 12px;
}

.preset.active,
.report-mode #reportMode {
  border-color: transparent;
  background: var(--moss-dark);
  color: #fffdf4;
}

label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: var(--moss-dark);
  font-size: 12px;
  font-weight: 760;
}

.filter-details {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin: 2px 0 12px;
  padding: 10px 0 12px;
}

.filter-details summary {
  min-height: 36px;
  color: var(--moss-dark);
  cursor: pointer;
  font-size: 13px;
  font-weight: 850;
}

.filter-details label:first-of-type {
  margin-top: 8px;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
  padding: 10px 11px;
}

textarea {
  min-height: 72px;
  resize: vertical;
}

.toggles {
  display: grid;
  gap: 7px;
  margin-top: 4px;
}

.toggles label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 13px;
}

.toggles input {
  width: auto;
}

output,
.hint,
.map-toolbar span {
  color: var(--muted);
  font-size: 12px;
}

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

.button-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

button,
.official {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffbf0;
  color: var(--moss-dark);
  padding: 9px 11px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 800;
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.primary {
  width: 100%;
  border-color: transparent;
  background: var(--moss-dark);
  color: #fffdf4;
}

.inline-check {
  display: flex;
  grid-template-columns: none;
  align-items: flex-start;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.inline-check input {
  width: auto;
  margin-top: 2px;
}

.official {
  display: block;
  margin-top: 10px;
  text-align: center;
  background: #ffe1a5;
}

.sources {
  display: grid;
  gap: 8px;
  padding-bottom: 24px;
}

.sources a {
  color: var(--moss-dark);
  font-size: 13px;
}

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

.map-toolbar {
  position: absolute;
  top: 16px;
  left: 72px;
  right: 16px;
  max-width: calc(100% - 88px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid rgba(24, 32, 22, 0.13);
  border-radius: 8px;
  background: rgba(255, 252, 243, 0.92);
  padding: 10px 12px;
  box-shadow: 0 8px 24px rgba(24, 32, 22, 0.12);
}

.map-toolbar strong,
.map-toolbar span {
  min-width: 0;
}

.map-toolbar strong {
  overflow-wrap: anywhere;
}

.report-mode .map-toolbar {
  border-color: rgba(200, 75, 49, 0.42);
  background: rgba(255, 232, 186, 0.96);
}

.map-key {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  color: var(--moss-dark);
  font-size: 12px;
  font-weight: 720;
}

.map-key div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.key-dot {
  display: inline-block;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border: 1px solid rgba(38, 61, 45, 0.68);
  border-radius: 50%;
}

.key-dot.oak-density {
  background: rgba(84, 124, 79, 0.38);
}

.key-triangle {
  display: inline-block;
  width: 18px;
  height: 16px;
  flex: 0 0 18px;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.key-triangle.resolved {
  background: #8c8f62;
}

.key-triangle.open {
  background: var(--hazard);
}

.key-triangle.community {
  background: var(--amber);
}

.report-mode .map-toolbar strong {
  color: var(--hazard);
}

.leaflet-popup-content {
  margin: 12px 14px;
  line-height: 1.4;
}

.popup-title {
  margin-bottom: 6px;
  font-weight: 850;
}

.report-marker {
  display: grid;
  place-items: center;
  width: 30px !important;
  height: 27px !important;
  margin-left: -15px !important;
  margin-top: -14px !important;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background: var(--hazard);
  color: white;
  font-weight: 950;
  box-shadow: 0 4px 12px rgba(80, 20, 8, 0.34);
}

.report-marker.official-resolved {
  background: #8c8f62;
  color: #fffdf4;
  opacity: 0.86;
}

.report-marker.official-open {
  background: var(--hazard);
  color: #fffdf4;
  transform: scale(1.08);
}

.report-marker.community {
  background: #d88b12;
  color: #2b1a03;
}

.report-marker.pending {
  background: #c84b31;
  color: #fffdf4;
  outline: 3px solid rgba(255, 232, 186, 0.82);
}

.popup-zoom {
  margin-top: 8px;
  padding: 7px 9px;
}

.report-mode #map {
  cursor: crosshair;
}

@media (max-width: 840px) {
  .shell {
    width: 100vw;
    max-width: 100vw;
    overflow: hidden;
    grid-template-columns: 1fr;
    grid-template-rows: 48vh 52vh;
  }

  .panel {
    grid-row: 2;
    border-right: 0;
    border-top: 1px solid var(--line);
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    padding: 16px;
  }

  .notice {
    font-size: 13px;
    max-width: calc(100vw - 32px);
  }

  .map-toolbar {
    left: 58px;
    right: 10px;
    max-width: none;
    padding: 8px 10px;
  }

  .stats {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .stats div {
    padding: 9px 6px;
  }

  .stats span {
    font-size: 21px;
  }

  .map-wrap {
    grid-row: 1;
  }

  .map-toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .map-toolbar strong {
    font-size: 14px;
    line-height: 1.2;
  }

  .map-toolbar span {
    font-size: 11px;
    line-height: 1.2;
  }
}
