/* Fonts: self-hosted via vendor/fonts.css (loaded in <head>). No googleapis needed. */

/* ─── Variables ─────────────────────────────────────────────────────────── */
/* ─── Токены оформления ─────────────────────────────────────────────────────

   Направление «аналитическая станция»: рабочий инструмент, а не витрина.
   Спокойный синий вместо неонового бирюзового, приглушённые границы вместо
   светящихся рамок, плотнее сетка, меньше радиусы.

   Имена переменных сохранены от прежней темы намеренно: на них завязаны
   разметка обеих страниц, восемь модулей и набор проверок. Меняются значения,
   а не имена - иначе правка растянулась бы на весь проект и сломала бы то,
   что сейчас работает.

   Из-за этого осталось историческое имя --electric: теперь это обычный синий
   акцент, никакого свечения за ним нет.

   Поверхности нейтрально-серые, без синевы. Синий фон, светящиеся рамки и
   радужные акценты - набор признаков, по которому тёмная панель опознаётся
   как штампованная; цвет здесь несёт смысл только там, где различает данные:
   победители, призёры, охват регионов.
   ───────────────────────────────────────────────────────────────────────── */
:root {
  /* Поверхности: от фона страницы к самой приподнятой карточке */
  --bg:            #161616;
  --surface:       #1e1e1e;
  --surface2:      #242424;
  --surface3:      #2c2c2c;

  /* Границы. Полупрозрачные, чтобы одинаково ложиться на любую поверхность */
  --border:        #2b2b2b;
  --border2:       #3a3a3a;

  /* Акцент */
  --blue:          #2563eb;
  --blue-light:    #4b83f0;
  --electric:      #4b83f0;
  --electric-glow: rgba(37, 99, 235, 0.16);
  --electric-glow2:rgba(37, 99, 235, 0.08);

  /* Текст: основной, второстепенный, подписи */
  --text:          #e6e6e6;
  --text2:         #9a9a94;
  --text3:         #6e6e69;

  /* Состояния */
  --green:         #22c55e;
  --green-glow:    rgba(34, 197, 94, 0.14);
  --amber:         #f59e0b;
  --amber-glow:    rgba(245, 158, 11, 0.14);
  --red:           #ef4444;
  --red-glow:      rgba(239, 68, 68, 0.14);

  /* Скругления: сдержаннее прежних, ближе к приборной панели */
  --radius-sm:  4px;
  --radius-md:  6px;
  --radius-lg:  8px;
  --radius-xl:  10px;

  /* Тени обычные. Прежняя --shadow-electric светилась бирюзовым по всему
     интерфейсу; оставлена как мягкая подсветка акцентом, чтобы не искать
     каждое её упоминание в разметке. */
  --shadow-sm:  none;
  --shadow-md:  none;
  --shadow-lg:  0 12px 40px rgba(0,0,0,0.55);
  --shadow-electric: none;

  --transition-fast:   140ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 220ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow:   360ms cubic-bezier(0.4, 0, 0.2, 1);

  --header-height: 56px;
  --statusbar-height: 32px;
  --sidebar-width: 340px;
}

/* ─── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: 'Golos Text', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg, video { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
canvas { display: block; }

/* ─── Scrollbar ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ─── Поверхности поверх карты ──────────────────────────────────────────
   Размытия здесь больше нет. Полупрозрачное стекло поверх карты читалось
   плохо: сквозь панель просвечивали контуры регионов, а на слабой видеокарте
   каждое движение карты пересчитывало размытие целого экрана.
   Имена классов оставлены - на них завязана разметка обеих страниц. */
.glass {
  background: var(--surface);
  border: 1px solid var(--border);
}

.glass-strong {
  background: var(--surface);
  border: 1px solid var(--border2);
}

.glass-light {
  background: var(--surface2);
  border: 1px solid var(--border);
}

/* ─── Меню «ещё» в шапке ────────────────────────────────────────────────── */
.header-menu { position: relative; }

.header-menu-list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 1200;
  min-width: 224px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.header-menu-list[hidden] { display: none; }

.header-menu-list button {
  padding: 8px 10px;
  text-align: left;
  font-size: 13px;
  color: var(--text2);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
}

