/* ============================================================
   OrinAPI — дизайн-система кабинета и витрины (v2).

   Своя, отдельная от админки. Принципы:
   - бумага и чернила: тёплый фон, холодные чернила, один сигнальный
     зелёный (пломба/подтверждение);
   - иерархия важнее плотности: одно главное число на экран;
   - тени — для высоты, бордеры — только структура (разделители, поля);
   - tabular-nums у всех чисел; mono для id/моделей/кода;
   - анимируются только transform/opacity, ≤260мс, ease-out;
   - hover — только под (hover:hover) and (pointer:fine);
   - контраст ≥4.5:1 (tools/contrast_check.py), не на глаз;
   - предпочтения reduced-motion уважаются.
   ============================================================ */

/* ---------- шрифты (self-hosted, latin + cyrillic) ----------
   CSP кабинета: font-src 'self' — поэтому файлы лежат в static/fonts,
   а не на CDN. unicode-range даёт браузеру не качать кириллицу, если
   на странице только латиница (и наоборот). */
@font-face {
  font-family: "Orin Sans";
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url("/fonts/ibm-plex-sans-latin-wght-normal.woff2") format("woff2");
  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+2074, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Orin Sans";
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url("/fonts/ibm-plex-sans-cyrillic-wght-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Orin Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  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+2074, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Orin Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/ibm-plex-mono-cyrillic-400-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Orin Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2");
  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+2074, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Orin Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/ibm-plex-mono-cyrillic-600-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* ---------- токены: светлая тема (бумага) ---------- */
:root {
  --bg: oklch(0.968 0.005 95);
  --surface: oklch(1 0 0);
  --surface-2: oklch(0.958 0.005 95);
  --surface-3: oklch(0.932 0.006 95);
  --surface-inset: oklch(0.972 0.004 95);

  --ink: oklch(0.21 0.015 260);
  --ink-2: oklch(0.40 0.012 260);
  --ink-3: oklch(0.50 0.011 260);

  /* сигнальный зелёный: пломба, primary, «проверено» */
  --seal: oklch(0.495 0.115 158);
  --seal-hover: oklch(0.445 0.115 158);
  --seal-ink: oklch(0.395 0.10 158);
  --seal-soft: oklch(0.952 0.038 158);
  --on-seal: oklch(0.99 0 0);

  --ok: oklch(0.46 0.10 158);
  --ok-soft: oklch(0.952 0.038 158);
  --warn: oklch(0.50 0.105 70);
  --warn-soft: oklch(0.958 0.045 80);
  --bad: oklch(0.52 0.17 27);
  --bad-soft: oklch(0.958 0.032 27);

  --line: oklch(0.905 0.005 95);
  --line-strong: oklch(0.845 0.007 95);

  --r-xs: 4px;
  --r-s: 6px;
  --r-m: 10px;
  --r-l: 14px;
  --r-xl: 20px;

  --shadow-card:
    0 0 0 1px oklch(0 0 0 / 0.05),
    0 1px 2px -1px oklch(0 0 0 / 0.05),
    0 4px 10px -4px oklch(0 0 0 / 0.05);
  --shadow-card-hover:
    0 0 0 1px oklch(0 0 0 / 0.07),
    0 2px 4px -2px oklch(0 0 0 / 0.07),
    0 12px 28px -10px oklch(0 0 0 / 0.10);
  --shadow-pop:
    0 0 0 1px oklch(0 0 0 / 0.07),
    0 18px 44px -14px oklch(0.25 0.03 260 / 0.22),
    0 3px 8px -2px oklch(0 0 0 / 0.06);

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

  --topbar-bg: oklch(0.968 0.005 95 / 0.84);
  --tooltip-bg: oklch(0.21 0.015 260);
  --tooltip-ink: oklch(0.98 0.004 95);

  --rail-w: 216px;
  --wrap: 1120px;

  color-scheme: light;
}

/* ---------- токены: тёмная тема (чернильный терминал) ---------- */
:root[data-theme="dark"] {
  --bg: oklch(0.155 0.010 260);
  --surface: oklch(0.196 0.011 260);
  --surface-2: oklch(0.228 0.012 260);
  --surface-3: oklch(0.262 0.013 260);
  --surface-inset: oklch(0.178 0.010 260);

  --ink: oklch(0.95 0.004 95);
  --ink-2: oklch(0.79 0.010 260);
  --ink-3: oklch(0.695 0.011 260);

  --seal: oklch(0.78 0.135 158);
  --seal-hover: oklch(0.83 0.135 158);
  --seal-ink: oklch(0.84 0.10 158);
  --seal-soft: oklch(0.30 0.05 158);
  --on-seal: oklch(0.16 0.02 158);

  --ok: oklch(0.78 0.135 158);
  --ok-soft: oklch(0.30 0.05 158);
  --warn: oklch(0.80 0.12 78);
  --warn-soft: oklch(0.31 0.045 75);
  --bad: oklch(0.72 0.16 27);
  --bad-soft: oklch(0.32 0.055 27);

  --line: oklch(0.30 0.011 260);
  --line-strong: oklch(0.37 0.013 260);

  --shadow-card: 0 0 0 1px oklch(1 0 0 / 0.055), 0 2px 8px -3px oklch(0 0 0 / 0.55);
  --shadow-card-hover: 0 0 0 1px oklch(1 0 0 / 0.09), 0 12px 28px -10px oklch(0 0 0 / 0.65);
  --shadow-pop: 0 0 0 1px oklch(1 0 0 / 0.08), 0 18px 44px -14px oklch(0 0 0 / 0.75);

  --topbar-bg: oklch(0.155 0.010 260 / 0.82);
  --tooltip-bg: oklch(0.90 0.006 95);
  --tooltip-ink: oklch(0.19 0.015 260);

  color-scheme: dark;
}

/* ---------- база ---------- */
* { box-sizing: border-box; }
html {
  font-family: "Orin Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100dvh;
  transition: background-color 200ms var(--ease-out), color 200ms var(--ease-out);
}
h1, h2, h3, h4 { margin: 0; text-wrap: balance; letter-spacing: -0.02em; }
p, li { text-wrap: pretty; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, [role="button"] { touch-action: manipulation; user-select: none; -webkit-user-select: none; }
a { color: var(--seal-ink); text-decoration-thickness: 1px; text-underline-offset: 2px; }
code, .mono {
  font-family: "Orin Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.92em;
  font-variant-ligatures: none;
}
.num { font-variant-numeric: tabular-nums; }
svg.ic { width: 16px; height: 16px; flex: none; }
svg.ic-lg { width: 18px; height: 18px; flex: none; }
.btn svg, .chip svg, .badge svg, .navitem svg { display: block; }
:focus-visible { outline: 2px solid var(--seal); outline-offset: 2px; }
::selection { background: var(--seal-soft); color: var(--seal-ink); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
/* пропустить навигацию: с клавиатуры шапка — 5 целей перед контентом */
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--surface); color: var(--ink);
  padding: 10px 14px; border-radius: var(--r-m);
  box-shadow: var(--shadow-pop); font-size: 13px; font-weight: 600;
  transition: top 140ms var(--ease-out);
}
.skip:focus { top: 12px; }

/* ---------- логотип ---------- */
.logo { display: inline-flex; align-items: center; gap: 9px; color: inherit; text-decoration: none; }
.logo-mark { width: 26px; height: 26px; flex: none; color: var(--seal); }
.logo-mark .ring { fill: none; stroke: currentColor; stroke-width: 2.5; }
.logo-mark .tick { stroke: currentColor; stroke-width: 2; stroke-linecap: butt; }
.logo-mark .dot { fill: currentColor; }
.logo-word { font-size: 16px; font-weight: 600; letter-spacing: -0.025em; line-height: 1; }
.logo-word .api { color: var(--ink-3); font-weight: 500; }
.logo > span { display: flex; flex-direction: column; min-width: 0; }
.logo-sub { font-size: 11.5px; color: var(--ink-3); line-height: 1.2; margin-top: 2px; }

/* ============================================================
   ШАПКА (витрина)
   ============================================================ */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--topbar-bg);
  backdrop-filter: blur(14px) saturate(1.5);
  -webkit-backdrop-filter: blur(14px) saturate(1.5);
  box-shadow: 0 1px 0 0 var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar-in {
  max-width: var(--wrap); margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
  height: 60px; padding: 0 24px;
}
.topbar .spacer { flex: 1; }
.topnav { display: flex; align-items: center; gap: 2px; margin-right: 6px; }
.topnav a {
  font-size: 13.5px; font-weight: 500; color: var(--ink-2); text-decoration: none;
  padding: 7px 10px; border-radius: var(--r-s);
}
@media (hover: hover) and (pointer: fine) {
  .topnav a:hover { background: var(--surface-2); color: var(--ink); }
}

