/* ==========================================================================
   Интерактивный подбор территории: карта + правая панель профиля.
   Базовые токены и типографика — в app.css.
   ========================================================================== */

.page-tool { background: var(--bg); }
.page-tool .site-footer { display: none; }

/* Статический баннер занимает место над картой. */
.preview-banner + .tool-main .tool-layout {
  height: calc(100dvh - var(--header-h) - 37px);
}

.tool-main { padding: 0; }

.tool-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 410px;
  height: calc(100dvh - var(--header-h));
  min-height: 560px;
  background: var(--surface);
  overflow: hidden;
}

/* ------------------------------------------------------------------ карта */
.tool-map {
  position: relative;
  min-width: 0;
  background: var(--surface-2);
  overflow: hidden;
}

#map { position: absolute; inset: 0; z-index: 1; }

/* Управление зумом ниже верхней панели, чтобы статус не перекрывал кнопки. */
.tool-map .leaflet-top.leaflet-right { top: 78px; }

.tool-topbar {
  position: absolute;
  left: 14px;
  right: 14px;
  top: 12px;
  z-index: 500;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
  flex-wrap: wrap;
}

.reference-chip,
.tool-status {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, .96);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: .78rem;
  color: var(--ink-2);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(6px);
}
.reference-chip { max-width: 100%; }
.reference-chip #reference-coords { font-variant-numeric: tabular-nums; white-space: nowrap; }
.reference-chip .link-button { font-size: .74rem; }
.reference-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e11d48;
  box-shadow: 0 0 0 3px rgba(225, 29, 72, .16);
  flex: 0 0 auto;
}
.tool-status {
  background: rgba(14, 31, 44, .9);
  border-color: transparent;
  color: #fff;
  white-space: normal;
  max-width: 430px;
}
.map-toggle {
  pointer-events: auto;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .96);
  color: var(--ink-2);
  border-radius: 999px;
  padding: 7px 12px;
  font: inherit;
  font-size: .74rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.map-toggle.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.map-toggle:hover { border-color: var(--brand); }
.tool-status.is-error { background: var(--danger); }
/* Сводка «Балл … · объектов в зоне · точность» скрыта: она дублирует карточку балла.
   Остаются только служебные сообщения (загрузка, выбор категорий, ошибки). */
.tool-status.is-ok { display: none; }

.tool-error {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 16px;
  z-index: 800;
  background: #fff4f4;
  border: 1px solid #f0c2c2;
  color: #7c1d1d;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: .82rem;
  box-shadow: var(--shadow);
}
.tool-error[hidden] { display: none; }

.tool-hint {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 450;
  background: rgba(255, 255, 255, .94);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: .76rem;
  color: var(--ink-2);
  box-shadow: var(--shadow-sm);
  pointer-events: none;
  white-space: nowrap;
}

.tool-note {
  position: absolute;
  right: 14px;
  bottom: 56px;
  z-index: 450;
  max-width: 330px;
  background: rgba(255, 251, 235, .97);
  border: 1px solid #ecd7a0;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: .76rem;
  color: #6f5000;
  box-shadow: var(--shadow-sm);
}
.tool-note[hidden] { display: none; }

/* ------------------------------------------------------------------ легенда */
.map-legend {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 500;
  width: 260px;
  max-height: 42vh;
  overflow: auto;
  background: rgba(255, 255, 255, .96);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 9px 11px;
  font-size: .76rem;
}
.map-legend[hidden] { display: none; }
.map-legend-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}
.map-legend-head strong { font-size: .78rem; }
.legend-help {
  margin: 0 0 5px;
  font-size: .64rem;
  color: var(--muted);
  line-height: 1.35;
}
.map-legend ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.map-legend li { list-style: none; }
.legend-row {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  width: 100%;
  border: 0;
  background: none;
  padding: 4px 3px;
  font: inherit;
  text-align: left;
  color: var(--ink);
  border-radius: 6px;
  cursor: pointer;
}
.legend-row:hover { background: var(--surface-2); }
.legend-row.is-active { background: var(--brand-soft); }
.legend-value {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.1;
  white-space: nowrap;
}
.legend-value b { font-size: .78rem; font-variant-numeric: tabular-nums; }
.legend-value small { font-size: .59rem; color: var(--muted); }

