/* ==========================================================================
   GIS Portal — оформление
   Лёгкая тема, системные шрифты, без сборки. Цвета классов — из методики
   модуля №2 (A #1a7f37, B #6aa32f, C #d29922, D #d2691e, E #b62324).
   ========================================================================== */

:root {
  --bg: #f2f5f8;
  --surface: #ffffff;
  --surface-2: #eef3f7;
  --surface-3: #e4ebf1;
  --ink: #0e1f2c;
  --ink-2: #2c4153;
  --muted: #61758a;
  --line: #d9e2ea;
  --line-strong: #c3cfda;
  --brand: #0b5f8a;
  --brand-2: #0e7490;
  --brand-soft: #e3f1f8;
  --accent: #f5b301;
  --ok: #1a7f37;
  --warn: #9a6a00;
  --danger: #b62324;
  --grade-a: #1a7f37;
  --grade-b: #6aa32f;
  --grade-c: #d29922;
  --grade-d: #d2691e;
  --grade-e: #b62324;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(14, 31, 44, .06);
  --shadow: 0 1px 2px rgba(14, 31, 44, .05), 0 10px 28px rgba(14, 31, 44, .07);
  --font: "Inter", "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", "Consolas", monospace;
  --header-h: 68px;
  --maxw: 1280px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.01em; font-weight: 700; }
h1 { font-size: clamp(1.55rem, 1.2rem + 1.2vw, 2.1rem); }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75em; }
p:last-child { margin-bottom: 0; }
a { color: var(--brand); text-decoration-thickness: .06em; text-underline-offset: .16em; }
a:hover { color: var(--brand-2); }
code {
  font-family: var(--mono);
  font-size: .86em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .08em .35em;
  word-break: break-word;
}
strong { font-weight: 650; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: 12px; top: -60px;
  z-index: 5000;
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  transition: top .15s ease;
}
.skip-link:focus { top: 0; color: #fff; }

:focus-visible {
  outline: 3px solid rgba(11, 95, 138, .38);
  outline-offset: 2px;
}

/* Статический предпросмотр для IIS */
.preview-banner {
  background: #fff7e2;
  border-bottom: 1px solid #ecd7a0;
  color: #6f5000;
  font-size: .82rem;
}
.preview-banner-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 8px 22px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: baseline;
}
.preview-banner strong { color: #4d3700; }

/* ------------------------------------------------------------------ шапка */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1200;
  height: var(--header-h);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: var(--maxw);
  height: 100%;
  margin: 0 auto;
  padding: 0 22px;
  display: flex;
  align-items: center;
  gap: 26px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--ink);
  flex: 0 0 auto;
}
.brand-mark { display: grid; place-items: center; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 1.02rem; letter-spacing: -.01em; }
.brand-text span { font-size: .72rem; color: var(--muted); }

.site-nav { display: flex; align-items: center; gap: 4px; margin-left: 6px; }
.site-nav a {
  display: inline-block;
  padding: 8px 13px;
  border-radius: 999px;
  color: var(--ink-2);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 550;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.site-nav a:hover { background: var(--surface-2); color: var(--ink); }
.site-nav a.is-active { background: var(--brand-soft); color: var(--brand); }

.header-meta { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: .76rem;
  color: var(--ink-2);
  white-space: nowrap;
}
.chip-muted { color: var(--muted); background: var(--surface-2); }
.chip-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(26, 127, 55, .15);
}

/* ------------------------------------------------------------------ основа */
.site-main { min-height: 60vh; }
.page-shell {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 22px 22px 56px;
}
.map-main { padding: 0; }

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .8rem;
  color: var(--muted);
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--brand); text-decoration: underline; }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-head .lead {
  max-width: 74ch;
  color: var(--ink-2);
  margin-top: 7px;
  font-size: .97rem;
}
.page-head-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.lead { color: var(--ink-2); }
.muted { color: var(--muted); }
.small { font-size: .78rem; }
.nowrap { white-space: nowrap; }

