/* Общий набор интерфейса стендов «Обезличиватель» и «Синтетика».
   Тёмная деловая тема в одной линейке с витриной «Слабые сигналы»: глубокий синий, бирюза — действие и
   «синтетика», золото — акцент и «важное». Шрифт Manrope лежит локально (OFL), внешних CDN нет:
   стенд работает в закрытом контуре. Файл одинаковый в обоих проектах — источник: _hq/gpb/ui-kit/. */

@font-face {
  font-family: "Manrope Variable"; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url(/static/fonts/manrope-latin-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Manrope Variable"; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url(/static/fonts/manrope-cyrillic-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

:root {
  --bg: #070d1a; --bg-2: #0a1324; --card: #0f1a2c; --card-2: #13213a;
  --panel: rgba(11, 20, 38, .8); --glass: rgba(10, 19, 36, .9);
  --line: rgba(148, 178, 220, .16); --line-2: rgba(148, 178, 220, .28); --line-3: rgba(148, 178, 220, .42);
  --ink: #e8eef8; --ink-2: #c3cfe0; --muted: #9aabc4; --faint: #7486a3;
  --teal: #2dd4bf; --teal-2: #22b8a6; --teal-soft: rgba(45, 212, 191, .14); --teal-line: rgba(45, 212, 191, .45);
  --gold: #e8b54a; --gold-soft: rgba(232, 181, 74, .14); --gold-line: rgba(232, 181, 74, .45);
  --ok: #5fd39a; --ok-soft: rgba(95, 211, 154, .13); --ok-line: rgba(95, 211, 154, .4);
  --bad: #f0846c; --bad-soft: rgba(217, 120, 92, .14); --bad-line: #d9785c; --bad-ink: #ffd2c2;
  --warn: #f2c46d; --warn-soft: rgba(232, 181, 74, .12);
  /* ряды графиков: «реальные» — спокойный графит, «синтетика» — бирюза (контраст ≥ 3:1 на --card) */
  --real: #8fa3c2; --syn: #2dd4bf;
  --radius: 14px; --radius-s: 10px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .35); --shadow-s: 0 6px 20px rgba(0, 0, 0, .25);
  --font: "Manrope Variable", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --gutter: clamp(16px, 3vw, 36px);
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; color: var(--ink); overflow-x: hidden;
  background:
    radial-gradient(1200px 620px at 78% -12%, rgba(45, 212, 191, .10), transparent 62%),
    radial-gradient(900px 520px at -4% 8%, rgba(64, 110, 200, .15), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  font: 16px/1.55 var(--font); -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 0;
}
a { color: var(--teal); text-underline-offset: 3px; }
a:hover { color: #6ff0de; }
::selection { background: rgba(45, 212, 191, .35); color: #fff; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.015em; }
p { margin: 0 0 12px; }
code, kbd { font-family: var(--mono); font-size: .88em; background: rgba(148, 178, 220, .1);
  border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; color: var(--ink-2); }
kbd { border-bottom-width: 2px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--card); color: var(--ink);
  padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }

/* полосы прокрутки в тон */
* { scrollbar-width: thin; scrollbar-color: rgba(148, 178, 220, .3) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(148, 178, 220, .25); border-radius: 10px; border: 2px solid transparent;
  background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(148, 178, 220, .4); }

/* ---------- верхняя полоса ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px var(--gutter); border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(7, 13, 26, .94), rgba(7, 13, 26, .78)); backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; text-decoration: none; color: inherit; }
.logo { width: 38px; height: 38px; flex: none; }
.brand-name, .brand-sub { display: block; }
.brand-name { font-weight: 780; font-size: 17px; letter-spacing: -.01em; line-height: 1.2; }
.brand-sub { color: var(--muted); font-size: 12.5px; line-height: 1.3; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); white-space: nowrap;
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; background: rgba(15, 26, 44, .6);
}
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.pill.ok .dot { background: var(--ok); box-shadow: 0 0 0 4px rgba(95, 211, 154, .15); }
.pill.warn .dot { background: var(--gold); box-shadow: 0 0 0 4px rgba(232, 181, 74, .15); }
.pill.bad .dot { background: var(--bad-line); }
.trl { border: 1px solid var(--gold-line); background: var(--gold-soft); color: #f6d68f; border-radius: 999px;
  padding: 5px 12px; font-size: 12px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; cursor: help; }

/* ---------- шаги (вкладки) ---------- */
.steps {
  position: sticky; top: 63px; z-index: 25; display: flex; gap: 6px; padding: 10px var(--gutter);
  overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
  background: rgba(7, 13, 26, .82); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.steps::-webkit-scrollbar { display: none; }
.steps button {
  display: inline-flex; align-items: center; gap: 9px; flex: none; cursor: pointer; font: inherit;
  font-size: 14px; font-weight: 650; color: var(--ink-2); background: transparent;
  border: 1px solid transparent; border-radius: 11px; padding: 7px 13px 7px 8px;
  transition: background .15s, border-color .15s, color .15s;
}
.steps button .n {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; flex: none;
  font-size: 12px; font-weight: 800; color: var(--muted); border: 1px solid var(--line-2);
  background: rgba(7, 13, 26, .6); font-variant-numeric: tabular-nums; transition: inherit;
}
.steps button:hover { background: rgba(45, 212, 191, .07); border-color: var(--line); color: var(--ink); }
.steps button.on { color: var(--teal); background: var(--teal-soft); border-color: rgba(45, 212, 191, .35); }
.steps button.on .n { background: var(--teal); border-color: var(--teal); color: #04201c; }
.steps button.done .n { border-color: var(--teal-line); color: var(--teal); }
.steps button.on.done .n { color: #04201c; }

/* ---------- главный экран ---------- */
.hero {
  display: grid; grid-template-columns: minmax(360px, 500px) minmax(0, 1fr); gap: clamp(20px, 3vw, 40px);
  align-items: center; padding: clamp(24px, 4vw, 52px) var(--gutter) clamp(20px, 3vw, 36px);
  max-width: 1400px; margin: 0 auto;
}
.panel {
  position: relative; padding: 28px 28px 24px; border-radius: 18px; background: var(--panel);
  border: 1px solid var(--line); backdrop-filter: blur(10px); box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
}
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: 11.5px; font-weight: 750; color: var(--teal); }
.eyebrow.gold { color: var(--gold); }
h1.title {
  font-size: clamp(26px, 2.6vw, 34px); line-height: 1.13; margin: 10px 0 12px; font-weight: 800; letter-spacing: -.025em;
  background: linear-gradient(95deg, #fff 30%, #bfe9e3 70%, #f1d49a); -webkit-background-clip: text;
  background-clip: text; color: transparent;
}
.lead { color: var(--ink-2); font-size: 15.5px; margin: 0 0 18px; }
.cta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 4px 0 0; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 18px 0 2px; }
.fact { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: rgba(7, 13, 26, .45); }
.fact b { display: block; font-size: 21px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.fact span { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.3; }
.fact.teal b { color: var(--teal); } .fact.gold b { color: var(--gold); }
.stage { position: relative; min-width: 0; }

/* ---------- раскладка ---------- */
.wrap { max-width: 1400px; margin: 0 auto; padding: 28px var(--gutter) 72px; }
.view { display: none; animation: fadeup .35s var(--ease); }
.view.on { display: block; min-height: calc(100vh - 150px); }  /* есть куда прокрутить, пока данные грузятся */
@keyframes fadeup { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.sec-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px;
  margin: 0 0 18px; }
.sec-head h2 { font-size: clamp(22px, 2.2vw, 28px); line-height: 1.2; font-weight: 800; margin-top: 6px; }
.sec-head p { color: var(--ink-2); max-width: 82ch; margin: 8px 0 0; font-size: 15px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

/* ---------- карточки ---------- */
.card {
  position: relative; background: linear-gradient(180deg, rgba(19, 33, 58, .82), rgba(15, 26, 44, .86));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; min-width: 0;
}
.card.flat { background: rgba(15, 26, 44, .6); }
.card.accent { border-color: rgba(45, 212, 191, .3); box-shadow: inset 0 1px 0 rgba(45, 212, 191, .25); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.card-head h3 { font-size: 16.5px; font-weight: 750; }
.card-head .hint { color: var(--muted); font-size: 12.5px; }
.card h3 { font-size: 16.5px; font-weight: 750; margin-bottom: 10px; }
.card h4 { font-size: 14px; font-weight: 750; color: var(--ink-2); margin: 14px 0 8px; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 0 0 16px; }
.kpi { background: linear-gradient(180deg, var(--card-2), var(--card)); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.kpi .v { font-size: 28px; line-height: 1.15; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .v small { font-size: 15px; font-weight: 700; color: var(--muted); margin-left: 3px; }
.kpi .k { color: var(--ink-2); font-size: 13px; line-height: 1.35; margin-top: 3px; }
.kpi .h { color: var(--muted); font-size: 11.5px; margin-top: 6px; line-height: 1.35; }
.kpi.teal .v { color: var(--teal); } .kpi.gold .v { color: var(--gold); }
.kpi.ok .v { color: var(--ok); } .kpi.bad .v { color: var(--bad); }
.help { border-bottom: 1px dotted var(--muted); cursor: help; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; text-decoration: none;
  font: inherit; font-size: 14.5px; font-weight: 700; line-height: 1.2; color: var(--ink); white-space: nowrap;
  padding: 10px 16px; border-radius: 11px; border: 1px solid var(--line-2); background: rgba(19, 33, 58, .7);
  transition: transform .15s var(--ease), box-shadow .15s, background .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: var(--teal-line); background: rgba(45, 212, 191, .08); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn.primary { color: #04201c; border: 0; background: linear-gradient(135deg, #3ee6cf, #22b8a6);
  box-shadow: 0 8px 24px rgba(45, 212, 191, .22); padding: 11px 20px; }
.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 12px 30px rgba(45, 212, 191, .34); color: #04201c; }
.btn.gold { color: #2a1c00; border: 0; background: linear-gradient(135deg, #f3c86a, #d9a338);
  box-shadow: 0 8px 24px rgba(232, 181, 74, .2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: rgba(148, 178, 220, .08); border-color: var(--line); }
.btn.danger:hover { border-color: var(--bad-line); background: var(--bad-soft); color: var(--bad-ink); }
.btn.sm { font-size: 13px; padding: 7px 11px; border-radius: 9px; }
.btn.lg { font-size: 16px; padding: 13px 24px; }
.btn.icon { padding: 8px; width: 38px; height: 38px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.busy::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .25); border-top-color: var(--ink); animation: spin .7s linear infinite; }
.btn.primary.busy::after { border-color: rgba(4, 32, 28, .25); border-top-color: #04201c; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn svg { width: 16px; height: 16px; flex: none; }

/* ---------- поля ---------- */
input[type=text], input[type=number], input[type=search], input[type=date], select, textarea {
  font: inherit; font-size: 15px; color: var(--ink); background: rgba(7, 13, 26, .72);
  border: 1px solid var(--line-2); border-radius: 10px; padding: 9px 12px; min-width: 0;
  transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover, textarea:hover { border-color: var(--line-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, .18); }
input::placeholder, textarea::placeholder { color: var(--faint); }
select { padding-right: 30px; cursor: pointer; appearance: none; background-image:
  linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
select option { background: var(--card); color: var(--ink); }
textarea { width: 100%; resize: vertical; line-height: 1.6; min-height: 180px; }
input[type=checkbox], input[type=radio] { accent-color: var(--teal); width: 16px; height: 16px; cursor: pointer; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; min-width: 0; }
.field > span { letter-spacing: .01em; }
.fields { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--ink-2); font-size: 14px; }

/* зона загрузки файла: перетаскивание или выбор */
.drop {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px; border: 1.5px dashed var(--line-2);
  border-radius: var(--radius); background: rgba(7, 13, 26, .45); cursor: pointer; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--teal); background: rgba(45, 212, 191, .06); }
.drop input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop .ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none;
  background: var(--teal-soft); color: var(--teal); }
.drop .ico svg { width: 22px; height: 22px; }
.drop b { display: block; font-size: 15px; }
.drop small { color: var(--muted); font-size: 12.5px; }
.drop .fname { color: var(--teal); font-weight: 700; }

/* ---------- таблицы ---------- */
.tbl { overflow: auto; max-width: 100%; border: 1px solid var(--line); border-radius: var(--radius-s); background: rgba(7, 13, 26, .35); }
.tbl.tall { max-height: 460px; }
.tbl table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13.5px; }
.tbl th, .tbl td { padding: 9px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.tbl th { position: sticky; top: 0; z-index: 1; background: #101c31; color: var(--muted); font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
.tbl tbody tr:nth-child(even) td { background: rgba(148, 178, 220, .025); }
.tbl tbody tr:hover td { background: rgba(45, 212, 191, .05); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl td.best { color: var(--teal); font-weight: 800; }
.tbl td.mono { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); }
.tbl tr.click { cursor: pointer; }
.tbl select { font-size: 13px; padding: 6px 28px 6px 9px; }

/* ---------- метки, чипы, заметки ---------- */
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 6px; background: rgba(148, 178, 220, .08); border: 1px solid var(--line);
  border-radius: 7px; padding: 2px 8px; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.tag.teal { background: var(--teal-soft); border-color: rgba(45, 212, 191, .35); color: var(--teal); font-weight: 700; }
.tag.gold { background: var(--gold-soft); border-color: var(--gold-line); color: #f6d68f; font-weight: 700; }
.tag[title] { cursor: help; }
.chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 11px; font-size: 12.5px;
  font-weight: 750; white-space: nowrap; border: 1px solid transparent; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.chip.bad { background: var(--bad-soft); color: var(--bad); border-color: rgba(217, 120, 92, .45); }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: var(--gold-line); }
.chip.na { background: rgba(148, 178, 220, .08); color: var(--muted); border-color: var(--line); }
.note { border: 1px solid var(--line); background: rgba(19, 33, 58, .6); color: var(--ink-2); border-radius: 12px;
  padding: 12px 15px; font-size: 14.5px; line-height: 1.5; }
.note b { color: var(--ink); }
.note.warn { border-color: var(--gold-line); background: var(--warn-soft); color: #f7dda6; }
.note.ok { border-color: var(--ok-line); background: var(--ok-soft); color: #c6f1db; }
.note.err { border-color: var(--bad-line); background: var(--bad-soft); color: var(--bad-ink); }
.note ul { margin: 6px 0 0; padding-left: 20px; }
.empty { color: var(--ink-2); padding: 22px; border: 1px dashed var(--line-2); border-radius: 12px; text-align: center; }
.empty b { display: block; color: var(--ink); font-size: 15.5px; margin-bottom: 4px; }
details.more { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 8px; }
details.more > summary { cursor: pointer; color: var(--muted); font-size: 13px; list-style: none; display: inline-flex; gap: 6px; }
details.more > summary::before { content: "▸"; transition: transform .15s; }
details.more[open] > summary::before { transform: rotate(90deg); }
details.more > summary::-webkit-details-marker { display: none; }

/* ---------- ход операции (как в «Слабых сигналах»: этап, доля, подстрока; доля только растёт) ---------- */
.prog { border: 1px solid var(--line-2); border-radius: 14px; padding: 12px 15px 10px; background: var(--glass);
  box-shadow: var(--shadow-s); margin: 0 0 16px; }
.prog-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.prog-stage { font-size: 14.5px; font-weight: 750; }
.prog-pct { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--teal); }
.prog-track { position: relative; height: 8px; border-radius: 4px; margin: 9px 0 7px; background: rgba(148, 178, 220, .14); overflow: hidden; }
.prog-fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 4px;
  background: linear-gradient(90deg, var(--teal), var(--gold)); transition: width .35s ease-out; }
.prog-fill::after { content: ""; position: absolute; inset: 0; border-radius: 4px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent); background-size: 40% 100%;
  background-repeat: no-repeat; animation: shine 1.4s linear infinite; }
@keyframes shine { from { background-position: -40% 0; } to { background-position: 140% 0; } }
.prog.ind .prog-fill { width: 35% !important; animation: slide 1.3s ease-in-out infinite; }
@keyframes slide { 0% { left: -35%; } 100% { left: 100%; } }
.prog-sub { font-size: 12.5px; color: var(--muted); min-height: 17px; }
.prog.done .prog-fill::after, .prog.err .prog-fill::after { animation: none; }
.prog.done .prog-pct { color: var(--ok); }
.prog.err { border-color: var(--bad-line); background: rgba(40, 14, 14, .94); }
.prog.err .prog-fill { background: var(--bad-line); width: 100% !important; animation: none; }
.prog.err .prog-stage { color: #ffc0ad; } .prog.err .prog-sub { color: var(--bad-ink); }

/* ---------- карточка с навигацией (модальное окно) ---------- */
dialog.modal { padding: 0; border: 1px solid var(--line-2); border-radius: 18px; background: #0c1628; color: var(--ink);
  width: min(920px, calc(100vw - 24px)); max-height: calc(100vh - 32px); box-shadow: 0 40px 120px rgba(0, 0, 0, .6); }
dialog.modal::backdrop { background: rgba(3, 7, 15, .66); backdrop-filter: blur(4px); }
dialog.modal[open] { animation: pop .22s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-bottom: 1px solid var(--line); background: rgba(12, 22, 40, .96); }
.modal-head .pos { color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.modal-body { padding: 20px 24px 26px; overflow: auto; max-height: calc(100vh - 100px); }
.modal-body h2 { font-size: clamp(22px, 2.4vw, 30px); line-height: 1.2; font-weight: 800; margin: 6px 0 10px; }
.modal-body .sec { margin-top: 20px; }
.modal-body .sec > .eyebrow { display: block; margin-bottom: 8px; }
.reasons { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.reasons li { position: relative; padding-left: 20px; color: var(--ink-2); }
.reasons li::before { content: ""; position: absolute; left: 3px; top: .62em; width: 7px; height: 7px; border-radius: 50%;
  background: var(--teal); box-shadow: 0 0 8px rgba(45, 212, 191, .6); }
.reasons li.gold::before { background: var(--gold); box-shadow: 0 0 8px rgba(232, 181, 74, .5); }
.reasons li.bad::before { background: var(--bad-line); box-shadow: none; }
.kv { display: grid; grid-template-columns: minmax(140px, max-content) 1fr; gap: 6px 18px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; color: var(--ink); font-weight: 600; word-break: break-word; }

/* ---------- уведомления ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: grid; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: rgba(12, 22, 40, .97); border: 1px solid var(--line-2); border-left: 3px solid var(--teal); color: var(--ink);
  border-radius: 12px; padding: 11px 14px; font-size: 14px; box-shadow: var(--shadow); animation: pop .2s var(--ease); }
.toast.err { border-left-color: var(--bad-line); } .toast.warn { border-left-color: var(--gold); }

/* ---------- графики (SVG, данные — только из ответа API) ---------- */
.chart { position: relative; min-width: 0; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: rgba(148, 178, 220, .12); }
.chart .axis text, .chart text.lbl { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .val { fill: var(--ink-2); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chart rect.bar { transition: opacity .15s; }
.chart rect.bar.real { fill: var(--real); } .chart rect.bar.syn { fill: var(--syn); } .chart rect.bar.gold { fill: var(--gold); }
.chart rect.bar.teal { fill: var(--teal); } .chart rect.bar.bad { fill: var(--bad-line); }
.chart .hot rect.bar { opacity: .55; } .chart .hot rect.bar.on { opacity: 1; }
.chart line.thr { stroke: var(--gold); stroke-width: 1.5; stroke-dasharray: 4 4; }
.chart text.thr { fill: var(--gold); font-size: 11px; font-weight: 700; }
.chart path.line { fill: none; stroke: var(--teal); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart path.line.real { stroke: var(--real); }
.chart path.area { fill: url(#kit-area); opacity: .9; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--ink-2); margin: 8px 0 0; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.legend i.real { background: var(--real); } .legend i.syn { background: var(--syn); } .legend i.gold { background: var(--gold); }
.legend i.thr { width: 16px; height: 0; border-top: 2px dashed var(--gold); border-radius: 0; vertical-align: 3px; }
.tip { position: fixed; z-index: 300; pointer-events: none; min-width: 180px; max-width: 320px; background: rgba(10, 19, 36, .97);
  border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 12px; font-size: 13px; box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
  opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s; }
.tip.on { opacity: 1; transform: none; }
.tip .tt { font-weight: 750; font-size: 14px; margin-bottom: 4px; }
.tip .tr { display: flex; justify-content: space-between; gap: 14px; color: var(--ink-2); }
.tip .tr b { color: var(--ink); font-variant-numeric: tabular-nums; }
.tip .th { color: var(--muted); font-size: 11.5px; margin-top: 6px; }

.chart rect.bar { transform-box: fill-box; transform-origin: 50% 100%; animation: growY .7s var(--ease) both; }
@keyframes growY { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.chart .grp { outline: none; cursor: default; }
.chart .grp:hover rect.bar, .chart .grp:focus rect.bar { filter: brightness(1.18); }
svg.spark { width: 100%; height: 32px; overflow: visible; }

/* точечная диаграмма (Kit.scatter): два полупрозрачных ряда, появление слева направо */
.chart circle.pt { --o: .55; opacity: var(--o); transform-box: fill-box; transform-origin: center; animation: ptIn .55s var(--ease) both; }
.chart circle.pt.real { fill: var(--real); --o: .5; }
.chart circle.pt.syn, .chart circle.pt.teal { fill: var(--syn); --o: .55; }
.chart circle.pt.gold { fill: var(--gold); --o: .6; }
.chart.still circle.pt { animation: none; }
@keyframes ptIn { from { opacity: 0; transform: scale(.3); } to { opacity: var(--o); transform: none; } }
.chart .grid line.v { stroke: rgba(148, 178, 220, .07); }
.chart .axis-title { fill: var(--ink-2); font-size: 12px; font-weight: 650; font-family: var(--font); }
.chart circle.hit { fill: none; stroke: #fff; stroke-width: 1.6; pointer-events: none; opacity: 0; }
.chart circle.hit.on { opacity: 1; }
.chart rect.plot { cursor: crosshair; }
.scatter .legend i { border-radius: 50%; }

/* горизонтальные полосы показателей с порогом */
.hbars { display: grid; gap: 10px; }
.hb { display: grid; grid-template-columns: minmax(120px, 30%) minmax(0, 1fr) minmax(78px, max-content); gap: 12px; align-items: center;
  font-size: 13.5px; }
.hb-l { color: var(--ink-2); line-height: 1.3; }
.hb-v { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hb-track { position: relative; height: 10px; border-radius: 5px; background: rgba(148, 178, 220, .12); }
.hb-track i { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 5px; background: linear-gradient(90deg, var(--teal-2), var(--teal));
  transition: width 1s var(--ease); }
.hb-track i.ok { background: linear-gradient(90deg, #3fb57d, var(--ok)); }
.hb-track i.bad { background: linear-gradient(90deg, #b9583f, var(--bad)); }
.hb-thr { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--gold); border-radius: 1px;
  box-shadow: 0 0 0 2px rgba(7, 13, 26, .8); transition: left 1s var(--ease); }
@media (max-width: 640px) { .hb { grid-template-columns: minmax(0, 1fr) auto; } .hb-track { grid-column: 1 / -1; grid-row: 2; } }

/* полоса значения со шкалой (доля, сила) */
.meter { height: 6px; border-radius: 3px; background: rgba(148, 178, 220, .12); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 3px; width: 0; background: linear-gradient(90deg, var(--teal), var(--gold));
  transition: width 1s var(--ease); }
.meter.ok i { background: var(--ok); } .meter.bad i { background: var(--bad-line); }

/* ---------- скелет загрузки ---------- */
.sk { position: relative; overflow: hidden; background: rgba(148, 178, 220, .08); border-radius: 8px; min-height: 14px; }
.sk::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(148, 178, 220, .12), transparent); animation: sk 1.3s infinite; }
@keyframes sk { to { transform: translateX(100%); } }

/* ---------- подвал ---------- */
.foot { border-top: 1px solid var(--line); padding: 22px var(--gutter) 28px; color: var(--muted); font-size: 12.5px;
  display: flex; flex-wrap: wrap; gap: 8px 22px; justify-content: space-between; max-width: 1400px; margin: 0 auto; }
.foot a { color: var(--ink-2); }

/* появление по очереди */
.rise { opacity: 0; transform: translateY(8px); animation: rise .5s var(--ease) forwards; }
@keyframes rise { to { opacity: 1; transform: none; } }

/* ---------- адаптив ---------- */
@media (max-width: 1100px) {
  .hero { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .topbar .pill.build { display: none; }
  .steps { top: 61px; }
}
@media (max-width: 640px) {
  :root { --gutter: 16px; }
  body { font-size: 15px; }
  .brand-sub { display: none; }
  .topbar { padding-top: 10px; padding-bottom: 10px; }
  .topbar .pill { display: none; }
  .steps { top: 58px; padding-top: 8px; padding-bottom: 8px; }
  .steps button { font-size: 13.5px; padding: 6px 10px 6px 6px; }
  .panel { padding: 20px 18px 18px; border-radius: 16px; }
  .facts { grid-template-columns: 1fr 1fr; }
  .card { padding: 16px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi .v { font-size: 23px; }
  .modal-body { padding: 16px 16px 22px; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; } .kv dd { margin-bottom: 8px; }
  .btn { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* печать: отчёты и карточки — светлые, без управления */
@media print {
  :root { --ink: #111; --ink-2: #222; --muted: #555; --line: #ccc; --line-2: #bbb; }
  html, body { background: #fff !important; color: #111; }
  .topbar, .steps, .btn, .toasts, .foot, .drop, .noprint { display: none !important; }
  .card, .kpi, .panel, .note, .tbl { background: #fff !important; border-color: #ccc !important; box-shadow: none !important; }
  .view { display: block !important; }
  h1.title { color: #111; background: none; }
}
