/* SevSvet bundled styles: 20260720_154059 */


/* ===== frontend/css/tokens.css ===== */
:root {
  --app-color-text: #101c1b;
  --app-color-muted: #74817f;
  --app-color-bg: #f4f7f6;
  --app-color-surface: #ffffff;
  --app-color-surface-glass: rgb(255 255 255 / 88%);
  --app-color-accent: #006b68;
  --app-color-accent-deep: #00514f;
  --app-color-accent-soft: #e7f3f2;
  --app-color-success: #23b26d;
  --app-color-danger: #ef4f5b;
  --app-color-warning: #f5a524;
  --app-color-border: rgb(17 43 41 / 8%);
  --app-radius-small: 10px;
  --app-radius-medium: 14px;
  --app-radius-large: 20px;
  --app-radius-sheet: 24px;
  --app-radius-pill: 999px;
  --app-shadow-card: 0 10px 32px rgb(7 44 41 / 10%);
  --app-shadow-popup: 0 22px 58px rgb(7 44 41 / 22%);
  --app-shadow-elevated: 0 18px 44px rgb(7 44 41 / 16%);
  --app-space-1: 4px;
  --app-space-2: 8px;
  --app-space-3: 12px;
  --app-space-4: 16px;
  --app-space-5: 20px;
  --app-button-height: 44px;
  --app-button-height-compact: 38px;
  --app-duration-fast: 140ms;
  --app-duration-medium: 220ms;
  --app-ease-standard: cubic-bezier(.2, .8, .2, 1);
  --app-safe-bottom: env(safe-area-inset-bottom);
  --app-z-popup: 700;
  --app-z-panel: 8;
  --app-z-toast: 20;
}


/* ===== frontend/css/components.css ===== */
.app-surface {
  background: var(--app-color-surface-glass);
  border: 1px solid var(--app-color-border);
  box-shadow: var(--app-shadow-card);
  backdrop-filter: blur(18px) saturate(140%);
}

.app-card {
  border-radius: var(--app-radius-large);
  background: var(--app-color-surface);
  box-shadow: inset 0 0 0 1px var(--app-color-border);
}

.app-button,
.app-icon-button {
  min-height: var(--app-button-height);
  border: 0;
  border-radius: var(--app-radius-medium);
  font: inherit;
  font-weight: 800;
  transition:
    transform var(--app-duration-fast) var(--app-ease-standard),
    filter var(--app-duration-fast) var(--app-ease-standard),
    box-shadow var(--app-duration-fast) var(--app-ease-standard);
}

.app-button-primary {
  background: var(--app-color-accent);
  color: #fff;
  box-shadow: 0 12px 24px rgb(0 107 104 / 16%);
}

.app-button-danger {
  background: var(--app-color-danger);
  color: #fff;
  box-shadow: 0 12px 24px rgb(239 79 91 / 16%);
}

.app-button-secondary {
  background: rgb(17 43 41 / 7%);
  color: var(--app-color-text);
}

.app-icon-button {
  display: inline-grid;
  width: var(--app-button-height);
  min-height: var(--app-button-height);
  place-items: center;
  border-radius: var(--app-radius-pill);
}

.app-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 6px 10px;
  border-radius: var(--app-radius-pill);
  background: var(--app-color-accent-soft);
  color: var(--app-color-accent);
  font-size: 12px;
  font-weight: 750;
}

.app-toast {
  border-radius: var(--app-radius-large);
  box-shadow: var(--app-shadow-elevated);
}

.app-bottom-sheet {
  border-radius: var(--app-radius-sheet) var(--app-radius-sheet) 0 0;
  background: var(--app-color-surface-glass);
  box-shadow: var(--app-shadow-popup);
  backdrop-filter: blur(22px) saturate(140%);
}

.app-scroll-area {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgb(0 107 104 / 30%) transparent;
}

.app-scroll-area::-webkit-scrollbar {
  width: 5px;
}

.app-scroll-area::-webkit-scrollbar-track {
  background: transparent;
}

.app-scroll-area::-webkit-scrollbar-thumb {
  border-radius: var(--app-radius-pill);
  background: rgb(0 107 104 / 28%);
}


/* ===== frontend/css/animations.css ===== */
@keyframes appFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes appFadeTranslateIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes appToastIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.app-pressable:active,
.app-button:active,
.app-icon-button:active {
  transform: scale(.98);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}


/* ===== frontend/css/layout.css ===== */
:root {
  --app-shell-max-width: 520px;
  --app-bottom-nav-height: 78px;
  --app-popup-bottom-clearance: calc(var(--app-bottom-nav-height) + var(--app-safe-bottom) + 120px);
}

.app-layer {
  position: relative;
  z-index: 1;
}


/* ===== frontend/css/app.css ===== */
:root {
  --bg: #f4f7f6;
  --surface: #ffffff;
  --surface-glass: rgb(255 255 255 / 88%);
  --text: #101c1b;
  --muted: #74817f;
  --line: rgb(17 43 41 / 8%);
  --accent: #006b68;
  --accent-deep: #00514f;
  --accent-soft: #e7f3f2;
  --danger: #ef4f5b;
  --success: #23b26d;
  --unknown: #8e9997;
  --radius: 24px;
  --shadow: 0 18px 54px rgb(7 44 41 / 14%);
  --shadow-soft: 0 10px 32px rgb(7 44 41 / 10%);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 50% -20%, rgb(0 107 104 / 10%), transparent 34%),
    var(--bg);
  color: var(--text);
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

.app-icon {
  display: block;
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.screen {
  position: relative;
  width: min(100%, 520px);
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: #eaf1ef;
}

.map-shell {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #e8f0ed;
}

.map-viewport {
  position: absolute;
  inset: 25px 0 -25px;
  z-index: 1;
  overflow: hidden;
  background: #e8f0ed;
}

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

.leaflet-container {
  width: 100%;
  height: 100%;
  background: #e8f0ed;
  color: var(--text);
  font: inherit;
}

.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas {
  position: absolute;
  top: 0;
  left: 0;
}

.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow {
  user-select: none;
  -webkit-user-drag: none;
}

.leaflet-tile-pane {
  z-index: 200;
}

.leaflet-overlay-pane {
  z-index: 400;
}

.leaflet-marker-pane {
  z-index: 600;
}

.leaflet-tooltip-pane {
  z-index: 650;
}

.leaflet-popup-pane {
  z-index: 700;
}

.leaflet-popup {
  position: absolute;
  text-align: center;
  margin-bottom: 20px;
}

.leaflet-popup-content-wrapper {
  text-align: left;
}

.leaflet-popup-content {
  line-height: 1.35;
}

.leaflet-popup-tip-container {
  position: absolute;
  left: 50%;
  width: 40px;
  height: 20px;
  margin-left: -20px;
  overflow: hidden;
  pointer-events: none;
}

.leaflet-control {
  position: relative;
  z-index: 800;
  pointer-events: auto;
}

.leaflet-bottom {
  position: absolute;
  z-index: 1000;
  pointer-events: none;
}

.leaflet-right {
  right: 0;
}

.leaflet-bottom {
  bottom: 0;
}

.leaflet-control-attribution {
  max-width: 240px;
  border-radius: 8px;
  opacity: .5;
  font-size: 9px;
  line-height: 1.2;
  box-shadow: 0 6px 18px rgb(7 44 41 / 10%);
}

.leaflet-bottom.leaflet-right {
  right: 8px;
  bottom: 80px;
}

.leaflet-tile {
  filter: saturate(.72) contrast(.96) brightness(1.04);
}

.overlay {
  position: relative;
  z-index: 5;
  padding: max(14px, env(safe-area-inset-top)) 14px 0;
  pointer-events: none;
}

.topbar,
.stats-card,
.search-card {
  pointer-events: auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 52px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-glass);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(22px) saturate(130%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.brand-mark .app-icon {
  width: 21px;
  height: 21px;
}

h1 {
  margin: 0;
  font-size: 19px;
  line-height: 1.05;
  letter-spacing: 0;
}

.eyebrow {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.icon-button {
  display: grid;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: white;
  box-shadow: 0 12px 28px rgb(0 107 104 / 24%);
}

.icon-button .app-icon {
  width: 21px;
  height: 21px;
}

.stats-card {
  display: grid;
  grid-template-columns: 1.05fr repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-top: 7px;
  padding: 5px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgb(255 255 255 / 91%);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(24px) saturate(135%);
}

.stats-card > div {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 40px;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 6px 5px;
  overflow: hidden;
  border-radius: 16px;
  background: transparent;
}

.stat-main {
  background: transparent !important;
}

.stat-item::before {
  content: "";
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: 0;
  width: 1px;
  background: rgb(17 43 41 / 6%);
}

.stat-item {
  position: relative;
}

.stat-label {
  display: inline-flex;
  min-width: 0;
  max-width: 100%;
  align-items: center;
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  line-height: 1.15;
  white-space: nowrap;
}

.stat-dot {
  display: inline-block;
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  margin-right: 4px;
  border-radius: 999px;
  vertical-align: 1px;
}

.stats-card strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-overflow: ellipsis;
}

.stat-main .stat-label {
  color: rgb(116 129 127 / 72%);
}

.stat-main strong {
  color: rgb(116 129 127 / 92%);
  font-size: 11px;
  font-weight: 550;
}

.is-online .stat-dot {
  background: var(--success);
}

.is-offline .stat-dot {
  background: var(--danger);
}

.is-unknown .stat-dot {
  background: var(--unknown);
}

.is-online strong {
  color: var(--success);
}

.is-offline strong {
  color: var(--danger);
}

.is-unknown strong {
  color: rgb(16 28 27 / 76%);
  font-weight: 600;
}

.search-card {
  position: relative;
  margin-top: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-glass);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(22px) saturate(130%);
}

.search-icon {
  position: absolute;
  left: 22px;
  top: 20px;
  width: 18px;
  height: 18px;
  color: var(--accent);
  pointer-events: none;
}

.search-card input {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: var(--radius);
  padding: 0 14px 0 42px;
  outline: none;
  background: rgb(255 255 255 / 78%);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgb(17 43 41 / 6%);
}

.search-card input::placeholder {
  color: rgb(116 129 127 / 78%);
}

.search-card input:focus {
  box-shadow:
    inset 0 0 0 1px rgb(0 107 104 / 28%),
    0 0 0 4px rgb(0 107 104 / 8%);
}

.search-results {
  display: grid;
  gap: 8px;
  max-height: 180px;
  overflow: auto;
}

.search-results:not(:empty) {
  margin-top: 8px;
}

.search-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius);
  background: rgb(255 255 255 / 82%);
  color: var(--text);
  font-size: 14px;
  line-height: 1.25;
  box-shadow: inset 0 0 0 1px rgb(17 43 41 / 5%);
  cursor: pointer;
  transition: background .16s ease, transform .16s ease, box-shadow .16s ease;
}

.search-result:active {
  transform: scale(.985);
}

.search-result:hover {
  background: rgb(255 255 255 / 94%);
  box-shadow:
    inset 0 0 0 1px rgb(0 107 104 / 14%),
    0 8px 20px rgb(7 44 41 / 8%);
}

.search-result span {
  min-width: 0;
}

.search-result strong {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 12px;
}

.power-marker {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 50%, #fff 0 36%, currentColor 38% 100%);
  cursor: pointer;
  pointer-events: auto;
  box-shadow:
    0 6px 16px rgb(7 44 41 / 18%),
    0 0 0 3px rgb(255 255 255 / 66%);
  transition: box-shadow .18s ease, transform .18s ease, background .18s ease;
}

.power-marker::after {
  content: "";
  position: absolute;
  inset: -12px;
  border-radius: inherit;
}

.power-marker.online,
.power-marker.on {
  color: var(--success);
}

.power-marker.offline,
.power-marker.off {
  color: var(--danger);
}

.power-marker.unknown,
.power-marker.unk {
  color: var(--unknown);
}

.power-marker:hover {
  transform: scale(1.08);
  box-shadow:
    0 8px 20px rgb(7 44 41 / 20%),
    0 0 0 4px rgb(255 255 255 / 76%);
}

.power-marker.is-selected {
  z-index: 650 !important;
  transform: scale(1.12);
  box-shadow:
    0 10px 26px rgb(7 44 41 / 24%),
    0 0 0 5px rgb(255 255 255 / 86%),
    0 0 0 9px rgb(0 107 104 / 18%);
}

.power-cluster {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 999px;
  background: transparent;
  transition: transform .18s ease, filter .18s ease;
}

.power-cluster:hover {
  transform: scale(1.04);
  filter: saturate(1.04);
}

.power-cluster:active {
  transform: scale(.97);
}

.power-cluster-ring {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 999px;
  padding: 4px;
  box-shadow:
    0 16px 38px rgb(7 44 41 / 18%),
    0 0 0 5px rgb(255 255 255 / 48%);
}

.power-cluster-inner {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff, rgb(248 251 250 / 98%));
  box-shadow:
    inset 0 0 0 1px rgb(17 43 41 / 8%),
    0 8px 18px rgb(7 44 41 / 12%);
}

.power-cluster-count {
  color: var(--text);
  font-size: 17px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
}

.house-popup .leaflet-popup-content-wrapper {
  overflow: hidden;
  border-radius: 26px;
  background: transparent;
  box-shadow: 0 24px 68px rgb(7 44 41 / 24%);
}

.house-popup .leaflet-popup-content {
  width: min(318px, calc(100vw - 36px)) !important;
  margin: 0;
  color: var(--text);
  font: inherit;
}

.house-popup .leaflet-popup-tip-container {
  display: none;
}

.house-popup-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgb(17 43 41 / 8%);
  border-radius: 26px;
  background: linear-gradient(180deg, rgb(255 255 255 / 98%), rgb(249 252 251 / 96%));
  backdrop-filter: blur(24px) saturate(140%);
}

.house-popup-section {
  display: grid;
  gap: 7px;
  padding: 9px;
  border-radius: 16px;
  background: rgb(244 247 246 / 66%);
  box-shadow: inset 0 0 0 1px rgb(17 43 41 / 4%);
}

.house-popup-header {
  grid-template-columns: 1fr;
  background: transparent;
  padding: 0;
  box-shadow: none;
}

.house-popup-kicker,
.house-popup-title {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0;
}

.house-popup-address {
  display: grid;
  gap: 3px;
}

.house-popup-address strong {
  color: var(--text);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.15;
}

.house-popup-address span,
.house-popup-muted,
.house-popup-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.house-popup-note {
  padding: 9px 10px;
  border-radius: 14px;
  background: rgb(255 255 255 / 62%);
}

.house-popup-status {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
  box-shadow: inset 0 0 0 1px currentColor;
}

.house-popup-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
}

.house-popup-status.is-online {
  background: rgb(35 178 109 / 11%);
  color: var(--success);
}

.house-popup-status.is-offline {
  background: rgb(239 79 91 / 11%);
  color: var(--danger);
}

.house-popup-status.is-unknown {
  background: rgb(142 153 151 / 13%);
  color: var(--unknown);
}

.house-popup-status.is-preliminary {
  max-width: 170px;
  white-space: normal;
  line-height: 1.15;
}

.house-popup-community-signal {
  display: grid;
  gap: 3px;
  padding: 8px 9px;
  border-radius: 13px;
  background: rgb(255 255 255 / 72%);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgb(17 43 41 / 5%);
}

.house-popup-community-signal strong {
  font-size: 12px;
  line-height: 1.25;
  font-weight: 680;
}

.house-popup-community-signal span {
  font-size: 11.5px;
  line-height: 1.25;
  color: var(--muted);
}

.house-popup-community-signal.is-online {
  box-shadow: inset 0 0 0 1px rgb(35 178 109 / 20%);
}

.house-popup-community-signal.is-offline {
  box-shadow: inset 0 0 0 1px rgb(239 79 91 / 20%);
}

.house-popup-votes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.house-popup-votes div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 9px;
  border-radius: 14px;
  background: rgb(255 255 255 / 70%);
  color: var(--muted);
  font-size: 10.5px;
  box-shadow: inset 0 0 0 1px rgb(17 43 41 / 4%);
}

.house-popup-votes strong {
  color: var(--text);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  font-weight: 760;
}

.house-popup-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.house-popup-secondary-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.house-popup-action {
  min-height: 44px;
  border: 0;
  border-radius: 14px;
  padding: 0 12px;
  color: white;
  font-size: 13.5px;
  font-weight: 680;
  box-shadow: 0 10px 20px rgb(7 44 41 / 10%);
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease, opacity .16s ease;
}

.house-popup-action:active {
  transform: scale(.98);
  box-shadow: 0 8px 18px rgb(7 44 41 / 10%);
}

.house-popup-action.is-online {
  background: var(--success);
}

.house-popup-action.is-offline {
  background: var(--danger);
}

.house-popup-admin-action {
  min-height: 40px;
  border: 0;
  border-radius: 14px;
  padding: 0 12px;
  background: rgb(0 107 104 / 10%);
  color: var(--accent-deep);
  font-size: 13.5px;
  font-weight: 680;
}

.house-popup-secondary-action {
  min-height: 40px;
  border: 0;
  border-radius: 14px;
  padding: 0 12px;
  background: rgb(17 43 41 / 7%);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 680;
}