/* ------------------------------------------------------------------ кнопки */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-size: .88rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .05s ease;
  white-space: nowrap;
}
.button:hover { background: #0a5279; border-color: #0a5279; color: #fff; }
.button:active { transform: translateY(1px); }
.button-ghost {
  background: var(--surface);
  color: var(--ink-2);
  border-color: var(--line-strong);
}
.button-ghost:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line-strong); }
.button-small { padding: 7px 12px; font-size: .82rem; }
.button-tiny { padding: 5px 9px; font-size: .76rem; border-radius: 8px; }
.button:disabled {
  opacity: .48;
  cursor: not-allowed;
  transform: none;
}
.text-link { color: var(--brand); font-size: .85rem; text-decoration: none; font-weight: 550; }
.text-link:hover { text-decoration: underline; }
.link-button {
  border: 0;
  background: none;
  padding: 0;
  color: var(--brand);
  font: inherit;
  font-size: .78rem;
  cursor: pointer;
  text-decoration: underline;
}

/* ------------------------------------------------------------------ карточки */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 18px;
}
.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.method-tag, .source-tag {
  font-size: .74rem;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}
.subhead { margin: 20px 0 12px; font-size: .95rem; }

/* ------------------------------------------------------------------ карта */
.map-layout {
  display: grid;
  grid-template-columns: 372px minmax(0, 1fr);
  height: calc(100dvh - var(--header-h));
  min-height: 560px;
  background: var(--surface);
}
.map-panel {
  overflow-y: auto;
  border-right: 1px solid var(--line);
  padding: 18px 18px 22px;
  background: var(--surface);
  scrollbar-width: thin;
}
.panel-intro h1 { font-size: 1.35rem; margin-bottom: 7px; }
.panel-intro p { color: var(--ink-2); font-size: .86rem; }
.panel-section {
  padding: 15px 0;
  border-top: 1px solid var(--line);
}
.panel-section h2 { font-size: .9rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 10px; }
.panel-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.panel-note { font-size: .76rem; color: var(--muted); margin-top: 10px; line-height: 1.45; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.stat-value { font-size: 1.22rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-label { font-size: .7rem; color: var(--muted); }

.grade-bars { display: grid; gap: 5px; margin-top: 12px; }
.grade-bar-row { display: grid; grid-template-columns: 18px 1fr 54px; align-items: center; gap: 8px; }
.grade-key { font-weight: 700; font-size: .78rem; }
.grade-bar { height: 7px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.grade-bar > span { display: block; height: 100%; border-radius: 999px; background: var(--line-strong); }
.grade-key.grade-a ~ .grade-bar > span { background: var(--grade-a); }
.grade-key.grade-b ~ .grade-bar > span { background: var(--grade-b); }
.grade-key.grade-c ~ .grade-bar > span { background: var(--grade-c); }
.grade-key.grade-d ~ .grade-bar > span { background: var(--grade-d); }
.grade-key.grade-e ~ .grade-bar > span { background: var(--grade-e); }
.grade-count { font-size: .74rem; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

.layer-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.layer-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 6px;
  border-radius: 8px;
  cursor: pointer;
  font-size: .82rem;
}
.layer-toggle:hover { background: var(--surface-2); }
.layer-toggle input { accent-color: var(--brand); width: 15px; height: 15px; flex: 0 0 auto; }
.layer-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--layer-color, var(--muted));
  flex: 0 0 auto;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--layer-color, #888) 18%, transparent);
}
.layer-label { flex: 1 1 auto; }
.layer-count { font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.sample-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.sample-cards li {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 7px 5px;
  border-bottom: 1px solid var(--line);
}
.sample-cards li:last-child { border-bottom: 0; }
.sample-cards a { font-size: .82rem; font-weight: 600; text-decoration: none; }
.sample-cards a:hover { text-decoration: underline; }
.sample-cards span { font-size: .72rem; color: var(--muted); }

.grade-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }.grade-legend label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .82rem;
  cursor: pointer;
  padding: 3px 5px;
  border-radius: 7px;
}
.grade-legend label:hover { background: var(--surface-2); }
.grade-legend input { accent-color: var(--brand); width: 15px; height: 15px; }
.legend-swatch { width: 11px; height: 11px; border-radius: 3px; flex: 0 0 auto; }
.legend-key { font-weight: 700; width: 14px; }
.legend-text { color: var(--muted); }
.grade-a { color: var(--grade-a); }
.grade-b { color: var(--grade-b); }
.grade-c { color: var(--grade-c); }
.grade-d { color: var(--grade-d); }
.grade-e { color: var(--grade-e); }
.legend-swatch.grade-a { background: var(--grade-a); }
.legend-swatch.grade-b { background: var(--grade-b); }
.legend-swatch.grade-c { background: var(--grade-c); }
.legend-swatch.grade-d { background: var(--grade-d); }
.legend-swatch.grade-e { background: var(--grade-e); }
.attribution-box p { font-size: .78rem; color: var(--ink-2); }

