:root {
  --bg: #f6f6f4; --surface: #ffffff; --text: #0b0b0b; --text2: #52514e; --muted: #8a8984;
  --line: #e4e3df; --accent: #2a78d6; --x: #2a78d6; --m: #eb6834; --warn-bg: #fff6e0; --warn: #8a5a00;
  --err-bg: #fde8e8; --err: #a01d1d;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
header { background: var(--surface); border-bottom: 1px solid var(--line); padding: 12px 16px 0; position: sticky; top: 0; z-index: 5; }
.head-row { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: baseline; justify-content: space-between; }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 16px; margin: 24px 0 8px; }
.source { color: var(--text2); font-size: 12px; }
.notice { background: var(--warn-bg); color: var(--warn); border-radius: 6px; padding: 6px 10px; margin: 8px 0; font-size: 12px; }
nav { display: flex; gap: 2px; overflow-x: auto; }
nav button { border: 0; background: none; padding: 8px 12px; cursor: pointer; color: var(--text2); border-bottom: 2px solid transparent; white-space: nowrap; font: inherit; }
nav button.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
main { padding: 16px; max-width: 1400px; overflow-x: hidden; margin: 0 auto; }
.hidden { display: none !important; }
.error { background: var(--err-bg); color: var(--err); padding: 10px 12px; border-radius: 6px; margin-bottom: 12px; white-space: pre-wrap; }
.note { color: var(--text2); font-size: 13px; margin: 6px 0 10px; }
.hint { color: var(--muted); font-size: 12px; }
.chart { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; height: 380px; margin-bottom: 12px; }
.chart.tall { height: 480px; } .chart.xtall { height: 620px; } .chart.small { height: 260px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.kpi .l { color: var(--text2); font-size: 12px; } .kpi .v { font-size: 24px; font-weight: 650; }
.kpi .d { font-size: 12px; color: var(--text2); }
.controls { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-bottom: 10px; }
select, input { font: inherit; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 5px 12px; cursor: pointer; font: inherit; }
.seg button.active { background: var(--accent); color: #fff; }
button.primary, .tb-actions button { font: inherit; border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 5px 12px; cursor: pointer; }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.table-box { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 12px; }
.tb-actions { display: flex; gap: 6px; justify-content: space-between; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tb-actions .t { font-weight: 600; font-size: 13px; }
.tb-scroll { max-height: 460px; overflow: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 5px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; max-width: 520px; overflow: hidden; text-overflow: ellipsis; }
th { position: sticky; top: 0; background: #fafaf8; font-weight: 600; color: var(--text2); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.click { cursor: pointer; } tr.click:hover td { background: #eef4fc; }
tr.flag td { background: #f3f3f1; color: var(--text2); }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }
.detail { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px; min-height: 200px; overflow: hidden; }
.detail h3 { margin: 0 0 6px; }
.results { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; max-height: 260px; overflow: auto; }
.results a { padding: 4px 8px; border-radius: 4px; cursor: pointer; color: var(--text); text-decoration: none; }
.results a:hover { background: #eef4fc; } .results code { font-weight: 600; margin-right: 8px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 12px; }
@media (max-width: 500px) { .cards { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.card h3 { font-size: 15px; margin: 0 0 4px; } .card .sub { color: var(--text2); font-size: 12px; margin-bottom: 6px; }
.card .chart { border: 0; height: 240px; margin: 0; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: #eef4fc; color: #1d5aa5; }
.badge.hi { background: var(--err-bg); color: var(--err); } .badge.mid { background: var(--warn-bg); color: var(--warn); }
.crumbs a { cursor: pointer; color: var(--accent); }
footer { color: var(--muted); font-size: 12px; padding: 16px; text-align: center; }
@media (max-width: 700px) {
  /* при прокрутке видны только вкладки (см. pinTabs в app.js) */
  header { padding-top: 10px; }
  h1 { font-size: 18px; }
  .source, .notice { font-size: 11px; }
  nav button { padding: 8px 10px; }
}
.loading { color: var(--muted); padding: 20px; }