.leaflet-container.is-picking-coordinate {
  cursor: crosshair;
}

.admin-preview-marker {
  width: 22px;
  height: 22px;
  border: 2px solid var(--accent);
  border-radius: 999px;
  background: rgb(255 255 255 / 92%);
  box-shadow:
    0 10px 24px rgb(7 44 41 / 20%),
    0 0 0 7px rgb(0 107 104 / 18%);
}

.admin-preview-marker::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: inherit;
  background: var(--accent);
}

.admin-review-marker {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #fff;
  box-shadow:
    0 10px 26px rgb(7 44 41 / 20%),
    0 0 0 5px rgb(255 255 255 / 68%);
}

.admin-review-marker::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: inherit;
}

.admin-review-marker.is-current {
  border: 2px solid var(--danger);
}

.admin-review-marker.is-current::after {
  background: var(--danger);
}

.admin-review-marker.is-suggested {
  border: 2px solid var(--accent);
  box-shadow:
    0 12px 30px rgb(7 44 41 / 22%),
    0 0 0 6px rgb(0 107 104 / 18%);
}

.admin-review-marker.is-suggested::after {
  background: var(--accent);
}

.admin-coordinate-panel {
  position: absolute;
  right: 14px;
  bottom: calc(96px + env(safe-area-inset-bottom));
  left: 14px;
  z-index: 8;
  display: none;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgb(255 255 255 / 94%);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px) saturate(135%);
}

.admin-coordinate-panel.is-visible {
  display: flex;
}

.admin-coordinate-panel strong,
.admin-coordinate-panel span {
  display: block;
}

.admin-coordinate-panel strong {
  color: var(--text);
  font-size: 13px;
  line-height: 1.25;
}

.admin-coordinate-panel span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.admin-coordinate-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.admin-coordinate-actions button {
  min-height: 38px;
  border: 0;
  border-radius: 14px;
  padding: 0 12px;
  font-weight: 800;
}

.admin-coordinate-actions button:first-child {
  background: var(--accent);
  color: white;
}

.admin-coordinate-actions button:last-child {
  background: rgb(17 43 41 / 7%);
  color: var(--text);
}

.admin-review-panel {
  position: absolute;
  right: 14px;
  bottom: calc(96px + env(safe-area-inset-bottom));
  left: 14px;
  z-index: 9;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgb(255 255 255 / 95%);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px) saturate(135%);
}

.admin-review-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.admin-review-head strong {
  color: var(--text);
  font-size: 14px;
}

.admin-review-head span,
.admin-review-distances span {
  color: var(--muted);
  font-size: 12px;
}

.admin-review-address {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
}

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

.admin-review-distances span {
  padding: 7px 8px;
  border-radius: 12px;
  background: rgb(17 43 41 / 5%);
  font-variant-numeric: tabular-nums;
}

.admin-review-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.admin-review-actions button {
  min-height: 36px;
  border: 0;
  border-radius: 13px;
  padding: 0 8px;
  background: rgb(17 43 41 / 7%);
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
}

.admin-review-actions button.is-primary {
  background: var(--accent);
  color: #fff;
}

.map-controls {
  position: absolute;
  right: 16px;
  bottom: 104px;
  left: 16px;
  z-index: 4;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

#moveMapButton,
#zoomLabel {
  display: none;
}

.map-controls button,
.map-controls span {
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(20px) saturate(130%);
  pointer-events: auto;
}

.map-controls button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  border: 0;
  padding: 0 18px;
  background: var(--accent);
  color: white;
  font-weight: 800;
}

.control-icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: rgb(255 255 255 / 16%);
  line-height: 1;
}

.control-icon .app-icon {
  width: 17px;
  height: 17px;
}

.map-controls span {
  min-height: 44px;
  padding: 13px 14px 0;
  background: rgb(255 255 255 / 86%);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  width: min(100%, 520px);
  margin: 0 auto;
  padding: 8px 10px max(10px, env(safe-area-inset-bottom));
  border: 1px solid rgb(17 43 41 / 8%);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  background: rgb(255 255 255 / 90%);
  box-shadow: 0 -18px 42px rgb(7 44 41 / 13%);
  backdrop-filter: blur(26px) saturate(140%);
}

.bottom-nav button {
  display: grid;
  min-width: 0;
  min-height: 62px;
  place-items: center;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.1;
}

.bottom-nav button.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: currentColor;
}

.nav-icon .app-icon {
  width: 23px;
  height: 23px;
}

@media (max-width: 430px) {
  .stats-card strong {
    font-size: 12.5px;
  }

  .stat-main strong {
    font-size: 11.5px;
  }
}

@media (max-width: 360px) {
  .screen {
    width: 100%;
  }

  .overlay {
    padding-right: 12px;
    padding-left: 12px;
  }

  .stats-card {
    gap: 1px;
  }

  .stats-card > div {
    padding: 6px 3px;
  }

  .bottom-nav {
    padding-right: 8px;
    padding-left: 8px;
  }
}

.app-toast {
  position: absolute;
  right: 16px;
  bottom: calc(98px + env(safe-area-inset-bottom));
  left: 16px;
  z-index: 20;
  display: grid;
  min-height: 52px;
  place-items: center;
  padding: 12px 16px;
  border-radius: 20px;
  background: rgb(17 43 41 / 92%);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 18px 44px rgb(7 44 41 / 28%);
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}

.app-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.admin-requests-panel {
  gap: 8px;
  padding: 10px;
}

.admin-requests-panel .admin-review-head strong {
  font-size: 13px;
}

.admin-requests-panel .admin-review-address {
  font-size: 12.5px;
}

.admin-requests-panel .admin-review-distances {
  gap: 6px;
}

.admin-requests-panel .admin-review-distances span {
  padding: 6px 7px;
  font-size: 10.5px;
}

