:root {
  color-scheme: light;
  --ink: #12201c;
  --muted: #66736f;
  --line: #d7e0dc;
  --paper: #edf5f1;
  --surface: #ffffff;
  --panel: #f8fbfa;
  --teal: #0f766e;
  --teal-dark: #075e57;
  --blue: #2563eb;
  --amber: #d97706;
  --rose: #d33556;
  --rose-dark: #a91f43;
  --green-soft: #e7f4f1;
  --map-backdrop: #e4eee9;
  --shadow: 0 10px 24px rgba(18, 32, 28, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(circle at 50% -12%, rgba(15, 118, 110, 0.16), transparent 34%),
    linear-gradient(180deg, #f7fbf9 0%, var(--paper) 48%, #eaf3ef 100%);
  color: var(--ink);
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: 100%;
  min-width: 0;
  height: 100dvh;
  max-width: 760px;
  margin: 0 auto;
  background: rgba(237, 245, 241, 0.96);
  border-inline: 1px solid rgba(18, 32, 28, 0.08);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 252, 250, 0.94));
  box-shadow: 0 8px 22px rgba(18, 32, 28, 0.06);
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--teal);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 1.13rem;
  line-height: 1.18;
}

h2 {
  font-size: 1.08rem;
}

.top-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.top-stats span {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid #dce7e2;
  border-radius: 999px;
  background: #f4faf7;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.top-stats strong {
  color: var(--teal-dark);
}

.top-stats .connection-status {
  gap: 5px;
  border-color: #cfe5dc;
  background: #f2faf6;
}

.connection-status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #16865e;
  box-shadow: 0 0 0 3px rgba(22, 134, 94, 0.1);
}

.top-stats .connection-status.offline {
  border-color: #f2d6a5;
  background: #fff8e8;
}

.connection-status.offline i {
  background: #d97706;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.12);
}

.connection-status.offline strong {
  color: #9a5709;
}

main {
  min-width: 0;
  min-height: 0;
  position: relative;
}

.screen {
  display: none;
  min-width: 0;
  height: 100%;
  min-height: 0;
  padding: 12px 12px calc(96px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.25), rgba(226, 240, 234, 0.48));
  overflow: auto;
  scroll-padding-bottom: calc(96px + env(safe-area-inset-bottom));
}