.header-menu-list button:hover {
  background: var(--surface2);
  color: var(--text);
}

/* ─── Header ────────────────────────────────────────────────────────────── */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Плашка знака. Ровный синий вместо градиента со свечением: знак должен
   читаться, а не светиться - он стоит рядом с названием, а не отдельно. */
.header-logo-icon {
  width: 32px;
  height: 32px;
  background: var(--blue);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Монограмма нарисована обводкой, а не заливкой: так она не залипает
   в пятно на мелком размере и остаётся читаемой во вкладке браузера. */
.header-logo-icon svg {
  width: 20px;
  height: 20px;
  color: #fff;
  fill: none;
}

.header-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.header-logo-text .title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.header-logo-text .subtitle {
  font-size: 11px;
  font-weight: 500;
  color: var(--electric);
}

.header-divider {
  width: 1px;
  height: 28px;
  background: var(--border);
  flex-shrink: 0;
}

/* Какой набор открыт - вместо прежней ленты фильтров, уехавшей в панель слева. */
.header-source {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--text2);
  overflow: hidden;
  white-space: nowrap;
}

.header-source .key { color: var(--text3); }
.header-source b { font-weight: 600; color: var(--text); }

@media (max-width: 1400px) { .header-source #srcMeta { display: none; } }
@media (max-width: 1100px) { .header-source { display: none; } }

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ─── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all var(--transition-normal);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  outline: none;
}

.btn-ghost {
  background: transparent;
  border-color: var(--border2);
  color: var(--text2);
}

.btn-ghost:hover {
  background: var(--surface2);
  border-color: var(--border2);
  color: var(--text);
}

.btn-primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-electric {
  background: rgba(75, 131, 240, 0.12);
  border-color: rgba(75, 131, 240, 0.4);
  color: var(--electric);
}

.btn-electric:hover {
  background: rgba(75, 131, 240, 0.2);
  border-color: var(--electric);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}

.btn-icon {
  padding: 8px;
  width: 36px;
  height: 36px;
  justify-content: center;
}

.btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

/* ─── Filter Chips ──────────────────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--text2);
  cursor: pointer;
  transition: all var(--transition-normal);
  white-space: nowrap;
  user-select: none;
}

.chip:hover {
  border-color: var(--electric);
  color: var(--electric);
  background: var(--electric-glow2);
}

.chip.active {
  background: var(--electric-glow);
  border-color: var(--electric);
  color: var(--electric);
}

.chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* ─── Рабочая область ───────────────────────────────────────────────────────

   Три полосы по вертикали: шапка, рабочая область, плашка состояния.
   Внутри рабочей области - панель фильтров и сцена с показателями и картой.

   Раньше карта висела на весь экран как fixed, а фильтры теснились в шапке.
   Теперь у каждого куска своё место в сетке, и карта не залезает под панели.
   ───────────────────────────────────────────────────────────────────────── */
.workspace {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: var(--statusbar-height);
  display: grid;
  grid-template-columns: 208px 1fr;
  min-height: 0;
}

/* ── Панель фильтров ── */
.filters-panel {
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 14px 0 16px;
  display: flex;
  flex-direction: column;
}

.filters-group {
  padding: 0 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filters-group h3 {
  font-size: 12px;
  font-weight: 700;
  color: var(--text3);
  margin-bottom: 6px;
}

/* Чип внутри панели - строка во всю ширину, а не «таблетка»:
   в столбце они читаются как список, а не как разбросанные ярлыки. */
.filters-panel .chip {
  width: 100%;
  justify-content: flex-start;
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 12.5px;
  border-color: transparent;
  background: transparent;
}

.filters-panel .chip:hover {
  background: var(--surface2);
  border-color: transparent;
  color: var(--text);
}

.filters-panel .chip.active {
  background: var(--electric-glow);
  border-color: transparent;
  color: var(--text);
  box-shadow: inset 2px 0 0 var(--electric);
}

.filters-note {
  margin-top: auto;
  padding: 12px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--text3);
  border-top: 1px solid var(--border);
}

/* ── Сцена: показатели и карта ── */
.stage {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
  min-width: 0;
}

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.kpi-strip > div {
  padding: 7px 18px 9px;
  border-right: 1px solid var(--border);
}

