:root {
  --font-sans: "Montserrat", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-family: var(--font-sans);
}

html,
body {
  margin: 0;
  min-height: 100vh;
  background-color: #000;
  background-image: none;
}

.app-boot {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0a0a;
  color: #e5e5e5;
  font-size: 0.95rem;
  font-weight: 500;
}

.app-boot.is-hidden {
  display: none;
}

html:has(.page.page-wide) {
  height: 100dvh;
  height: 100vh;
  overflow: hidden;
}

body {
  font-family: var(--font-sans);
  color: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

body:has(.page.page-wide) {
  align-items: stretch;
  justify-content: flex-start;
  padding: 0;
  height: 100dvh;
  height: 100vh;
  overflow: hidden;
}

.page {
  width: min(520px, 100%);
}

.page.page-wide {
  width: 100%;
  max-width: none;
  height: 100dvh;
  height: 100vh;
  max-height: 100dvh;
  max-height: 100vh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tab {
  flex: 1;
  min-width: 0;
  padding: 0.65rem 0.75rem;
  background: transparent;
  color: #a3a3a3;
  border: 1px solid #333;
  border-radius: 2px;
  font-size: 0.85rem;
  font-weight: 600;
}

.tab.active {
  color: #000;
  background: #fff;
  border-color: #fff;
}

.panel.hidden {
  display: none;
}

#map {
  width: 100%;
  min-height: 12rem;
  border: 1px solid #333;
  border-radius: 2px;
  background: #111;
}

.page.page-wide .tabs {
  flex-shrink: 0;
  margin-bottom: 0.5rem;
}

.page.page-wide #panelMap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  padding: 0.35rem 0.5rem 0.4rem;
  overflow: hidden;
}

.page.page-wide .map-search {
  flex-shrink: 0;
}

.map-search-toggle {
  display: flex;
  flex: 0 0 auto !important;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 0 0.25rem;
  padding: 0.3rem 0.5rem;
  background: #141414;
  border: 1px solid #404040;
  border-radius: 2px;
  color: #e5e5e5;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.map-search-toggle:active {
  background: #1a1a1a;
}

#mapSearchPanel:not(.is-open) {
  display: none;
}

#mapSearchPanel.is-open {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.3rem;
  padding: 0.35rem 0.45rem;
  background: #0a0a0a;
  border: 1px solid #333;
  border-radius: 2px;
  max-height: 28dvh;
  max-height: 28vh;
  overflow-y: auto;
}

.map-workspace {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

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

.page.page-wide #map {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}

.page.page-wide .btn-label-short {
  display: inline;
}

.page.page-wide .btn-label-long {
  display: none;
}

.btn-label-short {
  display: none;
}

.btn-label-long {
  display: inline;
}

.map-bottom-sheet .status {
  margin-top: 0.5rem;
}

.map-search {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.map-search-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.5rem;
}

.map-search-label {
  font-size: 0.75rem;
  color: #a3a3a3;
  min-width: 3.5rem;
}

.map-search-label-wide {
  min-width: 7.5rem;
}

.map-search-input {
  flex: 1 1 5rem;
  min-width: 4.5rem;
  max-width: 8rem;
  padding: 0.45rem 0.55rem;
  background: #111;
  border: 1px solid #525252;
  border-radius: 2px;
  color: #fff;
  font-size: 0.9rem;
}

.map-search-input-wide {
  flex: 1 1 10rem;
  max-width: none;
}

.map-sheet-select {
  flex: 1 1 8rem;
  max-width: none;
  min-width: 6rem;
  padding: 0.45rem 0.55rem;
  background: #111;
  border: 1px solid #525252;
  border-radius: 2px;
  color: #fff;
  font-size: 0.85rem;
}

.map-sheet-hint {
  margin: -0.15rem 0 0.35rem;
  font-size: 0.72rem;
  color: #a3a3a3;
}

.map-sheet-row {
  align-items: center;
}

.map-search-btn {
  flex: 0 0 auto;
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
}

.page.page-wide .map-hint {
  position: absolute;
  left: max(0.35rem, env(safe-area-inset-left, 0));
  right: max(0.35rem, env(safe-area-inset-right, 0));
  bottom: 0.3rem;
  margin: 0;
  padding: 0.22rem 0.35rem;
  font-size: 0.65rem;
  line-height: 1.2;
  background: rgba(10, 10, 10, 0.82);
  border: 1px solid #404040;
  border-radius: 2px;
  z-index: 450;
  pointer-events: none;
}

.page.page-wide .map-status-legend {
  position: absolute;
  left: max(0.35rem, env(safe-area-inset-left, 0));
  right: max(0.35rem, env(safe-area-inset-right, 0));
  bottom: 2.35rem;
  margin: 0;
  padding: 0.2rem 0.35rem;
  background: rgba(10, 10, 10, 0.78);
  border: 1px solid #404040;
  border-radius: 2px;
  z-index: 450;
  pointer-events: none;
}

.page.page-wide .map-bottom-sheet {
  flex-shrink: 0;
  padding-top: 0.25rem;
}

.page.page-wide #panelMap .actions,
.page.page-wide .map-actions-bar {
  flex-shrink: 0;
  margin-top: 0.25rem;
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr;
  gap: 0.35rem;
}

.page.page-wide .map-actions-bar button {
  flex: none;
  min-width: 0;
  min-height: 0;
  width: 100%;
  padding: 0.32rem 0.4rem;
  font-size: 0.76rem;
  line-height: 1.12;
}

.page.page-wide #mapSubmitBtn {
  font-size: 0.82rem;
}