.admin-requests-panel .admin-review-actions {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.admin-requests-panel .admin-review-actions button {
  min-height: 34px;
  border-radius: 12px;
  padding: 0 6px;
  font-size: 10.5px;
}

.admin-requests-panel.is-empty .admin-review-distances {
  display: none;
}

.admin-requests-panel.is-empty .admin-review-actions button:not([data-request-refresh]) {
  display: none;
}

.admin-requests-panel.is-empty .admin-review-actions {
  grid-template-columns: 1fr;
}

.admin-requests-panel.is-empty [data-request-refresh] {
  min-height: 40px;
  font-size: 12px;
}

.admin-mode-switcher {
  position: absolute;
  right: 16px;
  bottom: calc(188px + env(safe-area-inset-bottom));
  left: 16px;
  z-index: 14;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgb(255 255 255 / 94%);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(22px) saturate(135%);
}

.admin-mode-switcher a {
  display: grid;
  min-height: 34px;
  place-items: center;
  border-radius: 13px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-decoration: none;
}

.admin-mode-switcher a.is-active {
  background: var(--accent);
  color: #fff;
}

.admin-coordinate-panel {
  z-index: 18;
}

.admin-review-panel.is-hidden-during-edit,
.admin-requests-panel.is-hidden-during-edit {
  display: none;
}

.power-marker.planned {
  color: #f5a524;
}

.outage-card {
  display: grid;
  gap: 7px;
  padding: 10px;
  border-radius: 14px;
  background: rgb(255 255 255 / 72%);
  box-shadow: inset 0 0 0 1px rgb(17 43 41 / 5%);
}

.outage-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.outage-card-head strong {
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.2;
}

.outage-description {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.outage-queue {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 4px 7px;
  background: rgb(245 165 36 / 15%);
  color: #9a6200;
  font-size: 10.5px;
  font-weight: 800;
}

.outage-card.outage-planned {
  background: rgb(255 248 230 / 86%);
  box-shadow: inset 0 0 0 1px rgb(245 165 36 / 22%);
}

.outage-card.outage-emergency,
.outage-card.outage-queue_limit {
  background: rgb(255 239 241 / 88%);
  box-shadow: inset 0 0 0 1px rgb(239 68 85 / 20%);
}

.stats-card {
  grid-template-columns: .95fr repeat(4, minmax(0, 1fr));
}

.is-planned .stat-dot {
  background: #f5a524;
}

.is-planned strong {
  color: #9a6200;
}

.power-cluster.has-planned .power-cluster-ring {
  box-shadow:
    0 16px 38px rgb(7 44 41 / 18%),
    0 0 0 5px rgb(255 255 255 / 48%),
    0 0 0 9px rgb(245 165 36 / 18%);
}


.house-popup .leaflet-popup-content {
  max-height: calc(100vh - 310px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 26px;
}

.house-popup-card {
  max-height: calc(100vh - 310px);
}

.house-popup .leaflet-popup-content::-webkit-scrollbar {
  width: 0;
}

.stats-card .stat-item,
.stats-card .stat-main {
  cursor: pointer;
}

.stats-card .is-filter-active {
  background: rgb(17 43 41 / 8%);
  box-shadow: inset 0 0 0 1px rgb(17 43 41 / 8%);
}

.stats-card .is-filter-active {
  border-radius: 16px;
  background: rgb(17 43 41 / 5%);
  box-shadow: inset 0 0 0 1px rgb(17 43 41 / 7%);
}


.house-popup .leaflet-popup-content {
  max-height: min(520px, calc(100dvh - 250px));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.house-popup-card {
  max-height: none;
}

/* Compact popup v1 */
.house-popup .leaflet-popup-content {
  width: min(285px, calc(100vw - 44px)) !important;
  max-height: min(455px, calc(100dvh - 275px));
}

.house-popup-card {
  gap: 9px;
  padding: 12px;
  border-radius: 22px;
}

.house-popup-section {
  gap: 6px;
  padding: 8px;
  border-radius: 15px;
}

.house-popup-address strong {
  font-size: 15px;
}

.house-popup-address span,
.house-popup-note {
  font-size: 12px;
}

.house-popup-title {
  font-size: 11px;
}

.house-popup-votes {
  gap: 6px;
}

.house-popup-votes div {
  padding: 8px;
  border-radius: 13px;
}

.house-popup-action {
  min-height: 40px;
  border-radius: 14px;
  font-size: 15px;
}

.house-popup-secondary-action,
.house-popup-admin-action {
  min-height: 36px;
  border-radius: 14px;
  font-size: 14px;
}

.outage-card {
  padding: 9px;
  border-radius: 14px;
}

.outage-title {
  font-size: 13px;
}

.outage-description {
  font-size: 12px;
}

.outage-queue {
  padding: 3px 6px;
  font-size: 10px;
}


.status-badge.is-planned {
  color: #9a6200;
  background: rgb(255 248 230 / 92%);
  border-color: rgb(245 165 36 / 45%);
}

.status-badge.is-planned .status-dot {
  background: #f5a524;
}

.house-popup-status.is-planned {
  color: #9a6200;
  background: rgb(255 248 230 / 92%);
  box-shadow: inset 0 0 0 1px rgb(245 165 36 / 45%);
}

.house-popup-status.is-planned .house-popup-dot {
  background: #f5a524;
}

.stats-card {
  position: relative;
  z-index: 20;
  pointer-events: auto;
}

.stats-card > div {
  pointer-events: auto;
  cursor: pointer;
  touch-action: manipulation;
}

/* Sticky popup action footer */
.house-popup-sticky-actions {
  position: sticky;
  bottom: calc(-8px - env(safe-area-inset-bottom));
  z-index: 5;
  display: grid;
  gap: 6px;
  margin: 2px -14px -14px;
  padding: 8px 14px calc(10px + env(safe-area-inset-bottom));
  border-radius: 0 0 22px 22px;
  background: linear-gradient(180deg, rgb(249 252 251 / 58%), rgb(249 252 251 / 92%) 42%, rgb(249 252 251 / 98%));
  backdrop-filter: blur(8px);
}

.house-popup-sticky-actions .house-popup-secondary-action,
.house-popup-sticky-actions .house-popup-admin-action,
.house-popup-sticky-actions .house-popup-history-action,
.house-popup-sticky-actions .house-popup-favorite-action {
  width: 100%;
}

/* Popup fixed footer layout */
.house-popup .leaflet-popup-content {
  overflow: hidden;
  width: min(304px, calc(100vw - 26px)) !important;
  max-height: min(620px, calc(100dvh - 152px));
}

.house-popup-card {
  display: flex;
  flex-direction: column;
  max-height: min(620px, calc(100dvh - 152px));
  overflow: hidden;
}

.house-popup-scroll {
  display: grid;
  gap: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgb(0 107 104 / 34%) transparent;
}

.house-popup-scroll::-webkit-scrollbar {
  width: 6px;
}

.house-popup-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.house-popup-scroll::-webkit-scrollbar-thumb {
  border: 1px solid transparent;
  border-radius: 999px;
  background: rgb(0 107 104 / 26%);
  background-clip: padding-box;
}

.house-popup-chrome {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 34px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0;
}

.house-popup-footer {
  display: grid;
  gap: 8px;
  flex-shrink: 0;
  margin: 8px -12px -12px;
  padding: 10px 12px 12px;
  border-radius: 0 0 22px 22px;
  background: linear-gradient(
    180deg,
    rgb(249 252 251 / 72%),
    rgb(249 252 251 / 98%) 36%,
    rgb(249 252 251 / 100%)
  );
  backdrop-filter: blur(14px);
  box-shadow: 0 -12px 22px rgb(7 44 41 / 5%);
}

.house-popup-footer .house-popup-secondary-action,
.house-popup-footer .house-popup-admin-action {
  width: 100%;
}

/* Favorite button in house popup */
.house-popup-favorite-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgb(0 107 104 / 9%);
  color: var(--accent-deep);
  box-shadow: inset 0 0 0 1px rgb(0 107 104 / 10%);
}

.house-popup-favorite-action.is-active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 22px rgb(0 107 104 / 18%);
}

.house-popup-favorite-action:active {
  transform: scale(.985);
}

/* Favorites tab */
.favorites-panel {
  position: absolute;
  inset: auto 12px calc(88px + env(safe-area-inset-bottom)) 12px;
  z-index: 30;
  display: none;
  max-height: min(520px, calc(100dvh - 190px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: linear-gradient(180deg, rgb(255 255 255 / 98%), rgb(249 252 251 / 96%));
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px) saturate(140%);
}

.favorites-panel.is-visible {
  display: flex;
  flex-direction: column;
}

.favorites-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 10px;
}

.favorites-kicker {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.favorites-panel h2 {
  margin: 2px 0 0;
  font-size: 22px;
  line-height: 1.1;
}

.favorites-close {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 16px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 28px;
  line-height: 1;
  font-weight: 700;
}

.favorites-list {
  display: grid;
  gap: 8px;
  overflow-y: auto;
  padding: 0 12px 14px;
}

.favorite-row {
  width: 100%;
  border: 0;
  border-radius: 18px;
  padding: 12px;
  background: rgb(244 247 246 / 78%);
  color: var(--text);
  text-align: left;
  box-shadow: inset 0 0 0 1px rgb(17 43 41 / 5%);
}

.favorite-row strong {
  display: block;
  font-size: 15px;
  line-height: 1.2;
}

.favorite-row span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.favorites-empty {
  padding: 18px;
  border-radius: 20px;
  background: rgb(244 247 246 / 72%);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

/* Favorites list compact */
.favorites-list {
  max-height: 286px;
  overflow-y: auto;
  padding-bottom: 12px;
}

.favorite-row-wrap {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 74px 42px;
  gap: 8px;
  align-items: stretch;
}

.favorite-row-wrap .favorite-row {
  min-width: 0;
}

.favorite-delete {
  display: grid;
  width: 42px;
  min-height: 64px;
  place-items: center;
  border: 0;
  border-radius: 18px;
  background: rgb(239 79 91 / 10%);
  color: var(--danger);
  font-size: 18px;
  box-shadow: inset 0 0 0 1px rgb(239 79 91 / 12%);
}

.favorite-delete:active {
  transform: scale(.97);
}

.favorite-history {
  min-height: 64px;
  padding: 0 10px;
  border-radius: 18px;
  font-size: 12px;
}

/* Favorite marker above clusters */
.favorite-map-marker {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 3px solid #fff;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  box-shadow:
    0 10px 22px rgb(0 107 104 / 28%),
    0 0 0 5px rgb(0 107 104 / 14%);
}

/* Status ring for favorite markers */
.favorite-map-marker {
  outline: 4px solid rgb(142 153 151 / 38%);
  outline-offset: 1px;
}

.favorite-map-marker.is-online {
  outline-color: rgb(35 178 109 / 55%);
}

.favorite-map-marker.is-offline {
  outline-color: rgb(239 79 91 / 60%);
}

.favorite-map-marker.is-planned {
  outline-color: rgb(245 165 36 / 65%);
}

.favorite-map-marker.is-unknown {
  outline-color: rgb(142 153 151 / 45%);
}

/* Smaller clusters */
.power-cluster,
.power-cluster-ring {
  transform: scale(.86);
}

.power-cluster-count {
  font-size: 16px;
}

/* Slightly larger Leaflet attribution */
.leaflet-control-attribution {
  font-size: 0px;
  opacity: .0;
}

/* Favorite marker status ring */
.favorite-map-marker.is-online {
  box-shadow:
    0 10px 22px rgb(35 178 109 / 28%),
    0 0 0 5px rgb(35 178 109 / 24%);
}

.favorite-map-marker.is-offline {
  box-shadow:
    0 10px 22px rgb(239 79 91 / 30%),
    0 0 0 5px rgb(239 79 91 / 34%);
}

.favorite-map-marker.is-planned {
  box-shadow:
    0 10px 22px rgb(245 165 36 / 30%),
    0 0 0 5px rgb(245 165 36 / 34%);
}

.favorite-map-marker.is-unknown {
  box-shadow:
    0 10px 22px rgb(142 153 151 / 24%),
    0 0 0 5px rgb(142 153 151 / 26%);
}

/* Favorite marker status ring */
.favorite-map-marker.is-online {
  box-shadow:
    0 10px 22px rgb(0 107 104 / 28%),
    0 0 0 5px rgb(35 178 109 / 28%);
}

.favorite-map-marker.is-offline {
  box-shadow:
    0 10px 22px rgb(0 107 104 / 28%),
    0 0 0 5px rgb(239 79 91 / 32%);
}

.favorite-map-marker.is-planned {
  box-shadow:
    0 10px 22px rgb(0 107 104 / 28%),
    0 0 0 5px rgb(245 165 36 / 34%);
}

.favorite-map-marker.is-unknown {
  box-shadow:
    0 10px 22px rgb(0 107 104 / 28%),
    0 0 0 5px rgb(142 153 151 / 26%);
}

/* Favorite marker status rings */
.favorite-map-marker.is-online {
  border-color: var(--success);
  box-shadow:
    0 10px 22px rgb(0 107 104 / 25%),
    0 0 0 5px rgb(35 178 109 / 30%);
}

.favorite-map-marker.is-offline {
  border-color: var(--danger);
  box-shadow:
    0 10px 22px rgb(0 107 104 / 25%),
    0 0 0 5px rgb(239 79 91 / 36%);
}

.favorite-map-marker.is-planned {
  border-color: #f5a524;
  box-shadow:
    0 10px 22px rgb(0 107 104 / 25%),
    0 0 0 5px rgb(245 165 36 / 38%);
}

.favorite-map-marker.is-unknown {
  border-color: var(--unknown);
  box-shadow:
    0 10px 22px rgb(0 107 104 / 22%),
    0 0 0 5px rgb(142 153 151 / 30%);
}

/* FINAL favorite marker status override */
.favorite-map-marker.is-online {
  border-color: var(--success) !important;
}

.favorite-map-marker.is-offline {
  border-color: var(--danger) !important;
}

.favorite-map-marker.is-planned {
  border-color: #f5a524 !important;
}

.favorite-map-marker.is-unknown {
  border-color: var(--unknown) !important;
}

/* Favorite marker ring by status */
.favorite-map-marker {
  position: relative;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.favorite-map-marker-ring {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 4px solid var(--unknown);
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  box-shadow:
    0 10px 22px rgb(0 107 104 / 25%),
    0 0 0 5px rgb(142 153 151 / 28%);
}

.favorite-map-marker.is-online .favorite-map-marker-ring {
  border-color: var(--success);
  box-shadow:
    0 10px 22px rgb(0 107 104 / 25%),
    0 0 0 5px rgb(35 178 109 / 30%);
}

.favorite-map-marker.is-offline .favorite-map-marker-ring {
  border-color: var(--danger);
  box-shadow:
    0 10px 22px rgb(0 107 104 / 25%),
    0 0 0 5px rgb(239 79 91 / 38%);
}

.favorite-map-marker.is-planned .favorite-map-marker-ring {
  border-color: #f5a524;
  box-shadow:
    0 10px 22px rgb(0 107 104 / 25%),
    0 0 0 5px rgb(245 165 36 / 38%);
}

.favorite-map-marker {
  width: 38px !important;
  height: 38px !important;
}

.favorite-map-marker-ring {
  width: 30px !important;
  height: 30px !important;
  border-width: 4px !important;
}

/* Final favorite marker positioning fix */
.favorite-map-marker {
  width: 30px !important;
  height: 30px !important;
  margin-left: -15px !important;
  margin-top: -15px !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.favorite-map-marker-ring {
  display: grid !important;
  width: 30px !important;
  height: 30px !important;
  place-items: center !important;
  border-width: 4px !important;
  border-style: solid !important;
  border-radius: 999px !important;
  background: var(--accent) !important;
  color: #fff !important;
}

/* Fixed favorite markers: no coordinate shift */
.favorite-map-marker-icon {
  width: 34px !important;
  height: 34px !important;
  margin-left: -17px !important;
  margin-top: -17px !important;
  border: 0 !important;
  background: transparent !important;
}

.favorite-map-marker {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 4px solid var(--unknown);
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
  box-shadow:
    0 10px 22px rgb(0 107 104 / 25%),
    0 0 0 5px rgb(142 153 151 / 30%);
}

.favorite-map-marker.is-online {
  border-color: var(--success);
  box-shadow:
    0 10px 22px rgb(0 107 104 / 25%),
    0 0 0 5px rgb(35 178 109 / 30%);
}

.favorite-map-marker.is-offline {
  border-color: var(--danger);
  box-shadow:
    0 10px 22px rgb(0 107 104 / 25%),
    0 0 0 5px rgb(239 79 91 / 38%);
}

.favorite-map-marker.is-planned {
  border-color: #f5a524;
  box-shadow:
    0 10px 22px rgb(0 107 104 / 25%),
    0 0 0 5px rgb(245 165 36 / 38%);
}

.power-marker.is-favorite {
  box-shadow:
    0 8px 20px rgb(7 44 41 / 20%),
    0 0 0 5px rgb(255 255 255 / 86%),
    0 0 0 9px rgb(0 107 104 / 26%);
}

/* Final favorite marker/status override */
.favorite-map-marker-icon {
  width: 34px !important;
  height: 34px !important;
  margin-left: -17px !important;
  margin-top: -17px !important;
  border: 0 !important;
  background: transparent !important;
  opacity: 1 !important;
}

.favorite-map-marker {
  opacity: 1 !important;
  filter: none !important;
  background: var(--accent) !important;
  color: #fff !important;
  border: 4px solid var(--unknown) !important;
  outline: 0 !important;
}

.favorite-map-marker.is-online {
  border-color: var(--success) !important;
  box-shadow: 0 10px 22px rgb(0 107 104 / 28%), 0 0 0 6px rgb(35 178 109 / 36%) !important;
}

.favorite-map-marker.is-offline {
  border-color: var(--danger) !important;
  box-shadow: 0 10px 22px rgb(0 107 104 / 28%), 0 0 0 6px rgb(239 79 91 / 42%) !important;
}

.favorite-map-marker.is-planned {
  border-color: #f5a524 !important;
  box-shadow: 0 10px 22px rgb(0 107 104 / 28%), 0 0 0 6px rgb(245 165 36 / 44%) !important;
}

.favorite-map-marker.is-unknown {
  border-color: var(--unknown) !important;
  box-shadow: 0 10px 22px rgb(0 107 104 / 24%), 0 0 0 6px rgb(142 153 151 / 32%) !important;
}

.power-marker.is-favorite {
  opacity: 1 !important;
  filter: none !important;
}

.power-marker.is-favorite[data-favorite-status="online"] {
  box-shadow: 0 8px 20px rgb(7 44 41 / 20%), 0 0 0 5px rgb(255 255 255 / 86%), 0 0 0 10px rgb(35 178 109 / 45%) !important;
}

.power-marker.is-favorite[data-favorite-status="offline"] {
  box-shadow: 0 8px 20px rgb(7 44 41 / 20%), 0 0 0 5px rgb(255 255 255 / 86%), 0 0 0 10px rgb(239 79 91 / 52%) !important;
}

.power-marker.is-favorite[data-favorite-status="planned"] {
  box-shadow: 0 8px 20px rgb(7 44 41 / 20%), 0 0 0 5px rgb(255 255 255 / 86%), 0 0 0 10px rgb(245 165 36 / 54%) !important;
}

/* Favorite row status badge */
.favorite-row-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.favorite-status-badge {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgb(142 153 151 / 12%);
  color: var(--unknown);
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  box-shadow: inset 0 0 0 1px rgb(142 153 151 / 18%);
}

.favorite-status-badge i {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
}

.favorite-status-badge.is-online {
  background: rgb(35 178 109 / 11%);
  color: var(--success);
  box-shadow: inset 0 0 0 1px rgb(35 178 109 / 18%);
}

.favorite-status-badge.is-offline {
  background: rgb(239 79 91 / 11%);
  color: var(--danger);
  box-shadow: inset 0 0 0 1px rgb(239 79 91 / 18%);
}

.favorite-status-badge.is-planned {
  background: rgb(255 248 230 / 92%);
  color: #9a6200;
  box-shadow: inset 0 0 0 1px rgb(245 165 36 / 30%);
}

.favorite-status-badge.is-unknown {
  background: rgb(142 153 151 / 12%);
  color: var(--unknown);
}


.stats-card .stat-label small {
  font-size: 11px;
  font-weight: 800;
  opacity: 0.72;
  margin-left: 3px;
}

.stats-card .is-favorites .stat-dot {
  display: none !important;
}

.stats-card .is-favorites .stat-label {
  white-space: nowrap;
  font-size: 11px;
}

.stats-card .is-favorites strong {
  margin-top: 3px;
}


/* Избранные маркеры: фиксированный размер, чтобы Leaflet не "гулял" при зуме */
.house-marker.is-favorite-marker {
  width: 44px !important;
  height: 44px !important;
  transform: translate(-22px, -22px);
}

.house-marker.is-favorite-marker::before {
  content: "♥";
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: 8px;
  border-radius: 999px;
  background: #007c78;
  color: #fff;
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
}

.house-marker.is-favorite-marker {
  position: relative;
}

.house-marker.is-favorite-marker::before {
  position: absolute;
  z-index: 5;
  left: 50%;
  top: 50%;
  margin: 0 !important;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.house-marker.is-favorite-marker .marker-count,
.house-marker.is-favorite-marker .house-marker-count {
  display: none;
}

/* Product stage: lazy house details and three-tab navigation. */
.bottom-nav {
  grid-template-columns: repeat(3, 1fr);
}

.statistics-panel {
  z-index: 8;
}

.house-popup-close {
  display: grid;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: rgb(17 43 41 / 7%);
  color: var(--text);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}

.house-popup-scroll {
  max-height: min(560px, calc(100dvh - 210px));
  padding-right: 2px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.house-popup-skeleton-line {
  display: block;
  height: 13px;
  margin: 5px 0;
  border-radius: 999px;
  background: linear-gradient(90deg, rgb(17 43 41 / 7%), rgb(17 43 41 / 13%), rgb(17 43 41 / 7%));
  background-size: 180% 100%;
  animation: popupSkeleton 1.05s ease-in-out infinite;
}

.house-popup-skeleton-line.is-wide {
  width: 82%;
}

.house-popup-skeleton-line.is-medium {
  width: 58%;
}

.house-popup-skeleton-line.is-short {
  width: 36%;
}

@keyframes popupSkeleton {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -80% 0;
  }
}

.house-popup-error {
  display: grid;
  gap: 10px;
}

.house-popup-error button,
.house-popup-history-action {
  min-height: 42px;
  border: 0;
  border-radius: 16px;
  background: rgb(0 107 104 / 10%);
  color: var(--accent-deep);
  font-weight: 800;
}

.house-popup-history-action:disabled {
  cursor: default;
  opacity: .58;
}

.house-popup-limit-note {
  margin-top: -4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
  text-align: center;
}

.favorite-row-meta {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

/* Design-system foundation stage: compact popup, scroll affordance, unified controls. */
.house-popup .leaflet-popup-content-wrapper {
  border-radius: var(--app-radius-sheet);
  box-shadow: var(--app-shadow-popup);
}

.house-popup .leaflet-popup-content {
  width: min(298px, calc(100vw - 32px)) !important;
  max-height: min(560px, calc(100dvh - 168px));
  overflow: hidden;
}

.house-popup-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: min(560px, calc(100dvh - 168px));
  padding: 8px;
  border-radius: var(--app-radius-sheet);
  box-shadow: inset 0 0 0 1px var(--app-color-border);
  animation: appFadeTranslateIn var(--app-duration-medium) var(--app-ease-standard);
}

.house-popup-chrome {
  min-height: 38px;
  padding: 0 0 1px 4px;
}

.house-popup-close {
  width: 40px;
  min-height: 40px;
  height: 40px;
  background: rgb(17 43 41 / 6%);
  font-size: 22px;
  box-shadow: none;
}

.house-popup-scroll {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  gap: 6px;
  padding-right: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgb(0 107 104 / 34%) transparent;
}

.house-popup-scroll::-webkit-scrollbar {
  width: 5px;
}

.house-popup-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.house-popup-scroll::-webkit-scrollbar-thumb {
  border-radius: var(--app-radius-pill);
  background: rgb(0 107 104 / 30%);
}

.house-popup-card::after {
  content: "";
  position: absolute;
  right: 10px;
  bottom: 10px;
  left: 10px;
  height: 30px;
  border-radius: 0 0 18px 18px;
  background: linear-gradient(180deg, rgb(249 252 251 / 0%), rgb(249 252 251 / 94%));
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--app-duration-fast) var(--app-ease-standard);
}

.house-popup-card.has-scroll-overflow:not(.is-scroll-end)::after {
  opacity: 1;
}

.house-popup-card.has-scroll-overflow:not(.has-scrolled) .house-popup-scroll {
  box-shadow: inset 0 -10px 12px -14px rgb(0 107 104 / 46%);
}

/* Lazy history and favorite statistics stage. */
.history-panel {
  position: absolute;
  inset: auto 12px calc(88px + env(safe-area-inset-bottom)) 12px;
  z-index: 31;
  display: none;
  max-height: min(560px, calc(100dvh - 175px));
  overflow: hidden;
  border: 1px solid var(--app-color-border);
  border-radius: var(--app-radius-sheet);
  background: linear-gradient(180deg, rgb(255 255 255 / 98%), rgb(249 252 251 / 96%));
  box-shadow: var(--app-shadow-popup);
}

.history-panel.is-visible {
  display: flex;
  flex-direction: column;
  animation: appFadeTranslateIn var(--app-duration-medium) var(--app-ease-standard);
}

.history-panel-address {
  display: block;
  max-width: 250px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.history-panel-address strong,
.history-panel-address span {
  display: block;
}

.history-panel-address strong {
  color: var(--text);
  font-size: 13px;
  line-height: 1.18;
}

.history-panel-address span {
  margin-top: 2px;
}

.history-content {
  display: grid;
  gap: 10px;
  min-height: 170px;
  overflow-y: auto;
  padding: 0 12px 14px;
}

.history-event {
  position: relative;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 8px;
  padding: 10px;
  border-radius: var(--app-radius-large);
  background: rgb(244 247 246 / 72%);
  box-shadow: inset 0 0 0 1px rgb(17 43 41 / 5%);
}

.history-event-marker {
  width: 10px;
  height: 10px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--unknown);
  box-shadow: 0 0 0 4px rgb(142 153 151 / 14%);
}

.history-event.is-online .history-event-marker {
  background: var(--success);
  box-shadow: 0 0 0 4px rgb(35 178 109 / 14%);
}

.history-event.is-offline .history-event-marker {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgb(239 79 91 / 14%);
}

.history-event.is-planned .history-event-marker {
  background: var(--app-color-warning);
  box-shadow: 0 0 0 4px rgb(245 157 35 / 15%);
}

.history-event.is-possible-restoration .history-event-marker {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgb(0 107 104 / 15%);
}

.history-event-body {
  min-width: 0;
}

.history-event-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.history-event-meta em {
  font-style: normal;
  font-weight: 600;
}

.history-event h3 {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.2;
}

.history-event p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.history-skeleton {
  height: 70px;
  border-radius: var(--app-radius-large);
  background: linear-gradient(90deg, rgb(17 43 41 / 6%), rgb(17 43 41 / 12%), rgb(17 43 41 / 6%));
  background-size: 180% 100%;
  animation: popupSkeleton 1.05s ease-in-out infinite;
}

.history-skeleton.is-short {
  height: 48px;
  width: 76%;
}

.history-retry {
  margin-top: 10px;
  padding: 0 14px;
}

.favorite-stat-head {
  display: grid;
  gap: 3px;
  padding: 2px 2px 4px;
}

.favorite-stat-head strong {
  font-size: 14px;
  font-weight: 680;
  line-height: 1.2;
}

.favorite-stat-head span {
  color: var(--muted);
  font-size: 10.5px;
}

.favorite-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.favorite-stat-card {
  display: grid;
  gap: 3px;
  min-height: 58px;
  padding: 9px;
  border-radius: 14px;
  background: rgb(244 247 246 / 72%);
  box-shadow: inset 0 0 0 1px rgb(17 43 41 / 4%);
}

.favorite-stat-card span {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.2;
}

.favorite-stat-card strong {
  font-size: 20px;
  line-height: 1;
}

.favorite-stat-card.is-online strong {
  color: var(--success);
}

.favorite-stat-card.is-offline strong {
  color: var(--danger);
}

.favorite-stat-card.is-planned strong {
  color: var(--app-color-warning);
}

.favorite-stat-list {
  display: grid;
  gap: 7px;
}

.favorite-stat-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 9px;
  border-radius: 14px;
  background: rgb(244 247 246 / 70%);
  box-shadow: inset 0 0 0 1px rgb(17 43 41 / 4%);
}

.favorite-stat-row strong,
.favorite-stat-row span,
.favorite-stat-row small {
  display: block;
}

.favorite-stat-row strong {
  font-size: 12.8px;
  line-height: 1.2;
}

.favorite-stat-row span,
.favorite-stat-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10.8px;
  line-height: 1.25;
}

.favorite-stat-row .app-button {
  min-height: 38px;
  padding: 0 11px;
  white-space: nowrap;
}

.favorite-stat-row > div {
  min-width: 0;
}

.house-popup-history-action.is-disabled {
  cursor: default;
  opacity: .58;
}

.app-menu-backdrop {
  position: absolute;
  inset: 0;
  z-index: 39;
  background: rgb(8 24 23 / 18%);
  opacity: 0;
  transition: opacity var(--app-duration-fast) var(--app-ease-standard);
}

.app-menu-backdrop.is-visible {
  opacity: 1;
}

.app-menu-panel {
  position: absolute;
  right: 12px;
  bottom: calc(88px + env(safe-area-inset-bottom));
  left: 12px;
  z-index: 40;
  max-height: min(590px, calc(100dvh - 150px));
  overflow: hidden;
  border: 1px solid var(--app-color-border);
  border-radius: var(--app-radius-sheet);
  background: linear-gradient(180deg, rgb(255 255 255 / 98%), rgb(249 252 251 / 97%));
  box-shadow: var(--app-shadow-popup);
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity var(--app-duration-fast) var(--app-ease-standard),
    transform var(--app-duration-fast) var(--app-ease-standard);
}

.app-menu-panel.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.app-menu-view {
  display: none;
  max-height: inherit;
  flex-direction: column;
}

.app-menu-view.is-active {
  display: flex;
}

.app-menu-header {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 8px;
  min-height: 58px;
  padding: 10px 12px 8px;
}

.app-menu-header h2 {
  grid-column: 2;
  margin: 0;
  color: var(--text);
  font-size: 20px;
  line-height: 1.12;
  text-align: center;
}

.app-menu-view[data-menu-view="main"] .app-menu-header h2 {
  grid-column: 1 / 3;
  text-align: left;
}

.app-menu-close {
  grid-column: 3;
}

.app-menu-back {
  grid-column: 1;
}

.app-menu-close,
.app-menu-back {
  color: var(--accent-deep);
  background: rgb(0 107 104 / 9%);
}

.app-menu-list,
.app-menu-content {
  display: grid;
  gap: 8px;
  overflow-y: auto;
  padding: 0 12px 14px;
}

.app-menu-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  border: 0;
  border-radius: var(--app-radius-large);
  padding: 8px 10px;
  background: rgb(244 247 246 / 78%);
  color: var(--text);
  text-align: left;
  box-shadow: inset 0 0 0 1px rgb(17 43 41 / 5%);
}

.app-menu-item .app-icon {
  width: 22px;
  height: 22px;
  color: var(--accent-deep);
}

.app-menu-item span {
  font-size: 15px;
  font-weight: 760;
  line-height: 1.2;
}

.app-menu-full-button {
  margin: 2px 12px 14px;
}

.app-menu-content {
  max-height: min(500px, calc(100dvh - 220px));
  color: var(--text);
  font-size: 14px;
  line-height: 1.42;
}

.app-menu-content h3 {
  margin: 2px 0 0;
  font-size: 22px;
  line-height: 1.1;
}

.app-menu-content p,
.app-menu-content ul,
.app-menu-content ol {
  margin: 0;
}

.app-menu-content ul,
.app-menu-content ol {
  display: grid;
  gap: 6px;
  padding-left: 20px;
}

.app-menu-lead {
  color: var(--accent-deep);
  font-weight: 800;
}

.app-menu-muted {
  color: var(--muted);
  font-size: 12px;
}

.app-menu-channel-link {
  color: var(--accent-deep);
  font-weight: 750;
  text-decoration: none;
}

.app-menu-channel-link:active {
  opacity: .68;
}

/* Favorites naming polish. */
.favorites-panel h2 {
  font-weight: 680;
}

.favorite-row-wrap {
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
  padding: 10px;
  border-radius: var(--app-radius-large);
  background: rgb(244 247 246 / 72%);
  box-shadow: inset 0 0 0 1px rgb(17 43 41 / 5%);
}

.favorite-row-wrap .favorite-row {
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.favorite-row-top {
  align-items: flex-start;
}

.favorite-identity {
  min-width: 0;
}

.favorite-title {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  font-weight: 680;
  line-height: 1.18;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.favorite-address-line {
  display: block;
  margin-top: 5px;
  color: var(--text);
  font-size: 13px;
  font-weight: 560;
  line-height: 1.25;
}

.favorite-settlement {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 480;
  line-height: 1.25;
}

.favorite-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.favorite-edit,
.favorite-delete {
  width: 42px;
  min-height: 42px;
  height: 42px;
  border-radius: 15px;
  font-size: 0;
}

.favorite-edit {
  background: rgb(0 107 104 / 8%);
  color: var(--accent-deep);
}

.favorite-delete {
  background: rgb(239 79 91 / 9%);
  color: var(--danger);
}

.favorite-edit .app-icon,
.favorite-delete .app-icon {
  width: 18px;
  height: 18px;
}

.favorite-history {
  min-height: 42px;
  padding: 0 13px;
  border-radius: 15px;
  font-size: 12px;
  font-weight: 630;
}

.favorite-row-meta {
  margin-top: 7px;
}

.favorite-stat-head strong {
  font-weight: 680;
}

.favorite-stat-row {
  align-items: start;
}

.favorite-stat-row .favorite-title {
  font-size: 14px;
  font-weight: 680;
}

.favorite-stat-row .favorite-address-line {
  font-size: 12px;
}

.favorite-stat-row .app-button {
  min-height: 40px;
  border-radius: 15px;
  font-weight: 630;
}

.favorite-title-editor {
  position: absolute;
  right: 12px;
  bottom: calc(88px + env(safe-area-inset-bottom));
  left: 12px;
  z-index: 42;
  overflow: hidden;
  border: 1px solid var(--app-color-border);
  border-radius: var(--app-radius-sheet);
  background: linear-gradient(180deg, rgb(255 255 255 / 98%), rgb(249 252 251 / 97%));
  box-shadow: var(--app-shadow-popup);
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity var(--app-duration-fast) var(--app-ease-standard),
    transform var(--app-duration-fast) var(--app-ease-standard);
}

.favorite-title-editor.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.favorite-title-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 8px;
}

.favorite-title-editor-header h2 {
  margin: 2px 0 0;
  font-size: 20px;
  font-weight: 680;
  line-height: 1.12;
}

.favorite-title-editor-form {
  display: grid;
  gap: 10px;
  padding: 0 14px 14px;
}

.favorite-title-editor-form input {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgb(17 43 41 / 9%);
  border-radius: var(--app-radius-large);
  padding: 0 13px;
  background: rgb(244 247 246 / 74%);
  color: var(--text);
  outline: none;
}

.favorite-title-editor-form input:focus {
  border-color: rgb(0 107 104 / 34%);
  box-shadow: 0 0 0 4px rgb(0 107 104 / 9%);
}

.favorite-title-editor-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  min-height: 16px;
  color: var(--muted);
  font-size: 11px;
}

.favorite-title-editor-meta span {
  color: var(--danger);
}

.favorite-title-editor-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.favorite-title-editor-actions .app-button {
  min-height: 44px;
}

.app-menu-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: var(--app-radius-large);
  background: rgb(244 247 246 / 78%);
  box-shadow: inset 0 0 0 1px rgb(17 43 41 / 5%);
}

.app-menu-actions {
  display: grid;
  gap: 8px;
}

.app-menu-actions .app-button {
  display: grid;
  min-height: 44px;
  place-items: center;
  padding: 0 14px;
  text-align: center;
  text-decoration: none;
}

.app-menu-faq {
  border-radius: var(--app-radius-large);
  background: rgb(244 247 246 / 78%);
  box-shadow: inset 0 0 0 1px rgb(17 43 41 / 5%);
}

.app-menu-faq summary {
  min-height: 46px;
  padding: 13px 12px;
  color: var(--text);
  font-weight: 780;
  cursor: pointer;
}

.app-menu-faq p {
  padding: 0 12px 12px;
  color: var(--muted);
  font-size: 13px;
}

@media (prefers-reduced-motion: reduce) {
  .history-panel.is-visible,
  .history-skeleton,
  .app-menu-backdrop,
  .app-menu-panel {
    animation: none;
    transition: none;
  }
}

.house-popup-section {
  gap: 4px;
  padding: 6px;
  border-radius: var(--app-radius-medium);
  background: rgb(244 247 246 / 54%);
}

.house-popup-address strong {
  font-size: 15px;
  line-height: 1.12;
}

.house-popup-address span,
.house-popup-note {
  font-size: 11px;
  line-height: 1.3;
}

.house-popup-note {
  padding: 6px 8px;
  border-radius: 12px;
}

.house-popup-status {
  gap: 5px;
  padding: 5px 8px;
  font-size: 11px;
}

.house-popup-votes {
  gap: 5px;
}

.house-popup-votes div {
  gap: 4px;
  padding: 6px 7px;
  border-radius: 12px;
  font-size: 10.5px;
}

.house-popup-votes strong {
  font-size: 13px;
}

.house-popup-secondary-actions {
  gap: 6px;
}

.house-popup-actions {
  gap: 6px;
}

.house-popup-action {
  min-height: 40px;
  border-radius: 12px;
  padding: 0 10px;
  font-size: 13px;
  box-shadow: 0 6px 14px rgb(7 44 41 / 8%);
}

.house-popup-action[aria-disabled="true"],
.house-popup-action.is-disabled {
  cursor: default;
  filter: saturate(.72);
  opacity: .58;
  transform: none;
  box-shadow: none;
}

.house-popup-action.is-submitting {
  opacity: .68;
}

.house-popup-secondary-action,
.house-popup-admin-action,
.house-popup-history-action,
.house-popup-error button,
.house-popup-favorite-action {
  min-height: 38px;
  border-radius: 12px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 680;
}

.house-popup-sticky-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: grid;
  gap: 4px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  padding: 6px 0 calc(4px + env(safe-area-inset-bottom));
  box-sizing: border-box;
  overflow: hidden;
  border-radius: 0 0 var(--app-radius-sheet) var(--app-radius-sheet);
  background: linear-gradient(180deg, rgb(249 252 251 / 42%), rgb(249 252 251 / 90%) 46%, rgb(249 252 251 / 97%));
  backdrop-filter: blur(4px);
  border-top: 1px solid rgb(17 43 41 / 4%);
}

.house-popup-sticky-actions .house-popup-actions,
.house-popup-sticky-actions .house-popup-secondary-actions {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.house-popup-sticky-actions .house-popup-actions,
.house-popup-sticky-actions .house-popup-secondary-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.house-popup-sticky-actions .house-popup-secondary-action,
.house-popup-sticky-actions .house-popup-admin-action,
.house-popup-sticky-actions .house-popup-history-action,
.house-popup-sticky-actions .house-popup-favorite-action {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.app-toast {
  align-content: center;
  justify-items: center;
  gap: 3px;
  min-height: 54px;
  padding: 11px 16px;
  animation: appToastIn var(--app-duration-medium) var(--app-ease-standard);
}

.app-toast strong,
.app-toast span {
  display: block;
}

.app-toast strong {
  font-size: 14px;
  line-height: 1.2;
}

.app-toast span {
  font-size: 12px;
  font-weight: 650;
  line-height: 1.25;
  opacity: .82;
}

.statistics-screen {
  position: fixed;
  inset: 0;
  z-index: 65;
  display: grid;
  grid-template-rows: auto 1fr;
  background:
    linear-gradient(180deg, rgb(247 251 250 / 98%), rgb(238 246 244 / 96%));
  color: var(--text);
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity var(--app-duration-medium) var(--app-ease-standard),
    transform var(--app-duration-medium) var(--app-ease-standard);
}

.statistics-screen[hidden] {
  display: none;
}

.statistics-screen.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.statistics-screen-header {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  gap: 10px;
  align-items: center;
  padding: calc(12px + env(safe-area-inset-top)) 14px 10px;
  border-bottom: 1px solid rgb(17 43 41 / 7%);
  background: rgb(255 255 255 / 86%);
  backdrop-filter: blur(18px);
}

.statistics-screen-header h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0;
}

.statistics-tabs {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: var(--app-radius-pill);
  background: rgb(17 43 41 / 7%);
}

.statistics-tabs button {
  min-height: 36px;
  border: 0;
  border-radius: var(--app-radius-pill);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 670;
}

.statistics-tabs button.is-active {
  background: rgb(255 255 255 / 96%);
  color: var(--app-color-accent-deep);
  box-shadow: 0 6px 18px rgb(17 43 41 / 9%);
}

.statistics-screen-body {
  overflow: auto;
  padding: 12px 14px calc(96px + env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}

.statistics-screen.has-history-overlay .statistics-screen-body {
  overflow: hidden;
}

.statistics-range-row {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 0 0 10px;
  scrollbar-width: none;
}

.statistics-range-row::-webkit-scrollbar {
  display: none;
}

.statistics-range-row button {
  flex: 0 0 auto;
  min-height: 36px;
  border: 1px solid rgb(17 43 41 / 9%);
  border-radius: var(--app-radius-pill);
  padding: 0 12px;
  background: rgb(255 255 255 / 78%);
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 650;
}

.statistics-range-row button.is-active {
  border-color: rgb(0 107 104 / 28%);
  background: rgb(0 107 104 / 10%);
  color: var(--app-color-accent-deep);
}

.statistics-range-row button.is-locked {
  opacity: .72;
}

.statistics-content {
  display: grid;
  gap: 12px;
}

.statistics-hero,
.statistics-chart,
.statistics-list-section,
.statistics-top-row {
  border: 1px solid rgb(17 43 41 / 7%);
  border-radius: var(--app-radius-large);
  background: rgb(255 255 255 / 86%);
  box-shadow: var(--app-shadow-card);
}

.statistics-hero {
  display: grid;
  gap: 4px;
  padding: 14px;
}

.statistics-hero div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.statistics-hero span,
.statistics-hero small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 620;
}

.statistics-hero strong {
  color: var(--app-color-accent-deep);
  font-size: 30px;
  font-weight: 760;
  line-height: 1;
}

.statistics-chart {
  display: grid;
  gap: 8px;
  padding: 12px;
  color: var(--app-color-accent-deep);
}

.statistics-chart svg {
  width: 100%;
  height: 132px;
  overflow: visible;
}

.statistics-chart-meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  font-weight: 620;
}

.statistics-chart-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.statistics-chart-summary div {
  display: grid;
  gap: 3px;
  min-height: 56px;
  padding: 8px 9px;
  border-radius: 14px;
  background: rgb(244 247 246 / 72%);
  box-shadow: inset 0 0 0 1px rgb(17 43 41 / 4%);
}

.statistics-chart-summary span {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 620;
}

.statistics-chart-summary strong {
  align-self: end;
  color: var(--app-color-accent-deep);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  font-weight: 720;
  line-height: 1.05;
}

.statistics-chart-body {
  position: relative;
  min-height: 196px;
}

.statistics-chart-layout {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.statistics-chart-y-axis {
  position: relative;
  height: 220px;
  min-width: 0;
  overflow: visible;
  padding-top: 18px;
}

.statistics-chart-y-axis span {
  position: absolute;
  right: 0;
  display: block;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  line-height: 1;
  text-align: right;
  white-space: nowrap;
}

.statistics-chart-plot {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.statistics-chart-svg {
  display: block;
  width: 100%;
  height: 220px;
  overflow: visible;
}

.statistics-chart-grid-line {
  stroke: rgb(17 43 41 / 5%);
  stroke-width: .45;
}

.statistics-chart-axis-label {
  fill: var(--muted);
  font-size: 4.2px;
  font-weight: 640;
}

.statistics-chart-axis-label.is-y {
  text-anchor: start;
}

.statistics-chart-axis-label.is-x {
  text-anchor: middle;
}

.statistics-chart-hit {
  fill: transparent;
  stroke: transparent;
  stroke-width: 10;
  pointer-events: all;
  cursor: pointer;
}

.statistics-chart-line {
  fill: none;
  stroke: var(--app-color-accent-deep);
  stroke-width: 1.45;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.statistics-chart-area {
  opacity: .86;
}

.statistics-chart-point-dot {
  fill: rgb(255 255 255 / 94%);
  stroke: rgb(0 107 104 / 56%);
  stroke-width: .9;
  pointer-events: none;
}

.statistics-chart-point-dot.is-min {
  stroke: rgb(125 139 136 / 76%);
}

.statistics-chart-point-dot.is-max {
  stroke: rgb(0 107 104 / 92%);
}

.statistics-chart-point-dot.is-selected {
  stroke: var(--accent);
  stroke-width: 1;
  fill: #fff;
}

.statistics-chart-x-axis {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.statistics-chart-x-axis span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 620;
  line-height: 1.2;
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.statistics-chart-x-axis span.is-first {
  justify-self: start;
  text-align: left;
}

.statistics-chart-x-axis span.is-middle {
  justify-self: center;
  text-align: center;
}

.statistics-chart-x-axis span.is-first {
  justify-self: start;
  text-align: left;
}

.statistics-chart-x-axis span.is-last {
  justify-self: end;
  text-align: right;
}

.statistics-chart-x-axis span.is-last,
.statistics-chart-x-axis span.is-first,
.statistics-chart-x-axis span.is-middle {
  min-width: 0;
}

.statistics-chart-tooltip {
  display: grid;
  gap: 2px;
  padding: 9px 10px;
  border-radius: 16px;
  background: rgb(244 247 246 / 76%);
  box-shadow: inset 0 0 0 1px rgb(17 43 41 / 5%);
}

.statistics-chart-tooltip strong {
  color: var(--text);
  font-size: 12.5px;
  font-weight: 700;
}

.statistics-chart-tooltip span,
.statistics-chart-tooltip small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

@media (max-width: 399px) {
  .statistics-chart-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .statistics-chart-layout {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .statistics-chart-y-axis {
    height: 220px;
  }

  .statistics-chart-svg {
    height: 220px;
  }

  .favorite-stat-row {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .favorite-stat-row .app-button {
    justify-self: start;
  }

  .statistics-timeline-legend {
    gap: 3px 8px;
  }

  .statistics-timeline-axis span {
    font-size: 9px;
  }
}

.statistics-empty-chart {
  padding: 18px;
  border-radius: var(--app-radius-large);
  background: rgb(255 255 255 / 76%);
  color: var(--muted);
  text-align: center;
}

.statistics-empty-chart strong {
  display: block;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.statistics-empty-chart span {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.35;
}

.statistics-list-section {
  display: grid;
  gap: 8px;
  padding: 11px;
}

.statistics-list-section h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 680;
}

.statistics-top-list {
  display: grid;
  gap: 8px;
}

.statistics-top-row {
  display: grid;
  gap: 4px;
  padding: 9px;
  box-shadow: none;
}

.statistics-top-row-head {
  display: flex;
  align-items: center;
  gap: 6px;
}

.statistics-top-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 21px;
  min-height: 21px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgb(0 107 104 / 10%);
  color: var(--app-color-accent-deep);
  font-size: 11px;
  font-weight: 720;
}

.statistics-top-tag {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1;
}

.statistics-top-tag.is-outage {
  background: rgb(239 79 91 / 10%);
  color: var(--danger);
}

.statistics-top-tag.is-stable {
  background: rgb(35 178 109 / 10%);
  color: var(--success);
}

.statistics-top-row strong {
  font-size: 13.5px;
  font-weight: 670;
}

.statistics-top-row span,
.statistics-top-row small {
  color: var(--muted);
  font-size: 11.5px;
}

.statistics-address-selector {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 1px 0 2px;
  scrollbar-width: none;
}

.statistics-address-selector::-webkit-scrollbar {
  display: none;
}

.statistics-address-selector button {
  flex: 0 0 auto;
  min-height: 36px;
  border: 1px solid rgb(17 43 41 / 9%);
  border-radius: var(--app-radius-pill);
  padding: 0 12px;
  background: rgb(255 255 255 / 82%);
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 640;
}

.statistics-address-selector button.is-active {
  border-color: rgb(0 107 104 / 28%);
  background: rgb(0 107 104 / 10%);
  color: var(--app-color-accent-deep);
}

.statistics-favorite-detail {
  border: 1px solid rgb(17 43 41 / 6%);
  background: rgb(255 255 255 / 86%);
  box-shadow: var(--app-shadow-card);
}

.statistics-timeline {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 3px;
  min-height: 36px;
  align-items: stretch;
  padding: 7px;
  border-radius: 14px;
  background: rgb(255 255 255 / 72%);
  box-shadow: inset 0 0 0 1px rgb(17 43 41 / 4%);
}

.statistics-timeline-shell {
  display: grid;
  gap: 7px;
}

.statistics-timeline-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 620;
}

.statistics-timeline-legend-item.is-online {
  color: var(--success);
}

.statistics-timeline-legend-item.is-offline {
  color: var(--danger);
}

.statistics-timeline-legend-item.is-planned {
  color: var(--app-color-warning);
}

.statistics-timeline-legend-item.is-unknown {
  color: var(--unknown);
}

.statistics-timeline-legend-item.is-possible-restoration {
  color: var(--app-color-accent-deep);
}

.statistics-timeline-segment {
  position: relative;
  min-height: 30px;
  border: 0;
  border-radius: 10px;
  padding: 0;
  background: rgb(125 139 136 / 16%);
  overflow: hidden;
  color: inherit;
}

.statistics-timeline-segment-bar {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: currentColor;
  opacity: .72;
}

.statistics-timeline-segment.is-online {
  color: var(--success);
}

.statistics-timeline-segment.is-offline {
  color: var(--danger);
}

.statistics-timeline-segment.is-planned {
  color: var(--app-color-warning);
}

.statistics-timeline-segment.is-unknown {
  color: var(--unknown);
}

.statistics-timeline-segment.is-possible-restoration {
  color: var(--app-color-accent-deep);
}

.statistics-timeline-segment.is-selected {
  box-shadow: 0 0 0 2px rgb(0 107 104 / 16%);
}

.statistics-timeline-segment.is-selected .statistics-timeline-segment-bar {
  opacity: 1;
}

.statistics-timeline-axis {
  position: relative;
  min-height: 16px;
  overflow: hidden;
}

.statistics-timeline-axis span {
  position: absolute;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 620;
  transform: translateX(-50%);
}

.statistics-timeline-axis span.is-first {
  transform: translateX(0);
}

.statistics-timeline-axis span.is-last {
  transform: translateX(-100%);
}

.statistics-timeline-axis span.is-first {
  transform: translateX(0);
}

.statistics-timeline-axis span.is-last {
  transform: translateX(-100%);
}

.statistics-timeline-tooltip {
  display: grid;
  gap: 2px;
  padding: 9px 10px;
  border-radius: 16px;
  background: rgb(244 247 246 / 76%);
  box-shadow: inset 0 0 0 1px rgb(17 43 41 / 5%);
}

.statistics-timeline-tooltip strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 690;
}

.statistics-timeline-tooltip span {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.3;
}

.app-menu-fullscreen {
  position: fixed;
  inset: 0;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 80;
  height: 100%;
  width: auto;
  max-width: none;
  max-height: none;
  overflow: hidden;
  border-radius: 0;
  border: 0;
  background:
    linear-gradient(180deg, rgb(249 252 251 / 98%), rgb(238 246 244 / 98%));
  box-shadow: none;
  opacity: 1;
  transform: translateX(100%);
  transition: transform var(--app-duration-medium) var(--app-ease-standard);
}

.app-menu-fullscreen[hidden] {
  display: none;
}

.app-menu-fullscreen.is-visible {
  transform: translateX(0);
}

.app-menu-fullscreen .app-menu-view {
  min-height: 100%;
  padding: calc(14px + env(safe-area-inset-top)) 14px calc(24px + env(safe-area-inset-bottom));
}

.app-menu-fullscreen .app-menu-view[data-menu-view="main"] {
  display: none;
  min-height: 100%;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 12px;
}

.app-menu-fullscreen .app-menu-view[data-menu-view="main"].is-active {
  display: grid;
}

.app-menu-fullscreen .app-menu-list {
  align-content: start;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.app-menu-footer {
  align-self: end;
  margin: 4px 0 0;
  padding: 10px 4px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 620;
  line-height: 1.35;
  text-align: center;
}

.app-menu-fullscreen .app-menu-content {
  max-height: calc(100vh - 92px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
}

.statistics-history-panel {
  position: fixed;
  inset: 0;
  z-index: 74;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background:
    linear-gradient(180deg, rgb(249 252 251 / 98%), rgb(239 247 245 / 98%));
  opacity: 0;
  transform: translateX(14px);
  transition:
    opacity var(--app-duration-medium) var(--app-ease-standard),
    transform var(--app-duration-medium) var(--app-ease-standard);
}

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

.statistics-history-panel.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.statistics-history-header {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: calc(12px + env(safe-area-inset-top)) 14px 10px;
  border-bottom: 1px solid rgb(17 43 41 / 7%);
  background: rgb(255 255 255 / 88%);
  backdrop-filter: blur(18px);
}

.statistics-history-header h2 {
  margin: 0;
  color: var(--text);
  font-size: 21px;
  font-weight: 700;
}

.statistics-history-panel .history-content {
  overflow: auto;
  padding: 12px 14px calc(28px + env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}

@media (prefers-reduced-motion: reduce) {
  .statistics-screen,
  .app-menu-fullscreen,
  .statistics-tabs button {
    transition: none;
  }
}

/* Favorite address notification toggle */
.favorite-notifications {
  position: relative;
  color: var(--accent, #006d6b);
  background: rgba(0, 109, 107, 0.08);
  border-color: rgba(0, 109, 107, 0.14);
}

.favorite-notifications.is-active {
  color: var(--accent, #006d6b);
  background: rgba(0, 109, 107, 0.11);
}

.favorite-notifications.is-muted {
  color: #8c9998;
  background: rgba(126, 142, 140, 0.08);
  border-color: rgba(126, 142, 140, 0.16);
}

.favorite-notifications .favorite-notifications-slash {
  stroke-width: 2.2;
}

.favorite-notifications:disabled {
  cursor: default;
  opacity: 0.55;
}

.favorite-row-actions {
  flex-wrap: wrap;
}

/* =========================================================
   Final viewport geometry fix
   ========================================================= */

.statistics-screen {
  position: absolute;
  inset: 0;
  width: 100%;
  max-width: 100%;
  height: 100%;
  min-height: 0;
}

.statistics-screen-body {
  min-width: 0;
  min-height: 0;
  overscroll-behavior: contain;
}

.statistics-content,
.statistics-hero,
.statistics-chart,
.statistics-list-section,
.statistics-top-row {
  min-width: 0;
  max-width: 100%;
}

.house-popup .leaflet-popup-content {
  width: min(304px, calc(100vw - 28px)) !important;
  max-height: min(520px, calc(100dvh - 250px));
  overflow: hidden;
}

.house-popup-card {
  width: 100%;
  max-height: min(520px, calc(100dvh - 250px));
  min-height: 0;
  overflow: hidden;
}

.house-popup-scroll {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
}

.favorites-panel,
.history-panel {
  max-width: calc(100% - 24px);
}

@media (min-width: 521px) {
  .screen {
    box-shadow:
      0 0 0 1px rgb(17 43 41 / 7%),
      0 24px 70px rgb(7 44 41 / 14%);
  }
}

@media (max-width: 520px) {
  .screen {
    width: 100%;
    max-width: none;
  }

  .statistics-screen {
    width: 100%;
    max-width: none;
  }
}


/* =========================================================
   Universal mobile layout
   Device-independent responsive rules
   ========================================================= */

:root {
  --app-mobile-gutter: 12px;
  --app-bottom-nav-height: 78px;
  --app-overlay-reserved-height: 202px;
}

/* Основной контейнер всегда остаётся телефонным mini-app */
.screen {
  width: min(100%, 520px);
  max-width: 520px;
  height: 100dvh;
  min-height: 100svh;
  margin-inline: auto;
}

/* Все полноэкранные внутренние экраны ограничены шириной mini-app */
.statistics-screen,
.app-menu-fullscreen {
  position: absolute;
  inset: 0;
  width: 100%;
  max-width: 100%;
  height: 100%;
}

/* Поп-ап не должен выходить за границы mini-app */
.house-popup .leaflet-popup-content {
  width: min(
    304px,
    calc(min(100vw, 520px) - 28px)
  ) !important;

  max-height: calc(
    100dvh
    - var(--app-overlay-reserved-height)
    - var(--app-bottom-nav-height)
    - env(safe-area-inset-bottom)
  );

  min-height: 0;
  overflow: hidden;
}

.house-popup-card {
  width: 100%;
  max-height: inherit;
  min-height: 0;
  overflow: hidden;
}

.house-popup-scroll {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.house-popup-sticky-actions {
  flex: 0 0 auto;
}

/* Панели внутри mini-app, а не относительно всего браузера */
.favorites-panel,
.history-panel {
  right: var(--app-mobile-gutter);
  left: var(--app-mobile-gutter);
  width: auto;
  max-width: none;
}

/* Узкие телефоны */
@media (max-width: 380px) {
  :root {
    --app-mobile-gutter: 8px;
    --app-bottom-nav-height: 72px;
    --app-overlay-reserved-height: 194px;
  }

  .overlay {
    padding-right: 9px;
    padding-left: 9px;
  }

  .topbar {
    min-height: 48px;
    padding: 5px 7px;
  }

  .brand-mark {
    width: 31px;
    height: 31px;
  }

  h1 {
    font-size: 17px;
  }

  .brand-copy span {
    font-size: 10px;
  }

  .stats-card > div {
    padding-right: 3px;
    padding-left: 3px;
  }

  .stats-card strong {
    font-size: 12px;
  }

  .search-card {
    min-height: 54px;
  }

  .house-popup .leaflet-popup-content {
    width: calc(100vw - 18px) !important;
  }

  .house-popup-card {
    padding: 7px;
  }

  .house-popup-section {
    padding: 5px;
  }

  .house-popup-address strong {
    font-size: 14px;
  }

  .house-popup-address span,
  .house-popup-note,
  .house-popup-muted {
    font-size: 10.5px;
  }

  .house-popup-action {
    min-height: 38px;
    font-size: 12px;
  }

  .house-popup-secondary-action,
  .house-popup-history-action,
  .house-popup-favorite-action {
    min-height: 36px;
    font-size: 12px;
  }

  .bottom-nav {
    min-height: var(--app-bottom-nav-height);
    padding-right: 6px;
    padding-left: 6px;
  }

  .bottom-nav button {
    min-width: 0;
    padding-right: 4px;
    padding-left: 4px;
  }

  .bottom-nav span {
    font-size: 10px;
  }
}

/* Низкие экраны и горизонтальная ориентация */
@media (max-height: 700px) {
  :root {
    --app-bottom-nav-height: 66px;
    --app-overlay-reserved-height: 170px;
  }

  .overlay {
    padding-top: max(6px, env(safe-area-inset-top));
  }

  .topbar {
    min-height: 44px;
    padding-top: 4px;
    padding-bottom: 4px;
  }

  .stats-card {
    margin-top: 6px;
  }

  .stats-card > div {
    min-height: 44px;
    padding-top: 4px;
    padding-bottom: 4px;
  }

  .search-card {
    min-height: 48px;
    margin-top: 7px;
  }

  .search-card input {
    min-height: 44px;
  }

  .bottom-nav {
    min-height: var(--app-bottom-nav-height);
  }

  .house-popup .leaflet-popup-content {
    max-height: calc(
      100dvh
      - var(--app-overlay-reserved-height)
      - var(--app-bottom-nav-height)
      - env(safe-area-inset-bottom)
    );
  }

  .house-popup-card {
    gap: 4px;
    padding: 6px;
  }

  .house-popup-chrome {
    min-height: 32px;
  }

  .house-popup-close {
    width: 34px;
    min-height: 34px;
    height: 34px;
  }

  .house-popup-section {
    gap: 3px;
    padding: 5px;
  }

  .house-popup-sticky-actions {
    padding-top: 4px;
    padding-bottom: calc(3px + env(safe-area-inset-bottom));
  }
}

/* Планшеты и широкие браузеры */
@media (min-width: 521px) {
  .screen {
    width: 520px;
    max-width: 520px;
  }

  .statistics-screen,
  .app-menu-fullscreen {
    width: 100%;
    max-width: 100%;
  }

  .house-popup .leaflet-popup-content {
    width: 304px !important;
  }
}

/* Горизонтальный планшет или телефон:
   сохраняем телефонную колонку, но максимально используем высоту */
@media (orientation: landscape) and (max-height: 700px) {
  .screen {
    height: 100dvh;
  }

  .map-viewport {
    inset-top: 0;
  }

  .favorites-panel,
  .history-panel {
    max-height: calc(
      100dvh
      - var(--app-bottom-nav-height)
      - 18px
      - env(safe-area-inset-bottom)
    );
  }

  .statistics-screen-header {
    padding-top: calc(6px + env(safe-area-inset-top));
    padding-bottom: 6px;
  }

  .statistics-screen-body {
    padding-top: 8px;
    padding-bottom: calc(
      74px + env(safe-area-inset-bottom)
    );
  }
}



/* =========================================================
   Adaptive mobile geometry by viewport height
   ========================================================= */

:root {
  --mobile-header-safe-bottom: 336px;
  --mobile-nav-safe-top: 92px;
}

/*
 * Попап всегда ограничивается свободным местом:
 * верх — ниже поисковой карточки,
 * низ — выше нижней навигации.
 */
.house-popup .leaflet-popup-content {
  width: min(304px, calc(100vw - 24px)) !important;
  max-height: calc(
    100dvh
    - var(--mobile-header-safe-bottom)
    - var(--mobile-nav-safe-top)
  );
}

.house-popup-card {
  width: 100%;
  max-height: calc(
    100dvh
    - var(--mobile-header-safe-bottom)
    - var(--mobile-nav-safe-top)
  );
}

.house-popup-scroll {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.house-popup-sticky-actions {
  flex: 0 0 auto;
}

/* Обычные современные телефоны */
@media (min-height: 821px) and (max-width: 520px) {
  :root {
    --mobile-header-safe-bottom: 318px;
    --mobile-nav-safe-top: 96px;
  }

  .house-popup .leaflet-popup-content {
    width: min(320px, calc(100vw - 24px)) !important;
  }

  .house-popup-card {
    padding: 10px;
  }

  .house-popup-scroll {
    gap: 7px;
  }

  .house-popup-section {
    padding: 8px;
  }

  .house-popup-address strong {
    font-size: 16px;
  }

  .house-popup-address span,
  .house-popup-note {
    font-size: 11.5px;
  }

  .house-popup-action {
    min-height: 42px;
    font-size: 13.5px;
  }

  .house-popup-secondary-action,
  .house-popup-history-action,
  .house-popup-favorite-action {
    min-height: 40px;
  }
}

/* Средние телефоны */
@media (min-height: 701px) and (max-height: 820px) and (max-width: 520px) {
  :root {
    --mobile-header-safe-bottom: 326px;
    --mobile-nav-safe-top: 90px;
  }

  .house-popup .leaflet-popup-content {
    width: min(304px, calc(100vw - 20px)) !important;
  }

  .house-popup-card {
    gap: 5px;
    padding: 7px;
  }

  .house-popup-chrome {
    min-height: 34px;
  }

  .house-popup-close {
    width: 36px;
    min-height: 36px;
    height: 36px;
  }

  .house-popup-scroll {
    gap: 5px;
  }

  .house-popup-section {
    gap: 4px;
    padding: 6px;
  }

  .house-popup-address strong {
    font-size: 14.5px;
  }

  .house-popup-address span,
  .house-popup-note {
    font-size: 10.5px;
  }

  .house-popup-note {
    padding: 5px 7px;
  }

  .house-popup-votes div {
    padding: 5px 6px;
  }

  .house-popup-action {
    min-height: 38px;
    font-size: 12.5px;
  }

  .house-popup-secondary-action,
  .house-popup-history-action,
  .house-popup-favorite-action {
    min-height: 36px;
    font-size: 12px;
  }

  .house-popup-sticky-actions {
    gap: 3px;
    padding-top: 4px;
  }
}

/* Низкие экраны: iPhone SE и похожие */
@media (max-height: 700px) and (max-width: 520px) {
  :root {
    --mobile-header-safe-bottom: 316px;
    --mobile-nav-safe-top: 82px;
  }

  .house-popup .leaflet-popup-content {
    width: min(306px, calc(100vw - 18px)) !important;
  }

  .house-popup-card {
    gap: 4px;
    padding: 6px;
  }

  .house-popup-chrome {
    min-height: 30px;
    padding-left: 3px;
  }

  .house-popup-close {
    width: 34px;
    min-height: 34px;
    height: 34px;
    font-size: 20px;
  }

  .house-popup-scroll {
    gap: 4px;
    padding-right: 2px;
  }

  .house-popup-section {
    gap: 3px;
    padding: 5px;
    border-radius: 12px;
  }

  .house-popup-title,
  .house-popup-kicker {
    font-size: 9.5px;
  }

  .house-popup-address {
    gap: 2px;
  }

  .house-popup-address strong {
    font-size: 14px;
  }

  .house-popup-address span,
  .house-popup-muted,
  .house-popup-note {
    font-size: 10px;
    line-height: 1.22;
  }

  .house-popup-note {
    padding: 5px 6px;
    border-radius: 10px;
  }

  .house-popup-status {
    padding: 4px 7px;
    font-size: 10px;
  }

  .house-popup-votes {
    gap: 4px;
  }

  .house-popup-votes div {
    padding: 5px 6px;
    font-size: 10px;
  }

  .house-popup-votes strong {
    font-size: 12px;
  }

  .house-popup-action {
    min-height: 36px;
    padding: 0 7px;
    font-size: 12px;
  }

  .house-popup-secondary-action,
  .house-popup-history-action,
  .house-popup-favorite-action {
    min-height: 34px;
    padding: 0 6px;
    font-size: 11px;
  }

  .house-popup-sticky-actions {
    gap: 3px;
    padding: 4px 0 2px;
  }
}

/* Очень узкие устройства */
@media (max-width: 359px) {
  .overlay {
    padding-right: 8px;
    padding-left: 8px;
  }

  .house-popup .leaflet-popup-content {
    width: calc(100vw - 14px) !important;
  }

  .stats-card > div {
    padding-right: 2px;
    padding-left: 2px;
  }

  .stats-card span {
    font-size: 9px;
  }

  .stats-card strong {
    font-size: 12px;
  }

  .bottom-nav {
    padding-right: 5px;
    padding-left: 5px;
  }
}


/* =========================================================
   Mobile popup footer visibility fix
   Шапка и кнопки всегда видимы, прокручивается только содержимое
   ========================================================= */

.house-popup .leaflet-popup-content {
  overflow: hidden !important;
}

.house-popup-card {
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr) auto !important;
  width: 100%;
  min-height: 0;
  overflow: hidden !important;
}

.house-popup-chrome {
  grid-row: 1;
  flex: none;
}

.house-popup-scroll {
  grid-row: 2;
  min-height: 0 !important;
  max-height: none !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.house-popup-sticky-actions,
.house-popup-footer {
  position: relative !important;
  grid-row: 3;
  bottom: auto !important;
  z-index: 10;
  flex: none !important;
  min-height: max-content;
  margin: 0 !important;
  padding: 7px 0 2px !important;
  overflow: visible !important;
  background:
    linear-gradient(
      180deg,
      rgb(249 252 251 / 72%),
      rgb(249 252 251 / 100%) 34%
    ) !important;
  backdrop-filter: none;
}

.house-popup-sticky-actions .house-popup-actions,
.house-popup-sticky-actions .house-popup-secondary-actions,
.house-popup-footer .house-popup-actions,
.house-popup-footer .house-popup-secondary-actions {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 5px !important;
  width: 100%;
  min-width: 0;
}

.house-popup-sticky-actions button,
.house-popup-footer button {
  min-width: 0 !important;
  min-height: 40px !important;
  height: 40px;
  padding: 0 6px !important;
  overflow: hidden;
  font-size: 12px !important;
  line-height: 1.1;
  white-space: nowrap;
}

/* Высокие телефоны: XR, iPhone 11–16, большинство Android */
@media (max-width: 520px) and (min-height: 821px) {
  .house-popup .leaflet-popup-content,
  .house-popup-card {
    max-height: min(570px, calc(100dvh - 285px)) !important;
  }
}

/* Средние телефоны */
@media (max-width: 520px) and (min-height: 701px) and (max-height: 820px) {
  .house-popup .leaflet-popup-content,
  .house-popup-card {
    max-height: calc(100dvh - 270px) !important;
  }
}

/* Низкие экраны: iPhone SE и похожие */
@media (max-width: 520px) and (max-height: 700px) {
  .house-popup .leaflet-popup-content,
  .house-popup-card {
    max-height: calc(100dvh - 245px) !important;
  }

  .house-popup-card {
    gap: 3px !important;
    padding: 6px !important;
  }

  .house-popup-chrome {
    min-height: 32px !important;
  }

  .house-popup-close {
    width: 34px !important;
    min-height: 34px !important;
    height: 34px !important;
  }

  .house-popup-section {
    gap: 3px !important;
    padding: 5px !important;
  }

  .house-popup-sticky-actions,
  .house-popup-footer {
    padding-top: 5px !important;
  }

  .house-popup-sticky-actions button,
  .house-popup-footer button {
    min-height: 36px !important;
    height: 36px !important;
    font-size: 11px !important;
  }
}


/* =========================================================
   Final universal compact house popup
   Одинаковая компактная геометрия на всех телефонах
   ========================================================= */

@media (max-width: 520px) {
  .house-popup .leaflet-popup-content {
    width: min(304px, calc(100vw - 34px)) !important;
    max-height: 430px !important;
    overflow: hidden !important;
  }

  .house-popup-card {
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) auto !important;
    width: 100% !important;
    max-height: 430px !important;
    min-height: 0 !important;
    gap: 5px !important;
    padding: 7px !important;
    overflow: hidden !important;
  }

  .house-popup-chrome {
    grid-row: 1;
    min-height: 34px !important;
    padding-left: 3px !important;
  }

  .house-popup-close {
    width: 34px !important;
    min-width: 34px !important;
    height: 34px !important;
    min-height: 34px !important;
    font-size: 20px !important;
  }

  .house-popup-scroll {
    grid-row: 2;
    min-height: 0 !important;
    max-height: none !important;
    gap: 5px !important;
    padding-right: 3px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .house-popup-section {
    gap: 4px !important;
    padding: 6px !important;
    border-radius: 13px !important;
  }

  .house-popup-address strong {
    font-size: 14px !important;
    line-height: 1.12 !important;
  }

  .house-popup-address span,
  .house-popup-note,
  .house-popup-muted {
    font-size: 10.5px !important;
    line-height: 1.25 !important;
  }

  .house-popup-title,
  .house-popup-kicker {
    font-size: 10px !important;
  }

  .house-popup-status {
    padding: 4px 7px !important;
    font-size: 10px !important;
  }

  .house-popup-votes {
    gap: 4px !important;
  }

  .house-popup-votes div {
    min-height: 27px !important;
    padding: 5px 6px !important;
    font-size: 10px !important;
  }

  .house-popup-votes strong {
    font-size: 12px !important;
  }

  .house-popup-sticky-actions,
  .house-popup-footer {
    position: relative !important;
    grid-row: 3;
    bottom: auto !important;
    z-index: 10;
    min-height: auto !important;
    margin: 0 !important;
    padding: 5px 0 1px !important;
    overflow: visible !important;
    background: rgb(249 252 251 / 98%) !important;
    border-top: 1px solid rgb(17 43 41 / 5%);
    backdrop-filter: none !important;
  }

  .house-popup-sticky-actions .house-popup-actions,
  .house-popup-sticky-actions .house-popup-secondary-actions,
  .house-popup-footer .house-popup-actions,
  .house-popup-footer .house-popup-secondary-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 4px !important;
    width: 100% !important;
  }

  .house-popup-sticky-actions button,
  .house-popup-footer button {
    width: 100% !important;
    min-width: 0 !important;
    height: 36px !important;
    min-height: 36px !important;
    padding: 0 5px !important;
    border-radius: 11px !important;
    font-size: 11px !important;
    line-height: 1 !important;
    white-space: nowrap;
  }
}

/* Низкие экраны: iPhone SE, старые iPhone и компактные Android */
@media (max-width: 520px) and (max-height: 700px) {
  .house-popup .leaflet-popup-content {
    width: min(286px, calc(100vw - 40px)) !important;
    max-height: 360px !important;
  }

  .house-popup-card {
    max-height: 360px !important;
    gap: 3px !important;
    padding: 6px !important;
  }

  .house-popup-chrome {
    min-height: 30px !important;
  }

  .house-popup-close {
    width: 30px !important;
    min-width: 30px !important;
    height: 30px !important;
    min-height: 30px !important;
    font-size: 18px !important;
  }

  .house-popup-section {
    gap: 3px !important;
    padding: 5px !important;
  }

  .house-popup-address strong {
    font-size: 13px !important;
  }

  .house-popup-address span,
  .house-popup-note,
  .house-popup-muted {
    font-size: 9.5px !important;
  }

  .house-popup-sticky-actions button,
  .house-popup-footer button {
    height: 33px !important;
    min-height: 33px !important;
    font-size: 10px !important;
  }
}

/* Высокие современные телефоны */
@media (max-width: 520px) and (min-height: 850px) {
  .house-popup .leaflet-popup-content,
  .house-popup-card {
    max-height: 430px !important;
  }
}


/* Compact history entries inside statistics */
.statistics-history-panel .history-content {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  align-content: flex-start !important;
  gap: 10px !important;
  height: auto !important;
  min-height: 0 !important;
}

.statistics-history-panel .history-event {
  flex: 0 0 auto !important;
  align-self: stretch !important;
  height: auto !important;
  min-height: 0 !important;
  padding: 10px 12px !important;
}

.statistics-history-panel .history-event-body,
.statistics-history-panel .history-event-meta {
  min-height: 0 !important;
}

.statistics-history-panel .history-event h3,
.statistics-history-panel .history-event p {
  margin-top: 3px !important;
  margin-bottom: 0 !important;
}


/* ===== frontend/css/responsive.css ===== */
/* =========================================================
   СевСвет — пропорциональный мобильный интерфейс
   Эталон: iPhone 14 Pro Max, 430 × 932
   ========================================================= */

:root {
  --responsive-scale: 1;
  --responsive-side-gap: 10px;
  --responsive-top-gap: 8px;
  --responsive-bottom-nav-height: 74px;
  --responsive-popup-max-height: 430px;
}

/* Контейнер приложения */
.screen {
  width: min(100%, 520px) !important;
  max-width: 520px !important;
  height: 100dvh !important;
  min-height: 100dvh !important;
  margin: 0 auto !important;
  overflow: hidden !important;
}

/* =========================================================
   Единая верхняя панель:
   логотип + статистика + поиск
   ========================================================= */

.overlay {
  position: absolute !important;
  top: 0 !important;
  right: var(--responsive-side-gap) !important;
  left: var(--responsive-side-gap) !important;
  z-index: 1000 !important;

  display: grid !important;
  gap: calc(6px * var(--responsive-scale)) !important;

  margin: 0 !important;
  padding:
    max(
      calc(var(--responsive-top-gap) * var(--responsive-scale)),
      env(safe-area-inset-top)
    )
    0
    0 !important;

  pointer-events: none !important;
}

.topbar,
.stats-card,
.search-card {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  border: 1px solid rgb(17 43 41 / 7%) !important;
  background: rgb(255 255 255 / 94%) !important;
  box-shadow: 0 8px 24px rgb(7 44 41 / 10%) !important;
  backdrop-filter: blur(18px) saturate(125%) !important;
  -webkit-backdrop-filter: blur(18px) saturate(125%) !important;
  pointer-events: auto !important;
}

/* Шапка */
.topbar {
  min-height: calc(54px * var(--responsive-scale)) !important;
  padding:
    calc(6px * var(--responsive-scale))
    calc(8px * var(--responsive-scale)) !important;
  border-radius:
    calc(24px * var(--responsive-scale))
    calc(24px * var(--responsive-scale))
    calc(18px * var(--responsive-scale))
    calc(18px * var(--responsive-scale)) !important;
}

.brand {
  gap: calc(8px * var(--responsive-scale)) !important;
}

.brand-mark {
  width: calc(36px * var(--responsive-scale)) !important;
  height: calc(36px * var(--responsive-scale)) !important;
}

.brand h1,
.topbar h1 {
  font-size: calc(20px * var(--responsive-scale)) !important;
  line-height: 1.05 !important;
}

.brand p,
.brand small {
  font-size: calc(11px * var(--responsive-scale)) !important;
  line-height: 1.15 !important;
}

.menu-button,
.topbar-menu,
[data-menu-button] {
  width: calc(44px * var(--responsive-scale)) !important;
  min-width: calc(44px * var(--responsive-scale)) !important;
  height: calc(44px * var(--responsive-scale)) !important;
  min-height: calc(44px * var(--responsive-scale)) !important;
}

/* Карточка статусов */
.stats-card {
  min-height: calc(72px * var(--responsive-scale)) !important;
  padding: calc(5px * var(--responsive-scale)) !important;
  border-radius: calc(22px * var(--responsive-scale)) !important;
  gap: 0 !important;
}

.stats-card > div {
  min-width: 0 !important;
  min-height: calc(60px * var(--responsive-scale)) !important;
  padding:
    calc(6px * var(--responsive-scale))
    calc(5px * var(--responsive-scale)) !important;
}

.stats-card span {
  overflow: hidden !important;
  font-size: calc(10.5px * var(--responsive-scale)) !important;
  line-height: 1.08 !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.stats-card strong {
  font-size: calc(15px * var(--responsive-scale)) !important;
  line-height: 1.08 !important;
}

.stat-main strong {
  font-size: calc(14px * var(--responsive-scale)) !important;
}

/* Поиск */
.search-card {
  min-height: calc(66px * var(--responsive-scale)) !important;
  padding: calc(9px * var(--responsive-scale)) !important;
  border-radius:
    calc(18px * var(--responsive-scale))
    calc(18px * var(--responsive-scale))
    calc(24px * var(--responsive-scale))
    calc(24px * var(--responsive-scale)) !important;
}

.search-card input,
#addressSearch {
  min-height: calc(48px * var(--responsive-scale)) !important;
  font-size: calc(17px * var(--responsive-scale)) !important;
}

/* =========================================================
   Карта
   ========================================================= */

.map-viewport {
  inset: 0 !important;
}

.map-points,
.leaflet-container {
  width: 100% !important;
  height: 100% !important;
}

/* =========================================================
   Компактное нижнее меню
   ========================================================= */

.bottom-nav {
  position: absolute !important;
  right: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  z-index: 1100 !important;

  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;

  min-height:
    calc(
      var(--responsive-bottom-nav-height)
      + env(safe-area-inset-bottom)
    ) !important;

  padding:
    calc(5px * var(--responsive-scale))
    calc(7px * var(--responsive-scale))
    max(
      calc(5px * var(--responsive-scale)),
      env(safe-area-inset-bottom)
    ) !important;

  border-radius:
    calc(24px * var(--responsive-scale))
    calc(24px * var(--responsive-scale))
    0
    0 !important;

  background: rgb(255 255 255 / 96%) !important;
  box-shadow: 0 -10px 30px rgb(7 44 41 / 10%) !important;
  backdrop-filter: blur(18px) !important;
  -webkit-backdrop-filter: blur(18px) !important;
}

.bottom-nav button,
.bottom-nav a {
  min-width: 0 !important;
  min-height: calc(58px * var(--responsive-scale)) !important;
  padding:
    calc(5px * var(--responsive-scale))
    calc(3px * var(--responsive-scale)) !important;
  border-radius: calc(20px * var(--responsive-scale)) !important;
}

.bottom-nav .app-icon,
.bottom-nav svg {
  width: calc(22px * var(--responsive-scale)) !important;
  height: calc(22px * var(--responsive-scale)) !important;
}

.bottom-nav span {
  font-size: calc(11px * var(--responsive-scale)) !important;
  line-height: 1.05 !important;
}

/* =========================================================
   Поп-ап дома
   ========================================================= */

.house-popup .leaflet-popup-content-wrapper {
  overflow: hidden !important;
  border-radius: calc(22px * var(--responsive-scale)) !important;
  background: transparent !important;
}

.house-popup .leaflet-popup-content {
  width:
    min(
      calc(356px * var(--responsive-scale)),
      calc(100vw - 24px)
    ) !important;

  max-height: var(--responsive-popup-max-height) !important;
  margin: 0 !important;
  overflow: hidden !important;
}

.house-popup-card {
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr) auto !important;

  width: 100% !important;
  max-height: var(--responsive-popup-max-height) !important;
  min-height: 0 !important;

  gap: calc(5px * var(--responsive-scale)) !important;

  padding:
    calc(8px * var(--responsive-scale)) !important;

  overflow: hidden !important;
  border-radius: calc(22px * var(--responsive-scale)) !important;
}

/* Заголовок поп-апа */
.house-popup-chrome {
  grid-row: 1 !important;
  min-height: calc(34px * var(--responsive-scale)) !important;
  padding:
    0
    0
    calc(2px * var(--responsive-scale))
    calc(3px * var(--responsive-scale)) !important;
}

.house-popup-close {
  width: calc(36px * var(--responsive-scale)) !important;
  min-width: calc(36px * var(--responsive-scale)) !important;
  height: calc(36px * var(--responsive-scale)) !important;
  min-height: calc(36px * var(--responsive-scale)) !important;
  font-size: calc(20px * var(--responsive-scale)) !important;
}

/* Прокручивается только содержимое */
.house-popup-scroll {
  grid-row: 2 !important;

  min-width: 0 !important;
  min-height: 0 !important;
  max-height: none !important;

  gap: calc(5px * var(--responsive-scale)) !important;
  padding-right: calc(3px * var(--responsive-scale)) !important;

  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
  -webkit-overflow-scrolling: touch !important;
}

.house-popup-section {
  gap: calc(4px * var(--responsive-scale)) !important;

  padding:
    calc(6px * var(--responsive-scale)) !important;

  border-radius: calc(14px * var(--responsive-scale)) !important;
}

.house-popup-address {
  gap: calc(2px * var(--responsive-scale)) !important;
}

.house-popup-address strong {
  font-size: calc(15px * var(--responsive-scale)) !important;
  line-height: 1.1 !important;
}

.house-popup-address span,
.house-popup-note,
.house-popup-muted {
  font-size: calc(11px * var(--responsive-scale)) !important;
  line-height: 1.24 !important;
}

.house-popup-title,
.house-popup-kicker {
  font-size: calc(10px * var(--responsive-scale)) !important;
}

.house-popup-status {
  gap: calc(4px * var(--responsive-scale)) !important;
  padding:
    calc(4px * var(--responsive-scale))
    calc(7px * var(--responsive-scale)) !important;
  font-size: calc(10.5px * var(--responsive-scale)) !important;
}

.house-popup-note {
  padding:
    calc(6px * var(--responsive-scale))
    calc(7px * var(--responsive-scale)) !important;
}

.house-popup-votes {
  gap: calc(4px * var(--responsive-scale)) !important;
}

.house-popup-votes div {
  padding:
    calc(5px * var(--responsive-scale))
    calc(6px * var(--responsive-scale)) !important;
  font-size: calc(10px * var(--responsive-scale)) !important;
}

.house-popup-votes strong {
  font-size: calc(13px * var(--responsive-scale)) !important;
}

/* Кнопки всегда остаются внизу и всегда видны */
.house-popup-sticky-actions,
.house-popup-footer {
  position: relative !important;
  grid-row: 3 !important;
  bottom: auto !important;
  z-index: 20 !important;

  display: grid !important;
  gap: calc(4px * var(--responsive-scale)) !important;

  width: 100% !important;
  min-width: 0 !important;
  min-height: max-content !important;

  margin: 0 !important;
  padding:
    calc(6px * var(--responsive-scale))
    0
    0 !important;

  overflow: visible !important;

  border-top: 1px solid rgb(17 43 41 / 5%) !important;
  border-radius: 0 !important;

  background: rgb(249 252 251 / 98%) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.house-popup-sticky-actions .house-popup-actions,
.house-popup-sticky-actions .house-popup-secondary-actions,
.house-popup-footer .house-popup-actions,
.house-popup-footer .house-popup-secondary-actions {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: calc(4px * var(--responsive-scale)) !important;

  width: 100% !important;
  min-width: 0 !important;
}

.house-popup-sticky-actions button,
.house-popup-footer button,
.house-popup-action,
.house-popup-secondary-action,
.house-popup-history-action,
.house-popup-favorite-action {
  min-width: 0 !important;
  min-height: calc(38px * var(--responsive-scale)) !important;
  height: calc(38px * var(--responsive-scale)) !important;

  padding:
    0
    calc(5px * var(--responsive-scale)) !important;

  overflow: hidden !important;

  border-radius: calc(12px * var(--responsive-scale)) !important;

  font-size: calc(11.5px * var(--responsive-scale)) !important;
  line-height: 1.05 !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

/* =========================================================
   Избранное и история
   ========================================================= */

.favorites-panel,
.history-panel {
  right: var(--responsive-side-gap) !important;
  bottom:
    calc(
      var(--responsive-bottom-nav-height)
      + env(safe-area-inset-bottom)
      + 8px
    ) !important;
  left: var(--responsive-side-gap) !important;

  width: auto !important;
  max-width: none !important;
  max-height:
    calc(
      100dvh
      - var(--responsive-bottom-nav-height)
      - env(safe-area-inset-bottom)
      - 190px
    ) !important;
}

/* =========================================================
   Статистика остаётся внутри ширины приложения
   ========================================================= */

.statistics-screen {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  height: 100% !important;
}

/* =========================================================
   Маленькие и низкие телефоны — iPhone SE и аналоги
   ========================================================= */

@media (max-width: 390px), (max-height: 720px) {
  :root {
    --responsive-side-gap: 6px;
  }

  .house-popup .leaflet-popup-content {
    width: calc(100vw - 16px) !important;
  }

  .house-popup-card {
    gap: 3px !important;
    padding: 6px !important;
  }

  .house-popup-section {
    gap: 3px !important;
    padding: 5px !important;
  }

  .house-popup-address strong {
    font-size: calc(14px * var(--responsive-scale)) !important;
  }

  .house-popup-address span,
  .house-popup-note,
  .house-popup-muted {
    font-size: calc(10.5px * var(--responsive-scale)) !important;
  }

  .house-popup-sticky-actions,
  .house-popup-footer {
    padding-top: 4px !important;
  }
}

/* На настоящем мобильном устройстве приложение занимает всю ширину */
@media (max-width: 520px) {
  .screen {
    width: 100% !important;
    max-width: none !important;
  }
}


/* =========================================================
   Final tuning for short phone screens
   iPhone SE, Galaxy S8 and similar devices
   ========================================================= */

@media (max-width: 520px) and (max-height: 780px) {
  .house-popup .leaflet-popup-content,
  .house-popup-card {
    max-height: min(
      410px,
      calc(
        100dvh
        - var(--responsive-header-height, 182px)
        - var(--responsive-bottom-nav-height, 70px)
        - 18px
      )
    ) !important;
  }

  .house-popup-card {
    grid-template-rows: auto minmax(0, 1fr) auto !important;
  }

  .house-popup-scroll {
    min-height: 0 !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .house-popup-sticky-actions,
  .house-popup-footer {
    position: relative !important;
    bottom: auto !important;
    flex: 0 0 auto !important;
    padding-top: 4px !important;
    padding-bottom: 2px !important;
  }

  .house-popup-sticky-actions button,
  .house-popup-footer button {
    min-height: 34px !important;
    height: 34px !important;
    font-size: 10.5px !important;
  }

  .house-popup-section {
    padding: 5px !important;
  }

  .house-popup-note {
    padding: 5px 7px !important;
  }
}

@media (max-width: 380px) and (max-height: 700px) {
  .house-popup .leaflet-popup-content,
  .house-popup-card {
    max-height: min(
      365px,
      calc(
        100dvh
        - var(--responsive-header-height, 178px)
        - var(--responsive-bottom-nav-height, 66px)
        - 14px
      )
    ) !important;
  }

  .house-popup-card {
    gap: 3px !important;
    padding: 5px !important;
  }

  .house-popup-chrome {
    min-height: 28px !important;
  }

  .house-popup-close {
    width: 30px !important;
    min-height: 30px !important;
    height: 30px !important;
  }

  .house-popup-section {
    gap: 2px !important;
    padding: 4px !important;
  }

  .house-popup-address strong {
    font-size: 12.5px !important;
  }

  .house-popup-address span,
  .house-popup-note,
  .house-popup-muted {
    font-size: 9.5px !important;
  }

  .house-popup-sticky-actions button,
  .house-popup-footer button {
    min-height: 31px !important;
    height: 31px !important;
    font-size: 9.5px !important;
  }
}


/* =========================================================
   Final fullscreen layers and popup visual restoration
   ========================================================= */

/*
 * Верхняя панель карты и нижняя навигация имеют z-index 1000/1100.
 * Полноэкранные разделы обязаны располагаться выше них.
 */

.statistics-screen {
  position: absolute !important;
  inset: 0 !important;
  z-index: 5000 !important;

  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  min-height: 0 !important;

  overflow: hidden !important;

  background:
    linear-gradient(
      180deg,
      #f7fbfa 0%,
      #eef6f4 100%
    ) !important;

  isolation: isolate;
}

.statistics-screen-header {
  position: relative !important;
  z-index: 2 !important;

  background: #ffffff !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.statistics-screen-body {
  position: relative !important;
  z-index: 1 !important;

  min-width: 0 !important;
  min-height: 0 !important;

  background:
    linear-gradient(
      180deg,
      #f7fbfa 0%,
      #eef6f4 100%
    ) !important;
}

/* История внутри статистики выше основного экрана статистики */
.statistics-history-panel {
  position: absolute !important;
  inset: 0 !important;
  z-index: 5050 !important;

  width: 100% !important;
  height: 100% !important;

  background: #f4faf8 !important;
}

/* Затемнение для меню */
.app-menu-backdrop {
  position: absolute !important;
  inset: 0 !important;
  z-index: 5090 !important;

  background: rgb(8 24 23 / 34%) !important;
}

/* Само меню — самый верхний слой */
.app-menu-fullscreen {
  position: absolute !important;
  inset: 0 !important;
  z-index: 5100 !important;

  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  max-height: none !important;

  overflow: hidden !important;

  border: 0 !important;
  border-radius: 0 !important;

  background:
    linear-gradient(
      180deg,
      #f9fcfb 0%,
      #edf6f4 100%
    ) !important;

  box-shadow: none !important;
  isolation: isolate;
}

.app-menu-fullscreen .app-menu-view {
  width: 100% !important;
  height: 100% !important;
  min-height: 100% !important;

  background:
    linear-gradient(
      180deg,
      #f9fcfb 0%,
      #edf6f4 100%
    ) !important;
}

/*
 * Возвращаем поп-апу выразительную прямоугольную карточку,
 * сохраняя правильную структуру:
 * шапка / прокручиваемое содержимое / постоянные кнопки.
 */

.house-popup .leaflet-popup-content-wrapper {
  overflow: hidden !important;

  border: 1px solid rgb(17 43 41 / 8%) !important;
  border-radius: 20px !important;

  background: transparent !important;

  box-shadow:
    0 18px 48px rgb(7 44 41 / 18%),
    0 2px 8px rgb(7 44 41 / 8%) !important;
}

.house-popup .leaflet-popup-content {
  width: min(340px, calc(100vw - 28px)) !important;
}

.house-popup-card {
  gap: 7px !important;
  padding: 10px !important;

  border: 0 !important;
  border-radius: 20px !important;

  background:
    linear-gradient(
      180deg,
      rgb(255 255 255 / 99%) 0%,
      rgb(248 252 251 / 99%) 100%
    ) !important;

  box-shadow:
    inset 0 0 0 1px rgb(17 43 41 / 5%) !important;
}

.house-popup-chrome {
  min-height: 36px !important;
  padding: 1px 2px 2px 5px !important;
}

.house-popup-chrome > span {
  color: #647370 !important;
  font-size: 11px !important;
  font-weight: 760 !important;
}

.house-popup-close {
  width: 36px !important;
  min-width: 36px !important;
  height: 36px !important;
  min-height: 36px !important;

  border-radius: 999px !important;
  background: rgb(17 43 41 / 6%) !important;
}

.house-popup-scroll {
  gap: 7px !important;
  padding-right: 3px !important;
}

.house-popup-section {
  gap: 5px !important;
  padding: 8px !important;

  border-radius: 15px !important;

  background:
    linear-gradient(
      180deg,
      rgb(247 250 249 / 92%),
      rgb(242 247 245 / 86%)
    ) !important;

  box-shadow:
    inset 0 0 0 1px rgb(17 43 41 / 5%) !important;
}

.house-popup-header {
  background:
    linear-gradient(
      180deg,
      rgb(250 253 252 / 96%),
      rgb(245 249 248 / 92%)
    ) !important;
}

.house-popup-address strong {
  font-size: 15px !important;
  line-height: 1.12 !important;
}

.house-popup-address span,
.house-popup-note,
.house-popup-muted {
  font-size: 11px !important;
  line-height: 1.28 !important;
}

.house-popup-community-signal {
  border-radius: 13px !important;
  background: rgb(255 255 255 / 76%) !important;
  box-shadow:
    inset 0 0 0 1px rgb(17 43 41 / 5%) !important;
}

.house-popup-note {
  border-radius: 12px !important;
  background: rgb(255 255 255 / 72%) !important;
}

.house-popup-sticky-actions,
.house-popup-footer {
  gap: 5px !important;

  padding: 7px 0 1px !important;

  border-top: 1px solid rgb(17 43 41 / 7%) !important;

  background:
    linear-gradient(
      180deg,
      rgb(249 252 251 / 82%),
      #f9fcfb 24%
    ) !important;
}

.house-popup-sticky-actions button,
.house-popup-footer button {
  min-height: 38px !important;
  height: 38px !important;

  border-radius: 12px !important;

  font-size: 11.5px !important;
  font-weight: 720 !important;
}

/* Низкие телефоны: уменьшаем карточку, но не превращаем её в микротекст */
@media (max-width: 390px) and (max-height: 720px) {
  .house-popup .leaflet-popup-content {
    width: calc(100vw - 22px) !important;
  }

  .house-popup-card {
    gap: 5px !important;
    padding: 7px !important;
    border-radius: 18px !important;
  }

  .house-popup .leaflet-popup-content-wrapper {
    border-radius: 18px !important;
  }

  .house-popup-chrome {
    min-height: 30px !important;
  }

  .house-popup-close {
    width: 31px !important;
    min-width: 31px !important;
    height: 31px !important;
    min-height: 31px !important;
  }

  .house-popup-scroll {
    gap: 5px !important;
  }

  .house-popup-section {
    gap: 3px !important;
    padding: 5px !important;
    border-radius: 12px !important;
  }

  .house-popup-address strong {
    font-size: 13px !important;
  }

  .house-popup-address span,
  .house-popup-note,
  .house-popup-muted {
    font-size: 9.8px !important;
  }

  .house-popup-sticky-actions,
  .house-popup-footer {
    gap: 4px !important;
    padding-top: 5px !important;
  }

  .house-popup-sticky-actions button,
  .house-popup-footer button {
    min-height: 32px !important;
    height: 32px !important;

    border-radius: 10px !important;

    font-size: 10px !important;
  }
}



/* =========================================================
   Popup proportion refinement
   Более узкая и визуально вытянутая карточка
   ========================================================= */

/*
 * Не растягиваем окно почти на всю ширину телефона.
 * Карточка должна выглядеть отдельным компактным объектом.
 */

.house-popup .leaflet-popup-content {
  width: min(310px, calc(100vw - 48px)) !important;
}

.house-popup .leaflet-popup-content-wrapper {
  border-radius: 22px !important;

  box-shadow:
    0 20px 52px rgb(7 44 41 / 21%),
    0 4px 12px rgb(7 44 41 / 8%) !important;
}

.house-popup-card {
  gap: 8px !important;
  padding: 11px !important;
  border-radius: 22px !important;
}

.house-popup-chrome {
  min-height: 38px !important;
  padding: 1px 2px 3px 5px !important;
}

.house-popup-scroll {
  gap: 8px !important;
  padding-right: 4px !important;
}

.house-popup-section {
  gap: 6px !important;
  padding: 9px !important;
  border-radius: 16px !important;
}

.house-popup-address {
  gap: 3px !important;
}

.house-popup-address strong {
  font-size: 15px !important;
  line-height: 1.15 !important;
}

.house-popup-address span {
  font-size: 11px !important;
  line-height: 1.3 !important;
}

.house-popup-community-signal {
  padding: 10px !important;
  border-radius: 14px !important;
}

.house-popup-community-signal strong {
  line-height: 1.22 !important;
}

.house-popup-community-signal span {
  margin-top: 3px !important;
  line-height: 1.3 !important;
}

.house-popup-votes {
  gap: 6px !important;
}

.house-popup-votes div {
  min-height: 35px !important;
  padding: 7px 9px !important;
}

.house-popup-note {
  min-height: 34px !important;
  padding: 7px 9px !important;
  border-radius: 13px !important;
}

.house-popup-sticky-actions,
.house-popup-footer {
  gap: 6px !important;
  padding-top: 8px !important;
}

.house-popup-sticky-actions .house-popup-actions,
.house-popup-sticky-actions .house-popup-secondary-actions,
.house-popup-footer .house-popup-actions,
.house-popup-footer .house-popup-secondary-actions {
  gap: 6px !important;
}

.house-popup-sticky-actions button,
.house-popup-footer button {
  height: 39px !important;
  min-height: 39px !important;
  border-radius: 13px !important;
  font-size: 11px !important;
}

/*
 * Узкие телефоны:
 * iPhone SE, Galaxy S8 и похожие.
 */
@media (max-width: 390px) {
  .house-popup .leaflet-popup-content {
    width: min(296px, calc(100vw - 50px)) !important;
  }

  .house-popup-card {
    gap: 6px !important;
    padding: 8px !important;
    border-radius: 19px !important;
  }

  .house-popup .leaflet-popup-content-wrapper {
    border-radius: 19px !important;
  }

  .house-popup-chrome {
    min-height: 32px !important;
    padding-bottom: 2px !important;
  }

  .house-popup-close {
    width: 32px !important;
    min-width: 32px !important;
    height: 32px !important;
    min-height: 32px !important;
  }

  .house-popup-scroll {
    gap: 6px !important;
    padding-right: 3px !important;
  }

  .house-popup-section {
    gap: 4px !important;
    padding: 6px !important;
    border-radius: 13px !important;
  }

  .house-popup-address strong {
    font-size: 13px !important;
  }

  .house-popup-address span,
  .house-popup-note,
  .house-popup-muted {
    font-size: 9.8px !important;
  }

  .house-popup-community-signal {
    padding: 7px !important;
  }

  .house-popup-votes div {
    min-height: 30px !important;
    padding: 5px 7px !important;
  }

  .house-popup-note {
    min-height: 29px !important;
    padding: 5px 7px !important;
  }

  .house-popup-sticky-actions,
  .house-popup-footer {
    gap: 4px !important;
    padding-top: 6px !important;
  }

  .house-popup-sticky-actions .house-popup-actions,
  .house-popup-sticky-actions .house-popup-secondary-actions,
  .house-popup-footer .house-popup-actions,
  .house-popup-footer .house-popup-secondary-actions {
    gap: 4px !important;
  }

  .house-popup-sticky-actions button,
  .house-popup-footer button {
    height: 33px !important;
    min-height: 33px !important;
    border-radius: 11px !important;
    font-size: 9.8px !important;
  }
}

/*
 * Очень узкие экраны.
 */
@media (max-width: 350px) {
  .house-popup .leaflet-popup-content {
    width: min(284px, calc(100vw - 42px)) !important;
  }
}



/* =========================================================
   Adaptive popup height v2
   Единый дизайн, высота зависит от реального экрана
   ========================================================= */

/*
 * Высота задаётся JavaScript через:
 * --responsive-popup-max-height
 *
 * Эти правила намеренно расположены в самом конце файла,
 * чтобы перекрыть старые фиксированные ограничения.
 */
.house-popup .leaflet-popup-content,
.house-popup-card {
  max-height: var(--responsive-popup-max-height) !important;
}

/*
 * В карточке всегда три независимые области:
 * 1. заголовок;
 * 2. прокручиваемые сведения;
 * 3. постоянные кнопки.
 */
.house-popup-card {
  display: grid !important;
  grid-template-rows:
    auto
    minmax(0, 1fr)
    auto !important;

  min-height: 0 !important;
  overflow: hidden !important;
}

.house-popup-scroll {
  min-height: 0 !important;
  max-height: none !important;

  overflow-x: hidden !important;
  overflow-y: auto !important;

  overscroll-behavior: contain !important;
  -webkit-overflow-scrolling: touch !important;
}

/*
 * Кнопки никогда не прокручиваются вместе с информацией.
 */
.house-popup-sticky-actions,
.house-popup-footer {
  position: relative !important;
  grid-row: 3 !important;
  bottom: auto !important;

  flex: 0 0 auto !important;
  overflow: visible !important;
}

/*
 * Более аккуратная полоса прокрутки.
 * На большинстве обычных карточек высокого телефона
 * она вообще не появится.
 */
.house-popup-scroll {
  scrollbar-width: thin;
  scrollbar-color:
    rgb(0 107 104 / 24%)
    transparent;
}

.house-popup-scroll::-webkit-scrollbar {
  width: 4px;
}

.house-popup-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.house-popup-scroll::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgb(0 107 104 / 22%);
}

/*
 * Высокие телефоны:
 * немного больше воздуха, поскольку места достаточно.
 */
@media (max-width: 520px) and (min-height: 850px) {
  .house-popup-card {
    gap: 8px !important;
    padding: 10px !important;
  }

  .house-popup-scroll {
    gap: 7px !important;
  }

  .house-popup-section {
    gap: 5px !important;
    padding: 8px !important;
  }

  .house-popup-sticky-actions,
  .house-popup-footer {
    padding-top: 7px !important;
  }

  .house-popup-sticky-actions button,
  .house-popup-footer button {
    min-height: 37px !important;
    height: 37px !important;
  }
}

/*
 * Средние телефоны:
 * iPhone XR, Galaxy S20 и близкие размеры.
 */
@media
  (max-width: 520px)
  and (min-height: 721px)
  and (max-height: 849px) {

  .house-popup-card {
    gap: 6px !important;
    padding: 8px !important;
  }

  .house-popup-scroll {
    gap: 6px !important;
  }

  .house-popup-section {
    gap: 4px !important;
    padding: 7px !important;
  }

  .house-popup-sticky-actions,
  .house-popup-footer {
    padding-top: 6px !important;
  }

  .house-popup-sticky-actions button,
  .house-popup-footer button {
    min-height: 35px !important;
    height: 35px !important;
  }
}

/*
 * Низкие телефоны:
 * iPhone SE и близкие устройства.
 *
 * Не меняем сам дизайн — только немного уплотняем вертикальные
 * расстояния, чтобы сохранить правильные пропорции.
 */
@media (max-width: 520px) and (max-height: 720px) {
  .house-popup-card {
    gap: 4px !important;
    padding: 6px !important;
  }

  .house-popup-chrome {
    min-height: 29px !important;
    padding-bottom: 1px !important;
  }

  .house-popup-close {
    width: 30px !important;
    min-width: 30px !important;
    height: 30px !important;
    min-height: 30px !important;
  }

  .house-popup-scroll {
    gap: 4px !important;
    padding-right: 2px !important;
  }

  .house-popup-section {
    gap: 3px !important;
    padding: 5px !important;
  }

  .house-popup-community-signal {
    padding: 6px !important;
  }

  .house-popup-note {
    min-height: 27px !important;
    padding: 4px 6px !important;
  }

  .house-popup-votes div {
    min-height: 28px !important;
    padding: 4px 6px !important;
  }

  .house-popup-sticky-actions,
  .house-popup-footer {
    gap: 3px !important;
    padding-top: 4px !important;
  }

  .house-popup-sticky-actions .house-popup-actions,
  .house-popup-sticky-actions .house-popup-secondary-actions,
  .house-popup-footer .house-popup-actions,
  .house-popup-footer .house-popup-secondary-actions {
    gap: 4px !important;
  }

  .house-popup-sticky-actions button,
  .house-popup-footer button {
    min-height: 31px !important;
    height: 31px !important;
    font-size: 9.8px !important;
  }

  .house-popup-limit-note {
    margin-top: 0 !important;
    font-size: 9px !important;
    line-height: 1.2 !important;
  }
}



/* =========================================================
   FINAL UNIFORM HOUSE POPUP
   Один визуальный дизайн для всех мобильных устройств
   Меняется только доступная высота прокручиваемой области
   ========================================================= */

/*
 * Одинаковая ширина на SE, XR, Pro Max и Android.
 * На экранах уже 372 px остаются безопасные боковые поля.
 */
.house-popup .leaflet-popup-content {
  width: min(340px, calc(100vw - 24px)) !important;
  max-height: var(--responsive-popup-max-height) !important;
  margin: 0 !important;
  overflow: hidden !important;
}

.house-popup .leaflet-popup-content-wrapper {
  overflow: hidden !important;
  border: 0 !important;
  border-radius: 24px !important;
  background: transparent !important;
  box-shadow:
    0 18px 48px rgb(7 44 41 / 18%),
    0 0 0 1px rgb(17 43 41 / 7%) !important;
}

/*
 * Одинаковая структура на каждом устройстве:
 * шапка / прокручиваемое содержание / постоянные кнопки.
 */
.house-popup-card {
  display: grid !important;
  grid-template-rows: 38px minmax(0, 1fr) auto !important;

  width: 100% !important;
  max-height: var(--responsive-popup-max-height) !important;
  min-height: 0 !important;

  gap: 6px !important;
  padding: 9px !important;

  overflow: hidden !important;
  border: 0 !important;
  border-radius: 24px !important;

  background:
    linear-gradient(
      180deg,
      rgb(255 255 255 / 99%),
      rgb(248 252 251 / 98%)
    ) !important;

  box-shadow: none !important;
}

/* Заголовок поп-апа — одинаковый везде */
.house-popup-chrome {
  grid-row: 1 !important;

  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;

  min-height: 38px !important;
  height: 38px !important;
  padding: 0 1px 0 5px !important;

  color: var(--muted) !important;
  font-size: 12px !important;
  font-weight: 760 !important;
}

.house-popup-close {
  width: 38px !important;
  min-width: 38px !important;
  height: 38px !important;
  min-height: 38px !important;

  border-radius: 999px !important;

  background: rgb(17 43 41 / 6%) !important;
  color: var(--text) !important;

  font-size: 22px !important;
  line-height: 1 !important;
}

/* Только этот блок может прокручиваться */
.house-popup-scroll {
  grid-row: 2 !important;

  display: grid !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-height: none !important;

  gap: 6px !important;
  padding: 0 4px 0 0 !important;

  overflow-x: hidden !important;
  overflow-y: auto !important;

  overscroll-behavior: contain !important;
  -webkit-overflow-scrolling: touch !important;

  scrollbar-width: thin !important;
  scrollbar-color: rgb(0 107 104 / 26%) transparent !important;
}

.house-popup-scroll::-webkit-scrollbar {
  width: 4px !important;
}

.house-popup-scroll::-webkit-scrollbar-track {
  background: transparent !important;
}

.house-popup-scroll::-webkit-scrollbar-thumb {
  border-radius: 999px !important;
  background: rgb(0 107 104 / 24%) !important;
}

/* Одинаковые карточки содержимого */
.house-popup-section {
  display: grid !important;
  gap: 4px !important;

  padding: 7px !important;
  border-radius: 15px !important;

  background: rgb(244 248 247 / 68%) !important;
  box-shadow:
    inset 0 0 0 1px rgb(17 43 41 / 5%) !important;
}

.house-popup-header {
  padding: 7px !important;
  background: rgb(244 248 247 / 68%) !important;
  box-shadow:
    inset 0 0 0 1px rgb(17 43 41 / 5%) !important;
}

.house-popup-kicker,
.house-popup-title {
  font-size: 10px !important;
  font-weight: 720 !important;
  line-height: 1.15 !important;
}

.house-popup-address {
  gap: 2px !important;
}

.house-popup-address strong {
  font-size: 15px !important;
  font-weight: 760 !important;
  line-height: 1.12 !important;
}

.house-popup-address span,
.house-popup-muted {
  font-size: 11px !important;
  line-height: 1.25 !important;
}

.house-popup-status {
  gap: 5px !important;
  padding: 4px 7px !important;
  font-size: 10px !important;
  line-height: 1.1 !important;
}

.house-popup-community-signal {
  padding: 7px !important;
  border-radius: 13px !important;
}

.house-popup-community-signal strong {
  font-size: 13px !important;
  line-height: 1.2 !important;
}

.house-popup-community-signal span {
  font-size: 11px !important;
  line-height: 1.25 !important;
}

.house-popup-votes {
  gap: 5px !important;
}

.house-popup-votes div {
  min-height: 31px !important;
  padding: 5px 7px !important;
  border-radius: 12px !important;
  font-size: 10px !important;
}

.house-popup-votes strong {
  font-size: 13px !important;
}

.house-popup-note {
  min-height: 30px !important;
  padding: 6px 7px !important;
  border-radius: 12px !important;

  font-size: 10.5px !important;
  line-height: 1.25 !important;
}

/* Нижние кнопки — абсолютно одинаковые на всех устройствах */
.house-popup-sticky-actions,
.house-popup-footer {
  position: relative !important;
  grid-row: 3 !important;
  bottom: auto !important;
  z-index: 20 !important;

  display: grid !important;
  gap: 5px !important;

  width: 100% !important;
  min-width: 0 !important;
  min-height: auto !important;

  margin: 0 !important;
  padding: 6px 0 0 !important;

  overflow: visible !important;

  border-top: 1px solid rgb(17 43 41 / 5%) !important;
  border-radius: 0 !important;

  background: rgb(249 252 251 / 100%) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.house-popup-sticky-actions .house-popup-actions,
.house-popup-sticky-actions .house-popup-secondary-actions,
.house-popup-footer .house-popup-actions,
.house-popup-footer .house-popup-secondary-actions {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 5px !important;

  width: 100% !important;
  min-width: 0 !important;
}

.house-popup-sticky-actions button,
.house-popup-footer button,
.house-popup-action,
.house-popup-secondary-action,
.house-popup-history-action,
.house-popup-favorite-action {
  width: 100% !important;
  min-width: 0 !important;

  min-height: 36px !important;
  height: 36px !important;

  padding: 0 7px !important;
  border-radius: 12px !important;

  font-size: 11px !important;
  font-weight: 700 !important;
  line-height: 1.1 !important;
  white-space: nowrap !important;
}

.house-popup-limit-note {
  margin: 0 !important;
  padding: 0 4px !important;

  color: var(--muted) !important;
  font-size: 9.5px !important;
  line-height: 1.2 !important;
  text-align: center !important;
}

/*
 * ВАЖНО:
 * Для разных экранов больше не меняются ширина, шрифты,
 * радиусы, кнопки или внутренние отступы.
 * Меняется исключительно максимальная высота окна.
 */
@media (max-width: 520px) and (max-height: 700px) {
  .house-popup .leaflet-popup-content,
  .house-popup-card {
    max-height: min(
      var(--responsive-popup-max-height),
      360px
    ) !important;
  }
}

@media
  (max-width: 520px)
  and (min-height: 701px)
  and (max-height: 820px) {

  .house-popup .leaflet-popup-content,
  .house-popup-card {
    max-height: min(
      var(--responsive-popup-max-height),
      410px
    ) !important;
  }
}

@media
  (max-width: 520px)
  and (min-height: 821px)
  and (max-height: 910px) {

  .house-popup .leaflet-popup-content,
  .house-popup-card {
    max-height: min(
      var(--responsive-popup-max-height),
      470px
    ) !important;
  }
}

@media (max-width: 520px) and (min-height: 911px) {
  .house-popup .leaflet-popup-content,
  .house-popup-card {
    max-height: min(
      var(--responsive-popup-max-height),
      500px
    ) !important;
  }
}


