/* Full-screen map shell with collapsible sidebar. Loaded after styles.css. */
html,
body.app-body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.app {
  --rail-w: 60px;
  --panel-w: 380px;
  position: fixed;
  inset: 0;
  display: flex;
  background: var(--paper);
}

.app.rail-expanded {
  --rail-w: 232px;
}

.rail {
  flex: 0 0 var(--rail-w);
  width: var(--rail-w);
  display: flex;
  flex-direction: column;
  padding: 10px 8px;
  gap: 6px;
  background: var(--paper);
  border-right: 1px solid var(--line);
  z-index: 1200;
  overflow: hidden;
  transition: width 0.15s ease, flex-basis 0.15s ease;
}

.rail-top {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.rail-toggle,
.rail-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.rail-toggle:hover,
.rail-item:hover {
  background: #e9ebe2;
}

.rail-item.is-active {
  background: #dfe8dc;
  color: var(--green);
  font-weight: 600;
}

.rail svg {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rail .brand-mark svg {
  fill: currentColor;
  stroke: none;
}

.rail-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 10px;
  color: var(--green);
  text-decoration: none;
  font-family: "DM Serif Display", serif;
  font-size: 20px;
  white-space: nowrap;
}

.brand-mark {
  display: inline-grid;
  flex: 0 0 24px;
}

.brand-mark svg {
  width: 24px;
  height: 24px;
}

.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rail-settings,
.rail-support {
  margin-top: auto;
}

.rail-support + .rail-settings {
  margin-top: 4px;
}

.rail:not(:hover) .rail-label {
  /* labels follow the expanded state only */
}

.app:not(.rail-expanded) .rail-label {
  display: none;
}

.rail :focus-visible,
.view-panel :focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.view-panel {
  flex: 0 0 var(--panel-w);
  width: var(--panel-w);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-right: 1px solid var(--line);
  z-index: 1100;
  min-height: 0;
}

.view-panel[hidden] {
  display: none;
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.view-header h2 {
  margin: 0;
  font-family: "DM Serif Display", serif;
  font-size: 22px;
  font-weight: 400;
  outline: none;
}

.view-close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  color: var(--ink);
}

.view-close:hover {
  background: #eef0ea;
}

.view-close svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.view-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  font-size: 13px;
  line-height: 1.5;
}

.view-lead {
  margin: 0 0 12px;
}

.view-empty,
.view-privacy {
  margin: 10px 0;
  color: var(--muted);
  font-size: 12px;
}

.view-empty[hidden] {
  display: none;
}