/* ============================================================
   КНОПКИ / ПЕРЕКЛЮЧАТЕЛИ
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 15px;
  border: none; border-radius: var(--r-m);
  background: var(--surface); color: var(--ink);
  font-size: 13.5px; font-weight: 550; white-space: nowrap;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition-property: box-shadow, background-color, transform, color;
  transition-duration: 140ms; transition-timing-function: var(--ease-out);
}
.btn:active { transform: scale(0.96); }
.btn.primary {
  background: var(--seal); color: var(--on-seal);
  box-shadow: 0 1px 2px oklch(0.3 0.1 158 / 0.3), 0 0 0 1px oklch(0.4 0.1 158 / 0.45);
}
.btn.ghost { background: transparent; box-shadow: none; color: var(--ink-2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: var(--r-s); }
.btn.lg { height: 44px; padding: 0 20px; font-size: 14.5px; }
.btn.icon { width: 38px; padding: 0; }
.btn.icon.sm { width: 30px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { box-shadow: var(--shadow-card-hover); background: var(--surface-2); }
  .btn.primary:hover { background: var(--seal-hover); }
  .btn.ghost:hover { background: var(--surface-2); box-shadow: none; }
}
/* минимальная цель 44px на тач: визуально кнопка мелкая, палец попадает */
@media (pointer: coarse) {
  .btn.sm, .btn.icon.sm { position: relative; }
  .btn.sm::after, .btn.icon.sm::after {
    content: ""; position: absolute; inset: -7px; border-radius: var(--r-m);
  }
  /* чипы-фильтры и сегменты — тоже тап-цели: расширяем невидимой областью,
     не раздувая визуально плотный ряд */
  .chip { position: relative; }
  .chip::after { content: ""; position: absolute; inset: -11px -6px; }
  .seg button { position: relative; }
  .seg button::after { content: ""; position: absolute; inset: -8px -2px; }
}