.legend-detail {
  margin: 0 0 8px;
  padding: 0 0 8px;
  border-bottom: 1px solid var(--line);
  font-size: .74rem;
  color: var(--ink-2);
  max-height: 280px;
  overflow: auto;
}
.legend-detail[hidden] { display: none; }
.legend-detail-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}
.legend-detail-head strong { font-size: .8rem; }
.legend-detail p { margin: 5px 0; line-height: 1.4; }
.legend-detail-status {
  color: #92400e;
  background: #fef3c7;
  border-radius: 6px;
  padding: 4px 7px;
}
.legend-detail-percent {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin: 5px 0 3px;
}
.legend-detail-percent b { font-size: 1.5rem; line-height: 1; color: var(--brand); }
.legend-detail-percent span { font-size: .7rem; color: var(--muted); }
.legend-detail-list {
  margin: 5px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 4px;
}
.legend-detail-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 3px;
}
.legend-detail-list small { color: var(--muted); white-space: nowrap; }
.legend-detail-note {
  color: var(--muted);
  font-size: .68rem;
  border-top: 1px solid var(--line);
  padding-top: 5px;
}
.map-legend.is-collapsed ul,
.map-legend.is-collapsed .legend-detail { display: none; }

/* ------------------------------------------------------------------ панель */
.profile-panel {
  overflow-y: auto;
  min-height: 0;
  height: 100%;
  overscroll-behavior: contain;
  border-left: 1px solid var(--line);
  background: var(--surface);
  padding: 18px 18px 26px;
  scrollbar-width: thin;
}

