/* Карта: собственные панели и маркеры. Стили провайдера остаются нетронутыми. */
.map-page {
  --map-panel-bg: rgba(25, 44, 32, .94);
  --map-panel-border: rgba(230, 241, 218, .18);
  --map-panel-shadow: 0 10px 34px rgba(6, 17, 10, .18), inset 0 1px 0 rgba(247, 251, 234, .06);
  --map-canvas-bg: #21372d;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
[data-theme="light"] .map-page {
  --map-canvas-bg: #dce5d9;
  --map-panel-bg: rgba(251, 253, 248, .95);
  --map-panel-border: rgba(38, 66, 44, .14);
  --map-panel-shadow: 0 10px 34px rgba(32, 54, 37, .10), inset 0 1px 0 rgba(255, 255, 255, .9);
}
.map-page [hidden] { display: none !important; }
.map-toolbar { display: flex; align-items: center; gap: 10px; min-width: 0; }
.map-toolbar-search, .map-toolbar > .field { flex: 1; min-width: 180px; margin: 0; }
.map-toolbar-search { position: relative; }
.map-toolbar-search > .ui-icon { position: absolute; top: 50%; left: 14px; width: 18px; height: 18px; color: var(--text-tertiary); transform: translateY(-50%); pointer-events: none; }
.map-toolbar-search:has(> .ui-icon) input { padding-left: 42px; }
.map-toolbar .field input { min-height: 44px; border-radius: 13px; }
.map-toolbar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.map-tool-btn {
  appearance: none; display: inline-flex; justify-content: center; align-items: center; gap: 8px;
  min-width: 44px; min-height: 44px; padding: 0 14px; border: 1px solid var(--border-glass);
  border-radius: 13px; background: var(--surface-1); color: var(--text-secondary);
  font: 500 12px/1.3 var(--font-main); white-space: nowrap; cursor: pointer;
  transition: background .22s ease, color .22s ease, border-color .22s ease;
}
.map-tool-btn .ui-icon { width: 18px; height: 18px; flex-shrink: 0; }
.map-tool-btn:hover { color: var(--text-primary); background: var(--surface-2); border-color: var(--border-glass-strong); }
.map-tool-btn[aria-expanded="true"], .map-tool-btn[aria-pressed="true"], .map-tool-btn.is-active { color: var(--color-gold); border-color: var(--accent-border); background: var(--accent-soft); }
.map-tool-count, .map-filter-count { display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 6px; font-size: 10px; font-variant-numeric: tabular-nums; background: var(--control-hover); }
.map-filter-panel { padding: 20px; border: 1px solid var(--border-glass); border-radius: 18px; background: var(--surface-1); box-shadow: var(--shadow-card); animation: map-panel-enter .28s var(--ease-premium) both; }
.map-filter-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; align-items: end; }
.map-filter-grid .field { min-width: 0; }
.map-filter-grid .field label { font-size: 11px; }
.map-filter-grid .field select { width: 100%; min-width: 0; font-size: 12px; }
.map-filter-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding-top: 16px; }
.map-filter-hint { margin-right: auto; color: var(--text-tertiary); font-size: 11px; line-height: 1.5; }

