/* ============================================================
   Баланс газа Грузии — стили дашборда
   ============================================================ */
:root {
  color-scheme: light;
  --font: "Golos Text Variable", -apple-system, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;

  --bg: #eef1f6;
  --bg-2: #e6ebf3;
  --text: #16202e;
  --text-2: #5b6472;
  --text-3: #8a93a1;
  --line: rgba(22, 32, 46, 0.08);
  --line-2: rgba(22, 32, 46, 0.14);
  --surface: #fcfcfd;
  --glass: rgba(255, 255, 255, 0.64);
  --glass-2: rgba(255, 255, 255, 0.82);
  --glass-border: rgba(255, 255, 255, 0.75);
  --glass-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 14px 36px -16px rgba(16, 24, 40, 0.18);
  --accent: #1f5ad6;
  --accent-soft: rgba(31, 90, 214, 0.1);
  --good: #0ca30c;
  --bad: #d03b3b;
  --warn: #c98500;
  --good-soft: rgba(12, 163, 12, 0.12);
  --bad-soft: rgba(208, 59, 59, 0.12);
  --warn-soft: rgba(201, 133, 0, 0.14);
  --chip: rgba(22, 32, 46, 0.06);
  --chip-hover: rgba(22, 32, 46, 0.1);
  --pill-active: #ffffff;

  /* серии (валидированы scripts/validate_palette.js) */
  --c-blue: #2a78d6;
  --c-red: #e34948;
  --c-aqua: #1baf7a;
  --c-orange: #eb6834;
  --c-yellow: #eda100;
  --c-magenta: #e87ba4;
  --c-green: #008300;
  --c-violet: #4a3aa7;
  --c-blue-1: #6da7ec;
  --c-blue-2: #256abf;
  --c-blue-3: #0d366b;
  --c-gray: #9aa3ae;
  --c-gray-2: #cfd4db;
  --c-grid: rgba(22, 32, 46, 0.07);
  --c-axis: #8a93a1;

  --aurora-1: #bcd6ff;
  --aurora-2: #ffe3ad;
  --aurora-3: #c9f1e0;
  --aurora-4: #f6d2e4;

  --radius-xl: 24px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --gap: 16px;
  --page-pad: clamp(16px, 3vw, 40px);
  --topbar-h: 64px;
}

:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] { color-scheme: dark; } }

:root[data-theme="dark"],
:root[data-theme="auto"]:not([data-theme="light"]) {
  /* значения перекрываются ниже при тёмной схеме */
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] { --is-dark: 1; }
}

:root[data-theme="dark"], :root.dark {
  --bg: #0b1020;
  --bg-2: #0f1628;
  --text: #eef2f8;
  --text-2: #aab3c2;
  --text-3: #76809a;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --surface: #141a28;
  --glass: rgba(22, 29, 46, 0.62);
  --glass-2: rgba(22, 29, 46, 0.86);
  --glass-border: rgba(255, 255, 255, 0.09);
  --glass-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 18px 40px -18px rgba(0, 0, 0, 0.6);
  --accent: #5b9cff;
  --accent-soft: rgba(91, 156, 255, 0.16);
  --good: #3dbb3d;
  --bad: #f06a6a;
  --warn: #e3a32d;
  --good-soft: rgba(61, 187, 61, 0.16);
  --bad-soft: rgba(240, 106, 106, 0.16);
  --warn-soft: rgba(227, 163, 45, 0.18);
  --chip: rgba(255, 255, 255, 0.08);
  --chip-hover: rgba(255, 255, 255, 0.14);
  --pill-active: rgba(255, 255, 255, 0.14);

  --c-blue: #3987e5;
  --c-red: #e66767;
  --c-aqua: #199e70;
  --c-orange: #d95926;
  --c-yellow: #c98500;
  --c-magenta: #d55181;
  --c-green: #2e9e2e;
  --c-violet: #9085e9;
  --c-blue-1: #9ec5f4;
  --c-blue-2: #3987e5;
  --c-blue-3: #1c5cab;
  --c-gray: #7f8899;
  --c-gray-2: #3b4457;
  --c-grid: rgba(255, 255, 255, 0.07);
  --c-axis: #76809a;

  --aurora-1: #1b3a7a;
  --aurora-2: #5a3d14;
  --aurora-3: #124a3a;
  --aurora-4: #4a1f3c;
}