.profile-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.profile-head h1 { font-size: 1.35rem; margin-bottom: 6px; }
.city-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  gap: 8px;
  margin-top: 10px;
}
.purpose-block { margin-top: 10px; }
.purpose-options { display: flex; gap: 6px; flex-wrap: wrap; }
.purpose-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: #fff;
  color: var(--ink-2);
  font: inherit;
  font-size: .72rem;
  cursor: pointer;
}
.purpose-btn.is-active { background: #e8f5fb; border-color: var(--brand); color: var(--brand); font-weight: 650; }
.score-nearest {
  display: block;
  width: 100%;
  padding-top: 7px;
  border-top: 1px solid rgba(11, 95, 138, .14);
  font-size: .7rem;
}
.score-nearest-label { display: block; margin-bottom: 2px; color: var(--muted); }
.score-nearest strong { font-size: .74rem; color: var(--ink); font-weight: 650; }
.score-nearest small { margin-left: 4px; color: var(--muted); }
.score-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
  margin-top: 2px;
}
.score-save-status { font-size: .68rem; color: var(--muted); }
.copy-point-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid rgba(11, 95, 138, .28);
  border-radius: 8px;
  background: #fff;
  color: var(--brand);
  cursor: pointer;
  flex: 0 0 auto;
}
.copy-point-btn:hover { background: #eaf6fc; border-color: var(--brand); }
.copy-point-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.copy-point-btn .check-icon { display: none; color: #1a7f37; }
.copy-point-btn.is-copied { border-color: #1a7f37; background: #edf8f0; }
.copy-point-btn.is-copied .copy-icon { display: none; }
.copy-point-btn.is-copied .check-icon { display: block; }
.copy-point-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 7px;
  border-radius: 6px;
  background: #142b3a;
  color: #fff;
  font-size: .66rem;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease;
  z-index: 20;
}
.copy-point-btn:hover::after,
.copy-point-btn:focus-visible::after { opacity: 1; }
.city-search .field { min-width: 0; }
.search-box { position: relative; min-width: 0; }
.search-results {
  position: absolute;
  z-index: 1200;
  top: calc(100% + 3px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 35, 50, .16);
}
.search-result {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: .78rem;
  text-align: left;
  cursor: pointer;
}
.search-result:last-child { border-bottom: 0; }
.search-result:hover, .search-result:focus { background: #eef8fc; }
.search-empty { padding: 9px 10px; color: var(--muted); font-size: .76rem; }
@media (max-width: 420px) {
  .city-search { grid-template-columns: 1fr; }
}
.profile-score {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 10px 0 2px;
  padding: 10px 12px;
  border: 1px solid #cfe7f2;
  border-radius: 11px;
  background: linear-gradient(135deg, #f3fbfe 0%, #eaf6fc 100%);
  box-shadow: 0 6px 16px rgba(11, 95, 138, .10);
}
.profile-score-main { display: flex; flex-direction: column; gap: 1px; }
.profile-score-label {
  font-size: .65rem;
  font-weight: 650;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
}
.profile-score-number { display: flex; align-items: baseline; gap: 2px; line-height: 1; }
.profile-score-number strong { font-size: 2rem; line-height: 1; color: var(--brand); }
.profile-score-number small { font-size: .78rem; color: var(--muted); }
.profile-score-caption {
  max-width: 58%;
  text-align: right;
  font-size: .68rem;
  line-height: 1.35;
  color: var(--ink-2);
}
.profile-score.is-high .profile-score-number strong { color: #1a7f37; }
.profile-score.is-mid .profile-score-number strong { color: #a15c00; }
.profile-score.is-low .profile-score-number strong { color: #b42318; }
.profile-badge {
  flex: 0 0 auto;
  font-size: .7rem;
  font-weight: 650;
  color: #14602a;
  background: #e6f4ea;
  border: 1px solid #bfe3c8;
  border-radius: 999px;
  padding: 4px 9px;
  white-space: nowrap;
}
.profile-badge.is-custom {
  color: #7a5800;
  background: #fff6e0;
  border-color: #ecd7a0;
}

.panel-block {
  padding: 15px 0;
  border-top: 1px solid var(--line);
}
.panel-block:first-of-type { border-top: 0; }
.panel-block h2 {
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 9px;
}
.panel-block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.panel-hint {
  font-size: .74rem;
  color: var(--muted);
  line-height: 1.45;
  margin: 7px 0 0;
}
.panel-hint a { color: var(--brand); }

.age-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}
.age-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  padding: 8px 9px;
  text-align: left;
  font: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 1px;
  color: var(--ink);
  transition: border-color .15s ease, background .15s ease;
}
.age-btn span { font-size: .77rem; font-weight: 600; line-height: 1.2; }
.age-btn small { font-size: .68rem; color: var(--muted); }
.age-btn:hover { border-color: var(--line-strong); background: var(--surface-2); }
.age-btn.is-active {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px var(--brand);
}
.age-btn.is-active span { color: var(--brand); }

.field { display: flex; flex-direction: column; gap: 4px; font-size: .74rem; color: var(--muted); }
.field select {
  width: 100%;
  min-width: 0;
  font: inherit;
  font-size: .85rem;
  color: var(--ink);
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
}
.field select:focus { outline: 2px solid rgba(11, 95, 138, .25); border-color: var(--brand); }

.check-group { display: grid; gap: 5px; margin-bottom: 10px; }
.check-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .82rem;
  color: var(--ink-2);
  cursor: pointer;
  padding: 3px 0;
}
.check-line input { width: 15px; height: 15px; accent-color: var(--brand); flex: 0 0 auto; }

.slider-block { margin-top: 10px; }
.slider-block:first-of-type { margin-top: 0; }
.slider-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: .8rem;
  margin-bottom: 4px;
}
.slider-head output { font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }
.slider-block input[type="range"] {
  width: 100%;
  accent-color: var(--brand);
  margin: 2px 0 0;
}
.effective-note {
  font-size: .74rem;
  line-height: 1.45;
  border-radius: 8px;
  padding: 8px 10px;
  margin: 9px 0 0;
}
.effective-note {
  color: var(--brand);
  background: var(--brand-soft);
  border: 1px solid #cfe7f2;
}
.effective-note[hidden] { display: none; }

/* ------------------------------------------------------------------ потребности */
.need-groups { display: grid; gap: 4px; }
.need-group {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}
.need-group summary {
  cursor: pointer;
  padding: 8px 10px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
}
.need-group summary::-webkit-details-marker { display: none; }
.need-group summary::after {
  content: "▾";
  margin-left: auto;
  color: var(--muted);
  font-size: .7rem;
  transition: transform .15s ease;
}
.need-group[open] summary::after { transform: rotate(180deg); }
.group-dot,
.need-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--need-color, var(--group-color, var(--muted)));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--need-color, var(--group-color, #888)) 18%, transparent);
}
.need-list { padding: 2px 8px 8px; display: grid; gap: 1px; }
.need-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px;
  border-radius: 7px;
  cursor: pointer;
  font-size: .79rem;
}
.need-row:hover { background: var(--surface-2); }
.need-row input { width: 14px; height: 14px; accent-color: var(--brand); flex: 0 0 auto; }
.need-label { flex: 1 1 auto; }
.need-count {
  font-size: .69rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.need-count.is-zero { color: #b45309; }

.status-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: .62rem;
  font-weight: 600;
  vertical-align: 1px;
  white-space: nowrap;
}

/* Пометка для автомобильных категорий: радиус по прямой, без времени в пути. */
.radius-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: .62rem;
  font-weight: 600;
  vertical-align: 1px;
  white-space: nowrap;
  color: #0b5f8a;
  background: #eaf6fc;
  border: 1px solid rgba(11, 95, 138, .25);
}
.status-no_data {
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fde68a;
}
.status-sparse {
  color: #6b21a8;
  background: #f3e8ff;
  border: 1px solid #e9d5ff;
}
.category-meta {
  font-size: .69rem !important;
  color: var(--muted);
  line-height: 1.45;
}

/* ------------------------------------------------------------------ сводка */
.summary-block { background: var(--surface-2); border-radius: 10px; padding: 13px 12px; margin-top: 8px; border-top: 0; }
.need-summary { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.summary-empty { font-size: .8rem; color: var(--muted); }
.summary-total {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.summary-total strong { font-size: 1.35rem; line-height: 1; color: var(--brand); }
.summary-total span { font-size: .72rem; color: var(--muted); }
.summary-group {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  gap: 7px;
  align-items: baseline;
  padding: 3px 0;
  border-bottom: 1px dashed var(--line);
  font-size: .76rem;
}
.summary-group:last-child { border-bottom: 0; }
.summary-group-name { font-weight: 550; }
.summary-group-count { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.summary-group-count b { color: var(--ink); }
.summary-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: baseline;
  padding: 4px 0;
  border-bottom: 1px dashed var(--line);
  font-size: .78rem;
}
.summary-row:last-child { border-bottom: 0; }
.summary-name { font-weight: 550; }
.summary-meta { display: block; font-size: .69rem; color: var(--muted); }
.summary-count { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.summary-count.is-zero { color: #b45309; }
.summary-count.is-none { color: var(--muted); font-weight: 550; }

.attribution-block p { font-size: .76rem; color: var(--ink-2); }

/* ------------------------------------------------------------------ попапы */
.tool-popup { font-size: .8rem; }
.tool-popup-title { font-weight: 700; font-size: .86rem; margin-bottom: 2px; }
.tool-popup-row { color: var(--muted); font-size: .74rem; margin-bottom: 4px; }
.tool-popup-needs { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.tool-popup-need {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .69rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 7px;
}
.tool-popup-need i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--need-color, #888); display: inline-block;
}
.tool-popup-distance { font-weight: 650; font-variant-numeric: tabular-nums; }
.tool-popup-link { display: inline-block; margin-top: 4px; font-weight: 600; font-size: .74rem; }

.tool-marker {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(225, 29, 72, .14);
  border: 2px solid #e11d48;
  box-shadow: 0 0 0 4px rgba(225, 29, 72, .1);
  cursor: grab;
}
.tool-marker::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e11d48;
}
.tool-marker:active { cursor: grabbing; }

/* ------------------------------------------------------------------ методика */
.profile-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.profile-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--surface);
}
.profile-card h3 { margin-bottom: 2px; }
.profile-card .muted { font-size: .74rem; }
.profile-card ul { margin-top: 7px; }

.category-group { margin-top: 14px; }
.category-group h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .9rem;
  margin-bottom: 7px;
}
.category-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 7px;
}
.category-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 7px 9px;
  background: var(--surface);
}
.category-item > div { display: flex; flex-direction: column; gap: 1px; }
.category-item strong { font-size: .8rem; }
.category-item span { font-size: .71rem; color: var(--muted); }