.seg {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--surface-2); border-radius: var(--r-m);
}
.seg button {
  border: none; background: transparent; color: var(--ink-2);
  height: 28px; padding: 0 11px; border-radius: 7px;
  font-size: 12.5px; font-weight: 550; cursor: pointer;
  transition-property: background-color, color, box-shadow, transform;
  transition-duration: 130ms; transition-timing-function: var(--ease-out);
}
.seg button[aria-selected="true"] {
  background: var(--surface); color: var(--ink);
  box-shadow: 0 1px 2px oklch(0 0 0 / 0.08), 0 0 0 1px oklch(0 0 0 / 0.04);
}
.seg button:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) {
  .seg button:hover:not([aria-selected="true"]) { color: var(--ink); }
}

/* ============================================================
   КАРКАС ВИТРИНЫ
   ============================================================ */
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.section { margin-top: 64px; }
.section-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.section-head h2 { font-size: 20px; font-weight: 600; }
.section-head .hint { font-size: 13px; color: var(--ink-3); max-width: 62ch; }

/* hero: 7/5 — тезис слева, доказательство справа */
.hero { display: grid; grid-template-columns: 1.35fr 1fr; gap: 48px; padding: 56px 0 8px; align-items: start; }
.hero h1 {
  font-size: clamp(30px, 4.4vw, 46px);
  line-height: 1.06; letter-spacing: -0.03em; font-weight: 600;
  max-width: 22ch;
}
.hero h1 em { font-style: normal; color: var(--seal-ink); }
.hero .lead { margin: 18px 0 0; max-width: 54ch; font-size: 16px; color: var(--ink-2); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.hero-facts {
  display: flex; flex-wrap: wrap; gap: 0; margin-top: 34px;
  border-top: 1px solid var(--line); padding-top: 18px;
}
.hero-facts .fact { padding-right: 28px; margin-right: 28px; border-right: 1px solid var(--line); }
.hero-facts .fact:last-child { border-right: none; margin-right: 0; padding-right: 0; }
.fact .v { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.fact .k { font-size: 12px; color: var(--ink-3); }

/* карточка-доказательство в hero */
.proof {
  background: var(--surface); border-radius: var(--r-xl);
  box-shadow: var(--shadow-card); padding: 22px;
  position: relative;
}
.proof-top { display: flex; align-items: flex-start; gap: 14px; }
.proof-name { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.proof-vendor { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.proof-meta { margin-top: 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.proof-meta dt { font-size: 11.5px; color: var(--ink-3); }
.proof-meta dd { margin: 1px 0 0; font-size: 14px; font-weight: 550; font-variant-numeric: tabular-nums; }
.proof-foot {
  margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--ink-3);
  display: flex; align-items: center; gap: 8px;
}
.proof-foot .spacer { flex: 1; }

/* терминальная строка под hero: живое доказательство вместо обещания */
.term {
  margin-top: 18px;
  background: var(--surface-inset); border-radius: var(--r-m);
  padding: 12px 14px; font-family: "Orin Mono", monospace; font-size: 11.5px;
  line-height: 1.7; color: var(--ink-2); overflow-x: auto;
  overscroll-behavior-x: contain;
}
.term .c { color: var(--ink-3); }
.term .ok { color: var(--seal-ink); font-weight: 600; }

/* ============================================================
   ПЛОМБА (seal) — знак «проверено», не число
   ============================================================ */
.seal { display: inline-grid; place-items: center; flex: none; }
.seal svg { display: block; }
.seal .seal-ring { fill: none; stroke: var(--seal); stroke-width: 2; opacity: 0.35; }
.seal .seal-arc { fill: none; stroke: var(--seal); stroke-width: 2.5; stroke-linecap: round; }
.seal .seal-tick { stroke: var(--seal); stroke-width: 2; stroke-linecap: butt; }
.seal .seal-check { stroke: var(--seal); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.seal .seal-label { fill: var(--seal-ink); font-family: "Orin Sans", sans-serif; font-size: 7.5px; font-weight: 600; letter-spacing: 0.02em; }
.seal.sm .seal-label { display: none; }

/* ============================================================
   БЫСТРЫЙ ВХОД (возвратный пользователь)
   ============================================================ */
.quick {
  margin-top: 44px;
  background: var(--surface); border-radius: var(--r-l);
  box-shadow: var(--shadow-card);
  padding: 16px 18px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.quick .q-label { font-size: 13px; color: var(--ink-2); font-weight: 550; }
/* flex-wrap обязателен: строка ошибки (.q-err) занимает 100% ширины и без
   переноса отжимала инпут до 26px — «узкая пилюля» вместо поля ввода. */
.quick form { display: flex; flex-wrap: wrap; gap: 8px; flex: 1; min-width: min(260px, 100%); }
.quick input {
  flex: 1 1 220px; min-width: 0; height: 38px; padding: 0 12px;
  font-size: 16px;   /* 16px: iOS не зумит страницу на фокусе */
  background: var(--surface-inset); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--r-m);
}
.quick input:focus { outline: none; border-color: var(--seal); box-shadow: 0 0 0 3px oklch(0.5 0.115 158 / 0.16); }
.quick .q-err { flex-basis: 100%; font-size: 12.5px; color: var(--bad); }

/* ============================================================
   КАТАЛОГ: таблица-полоса (сравнение в столбик, не 4 карточки)
   ============================================================ */
.strip { background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-card); overflow: hidden; }
.strip-head, .strip-row {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 0.8fr 0.8fr 0.7fr 56px;
  gap: 12px; align-items: center;
  padding: 13px 20px;
}
.strip-head {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--ink-3); border-bottom: 1px solid var(--line);
  padding-top: 14px; padding-bottom: 11px;
}
.strip-row { border-bottom: 1px solid var(--line); }
.strip-row:last-child { border-bottom: none; }
.strip-row .m-name { font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; }
.strip-row .m-vendor { font-size: 11.5px; color: var(--ink-3); }
.strip-row .m-num { font-size: 13px; font-variant-numeric: tabular-nums; }
.strip-row .m-num .sub { display: block; font-size: 11px; color: var(--ink-3); }
.strip-row .m-price { font-size: 13px; font-family: "Orin Mono", monospace; font-variant-numeric: tabular-nums; }
.strip-row .m-price .io { color: var(--ink-3); font-size: 10.5px; margin-right: 4px; }
.strip-row .m-sup { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.strip-row .m-docs { justify-self: end; }
@media (hover: hover) and (pointer: fine) {
  .strip-row:hover { background: var(--surface-2); }
}

/* ============================================================
   ПРОВЕРКА ПОДЛИННОСТИ: три тезиса
   ============================================================ */
.method { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.method-item { background: var(--surface); border-radius: var(--r-l); box-shadow: var(--shadow-card); padding: 20px; }
.method-n {
  font-family: "Orin Mono", monospace; font-size: 11px; font-weight: 600;
  color: var(--seal-ink); letter-spacing: 0.06em;
}
.method-item h3 { font-size: 15px; font-weight: 600; margin-top: 8px; }
.method-item p { margin: 8px 0 0; font-size: 13.5px; color: var(--ink-2); line-height: 1.6; }

/* ============================================================
   КАРТОЧКИ / KPI / ГРАФИК
   ============================================================ */
.card { background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-card); }
.card-pad { padding: 20px 22px; }
.card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h3 { font-size: 14.5px; font-weight: 600; }
.card-head .spacer { flex: 1; }
.card-head .hint { font-size: 12px; color: var(--ink-3); }
.stack > * + * { margin-top: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* баланс: единственное крупное число экрана + действие */
.balance {
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px;
  padding: 20px 22px;
}
.balance-main { min-width: 0; }
.balance .k { font-size: 12px; color: var(--ink-3); }
.balance .amount {
  font-size: clamp(32px, 5vw, 42px); font-weight: 600; line-height: 1.05;
  letter-spacing: -0.035em; font-variant-numeric: tabular-nums;
  display: flex; align-items: baseline; gap: 2px;
}
.balance .amount .cur { font-size: 0.5em; font-weight: 500; color: var(--ink-3); }
.balance .sub { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.balance .spacer { flex: 1; }
.balance-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.balance-actions { display: flex; gap: 8px; }

.statusline { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); }
.statusline .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.statusline.warn .dot { background: var(--warn); }
.statusline.bad .dot { background: var(--bad); }
.statusline .when { color: var(--ink-3); font-size: 11.5px; }

/* «куда уходит баланс»: доли моделей полосами */
.share { display: flex; flex-direction: column; gap: 11px; }
.share-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; }
.share-row .nm { font-size: 12.5px; font-family: "Orin Mono", monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-row .vl { font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.share-bar { grid-column: 1 / -1; height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.share-bar i { display: block; height: 100%; background: var(--seal); border-radius: 3px; }
.share-bar.dim i { background: var(--ink-3); opacity: 0.5; }

/* здоровье: компактные метрики без карточек */
.health { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 18px; }
.health .h-k { font-size: 11.5px; color: var(--ink-3); }
.health .h-v { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.health .h-s { font-size: 11px; color: var(--ink-3); }

.chart-box { position: relative; }
/* overflow: hidden, а не visible: любой элемент, выехавший за область
   (подпись прогноза, точка у края), налезал на карточку выше — на мобиле
   «прогноз до нуля» печатался поверх «обновлено 19:15» (20.10). */
.chart-box svg { display: block; width: 100%; overflow: hidden; }
.chart-box .grid-line { stroke: var(--line); stroke-width: 1; }
.chart-box .axis-label { fill: var(--ink-3); font-size: 10.5px; font-variant-numeric: tabular-nums; font-family: "Orin Mono", monospace; }
.chart-box .area { fill: url(#areaFill); }
.chart-box .line { fill: none; stroke: var(--seal); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-box .forecast { fill: none; stroke: var(--ink-3); stroke-width: 1.5; stroke-dasharray: 4 4; }
.chart-box .forecast-label { fill: var(--ink-3); font-size: 10px; font-family: "Orin Sans", sans-serif; }
.chart-box .cross { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; }
.chart-box .pt { fill: var(--seal); stroke: var(--surface); stroke-width: 2; opacity: 0; }
.chart-box .cross.on, .chart-box .pt.on { opacity: 1; }
.chart-box:focus-visible { outline: 2px solid var(--seal); outline-offset: 4px; border-radius: 8px; }
.chart-tip {
  position: absolute; z-index: 5; pointer-events: none;
  background: var(--tooltip-bg); color: var(--tooltip-ink);
  border-radius: 8px; padding: 7px 10px;
  font-size: 12px; line-height: 1.5; white-space: nowrap;
  box-shadow: var(--shadow-pop);
  transform: translate(-50%, -100%);
  opacity: 0; transition: opacity 90ms linear;
}
.chart-tip.on { opacity: 1; }
.chart-tip .t { opacity: 0.72; font-size: 11px; }
.chart-tip .v { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ============================================================
   ТАБЛИЦЫ / РАСКРЫТИЕ СТРОКИ
   ============================================================ */
.tbl-wrap { overflow-x: auto; overscroll-behavior-x: contain; max-width: 100%; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-size: 10.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--ink-3);
  padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td {
  padding: 9px 12px; border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums; vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
td.r, th.r { text-align: right; }
tbody tr { transition: background-color 100ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  tbody tr:hover { background: var(--surface-2); }
}
.tbl-sticky th:first-child, .tbl-sticky td:first-child {
  position: sticky; left: 0; z-index: 1;
  background: var(--surface);
  box-shadow: 1px 0 0 0 var(--line);
}

/* строка-кнопка: раскрытие деталей запроса */
tr.expandable { cursor: pointer; }
tr.expandable td:first-child { position: relative; }
tr.expandable .caret {
  display: inline-block; width: 0; height: 0; margin-right: 6px;
  border-left: 4px solid var(--ink-3); border-top: 3.5px solid transparent;
  border-bottom: 3.5px solid transparent;
  transition: transform 140ms var(--ease-out);
  transform-origin: 25% 50%;
}
tr.expandable[aria-expanded="true"] .caret { transform: rotate(90deg); }
tr.detail > td { padding: 0; border-bottom: 1px solid var(--line); background: var(--surface-inset); }
.detail-in {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px 20px; padding: 14px 18px;
  animation: detail-in 160ms var(--ease-out);
}
@keyframes detail-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.detail-in .d-k { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-3); }
.detail-in .d-v { font-size: 12.5px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.detail-in .d-v.mono { font-family: "Orin Mono", monospace; font-size: 11.5px; }

/* ============================================================
   ПОДКЛЮЧЕНИЕ
   ============================================================ */
.field-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.field-row + .field-row { margin-top: 10px; }
.field-row .lbl { font-size: 12px; color: var(--ink-3); min-width: 84px; }
.code-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface-inset); border-radius: var(--r-m);
  padding: 5px 6px 5px 10px; max-width: 100%;
  font-family: "Orin Mono", monospace; font-size: 12.5px;
  overflow-wrap: anywhere;
}
.code-pill.wide { padding: 9px 10px 9px 14px; font-size: 13.5px; }
.code-pill .grow { flex: 1; min-width: 0; }
.snippet {
  margin: 14px 0 0; padding: 14px 16px;
  background: var(--surface-inset); border-radius: var(--r-m);
  font-family: "Orin Mono", monospace;
  font-size: 11.5px; line-height: 1.7; color: var(--ink-2);
  white-space: pre; overflow-x: auto; overscroll-behavior-x: contain;
}
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  display: inline-flex; align-items: center; height: 24px; padding: 0 9px;
  border-radius: 999px; background: var(--surface-2); color: var(--ink-2);
  font-size: 11.5px; font-weight: 550; white-space: nowrap;
}
.chip.on { background: var(--seal-soft); color: var(--seal-ink); }
.limits { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 16px; font-size: 12px; color: var(--ink-3); }
.limits b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ============================================================
   БЕЙДЖИ / СТАТУСЫ
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  background: var(--surface-2); color: var(--ink-2);
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.mute { background: var(--surface-2); color: var(--ink-3); }
.badge.bad .dot { animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--bad-soft); }
  50% { box-shadow: 0 0 0 5px var(--bad-soft); }
}
@media (prefers-reduced-motion: reduce) { .badge.bad .dot { animation: none; } }

/* ============================================================
   ФОРМЫ
   ============================================================ */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; height: 44px; padding: 0 13px;
  font-size: 16px;                       /* iOS не зумит */
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--r-m);
  transition-property: border-color, box-shadow;
  transition-duration: 140ms; transition-timing-function: var(--ease-out);
}
.field textarea { height: auto; min-height: 76px; padding: 11px 13px; resize: vertical; line-height: 1.5; }
.field input::placeholder, .field textarea::placeholder { color: var(--ink-3); }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--seal); box-shadow: 0 0 0 3px oklch(0.5 0.115 158 / 0.16);
}
.field.invalid input, .field.invalid textarea { border-color: var(--bad); }
.field .err { display: none; margin-top: 6px; font-size: 12px; color: var(--bad); }
.field.invalid .err { display: block; }
.check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); margin: 2px 0 18px; }
.check input { width: 16px; height: 16px; accent-color: var(--seal); }
.form-note { margin-top: 14px; font-size: 11.5px; color: var(--ink-3); line-height: 1.5; }

/* ============================================================
   ЭКРАН ВХОДА
   ============================================================ */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 32px 20px; }
.auth-card {
  width: 100%; max-width: 430px;
  background: var(--surface); border-radius: var(--r-xl);
  box-shadow: var(--shadow-card); padding: 30px 30px 26px;
}
.auth-card h1 { font-size: 22px; font-weight: 600; margin-top: 16px; }
.auth-card .sub { margin: 8px 0 22px; font-size: 13.5px; color: var(--ink-2); }
.auth-foot { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-3); }
.auth-foot a { font-weight: 550; }