.map-actions-secondary {
  display: contents;
}

.page.page-wide .map-bottom-sheet .status {
  margin-top: 0.3rem;
  padding: 0.4rem 0.5rem;
  font-size: 0.78rem;
}

.page.page-wide #mapStatus.visible {
  flex-shrink: 0;
  max-height: min(14dvh, 110px);
  max-height: min(14vh, 110px);
  overflow-y: auto;
}

.map-hint {
  margin: 0.75rem 0 0;
}

.map-status-legend {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  font-size: 0.68rem;
}

.map-status-legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.legend-swatch {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}

.legend-swatch--none {
  background: transparent;
  border-color: #ffe500;
}

.legend-swatch--not-found {
  background: #ef5350;
  border-color: #c62828;
}

.legend-swatch--flyer {
  background: #42a5f5;
  border-color: #1565c0;
}

.legend-swatch--met {
  background: #66bb6a;
  border-color: #2e7d32;
}

#map.map-exporting .leaflet-control-container {
  visibility: hidden !important;
}

/* Снимок: тайлы + рисуем границы на canvas, SVG не дублируем с заливкой */
#map.map-exporting .leaflet-overlay-pane,
#map.map-exporting .leaflet-marker-pane {
  visibility: hidden !important;
}

#map.map-export-capture .leaflet-overlay-pane path,
#map.map-export-capture .leaflet-overlay-pane svg path {
  stroke: #ffe500 !important;
  stroke-width: 3px !important;
  fill: none !important;
  fill-opacity: 0 !important;
  stroke-opacity: 1 !important;
}

@media print {
  body.printing-map {
    background: #fff !important;
    padding: 0 !important;
  }

  body.printing-map .page {
    width: 100% !important;
    min-height: auto !important;
  }

  body.printing-map .tabs,
  body.printing-map .map-search,
  body.printing-map .map-search-toggle,
  body.printing-map .map-hint,
  body.printing-map .map-status-legend,
  body.printing-map .map-bottom-sheet,
  body.printing-map #mapStatus {
    display: none !important;
  }

  body.printing-map #panelMap {
    display: block !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }

  body.printing-map #map {
    height: 100vh !important;
    min-height: 100vh !important;
    border: none !important;
  }

  body.printing-map .leaflet-control-container {
    display: none !important;
  }
}

.leaflet-container {
  background: #111;
  font-family: inherit;
}

.leaflet-control-attribution {
  display: none !important;
}

/* Панели Leaflet: рамка общая; зум — текст, рисование — спрайты (не background:!) */
#map .leaflet-bar {
  border: 2px solid #fff !important;
  border-radius: 4px !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.55) !important;
  overflow: hidden;
}

#map .leaflet-control-zoom a {
  width: 38px !important;
  height: 38px !important;
  line-height: 38px !important;
  background: #fff !important;
  color: #000 !important;
  border-bottom: 1px solid #d4d4d4 !important;
  font-size: 22px !important;
  font-weight: 700 !important;
}

#map .leaflet-control-zoom a:last-child {
  border-bottom: none !important;
}

#map .leaflet-control-zoom a:hover,
#map .leaflet-control-zoom a:focus {
  background: #e5e5e5 !important;
  color: #000 !important;
}