.kpi-strip > div:last-child { border-right: 0; }

.kpi-strip dt {
  font-size: 12px;
  font-weight: 600;
  color: var(--text3);
}

.kpi-strip dd {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.2;
  margin-top: 1px;
  letter-spacing: -0.02em;
}

.kpi-strip dd small {
  font-size: 12px;
  font-weight: 500;
  color: var(--text3);
  margin-left: 5px;
  letter-spacing: 0;
}

.map-container {
  position: relative;
  min-height: 0;
}

#map {
  width: 100%;
  height: 100%;
  background: var(--bg);
}

/* Leaflet overrides */
.leaflet-container {
  background: var(--bg) !important;
  font-family: 'Golos Text', sans-serif;
}

/* Подложка - светлые тайлы OpenStreetMap, а палитра интерфейса тёмная.
   Инверсия с поворотом тона делает из них тёмную карту, на которой вода
   остаётся синеватой, а не оранжевой. Прежний набор фильтров рассчитывался
   на уже тёмные тайлы Stadia и здесь дал бы засвеченный фон. */
.leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) brightness(0.8) contrast(0.95) saturate(0.2);
}

.leaflet-control-zoom {
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-md) !important;
  border-radius: var(--radius-sm) !important;
  overflow: hidden;
}

.leaflet-control-zoom a {
  background: var(--surface) !important;
  color: var(--text2) !important;
  border-bottom: 1px solid var(--border) !important;
  font-size: 16px !important;
  line-height: 28px !important;
  width: 30px !important;
  height: 30px !important;
  transition: all var(--transition-fast) !important;
}

.leaflet-control-zoom a:hover {
  background: var(--surface2) !important;
  color: var(--electric) !important;
}

.leaflet-control-attribution {
  background: rgba(22, 22, 22, 0.82) !important;
  color: var(--text3) !important;
  font-size: 10px !important;
}

.leaflet-control-attribution a { color: var(--text3) !important; }

/* ─── Tooltip ───────────────────────────────────────────────────────────── */
.map-tooltip {
  position: fixed;
  z-index: 2000;
  pointer-events: none;
  opacity: 0;
  transform: translate(12px, -50%) scale(0.95);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.map-tooltip.visible {
  opacity: 1;
  transform: translate(12px, -50%) scale(1);
}

.map-tooltip-inner {
  min-width: 200px;
  max-width: 280px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border2);
  box-shadow: var(--shadow-lg);
}

.tooltip-city {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.tooltip-region {
  font-size: 11px;
  color: var(--text2);
  margin-bottom: 10px;
}

.tooltip-stats {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.tooltip-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tooltip-stat-label {
  font-size: 11px;
  color: var(--text3);
}

.tooltip-stat-value {
  font-family: 'Golos Text', sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 600;
  color: var(--electric);
}

/* ─── Map Legend ─────────────────────────────────────────────────────────── */
/* ─── Плашка состояния ──────────────────────────────────────────────────────

   Обозначения, текущий масштаб и состояние данных. Раньше обозначения висели
   плашкой поверх карты по центру внизу и закрывали Дальний Восток; теперь
   у них своя полоса, а карта не упирается в край окна.
   ───────────────────────────────────────────────────────────────────────── */
.statusbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--statusbar-height);
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  background: var(--surface);
  border-top: 1px solid var(--border2);
  font-size: 11.5px;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
}

.statusbar-group {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.statusbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
  color: var(--text3);
}

.statusbar .key { color: var(--text3); }

.statusbar-storage { display: inline-flex; align-items: center; gap: 6px; }

.statusbar-storage::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text3);
}

.statusbar-storage.on::before { background: var(--green); }

/* Кнопка про нераспознанные строки. Показывается, только когда такие строки
   есть: молчаливая потеря части файла - худшее, что может сделать программа. */
