:root {
  --bg: #f4eef8;
  --bg-soft: #fbf8fd;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-strong: #ffffff;
  --text: #241b2a;
  --muted: #685a72;
  --line: rgba(102, 52, 121, 0.14);
  --accent: #663479;
  --accent-dark: #4f235f;
  --accent-soft: #efe4f5;
  --accent-strong: #7a4390;
  --success: #2f7a68;
  --danger: #b33a5b;
  --warning: #a66a1f;
  --shadow: 0 22px 65px rgba(72, 28, 88, 0.13);
  --shadow-soft: 0 14px 34px rgba(72, 28, 88, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  font-family: "Segoe UI Variable", "Segoe UI", "Trebuchet MS", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(102, 52, 121, 0.22), transparent 30%),
    radial-gradient(circle at bottom right, rgba(166, 114, 191, 0.18), transparent 28%),
    linear-gradient(135deg, #f8f3fb 0%, #efe7f5 46%, #fdfbff 100%);
}

.page {
  position: relative;
  display: grid;
  grid-template-columns: 380px 1fr;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  transition: grid-template-columns 0.28s ease;
}

.sidebar {
  height: 100vh;
  height: 100dvh;
  padding: 20px 18px 20px 20px;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.18);
  border-right: 1px solid transparent;
  backdrop-filter: blur(8px);
  transition:
    opacity 0.28s ease,
    transform 0.28s ease,
    padding 0.28s ease,
    border-color 0.28s ease;
}

.sidebar-toggle {
  position: fixed;
  top: 50%;
  left: 350px;
  z-index: 1200;
  display: inline-flex;
  width: 38px;
  height: 54px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--line);
  border-left: none;
  border-radius: 0 16px 16px 0;
  background: var(--surface);
  color: var(--accent-dark);
  box-shadow: var(--shadow-soft);
  transform: translateY(-50%);
  transition:
    left 0.28s ease,
    background 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease,
    top 0.28s ease,
    transform 0.28s ease;
}

.sidebar-toggle:hover {
  background: var(--accent-soft);
  color: var(--accent-dark);
  transform: translateY(-50%);
}

.sidebar-toggle__icon {
  font-size: 24px;
  line-height: 1;
  transition: transform 0.28s ease;
}

.map-tools-toggle {
  display: none;
}

.page.sidebar-collapsed {
  grid-template-columns: 0 1fr;
}

.page.sidebar-collapsed .sidebar {
  opacity: 0;
  transform: translateX(-24px);
  padding-left: 0;
  padding-right: 0;
  border-right-color: transparent;
  pointer-events: none;
}

.page.sidebar-collapsed .sidebar-toggle {
  left: 0;
}

.page.sidebar-collapsed .sidebar-toggle__icon {
  transform: rotate(180deg);
}

.map-section {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  padding: 16px 16px 16px 0;
}

#map {
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 30px;
  box-shadow: var(--shadow);
  background: #f8f4fb;
}

.panel,
.modal__dialog {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.panel {
  margin-bottom: 16px;
  padding: 22px;
  border-radius: 28px;
}

h1,
h2 {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.1rem, 1rem + 0.8vw, 1.95rem);
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--accent-dark);
  white-space: normal;
  overflow-wrap: anywhere;
}

h2 {
  margin-bottom: 14px;
  font-size: 19px;
  letter-spacing: -0.02em;
  color: var(--accent-dark);
}

.subtitle,
.empty,
.address-list span,
.tips-list,
.coordinate-preview,
.bulk-progress__details {
  color: var(--muted);
}

form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

label {
  font-weight: 600;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-strong);
  color: var(--text);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: rgba(102, 52, 121, 0.45);
  box-shadow: 0 0 0 4px rgba(102, 52, 121, 0.12);
  background: #fff;
}

textarea {
  resize: vertical;
}

button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 999px;
  padding: 13px 18px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(102, 52, 121, 0.22);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

button:hover,
.button-link:hover {
  background: var(--accent-strong);
  box-shadow: 0 14px 28px rgba(102, 52, 121, 0.28);
  transform: translateY(-1px);
}

button:disabled {
  background: #ded5e6;
  color: #7b6d86;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.button-link {
  width: 100%;
}