/* ---------- базовое ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.45; color: var(--text);
  background: var(--bg); min-height: 100vh; -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01"; transition: background-color .3s, color .3s;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select { font: inherit; color: inherit; }
svg { display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- фон-аврора ---------- */
.aurora { position: fixed; inset: -10% -10% -10% -10%; z-index: 0; pointer-events: none; overflow: hidden; filter: blur(70px) saturate(120%); opacity: .9; }
.aurora i { position: absolute; border-radius: 50%; mix-blend-mode: normal; animation: drift 46s ease-in-out infinite alternate; }
.aurora i:nth-child(1) { width: 52vw; height: 52vw; left: -8vw; top: -12vw; background: var(--aurora-1); }
.aurora i:nth-child(2) { width: 44vw; height: 44vw; right: -6vw; top: -4vw; background: var(--aurora-2); animation-delay: -12s; }
.aurora i:nth-child(3) { width: 48vw; height: 48vw; left: 26vw; bottom: -20vw; background: var(--aurora-3); animation-delay: -24s; }
.aurora i:nth-child(4) { width: 30vw; height: 30vw; right: 18vw; bottom: -6vw; background: var(--aurora-4); animation-delay: -36s; }
@keyframes drift { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(6vw, 4vw, 0) scale(1.08); } }
:root[data-theme="dark"] .aurora, :root.dark .aurora { opacity: .7; }
@media (prefers-reduced-motion: reduce) { .aurora i { animation: none; } html { scroll-behavior: auto; } }

/* ---------- верхняя панель ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px; padding: 0 var(--page-pad);
  background: var(--glass); backdrop-filter: saturate(180%) blur(22px); -webkit-backdrop-filter: saturate(180%) blur(22px);
  border-bottom: 1px solid var(--glass-border);
}
.brand { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; min-width: 150px; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--c-blue), var(--c-aqua)); position: relative; box-shadow: 0 4px 12px -4px rgba(42, 120, 214, .6); }
.brand-mark::after { content: ""; position: absolute; left: 7px; right: 7px; bottom: 7px; height: 12px; background:
  linear-gradient(#fff, #fff) 0 100% / 3px 70% no-repeat, linear-gradient(#fff, #fff) 50% 100% / 3px 100% no-repeat, linear-gradient(#fff, #fff) 100% 100% / 3px 50% no-repeat; border-radius: 2px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-weight: 600; font-size: 14px; letter-spacing: -0.01em; }
.brand-text span { font-size: 11px; color: var(--text-3); }

.tabs { display: flex; gap: 4px; margin: 0 auto; padding: 4px; border-radius: 999px; background: var(--chip); overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 999px; white-space: nowrap; color: var(--text-2); font-weight: 500; font-size: 13px; transition: background .2s, color .2s, box-shadow .2s; }
.tab svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab:hover { color: var(--text); background: var(--chip-hover); }
.tab.active { background: var(--pill-active); color: var(--text); box-shadow: 0 1px 2px rgba(16, 24, 40, .08), 0 4px 12px -6px rgba(16, 24, 40, .18); }
.tab kbd { display: none; }

.topbar-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.icon-btn { width: 38px; height: 38px; border-radius: 999px; display: inline-grid; place-items: center; color: var(--text-2); transition: background .2s, color .2s; }
.icon-btn:hover { background: var(--chip-hover); color: var(--text); }
.icon-btn svg, .btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 999px; font-weight: 500; font-size: 13px; background: var(--chip); color: var(--text); transition: background .2s, transform .1s; position: relative; }
.btn:hover { background: var(--chip-hover); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-ghost { background: transparent; border: 1px solid var(--line-2); }
.btn-ghost:hover { background: var(--chip); }
.btn-params em { position: absolute; top: -4px; right: -2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--c-orange); color: #fff; font-style: normal; font-size: 11px; font-weight: 600; display: grid; place-items: center; }
.icon-btn .ico-moon { display: none; }
:root[data-theme="dark"] .icon-btn .ico-sun, :root.dark .icon-btn .ico-sun { display: none; }
:root[data-theme="dark"] .icon-btn .ico-moon, :root.dark .icon-btn .ico-moon { display: block; }

/* ---------- основная область ---------- */
.main { position: relative; z-index: 1; padding: 22px var(--page-pad) 40px; max-width: 1560px; margin: 0 auto; }
.loading { display: flex; align-items: center; gap: 10px; color: var(--text-2); padding: 60px 0; justify-content: center; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.page { display: none; }
.page.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 6px 0 18px; }
.page-head h1 { font-size: clamp(26px, 3.2vw, 36px); font-weight: 600; letter-spacing: -0.025em; line-height: 1.08; }
.page-head .lead { color: var(--text-2); margin-top: 6px; font-size: 14px; max-width: 70ch; }
.page-head .meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.tag { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; background: var(--chip); color: var(--text-2); font-size: 12px; font-weight: 500; }
.tag b { color: var(--text); font-weight: 600; }
.tag.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }

