:root {
  color-scheme: light;
  font: 16px/1.4 system-ui, sans-serif;
  color: #19342a;
  background: #f3f5ee;
  --border: #d6dfd4;
  --muted: #486052;
  --green: #214d37;
}

* { box-sizing: border-box; }

body {
  width: min(100%, 1100px);
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}

h1, h2, p { margin: 0; }
h1 { font-size: 1.2rem; line-height: 1.15; }
h2 { font-size: 1.15rem; }

button, select {
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  color: inherit;
  background: #fff;
}

button { cursor: pointer; }
button:disabled, select:disabled { opacity: .56; cursor: default; }
button:focus-visible, select:focus-visible { outline: 3px solid #317cb3; outline-offset: 2px; }

.topbar, .brand, .map-toolbar, .summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.topbar { margin-bottom: 12px; }
.brand p, .map-status, .status, label { color: var(--muted); font-size: .875rem; }
.brand img { flex: none; }
.quiet { padding: 7px 10px; font-size: .85rem; font-weight: 650; }
.quiet:hover:not(:disabled), .quiet[aria-pressed="true"] { background: #e1ebe0; }

main { display: grid; gap: 12px; }
.map-card, .controls, dialog {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
}

.map-card { min-width: 0; overflow: hidden; }
.map-toolbar { padding: 8px; flex-wrap: wrap; }
.map-status { padding: 6px 10px; min-height: 32px; }

#map {
  height: clamp(295px, 49dvh, 630px);
  background-color: #e9f0e6;
  background-image: linear-gradient(#d7e4d7 1px, transparent 1px), linear-gradient(90deg, #d7e4d7 1px, transparent 1px);
  background-size: 26px 26px;
  z-index: 0;
}

.controls { align-self: start; padding: 12px; }
.summary { margin-bottom: 10px; }
.summary > div { min-width: 0; }
label { display: block; margin-bottom: 4px; }
select { max-width: 100%; padding: 0 10px; }
.count { flex: none; border-radius: 99px; padding: 6px 10px; background: #ecf2e9; font-weight: 700; }

.primary {
  width: 100%;
  min-height: 58px;
  border: 0;
  background: var(--green);
  color: #fff;
  font-size: 1.15rem;
  font-weight: 750;
}

.primary:hover:not(:disabled) { background: #2c6549; }
.status { min-height: 43px; margin-top: 8px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.danger { color: #8b2f29; }

dialog { max-width: min(380px, calc(100% - 24px)); color: inherit; padding: 18px; }
dialog p { margin-top: 6px; }
dialog::backdrop { background: #152a2266; }
body[data-demo="true"] #map { cursor: crosshair; }

@media (min-width: 760px) {
  body { padding: 22px; }
  main { grid-template-columns: minmax(0, 1fr) 300px; }
  #map { height: clamp(395px, 68dvh, 680px); }
}