.statusbar-warn {
  font: inherit;
  color: var(--amber);
  background: var(--amber-glow);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.statusbar-warn:hover { background: rgba(245, 158, 11, 0.2); }

/* На узком экране первой уходит подсказка про масштаб: обозначения и
   состояние данных важнее - без них непонятно, что показано на экране. */
@media (max-width: 1500px) { .statusbar-hint { display: none; } }

.map-legend {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* ─── Панель «Как загрузить данные» ─────────────────────────────────────────
   Открывается поверх правого края и не уводит со страницы: вопрос про формат
   возникает ровно в тот момент, когда человек собирается нажать «Загрузить».
   ───────────────────────────────────────────────────────────────────────── */
.help-panel {
  position: fixed;
  top: var(--header-height);
  right: 0;
  bottom: var(--statusbar-height);
  width: 384px;
  max-width: 92vw;
  z-index: 1100;
  background: var(--surface);
  border-left: 1px solid var(--border2);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

/* Свой display перебивает браузерное [hidden] - без этой строки панель
   висела открытой с самого запуска. */
.help-panel[hidden] { display: none; }

.help-panel-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.help-panel-head h2 { font-size: 14px; font-weight: 700; }

.help-panel-head button {
  margin-left: auto;
  background: none;
  border: 0;
  color: var(--text3);
  font-size: 20px;
  line-height: 1;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.help-panel-head button:hover { color: var(--text); background: var(--surface2); }

.help-panel-body { padding: 16px; display: grid; gap: 16px; }

.help-step { display: grid; grid-template-columns: 16px 1fr; gap: 10px; align-items: start; }

/* Номер шага - просто номер. Цифра в подсвеченном кружке выглядела как
   значок состояния, хотя обозначает всего лишь порядок. */
.help-step .n {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text3);
  line-height: 1.5;
}

.help-step h3 { font-size: 13px; font-weight: 700; margin-bottom: 3px; }
.help-step p  { font-size: 12.5px; color: var(--text2); line-height: 1.5; }

.help-panel code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: var(--text);
}

/* Образец таблицы. Шире панели, поэтому прокручивается внутри себя,
   а не растягивает страницу. */
.help-sample {
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  overflow-x: auto;
}

.help-sample table { width: 100%; border-collapse: collapse; font-size: 11px; }

.help-sample th {
  background: var(--surface2);
  color: var(--text2);
  font-weight: 600;
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border2);
  white-space: nowrap;
}

.help-sample th.req { color: var(--electric); }

.help-sample td {
  padding: 5px 8px;
  color: var(--text2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.help-sample tr:last-child td { border-bottom: 0; }

.help-facts { display: grid; gap: 8px; }

.help-facts li {
  position: relative;
  padding-left: 15px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text2);
}

/* Кружок отдельным слоем, а не колонкой сетки. В режиме grid каждый
   вложенный элемент строки становится своей ячейкой, поэтому выделенные
   слова внутри предложения выпадали из текста в соседние колонки. */
/* Маркер один на все пункты: зелёный и жёлтый кружки читались как
   «хорошо» и «внимание», хотя это просто три равнозначных факта. */
.help-facts li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 8px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text3);
}

/* Кнопка-иконка в шапке: та же высота, что у остальных, но без подписи. */
.btn-icon { padding: 7px; }
.btn-icon svg { width: 16px; height: 16px; }

.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  white-space: nowrap;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-scale {
  display: flex;
  align-items: center;
  gap: 4px;
}

.legend-scale-dot {
  border-radius: 50%;
  background: var(--electric);
  flex-shrink: 0;
  opacity: 0.8;
}