/* Иконки рисования — символы, без спрайта (спрайт ломался при 38px) */
#map .leaflet-draw-toolbar a {
  width: 34px !important;
  height: 34px !important;
  background: #fff !important;
  background-image: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 17px !important;
  line-height: 1 !important;
  color: #111 !important;
  text-indent: 0 !important;
  opacity: 1 !important;
  border: none !important;
  border-bottom: 1px solid #d4d4d4 !important;
}

#map .leaflet-draw-toolbar a .sr-only {
  display: none !important;
}

#map .leaflet-draw-draw-polyline::before {
  content: "╱";
  font-weight: 700;
}

#map .leaflet-draw-draw-polygon::before {
  content: "⬡";
  font-size: 15px;
}

#map .leaflet-draw-draw-rectangle::before {
  content: "▢";
  font-weight: 700;
}

#map .leaflet-draw-edit-edit::before {
  content: "✎";
}

#map .leaflet-draw-edit-remove::before {
  content: "✕";
  font-size: 15px;
}

#map .leaflet-draw-toolbar a:hover,
#map .leaflet-draw-toolbar a:focus {
  background: #e5e5e5 !important;
}

#map .leaflet-draw-toolbar-top {
  margin-top: 0;
}

#map .leaflet-draw-actions {
  display: none !important;
}

.map-draw-mobile-bar {
  display: none;
  position: fixed;
  left: max(0.5rem, env(safe-area-inset-left, 0));
  right: max(0.5rem, env(safe-area-inset-right, 0));
  bottom: 1.25rem;
  z-index: 10001;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 0.35rem;
  padding: 0.35rem;
  background: rgba(10, 10, 10, 0.92);
  border: 1px solid #404040;
  border-radius: 2px;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.5);
}

.map-draw-mobile-bar.is-active {
  display: grid;
}

.map-draw-mobile-bar button {
  min-height: 40px;
  margin: 0;
  padding: 0.5rem 0.35rem;
  font-size: 0.85rem;
  width: 100%;
}

/* Контур зоны — только рамка, без заливки */
#map path.map-selection-outline {
  stroke: #ffffff !important;
  stroke-width: 3px !important;
  fill: none !important;
  fill-opacity: 0 !important;
}

/* Границы участков НСПД (без статуса) */
#map path.map-parcel-outline {
  stroke: #ffe500 !important;
  stroke-width: 2.5px !important;
  fill: none !important;
  fill-opacity: 0 !important;
}

#map path.map-parcel-status-not-found {
  stroke: #c62828 !important;
  stroke-width: 3px !important;
  fill: #ef5350 !important;
  fill-opacity: 0.24 !important;
}

#map path.map-parcel-status-flyer {
  stroke: #1565c0 !important;
  stroke-width: 3px !important;
  fill: #42a5f5 !important;
  fill-opacity: 0.24 !important;
}

#map path.map-parcel-status-met {
  stroke: #2e7d32 !important;
  stroke-width: 3px !important;
  fill: #66bb6a !important;
  fill-opacity: 0.24 !important;
}

#map .leaflet-editing path.map-selection-outline {
  stroke: #ffffff !important;
  fill: none !important;
  fill-opacity: 0 !important;
}

.parcel-cad-marker {
  background: transparent;
  border: none;
}