.map-wrap { position: relative; min-width: 0; background: var(--surface-2); }
#map { position: absolute; inset: 0; z-index: 1; }
.map-status {
  position: absolute;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  z-index: 500;
  background: rgba(14, 31, 44, .88);
  color: #fff;
  font-size: .78rem;
  padding: 6px 14px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  pointer-events: none;
  max-width: calc(100% - 120px);
  text-align: center;
}
.map-status.is-error { background: var(--danger); }
.map-status.is-ok { background: rgba(26, 127, 55, .92); }
.map-overlay {
  position: absolute;
  inset: 0;
  z-index: 600;
  display: grid;
  place-items: center;
  background: rgba(242, 245, 248, .55);
  backdrop-filter: blur(2px);
  padding: 20px;
}
.map-overlay[hidden] { display: none; }
.map-overlay-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  max-width: 390px;
}
.map-overlay-card strong { display: block; font-size: 1.05rem; margin-bottom: 6px; }
.map-overlay-card p { color: var(--ink-2); font-size: .87rem; margin: 0; }
.map-error {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 16px;
  z-index: 650;
  background: #fff4f4;
  border: 1px solid #f0c2c2;
  color: #7c1d1d;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: .82rem;
  box-shadow: var(--shadow);
}
.map-error[hidden] { display: none; }
.map-hint {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 500;
  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;
}

/* попап Leaflet */
.leaflet-popup-content-wrapper { border-radius: 12px; box-shadow: var(--shadow); }
.leaflet-popup-content { margin: 12px 14px; font-family: var(--font); font-size: .82rem; }
.popup-title { font-weight: 700; font-size: .9rem; margin-bottom: 3px; }
.popup-row { color: var(--muted); font-size: .78rem; margin-bottom: 6px; }
.popup-score { display: flex; align-items: center; gap: 8px; margin: 7px 0; }
.popup-link { display: inline-block; margin-top: 4px; font-weight: 600; font-size: .78rem; }
.popup-flags { color: var(--warn); font-size: .74rem; margin-top: 5px; }

/* ------------------------------------------------------------------ карточка дома */
.building-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.building-main, .building-side { min-width: 0; }
.building-side .card { padding: 18px; }

.score-head { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }
.gauge {
  --v: 0;
  --c: var(--brand);
  width: 152px;
  height: 152px;
  border-radius: 50%;
  background: conic-gradient(var(--c) calc(var(--v) * 1%), var(--surface-3) 0);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  position: relative;
}
.gauge::after {
  content: "";
  position: absolute;
  inset: 11px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}