/* ============================================================
   КАБИНЕТ: рейка (десктоп) / нижняя навигация (мобилка)
   ============================================================ */
.shell { display: grid; grid-template-columns: var(--rail-w) 1fr; min-height: 100dvh; }
/* grid-элемент по умолчанию имеет min-width:auto — широкая таблица внутри
   растягивала всю оболочку и давала горизонтальный скролл страницы вместо
   скролла внутри .tbl-wrap (на ≤640 таблица моделей). */
.shell > div { min-width: 0; }
.rail {
  position: sticky; top: 0; align-self: start; height: 100dvh;
  display: flex; flex-direction: column; gap: 4px;
  padding: 18px 14px 14px;
  background: var(--bg);
  box-shadow: 1px 0 0 0 var(--line);
}
.rail .logo { padding: 0 8px 14px; }
.rail-nav { display: flex; flex-direction: column; gap: 2px; }
.rail-nav a {
  display: flex; align-items: center; gap: 10px;
  height: 36px; padding: 0 10px; border-radius: var(--r-s);
  font-size: 13.5px; font-weight: 550; color: var(--ink-2); text-decoration: none;
  transition-property: background-color, color; transition-duration: 120ms;
}
.rail-nav a svg { color: var(--ink-3); }
.rail-nav a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-card); }
.rail-nav a[aria-current="page"] svg { color: var(--seal); }
@media (hover: hover) and (pointer: fine) {
  .rail-nav a:hover:not([aria-current="page"]) { background: var(--surface-2); color: var(--ink); }
}
.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 0 4px; }
.rail-balance {
  background: var(--surface); border-radius: var(--r-m); box-shadow: var(--shadow-card);
  padding: 11px 12px;
}
.rail-balance .k { font-size: 11px; color: var(--ink-3); }
.rail-balance .v { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.rail-tools { display: flex; gap: 4px; }
.rail-tools .btn.icon { width: 32px; height: 32px; }
.rail-tools .btn.sm { height: 32px; }

.main { min-width: 0; padding: 26px 28px 72px; }
.main-in { max-width: 980px; margin: 0 auto; }
.page-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { font-size: 22px; font-weight: 600; }
.page-head .hint { font-size: 12.5px; color: var(--ink-3); }
.page-head .spacer { flex: 1; }

/* мобильная шапка кабинета */
.mtop { display: none; }

/* нижняя навигация */
.nav {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: var(--topbar-bg);
  backdrop-filter: blur(14px) saturate(1.5);
  -webkit-backdrop-filter: blur(14px) saturate(1.5);
  box-shadow: 0 -1px 0 0 var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.nav-in { display: grid; grid-template-columns: repeat(4, 1fr); }
.navitem {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 8px 4px 7px; text-decoration: none; color: var(--ink-3);
  font-size: 10.5px; font-weight: 550; min-height: 52px;
  transition-property: color, transform; transition-duration: 120ms;
}
.navitem[aria-current="page"] { color: var(--seal-ink); }
.navitem[aria-current="page"] svg { fill: var(--seal-soft); }
.navitem:active { transform: scale(0.96); }

/* ============================================================
   ПУСТЫЕ СОСТОЯНИЯ / АЛЕРТЫ / СКЕЛЕТОНЫ / ТОСТЫ
   ============================================================ */
.empty { padding: 28px 20px; text-align: center; color: var(--ink-3); font-size: 13px; }
.empty .t { color: var(--ink-2); font-weight: 600; margin-bottom: 4px; font-size: 13.5px; }
.empty .a { margin-top: 12px; }

.alert {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 11px 14px; border-radius: var(--r-m);
  background: var(--bad-soft); color: var(--bad);
  font-size: 12.8px; font-weight: 550; line-height: 1.45;
}
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.info { background: var(--seal-soft); color: var(--seal-ink); }
.alert svg { flex: none; margin-top: 1px; }
.alert .spacer { flex: 1; }

.skel { border-radius: var(--r-m); background: var(--surface-2); position: relative; overflow: hidden; }
.skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, oklch(1 0 0 / 0.55), transparent);
  animation: shimmer 1.5s var(--ease-in-out) infinite;
}
:root[data-theme="dark"] .skel::after {
  background: linear-gradient(90deg, transparent, oklch(1 0 0 / 0.05), transparent);
}
@keyframes shimmer { 0% { transform: translateX(-100%); } 60%, 100% { transform: translateX(100%); } }