/* ─── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: var(--header-height);
  right: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  z-index: 900;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--transition-slow);
  border-left: 1px solid var(--border);
  background: var(--surface);
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.sidebar-subtitle {
  font-size: 12px;
  color: var(--text2);
  margin-top: 2px;
}

.sidebar-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text2);
  transition: all var(--transition-fast);
}

.sidebar-close:hover {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--border2);
}

.sidebar-close svg { width: 14px; height: 14px; }

.sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.sidebar-stat-card {
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--surface2);
  border: 1px solid var(--border);
}

.sidebar-stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text3);
  margin-bottom: 6px;
}

.sidebar-stat-value {
  font-family: 'Golos Text', sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: 22px;
  font-weight: 600;
  color: var(--electric);
  line-height: 1;
}

.sidebar-stat-value.green { color: var(--green); }
.sidebar-stat-value.amber { color: var(--amber); }

.sidebar-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text3);
  margin-bottom: 10px;
}


/* ─── Upload Modal ──────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.72);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
  padding: 20px;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  width: 100%;
  max-width: 520px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 1px solid var(--border2);
  box-shadow: var(--shadow-lg);
  transform: translateY(16px) scale(0.98);
  transition: transform var(--transition-normal);
  overflow: hidden;
}

.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 24px 0;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.modal-body { padding: 20px 24px 24px; }

.dropzone {
  border: 2px dashed var(--border2);
  border-radius: var(--radius-lg);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
}

.dropzone:hover,
.dropzone.drag-over {
  border-color: var(--electric);
  background: var(--electric-glow2);
}

/* Пока грузятся контуры регионов. Раньше здесь была заставка во весь экран:
   она закрывала интерфейс, который к этому моменту уже работал. */
.map-loading {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: var(--radius-md);
  background: var(--surface2);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text2);
  pointer-events: none;
}

.map-loading-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--electric);
  animation: map-loading-pulse 1.1s ease-in-out infinite;
}

@keyframes map-loading-pulse {
  0%, 100% { opacity: 0.25; transform: scale(0.8); }
  50%      { opacity: 1;    transform: scale(1); }
}

.dropzone-icon {
  margin-bottom: 12px;
  line-height: 1;
  color: var(--text3);
}

.dropzone-icon svg {
  width: 34px;
  height: 34px;
  display: block;
  margin: 0 auto;
}

.dropzone:hover .dropzone-icon { color: var(--electric); }

/* Значок школы в списке боковой панели. */
.school-mark {
  display: inline-flex;
  flex: 0 0 auto;
  color: var(--green);
}

.school-mark svg { width: 13px; height: 13px; }

.dropzone-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.dropzone-sub {
  font-size: 12px;
  color: var(--text2);
}

.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.modal-status {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  display: none;
}

.modal-status.success {
  display: block;
  background: var(--green-glow);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--green);
}

.modal-status.error {
  display: block;
  background: var(--red-glow);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--red);
}

.col-map {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.col-map-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: center;
}

.col-map-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
}

.col-map-select {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text);
  font-family: 'Golos Text', sans-serif;
  font-size: 12px;
  outline: none;
  transition: border-color var(--transition-fast);
}

.col-map-select:focus { border-color: var(--electric); }

/* ─── Notification ──────────────────────────────────────────────────────── */
/* Стили тоста живут в js/animations.js (_injectNotificationStyles): элемент
   создаётся кодом и им же оформляется. Здесь был второй набор правил для того
   же класса - живой тост получал left:50% отсюда и right:28px оттуда и вставал
   криво. Классы .show/.success/.error/.info не навешивал никто. */

/* ─── Cluster Markers ────────────────────────────────────────────────────── */
.marker-cluster-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
}

.marker-circle {
  border-radius: 50%;
  background: rgba(75, 131, 240, 0.45);
  border: 1.5px solid rgba(75, 131, 240, 0.6);
  box-shadow: 0 0 12px rgba(75, 131, 240, 0.4), inset 0 0 8px rgba(75, 131, 240,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Golos Text', sans-serif;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: white;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  cursor: pointer;
  animation: pulse-ring 3s ease-in-out infinite;
}

.marker-circle:hover {
  transform: scale(1.15);
  box-shadow: 0 0 24px rgba(75, 131, 240, 0.6), inset 0 0 12px rgba(75, 131, 240,0.15);
}

@keyframes pulse-ring {
  0%, 100% { box-shadow: 0 0 12px rgba(75, 131, 240, 0.4), inset 0 0 8px rgba(75, 131, 240,0.1); }
  50%       { box-shadow: 0 0 22px rgba(75, 131, 240, 0.6), 0 0 40px rgba(75, 131, 240,0.15), inset 0 0 8px rgba(75, 131, 240,0.1); }
}

/* ─── Dashboard Layout ───────────────────────────────────────────────────── */
.dashboard-body {
  padding-top: var(--header-height);
  min-height: 100vh;
  background: var(--bg);
}

.dashboard-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.dashboard-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.dashboard-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.dashboard-subtitle {
  font-size: 13px;
  color: var(--text2);
  margin-top: 3px;
}

/* Toggle Switch */
.toggle-group {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  border: 1px solid var(--border);
}

.toggle-btn {
  padding: 7px 18px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text2);
  transition: all var(--transition-normal);
}