.button-link--secondary {
  width: auto;
  background: #fff;
  color: var(--accent-dark);
  border: 1px solid var(--line);
  box-shadow: 0 8px 20px rgba(102, 52, 121, 0.08);
}

.button-link--secondary:hover {
  background: var(--accent-soft);
}

.danger-button {
  width: 100%;
  margin-bottom: 14px;
  background: var(--danger);
}

.danger-button:hover {
  background: #972f4c;
}

.danger-button--compact {
  width: auto;
  margin-bottom: 0;
  padding: 10px 14px;
}

.sidebar-tool-button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.sidebar-tool-button__icon {
  font-size: 18px;
  line-height: 1;
}

.sidebar-tool-button.active {
  background: var(--accent-dark);
}

.sidebar-tool-button.active:hover {
  background: var(--accent);
}

.bulk-progress,
.bulk-summary,
.error-log-card {
  border-radius: 20px;
  border: 1px solid var(--line);
}

.bulk-progress {
  margin-top: 6px;
  padding: 12px;
  background: linear-gradient(135deg, rgba(102, 52, 121, 0.08), rgba(255, 255, 255, 0.96));
}

.bulk-progress__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.bulk-progress__bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(102, 52, 121, 0.12);
}

.bulk-progress__fill {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-strong) 100%);
  transition: width 0.25s ease;
}

.bulk-summary {
  margin-top: 10px;
  padding: 12px;
  border-color: rgba(47, 122, 104, 0.18);
  background: rgba(47, 122, 104, 0.1);
}

.bulk-summary__text {
  margin: 0;
  color: var(--success);
  font-weight: 600;
}

.bulk-summary__link {
  margin-top: 10px;
  padding: 0;
  background: transparent;
  color: var(--accent);
  text-decoration: underline;
  box-shadow: none;
}

.bulk-summary__link:hover {
  background: transparent;
  color: var(--accent-dark);
  box-shadow: none;
  transform: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal[hidden] {
  display: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(32, 19, 38, 0.44);
  backdrop-filter: blur(4px);
}

.modal__dialog {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  max-height: 85vh;
  overflow: hidden;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.98);
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.modal__header h2 {
  margin: 0;
  font-size: 20px;
}

.modal__close {
  min-width: auto;
  padding: 8px 12px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  box-shadow: none;
}

.modal__close:hover {
  background: rgba(102, 52, 121, 0.18);
  box-shadow: none;
}

.modal__body {
  max-height: calc(85vh - 72px);
  overflow: auto;
  padding: 20px;
}

.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 20px 20px;
}

.manual-address-form {
  display: block;
}

.manual-address-form .modal__body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.icon-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 4px 0 0;
  padding: 0;
  border: none;
}

.icon-picker legend {
  grid-column: 1 / -1;
  margin-bottom: 2px;
  font-weight: 700;
}

.icon-picker label {
  min-width: 0;
}

.icon-picker input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.icon-choice {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

.icon-choice:hover {
  transform: translateY(-1px);
  border-color: rgba(102, 52, 121, 0.2);
  background: rgba(102, 52, 121, 0.05);
}

.icon-picker input:checked + .icon-choice {
  border-color: rgba(102, 52, 121, 0.24);
  background: rgba(102, 52, 121, 0.08);
  box-shadow:
    inset 0 0 0 2px rgba(102, 52, 121, 0.14),
    0 12px 24px rgba(102, 52, 121, 0.08);
}

.icon-picker--form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.icon-picker--form .icon-choice {
  min-height: 56px;
  font-size: 13px;
}

.error-log-card + .error-log-card {
  margin-top: 16px;
}

.error-log-card {
  padding: 16px;
  background: rgba(255, 255, 255, 0.94);
}

.error-log-card__title {
  margin: 0 0 8px;
  font-size: 18px;
}

.error-log-card__reason,
.error-log-card__label {
  margin: 0 0 8px;
  color: var(--muted);
}

.error-log-card__queries {
  margin: 0;
  padding-left: 18px;
  color: var(--text);
}

.modal-open {
  overflow: hidden;
}

.message {
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
}

.message.success {
  background: rgba(47, 122, 104, 0.12);
  color: var(--success);
  border: 1px solid rgba(47, 122, 104, 0.14);
}

.message.error {
  background: rgba(179, 58, 91, 0.08);
  color: var(--danger);
  border: 1px solid rgba(179, 58, 91, 0.14);
}

.address-list,
.tips-list {
  margin: 0;
  padding-left: 18px;
}

.address-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  list-style: none;
  padding-left: 0;
}