/* строка фильтров */
.filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--chip); gap: 2px; }
.seg button { padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--text-2); transition: background .2s, color .2s; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--pill-active); color: var(--text); box-shadow: 0 1px 2px rgba(16, 24, 40, .08), 0 3px 10px -6px rgba(16, 24, 40, .18); }
.seg button i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.filters label { font-size: 12px; color: var(--text-3); margin-right: -4px; }
.seg.small button { padding: 4px 10px; font-size: 12px; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.kpi {
  position: relative; padding: 16px 18px 14px; border-radius: var(--radius-lg); background: var(--glass); border: 1px solid var(--glass-border);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); box-shadow: var(--glass-shadow); cursor: pointer; text-align: left; overflow: hidden;
  transition: transform .2s, box-shadow .2s; display: flex; flex-direction: column; gap: 6px; min-height: 128px;
}
.kpi:hover { transform: translateY(-2px); box-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 20px 40px -18px rgba(16, 24, 40, .28); }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--kpi-color, var(--c-blue)); opacity: .9; }
.kpi .kpi-label { font-size: 12.5px; color: var(--text-2); font-weight: 500; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.kpi .kpi-value { font-size: 30px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.05; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.kpi .kpi-value small { font-size: 13px; font-weight: 500; color: var(--text-3); letter-spacing: 0; }
.kpi .kpi-sub { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.delta { display: inline-flex; align-items: center; gap: 3px; height: 20px; padding: 0 7px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--chip); color: var(--text-2); white-space: nowrap; }
.delta.up { background: var(--good-soft); color: var(--good); }
.delta.down { background: var(--bad-soft); color: var(--bad); }
.delta.warn { background: var(--warn-soft); color: var(--warn); }
.delta svg { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.kpi .spark { position: absolute; right: 14px; bottom: 12px; width: 70px; height: 26px; opacity: .95; }
.kpi.has-spark .kpi-sub { padding-right: 76px; }
.kpi .spark path.l { fill: none; stroke: var(--kpi-color, var(--c-blue)); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.kpi .spark path.a { fill: var(--kpi-color, var(--c-blue)); opacity: .12; }
.kpi .spark circle { fill: var(--kpi-color, var(--c-blue)); stroke: var(--surface); stroke-width: 2; }
.kpi .kpi-info { width: 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center; color: var(--text-3); flex: 0 0 auto; }
.kpi .kpi-info:hover { background: var(--chip); color: var(--text); }
.kpi .kpi-info svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.8; }

/* ---------- сетка карточек ---------- */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); }
.card {
  grid-column: span var(--span, 4); position: relative; border-radius: var(--radius-xl); background: var(--glass); border: 1px solid var(--glass-border);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); box-shadow: var(--glass-shadow); display: flex; flex-direction: column; min-width: 0;
  transition: box-shadow .3s;
}
.card.flash { box-shadow: 0 0 0 3px var(--accent-soft), var(--glass-shadow); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 18px 20px 6px; }
.card-head h3 { font-size: 16px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.25; }
.card-head .sub { color: var(--text-3); font-size: 12.5px; margin-top: 3px; }
.card-tools { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.card-body { position: relative; flex: 1; padding: 6px 12px 12px; min-height: 0; display: flex; flex-direction: column; }
.chart { width: 100%; height: var(--h, 300px); flex: 1 0 auto; min-height: 0; }
.card.text-card .card-body { display: block; }
.card-foot { padding: 0 20px 14px; font-size: 12px; color: var(--text-3); }
.card.text-card .card-body { padding: 4px 20px 18px; }
.card .legend-html { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 2px 8px 6px; font-size: 12.5px; color: var(--text-2); }
.legend-html span { display: inline-flex; align-items: center; gap: 6px; }
.legend-html i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend-html i.line { height: 3px; width: 14px; border-radius: 2px; }
.legend-html i.dash { background: repeating-linear-gradient(90deg, currentColor 0 4px, transparent 4px 7px); height: 2px; width: 16px; }
.legend-html b { color: var(--text); font-weight: 600; }

/* таблица внутри карточки */
.table-wrap { overflow: auto; max-height: 420px; border-radius: var(--radius-md); }
table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data th, table.data td { padding: 7px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
table.data th { font-weight: 600; color: var(--text-2); position: sticky; top: 0; background: var(--glass-2); backdrop-filter: blur(10px); z-index: 1; }
table.data th:first-child, table.data td:first-child { text-align: left; white-space: normal; min-width: 110px; font-variant-numeric: normal; }
table.data caption { caption-side: top; text-align: left; font-size: 11.5px; color: var(--text-3); padding: 0 10px 6px; }
table.data tr:hover td { background: var(--chip); }
table.data td.neg { color: var(--bad); }
table.data td.dim, table.data th.dim { color: var(--text-3); }
table.data .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: 0; }
table.data td.sec { color: var(--text-3); font-weight: 600; text-align: left; padding-top: 12px; }

/* сноски и примечания */
.notes { margin-top: var(--gap); border-radius: var(--radius-lg); background: var(--glass); border: 1px solid var(--glass-border); backdrop-filter: blur(24px); padding: 4px 20px; }
.notes details { padding: 10px 0; }
.notes summary { cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--text-2); list-style: none; display: flex; align-items: center; gap: 8px; }
.notes summary::-webkit-details-marker { display: none; }
.notes summary::before { content: ""; width: 7px; height: 7px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(-45deg); transition: transform .2s; margin-left: 2px; }
.notes details[open] summary::before { transform: rotate(45deg); }
.notes p, .notes li { font-size: 12.5px; color: var(--text-2); line-height: 1.55; margin: 8px 0 0; max-width: 120ch; }
.notes ul { margin: 6px 0 0; padding-left: 18px; }