#toasts {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column-reverse; align-items: center; gap: 8px;
  z-index: 100; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 8px;
  background: var(--tooltip-bg); color: var(--tooltip-ink);
  border-radius: var(--r-m); padding: 10px 15px;
  font-size: 13px; font-weight: 550;
  box-shadow: var(--shadow-pop); pointer-events: auto;
  max-width: min(420px, calc(100vw - 32px));
  opacity: 1; transform: translateY(0);
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out);
}
@starting-style { .toast { opacity: 0; transform: translateY(10px); } }
.toast.hide { opacity: 0; transform: translateY(6px); }
.toast.error { background: var(--bad); color: #fff; }
:root[data-theme="dark"] .toast.error { color: oklch(0.16 0.02 27); }

/* ============================================================
   ПОДВАЛ
   ============================================================ */
.footer {
  margin-top: 72px; padding: 24px 0 40px;
  border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  font-size: 12px; color: var(--ink-3);
}
.footer .spacer { flex: 1; }
.footer a { color: var(--ink-2); text-decoration: none; }
@media (hover: hover) and (pointer: fine) { .footer a:hover { color: var(--ink); } }

/* ============================================================
   ВХОДНОЙ КАСКАД (только витрина, один раз)
   ============================================================ */
.enter { animation: enter 260ms var(--ease-out) both; }
.enter-2 { animation-delay: 70ms; }
.enter-3 { animation-delay: 140ms; }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ============================================================
   АДАПТИВ
   ============================================================ */
@media (max-width: 1080px) {
  .hero { grid-template-columns: 1fr; gap: 28px; padding-top: 40px; }
  .proof { max-width: 520px; }
  .strip-head, .strip-row { grid-template-columns: 1.4fr 1fr 1fr 0.8fr 56px; }
  .strip-head .col-tps, .strip-row .col-tps,
  .strip-head .col-p50, .strip-row .col-p50 { display: none; }
}
@media (max-width: 900px) {
  .wrap { padding: 0 16px; }
  .section { margin-top: 44px; }
  .topbar-in { padding: 0 16px; height: 56px; }
  .topnav { display: none; }
  .method { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }

  /* кабинет: рейка → верхняя полоса + нижняя навигация */
  .shell { grid-template-columns: 1fr; }
  .rail { display: none; }
  .nav { display: block; }
  .mtop {
    display: block; position: sticky; top: 0; z-index: 30;
    background: var(--topbar-bg);
    backdrop-filter: blur(14px) saturate(1.5);
    -webkit-backdrop-filter: blur(14px) saturate(1.5);
    box-shadow: 0 1px 0 0 var(--line);
    padding-top: env(safe-area-inset-top, 0px);
  }
  .mtop-in { display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 16px; }
  .mtop .spacer { flex: 1; }
  .main { padding: 18px 16px calc(84px + env(safe-area-inset-bottom, 0px)); }
  /* тост поднять над нижней навигацией (иначе садится на иконки nav) */
  #toasts { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .hero { padding-top: 30px; }
  .hero h1 { font-size: 29px; }
  .hero .lead { font-size: 15px; }
  .hero-facts { margin-top: 26px; padding-top: 14px; }
  .hero-facts .fact { padding-right: 18px; margin-right: 18px; }
  .fact .v { font-size: 19px; }
  .card-pad { padding: 16px; }
  .balance { padding: 16px; }
  .balance-right { width: 100%; }
  .balance-actions { flex: 1; }
  .balance-actions .btn { flex: 1; }
  .health { grid-template-columns: repeat(2, 1fr); gap: 12px 14px; }
  .page-head h1 { font-size: 19px; }
  /* таблица запросов на 390px — карточки-строки (см. rowCard в account.js) */
  .tbl-wrap table { min-width: 0; }
  .snippet { white-space: pre-wrap; word-break: break-word; }
  .auth-card { padding: 22px 20px; }
  .footer { margin-top: 48px; }
  /* карточка каталога вместо строки таблицы */
  .strip-head { display: none; }
  .strip-row {
    grid-template-columns: 1fr auto; gap: 6px 12px; padding: 14px 16px;
  }
  .strip-row .m-name-cell { grid-column: 1; grid-row: 1 / 3; align-self: start; }
  /* обе цены (in/out) — справа от имени, в своих строках, без наложения */
  .strip-row .m-price { grid-column: 2; text-align: right; }
  .strip-row .m-num, .strip-row .m-sup { grid-column: 1 / -1; }
  .strip-row .m-docs { display: none; }
}

/* уважение к prefers-reduced-motion: убираем движение, оставляем смену цвета */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .skel::after { animation: none; }
}

