/* Вкладка «Аналитика»: карточки показателей, графики и таблицы.
   Палитра и типографика те же, что на вкладке работы с данными, — это один
   инструмент, а не два разных приложения. */

#analytics { max-width: none; }

.an-bar {
  display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 18px; margin-bottom: 16px;
}
.an-bar .fld { display: flex; flex-direction: column; gap: 4px; }
.an-bar label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.an-bar select {
  border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px;
  font: inherit; font-size: 14px; background: #fff; min-width: 190px; color: var(--text);
}
.an-bar .grow { flex: 1; }
.an-bar .stamp { font-size: 12.5px; color: var(--muted); text-align: right; line-height: 1.5; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px;
}
.kpi .v { font-size: 23px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi .l { color: var(--muted); font-size: 12px; margin-top: 4px; }
.kpi .n { font-size: 12px; margin-top: 6px; color: var(--muted); }
.kpi .n b { color: var(--text); font-weight: 600; }
.kpi.hl { border-color: #bcd7ff; background: linear-gradient(180deg, #f5f9ff, #fff); }

.an-grid { display: grid; gap: 16px; margin-bottom: 16px; }
.an-grid.two { grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); }
.an-grid.three { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.an-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 18px 20px; min-width: 0;
}
.an-card h3 { margin: 0 0 3px; font-size: 15px; font-weight: 650; }
.an-card .sub { margin: 0 0 14px; color: var(--muted); font-size: 12.5px; }
.an-card .box { position: relative; height: 280px; }
.an-card .box.tall { height: 340px; }
.an-card .box.flex { height: auto; min-height: 240px; }

/* Полоса исполнения бюджета */
.flow { display: grid; gap: 10px; }
.flow-row { display: grid; grid-template-columns: 210px 1fr 150px; gap: 12px; align-items: center; }
.flow-row .nm { font-size: 13px; color: var(--muted); }
.flow-row .track { background: #eef1f5; border-radius: 6px; height: 22px; overflow: hidden; }
.flow-row .fill { height: 100%; border-radius: 6px; }
.flow-row .val { text-align: right; font-size: 13px; font-variant-numeric: tabular-nums; font-weight: 600; }
.flow-note { margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.flow-head { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-weight: 600; margin: 4px 0 -2px; }
.flow-row .nm .tag { margin-left: 6px; }

/* Метки источника данных: что из электронного бюджета, а что — наше из ЕИС */
.tag { display: inline-block; font-size: 10.5px; font-weight: 650; letter-spacing: .04em;
  padding: 2px 6px; border-radius: 5px; vertical-align: middle; }
.tag.eb { background: #e7effb; color: #1f4e8c; }
.tag.eis { background: #e6f4ee; color: #0f6b4a; }

.an-src { margin-bottom: 16px; }
.an-src h4 { margin: 0 0 8px; font-size: 13px; font-weight: 650; color: var(--text); }
.an-src .kpis { margin-bottom: 0; }

/* Плитки акцентных групп АТХ */
.atc-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 10px; }
.atc-tile {
  border: 1px solid var(--line); border-radius: 9px; padding: 12px 14px; background: #fbfcfd;
  cursor: pointer; transition: border-color .12s, transform .12s;
}
.atc-tile:hover { border-color: var(--accent); transform: translateY(-1px); }
.atc-tile.on { border-color: var(--accent); background: #f2f7ff; }
.atc-tile .p { font-size: 21px; font-weight: 650; font-variant-numeric: tabular-nums; }
.atc-tile .t { font-size: 12.5px; margin-top: 2px; }
.atc-tile .s { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.atc-tile .bar { height: 4px; border-radius: 3px; background: #e3e8ef; margin-top: 8px; overflow: hidden; }
.atc-tile .bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }

.an-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.an-table th, .an-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.an-table th { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; font-weight: 550; text-align: left; }
.an-table td.num, .an-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.an-table tbody tr:hover { background: #f7f9fc; }
.an-scroll { max-height: 430px; overflow: auto; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11.5px; white-space: nowrap; }
.pill.ok { background: #e7f5ec; color: var(--ok); }
.pill.warn { background: #fdf3e3; color: var(--warn); }
.pill.err { background: #fdeceb; color: var(--err); }
.pill.mute { background: #eef1f5; color: var(--muted); }

.an-empty { color: var(--muted); font-size: 13.5px; padding: 26px 0; text-align: center; }

@media (max-width: 780px) {
  .flow-row { grid-template-columns: 1fr; gap: 4px; }
  .flow-row .val { text-align: left; }
  .an-bar .stamp { text-align: left; }
}

/* Кнопка «Проверить» в строке сверки: открывает разбор статьи. Вид скромный —
   она стоит внутри таблицы и не должна перетягивать внимание с чисел. */
.an-audit-btn {
  border: 1px solid #c7d2e1;
  background: #fff;
  color: #1f6feb;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.an-audit-btn:hover { background: #f3f7fd; border-color: #1f6feb; }