/* текстовые наблюдения */
.obs { display: grid; gap: 12px; }
.obs-item { display: grid; grid-template-columns: 4px 1fr; gap: 14px; }
.obs-item i { border-radius: 2px; background: var(--c, var(--c-blue)); }
.obs-item h4 { font-size: 14px; font-weight: 600; margin-bottom: 3px; }
.obs-item p { font-size: 13px; color: var(--text-2); line-height: 1.5; }

/* всплывающее меню карточки */
.menu { position: absolute; z-index: 40; min-width: 220px; padding: 6px; border-radius: var(--radius-md); background: var(--glass-2); border: 1px solid var(--glass-border); backdrop-filter: blur(24px); box-shadow: 0 20px 48px -16px rgba(16, 24, 40, .35); display: flex; flex-direction: column; gap: 2px; animation: pop .15s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.menu button { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; font-size: 13px; text-align: left; color: var(--text); }
.menu button:hover { background: var(--chip-hover); }
.menu button svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 6px; }
.menu .menu-title { padding: 6px 10px 2px; font-size: 11px; color: var(--text-3); font-weight: 600; }

/* popover источника */
.pop { position: absolute; z-index: 41; max-width: 360px; padding: 12px 14px; border-radius: var(--radius-md); background: var(--glass-2); border: 1px solid var(--glass-border); backdrop-filter: blur(24px); box-shadow: 0 20px 48px -16px rgba(16, 24, 40, .35); font-size: 12.5px; color: var(--text-2); line-height: 1.5; animation: pop .15s ease; }
.pop b { color: var(--text); display: block; margin-bottom: 4px; font-size: 13px; }