/* ------------------------------------------------------------------ адаптив */
@media (max-width: 1180px) {
  .tool-layout { grid-template-columns: minmax(0, 1fr) 370px; }
  .tool-status { max-width: 330px; }
}

@media (max-width: 980px) {
  .tool-layout,
  .preview-banner + .tool-main .tool-layout { display: block; height: auto; overflow: visible; }
  .tool-map { height: 58dvh; min-height: 420px; }
  .profile-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
    max-height: none;
    height: auto;
    padding: 16px;
  }
  .tool-hint { display: none; }
  .map-legend { max-height: 34vh; }
  .profile-score { position: static; box-shadow: none; }
}

@media (max-width: 760px) {
  .tool-map { height: 54dvh; min-height: 380px; }
  .tool-topbar { top: 8px; left: 8px; right: 8px; gap: 6px; }
  .reference-chip, .tool-status { font-size: .72rem; padding: 6px 10px; }
  .tool-status { max-width: calc(100% - 10px); }
  .tool-note { display: none; }
  .map-legend {
    width: calc(100% - 16px);
    left: 8px;
    bottom: 8px;
    max-height: 30vh;
  }
  .map-legend.is-collapsed { width: auto; max-width: calc(100% - 16px); }
  .map-legend.is-collapsed .legend-help { display: none; }
  .profile-panel { padding: 14px; }
  .age-grid { grid-template-columns: 1fr 1fr; }
  .age-btn { padding: 7px; }
  .profile-head h1 { font-size: 1.15rem; }
  .profile-badge { font-size: .66rem; }
}