.parcel-cad-marker-text {
  display: inline-block;
  background: rgba(10, 10, 10, 0.82);
  color: #ffe500;
  border: 1px solid #ffe500;
  border-radius: 2px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
  padding: 1px 4px;
  white-space: nowrap;
  pointer-events: none;
  transform: translate(-50%, -50%);
  max-width: 6rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

h1 {
  margin: 0 0 1.25rem;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
}

.card {
  background: #0a0a0a;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 1.5rem;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.6);
}

.dropzone {
  display: block;
  position: relative;
  border: 1px dashed #666;
  border-radius: 2px;
  padding: 2rem 1rem;
  text-align: center;
  cursor: pointer;
  outline: none;
  color: #e5e5e5;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.dropzone:hover,
.dropzone.dragover,
.dropzone:focus-visible {
  border-color: #fff;
  background: #141414;
  color: #fff;
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  outline: none;
}

.dropzone p {
  margin: 0.25rem 0;
}

.dropzone .hint {
  font-size: 0.85rem;
  color: #737373;
}

.file-name {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: #a3a3a3;
  word-break: break-all;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

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

button {
  flex: 1;
  min-width: 140px;
  padding: 0.75rem 1rem;
  border-radius: 2px;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.1s;
}

button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

button.primary {
  background: #fff;
  color: #000;
  border: 1px solid #fff;
}

button.primary:not(:disabled):hover {
  background: #d4d4d4;
  border-color: #d4d4d4;
}

button.secondary {
  background: transparent;
  color: #e5e5e5;
  border: 1px solid #525252;
}

button.secondary:not(:disabled):hover {
  border-color: #fff;
  color: #fff;
}

button:not(:disabled):active {
  transform: scale(0.98);
}

.status {
  margin-top: 1.25rem;
  padding: 1rem;
  border-radius: 2px;
  font-size: 0.9rem;
  display: none;
  color: #d4d4d4;
}

.status.visible {
  display: block;
}

.status.loading {
  background: #141414;
  border: 1px solid #404040;
}

.status.success {
  background: #171717;
  border: 1px solid #525252;
}

.status.error {
  background: #0a0a0a;
  border: 1px solid #737373;
  color: #fafafa;
}

.plots-list {
  margin: 0.75rem 0 0;
  padding-left: 1.25rem;
  max-height: 200px;
  overflow-y: auto;
  color: #a3a3a3;
}

.plots-list li {
  margin: 0.2rem 0;
}

.plots-list .overlap-pct {
  color: #ffe500;
  font-size: 0.9em;
  font-weight: 500;
}

.leaflet-tooltip.parcel-cad-label {
  background: rgba(10, 10, 10, 0.88);
  color: #ffe500;
  border: 1px solid #ffe500;
  border-radius: 2px;
  box-shadow: none;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 5px;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
}

.leaflet-tooltip.parcel-cad-label::before {
  display: none;
}

a.sheet-link {
  color: #fff;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

a.sheet-link:hover {
  color: #d4d4d4;
}

.spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid #525252;
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 0.5rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ——— Мобильные устройства ——— */
@media (max-width: 768px) {
  body {
    padding: 0;
    align-items: stretch;
  }

  body:has(.page.page-wide) {
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .page {
    width: 100%;
  }

  .page.page-wide {
    height: 100dvh;
    height: 100vh;
    max-height: 100dvh;
    max-height: 100vh;
    min-height: 0;
    overflow: hidden;
  }

  .tabs {
    margin-bottom: 0;
    padding: 0.35rem 0.5rem 0;
    padding-top: max(0.35rem, env(safe-area-inset-top, 0));
    gap: 0.35rem;
  }

  .tab {
    padding: 0.7rem 0.4rem;
    font-size: 0.78rem;
    min-height: 44px;
  }

  .card {
    padding: 0.75rem;
    border-radius: 0;
    box-shadow: none;
  }

  .page.page-wide #panelMap.card {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    border: none;
    padding: 0;
    overflow: hidden;
  }

  .map-search-toggle {
    position: absolute;
    top: 0.35rem;
    left: max(0.4rem, env(safe-area-inset-left, 0));
    right: max(0.4rem, env(safe-area-inset-right, 0));
    width: auto;
    margin: 0;
    z-index: 850;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
    background: rgba(20, 20, 20, 0.92);
  }

  .map-search-toggle-icon {
    color: #a3a3a3;
    font-size: 0.72rem;
  }

  #mapSearchPanel.is-open {
    position: absolute;
    top: 2.1rem;
    left: 0;
    right: 0;
    z-index: 860;
    margin: 0;
    padding: 0.4rem 0.55rem;
    padding-left: max(0.55rem, env(safe-area-inset-left, 0));
    padding-right: max(0.55rem, env(safe-area-inset-right, 0));
    border: none;
    border-bottom: 1px solid #333;
    border-radius: 0;
    max-height: 40dvh;
    max-height: 40vh;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
  }

  .map-search-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
  }

  .map-search-label,
  .map-search-label-wide {
    min-width: 0;
    width: 100%;
    font-size: 0.8rem;
  }

  .map-search-input,
  .map-search-input-wide {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
    width: 100%;
    padding: 0.65rem 0.6rem;
    font-size: 16px;
  }

  .map-search-btn {
    width: 100%;
    min-height: 44px;
    padding: 0.65rem 1rem;
  }

  .map-workspace {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  html.mobile-ui .map-workspace {
    padding-top: 0;
  }

  .map-stage {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .page.page-wide #map {
    flex: 1;
    min-height: 0;
    height: 100% !important;
    border: none;
    border-radius: 0;
    touch-action: none;
  }

  .map-hint {
    position: absolute;
    left: max(0.5rem, env(safe-area-inset-left, 0));
    right: max(0.5rem, env(safe-area-inset-right, 0));
    bottom: 0.5rem;
    margin: 0;
    padding: 0.4rem 0.5rem;
    font-size: 0.72rem;
    line-height: 1.3;
    background: rgba(10, 10, 10, 0.82);
    border: 1px solid #404040;
    border-radius: 2px;
    z-index: 450;
    pointer-events: none;
  }

  html.mobile-ui .map-bottom-sheet,
  .map-bottom-sheet {
    flex-shrink: 0;
    background: #0a0a0a;
    border-top: 1px solid #333;
    padding: 0.5rem 0.75rem;
    padding-left: max(0.75rem, env(safe-area-inset-left, 0));
    padding-right: max(0.75rem, env(safe-area-inset-right, 0));
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom, 0));
    z-index: 500;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
  }

  html.mobile-ui .map-bottom-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
  }

  html.mobile-ui .map-workspace {
    padding-bottom: 5.1rem;
  }

  .page.page-wide .map-actions-bar,
  html.mobile-ui .page.page-wide .map-actions-bar {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.35rem;
    width: 100%;
    align-items: stretch;
  }

  .page.page-wide .map-actions-secondary,
  html.mobile-ui .page.page-wide .map-actions-secondary {
    display: contents;
  }

  .btn-label-long {
    display: none;
  }

  .btn-label-short {
    display: inline;
  }

  .map-actions-bar button,
  #panelMap .map-actions-bar button,
  html.mobile-ui .map-actions-bar button {
    flex: none;
    min-width: 0;
    width: 100%;
    max-width: none;
    min-height: 2.5rem;
    padding: 0.5rem 0.35rem;
    font-size: 0.8rem;
    margin: 0;
    justify-self: stretch;
  }

  #mapSubmitBtn,
  html.mobile-ui #mapSubmitBtn {
    min-height: 2.5rem;
    padding: 0.5rem 0.35rem;
    font-size: 0.8rem;
  }

  .map-bottom-sheet {
    padding: 0.28rem 0.45rem;
    padding-bottom: max(0.28rem, env(safe-area-inset-bottom, 0));
  }

  .map-bottom-sheet .status {
    margin-top: 0.3rem;
    padding: 0.4rem 0.45rem;
  }

  .page.page-wide #mapStatus.visible {
    max-height: 18dvh;
    max-height: 18vh;
    font-size: 0.78rem;
  }

  .page.page-wide .map-hint {
    font-size: 0.62rem;
    bottom: 0.25rem;
  }

  .page.page-wide .map-status-legend {
    bottom: 2rem;
    font-size: 0.6rem;
  }

  .plots-list {
    max-height: 18dvh;
    padding-left: 1rem;
  }

  #panelOcr.card {
    padding: 0.75rem;
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0));
  }

  .dropzone {
    padding: 1.5rem 0.75rem;
  }

  #map .leaflet-top.leaflet-left {
    top: auto;
    bottom: calc(5.1rem + env(safe-area-inset-bottom, 0));
    left: max(8px, env(safe-area-inset-left, 0));
  }

  #map .leaflet-top.leaflet-right {
    top: max(6px, env(safe-area-inset-top, 0));
    right: max(6px, env(safe-area-inset-right, 0));
  }

  #map .leaflet-control-zoom a {
    width: 44px !important;
    height: 44px !important;
    line-height: 44px !important;
    font-size: 24px !important;
  }

  #map .leaflet-draw-toolbar a {
    width: 44px !important;
    height: 44px !important;
    font-size: 18px !important;
  }

  .map-draw-mobile-bar {
    bottom: calc(5.35rem + env(safe-area-inset-bottom, 0));
  }

  .map-draw-mobile-bar button {
    min-height: 44px;
    font-size: 0.82rem;
  }

  html.mobile-ui #map .leaflet-draw-edit-edit,
  html.mobile-ui #map .leaflet-draw-edit-remove {
    display: none !important;
  }
}

@media (max-width: 380px) {
  .tab {
    font-size: 0.72rem;
    letter-spacing: -0.02em;
  }

  .map-hint {
    font-size: 0.72rem;
  }
}