/* ---------- панель параметров ---------- */
.scrim { position: fixed; inset: 0; z-index: 48; background: transparent; pointer-events: none; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.drawer { position: fixed; top: 10px; right: 10px; bottom: 10px; width: min(440px, calc(100vw - 20px)); z-index: 49; border-radius: var(--radius-xl); background: var(--glass-2); border: 1px solid var(--glass-border); backdrop-filter: blur(28px); box-shadow: 0 30px 80px -20px rgba(16, 24, 40, .45); display: flex; flex-direction: column; transform: translateX(calc(100% + 20px)); visibility: hidden; transition: transform .35s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .35s; }
.drawer.open { transform: none; visibility: visible; transition: transform .35s cubic-bezier(.2, .8, .2, 1), visibility 0s; }
.drawer-head h2 { white-space: nowrap; }
.drawer-head { padding: 18px 20px 12px; display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 18px; }
.drawer-head p { color: var(--text-3); font-size: 12.5px; margin-top: 3px; }
.drawer-head-actions { display: flex; gap: 6px; align-items: center; flex: 0 0 auto; }
.drawer-head .btn-ghost .short { display: none; }
.drawer-body { overflow: auto; padding: 8px 20px 24px; }
.pgroup { padding: 12px 0; border-bottom: 1px solid var(--line); }
.pgroup:last-child { border-bottom: 0; }
.pgroup > summary { cursor: pointer; font-weight: 600; font-size: 14px; display: flex; align-items: center; justify-content: space-between; list-style: none; padding: 4px 0; }
.pgroup > summary::-webkit-details-marker { display: none; }
.pgroup > summary .cnt { font-size: 11px; color: var(--c-orange); font-weight: 600; }
.prow { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 8px 0; }
.prow .pl { font-size: 13px; color: var(--text); }
.prow .ph { grid-column: 1 / -1; font-size: 11.5px; color: var(--text-3); }
.prow .ph b { color: var(--text-2); font-weight: 500; }
.prow input[type="number"] { width: 92px; height: 32px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--surface); padding: 0 8px; text-align: right; font-variant-numeric: tabular-nums; }
.prow input[type="number"]:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.prow input[type="range"] { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); margin: 2px 0 0; }
.prow.changed .pl::after { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--c-orange); margin-left: 7px; vertical-align: middle; }
.prow .seg { justify-self: end; }
.prow .seg button { padding: 4px 10px; font-size: 12px; }
.prow .unit { font-size: 11.5px; color: var(--text-3); margin-left: 6px; }
.prow .with-unit { display: flex; align-items: center; justify-self: end; }
.prow .scen3 { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.prow .scen3 label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--text-3); }
.prow .scen3 input { width: 100%; }