.view-button {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.recent-list,
.saved-list {
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
}

.recent-list li + li,
.saved-list li + li {
  border-top: 1px solid #edf0e9;
}

.list-item {
  width: 100%;
  display: block;
  padding: 10px 4px;
  border: 0;
  background: transparent;
  text-align: left;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
}

.list-item:hover {
  background: #f3f5ef;
}

.list-item small {
  display: block;
  color: var(--muted);
}

.view .notes-grid {
  display: grid;
  gap: 12px;
}

.view .status-card {
  margin: 0 0 12px;
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--green);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.map-stage {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.map-stage #map {
  flex: 1 1 0;
  height: auto;
  min-height: 0;
}

.map-search {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1000;
  width: min(340px, calc(100% - 24px));
  padding: 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 2px 10px rgba(25, 40, 29, 0.28);
}

.map-search .search-message,
.map-search .search-attribution {
  margin: 6px 2px 0;
  font-size: 11px;
  color: var(--muted);
}

.map-search .search-results li {
  display: flex;
  align-items: stretch;
}

.map-search .search-result {
  flex: 1;
  min-width: 0;
}

.search-result-save,
.place-save-button {
  flex: 0 0 auto;
  margin: 4px;
  padding: 4px 10px;
  border: 1px solid var(--green);
  border-radius: 6px;
  background: #fff;
  color: var(--green);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.search-result-save:disabled,
.place-save-button:disabled {
  opacity: 0.7;
  cursor: default;
}

.leaflet-popup-content .map-popup {
  overflow-x: hidden;
  padding-right: 4px;
}

.map-popup .eyebrow,
.map-popup > p:first-child {
  padding-right: 44px;
}

.place-facts {
  margin: 6px 0;
}

.place-facts div {
  margin-bottom: 4px;
}

.place-facts dt {
  font-weight: 700;
}

.place-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.place-source {
  margin: 6px 0;
  color: var(--muted);
  font-size: 11px;
}

.map-search .search-message:empty,
.map-search:not(:focus-within) .search-attribution {
  display: none;
}

.map-tools {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.map-tool {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(25, 40, 29, 0.28);
  cursor: pointer;
}

.map-region-jump {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

.map-region-button {
  height: 28px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.04em;
}

.map-tool svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.map-notice {
  flex: 0 0 auto;
  padding: 6px 12px;
  border-top: 1px solid var(--line);
  background: #fff;
  font-size: 11px;
  line-height: 1.4;
  display: flex;
  flex-wrap: wrap;
  column-gap: 16px;
  row-gap: 2px;
}

.map-notice .map-status {
  color: var(--muted);
}

.map-stage .leaflet-bottom.leaflet-left {
  bottom: 0;
}

.search-wrap .search-menu-button {
  display: none;
}

@media (max-width: 800px) {
  .app,
  .app.rail-expanded {
    --rail-w: 0px;
  }

  .rail {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    flex: none;
    width: 232px;
    padding: 10px 8px;
    border-right: 1px solid var(--line);
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.15s ease, visibility 0s linear 0.15s;
  }

  .app.rail-expanded .rail {
    width: 232px;
    transform: none;
    visibility: visible;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.25);
    transition: transform 0.15s ease;
  }

  .view-panel {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    width: auto;
    flex: none;
  }

  .map-search {
    width: calc(100% - 24px - 50px);
  }

  .search-wrap .search-menu-button {
    display: grid;
    place-items: center;
    flex: 0 0 36px;
    width: 36px;
    height: 100%;
    margin: 0;
    padding: 0;
    border-right: 1px solid #dfe2da;
    border-radius: 4px 0 0 4px;
    background: transparent;
    color: var(--ink);
  }

  .search-wrap .search-menu-button:hover {
    background: #e9ebe2;
  }

  .search-wrap .search-menu-button svg {
    width: 20px;
    height: 20px;
    margin: 0;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
  }
}

/* Installed home-screen app: safe areas, touch behavior, no input zoom. */
html,
body.app-body {
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

.app {
  touch-action: manipulation;
}

.map-search {
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: calc(12px + env(safe-area-inset-left, 0px));
}

.rail {
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}

.map-tools {
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: calc(12px + env(safe-area-inset-right, 0px));
}

.map-notice {
  padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 800px) {
  .map-search input,
  .view-panel input,
  .view-panel select,
  .view-panel textarea {
    font-size: 16px;
  }
}
/* Offline maps panel */
.offline-warning {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 6px;
  background: #fbefe9;
  color: #8a3d2c;
  font-size: 12px;
}

.offline-warning[hidden],
.offline-form[hidden] {
  display: none;
}

.offline-card {
  margin: 0 0 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.offline-mode-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}

.offline-mode-row small,
.offline-choice small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.offline-switch {
  flex: 0 0 auto;
  width: 40px;
  height: 22px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  border-radius: 11px;
  background: #c9cec6;
  cursor: pointer;
  transition: background 0.15s;
}

.offline-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s;
}

.offline-switch:checked {
  background: #365a43;
}

.offline-switch:checked::after {
  transform: translateX(18px);
}

.offline-form {
  display: grid;
  gap: 6px;
  margin: 0 0 18px;
}

.offline-form h3,
.offline-list-heading {
  margin: 0;
  font-size: 14px;
}

.offline-help,
.offline-estimate,
.offline-message {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.offline-estimate.is-error,
.offline-message.is-error {
  color: #9b3f35;
}

.offline-fieldset {
  display: grid;
  gap: 6px;
  margin: 4px 0 0;
  padding: 0;
  border: 0;
}

.offline-choice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}

.offline-choice input {
  margin: 2px 0 0;
  accent-color: #365a43;
}

.offline-choice strong {
  font-weight: 600;
}

.offline-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.offline-actions button {
  padding: 9px 14px;
  font-size: 13px;
}

.offline-actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.offline-actions button[hidden],
.offline-progress[hidden] {
  display: none;
}

.offline-progress {
  width: 100%;
  height: 8px;
  accent-color: #365a43;
}

.offline-pack-list {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.offline-pack {
  padding: 10px 0;
}

.offline-pack + .offline-pack {
  border-top: 1px solid #edf0e9;
}

.offline-pack-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.offline-badge {
  flex: 0 0 auto;
  padding: 2px 6px;
  border-radius: 4px;
  background: #fbefe9;
  color: #8a3d2c;
  font-size: 11px;
  font-weight: 600;
}

.offline-pack-meta {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.offline-pack-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.offline-pack-actions .view-button {
  padding: 6px 10px;
  font-size: 12px;
}

.offline-pack-actions .offline-delete {
  color: #9b3f35;
}

.map-status.is-offline {
  color: #365a43;
  font-weight: 600;
}

.map-status.is-offline.error {
  color: #9e563e;
}

.about-offline {
  margin: 0 0 16px;
}

.about-offline h3 {
  margin: 0 0 7px;
  color: #495d4b;
  font-size: 10px;
}

.about-offline p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

/* Settings panel: built from the Offline maps panel pieces. */
.settings-panel {
  display: grid;
  gap: 20px;
}

.settings-group {
  display: grid;
  gap: 10px;
}

.settings-group h3 {
  margin: 0;
  font-size: 14px;
}

.settings-card {
  display: grid;
  gap: 6px;
  margin: 0;
}

fieldset.settings-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
}

.settings-legend {
  float: left;
  width: 100%;
  margin: 0 0 4px;
  padding: 0;
}

.settings-card .offline-mode-row + .offline-mode-row {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid #edf0e9;
}

.settings-card .offline-choice .filter-swatch {
  flex: 0 0 auto;
  margin-top: 2px;
}

.settings-range {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  font-size: 13px;
}

.settings-range output {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.settings-card input[type="range"] {
  width: 100%;
  margin: 0;
  accent-color: #365a43;
}

.settings-hint {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: var(--font-caption-size, 10px);
  line-height: 1.4;
}

.settings-wrap-actions {
  flex-wrap: wrap;
}

.settings-wrap-actions .view-button {
  padding: 6px 10px;
  font-size: 12px;
}

.settings-wrap-actions .view-button[hidden],
.settings-subfields[hidden] {
  display: none;
}

.settings-subfields {
  display: grid;
  gap: 6px;
  margin: 2px 0 4px 24px;
}

.secret-field {
  display: flex;
  gap: 6px;
}

.secret-field .note-text-field {
  flex: 1;
  min-width: 0;
}

.secret-field .view-button {
  flex: 0 0 auto;
  padding: 6px 10px;
  font-size: 12px;
}

.settings-advanced > summary {
  display: grid;
  gap: 2px;
  padding-left: 18px;
  position: relative;
  list-style: none;
  cursor: pointer;
}

.settings-advanced > summary::-webkit-details-marker {
  display: none;
}

.settings-advanced > summary::before {
  content: "";
  position: absolute;
  top: 5px;
  left: 2px;
  border: 5px solid transparent;
  border-left-color: currentColor;
  transition: transform 0.15s;
  transform-origin: 2px 5px;
}

.settings-advanced[open] > summary::before {
  transform: rotate(90deg);
}

.settings-advanced > summary small {
  color: var(--muted);
  font-size: 12px;
}

.settings-advanced {
  display: block;
}

.settings-advanced > :not(summary) {
  margin-top: 10px;
}

.storage-list {
  display: grid;
  gap: 6px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.storage-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
}

.storage-list li + li {
  border-top: 1px solid #edf0e9;
}

.storage-list li > span:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.storage-list small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.storage-size {
  flex: none;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.settings-card[hidden],
.settings-card [hidden] {
  display: none;
}

#backup-preview {
  border-color: #365a43;
}
.settings-inline-field {
  display: flex;
  gap: 6px;
}

.settings-inline-field select {
  flex: 1;
  min-width: 0;
}

.settings-inline-field .note-save-button {
  flex: 0 0 auto;
}

.settings-place-list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
}

.settings-place-list li {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-place-list li.more {
  list-style: none;
  margin-left: -18px;
  color: var(--muted);
}

/* Turned off by the admin site config (site-policy.js). */
[data-policy-off] {
  display: none !important;
}
