.coverage-map {
  background-color: #edf0eb;
  background-image: linear-gradient(#dfe5dd 1px, transparent 1px), linear-gradient(90deg, #dfe5dd 1px, transparent 1px);
  background-size: 64px 64px;
  font-family: var(--ui-font);
}
.coverage-canvas { position: absolute; pointer-events: none; }
.coverage-tile-notice {
  position: absolute; bottom: 26px; left: 12px; right: 12px; z-index: 450;
  width: fit-content; max-width: calc(100% - 24px); background: #fff;
  border: 1px solid #c8d0c8; border-radius: 6px; padding: 8px 10px;
  color: #465249; font-size: 12px; pointer-events: none;
}
.coverage-tile-notice[hidden] { display: none; }
.coverage-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.coverage-browse { display: grid; }
.coverage-browse button {
  background: #fff; border: 0; padding: 7px 10px; min-height: 36px; font: 13px var(--ui-font);
  color: #23352a; cursor: pointer; border-radius: 3px;
}
.coverage-browse button + button { border-top: 1px solid #ccd5cf; }
.coverage-browse button:hover { background: #eff4ee; }
.coverage-map button:focus-visible { outline: 3px solid #13796c; outline-offset: 2px; }
.coverage-map .leaflet-popup-content { margin: 18px; font: 13px/1.45 var(--ui-font); overflow-wrap: anywhere; }
.coverage-map .leaflet-popup-content-wrapper { border-radius: 9px; }
.coverage-map .leaflet-popup-close-button { width: 32px; height: 32px; font-size: 23px; }
.coverage-point-card h3, .coverage-group-card h3 { margin: 0 16px 10px 0; font-size: 16px; line-height: 1.35; color: #1f3027; }
.coverage-point-card p, .coverage-group-card p { margin: 7px 0; }
.coverage-point-zones { color: #5a675e; }
.coverage-point-amount { font-weight: 700; font-size: 14px; }
.coverage-zone-table { border-collapse: collapse; width: 100%; margin-top: 12px; font-size: 12px; }
.coverage-zone-table td, .coverage-zone-table th { border-top: 1px solid #e2e7e1; text-align: left; padding: 7px 6px 7px 0; vertical-align: top; }
.coverage-zone-table td:last-child, .coverage-zone-table th:last-child { text-align: right; padding-right: 0; }
.coverage-zone-table th { color: #57665b; font-weight: 500; }
.coverage-group-list { max-height: min(45vh, 300px); overflow-y: auto; overscroll-behavior: contain; }
.coverage-list-point { display: block; width: 100%; background: #fff; border: 0; border-top: 1px solid #e2e7e1; padding: 12px 2px; text-align: left; font: inherit; color: #185a81; cursor: pointer; min-height: 44px; }
.coverage-list-point:hover { background: #f0f5f0; }
.coverage-group-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 10px; }
.coverage-group-footer button { border: 1px solid #cbd5cb; background: #fff; border-radius: 5px; font: inherit; min-height: 36px; padding: 5px 10px; cursor: pointer; }
.coverage-group-footer button:disabled { opacity: .45; cursor: default; }
@media (max-width: 600px) {
  .coverage-map .leaflet-popup-content { margin: 15px; max-width: calc(100vw - 85px); }
  .coverage-map .leaflet-control-zoom a { width: 36px; height: 36px; line-height: 36px; }
  .coverage-browse button { min-height: 40px; }
  .coverage-zone-table { font-size: 11px; }
  .coverage-tile-notice { bottom: 30px; }
}
.coverage-basemap { filter: saturate(.48) contrast(.9) brightness(1.09); }
.map-legend {
  position: absolute; z-index: 410; left: 12px; bottom: 58px;
  max-width: calc(100% - 24px); padding: 10px 12px;
  border: 1px solid #ccd5cf; border-radius: 8px;
  background: #fffffff5; color: #23352a; font-size: 12px;
  box-shadow: 0 2px 8px #14282314;
}
.map-legend strong, .map-legend small { display: block; }
.map-legend small { margin-top: 6px; }
.legend-bands { display: grid; gap: 4px; margin-top: 7px; }
.legend-bands div { display: flex; align-items: center; gap: 7px; }
.legend-bands i { display: block; width: 17px; height: 12px; border: 1px solid #536b7a; }
.legend-sizes { display: flex; gap: 10px; align-items: end; margin-top: 6px; }
.legend-sizes div { display: grid; gap: 4px; justify-items: center; text-align: center; }
.legend-sizes i { border-radius: 50%; background: #3a6255; border: 1px solid white; }
.coverage-cluster-tip { max-height: 260px; overflow: auto; }
.coverage-group-tooltip { white-space: normal; width: max-content; max-width: min(320px, 60vw); }
.territory-controls { display: grid; grid-template-columns: max-content minmax(0,1fr); align-items: center; gap: 8px; }
.territory-controls + div:not(:empty) { margin-top: 10px; padding: 8px 10px; background: #eef4f6; border-radius: 6px; }
#territory-detail p, #territory-reconciliation p { margin: 4px 0; font-size: 12px; }
#territory-detail h3 { margin: 5px 0; }
.territory-parent { font-weight: 700; }
#territory-table { margin: 10px 0; max-height: 380px; overflow: auto; overscroll-behavior: contain; }
.territory-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; font-variant-numeric: tabular-nums; }
.territory-table th, .territory-table td { padding: 6px 7px; border-bottom: 1px solid #e2e7e1; text-align: right; }
.territory-table td, .territory-table thead th { white-space: nowrap; }
.territory-table th:first-child { position: sticky; left: 0; text-align: left; min-width: 112px; background: #fff; }
.territory-table thead th { position: sticky; top: 0; background: #eef3f5; z-index: 2; }
.territory-table thead th:first-child { z-index: 3; background: #eef3f5; }
.territory-table tbody tr { cursor: pointer; }
.territory-table tbody tr:hover > *, .territory-table tr[aria-current=true] > * { background: #fff0df; }
.territory-table .text-button { text-align: left; }
.boundary-source { margin-top: 10px; font-size: 12px; }
.boundary-source p { margin: 5px 0; }
#zone-scope { width: 100%; margin-bottom: 6px; }
@media (max-width: 600px) {
  .legend-sizes { gap: 6px; }
  .legend-sizes span { max-width: 8ch; overflow-wrap: anywhere; }
}

/* Интерактивные карточки, отдельные от Leaflet-подсказок. */
.coverage-hover-card {
  position:absolute; z-index:650; pointer-events:auto; width:min(365px, calc(100% - 12px));
  max-height: min(440px, calc(100% - 12px)); overflow:auto; overscroll-behavior:contain;
  box-sizing:border-box; background:#fff; border:1px solid #dededb; border-radius:12px;
  box-shadow:0 5px 24px #17212e36; padding:14px; font:13px/1.42 var(--ui-font);
  color:#20262d; overflow-wrap:anywhere;
}
.coverage-hover-card h3 {margin:0 0 8px; font-size:16px; line-height:1.3;}
.coverage-hover-card p {margin:5px 0;}
.coverage-card-actions {display:flex; flex-wrap:wrap; gap:6px; margin-top:12px;}
.coverage-card-actions button {font:700 12px var(--ui-font); color:var(--ink); background:var(--paper); border:1px solid var(--line); border-radius:6px; padding:8px 10px; min-height:34px; cursor:pointer;}
.coverage-card-actions button:first-child {background:var(--soft); border-color:#b8d3cc; color:var(--accent);}
.coverage-card-actions button:hover {background:var(--soft);}
.coverage-zone-dot {display:inline-block; width:9px; height:9px; border-radius:50%; margin-right:5px; vertical-align:baseline; flex:none;}
.coverage-point-zones span {display:inline-block; margin:0 8px 4px 0;}
.coverage-note {font-size:11px; color:#58636b;}
.coverage-table-scroll {max-height:175px; overflow:auto; overscroll-behavior:contain;}
.coverage-zone-table td:not(:first-child), .coverage-zone-table th:not(:first-child) {text-align:right; font-variant-numeric:tabular-nums;}
.coverage-zone-table td:not(:first-child) {white-space:normal;}
.coverage-map .leaflet-popup-content-wrapper {border-radius:12px;}
.coverage-map .leaflet-popup-content {max-height:min(55vh, 520px); overflow:auto; overscroll-behavior:contain;}
.district-option {display:flex; align-items:center; gap:9px; min-height:42px; margin-bottom:0; cursor:pointer;}
.legend-sizes {flex-wrap:wrap;}
.legend-sizes div {max-width:125px;}
.legend-sizes span {overflow-wrap:anywhere;}
@media(max-width:600px) {
  .map-legend {max-width:calc(100% - 24px); padding:6px;}
  .legend-sizes {flex-wrap:nowrap; gap:4px;}
  .coverage-card-actions button {min-height:40px;}
}
.coverage-hover-card {width:min(420px,calc(100% - 12px));max-height:calc(100% - 12px);overflow-wrap:normal;}
.coverage-table-scroll {max-height:none;overflow-x:auto;overflow-y:visible;}
.coverage-zone-table {table-layout:auto;}
.coverage-zone-table td:first-child {min-width:80px;overflow-wrap:anywhere;}
.coverage-zone-table td:not(:first-child),.coverage-zone-table th:not(:first-child) {white-space:nowrap;overflow-wrap:normal;word-break:normal;}
.coverage-zone-table th {font-size:11px;}
.map-legend {max-height:calc(100% - 80px);overflow:auto;overscroll-behavior:contain;}
.legend-bands {grid-template-columns:repeat(2,minmax(0,1fr));gap:3px 10px;}
.legend-bands i {flex:none;}
@media(max-width:600px){.legend-bands{grid-template-columns:1fr 1fr;font-size:10px;}.coverage-hover-card{font-size:12px;}}
@media (max-height: 459px) {
  .map-legend {
    left: auto;
    right: 52px;
    bottom: 26px;
    max-width: calc(100% - 170px);
    max-height: calc(100% - 70px);
  }
}

/* Imagery has no administrative overlay; keep thematic colors legible. */
.coverage-imagery { filter: saturate(.55) brightness(1.15); }
.coverage-reference-notice { position:absolute; z-index:450; bottom:50px; left:12px; max-width:calc(100% - 24px); padding:7px 10px; background:#fff; border:1px solid #c8d0c8; border-radius:6px; font-size:12px; pointer-events:none; }
.coverage-reference-notice[hidden] { display:none; }


.legend-territories { margin-top: 10px; border-top: 1px solid #d8dee4; padding-top: 8px; }
.legend-territories > strong { display: block; margin-bottom: 6px; }
.legend-territory-list { display: grid; gap: 4px; }
.legend-territory-list div { display: flex; align-items: center; gap: 7px; }
.legend-territory-list i { display: block; width: 17px; height: 12px; border: 1px solid #536b7a; flex: none; }

/* Sortable headers stay compact and retain their keyboard focus. */
.table-sort-button { display:inline-flex; align-items:center; justify-content:inherit; gap:3px; border:0; border-radius:3px; min-height:24px; padding:2px 0; background:transparent; color:inherit; font:inherit; white-space:nowrap; cursor:pointer; }
.table-sort-button:hover { color:#0e6055; background:#e4efeb; }
.table-sort-button:focus-visible { outline:2px solid #13796c; outline-offset:1px; }
.table-sort-arrow { font-size:10px; color:#87938d; line-height:1; }
th[aria-sort] .table-sort-button { color:#0e6055; font-weight:700; }
th[aria-sort] .table-sort-arrow { color:#0e6055; }


.territory-table th, .coverage-zone-table th { position: relative; }
.table-resize-handle { position:absolute; top:0; right:-5px; width:10px; height:100%; cursor:col-resize; touch-action:none; z-index:4; }
.table-resize-handle::after { content:''; position:absolute; top:6px; bottom:6px; left:4px; width:2px; border-radius:2px; background:#c9d5d1; opacity:0; }
th:hover > .table-resize-handle::after, th:focus-within > .table-resize-handle::after { opacity:1; }
.coverage-zone-table, .territory-table { table-layout:auto; }

/* Leaflet and vector-map controls use the same local font as the application. */
.coverage-map .leaflet-control, .coverage-map .leaflet-popup, .coverage-map .leaflet-tooltip, .coverage-map .maplibregl-ctrl {font-family:var(--ui-font);}

.population-circle-marker {border-radius:50%;background:#187a39dc;border:2px solid white;box-shadow:0 1px 4px #123d28aa;display:grid;place-items:center;cursor:pointer;}
.population-circle-label {color:white;font-weight:700;line-height:1;white-space:nowrap;text-align:center;text-shadow:0 1px 2px #123d28;}
.population-legend-sizes i {background:#187a39;}