.address-list li {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.address-list--editable {
  gap: 0;
}

.address-list--editable li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px 0;
}

.address-list__text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.address-list__actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.address-edit-button,
.address-delete-button {
  padding: 9px 12px;
  box-shadow: none;
}

.address-edit-button {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.address-edit-button:hover {
  background: rgba(102, 52, 121, 0.18);
  box-shadow: none;
}

.address-delete-button {
  background: rgba(179, 58, 91, 0.08);
  color: var(--danger);
}

.address-delete-button:hover {
  background: rgba(179, 58, 91, 0.16);
  box-shadow: none;
}

.tips-list li + li {
  margin-top: 8px;
}

.house-marker,
.custom-ev-marker,
.custom-tu-marker {
  background: transparent;
  border: none;
}

.house-pin {
  position: relative;
  width: 34px;
  height: 42px;
}

.house-pin::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 12px;
  height: 12px;
  background: var(--accent-dark);
  border-radius: 0 0 12px 12px;
  transform: translateX(-50%) rotate(45deg);
}

.house-pin-roof {
  position: absolute;
  left: 50%;
  top: 1px;
  width: 0;
  height: 0;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-bottom: 15px solid var(--accent-dark);
  transform: translateX(-50%);
}

.house-pin-body {
  position: absolute;
  left: 50%;
  top: 14px;
  width: 24px;
  height: 18px;
  background: #ffeb3b;
  border: 3px solid var(--accent-dark);
  border-radius: 4px;
  transform: translateX(-50%);
}

.house-pin-door {
  position: absolute;
  left: 50%;
  top: 22px;
  width: 6px;
  height: 10px;
  background: #ef4444;
  border: 2px solid var(--accent-dark);
  border-bottom-width: 0;
  transform: translateX(-50%);
}

.custom-map-marker {
  position: relative;
  border: none;
  background: transparent;
}

.custom-map-marker::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 14px;
  height: 14px;
  border-radius: 0 0 12px 12px;
  background: var(--accent-dark);
  transform: translateX(-50%) rotate(45deg);
}

.custom-map-marker span {
  position: absolute;
  left: 50%;
  top: 2px;
  display: flex;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--accent-dark);
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
  transform: translateX(-50%);
}

.custom-map-marker--pin span {
  background: var(--accent);
}

.custom-map-marker--star span {
  background: #7b3f92;
}

.custom-map-marker--flag span {
  background: var(--success);
}

.custom-map-marker--warning span {
  background: var(--danger);
}

.custom-ev-marker img {
  display: block;
  width: 38px;
  height: 48px;
  object-fit: contain;
}

.custom-ev-marker--proposal img,
.custom-ev-marker--belniip img,
.custom-ev-marker--malanka img {
  width: 38px;
  height: 48px;
  margin: 0;
}

.tu-marker-logo {
  display: flex;
  width: 38px;
  height: 42px;
  align-items: center;
  justify-content: center;
  border: 3px solid #fff;
  border-radius: 12px 12px 12px 3px;
  background: #0f766e;
  color: #fff;
  box-shadow: 0 3px 8px rgba(17, 24, 39, 0.38);
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
  transform: rotate(-45deg);
}

.tu-marker-logo span {
  transform: rotate(45deg);
}

.address-layer-control.leaflet-control-layers-expanded {
  max-width: min(280px, calc(100vw - 70px));
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
}

.address-layer-control .leaflet-control-layers-overlays label {
  margin: 3px 0;
  font-weight: 600;
}

.address-layer-control .leaflet-control-layers-selector {
  width: auto;
  margin-right: 6px;
}

.measure-control {
  display: flex;
  flex-direction: column;
}

.measure-btn,
.pdf-export-btn,
.pdf-export-toggle {
  color: var(--accent-dark);
  box-shadow: none;
}