.gauge-inner { position: relative; z-index: 1; text-align: center; display: flex; flex-direction: column; }
.gauge-value { font-size: 2rem; font-weight: 750; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.gauge-unit { font-size: .72rem; color: var(--muted); }
.score-summary { flex: 1 1 260px; min-width: 220px; }
.grade-pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}
.grade-pill.grade-a { background: var(--grade-a); color: #fff; }
.grade-pill.grade-b { background: var(--grade-b); color: #fff; }
.grade-pill.grade-c { background: var(--grade-c); color: #fff; }
.grade-pill.grade-d { background: var(--grade-d); color: #fff; }
.grade-pill.grade-e { background: var(--grade-e); color: #fff; }
.score-percentile { font-size: .92rem; margin-bottom: 4px; }
.score-notes { margin: 8px 0 0; padding-left: 18px; font-size: .8rem; color: var(--muted); }
.score-notes li { margin-bottom: 3px; }
.notice-inline {
  font-size: .8rem;
  color: var(--warn);
  background: #fff9e8;
  border: 1px solid #f0e0b0;
  border-radius: 8px;
  padding: 8px 10px;
  margin-top: 6px;
}

.component-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.component { border-top: 1px dashed var(--line); padding-top: 11px; }
.component:first-child { border-top: 0; padding-top: 0; }
.component-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.component-name { font-weight: 600; font-size: .9rem; }
.component-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.bar { height: 7px; background: var(--surface-3); border-radius: 999px; overflow: hidden; margin: 7px 0 5px; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand), #2fa3c4); }
.component-meta { font-size: .74rem; color: var(--muted); }
.detail-chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 0;
  padding: 0;
}
.detail-chips li {
  font-size: .74rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 8px;
  color: var(--ink-2);
}
.detail-chips b { color: var(--ink); }
.detail-label { color: var(--muted); margin-right: 4px; }
.detail-line { font-size: .78rem; color: var(--ink-2); margin: 8px 0 0; }

.spec-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0 22px; margin: 0; }
.spec-grid > div {
  display: grid;
  grid-template-columns: minmax(120px, 42%) 1fr;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}
.spec-grid > div:last-child { border-bottom: 0; }
.spec-grid dt { color: var(--muted); font-size: .78rem; }
.spec-grid dd { margin: 0; font-size: .87rem; font-weight: 550; overflow-wrap: anywhere; }
.spec-grid.compact > div { grid-template-columns: 1fr auto; }
.unknown { color: var(--warn); font-weight: 550; }

.mini-dl { margin: 10px 0 0; }
.mini-dl > div { display: grid; grid-template-columns: 1fr; gap: 1px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.mini-dl > div:last-child { border-bottom: 0; }
.mini-dl dt { color: var(--muted); font-size: .72rem; }
.mini-dl dd { margin: 0; font-size: .82rem; overflow-wrap: anywhere; }

.plain-list { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: .86rem; }
.plain-list li { margin-bottom: 6px; }
.limits-list li { margin-bottom: 8px; }

.nearest-list { list-style: none; margin: 0; padding: 0; display: grid; }
.nearest-list li {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: baseline;
  padding: 8px 4px;
  border-bottom: 1px solid var(--line);
  font-size: .84rem;
}
.nearest-list li:last-child { border-bottom: 0; }
.nearest-rank {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  font-size: .68rem;
  font-weight: 700;
}
.nearest-name { font-weight: 600; overflow-wrap: anywhere; }
.nearest-group { color: var(--muted); font-size: .74rem; }
.nearest-distance { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty, .empty-state { color: var(--muted); font-size: .86rem; padding: 13px; text-align: center; background: var(--surface-2); border-radius: 10px; }
.empty-state strong { display: block; color: var(--ink); margin-bottom: 4px; }

.definition-list { margin: 0; }
.definition-list > div { padding: 10px 0; border-bottom: 1px solid var(--line); }
.definition-list > div:last-child { border-bottom: 0; }
.definition-list dt { font-weight: 650; margin-bottom: 3px; }
.definition-list dd { margin: 0; color: var(--ink-2); font-size: .88rem; }

/* ------------------------------------------------------------------ уведомления */
.notice {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  font-size: .86rem;
  margin-bottom: 16px;
  color: var(--ink-2);
}
.notice-warn { background: #fffaf0; border-color: #efdfb7; }
.notice-ok { background: #f1faf3; border-color: #bfe3c8; }
.notice p { margin: 6px 0 0; }
.notice-note { color: var(--muted); font-size: .8rem; }
.flag-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 7px; }
.flag-list li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid #e8d6a9;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: .78rem;
  color: #7a5800;
}
.flag-icon {
  width: 15px; height: 15px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: #f3c64a;
  color: #4a3400;
  font-size: .66rem;
  font-weight: 800;
}

/* ------------------------------------------------------------------ таблицы */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.data-table { width: 100%; border-collapse: collapse; font-size: .83rem; background: var(--surface); }
.data-table th, .data-table td { padding: 9px 11px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 650;
  white-space: nowrap;
}
.data-table thead th a { color: inherit; text-decoration: none; }
.data-table thead th a:hover { color: var(--brand); text-decoration: underline; }
.data-table thead th a.is-sorted { color: var(--brand); }
.data-table tbody tr:hover { background: #f8fafc; }
.data-table tbody tr:last-child td, .data-table tbody tr:last-child th { border-bottom: 0; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table th[scope="row"] { font-weight: 550; color: var(--ink); }
.data-table .empty { text-align: center; padding: 22px; }
.access-table th[scope="row"] { min-width: 220px; }
.districts-table td.cell-label { min-width: 250px; font-weight: 550; }
.admin-table .reason { min-width: 240px; max-width: 420px; color: var(--ink-2); overflow-wrap: anywhere; }
.admin-table td a { white-space: nowrap; }
.kind-code { font-size: .72rem; white-space: nowrap; }
.payload summary { cursor: pointer; font-size: .72rem; color: var(--muted); margin-top: 4px; }
.payload pre {
  max-width: 320px;
  max-height: 180px;
  overflow: auto;
  font-size: .7rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px;
  margin: 5px 0 0;
}

.score-chip {
  display: inline-block;
  min-width: 44px;
  text-align: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: .78rem;
  background: var(--surface-2);
  color: var(--ink-2);
}
.score-chip.grade-a { background: #e6f4ea; color: #14602a; }
.score-chip.grade-b { background: #eef7e3; color: #4d7b20; }
.score-chip.grade-c { background: #fbf3dc; color: #8a6412; }
.score-chip.grade-d { background: #fdeee2; color: #a04f14; }
.score-chip.grade-e { background: #fbe9e9; color: #8d1c1d; }

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding-top: 13px; flex-wrap: wrap; }
.pagination-info { font-size: .8rem; color: var(--muted); }
.pagination-controls { display: flex; gap: 7px; }
.table-card { padding: 16px 16px 13px; }

/* ------------------------------------------------------------------ агрегаты */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.summary-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.summary-value { font-size: 1.4rem; font-weight: 720; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.summary-label { font-size: .74rem; color: var(--muted); }

.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 11px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 16px;
}
.field { display: flex; flex-direction: column; gap: 4px; font-size: .76rem; color: var(--muted); }
.field input, .field select {
  font: inherit;
  font-size: .86rem;
  color: var(--ink);
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  min-width: 230px;
}
.field-small input { min-width: 130px; width: 130px; }
.field input:focus, .field select:focus { outline: 2px solid rgba(11, 95, 138, .25); border-color: var(--brand); }
.checkbox-field { display: flex; align-items: center; gap: 7px; font-size: .82rem; padding-bottom: 9px; }
.checkbox-field input { width: 15px; height: 15px; accent-color: var(--brand); }
.filter-result { margin-left: auto; font-size: .8rem; color: var(--muted); }
.static-note-bar { font-size: .84rem; color: var(--ink-2); display: block; }
.page-note { font-size: .8rem; color: var(--muted); margin-top: 14px; line-height: 1.5; }

/* ------------------------------------------------------------------ методика */
.meta-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 18px;
}
.meta-strip > div { background: var(--surface); padding: 11px 14px; display: flex; flex-direction: column; gap: 2px; }
.meta-strip span { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.meta-strip b { font-size: .88rem; overflow-wrap: anywhere; }
.prose { max-width: none; }
.prose p { color: var(--ink-2); }
.formula {
  font-family: var(--mono);
  font-size: .84rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 14px 0;
  overflow-x: auto;
}
.weight-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.weight-list li { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(120px, 2fr) 54px; gap: 12px; align-items: center; font-size: .85rem; }
.weight-name { font-weight: 550; }
.weight-bar { height: 9px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.weight-bar > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand), #35a7c6); }
.weight-value { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.tag-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 7px; }
.tag {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: .78rem;
  color: var(--ink-2);
}

/* ------------------------------------------------------------------ о проекте */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.terms-block { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.terms-block:last-of-type { border-bottom: 0; }
.terms-block h3 { margin-bottom: 5px; }
.license-line { font-size: .82rem; color: var(--muted); }
.http-method {
  display: inline-block;
  font-family: var(--mono);
  font-size: .7rem;
  font-weight: 700;
  color: #fff;
  background: var(--brand);
  border-radius: 5px;
  padding: 1px 6px;
}
.badge {
  display: inline-block;
  font-size: .72rem;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.badge-ok { background: #e6f4ea; border-color: #bfe3c8; color: #14602a; }
.mode-badge {
  display: inline-block;
  font-size: .78rem;
  font-weight: 650;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.mode-read { background: #fff6e0; border-color: #ecd7a0; color: #7a5800; }
.mode-write { background: #e6f4ea; border-color: #bfe3c8; color: #14602a; }
.decision-buttons { display: flex; flex-wrap: wrap; gap: 4px; }
.decision-buttons .button { background: var(--surface); color: var(--ink-2); border-color: var(--line-strong); }
.decision-buttons .button:hover { background: var(--surface-2); color: var(--ink); }
.decision-buttons .button.is-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.decision-buttons .button.is-primary:hover { background: #0a5279; color: #fff; }
.decision-buttons .button:disabled,
.decision-buttons .button.is-primary:disabled {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--muted);
  opacity: .75;
}

/* ------------------------------------------------------------------ ошибки */
.error-shell { text-align: center; padding-top: 64px; padding-bottom: 80px; max-width: 720px; }
.error-code { font-size: clamp(4rem, 9vw, 7rem); font-weight: 800; line-height: 1; color: var(--line-strong); letter-spacing: -.05em; }
.error-shell h1 { margin: 10px 0 8px; }
.error-shell .lead { max-width: 52ch; margin: 0 auto 20px; }
.error-actions { display: flex; gap: 9px; justify-content: center; flex-wrap: wrap; margin-bottom: 18px; }

/* ------------------------------------------------------------------ подвал */
.site-footer {
  background: #0e2230;
  color: #c7d6e2;
  padding: 36px 22px 16px;
  margin-top: 8px;
}
.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 26px;
}
.footer-col strong { color: #fff; font-size: .95rem; }
.footer-about p { font-size: .8rem; color: #a9bccb; margin-top: 8px; line-height: 1.55; }
.attribution-line { border-top: 1px solid rgba(255,255,255,.12); padding-top: 9px; }
.site-footer a { color: #9fd3ee; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.footer-title {
  display: block;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #7f97a9;
  margin-bottom: 9px;
}
.footer-dl { margin: 0; display: grid; gap: 6px; }
.footer-dl > div { display: flex; flex-direction: column; gap: 0; }
.footer-dl dt { font-size: .68rem; color: #7f97a9; text-transform: uppercase; letter-spacing: .05em; }
.footer-dl dd { margin: 0; font-size: .78rem; color: #dbe7f0; overflow-wrap: anywhere; }
.footer-dl code { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.14); color: #dbe7f0; }
.footer-links, .footer-notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; font-size: .78rem; }
.footer-notes { color: #9fb2c1; }
.footer-bottom {
  max-width: var(--maxw);
  margin: 26px auto 0;
  padding-top: 13px;
  border-top: 1px solid rgba(255,255,255,.1);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: .72rem;
  color: #7f97a9;
}

/* ------------------------------------------------------------------ адаптив */
@media (max-width: 1120px) {
  .header-inner { gap: 14px; }
  .header-meta .chip-muted { display: none; }
  .building-grid { grid-template-columns: minmax(0, 1fr) 300px; }
  .footer-inner { grid-template-columns: 1.4fr 1fr 1fr; }
  .footer-col:last-child { display: none; }
}

@media (max-width: 940px) {
  .site-nav a { padding: 7px 10px; font-size: .84rem; }
  .brand-text span { display: none; }
  .map-layout { grid-template-columns: 1fr; height: auto; }
  .map-panel {
    order: 2;
    border-right: 0;
    border-top: 1px solid var(--line);
    max-height: none;
    padding: 16px;
  }
  .map-wrap { order: 1; height: 62dvh; min-height: 420px; }
  .map-hint { display: none; }
  .building-grid { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  :root { --header-h: 92px; }
  .site-header { height: auto; }
  .header-inner { padding: 7px 14px 6px; gap: 4px 12px; flex-wrap: wrap; height: auto; }
  .brand-text strong { font-size: .92rem; }
  .header-meta { display: none; }
  .site-nav {
    order: 3;
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
    gap: 2px;
    overflow: visible;
  }
  .site-nav a { padding: 5px 6px; font-size: .78rem; flex: 1 1 auto; text-align: center; }
  .page-shell { padding: 16px 14px 44px; }
  .preview-banner-inner { padding: 8px 14px; }
  .card { padding: 15px; }
  .page-head { gap: 12px; }
  .map-wrap { height: 56dvh; min-height: 360px; }
  .score-head { gap: 18px; }
  .gauge { width: 128px; height: 128px; }
  .gauge-value { font-size: 1.7rem; }
  .nearest-list li { grid-template-columns: 24px minmax(0, 1fr) auto; }
  .nearest-group { grid-column: 2; color: var(--muted); }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .weight-list li { grid-template-columns: 1fr 46px; }
  .weight-bar { grid-column: 1 / -1; grid-row: 2; }
  .filter-bar { padding: 11px; }
  .field input, .field select { min-width: 0; width: 100%; }
  .field { flex: 1 1 100%; }
  .filter-result { margin-left: 0; }
  .data-table { font-size: .78rem; }
  .data-table th, .data-table td { padding: 7px 8px; }
  .footer-inner { grid-template-columns: 1fr; gap: 18px; }
  .footer-col:last-child { display: block; }
  .site-footer { padding: 28px 16px 14px; }
}

@media (max-width: 420px) {
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .summary-value { font-size: 1.2rem; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .spec-grid > div { grid-template-columns: 1fr; gap: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