/* ============================================================
   МЕЛКИЕ КЛАССЫ-УТИЛИТЫ
   Появились после ревизии 20.10: в JS было 23 инлайн-стиля, из них
   отступы и размеры шрифта задавались прямо в разметке — дизайн-система
   протекала, а тема/плотность переставали управляться из CSS.
   Инлайн остаётся только там, где значение ВЫЧИСЛЯЕТСЯ (ширина полосы
   доли, геометрия SVG).
   ============================================================ */
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.card-pad-tight { padding-bottom: 4px; }
.hint-tight { margin-top: -6px; margin-bottom: 14px; }

/* ячейка «модель» в таблице моделей кабинета */
.m-cell { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.m-cell-name { letter-spacing: -0.01em; }
.m-cell-sub { font-size: 11px; color: var(--ink-3); }
.m-cell-price { font-size: 12px; }

/* карточка запроса на узком экране (таблица из 7 колонок не влезает) */
.reqcard { padding: 12px 16px; border-top: 1px solid var(--line); }
.reqcard.expandable { cursor: pointer; }
.reqcard-detail { margin-top: 10px; border-top: 1px solid var(--line); }
.reqcard:first-child { border-top: none; }
.reqcard-top { display: flex; gap: 8px; align-items: baseline; }
.reqcard-name { font-size: 12.5px; font-weight: 600; }
.reqcard-amt { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.reqcard-meta {
  display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 2px;
  font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.mt-4 { margin-top: 16px; }
.grow { flex: 1; min-width: 0; }
.w-full { width: 100%; }
.quick-hint { font-size: 11.5px; color: var(--ink-3); }

/* ссылка с иконкой: иконка одного размера с текстом и по центру строки —
   без этого SVG в <a> «прилипал» к базовой линии и читался как артефакт */
.link-ico { display: inline-flex; align-items: center; gap: 6px; }
.link-ico svg { width: 14px; height: 14px; }