.toggle-btn.active {
  background: var(--surface);
  color: var(--electric);
  box-shadow: var(--shadow-sm);
}

/* ─── Dashboard Cards ────────────────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.dashboard-grid-full {
  grid-template-columns: 1fr;
}

@media (max-width: 1200px) {
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

.dash-card {
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: visible;
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.dash-card:hover {
  border-color: var(--border2);
  box-shadow: var(--shadow-md);
}

.dash-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.dash-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.dash-card-title-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

/* Значок рисуется линиями, а не шрифтом: смайлик на каждой системе свой -
   плоский на одной, объёмный на другой, - и подстроить его под тёмную тему
   нельзя. Обводка берёт цвет из color, поэтому карточка задаёт оба тона. */
.dash-card-title-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}

.dash-card-title-icon.blue   { background: rgba(29,78,216,0.2);  color: var(--blue-light); }
.dash-card-title-icon.green  { background: rgba(16,185,129,0.2); color: var(--green); }
.dash-card-title-icon.amber  { background: rgba(245,158,11,0.2); color: var(--amber); }
.dash-card-title-icon.red    { background: rgba(239,68,68,0.2);  color: var(--red); }

/* Приглашение загрузить файл - единственное, что видно на пустом дашборде. */
.dash-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 420px;
  margin: 48px auto;
  padding: 32px 28px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.dash-empty[hidden] { display: none; }

.dash-empty svg {
  width: 34px;
  height: 34px;
  color: var(--text3);
}

.dash-empty h2 { font-size: 15px; font-weight: 600; }

.dash-empty p {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text2);
}

.dash-empty .btn { margin-top: 6px; }

.dash-card-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 100px;
  background: var(--electric-glow);
  border: 1px solid rgba(75, 131, 240,0.25);
  color: var(--electric);
  font-family: 'Golos Text', sans-serif;
  font-variant-numeric: tabular-nums;
}

.dash-card-chart {
  padding: 12px 24px 8px;
  position: relative;
  height: 160px;
}

.dash-card-chart canvas {
  width: 100% !important;
  height: 100% !important;
}

.dash-card-table-wrap {
  overflow: visible;
  padding: 0 0 8px;
}

/* ─── Tables ─────────────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th {
  padding: 8px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--surface);
}

.data-table th:last-child,
.data-table td:last-child { text-align: right; }

.data-table td {
  padding: 9px 16px;
  color: var(--text2);
  border-bottom: 1px solid rgba(30, 45, 69, 0.5);
  transition: background var(--transition-fast);
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tbody tr:hover td { background: var(--surface2); }

.data-table .rank {
  font-family: 'Golos Text', sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--text3);
  font-weight: 500;
}

/* Первое место: цифра в кружке вместо медали-смайлика. Смайлик здесь был
   единственным цветным пятном в таблице и ломал ряд по высоте. */
.data-table .rank-top {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(245,158,11,0.16);
  color: var(--amber);
  font-weight: 700;
}

/* «Все регионы охвачены» - галочка линиями вместо праздничного смайлика. */
.all-covered {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 13px;
  color: var(--green);
  padding: 16px 0;
  text-align: center;
}

.all-covered .ok-mark {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.data-table .name-cell {
  font-weight: 600;
  color: var(--text);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table .count-cell {
  font-family: 'Golos Text', sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 600;
  color: var(--electric);
}

.data-table .bar-cell {
  width: 100px;
}

.mini-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  overflow: hidden;
}

.mini-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--electric);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Uncovered Regions Card ─────────────────────────────────────────────── */
.uncovered-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  padding: 16px 24px;
}

.uncovered-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
}

.uncovered-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border2);
  flex-shrink: 0;
}

/* ─── Summary Stats Strip ────────────────────────────────────────────────── */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

@media (max-width: 900px) {
  .stats-strip { grid-template-columns: repeat(2, 1fr); }
}