/* ---------- поиск ---------- */
.palette { position: fixed; inset: 0; z-index: 60; background: rgba(10, 14, 24, .3); backdrop-filter: blur(3px); display: grid; place-items: start center; padding-top: 12vh; animation: fadein .15s ease; }
.palette-box { width: min(620px, calc(100vw - 24px)); border-radius: var(--radius-lg); background: var(--glass-2); border: 1px solid var(--glass-border); backdrop-filter: blur(28px); box-shadow: 0 40px 100px -20px rgba(16, 24, 40, .5); overflow: hidden; animation: pop .18s ease; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.palette-input svg { width: 18px; height: 18px; stroke: var(--text-3); fill: none; stroke-width: 1.8; }
.palette-input input { flex: 1; border: 0; background: transparent; font-size: 16px; outline: none; }
.palette-input kbd { font: 11px var(--font); color: var(--text-3); border: 1px solid var(--line-2); border-radius: 6px; padding: 2px 6px; }
.palette-list { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow: auto; }
.palette-list li { padding: 9px 10px; border-radius: 10px; display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; }
.palette-list li .k { font-size: 11px; color: var(--text-3); margin-left: auto; white-space: nowrap; }
.palette-list li.active, .palette-list li:hover { background: var(--chip-hover); }
.palette-list li i { width: 8px; height: 8px; border-radius: 50%; background: var(--c-blue); flex: 0 0 auto; }
.palette-list .empty { color: var(--text-3); padding: 14px 10px; }

/* ---------- модальные окна и тосты ---------- */
.modal { position: fixed; inset: 0; z-index: 70; background: rgba(10, 14, 24, .35); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 20px; animation: fadein .15s ease; }
.modal-box { width: min(560px, 100%); max-height: 86vh; overflow: auto; border-radius: var(--radius-xl); background: var(--glass-2); border: 1px solid var(--glass-border); backdrop-filter: blur(28px); box-shadow: 0 40px 100px -20px rgba(16, 24, 40, .5); padding: 22px 24px; animation: pop .18s ease; }
.modal-box h2 { font-size: 20px; margin-bottom: 6px; }
.modal-box p { color: var(--text-2); font-size: 13.5px; line-height: 1.5; margin: 8px 0; }
.modal-box .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.modal-box input[type="password"], .modal-box input[type="text"] { width: 100%; height: 38px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); padding: 0 12px; margin: 6px 0 10px; }
.modal-box input[type="file"] { width: 100%; margin: 6px 0 10px; }
.modal-box ul { padding-left: 18px; color: var(--text-2); font-size: 13px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80; padding: 10px 16px; border-radius: 999px; background: var(--text); color: var(--bg); font-size: 13px; font-weight: 500; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .5); animation: pop .2s ease; max-width: calc(100vw - 32px); }

.site-footer { position: relative; z-index: 1; padding: 10px var(--page-pad) 30px; color: var(--text-3); font-size: 12px; max-width: 1560px; margin: 0 auto; display: flex; gap: 14px; flex-wrap: wrap; }

/* ---------- адаптив ---------- */
@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .card { grid-column: span 6; }
  .card[data-span="12"] { grid-column: span 12; }
}
@media (max-width: 1024px) {
  .tab span { display: none; }
  .tab { padding: 8px 10px; }
  .btn-params span { display: none; }
  .brand { min-width: auto; }
}
@media (max-width: 760px) {
  :root { --topbar-h: 56px; --gap: 12px; }
  .kpi.has-spark .kpi-sub { padding-right: 0; }
  .filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  .filters::-webkit-scrollbar { display: none; }
  .filters label { white-space: nowrap; }
  .scrim { background: rgba(10, 14, 24, .35); pointer-events: auto; }
  .drawer-head h2 { font-size: 16px; }
  .drawer-head .btn-ghost .full { display: none; }
  .drawer-head .btn-ghost .short { display: inline; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head > div:last-child { max-width: 100%; }
  .topbar { gap: 8px; }
  .brand-text { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi .kpi-value { font-size: 24px; }
  .kpi .spark { display: none; }
  .card, .card[data-span] { grid-column: span 12; }
  .chart { height: min(var(--h, 300px), 320px); }
  .page-head h1 { font-size: 26px; }
  .drawer { top: auto; height: 88vh; width: calc(100vw - 20px); border-radius: var(--radius-xl) var(--radius-xl) 0 0; transform: translateY(110%); left: 10px; right: 10px; bottom: 0; }
  .drawer.open { transform: none; }
}

/* ---------- печать ---------- */
@media print {
  .aurora, .topbar, .site-footer, .drawer, .scrim, .palette, .menu, .toast, .card-tools, .filters, .kpi .kpi-info { display: none !important; }
  body { background: #fff; color: #000; }
  .main { padding: 0; max-width: none; }
  .card, .kpi, .notes { background: #fff; border: 1px solid #ddd; box-shadow: none; backdrop-filter: none; break-inside: avoid; }
  .grid { gap: 10px; }
  .card { grid-column: span 6 !important; }
}
