:root {
  --ink: #17211e;
  --muted: #65716d;
  --line: #d9e1de;
  --paper: #edf2f0;
  --surface: #ffffff;
  --panel: #f7f9f8;
  --teal: #0b6b60;
  --teal-dark: #07574f;
  --blue: #2563eb;
  --amber: #b96708;
  --rose: #c83255;
  --rose-dark: #9f2343;
  --green-soft: #e7f2ef;
  --map-backdrop: #dfe7e4;
  --shadow: 0 8px 22px rgba(20, 34, 29, 0.08);
  font-family: "Be Vietnam Pro", "Segoe UI", sans-serif;
}

body {
  background: #e9efed;
}

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

.app-shell {
  background: #f2f6f4;
  border-color: #d9e1de;
}

.topbar {
  padding: calc(13px + env(safe-area-inset-top)) 16px 13px;
  border-bottom-color: #dce4e1;
  background: #ffffff;
  box-shadow: 0 3px 12px rgba(20, 34, 29, 0.05);
}

.brand-block {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(7, 95, 86, 0.16);
}

.brand-copy {
  min-width: 0;
}

.eyebrow {
  margin-bottom: 3px;
  color: #0b6b60;
  font-size: 0.68rem;
  font-weight: 700;
}

h1 {
  color: #17211e;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.3;
}

h2 {
  font-size: 1.02rem;
  font-weight: 700;
}

.top-stats {
  gap: 5px;
  margin-top: 8px;
}

.top-stats span {
  min-height: 22px;
  padding: 3px 7px;
  border-color: #dce5e1;
  border-radius: 6px;
  background: #f7faf9;
  font-size: 0.68rem;
  font-weight: 600;
}

.top-stats strong {
  font-weight: 700;
}

.screen {
  padding: 11px 12px calc(94px + env(safe-area-inset-bottom));
  background: #f2f6f4;
}

.screen.active {
  gap: 9px;
}

.search-row,
.google-toolbar,
.section-heading {
  gap: 8px;
}

.search-box {
  height: 42px;
  border-color: #d5dfdc;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(20, 34, 29, 0.04);
}

.search-box:focus-within {
  border-color: #4d9b92;
  box-shadow: 0 0 0 3px rgba(11, 107, 96, 0.1);
}

.search-box input {
  font-size: 0.86rem;
}

.map-mode-bar {
  gap: 3px;
  padding: 3px;
  border: 1px solid #d8e1de;
  border-radius: 8px;
  background: #e8eeec;
}

.map-mode {
  height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #5f6d68;
  font-size: 0.78rem;
  font-weight: 700;
}

.map-mode.active {
  background: #075f56;
  color: #ffffff;
  box-shadow: 0 2px 7px rgba(7, 95, 86, 0.18);
}

.tool-button,
.primary-button,
.secondary-button,
.route-button,
.fullscreen-trigger,
.fullscreen-exit,
.icon-button {
  border-radius: 8px;
  font-weight: 700;
}

.tool-button,
.secondary-button,
.fullscreen-trigger,
.fullscreen-exit {
  border-color: #d5dfdc;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(20, 34, 29, 0.05);
}

.primary-button {
  background: #075f56;
  box-shadow: 0 4px 12px rgba(7, 95, 86, 0.18);
}

.route-button {
  background: #2563eb;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.16);
}

.map-stage {
  border-color: #cfdad6;
  border-radius: 10px;
  box-shadow: 0 7px 20px rgba(20, 34, 29, 0.1);
}

.map-tools {
  gap: 4px;
  padding: 4px;
  border-color: #d4dfdb;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 4px 12px rgba(20, 34, 29, 0.1);
}

.basemap-switch,
.basemap-option,
.map-tool-action {
  border-radius: 6px;
}

.basemap-option,
.map-tool-action {
  font-size: 0.64rem;
  font-weight: 700;
}

.atlas-title,
.atlas-legend,
.map-load-status,
.map-coordinate-readout {
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(20, 34, 29, 0.1);
}

.atlas-title {
  background: rgba(255, 255, 255, 0.9);
}

.atlas-title span {
  font-weight: 700;
}

.atlas-title strong {
  font-weight: 700;
}

.map-cluster {
  border-width: 2px;
  background: #235968;
  box-shadow: 0 0 0 3px rgba(35, 89, 104, 0.14), 0 4px 10px rgba(20, 34, 29, 0.22);
  font-weight: 800;
}

.hamlet-map-pin {
  border-width: 2px;
  box-shadow: 0 3px 8px rgba(20, 34, 29, 0.2);
  font-weight: 800;
}

.hamlet-map-pin.selected {
  background: #087269;
  box-shadow: 0 0 0 4px rgba(8, 114, 105, 0.16), 0 5px 12px rgba(7, 95, 86, 0.24);
}

.real-map .leaflet-control-zoom,
.real-map .leaflet-popup-content-wrapper {
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(20, 34, 29, 0.12);
}

.quick-panel,
.hamlet-item,
.detail-card,
.boundary-box,
.stats-grid div {
  border-color: #d9e2df;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 3px 12px rgba(20, 34, 29, 0.05);
}

.quick-panel {
  padding: 12px;
  background: #ffffff;
}

.selected-summary strong {
  font-size: 1rem;
  font-weight: 700;
}

.quick-panel p,
.section-heading p,
.google-toolbar p {
  font-size: 0.8rem;
}

.selected-stats span {
  border-color: #dce5e2;
  border-radius: 6px;
  background: #f5f8f7;
  font-weight: 700;
}

.selected-stats strong {
  font-weight: 800;
}

.selected-distance {
  border-radius: 6px;
  background: #edf3ff;
}

.hamlet-list {
  gap: 8px;
}

.hamlet-item {
  padding: 12px;
}

.hamlet-item strong {
  font-weight: 700;
}

.population-bar {
  height: 4px;
  background: #e4ebe8;
}

.population-bar i {
  background: #167f75;
}

.hamlet-item .badge,
.distance-badge {
  border-radius: 5px;
  font-weight: 700;
}

.nearby-sort {
  border-radius: 7px;
  box-shadow: none;
  font-weight: 700;
}

.detail-card {
  padding: 14px;
}

.info-grid div,
.compare-pdf,
.google-frame {
  border-radius: 8px;
}

.note-box textarea {
  border-color: #d5dfdc;
  border-radius: 8px;
  background: #fbfcfc;
}

.bottom-nav {
  gap: 4px;
  padding-top: 7px;
  border-top-color: #d8e1de;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 -4px 14px rgba(20, 34, 29, 0.06);
}

.nav-item {
  height: 50px;
  border-radius: 7px;
  font-size: 0.68rem;
  font-weight: 600;
}

.nav-item.active {
  background: #e4f1ee;
  color: #075f56;
  box-shadow: inset 0 0 0 1px rgba(7, 95, 86, 0.08);
}

.connection-status i {
  box-shadow: none;
}

@media (max-width: 520px) {
  .topbar {
    padding-inline: 13px;
  }

  .screen {
    padding-inline: 10px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
    border-radius: 9px;
  }

  .map-tools {
    left: 8px;
    right: 8px;
  }
}

@media (max-width: 380px) {
  .map-tool-action {
    font-size: 0;
  }

  .map-tool-check,
  .locate-symbol {
    margin-inline: 3px;
  }
}