.stats-strip-card {
  padding: 20px 24px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
}

.stats-strip-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
}

.stats-strip-value {
  font-family: 'Golos Text', sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1;
}

/* Цвет остаётся только там, где различает данные: победители, призёры,
   непокрытые регионы. Раньше своим цветом светилось каждое число, и радуга
   из четырёх оттенков сообщала не больше, чем один: «здесь цифра». */
.stats-strip-value.electric { color: var(--text); }
.stats-strip-value.green    { color: var(--text); }
.stats-strip-value.amber    { color: var(--amber); }
.stats-strip-value.red      { color: var(--red); }

.stats-strip-sub {
  font-size: 11px;
  color: var(--text3);
  margin-top: 2px;
}

/* ─── Neon Glow Utility ──────────────────────────────────────────────────── */

/* ─── Misc ───────────────────────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-mono {
  font-family: 'Golos Text', sans-serif;
  font-variant-numeric: tabular-nums;
}

.text-electric { color: var(--electric); }
.text-green    { color: var(--green); }
.text-amber    { color: var(--amber); }
.text-red      { color: var(--red); }
.text-muted    { color: var(--text2); }
.text-dimmed   { color: var(--text3); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-auto { margin-top: auto; }

/* ─── Animations ─────────────────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

.animate-fade-in    { animation: fadeIn 0.4s var(--transition-slow) both; }
.animate-scale-in   { animation: scaleIn 0.3s ease both; }
.animate-slide-in-r { animation: slideInRight 0.35s ease both; }

/* Stagger children */
.stagger-children > *:nth-child(1)  { animation-delay: 0ms; }
.stagger-children > *:nth-child(2)  { animation-delay: 60ms; }
.stagger-children > *:nth-child(3)  { animation-delay: 120ms; }
.stagger-children > *:nth-child(4)  { animation-delay: 180ms; }
.stagger-children > *:nth-child(5)  { animation-delay: 240ms; }
.stagger-children > *:nth-child(6)  { animation-delay: 300ms; }
.stagger-children > *:nth-child(7)  { animation-delay: 360ms; }
.stagger-children > *:nth-child(8)  { animation-delay: 420ms; }
.stagger-children > *:nth-child(9)  { animation-delay: 480ms; }
.stagger-children > *:nth-child(10) { animation-delay: 540ms; }

/* ══════════════════════════════════════════════════════════════════
   Отклик интерфейса: наведение, нажатие, появление окна.

   Прежде на этом месте лежал слой украшений: фоновые пятна по краям,
   сетка точек на дашборде, бегущая линия под шапкой, дышащее свечение
   вокруг знака, градиентный заголовок и синяя полоса прокрутки. Каждый
   приём по отдельности безобиден, вместе они дают ровно тот вид, по
   которому тёмная панель опознаётся как штампованная, и ни один из них
   не сообщает о данных ничего. Осталось то, что помогает работать.
   ══════════════════════════════════════════════════════════════════ */

.stats-strip-card {
  transition: border-color 200ms ease, background 200ms ease;
  cursor: default;
}

.stats-strip-card:hover { border-color: var(--border2); }

/* Число вместо вывески: 40px восьмого начертания читались как заголовок
   рекламной страницы, а не как показатель. */
.stats-strip-value {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.dash-card { transition: border-color 200ms ease; }
.dash-card:hover { border-color: var(--border2); }

.chip.active { background: rgba(75, 131, 240, 0.12); }

.sidebar-stat-card {
  transition: border-color 200ms ease, background 200ms ease;
  cursor: default;
}

.sidebar-stat-card:hover {
  border-color: var(--border2);
  background: var(--surface3);
}

.uncovered-item { transition: background 140ms ease, border-color 140ms ease; }

.uncovered-item:hover {
  background: var(--surface3);
  border-color: var(--border2);
}

.btn:active { transform: scale(0.98); transition-duration: 70ms; }

.modal-overlay.open .modal { animation: modal-in 180ms ease-out both; }

@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.dropzone:hover,
.dropzone.drag-over {
  border-color: var(--electric);
  background: rgba(75, 131, 240, 0.05);
}