/* ------------------------------------------------------------------ ДТП */
.dtp-panel { position: absolute; left: 12px; bottom: 46px; z-index: 620; width: min(320px, calc(100% - 24px)); padding: 9px 11px; background: rgba(255, 255, 255, .97); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(10, 36, 52, .18); font-size: .7rem; }
.dtp-panel[hidden] { display: none; }
.dtp-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dtp-city { margin: 6px 0; color: var(--ink-2); line-height: 1.35; }
.dtp-filter { display: flex; align-items: center; gap: 6px; color: var(--ink-2); }
.dtp-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 7px 0 5px; color: var(--muted); font-size: .64rem; }
.dtp-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dtp-dot-light { background: #f9a825; }
.dtp-dot-heavy { background: #ef6c00; }
.dtp-dot-fatal { background: #b71c1c; }
.dtp-cluster { background: transparent; }
.dtp-cluster span { display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; background: rgba(38, 50, 56, .82); color: #fff; font-size: .72rem; font-weight: 650; border: 2px solid #fff; }
.dtp-cluster.is-fatal span { background: rgba(183, 28, 28, .9); }
@media (max-width: 760px) {
  .dtp-panel { left: 8px; right: 8px; width: auto; bottom: 10px; }
}

/* ------------------------------------------------------- безопасность (ДТП) */
.safety-block { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.safety-title { margin: 0 0 6px; font-size: .72rem; font-weight: 650; letter-spacing: .02em; color: var(--ink-2); text-transform: uppercase; }
.safety-block .need-row { cursor: pointer; }

/* Прототип: маркеры-символы по группам инфраструктуры */
.shape-marker { background: none; border: 0; }
.shape-marker svg { display: block; filter: drop-shadow(0 0 1px rgba(0, 0, 0, .35)); }

/* Прототип: символы одной текстовой глифой (без вложенного SVG) */
.glyph-marker { background: none; border: 0; }
.glyph-marker span { display: block; font-size: 14px; line-height: 14px; text-align: center; text-shadow: 0 0 1px #fff, 0 0 2px #fff; }

/* Легенда символов по группам инфраструктуры */
.legend-shapes { margin-top: 9px; padding-top: 8px; border-top: 1px dashed var(--line); }
.legend-shapes ul { list-style: none; margin: 5px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; }
.legend-shapes li { display: flex; align-items: center; gap: 6px; font-size: .68rem; color: var(--ink-2); }
.shape-swatch { width: 14px; height: 14px; flex: 0 0 auto; background-repeat: no-repeat; background-position: center; background-size: 14px 14px; }
@media (max-width: 760px) {
  .legend-shapes { display: none; }
}