.map-workspace {
  position: relative; isolation: isolate; width: 100%; min-width: 0;
  height: clamp(540px, calc(100dvh - 240px), 780px);
  overflow: hidden; border: 1px solid var(--border-glass-strong); border-radius: 22px;
  background: var(--map-canvas-bg); box-shadow: var(--shadow-card);
}
.map-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-workspace:fullscreen { width: 100%; height: 100%; border: 0; border-radius: 0; }
.map-loading {
  position: absolute; inset: 0; z-index: 25; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px; padding: 34px; text-align: center;
  background: var(--map-panel-bg); color: var(--text-primary);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.map-loading > .ui-icon, .map-loading-icon {
  display: grid; place-items: center; width: 62px; height: 62px; padding: 17px;
  border-radius: 18px; background: var(--accent-soft); color: var(--color-gold); border: 1px solid var(--accent-border);
}
.map-loading-icon .ui-icon { width: 28px; height: 28px; }
.map-loading h2, .map-loading-title, .map-loading > strong { margin: 0; max-width: 460px; font-size: 18px; font-weight: 600; letter-spacing: -.02em; }
.map-loading p, .map-loading-text, .map-loading > span:not(.map-loading-icon) { max-width: 420px; margin: 0; color: var(--text-secondary); font-size: 13px; line-height: 1.65; }
.map-loading .btn { margin-top: 4px; }
.map-loading.is-error > .ui-icon, .map-loading.is-error .map-loading-icon { color: var(--color-warm); background: color-mix(in srgb, var(--color-warm) 10%, transparent); border-color: color-mix(in srgb, var(--color-warm) 22%, transparent); }

.map-controls, .map-legend-bar, .map-results-panel, .map-selection-panel, .map-region-caption {
  border: 1px solid var(--map-panel-border); background: var(--map-panel-bg); color: var(--text-primary);
  box-shadow: var(--map-panel-shadow); -webkit-backdrop-filter: blur(22px) saturate(115%); backdrop-filter: blur(22px) saturate(115%);
}
.map-controls { position: absolute; z-index: 15; top: 18px; left: 18px; display: flex; flex-direction: column; gap: 2px; padding: 5px; border-radius: 15px; }
.map-controls button {
  appearance: none; display: grid; place-items: center; width: 36px; height: 36px; padding: 0;
  border: 0; border-radius: 10px; background: transparent; color: var(--text-secondary); cursor: pointer;
  transition: background .22s ease, color .22s ease;
}
.map-controls button .ui-icon { width: 19px; height: 19px; stroke-width: 1.6; }
.map-controls button:hover { color: var(--text-primary); background: var(--control-hover); }
.map-controls button[aria-pressed="true"] { color: var(--color-gold); background: var(--accent-soft); }
.map-controls button:disabled { opacity: .38; cursor: default; }
.map-control-divider { height: 1px; margin: 3px 7px; background: var(--divider); }
.map-legend-bar {
  position: absolute; z-index: 12; bottom: 32px; left: 18px; display: flex; flex-wrap: wrap;
  align-items: center; gap: 8px 14px; max-width: calc(100% - 36px); padding: 11px 14px;
  border-radius: 13px; pointer-events: auto;
}
.map-workspace:has(.map-results-panel:not([hidden])) .map-legend-bar { max-width: calc(100% - 356px); }
.map-legend-bar .legend-item { display: inline-flex; align-items: center; gap: 6px; color: var(--text-secondary); font-size: 10px; line-height: 1.3; white-space: nowrap; }
.map-legend-bar .legend-dot { width: 6px; height: 6px; flex-shrink: 0; border-radius: 50%; box-shadow: none; }
.map-page [data-status="in_progress"] { --map-status-color: #D6B25C; }
.map-page [data-status="done"] { --map-status-color: #78A88A; }
.map-page [data-status="delay"] { --map-status-color: #C7916B; }
.map-page [data-status="planned"] { --map-status-color: #A6B5AF; }
.map-page .legend-dot, .map-page .map-result-dot { background: var(--map-status-color, #A6B5AF); }

.map-results-panel {
  position: absolute; z-index: 18; top: 18px; right: 18px; bottom: 80px;
  width: 300px; max-width: calc(100% - 90px); display: flex; flex-direction: column;
  min-height: 0; overflow: hidden; border-radius: 18px; animation: map-panel-enter .32s var(--ease-premium) both;
}
.map-results-heading, .map-results-header { display: flex; align-items: center; gap: 10px; flex-shrink: 0; padding: 16px 16px 13px; border-bottom: 1px solid var(--divider); }
.map-results-heading h2, .map-results-header h2, .map-results-heading .card-title { flex: 1; margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -.01em; }
.map-results-count { font-size: 11px; color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
.map-results-heading > div { display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.map-results-heading #map-count { color: var(--text-tertiary); font-size: 11px; }
.map-cluster-context { flex-shrink: 0; padding: 7px 12px 10px; border-bottom: 1px solid var(--divider); }
.map-cluster-context .btn { width: 100%; justify-content: flex-start; }
.map-cluster-context p { margin: 6px 4px 0; font-size: 11px; line-height: 1.5; color: var(--text-secondary); }
.map-results-heading .icon-btn, .map-results-header .icon-btn, .map-selection-header .icon-btn { width: 28px; height: 28px; flex-shrink: 0; margin-left: auto; border-radius: 8px; }
.map-results-heading .icon-btn .ui-icon, .map-results-header .icon-btn .ui-icon, .map-selection-header .icon-btn .ui-icon { width: 15px; height: 15px; }
.map-panel-close { display: grid; place-items: center; flex-shrink: 0; width: 28px; height: 28px; padding: 0; margin-left: auto; border: 0; border-radius: 8px; color: var(--text-secondary); background: var(--control-bg); cursor: pointer; transition: background .22s ease, color .22s ease; }
.map-panel-close .ui-icon { width: 15px; height: 15px; }
.map-panel-close:hover { color: var(--text-primary); background: var(--control-hover); }
.map-page .map-results, .map-results-body { flex: 1; min-height: 0; max-height: none; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; margin: 0; padding: 7px; display: flex; flex-direction: column; gap: 3px; }
.map-page button.map-result-item {
  appearance: none; display: flex; align-items: center; gap: 10px; flex-shrink: 0;
  width: 100%; min-height: 65px; padding: 11px 9px; margin: 0; text-align: left;
  color: var(--text-primary); background: transparent; border: 1px solid transparent; border-radius: 12px;
  font-family: var(--font-main); cursor: pointer; transition: background .22s ease, border-color .22s ease;
}
.map-page button.map-result-item > div, .map-page button.map-result-item > span:not(.map-result-dot) { flex: 1; min-width: 0; }
.map-page button.map-result-item:hover { background: var(--control-hover); }
.map-page button.map-result-item.is-selected, .map-page button.map-result-item[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-border); }
.map-page .map-result-name { font-size: 12px; font-weight: 500; line-height: 1.45; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.map-page .map-result-sub { display: block; margin-top: 4px; color: var(--text-tertiary); font-size: 10px; line-height: 1.5; }
.map-page .map-result-dot { width: 7px; height: 7px; flex-shrink: 0; border-radius: 50%; box-shadow: none; }
.map-result-arrow { flex-shrink: 0; width: 14px; height: 14px; color: var(--text-tertiary); }
.map-results-footer { flex-shrink: 0; padding: 12px 16px; border-top: 1px solid var(--divider); color: var(--text-tertiary); font-size: 10px; line-height: 1.5; }
.map-results-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; gap: 10px; min-height: 160px; padding: 24px 14px; text-align: center; color: var(--text-secondary); font-size: 12px; line-height: 1.6; }

.map-selection-panel { position: absolute; z-index: 20; bottom: 82px; left: 18px; width: 340px; max-width: calc(100% - 36px); max-height: calc(100% - 104px); overflow-y: auto; padding: 20px; border-radius: 18px; animation: map-panel-enter .32s var(--ease-premium) both; }
.map-workspace:has(.map-loading.is-error) .map-results-panel { z-index: 26; }
.map-workspace:has(.map-loading.is-error) .map-selection-panel { z-index: 27; }
.map-selection-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 13px; }
.map-selection-title { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.4; letter-spacing: -.02em; overflow-wrap: anywhere; }
.map-selection-location { margin: 8px 0 18px; color: var(--text-secondary); font-size: 11px; line-height: 1.55; }
.map-selection-progress { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 8px; color: var(--text-secondary); font-size: 11px; }
.map-selection-panel > .progress-bar { margin-bottom: 18px; }
.map-selection-progress b { color: var(--text-primary); font-weight: 600; font-variant-numeric: tabular-nums; }
.map-selection-panel > .btn { width: 100%; min-height: 39px; }
.map-status-note { margin: -2px 4px 0; color: var(--text-tertiary); font-size: 11px; line-height: 1.55; }
.map-status-note.is-error { color: var(--color-warm); }
.map-region-caption { position: absolute; z-index: 17; top: 18px; left: 80px; display: flex; align-items: center; gap: 8px; width: max-content; max-width: calc(100% - 104px); min-height: 39px; padding: 8px 10px 8px 14px; border-radius: 12px; font-size: 12px; font-weight: 500; }
.map-region-caption #map-region-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-region-caption #map-region-clear { display: grid; place-items: center; flex-shrink: 0; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 7px; background: var(--control-bg); color: var(--text-secondary); cursor: pointer; }
.map-region-caption #map-region-clear:hover { color: var(--text-primary); background: var(--control-hover); }
.map-region-caption #map-region-clear .ui-icon { width: 13px; height: 13px; }
.map-region-caption #map-region-clear:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.map-workspace:has(.map-results-panel:not([hidden])) .map-region-caption { max-width: calc(100% - 416px); }
.map-boundary-credit { position: absolute; z-index: 12; left: 18px; bottom: 32px; max-width: calc(100% - 36px); padding: 3px 7px; border-radius: 5px; background: var(--map-panel-bg); color: var(--text-secondary); font-size: 9px; line-height: 1.5; }
.map-boundary-credit a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.map-boundary-note { margin: -5px 4px 0; color: var(--text-tertiary); font-size: 10px; line-height: 1.6; }
.map-boundary-note a { color: var(--text-secondary); text-decoration: underline; text-underline-offset: 2px; }
.map-workspace:has(.map-boundary-credit:not([hidden])) .map-legend-bar { bottom: 58px; }
.map-workspace:has(.map-boundary-credit:not([hidden])) .map-results-panel, .map-workspace:has(.map-boundary-credit:not([hidden])) .map-selection-panel { bottom: 106px; }

/* Тихие группы: детализация раскрывается масштабом, а не цветными кольцами. */
.kr-map-pin, .kr-map-cluster {
  appearance: none; position: relative; display: grid; place-items: center; box-sizing: border-box; margin: 0; padding: 0;
  border: 1px solid rgba(227,239,228,.38); border-radius: 50%; background: var(--pin-color, #dec98f);
  color: #20392b; font-family: var(--font-main); cursor: pointer;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 7px rgba(9,24,17,.2);
  transition: box-shadow .2s ease, background .2s ease, border-color .2s ease;
}
.kr-map-pin::after, .kr-map-cluster::after { content: ""; position: absolute; width: max(100%,44px); height: max(100%,44px); left: 50%; top: 50%; transform: translate(-50%,-50%); border-radius: inherit; }
.kr-map-pin { width: 24px; height: 24px; }
.kr-map-pin .ui-icon { width: 13px; height: 13px; }
.kr-map-pin-dot { display: block; width: 5px; height: 5px; border-radius: 50%; background: #284332; }
.kr-map-pin:hover { box-shadow: 0 0 0 3px rgba(223,232,208,.14), 0 3px 9px rgba(9,24,17,.24); }
.kr-map-pin.is-selected, .kr-map-pin[aria-pressed="true"] { border-color: #e4cd89; box-shadow: 0 0 0 3px rgba(228,205,137,.3), 0 3px 10px rgba(9,24,17,.24); }
.kr-map-cluster { width: var(--cluster-size,40px); height: var(--cluster-size,40px); padding: 0 4px; background: #294137; color: #eef3ec; border-color: rgba(203,222,208,.28); font-size: 11px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kr-map-cluster:hover { background: #365345; border-color: rgba(228,205,137,.7); box-shadow: 0 0 0 3px rgba(228,205,137,.1), 0 3px 10px rgba(9,24,17,.24); }
.kr-map-cluster-count { display: grid; place-items: center; width: 100%; height: 100%; border-radius: inherit; background: transparent; line-height: 1; }
[data-theme="light"] .kr-map-cluster { color: #294137; background: #eff4ec; border-color: rgba(44,74,54,.3); box-shadow: 0 2px 7px rgba(32,54,37,.13); }
[data-theme="light"] .kr-map-cluster:hover { background: #fff; border-color: #ac945c; }
.map-tool-btn:focus-visible, .map-controls button:focus-visible, .map-panel-close:focus-visible, .map-page button.map-result-item:focus-visible, .kr-map-pin:focus-visible, .kr-map-cluster:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; }
@keyframes map-panel-enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (max-width: 1000px) {
  .map-filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .map-results-panel { width: 280px; }
  .map-workspace:has(.map-results-panel:not([hidden])) .map-legend-bar { max-width: calc(100% - 336px); }
  .map-selection-panel { width: 310px; }
  .map-workspace:has(.map-results-panel:not([hidden])) .map-region-caption { max-width: calc(100% - 396px); }
}
@media (max-width: 720px) {
  .map-page { gap: 12px; }
  .map-toolbar { flex-wrap: wrap; gap: 8px; }
  .map-toolbar-search, .map-toolbar > .field { flex-basis: 100%; min-width: 0; }
  .map-toolbar-actions { width: 100%; gap: 8px; }
  .map-toolbar-actions .map-tool-btn { flex: 1; }
  .map-toolbar > .map-tool-btn { flex: 1; }
  .map-filter-panel { padding: 16px; border-radius: 16px; }
  .map-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 10px; }
  .map-filter-grid .field label { font-size: 10px; }
  .map-filter-grid .field select { min-height: 40px; padding-inline: 9px; font-size: 11px; }
  .map-filter-actions { flex-wrap: wrap; }
  .map-workspace { height: clamp(540px, calc(100dvh - 220px), 720px); border-radius: 18px; }
  .map-controls { top: 12px; left: 12px; padding: 4px; border-radius: 13px; }
  .map-controls button { width: 34px; height: 34px; }
  .map-legend-bar, .map-workspace:has(.map-results-panel:not([hidden])) .map-legend-bar { left: 12px; right: 12px; bottom: 31px; max-width: none; padding: 9px 11px; gap: 6px 12px; justify-content: center; border-radius: 11px; }
  .map-legend-bar .legend-item { font-size: 9px; }
  .map-results-panel { top: auto; right: 12px; left: 12px; bottom: 75px; width: auto; max-width: none; height: 55%; max-height: 55%; border-radius: 18px; }
  .map-results-heading, .map-results-header { padding: 12px 14px 10px; }
  .map-results-panel::before { content: ""; flex-shrink: 0; width: 28px; height: 3px; margin: 8px auto 0; border-radius: 2px; background: var(--border-glass-strong); }
  .map-page button.map-result-item { min-height: 62px; padding: 10px; }
  .map-selection-panel { left: 12px; right: 12px; bottom: 75px; width: auto; max-width: none; max-height: 60%; padding: 17px; }
  .map-selection-title { font-size: 15px; }
  .map-selection-location { margin-bottom: 14px; }
  .map-selection-progress { margin-bottom: 14px; }
  .map-status-note { font-size: 10px; }
  .map-region-caption, .map-workspace:has(.map-results-panel:not([hidden])) .map-region-caption { top: 12px; left: 68px; right: 12px; max-width: calc(100% - 80px); min-height: 37px; padding: 7px 9px 7px 12px; font-size: 11px; }
  .map-boundary-credit { bottom: 31px; left: 12px; max-width: calc(100% - 24px); font-size: 8px; }
  .map-workspace:has(.map-boundary-credit:not([hidden])) .map-legend-bar { bottom: 54px; }
  .map-workspace:has(.map-boundary-credit:not([hidden])) .map-results-panel, .map-workspace:has(.map-boundary-credit:not([hidden])) .map-selection-panel { bottom: 104px; }
  .map-boundary-note { font-size: 9px; }
}
@media (max-width: 380px) {
  .map-tool-btn { padding-inline: 10px; font-size: 11px; }
  .map-legend-bar, .map-workspace:has(.map-results-panel:not([hidden])) .map-legend-bar { gap: 5px 9px; padding-inline: 8px; }
  .map-legend-bar .legend-item { font-size: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .map-filter-panel, .map-results-panel, .map-selection-panel { animation: none; }
  .map-tool-btn, .map-controls button, .map-panel-close, .map-page button.map-result-item, .kr-map-pin, .kr-map-cluster { transition: none; }
}