.screen.active {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search-row,
.google-toolbar,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.search-row,
.google-toolbar {
  min-width: 0;
}

.coordinate-review-strip {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto auto auto;
  align-items: center;
  gap: 7px;
  padding: 7px;
  border: 1px solid #d4e3de;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(235, 246, 242, 0.96));
  box-shadow: 0 7px 18px rgba(18, 32, 28, 0.07);
}

.coordinate-review-strip > div {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.coordinate-review-strip span {
  color: var(--teal);
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.coordinate-review-strip strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.74rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coordinate-review-strip small {
  overflow: hidden;
  color: #647771;
  font-size: 0.58rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coordinate-review-strip .review-progress-track {
  display: block;
  width: 100%;
  height: 4px;
  margin-top: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: #dce8e4;
}

.coordinate-review-strip .review-progress-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0b7c71, #22b38d);
  box-shadow: 0 0 9px rgba(11, 124, 113, 0.24);
  transition: width 300ms ease;
}

.coordinate-review-strip button {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid #cdded8;
  border-radius: 8px;
  background: #ffffff;
  color: var(--teal-dark);
  font: inherit;
  font-size: 0.68rem;
  font-weight: 850;
  white-space: nowrap;
}

.coordinate-review-strip .review-verify-button {
  border-color: #087269;
  background: #087269;
  color: #ffffff;
  box-shadow: 0 4px 11px rgba(8, 114, 105, 0.18);
}

.coordinate-review-strip button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.review-session-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.review-session-summary > div {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 8px;
  min-width: 0;
  padding: 9px 10px 9px 13px;
  overflow: hidden;
  border: 1px solid #d9e5e1;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.9);
}

.review-session-summary > div::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: #0b7c71;
  content: "";
}

.review-session-summary span {
  align-self: end;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.66rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-session-summary strong {
  grid-row: 1 / 3;
  grid-column: 2;
  align-self: center;
  color: var(--teal-dark);
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.review-session-summary small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.55rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-session-summary .adjusted::before { background: #d58b19; }
.review-session-summary .adjusted strong { color: #9a5c00; }
.review-session-summary .rejected::before { background: #cf3157; }
.review-session-summary .rejected strong { color: #ad2045; }
.review-session-summary .remaining::before { background: #648078; }
.review-session-summary .remaining strong { color: #435d56; }

.topbar > div {
  min-width: 0;
}

.section-heading {
  display: block;
  padding: 2px 2px 4px;
}

.section-heading p {
  margin-top: 4px;
}

.list-heading-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.nearby-sort {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 9px;
  background: white;
  color: #1d4ed8;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.08);
  font-size: 0.76rem;
  font-weight: 850;
  white-space: nowrap;
}

.nearby-sort.active {
  background: #2563eb;
  color: white;
}

.search-box {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 13px;
  border: 1px solid rgba(15, 118, 110, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--muted);
  box-shadow: 0 8px 20px rgba(18, 32, 28, 0.07);
}

.search-box svg {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  margin-right: 7px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.3;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.map-mode-bar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.map-mode {
  min-width: 0;
  height: 42px;
  border: 1px solid rgba(15, 118, 110, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 900;
}

.map-mode.active {
  background: linear-gradient(180deg, #13877e, var(--teal-dark));
  color: white;
  box-shadow: 0 9px 18px rgba(15, 118, 110, 0.18);
}

.tool-button,
.primary-button,
.secondary-button,
.route-button,
.fullscreen-trigger,
.icon-button {
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.fullscreen-trigger,
.fullscreen-exit {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--teal-dark);
  box-shadow: 0 8px 18px rgba(18, 32, 28, 0.09);
}

.fullscreen-trigger svg,
.fullscreen-exit svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.1;
}

.tool-button,
.secondary-button {
  height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(15, 118, 110, 0.14);
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(18, 32, 28, 0.07);
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  background: linear-gradient(180deg, #13877e, var(--teal-dark));
  color: white;
  box-shadow: 0 10px 18px rgba(15, 118, 110, 0.22);
}

.primary-button:active,
.icon-button:active {
  background: var(--teal-dark);
}

.route-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 0 12px;
  background: #2563eb;
  color: white;
  box-shadow: 0 9px 18px rgba(37, 99, 235, 0.2);
}

.route-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.route-button:active {
  background: #1d4ed8;
}

.icon-button {
  width: 40px;
  height: 40px;
  background: var(--teal);
  color: white;
  font-size: 1.3rem;
}

.hidden {
  display: none;
}

.map-stage {
  position: relative;
  /* The map is a primary surface. Keep it tall and let the screen scroll below it. */
  flex: 0 0 clamp(340px, 52dvh, 500px);
  width: 100%;
  height: clamp(340px, 52dvh, 500px);
  min-height: 340px;
  overflow: hidden;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 16px;
  background: var(--map-backdrop);
  box-shadow: 0 16px 34px rgba(18, 32, 28, 0.14);
  touch-action: none;
}

.map-stage.fullscreen {
  position: fixed;
  inset: 0;
  z-index: 3000;
  width: 100%;
  height: 100dvh;
  min-height: 0;
  max-height: none;
  flex: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.fullscreen-exit {
  position: absolute;
  left: max(12px, env(safe-area-inset-left));
  top: max(12px, env(safe-area-inset-top));
  z-index: 1200;
  background: rgba(255, 255, 255, 0.94);
}

.fullscreen-exit.hidden {
  display: none;
}

.map-stage.fullscreen .atlas-title {
  left: max(62px, calc(env(safe-area-inset-left) + 62px));
}

body.map-is-fullscreen {
  overscroll-behavior: none;
}

.map-layer {
  position: absolute;
  inset: 0;
}

.map-layer.hidden {
  display: none;
}

.atlas-layer {
  overflow: hidden;
  background: #dfe9e5;
}

.real-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  background: #dfe9e5;
}

.navigation-rotation-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  /* The map pane must be allowed to extend past its unrotated box. The
     atlas layer clips the final result, otherwise a 90deg turn exposes a
     blank strip where the rotated rectangle was clipped too early. */
  overflow: visible;
  pointer-events: auto;
  transform: rotate(var(--navigation-rotation, 0deg)) scale(var(--navigation-scale, 1));
  transform-origin: center;
}

.navigation-rotation-layer.rotating {
  transition: transform 0.45s ease-out;
}

.real-map .leaflet-tile-pane {
  filter: saturate(0.9) contrast(1.02) brightness(1.015);
}

.map-tools {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 710;
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-tools > .map-tool-action,
.map-options summary {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 18px rgba(18, 32, 28, 0.12);
  cursor: pointer;
}

.map-options {
  position: relative;
}

.map-options summary {
  list-style: none;
}

.map-options summary::-webkit-details-marker {
  display: none;
}

.map-options[open] summary {
  background: #e6f3f0;
  color: var(--teal-dark);
}

.map-options-symbol,
.reset-map-symbol {
  position: relative;
  display: block;
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-radius: 4px;
}

.map-options-symbol::before,
.map-options-symbol::after {
  position: absolute;
  left: 2px;
  right: 2px;
  height: 2px;
  background: currentColor;
  content: "";
}

.map-options-symbol::before { top: 3px; }
.map-options-symbol::after { bottom: 3px; }

.reset-map-symbol {
  border-radius: 50%;
  border-left-color: transparent;
  transform: rotate(-38deg);
}

.reset-map-symbol::after {
  position: absolute;
  right: -4px;
  top: -3px;
  border: 4px solid transparent;
  border-bottom-color: currentColor;
  content: "";
  transform: rotate(50deg);
}

.map-options-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  display: grid;
  width: 218px;
  gap: 7px;
  padding: 8px;
  border: 1px solid rgba(15, 118, 110, 0.15);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 30px rgba(18, 32, 28, 0.16);
  backdrop-filter: blur(14px);
}

.map-options:not([open]) .map-options-panel {
  display: none;
}

.map-options-panel .map-mode-bar {
  gap: 4px;
}

.map-options-panel .map-mode {
  height: 34px;
  border-radius: 8px;
  font-size: 0.7rem;
}

.basemap-switch {
  display: flex;
  padding: 2px;
  border-radius: 8px;
  background: #edf3f1;
}

.basemap-option,
.map-tool-action {
  min-height: 30px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #4e5d58;
  font: inherit;
  font-size: 0.66rem;
  font-weight: 850;
  white-space: nowrap;
}

.basemap-option {
  padding: 0 9px;
}

.basemap-option.active {
  background: white;
  color: var(--teal-dark);
  box-shadow: 0 2px 7px rgba(18, 32, 28, 0.12);
}

.map-tool-action {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
}

.map-options-panel .map-tool-action {
  justify-content: flex-start;
  min-height: 34px;
  padding-inline: 9px;
  border: 1px solid rgba(15, 118, 110, 0.1);
  border-radius: 8px;
}

.map-tool-action:hover,
.map-tool-action.active {
  background: #e6f3f0;
  color: var(--teal-dark);
}

.map-tool-check {
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.map-tool-action.active .map-tool-check {
  background: var(--teal);
  box-shadow: inset 0 0 0 2px white;
}

.locate-symbol {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px white;
  background: currentColor;
}

.edit-coordinate-symbol {
  position: relative;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
}

.edit-coordinate-symbol::after {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  content: "";
  transform: translate(-50%, -50%);
}

.google-anchor-symbol {
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  background: #f6c453;
  box-shadow: inset 0 0 0 2px #ffffff;
  transform: rotate(45deg);
}

.real-map.coordinate-editing,
.real-map.coordinate-editing .leaflet-marker-icon {
  cursor: move;
}

.locate-action.loading .locate-symbol {
  animation: locate-pulse 0.9s ease-in-out infinite alternate;
}

@keyframes locate-pulse {
  to { opacity: 0.35; transform: scale(0.78); }
}

.pdf-opacity-control {
  display: grid;
  gap: 2px;
  width: 90px;
  padding: 0 5px;
  color: #4e5d58;
  font-size: 0.58rem;
  font-weight: 800;
}

.pdf-opacity-control.hidden {
  display: none;
}

.pdf-opacity-control input {
  width: 100%;
  accent-color: var(--teal);
}

.real-map .leaflet-control-zoom {
  overflow: hidden;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 12px;
  box-shadow: 0 8px 18px rgba(18, 32, 28, 0.15);
}

.real-map .leaflet-control-zoom a {
  width: 38px;
  height: 38px;
  border-bottom-color: var(--line);
  color: var(--ink);
  font-size: 1.25rem;
  line-height: 38px;
}

.real-map .leaflet-control-attribution {
  padding: 3px 6px;
  border-radius: 8px 0 0 0;
  background: rgba(255, 255, 255, 0.88);
  color: #50605b;
  font-size: 0.58rem;
}

.real-map .leaflet-control-attribution a {
  color: var(--teal-dark);
}

.map-load-status {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 650;
  max-width: calc(100% - 40px);
  padding: 9px 12px;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--muted);
  box-shadow: 0 8px 20px rgba(18, 32, 28, 0.12);
  font-size: 0.76rem;
  font-weight: 800;
  text-align: center;
  transform: translate(-50%, -50%);
}

.map-load-status.hidden {
  display: none;
}

.map-coordinate-readout {
  position: absolute;
  left: 50%;
  bottom: 14px;
  z-index: 720;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--teal-dark);
  box-shadow: 0 7px 18px rgba(18, 32, 28, 0.16);
  font-size: 0.7rem;
  font-weight: 850;
  transform: translateX(-50%);
  white-space: nowrap;
}

.map-coordinate-readout.hidden {
  display: none;
}

.real-map .leaflet-control-scale-line {
  border-color: rgba(18, 32, 28, 0.72);
  border-top: 0;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  font-size: 0.62rem;
  font-weight: 800;
}

.leaflet-hamlet-marker {
  border: 0;
  background: transparent;
}

.leaflet-cluster-icon {
  border: 0;
  background: transparent;
}

.leaflet-google-anchor {
  border: 0;
  background: transparent;
}

.google-landmark-pin {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 2px solid #ffffff;
  border-radius: 50% 50% 50% 0;
  background: linear-gradient(145deg, #f7c948, #d88a08);
  color: #5f3600;
  box-shadow: 0 0 0 3px rgba(216, 138, 8, 0.18), 0 5px 12px rgba(72, 45, 5, 0.3);
  transform: rotate(-45deg);
  animation: google-anchor-arrive 360ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.google-landmark-pin small {
  font-size: 0.58rem;
  font-weight: 950;
  transform: rotate(45deg);
}

.google-landmark-pin.provisional {
  border-color: #a96a05;
  border-style: dashed;
  background: linear-gradient(145deg, #fff8e4, #efc76f);
  box-shadow: 0 0 0 3px rgba(169, 106, 5, 0.13), 0 5px 12px rgba(72, 45, 5, 0.22);
}

@keyframes google-anchor-arrive {
  from {
    opacity: 0;
    transform: translateY(-10px) rotate(-45deg) scale(0.7);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotate(-45deg) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .google-landmark-pin {
    animation: none;
  }

  .coordinate-review-strip .review-progress-track i {
    transition: none;
  }
}

.map-cluster {
  display: grid;
  align-content: center;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.96);
  border-radius: 50%;
  background: #245c68;
  color: white;
  box-shadow: 0 0 0 4px rgba(36, 92, 104, 0.14), 0 6px 16px rgba(18, 32, 28, 0.28);
  font-size: 0.72rem;
  font-weight: 950;
  line-height: 0.9;
}

.map-cluster strong {
  font-size: 0.78rem;
}

.map-cluster small {
  font-size: 0.46rem;
  font-weight: 800;
  opacity: 0.8;
  text-transform: uppercase;
}

.hamlet-map-pin {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border: 2px solid rgba(255, 255, 255, 0.96);
  border-radius: 50%;
  background: #ffffff;
  color: var(--teal-dark);
  box-shadow: 0 4px 12px rgba(18, 32, 28, 0.24);
  font-size: 0.62rem;
  font-weight: 950;
}

.hamlet-map-pin.high-population {
  background: #fff5f7;
  color: var(--rose-dark);
  box-shadow: 0 4px 12px rgba(169, 31, 67, 0.22);
}

.hamlet-map-pin.evidence-gap:not(.selected):not(.coordinate-adjusted) {
  border-color: #d58b19;
  border-style: dashed;
  box-shadow: 0 0 0 3px rgba(213, 139, 25, 0.14), 0 4px 12px rgba(18, 32, 28, 0.2);
}

.hamlet-map-pin.constituent-control:not(.selected):not(.coordinate-adjusted) {
  border-color: #2776b8;
  border-style: dotted;
  box-shadow: 0 0 0 3px rgba(39, 118, 184, 0.14), 0 4px 12px rgba(18, 32, 28, 0.2);
}

.hamlet-map-pin.provisional-control:not(.selected):not(.coordinate-adjusted) {
  border-color: #71899c;
  border-style: dashed;
  background: #f4f7f9;
  box-shadow: 0 0 0 3px rgba(113, 137, 156, 0.14), 0 4px 12px rgba(18, 32, 28, 0.18);
}

.hamlet-map-pin.selected {
  width: 34px;
  height: 34px;
  background: linear-gradient(180deg, #13877e, var(--teal-dark));
  color: white;
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.18), 0 8px 18px rgba(7, 94, 87, 0.3);
  font-size: 0.72rem;
}

.hamlet-map-pin.coordinate-adjusted {
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2), 0 4px 12px rgba(18, 32, 28, 0.24);
}

.hamlet-map-pin.coordinate-estimated:not(.selected):not(.coordinate-adjusted) {
  border-color: #b97812;
  border-style: dashed;
  background: #fffaf0;
  color: #7a4a00;
  box-shadow: 0 0 0 3px rgba(185, 120, 18, 0.12), 0 4px 12px rgba(18, 32, 28, 0.18);
}

.hamlet-map-pin.coordinate-verified {
  border-color: #ffffff;
  outline: 3px solid rgba(5, 150, 105, 0.72);
  box-shadow: 0 0 0 6px rgba(5, 150, 105, 0.13), 0 5px 14px rgba(5, 92, 68, 0.25);
}

.real-map .leaflet-popup-content-wrapper {
  border: 1px solid rgba(15, 118, 110, 0.14);
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(18, 32, 28, 0.18);
}

.real-map .leaflet-popup-content {
  min-width: 150px;
  margin: 11px 13px;
  color: var(--ink);
  font-family: inherit;
  line-height: 1.35;
}

.map-popup-title {
  display: block;
  margin-bottom: 3px;
  color: var(--teal-dark);
  font-size: 0.88rem;
  font-weight: 900;
}

.map-popup-meta {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
}

.map-popup-coordinate {
  display: block;
  margin-top: 5px;
  color: var(--teal-dark);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.01em;
}

.map-popup-reference {
  display: block;
  margin-top: 6px;
  color: #7a5a18;
  font-size: 0.66rem;
  font-weight: 750;
}

.map-popup-route {
  display: inline-flex;
  margin-top: 8px;
  color: #1d4ed8;
  font-size: 0.72rem;
  font-weight: 850;
  text-decoration: none;
}

.atlas-title {
  position: absolute;
  left: 14px;
  top: 12px;
  display: grid;
  gap: 2px;
  padding: 9px 11px;
  border: 1px solid rgba(15, 118, 110, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 20px rgba(18, 32, 28, 0.08);
  backdrop-filter: blur(12px);
  z-index: 700;
  pointer-events: none;
}

.atlas-title span {
  color: var(--teal);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.atlas-title strong {
  font-size: 0.9rem;
}

.atlas-title small {
  margin-top: 2px;
  color: #55716a;
  font-size: 0.6rem;
  font-weight: 800;
}

.atlas-title .mymaps-source-link {
  width: fit-content;
  margin-top: 4px;
  padding: 4px 7px;
  border: 1px solid rgba(180, 83, 9, 0.28);
  border-radius: 999px;
  background: rgba(255, 251, 235, 0.94);
  color: #9a4f08;
  font-size: 0.58rem;
  font-weight: 900;
  line-height: 1;
  pointer-events: auto;
  text-decoration: none;
}

.atlas-title .mymaps-source-link:hover {
  background: #fff3d9;
  color: #713905;
}

.atlas-title .google-link-status.audited {
  color: #966000;
}

.atlas-title .google-link-status.audited::before {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border-radius: 50%;
  background: #d58b19;
  box-shadow: 0 0 0 3px rgba(213, 139, 25, 0.14);
  content: "";
  vertical-align: 1px;
}

/* The selected hamlet is useful; the full audit heading duplicates the detail view. */
.atlas-title {
  display: none;
}

.atlas-legend {
  position: absolute;
  right: 14px;
  top: 64px;
  display: grid;
  gap: 5px;
  padding: 9px 10px;
  border: 1px solid rgba(15, 118, 110, 0.15);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 22px rgba(18, 32, 28, 0.1);
  backdrop-filter: blur(12px);
  z-index: 700;
  pointer-events: none;
}

.atlas-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #475651;
  font-size: 0.68rem;
  font-weight: 800;
  white-space: nowrap;
}

.atlas-legend i {
  display: block;
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.atlas-legend .legend-selected {
  background: var(--teal-dark);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.15);
}

.atlas-legend .legend-population {
  background: var(--rose);
  box-shadow: 0 0 0 2px rgba(211, 53, 86, 0.12);
}

.atlas-legend .legend-adjusted {
  border: 2px solid #f59e0b;
  background: #ffffff;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.14);
}

.atlas-legend .legend-verified {
  border: 2px solid #ffffff;
  background: #087269;
  box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.72);
}

.atlas-legend .legend-boundary {
  width: 12px;
  height: 0;
  border-top: 2px dashed var(--teal);
  border-radius: 0;
}

.atlas-legend .legend-hamlet-boundary {
  width: 14px;
  height: 8px;
  border: 2px solid #b45309;
  border-radius: 3px;
  background: rgba(180, 83, 9, 0.18);
  box-shadow: none;
}

.atlas-legend .legend-google-anchor {
  width: 9px;
  height: 9px;
  border: 1px solid #ffffff;
  border-radius: 1px;
  background: #e6a91c;
  box-shadow: 0 0 0 1px #bd7907;
  transform: rotate(45deg);
}

.atlas-legend .legend-evidence-gap {
  border: 2px dashed #d58b19;
  background: #ffffff;
  box-shadow: 0 0 0 2px rgba(213, 139, 25, 0.12);
}

.atlas-legend .legend-constituent-control {
  border: 2px dotted #2776b8;
  background: #eef7ff;
  box-shadow: 0 0 0 2px rgba(39, 118, 184, 0.12);
}

.atlas-legend .legend-provisional-control {
  border: 2px dashed #71899c;
  background: #f4f7f9;
  box-shadow: 0 0 0 2px rgba(113, 137, 156, 0.12);
}

.map-canvas {
  position: absolute;
  left: 0;
  top: 0;
  width: 7265px;
  height: 5224px;
  transform-origin: 0 0;
  will-change: transform;
}

#mapImage {
  display: block;
  width: 7265px;
  height: 5224px;
  filter: saturate(0.88) contrast(1.06) brightness(1.03);
  user-select: none;
  pointer-events: none;
}

.marker-layer {
  position: absolute;
  inset: 0;
}

.marker {
  position: absolute;
  display: grid;
  place-items: center;
  width: var(--marker-width, 32px);
  height: var(--marker-height, 32px);
  border: 1px solid rgba(11, 107, 96, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--teal-dark);
  cursor: pointer;
  font-size: var(--marker-font-size, 0.72rem);
  font-weight: 900;
  padding: 0;
  box-shadow: 0 10px 24px rgba(15, 80, 69, 0.12);
  text-shadow: none;
  transform: translate(-50%, -50%);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.marker:hover {
  transform: translate(-50%, -50%) scale(1.06);
  box-shadow: 0 12px 26px rgba(15, 80, 69, 0.18);
}

.marker span {
  display: grid;
  place-items: center;
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
}

.marker.selected {
  width: var(--marker-selected-width, 46px);
  height: var(--marker-selected-height, 46px);
  background: linear-gradient(180deg, #13877e, #075f56);
  color: white;
  outline: 0;
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.16), 0 12px 26px rgba(7, 94, 87, 0.24);
  z-index: 3;
}

.map-google-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #edf4f1;
}

.map-google-panel {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 8px 9px 8px 12px;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 24px rgba(18, 32, 28, 0.13);
  backdrop-filter: blur(12px);
}

.map-google-panel.hidden {
  display: none;
}

.map-google-panel span {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-google-panel a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 11px;
  border-radius: 11px;
  background: linear-gradient(180deg, #13877e, var(--teal-dark));
  color: white;
  font-size: 0.78rem;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.map-stage:not(.pdf-mode) .zoom-controls {
  display: none;
}

.map-stage:not(.atlas-mode) .atlas-legend {
  display: none;
}

.zoom-controls {
  position: absolute;
  right: 12px;
  top: 12px;
  display: grid;
  gap: 7px;
}

.zoom-controls button {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(15, 118, 110, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(18, 32, 28, 0.14);
}

.quick-panel,
.hamlet-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
}

.quick-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 13px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fcfa 100%);
  border-color: rgba(15, 118, 110, 0.12);
  box-shadow: 0 14px 28px rgba(18, 32, 28, 0.09);
}

.selected-summary {
  min-width: 0;
}

.selected-summary strong {
  display: block;
  font-size: 1.06rem;
  line-height: 1.2;
}

.selected-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.selected-stats span {
  display: inline-grid;
  gap: 1px;
  min-width: 62px;
  padding: 6px 8px;
  border: 1px solid #dcebe5;
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fdfb, #eef8f4);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
}

.selected-stats strong {
  color: var(--teal-dark);
  font-size: 0.92rem;
}

.selected-distance {
  display: inline-flex;
  width: fit-content;
  margin-top: 7px !important;
  padding: 5px 8px;
  border-radius: 7px;
  background: #eef4ff;
  color: #1e4e9f !important;
  font-size: 0.7rem !important;
  font-weight: 800;
}

.selected-distance.hidden {
  display: none;
}

.selected-boundary-evidence {
  width: fit-content;
  max-width: 100%;
  margin-top: 7px !important;
  padding: 6px 8px;
  border: 1px solid #dce7e3;
  border-radius: 8px;
  background: #f4f8f6;
  color: #536b64 !important;
  font-size: 0.68rem !important;
  font-weight: 780;
  line-height: 1.45;
}

.map-license-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.55;
}

.map-license-note a {
  color: var(--teal-dark);
  font-weight: 800;
}

.selected-boundary-evidence.strong {
  border-color: rgba(5, 150, 105, 0.22);
  background: #ecf8f2;
  color: #176348 !important;
}

.selected-boundary-evidence.mixed {
  border-color: rgba(37, 99, 235, 0.2);
  background: #eef5ff;
  color: #24528f !important;
}

.selected-boundary-evidence.review {
  border-color: rgba(213, 139, 25, 0.28);
  background: #fff8e8;
  color: #7a5718 !important;
}

.coordinate-audit {
  display: flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  max-width: 100%;
  margin-top: 9px;
  padding: 7px;
  border: 1px solid #d7e6e1;
  border-radius: 11px;
  background: #f8fbfa;
}

.coordinate-audit > div {
  display: grid;
  gap: 1px;
  min-width: 184px;
}

.coordinate-audit span,
.coordinate-audit small {
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 750;
}

.coordinate-audit a {
  width: fit-content;
  color: #1d4ed8;
  font-size: 0.61rem;
  font-weight: 850;
  text-decoration: none;
}

.coordinate-audit a:hover {
  text-decoration: underline;
}

.coordinate-audit a.hidden {
  display: none;
}

.coordinate-audit strong {
  color: var(--teal-dark);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.coordinate-audit small.adjusted {
  color: #a15c00;
}

.coordinate-audit small.verified {
  color: #047857;
}

.coordinate-audit button {
  min-height: 31px;
  padding: 0 9px;
  border: 1px solid #cdded8;
  border-radius: 8px;
  background: #ffffff;
  color: var(--teal-dark);
  font: inherit;
  font-size: 0.64rem;
  font-weight: 850;
  white-space: nowrap;
}

.coordinate-audit button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.coordinate-audit button.hidden {
  display: none;
}

.coordinate-data-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto auto auto;
  align-items: center;
  gap: 9px;
  padding: 12px;
  border: 1px solid #d7e4e0;
  border-radius: 12px;
  background: linear-gradient(135deg, #f8fbfa, #eef6f3);
}

.coordinate-data-tools h3 {
  margin: 0 0 3px;
  color: var(--ink);
  font-size: 0.84rem;
}

.coordinate-data-tools p {
  margin: 0;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.35;
}

.coordinate-data-tools .secondary-button {
  min-height: 36px;
  padding-inline: 11px;
  font-size: 0.68rem;
  white-space: nowrap;
}

.coordinate-data-tools .google-review-download {
  text-decoration: none;
}

.coordinate-data-tools .secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.coordinate-data-tools .certificate-button:not(:disabled) {
  border-color: #087269;
  background: #087269;
  color: #ffffff;
  box-shadow: 0 4px 11px rgba(8, 114, 105, 0.18);
}

.coordinate-import-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.coordinate-import-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.coordinate-history {
  overflow: hidden;
  border: 1px solid #d7e4e0;
  border-radius: 12px;
  background: #ffffff;
}

.coordinate-history summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  cursor: pointer;
  list-style: none;
}

.coordinate-history summary::-webkit-details-marker {
  display: none;
}

.coordinate-history summary span {
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 850;
}

.coordinate-history summary strong {
  padding: 3px 7px;
  border-radius: 999px;
  background: #edf5f2;
  color: var(--teal-dark);
  font-size: 0.62rem;
}

.coordinate-history[open] summary {
  border-bottom: 1px solid #e2ebe8;
  background: #f7faf9;
}

.coordinate-history-list {
  display: grid;
  padding: 5px 12px 10px;
}

.coordinate-history-item {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #edf2f0;
}

.coordinate-history-item:last-child {
  border-bottom: 0;
}

.coordinate-history-item > i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #0b7c71;
  box-shadow: 0 0 0 3px rgba(11, 124, 113, 0.12);
}

.coordinate-history-item.rejected > i {
  background: #cf3157;
  box-shadow: 0 0 0 3px rgba(207, 49, 87, 0.12);
}

.coordinate-history-item > span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.coordinate-history-item strong {
  color: var(--ink);
  font-size: 0.7rem;
}

.coordinate-history-item small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.61rem;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coordinate-history-item time {
  color: #73817d;
  font-size: 0.58rem;
  white-space: nowrap;
}

.coordinate-history-empty {
  padding: 18px 4px;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
}

.quick-actions {
  display: grid;
  align-content: center;
  gap: 8px;
  min-width: 102px;
}

.quick-panel p,
.section-heading p,
.google-toolbar p {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.hamlet-list {
  display: grid;
  gap: 10px;
  padding-bottom: 10px;
}

.list-filter-bar {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  padding: 4px;
  border: 1px solid #d7e4e0;
  border-radius: 10px;
  background: #eaf1ee;
}

.list-filter-bar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 34px;
  padding: 0 7px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #5c6c67;
  font: inherit;
  font-size: 0.66rem;
  font-weight: 850;
  white-space: nowrap;
}

.list-filter-bar button span {
  min-width: 19px;
  padding: 2px 5px;
  border-radius: 999px;
  background: rgba(82, 104, 97, 0.1);
  font-size: 0.58rem;
  font-variant-numeric: tabular-nums;
}

.list-filter-bar button.active {
  background: #ffffff;
  color: var(--teal-dark);
  box-shadow: 0 3px 9px rgba(18, 32, 28, 0.1);
}

.list-filter-bar button.active span {
  background: #dff1ec;
  color: #067065;
}

.list-empty-state {
  display: grid;
  place-items: center;
  gap: 4px;
  min-height: 180px;
  padding: 24px;
  border: 1px dashed #cdded8;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  text-align: center;
}

.list-empty-state strong {
  color: var(--ink);
  font-size: 0.9rem;
}

.list-empty-state span {
  font-size: 0.76rem;
}

.hamlet-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 13px 12px;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 5px 14px rgba(18, 32, 28, 0.05);
}

.hamlet-item strong {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 3px;
}

.hamlet-item em {
  color: var(--muted);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 800;
}

.hamlet-item span {
  color: var(--muted);
  font-size: 0.86rem;
}

.population-bar {
  display: block;
  height: 5px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5eee9;
}

.population-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--blue));
}

.hamlet-item .badge {
  align-self: start;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef6ff;
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 900;
}

.item-badges {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.distance-badge {
  padding: 4px 8px;
  border-radius: 999px;
  background: #e9f7f3;
  color: var(--teal-dark) !important;
  font-size: 0.72rem !important;
  font-weight: 900;
  white-space: nowrap;
}

.coordinate-badge {
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.66rem !important;
  font-weight: 900;
  white-space: nowrap;
}

.coordinate-badge.calibrated {
  border-color: #d4e3de;
  background: #f2f7f5;
  color: #527068 !important;
}

.coordinate-badge.adjusted {
  border-color: #f1d195;
  background: #fff8e8;
  color: #9a5b00 !important;
}

.coordinate-badge.verified {
  border-color: #a7dec8;
  background: #eaf9f2;
  color: #047857 !important;
}

.coordinate-badge.google-landmark {
  border-color: #efd08a;
  background: #fff7dc;
  color: #8a5700 !important;
}

.coordinate-badge.google-landmark.provisional {
  border-style: dashed;
  background: #fffaf0;
}

.coordinate-badge.constituent-area {
  border-color: #a9cfea;
  border-style: dotted;
  background: #eef7ff;
  color: #1f639b !important;
}

.coordinate-badge.constituent-area.provisional {
  border-color: #b9c8d2;
  border-style: dashed;
  background: #f4f7f9;
  color: #526b7c !important;
}

.coordinate-badge.evidence-gap {
  border-color: #e7c37d;
  border-style: dashed;
  background: #fffaf0;
  color: #8a5700 !important;
}

.coordinate-badge.review-priority {
  border-color: #efb5c1;
  background: #fff0f3;
  color: #a51d42 !important;
}

.google-toolbar {
  align-items: flex-start;
  padding: 2px;
}

.compare-grid {
  display: grid;
  grid-template-rows: minmax(320px, 1fr);
  gap: 10px;
  flex: 1;
  min-height: 0;
}

.compare-map-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-height: 320px;
}

.google-frame {
  width: 100%;
  height: 100%;
  min-height: 320px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef3f1;
  box-shadow: var(--shadow);
}

.compare-reference-card {
  position: relative;
  min-width: 0;
  min-height: 320px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #dfe9e5;
  box-shadow: var(--shadow);
}

.compare-reference-map {
  position: absolute;
  inset: 0;
}

.compare-reference-map .leaflet-tile-pane {
  filter: saturate(0.9) contrast(1.02) brightness(1.015);
}

.compare-reference-map .leaflet-control-attribution {
  max-width: 78%;
  font-size: 0.5rem;
}

.compare-reference-map .leaflet-control-zoom {
  overflow: hidden;
  border: 1px solid rgba(8, 114, 105, 0.18);
  border-radius: 8px;
  box-shadow: 0 5px 12px rgba(18, 32, 28, 0.12);
}

.compare-basemap-switch {
  position: absolute;
  left: 50%;
  bottom: 18px;
  z-index: 600;
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid rgba(8, 114, 105, 0.16);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.93);
  box-shadow: 0 6px 15px rgba(18, 32, 28, 0.14);
  backdrop-filter: blur(9px);
  transform: translateX(-50%);
}

.compare-basemap-switch button {
  min-height: 29px;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #586a64;
  font: inherit;
  font-size: 0.62rem;
  font-weight: 850;
  white-space: nowrap;
}

.compare-basemap-switch button.active {
  background: #087269;
  color: #ffffff;
  box-shadow: 0 3px 8px rgba(8, 114, 105, 0.2);
}

.coordinate-nudge-controls {
  position: absolute;
  left: 50%;
  bottom: 58px;
  z-index: 600;
  display: flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid rgba(8, 114, 105, 0.15);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.93);
  box-shadow: 0 6px 15px rgba(18, 32, 28, 0.13);
  backdrop-filter: blur(9px);
  transform: translateX(-50%);
}

.coordinate-nudge-controls button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: #f1f7f5;
  color: var(--teal-dark);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 900;
}

.coordinate-nudge-controls button:hover,
.coordinate-nudge-controls button:active {
  background: #dff0eb;
  transform: translateY(-1px);
}

.coordinate-nudge-controls .nudge-step {
  width: 42px;
  background: #087269;
  color: #ffffff;
  font-size: 0.62rem;
}

.compare-reference-label {
  position: absolute;
  left: 9px;
  right: 9px;
  top: 9px;
  z-index: 500;
  display: grid;
  gap: 1px;
  padding: 7px 9px;
  border: 1px solid rgba(8, 114, 105, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 5px 14px rgba(18, 32, 28, 0.11);
  backdrop-filter: blur(9px);
  pointer-events: none;
}

.compare-reference-label span {
  color: var(--teal);
  font-size: 0.56rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.compare-reference-label strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.65rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compare-reference-marker {
  border: 0;
  background: transparent;
  cursor: grab;
}

.compare-reference-marker.leaflet-drag-target {
  cursor: grabbing;
}

.compare-reference-marker span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: linear-gradient(180deg, #13877e, #075f56);
  color: #ffffff;
  box-shadow: 0 0 0 4px rgba(8, 114, 105, 0.17), 0 7px 16px rgba(7, 95, 86, 0.28);
  font-size: 0.72rem;
  font-weight: 950;
  transition: box-shadow 160ms ease, transform 160ms ease;
}

.compare-reference-marker:hover span,
.compare-reference-marker.leaflet-drag-target span {
  box-shadow: 0 0 0 6px rgba(8, 114, 105, 0.2), 0 10px 22px rgba(7, 95, 86, 0.35);
  transform: scale(1.08);
}

.compare-pdf {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 6px 16px rgba(18, 32, 28, 0.06);
}

.compare-pdf p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.compare-image-wrap {
  position: relative;
  aspect-ratio: 1.39;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfa;
}

.compare-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.compare-pin {
  position: absolute;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 2px solid white;
  border-radius: 50%;
  background: var(--teal);
  color: white;
  font-size: 0.78rem;
  font-weight: 900;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
  transform: translate(-50%, -50%);
}

.detail-card {
  padding: 0 2px 12px;
}

.detail-subtitle {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.info-grid {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.info-grid div {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.info-grid dd a {
  color: var(--teal-dark);
  font-weight: 850;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
}

dt {
  color: var(--muted);
  font-size: 0.82rem;
}

dd {
  margin: 0;
  font-weight: 700;
}

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

.stats-grid div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 5px 14px rgba(18, 32, 28, 0.05);
}

.stats-grid div:nth-child(1) {
  border-top: 3px solid var(--teal);
}

.stats-grid div:nth-child(2) {
  border-top: 3px solid var(--blue);
}

.stats-grid div:nth-child(3),
.stats-grid div:nth-child(4) {
  border-top: 3px solid var(--amber);
}

.stats-grid div:nth-child(5) {
  border-top: 3px solid var(--rose);
}

.stats-grid span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.stats-grid strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 0.95rem;
  line-height: 1.25;
}

.boundary-box {
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 5px 14px rgba(18, 32, 28, 0.05);
}

.boundary-box h3 {
  margin: 0 0 10px;
  font-size: 0.96rem;
}

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

.boundary-grid div {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 8px;
  min-width: 0;
}

.boundary-grid dd {
  overflow-wrap: anywhere;
}

.note-box {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.note-box textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.button-row > * {
  flex: 1 1 128px;
}

.bottom-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 8px 10px calc(9px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(15, 118, 110, 0.12);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  box-shadow: 0 -14px 26px rgba(18, 32, 28, 0.09);
}

.nav-item {
  display: grid;
  gap: 2px;
  place-items: center;
  min-width: 0;
  height: 52px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.nav-item.active {
  background: linear-gradient(180deg, #e8f7f3, #dff1ec);
  color: var(--teal-dark);
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.08);
}

@media (min-width: 720px) {
  .app-shell {
    height: min(920px, 100dvh);
    margin-block: auto;
    box-shadow: var(--shadow);
  }

  .map-stage {
    flex-basis: clamp(360px, 56dvh, 500px);
    height: clamp(360px, 56dvh, 500px);
    min-height: 360px;
  }
}

@media (max-height: 700px) {
  .map-stage {
    flex-basis: 340px;
    height: 340px;
    min-height: 340px;
  }
}

@media (max-width: 520px) {
  .topbar {
    gap: 10px;
    padding-inline: 14px;
    /* Android WebView can report a zero safe-area inset while drawing under the status bar. */
    padding-top: max(36px, calc(12px + env(safe-area-inset-top)));
  }

  .quick-panel {
    grid-template-columns: 1fr;
  }

  /* On a phone, the verification controls should lead instead of the explanatory copy. */
  #googleView .google-toolbar {
    align-items: center;
    gap: 8px;
  }

  #googleView .google-toolbar h2 {
    font-size: 1.05rem;
    line-height: 1.2;
  }

  #googleView .google-toolbar p {
    display: none;
  }

  #googleView .google-toolbar .primary-button {
    min-height: 36px;
    padding-inline: 10px;
    font-size: 0.72rem;
  }

  .quick-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-width: 0;
  }

  .coordinate-audit {
    width: 100%;
    flex-wrap: wrap;
  }

  .coordinate-audit > div {
    flex: 1 1 100%;
    min-width: 0;
  }

  .coordinate-data-tools {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .coordinate-data-tools > div {
    grid-column: 1 / -1;
  }

  .coordinate-data-tools .certificate-button {
    grid-column: 1 / -1;
  }

  .list-filter-bar {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .list-filter-bar::-webkit-scrollbar {
    display: none;
  }

  .list-filter-bar button {
    flex: 0 0 auto;
    padding-inline: 10px;
  }

  .coordinate-review-strip {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  #reviewPreviousBtn {
    grid-column: 1;
    grid-row: 1;
  }

  .coordinate-review-strip > div {
    grid-column: 2;
    grid-row: 1;
  }

  #reviewNextBtn {
    grid-column: 3;
    grid-row: 1;
  }

  .coordinate-review-strip .review-reset-button {
    grid-column: 1;
    grid-row: 2;
  }

  .coordinate-review-strip .review-verify-button {
    grid-column: 2 / 4;
    grid-row: 2;
  }

  .review-session-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .compare-map-pair {
    grid-template-columns: 1fr;
  }

  .compare-reference-card {
    min-height: 260px;
  }

  .atlas-legend {
    display: none;
  }

  .map-options-panel {
    width: min(232px, calc(100vw - 38px));
  }

  .pdf-opacity-control {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 5px);
    width: auto;
    padding: 7px 10px;
    border: 1px solid rgba(15, 118, 110, 0.14);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 7px 16px rgba(18, 32, 28, 0.12);
  }

  .map-coordinate-readout {
    bottom: 38px;
  }
}

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

  .map-tool-check,
  .locate-symbol,
  .edit-coordinate-symbol,
  .google-anchor-symbol {
    margin: 0 3px;
  }
  .tool-button,
  .primary-button,
  .secondary-button,
  .route-button {
    padding-inline: 10px;
    font-size: 0.88rem;
  }

  .quick-panel {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .quick-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .compare-pdf {
    grid-template-columns: 118px 1fr;
  }

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

  .boundary-grid {
    grid-template-columns: 1fr;
  }
}

.navigation-panel {
  position: absolute;
  left: 14px;
  top: 12px;
  z-index: 760;
  display: grid;
  gap: 10px;
  width: min(370px, calc(100% - 84px));
  padding: 12px;
  border: 1px solid rgba(22, 119, 255, 0.2);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 40px rgba(18, 32, 28, 0.22);
  backdrop-filter: blur(16px);
}

.navigation-panel.hidden {
  display: none;
}

.navigation-active .map-tools,
.navigation-active .atlas-title,
.navigation-active .atlas-legend,
.navigation-active .map-coordinate-readout {
  display: none;
}

.navigation-heading,
.navigation-instruction,
.navigation-actions {
  display: flex;
  align-items: center;
}

.navigation-heading {
  justify-content: space-between;
  gap: 10px;
}

.navigation-heading > div {
  min-width: 0;
}

.navigation-heading span,
.navigation-heading strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.navigation-heading span {
  color: #55716a;
  font-size: 0.66rem;
  font-weight: 800;
}

.navigation-status-line {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
}

.navigation-status-line span {
  min-width: 0;
}

.navigation-status-line small {
  flex: 0 0 auto;
  padding: 3px 6px;
  border-radius: 999px;
  background: #edf4f6;
  color: #46625b;
  font-size: 0.54rem;
  font-weight: 850;
  white-space: nowrap;
}

.navigation-heading strong {
  margin-top: 2px;
  color: var(--ink);
  font-size: 0.9rem;
}

.navigation-current-road {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  color: #6a8078;
  font-size: 0.58rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.navigation-heading-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
}

.navigation-heading button {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  font: inherit;
  font-size: 0.68rem;
  font-weight: 850;
}

.navigation-heading .navigation-toggle {
  background: #edf4f6;
  color: #36554d;
}

.navigation-heading .navigation-stop {
  background: #fee8e8;
  color: #a12626;
}

.navigation-mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  padding: 4px;
  border-radius: 12px;
  background: #eaf0ef;
}

.navigation-mode-switch button {
  display: grid;
  gap: 1px;
  min-width: 0;
  min-height: 42px;
  padding: 6px 9px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #55716a;
  font: inherit;
  text-align: left;
}

.navigation-mode-switch button.active {
  background: white;
  color: #075f87;
  box-shadow: 0 4px 12px rgba(18, 32, 28, 0.1);
}

.navigation-mode-switch strong,
.navigation-mode-switch small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.navigation-mode-switch strong {
  font-size: 0.72rem;
}

.navigation-mode-switch small {
  font-size: 0.58rem;
  font-weight: 700;
}

.navigation-instruction {
  gap: 11px;
  min-height: 70px;
  padding: 10px 12px;
  border-radius: 14px;
  background: linear-gradient(135deg, #075f87, #1677ff);
  color: white;
}

.navigation-instruction > span {
  flex: 0 0 auto;
  width: 46px;
  font-size: 2.3rem;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}

.navigation-instruction > div {
  min-width: 0;
}

.navigation-instruction strong,
.navigation-instruction small {
  display: block;
}

.navigation-instruction strong {
  font-size: 0.94rem;
  line-height: 1.32;
}

.navigation-instruction small {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.68rem;
  font-weight: 750;
}

.navigation-instruction .navigation-instruction-next {
  overflow: hidden;
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.58rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.navigation-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.navigation-metrics span {
  min-width: 0;
  padding: 7px 8px;
  border-radius: 10px;
  background: #edf4f6;
  color: #55716a;
  font-size: 0.58rem;
  font-weight: 800;
  text-align: center;
}

.navigation-metrics strong {
  display: block;
  overflow: hidden;
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.navigation-actions {
  flex-wrap: wrap;
  gap: 6px;
}

.navigation-actions button,
.navigation-actions a {
  min-height: 32px;
  padding: 0 9px;
  border: 1px solid #d7e4e1;
  border-radius: 9px;
  background: white;
  color: #435a54;
  font: inherit;
  font-size: 0.62rem;
  font-weight: 850;
  line-height: 30px;
  text-decoration: none;
}

.navigation-trip-bar {
  position: absolute;
  left: 14px;
  bottom: 12px;
  z-index: 760;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: min(520px, calc(100% - 28px));
  padding: 10px 12px;
  border: 1px solid rgba(22, 119, 255, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 16px 38px rgba(18, 32, 28, 0.22);
  backdrop-filter: blur(18px);
}

.navigation-trip-bar.hidden,
.navigation-speedometer.hidden {
  display: none;
}

.navigation-trip-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  min-width: 0;
}

.navigation-trip-metrics span {
  display: grid;
  min-width: 0;
  padding: 5px 7px;
  border-right: 1px solid #e0e9e6;
  text-align: center;
}

.navigation-trip-metrics span:last-child {
  border-right: 0;
}

.navigation-trip-metrics strong,
.navigation-trip-metrics small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.navigation-trip-metrics strong {
  color: #243c35;
  font-size: 0.82rem;
  line-height: 1.2;
}

.navigation-trip-metrics .navigation-arrival strong {
  color: #08766b;
  font-size: 1rem;
}

.navigation-trip-metrics small {
  margin-top: 2px;
  color: #667d76;
  font-size: 0.55rem;
  font-weight: 750;
}

.navigation-trip-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.navigation-trip-actions button {
  display: grid;
  flex: 0 0 auto;
  width: 48px;
  min-height: 48px;
  place-items: center;
  gap: 1px;
  padding: 5px 3px;
  border: 1px solid #d6e2df;
  border-radius: 14px;
  background: white;
  color: #405952;
  font: inherit;
}

.navigation-trip-actions button.active {
  border-color: rgba(22, 119, 255, 0.25);
  background: #e8f2ff;
  color: #145cb7;
}

.navigation-trip-actions button.navigation-stop {
  border-color: #f0d1d1;
  background: #fff0f0;
  color: #a12626;
}

.navigation-trip-actions button > span {
  font-size: 1.22rem;
  font-weight: 850;
  line-height: 1;
}

.navigation-trip-actions button > small {
  font-size: 0.48rem;
  font-weight: 850;
  white-space: nowrap;
}

.navigation-recenter-symbol {
  position: relative;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.navigation-recenter-symbol::after {
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.navigation-voice-symbol {
  position: relative;
  width: 10px;
  height: 14px;
  border-radius: 3px 0 0 3px;
  background: currentColor;
}

.navigation-voice-symbol::after {
  position: absolute;
  left: 7px;
  top: 2px;
  width: 8px;
  height: 8px;
  border: 2px solid currentColor;
  border-bottom-color: transparent;
  border-left-color: transparent;
  border-radius: 50%;
  content: "";
  transform: rotate(45deg);
}

.navigation-speedometer {
  position: absolute;
  left: 16px;
  bottom: 94px;
  z-index: 755;
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  align-content: center;
  border: 3px solid white;
  border-radius: 50%;
  background: #17231f;
  color: white;
  box-shadow: 0 9px 24px rgba(18, 32, 28, 0.28);
}

.navigation-speedometer strong {
  font-size: 1rem;
  line-height: 1;
}

.navigation-speedometer small {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.47rem;
  font-weight: 750;
}

.navigation-compass-button {
  position: absolute;
  right: 16px;
  bottom: 94px;
  z-index: 755;
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  align-content: center;
  gap: 1px;
  border: 3px solid white;
  border-radius: 50%;
  background: white;
  color: #405952;
  box-shadow: 0 9px 24px rgba(18, 32, 28, 0.24);
  font: inherit;
}

.navigation-compass-button.hidden {
  display: none;
}

.navigation-compass-button.active {
  color: #145cb7;
}

.navigation-compass-symbol {
  position: relative;
  display: block;
  width: 18px;
  height: 22px;
  transform: rotate(var(--compass-bearing, 0deg));
  transition: transform 0.45s ease-out;
}

.navigation-compass-symbol::before,
.navigation-compass-symbol::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 0;
  height: 0;
  border-right: 6px solid transparent;
  border-left: 6px solid transparent;
  transform: translateX(-50%);
}

.navigation-compass-symbol::before {
  top: 0;
  border-bottom: 11px solid #d93025;
}

.navigation-compass-symbol::after {
  bottom: 0;
  border-top: 11px solid #7d918b;
}

.navigation-compass-button small {
  color: #526b63;
  font-size: 0.47rem;
  font-weight: 850;
}

.navigation-panel.live-mode .navigation-actions,
.navigation-panel.live-mode .navigation-steps,
.navigation-panel.live-mode .navigation-steps-heading {
  display: none;
}

.navigation-panel.collapsed {
  gap: 0;
  padding-block: 9px;
}

.navigation-panel.collapsed .navigation-mode-switch,
.navigation-panel.collapsed .navigation-instruction,
.navigation-panel.collapsed .navigation-steps-heading,
.navigation-panel.collapsed .navigation-metrics,
.navigation-panel.collapsed .navigation-actions,
.navigation-panel.collapsed .navigation-steps {
  display: none;
}

.navigation-actions button.active {
  border-color: rgba(22, 119, 255, 0.25);
  background: #e8f2ff;
  color: #145cb7;
}

.navigation-actions a {
  margin-left: auto;
  border-color: #1677ff;
  color: #145cb7;
}

.navigation-steps {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.navigation-steps-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
  color: #49625a;
}

.navigation-steps-heading strong {
  font-size: 0.64rem;
  font-weight: 850;
}

.navigation-steps-heading small {
  font-size: 0.56rem;
  font-weight: 750;
}

.navigation-panel.overview-mode .navigation-steps {
  max-height: 270px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.navigation-panel.overview-mode .navigation-steps li {
  display: grid;
}

.navigation-steps li {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding-top: 5px;
  border-top: 1px solid #e2ebe8;
  cursor: pointer;
}

.navigation-steps li:focus-visible {
  border-radius: 8px;
  outline: 2px solid #1677ff;
  outline-offset: 2px;
}

.navigation-steps li:nth-child(n + 4) {
  display: none;
}

.navigation-steps li > span {
  color: #1677ff;
  font-size: 1.05rem;
  font-weight: 900;
  text-align: center;
}

.navigation-steps li div {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.navigation-steps strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.66rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.navigation-steps small {
  flex: 0 0 auto;
  color: #55716a;
  font-size: 0.6rem;
  font-weight: 800;
}

.leaflet-navigation-location {
  border: 0;
  background: transparent;
  transition: transform 0.7s linear;
  will-change: transform;
}

.leaflet-navigation-destination {
  border: 0;
  background: transparent;
}

.navigation-destination-marker {
  position: relative;
  display: block;
  width: 30px;
  height: 30px;
  border: 3px solid white;
  border-radius: 50% 50% 50% 4px;
  background: #d93025;
  box-shadow: 0 5px 14px rgba(121, 24, 18, 0.32);
  transform: rotate(-45deg);
}

.navigation-destination-marker i {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: white;
}

.navigation-location-marker {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(22, 119, 255, 0.16);
  box-shadow: 0 0 0 1px rgba(22, 119, 255, 0.15);
}

.navigation-location-marker::after {
  width: 16px;
  height: 16px;
  border: 3px solid white;
  border-radius: 50%;
  background: #1677ff;
  box-shadow: 0 3px 10px rgba(11, 73, 159, 0.42);
  content: "";
}

.navigation-location-marker.has-heading i {
  position: absolute;
  left: 13px;
  top: -6px;
  width: 0;
  height: 0;
  border-right: 5px solid transparent;
  border-bottom: 13px solid #1677ff;
  border-left: 5px solid transparent;
  filter: drop-shadow(0 2px 2px rgba(11, 73, 159, 0.25));
  transform: rotate(var(--gps-heading));
  transform-origin: 5px 24px;
}

@media (prefers-reduced-motion: no-preference) {
  .navigation-location-marker {
    animation: navigation-gps-pulse 1.8s ease-out infinite;
  }
}

@keyframes navigation-gps-pulse {
  0%, 45% { box-shadow: 0 0 0 1px rgba(22, 119, 255, 0.15); }
  100% { box-shadow: 0 0 0 14px rgba(22, 119, 255, 0); }
}

@media (max-width: 720px) {
  .navigation-panel {
    left: 8px;
    right: 8px;
    top: 8px;
    width: auto;
    padding: 10px;
    border-radius: 15px;
  }

  .navigation-instruction {
    min-height: 62px;
    padding: 8px 10px;
  }

  .navigation-instruction > span {
    width: 38px;
    font-size: 1.9rem;
  }

  .navigation-steps li:nth-child(n + 3) {
    display: none;
  }
}

@media (max-width: 1119px) {
  body.navigation-mode {
    overflow: hidden;
    overscroll-behavior: none;
  }

  body.navigation-mode .app-shell {
    grid-template-rows: minmax(0, 1fr);
    width: 100%;
    max-width: none;
    height: 100dvh;
    max-height: none;
    margin: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0;
  }

  body.navigation-mode .topbar,
  body.navigation-mode #mapView .search-row,
  body.navigation-mode #mapView .quick-panel,
  body.navigation-mode .bottom-nav {
    display: none !important;
  }

  body.navigation-mode main,
  body.navigation-mode #mapView.screen.active {
    width: 100%;
    height: 100dvh;
    min-height: 100dvh;
  }

  body.navigation-mode #mapView.screen.active {
    display: block;
    padding: 0;
    overflow: hidden;
  }

  body.navigation-mode #mapView .map-stage {
    width: 100%;
    height: 100dvh;
    min-height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  body.navigation-mode .fullscreen-exit,
  body.navigation-mode .leaflet-control-scale {
    display: none !important;
  }

  body.navigation-mode .navigation-panel {
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
    top: max(12px, calc(env(safe-area-inset-top) + 10px));
    width: auto;
    max-height: calc(100dvh - max(150px, calc(env(safe-area-inset-top) + 146px)));
    overflow-y: auto;
  }

  body.navigation-mode .leaflet-control-zoom {
    display: none !important;
  }

  body.navigation-mode .navigation-trip-bar {
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    width: auto;
  }

  body.navigation-mode .navigation-speedometer {
    left: max(14px, env(safe-area-inset-left));
    bottom: max(94px, calc(env(safe-area-inset-bottom) + 88px));
  }

  body.navigation-mode .navigation-compass-button {
    right: max(14px, env(safe-area-inset-right));
    bottom: max(94px, calc(env(safe-area-inset-bottom) + 88px));
  }
}

@media (max-width: 520px) {
  body.navigation-mode .navigation-panel {
    top: max(38px, calc(env(safe-area-inset-top) + 10px));
  }

  body.navigation-mode .navigation-panel.live-mode {
    gap: 7px;
  }

  body.navigation-mode .navigation-panel.live-mode .navigation-instruction {
    min-height: 58px;
  }

  body.navigation-mode .navigation-trip-bar {
    gap: 7px;
    padding: 8px;
    border-radius: 16px;
  }

  body.navigation-mode .navigation-trip-metrics span {
    padding-inline: 3px;
  }

  body.navigation-mode .navigation-trip-metrics strong {
    font-size: 0.74rem;
  }

  body.navigation-mode .navigation-trip-metrics .navigation-arrival strong {
    font-size: 0.9rem;
  }

  body.navigation-mode .navigation-trip-actions {
    gap: 4px;
  }

  body.navigation-mode .navigation-trip-actions button {
    width: 44px;
    min-height: 46px;
    border-radius: 12px;
  }
}

@media (max-width: 380px) {
  .navigation-panel {
    gap: 8px;
  }

  .navigation-actions button,
  .navigation-actions a {
    flex: 1 1 auto;
    padding-inline: 7px;
    text-align: center;
  }

  .navigation-actions a {
    margin-left: 0;
  }

  .navigation-steps {
    display: none;
  }

  body.navigation-mode .navigation-trip-actions button {
    width: 41px;
  }

  body.navigation-mode .navigation-trip-actions button > small {
    font-size: 0.43rem;
  }
}

@media (orientation: landscape) and (max-height: 600px) {
  body.navigation-mode .navigation-panel {
    top: max(10px, calc(env(safe-area-inset-top) + 8px));
    width: min(430px, calc(100% - 20px));
    max-height: calc(100dvh - 128px);
  }

  body.navigation-mode .navigation-trip-bar {
    width: min(510px, calc(100% - 20px));
  }
}