.measure-btn {
  min-width: 108px;
  padding: 10px 12px;
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
}

.measure-btn:last-child {
  border-bottom: none;
}

.measure-btn:hover {
  background: var(--accent-soft);
  transform: none;
}

.measure-btn.active {
  background: var(--accent);
  color: #fff;
}

.pdf-export-control {
  position: relative;
  display: flex;
}

.pdf-export-toggle {
  display: flex;
  min-width: 52px;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 0;
  background: #fff;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}

.pdf-export-toggle:hover,
.pdf-export-toggle.active {
  background: var(--accent-soft);
  transform: none;
}

.pdf-export-menu {
  position: absolute;
  top: 0;
  right: calc(100% + 10px);
  min-width: 154px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.pdf-export-menu[hidden] {
  display: none;
}

.pdf-export-btn {
  display: block;
  width: 100%;
  min-width: 154px;
  padding: 10px 12px;
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

.pdf-export-btn:last-child {
  border-bottom: none;
}

.pdf-export-btn:hover {
  background: var(--accent-soft);
  transform: none;
}

.map-exporting .leaflet-control-container .leaflet-control {
  display: none;
}

.map-exporting .leaflet-control-container .leaflet-control-attribution {
  display: block;
}

.map-exporting-small-markers .house-pin,
.map-exporting-small-markers .custom-ev-marker img {
  transform: scale(0.3);
  transform-origin: center bottom;
}

.map-exporting-small-markers .custom-map-marker span {
  transform: translateX(-50%) scale(0.3);
  transform-origin: center bottom;
}

.map-exporting-small-markers .tu-marker-logo {
  transform: rotate(-45deg) scale(0.3);
  transform-origin: center bottom;
}

.map-exporting-standard-markers .house-pin,
.map-exporting-standard-markers .custom-ev-marker img {
  transform: scale(0.6);
  transform-origin: center bottom;
}

.map-exporting-standard-markers .custom-map-marker span {
  transform: translateX(-50%) scale(0.6);
  transform-origin: center bottom;
}

.map-exporting-standard-markers .tu-marker-logo {
  transform: rotate(-45deg) scale(0.6);
  transform-origin: center bottom;
}

.measure-label,
.measure-total-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 60px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(79, 35, 95, 0.92);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}

.measure-total-label {
  background: rgba(102, 52, 121, 0.95);
}

.marker-context-popup .leaflet-popup-content-wrapper {
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
}

.marker-context-popup .leaflet-popup-content {
  margin: 0;
}

.marker-context-popup .leaflet-popup-tip {
  background: #fff;
}

.leaflet-marker-draggable {
  cursor: grab;
}

.leaflet-marker-draggable:active {
  cursor: grabbing;
}

.marker-menu {
  min-width: 180px;
  padding: 8px;
}

.marker-menu__item {
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 14px;
  background: #fff;
  color: var(--danger);
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  box-shadow: none;
  cursor: pointer;
}

.marker-menu__item:hover {
  background: rgba(179, 58, 91, 0.08);
  transform: none;
}

.marker-menu__item--add {
  color: var(--accent);
}

.marker-menu__item--add:hover {
  background: rgba(102, 52, 121, 0.08);
}

.measuring-mode {
  cursor: crosshair;
}

.addresses-page {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.addresses-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.addresses-header h1 {
  margin-bottom: 6px;
}

.addresses-panel-page {
  border-radius: 28px;
}

.addresses-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.addresses-toolbar h2 {
  margin-bottom: 0;
}

.login-body {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  overflow: auto;
}

.login-card {
  width: min(100%, 440px);
  padding: 30px 28px;
  border-radius: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.login-card__header {
  margin-bottom: 18px;
}

.login-card__eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.login-card__text {
  margin: 10px 0 0;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 12px;
}

.alert {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(179, 58, 91, 0.08);
  color: var(--danger);
  border: 1px solid rgba(179, 58, 91, 0.14);
}

@media (max-width: 900px) {
  html,
  body {
    width: 100%;
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
  }

  .page {
    display: block;
    grid-template-columns: 1fr;
    width: 100%;
    height: 100%;
    height: 100dvh;
    min-height: 100svh;
    overflow: hidden;
  }

  .sidebar-toggle {
    top: 50%;
    left: min(calc(88vw - 1px), 359px);
    right: auto;
    width: 44px;
    height: 58px;
    border-left: 1px solid var(--line);
    border-radius: 0 16px 16px 0;
    touch-action: manipulation;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1100;
    width: min(88vw, 360px);
    height: 100%;
    height: 100dvh;
    padding:
      max(14px, env(safe-area-inset-top))
      14px
      max(14px, env(safe-area-inset-bottom))
      max(14px, env(safe-area-inset-left));
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: rgba(248, 243, 251, 0.97);
    border-right: none;
    border-bottom: none;
    box-shadow: 18px 0 45px rgba(32, 19, 38, 0.2);
    -webkit-overflow-scrolling: touch;
  }

  .page.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .page.sidebar-collapsed .sidebar {
    opacity: 0;
    transform: translateX(-100%);
    pointer-events: none;
  }

  .page.sidebar-collapsed .sidebar-toggle {
    left: max(8px, env(safe-area-inset-left));
    right: auto;
  }

  .page.sidebar-collapsed .sidebar-toggle__icon {
    transform: rotate(180deg);
  }

  .map-section {
    position: relative;
    width: 100%;
    height: 100%;
    height: 100dvh;
    min-height: 100svh;
    padding: 0;
  }

  #map {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .map-tools-toggle {
    position: fixed;
    top: 50%;
    right: max(8px, env(safe-area-inset-right));
    z-index: 1200;
    display: inline-flex;
    width: 44px;
    height: 58px;
    min-height: 58px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 16px 0 0 16px;
    background: var(--surface);
    color: var(--accent-dark);
    box-shadow: var(--shadow-soft);
    transform: translateY(-50%);
    touch-action: manipulation;
  }

  .map-tools-toggle:hover {
    background: var(--accent-soft);
    color: var(--accent-dark);
    transform: translateY(-50%);
  }

  .map-tools-toggle span {
    font-size: 24px;
    line-height: 1;
    transition: transform 0.2s ease;
  }

  .page:not(.map-tools-collapsed) .map-tools-toggle span {
    transform: rotate(180deg);
  }

  .page.map-tools-collapsed .address-layer-control,
  .page.map-tools-collapsed .measure-control,
  .page.map-tools-collapsed .pdf-export-control {
    display: none;
  }

  .panel {
    margin-bottom: 12px;
    padding: 18px;
    border-radius: 22px;
  }

  input,
  textarea,
  select {
    font-size: 16px;
  }

  button,
  .button-link {
    min-height: 44px;
  }

  .leaflet-control-container .leaflet-top {
    top: max(6px, env(safe-area-inset-top));
  }

  .leaflet-control-container .leaflet-bottom {
    bottom: max(4px, env(safe-area-inset-bottom));
  }

  .leaflet-control-container .leaflet-right {
    right: max(4px, env(safe-area-inset-right));
  }

  .leaflet-control-container .leaflet-left {
    left: max(4px, env(safe-area-inset-left));
  }

  .modal {
    align-items: flex-end;
    padding: max(10px, env(safe-area-inset-top)) 0 0;
  }

  .modal__dialog {
    width: 100%;
    max-height: calc(100dvh - max(10px, env(safe-area-inset-top)));
    border-radius: 24px 24px 0 0;
  }

  .modal__body {
    max-height: calc(100dvh - 150px);
    padding: 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  .modal__header {
    padding: 14px 16px;
  }

  .modal__footer {
    padding: 0 16px max(16px, env(safe-area-inset-bottom));
  }

  .addresses-header,
  .addresses-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .button-link--secondary,
  .danger-button--compact {
    width: 100%;
  }

  .address-list--editable li {
    grid-template-columns: 1fr;
  }

  .address-list__actions {
    flex-wrap: wrap;
  }

  .icon-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pdf-export-menu {
    top: calc(100% + 10px);
    right: 0;
  }

  .login-card {
    padding: 24px 20px;
    border-radius: 24px;
  }
}

@media (max-width: 900px) and (orientation: landscape) {
  .sidebar {
    width: min(72vw, 390px);
  }

  .sidebar-toggle {
    left: min(calc(72vw - 1px), 389px);
  }
}
