
/* Connect wizard: a fluid single column expands into two configuration cards. */
.cx-root{max-width:1100px}.cx-root .cx-card{min-width:0}.cx-card h1,.cx-card h2{margin:0}.cx-controls,.cx-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,220px),1fr));gap:16px}.cx-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.cx-label,.cx-tile{display:grid;gap:8px;min-width:0}.cx-label .input{width:100%;min-width:0}.cx-key{display:flex;gap:8px}.cx-tile,.cx-step{border-top:1px solid var(--line);padding-top:16px}.cx-tile small{overflow-wrap:anywhere}.cx-step{display:grid;grid-template-columns:2em minmax(0,1fr);gap:10px}.cx-step .snippet{overflow-x:auto;max-width:100%}.cx-root summary{cursor:pointer;font-weight:600}.cx-root .proto-block{min-width:0}@media(max-width:640px){.cx-grid,.cx-controls{grid-template-columns:minmax(0,1fr)}.cx-step .btn,.cx-tile .btn{width:100%}.cx-key{flex-wrap:wrap}}

/* ============================================================
   app.css — кабинет (после входа).

   Каркас: рейка на десктопе, верхняя полоса + нижняя навигация на телефоне.
   Иерархия обзора: одно главное число (баланс) + действие, затем график с
   прогнозом, затем «куда уходит баланс» и «здоровье», и только потом лог.

   Файл — только про кабинет. Общие токены/компоненты — user.css,
   публичные страницы — site.css. Три слоя, три файла: правка кабинета не
   требует чтения лендинга.
   ============================================================ */

/* ---------- каркас v4 ----------
   Рейка (десктоп) + верхняя панель кабинета; на телефоне — мобильная шапка
   и нижняя навигация. Контент — одна колонка с максимумом ширины: плотные
   таблицы и графики читаются до 1280px, дальше растёт только воздух. */
.shell { display: grid; grid-template-columns: var(--rail-w) 1fr; min-height: 100dvh; }
/* grid-элемент по умолчанию имеет min-width:auto — широкая таблица внутри
   растягивала всю оболочку и давала горизонтальный скролл страницы вместо
   скролла внутри .tbl-wrap. */
.shell > div, .shell-main { min-width: 0; }
.shell-main { display: flex; flex-direction: column; }
.rail {
  position: sticky; top: 0; align-self: start; height: 100dvh;
  display: flex; flex-direction: column; gap: 4px;
  padding: 18px 12px 14px;
  background: var(--surface-inset);
  box-shadow: 1px 0 0 0 var(--line);
}
.rail .logo { padding: 0 10px 14px; }
.rail-nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.rail-group + .rail-group { margin-top: 12px; }
.rail-nav .g {
  font-size: 10px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--ink-3); padding: 6px 10px 5px;
}
.rail-nav a {
  display: flex; align-items: center; gap: 10px;
  height: 34px; 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-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.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); }
.rail-nav a .pill-n {
  margin-left: auto; font-size: 10.5px; font-weight: 600; color: var(--seal-ink);
  background: var(--seal-soft); border-radius: 999px; padding: 1px 7px;
  font-variant-numeric: tabular-nums;
}
@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: 2px;
  padding-top: 12px; border-top: 1px solid var(--line);
}
.rail-doc {
  display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px;
  border: 0; background: none; border-radius: var(--r-s); cursor: pointer;
  font-size: 12.5px; font-weight: 550; color: var(--ink-3); text-decoration: none;
  text-align: left; transition: background-color 120ms var(--ease-out);
}
.rail-doc svg { color: var(--ink-3); }
@media (hover: hover) and (pointer: fine) {
  .rail-doc:hover { background: var(--surface-2); color: var(--ink); }
}

/* верхняя панель кабинета: раздел, свежесть, баланс, действия */
.apptop {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  height: 56px; padding: 0 24px;
  background: var(--bg); box-shadow: 0 1px 0 0 var(--line);
}
.apptop .spacer { flex: 1; }
.apptop-title { font-size: 14px; font-weight: 600; letter-spacing: -0.015em; }
/* Чип баланса. align-items: center, а НЕ baseline: подпись 11px и число
   14px по общей базовой линии вставали выше центра пилюли и почти выходили
   за её верхний край (поймано 23.11 на «Финансах»). Выравниваем по центру,
   а оптическую связку подписи и числа держим одинаковым line-height. */
.balance-chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 12px; border-radius: 999px;
  background: var(--surface); box-shadow: var(--shadow-card);
  text-decoration: none; color: inherit; line-height: 1;
}
.balance-chip .k { font-size: 11px; color: var(--ink-3); line-height: 1; }
.balance-chip .v { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1; }
@media (hover: hover) and (pointer: fine) {
  .balance-chip:hover .v { color: var(--seal); }
}

.main { min-width: 0; padding: 22px 24px 72px; }
.main-in { max-width: var(--wrap-wide); margin: 0 auto; }
/* ВАЖНО: селектор с областью .main-in. Класс .page-head есть и у публичных
   страниц (site.css, блочная вёрстка «шапка страницы»); без области кабинета
   flex-правило из этого файла (он грузится позже) ломало им вёрстку. */
.main-in .page-head {
  display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.main-in .page-head-t { min-width: 0; flex: 1; }
.main-in .page-head h1 { font-size: 23px; font-weight: 600; }
.main-in .page-head .hint { font-size: 12.5px; color: var(--ink-3); max-width: 70ch; margin: 3px 0 0; }
.main-in .page-head-a { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.main-in .page-head .spacer { flex: 1; }
.ov-mail { max-width: 26ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

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

/* ---------- обзор: баланс ---------- */
.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, 44px); 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; }
/* Строка статуса на узком экране: «обновлено 06:50 · следующая проверка
   через ~5 ч · живые данные» в одну строку не влезает и рвётся по словам
   («обновлено / 06:50»). Здесь — плотный ряд с переносами по элементам. */
@media (max-width: 640px) {
  .balance .statusline { flex-wrap: wrap; gap: 4px 8px; }
  .balance .statusline .when { font-size: 11px; white-space: nowrap; }
  .balance .live { font-size: 10.5px; }
}
/* «живой» индикатор: пульс только когда данные реально свежие */
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-3); }
.live .pulse {
  width: 7px; height: 7px; border-radius: 50%; background: var(--ok); position: relative;
}
.live .pulse::after {
  content: ""; position: absolute; inset: -3px; border-radius: 50%;
  box-shadow: 0 0 0 0 var(--ok-soft);
  animation: live-pulse 2.4s ease-out infinite;
}
@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 var(--ok-soft); }
  70%, 100% { box-shadow: 0 0 0 7px transparent; }
}
.live.stale .pulse { background: var(--ink-3); }
.live.stale .pulse::after { animation: none; }

/* «куда уходит баланс»: доли моделей полосами */
.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); }

/* ---------- плотная сетка «ключ — значение» (здоровье, лимиты) ----------
   Одна карточка на число превращала обзор в KPI-полосу из равных весов;
   сетка kv держит иерархию: подпись мелкая, значение — крупное. */
.kv {
  display: grid; gap: 12px 18px;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
}
.kv > * { min-width: 0; }
.kv .k { font-size: 11px; color: var(--ink-3); }
.kv .v {
  font-size: 17px; font-weight: 600; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; margin-top: 1px;
}
.kv .s { font-size: 11px; color: var(--ink-3); margin-top: 1px; }

/* ---------- лимит: полоса с риской (B8) ----------
   Разметка-контракт: .meter > .track > (.fill + .tick) + .cap.
   Риска (.tick) лежит ВНУТРИ .track и позиционируется инлайновым left (%)
   — это вычисляемая геометрия, не вёрстка. */
.meter { display: flex; flex-direction: column; gap: 5px; }
.meter .track {
  position: relative; height: 8px; border-radius: 999px;
  background: var(--surface-3); overflow: hidden;
}
.meter .fill { display: block; height: 100%; border-radius: inherit; background: var(--seal); }
.meter .tick {
  position: absolute; top: 0; bottom: 0; width: 2px;
  background: var(--ink); opacity: 0.55;
}
.meter .cap {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.meter .cap b { color: var(--ink); font-weight: 600; }
.meter .cap .spacer { flex: 1; }
.meter.warn .fill { background: var(--warn); }
.meter.bad .fill { background: var(--bad); }

/* ---------- график ----------
   Высота — от КОНТЕЙНЕРА, а не от ширины: пока H считался из W (chart.js),
   скелетон (180px) и настоящий график (210px) имели разную высоту, и при
   каждом поллинге страница дёргалась (CLS). Теперь .chart-box задаёт высоту
   один раз, а SVG растягивается в неё. */
.chart-box { position: relative; height: 210px; }
/* На узком экране график ниже — но опять же контейнером, а не расчётом из
   ширины: точка входа одна (высота .chart-box), и скелетон всегда совпадает. */
@media (max-width: 520px) { .chart-box { height: 150px; } }
.chart-box svg { display: block; width: 100%; height: 100%; overflow: hidden; }
/* Скелетон ВНУТРИ графика тянется по контейнеру: инлайновая высота (skel(180))
   здесь была бы причиной того же прыжка. */
.chart-box > .skel { height: 100%; }
.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; }
/* Правило .area { fill: url(#areaFill) } удалено: реальные id — areaFill-N
   (chart.js нумерует градиенты), а статичный #areaFill не существует.
   CSS перебивает атрибут fill у пути — заливка под линией просто не
   рисовалась. Цвет заливки задаёт сам chart.js в linearGradient. */
.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; }

/* ---------- легенда графика (переключатели серий) ----------
   Разметка-контракт: .chart-legend > button[aria-pressed] с .swatch.
   Состояние — в aria-pressed, а не в классе .off: тогда переключатель
   озвучивается скринридером и не расходится с классом. */
.chart-legend {
  display: flex; flex-wrap: wrap; gap: 4px 14px;
  margin-top: 10px; font-size: 11.5px;
}
.chart-legend button {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 28px; padding: 0 4px;
  border: none; background: none; cursor: pointer;
  font-size: 11.5px; font-weight: 550; color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.chart-legend .swatch { width: 12px; height: 3px; border-radius: 2px; background: var(--seal); flex: none; }
.chart-legend button[aria-pressed="false"] { color: var(--ink-3); }
.chart-legend button[aria-pressed="false"] .swatch { background: var(--line-strong); }
@media (pointer: coarse) {
  /* 44px по высоте — без визуального роста строки: расширяем зону тапа */
  .chart-legend button { position: relative; }
  .chart-legend button::after { content: ""; position: absolute; inset: -8px -4px; }
}

/* ---------- модели: ячейка + каталог ---------- */
.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; }

/* карточки каталога (вкладка «Каталог»): не таблица, а плитки —
   тут смотрят «что вообще есть», а не сравнивают 10 колонок */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.cat-card {
  background: var(--surface); border-radius: var(--r-l); box-shadow: var(--shadow-card);
  padding: 18px; display: flex; flex-direction: column; gap: 12px;
  transition-property: box-shadow, transform; transition-duration: 140ms;
  transition-timing-function: var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .cat-card:hover { box-shadow: var(--shadow-card-hover); transform: translateY(-1px); }
}
.cat-top { display: flex; align-items: flex-start; gap: 12px; }
.cat-tools { display: flex; gap: 2px; margin: -4px -6px 0 0; }
.cat-name { font-size: 15.5px; font-weight: 600; letter-spacing: -0.012em; }
.cat-vendor { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.cat-desc { font-size: 12.8px; color: var(--ink-2); line-height: 1.58; margin: 0; }
.cat-tags { display: flex; flex-wrap: wrap; gap: 4px; }
/* цены: строка «метка … значение», значение — mono и прижато вправо */
.cat-prices { display: grid; gap: 4px; }
.cat-prices .row { display: flex; align-items: baseline; gap: 10px; }
.cat-prices .k { font-size: 11.5px; color: var(--ink-3); }
.cat-prices .v {
  margin-left: auto; font-family: "Orin Mono", monospace; font-size: 12.5px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.cat-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.cat-meta .k { font-size: 10.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; }
.cat-meta .v { font-size: 13.5px; font-weight: 550; font-variant-numeric: tabular-nums; }
.cat-foot {
  display: flex; align-items: center; gap: 8px; flex-wrap: nowrap;
  border-top: 1px solid var(--line); padding-top: 11px; margin-top: auto;
  font-size: 11.5px; color: var(--ink-3);
}
.cat-foot .spacer { flex: 1; }
.cat-foot .conns { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
/* счётчик подключений: полоски, а не число «12» — видно «широкий пул» */
.sup-dots { display: inline-flex; gap: 2px; align-items: center; }
.sup-dots i { width: 4px; height: 10px; border-radius: 1px; background: var(--seal); opacity: 0.85; }
.sup-dots i.off { background: var(--line-strong); opacity: 1; }

/* строка сводки каталога */
.cat-summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px; margin-bottom: 14px;
}
.cat-summary .tile { background: var(--surface); border-radius: var(--r-m); box-shadow: var(--shadow-card); padding: 14px 16px; }
.cat-summary .k { font-size: 11px; color: var(--ink-3); }
.cat-summary .v { font-size: 19px; font-weight: 600; letter-spacing: -0.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.cat-summary .s { font-size: 11px; color: var(--ink-3); margin-top: 1px; }

/* ---------- лог запросов на мобиле ---------- */
.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;
}

/* ---------- подключение ----------
   На узком экране подпись «Base URL / Ключ / Модели» встаёт НАД значением:
   flex-строка с min-width:84px выдавливала пилюлю за край, и адрес с ключом
   переносились в три строки посреди слова. */
@media (max-width: 640px) {
  .field-row { display: block; }
  .field-row .lbl { display: block; min-width: 0; margin-bottom: 6px; }
  .field-row + .field-row { margin-top: 14px; }
  .code-pill, .code-pill.wide { width: 100%; }
  .limits { gap: 6px 14px; }
  /* Цена в таблице «Модели» — диапазон вида $0,0096–$0,021: в узкой
     колонке он рвался на четыре строки посреди числа. Пусть ячейка будет
     неразрывной — таблица скроллится внутри .tbl-wrap. */
  .tbl-sticky td.m-cell-price { white-space: nowrap; }
}
/* Обе карточки ряда «куда уходит баланс / здоровье» тянутся до одной
   высоты; короткий список долей оставлял внизу полкарточки пустоты.
   Доли распределяются по высоте — пустота читается как «воздух». */
.grid-2 > .card { display: flex; flex-direction: column; }
.grid-2 > .card > .share { flex: 1; justify-content: center; }
/* ---------- регистрация, email и восстановление ---------- */
.auth-flow-form { display: grid; gap: 14px; text-align: left; }
.auth-flow-form .field { margin: 0; }
.auth-flow-form .field input { width: 100%; }
.auth-form-status:empty { display: none; }
.auth-captcha { display: grid; gap: 8px; }
.auth-captcha-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.auth-captcha-image { display: block; width: 220px; height: 72px; max-width: 100%; border-radius: 12px; border: 1px solid var(--line); object-fit: contain; }
.auth-captcha > .skel { height: 72px; border-radius: 12px; }
.auth-resend { margin-top: 16px; text-align: left; }
.auth-resend summary { cursor: pointer; font-size: 13px; color: var(--ink-3); }
.auth-resend .auth-captcha { margin-top: 16px; }
.auth-resend > .btn { margin-top: 12px; }
.registration-key { display: flex; align-items: center; gap: 8px; min-width: 0; margin-top: 10px; }
.registration-key code { min-width: 0; overflow-wrap: anywhere; }
.auth-terms { align-items: flex-start; font-size: 12px; }
.auth-terms a { text-decoration: underline; }

/* ---------- аккаунт и несколько ключей ---------- */
.account-id { display: flex; align-items: center; gap: 12px; }
.account-id > .ic { width: 28px; height: 28px; color: var(--seal); }
.account-login { font-size: 18px; font-weight: 600; overflow-wrap: anywhere; }
.key-connect { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; flex: 1; }
.key-connect select {
  max-width: min(100%, 340px); min-height: 40px;
  /* ревью Kimi: нативный select с чёрной рамкой выбивался из дизайн-системы */
  appearance: none; -webkit-appearance: none;
  border: 1px solid var(--line); border-radius: var(--r-s);
  background: var(--surface); color: var(--ink);
  padding: 0 32px 0 12px; font: inherit; font-size: 13.5px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
    linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
.key-connect select:focus-visible { outline: 2px solid var(--seal); outline-offset: 1px; }
.api-key-list { display: grid; gap: 8px; margin: 16px 0; }
.api-key-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px;
  align-items: center; padding: 12px; border-radius: var(--r-m);
  background: var(--surface-inset); border: 1px solid var(--line);
}
.api-key-main { display: grid; gap: 6px; min-width: 0; }
.api-key-main > div:first-child { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.api-key-main .mono { overflow-wrap: anywhere; }
.api-key-label { font-weight: 600; }
.api-key-actions { display: flex; gap: 8px; }
.key-policy { grid-column: 1 / -1; min-width: 0; }
.key-policy summary { cursor: pointer; padding-block: 8px; }
.key-model-list { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); }
/* фильтры лога: та же панель, что на «Использовании» (.filterbar), поиск
   занимает остаток строки */
.history-filters .fb-item { flex: 1 1 170px; }
.history-filters .fb-search { flex: 2 1 240px; }
.history-filters .input, .history-filters select.input { max-width: none; width: 100%; }
.key-model-list { max-height: 240px; overflow: auto; }
.key-model-list label { overflow-wrap: anywhere; }
/* Лимит трат ключа: компактная строка под ключом. Инпут 16px — iOS не зумит. */
.api-key-limit {
  grid-column: 1 / -1; display: flex; align-items: center; flex-wrap: wrap;
  gap: 8px; padding-top: 2px;
}
.api-key-limit .input { width: 132px; height: 34px; padding: 0 10px; }
.api-key-limit .input::placeholder { color: var(--ink-3); }
.api-key-response-mode {
  grid-column: 1 / -1; display: grid; gap: 8px; min-width: 0;
  border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px;
}
.api-key-response-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.api-key-response-head label { display: grid; gap: 6px; flex: 1; min-width: 0; }
.api-key-response-head select {
  width: 100%; max-width: 360px; font-size: 16px; appearance: none;
  padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
    linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
.api-key-response-head select:focus-visible { outline: 2px solid var(--seal); outline-offset: 1px; }
.api-key-response-mode p { margin: 0; max-width: 76ch; }
.api-key-secret {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 8px;
  min-width: 0; padding: 8px 10px; border-radius: var(--r-m);
  background: var(--surface); border: 1px solid var(--line-strong);
}
.api-key-secret code { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.new-key-form { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
.new-key-form input { flex: 1; min-width: 0; }
.new-key-form button { flex-shrink: 0; }
@media (max-width: 640px) {
  .key-connect { display: grid; grid-template-columns: 1fr; width: 100%; }
  .key-connect select { width: 100%; max-width: none; }
  .api-key-row { grid-template-columns: 1fr; }
  .api-key-actions { justify-content: flex-start; }
  .new-key-form { align-items: stretch; flex-direction: column; }
}

/* ---------- подключение ---------- */
.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; }

/* ---------- подключение v3: протоколы ----------
   Три таба с техническими именами (OpenAI Chat Completions и т.д.) в 390px
   не влезают в строку: .proto-tabs переносится, а не скроллится — скрытый
   горизонтальный скролл читается как «третий протокол пропал».
   inline-flex, а не flex: трек .seg не должен растягиваться на всю карточку. */
.proto-picker { display: grid; gap: 8px; }
/* Трек .seg — по содержимому, а не на всю карточку: растянутый
   сегментированный переключатель читается как панель вкладок и теряет
   связь с тремя короткими подписями внутри. */
.proto-tabs { display: inline-flex; flex-wrap: wrap; max-width: 100%; justify-self: start; }
.proto-tabs button { white-space: nowrap; }
.proto-hint { margin: 0; }
.proto-card .card-head { margin-bottom: 6px; }
.proto-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.proto-block { margin-top: 16px; }
.proto-block .snippet { margin-top: 6px; }
.snippet-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.snippet-head .k {
  font-size: 10.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--ink-3);
}
.snippet-head .spacer { flex: 1; }
.proto-env-hint { margin: 6px 0 0; }
@media (max-width: 640px) {
  .proto-tabs { width: 100%; justify-self: stretch; }
  /* без растяжки: три таба не влезают в строку и переносятся —
     flex:1 растянул бы вторую строку на всю ширину (одинокий «Anthropic») */
  .proto-tabs button { flex: 0 1 auto; height: 28px; padding: 0 10px; font-size: 11.5px; }
  /* На мобиле .snippet глобально становится pre-wrap + word-break: break-word.
     Текст виден целиком — проверяем, что при 11px длинные строки curl/SDK
     почти всегда влезают и не рвутся посреди токена. */
  .proto-block .snippet { font-size: 11px; line-height: 1.7; padding: 12px; }
}

/* ---------- адаптив кабинета ---------- */
/* 641–1080: у лога запросов прячем второстепенные колонки (кэш, тип) вместо
   горизонтального скролла: на планшете скролл читается как «таблица
   сломалась», а эти два поля и так есть в раскрытии строки.
   Классы col-cache/col-kind — контракт с account.js (как col-p50 на витрине):
   их надо ставить и на th, и на td. */
@media (min-width: 641px) and (max-width: 1080px) {
  .col-cache, .col-kind, .col-price, .col-p50, .col-ttft { display: none; }
}
@media (max-width: 640px) {
  /* ревью Kimi: «мой расход» в 390px обрезалась на «Списано» — оставляем
     Модель/Запросов/Списано, остальное есть в деталях модели и на десктопе */
  .col-price, .col-cache, .col-p50, .col-kind, .col-ttft { display: none; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .rail { display: none; }
  .nav { display: block; }
  .mtop {
    display: block; position: sticky; top: 0; z-index: 30;
    /* Без backdrop-filter: размытие — приём витрины (там под шапкой только
       воздух). В кабинете под шапкой едут плотные таблицы, и blur давал
       грязную серую полосу поверх цифр плюс лишний композитинг на каждом
       кадре поллинга. */
    background: var(--bg);
    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: 56px; padding: 0 16px; }
  .mtop .spacer { flex: 1; }
  /* меню «Ещё» из cabinetMoreMenu: от общего .menu отличается только
     позицией — прижато вправо, к кнопке в шапке */
  .mtop .menu-wrap { flex: none; }
  .mtop .menu { left: auto; right: 0; min-width: 216px; }
  .mtop .menu a { align-items: center; }
  .mtop .menu a svg { color: var(--ink-3); margin-top: 0; }
  .mtop .menu a[aria-current="page"] svg { color: var(--seal); }
  .mtop .badge { text-decoration: none; }
  .main { padding: 18px 16px calc(88px + env(safe-area-inset-bottom, 0px)); }
  /* Плашка про cookie — над нижней навигацией, а не поверх неё: fixed-блок
     с bottom:16px закрывал «Обзор/Каталог/…» целиком. */
  body[data-screen="app"] .cookie-bar {
    bottom: calc(78px + env(safe-area-inset-bottom, 0px));
  }
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    /* тоже без blur — см. комментарий у .mtop; фон непрозрачный, чтобы
       под панелью не просвечивали строки лога */
    background: var(--bg);
    box-shadow: 0 -1px 0 0 var(--line);
    padding-bottom: max(env(safe-area-inset-bottom, 0px), 2px);
  }
  .nav-in { display: grid; grid-template-columns: repeat(5, 1fr); }
  .navitem {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    padding: 9px 2px 8px; text-decoration: none; color: var(--ink-3);
    font-size: 10px; font-weight: 550;
    /* цель ≥ 44px по обеим осям: панель — главная навигация на телефоне */
    min-height: 56px; min-width: 44px;
    transition-property: color, transform; transition-duration: 120ms;
  }
  .navitem svg { width: 22px; height: 22px; }
  .navitem[aria-current="page"] { color: var(--seal-ink); }
  /* правило «контур по умолчанию, заливка — активное»: заливка без обводки
     в 22px разваливалась в пятно, поэтому обводка остаётся сигнальной */
  .navitem[aria-current="page"] svg { fill: var(--seal-soft); stroke: var(--seal); }
  .navitem:active { transform: scale(0.96); }
}
@media (max-width: 640px) {
  .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; }
  .cat-grid { grid-template-columns: 1fr; }
  /* Сводка каталога на 390px: две плитки в ряд, а не 2×2 «кирпича» с
     разношенными подписями. Значение и подпись в одну строку. */
  .cat-summary { grid-template-columns: 1fr 1fr; gap: 8px; }
  .cat-summary .tile { padding: 12px 13px; }
  .cat-summary .k { font-size: 10.5px; }
  .cat-summary .v { font-size: 17px; }
  .cat-summary .s { font-size: 10.5px; }
}

/* ---------- пополнение: методы, инвойс, отсчёт ----------
   Автоматическая касса: сетка способов → форма суммы → карточка инвойса
   (адрес/QR/таймер). Инвойс замещает форму, поэтому у блоков общий ритм
   отступов, а статус-бейджи переиспользуют badge ok/warn/mute. */
.pay-skel { display: grid; gap: 10px; }
.pay-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--ink-3); margin-bottom: 8px;
}
.pay-methods {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}
.pay-method {
  display: flex; flex-direction: column; align-items: flex-start; gap: 5px;
  min-height: 64px; padding: 11px 13px;
  border: 1px solid var(--line); border-radius: var(--r-m);
  background: var(--surface); color: var(--ink); text-align: left; cursor: pointer;
  transition-property: background-color, border-color, box-shadow;
  transition-duration: 120ms; transition-timing-function: var(--ease-out);
}
.pay-method-name { font-size: 13.5px; font-weight: 600; }
.pay-method-range {
  font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.pay-method.on {
  border-color: var(--seal); background: var(--seal-soft);
  box-shadow: inset 0 0 0 1px var(--seal);
}
.pay-method.on .pay-method-name { color: var(--seal-ink); }
/* недоступный метод: приглушаем фон/подпись, но бейдж «скоро» оставляем
   читаемым — opacity на всей плитке гасила и его */
.pay-method.off { background: var(--surface-2); color: var(--ink-3); cursor: not-allowed; }
.pay-method.off .pay-method-name { color: var(--ink-3); font-weight: 500; }
@media (hover: hover) and (pointer: fine) {
  .pay-method:not(.off):not(.on):hover {
    background: var(--surface-2); border-color: var(--line-strong);
  }
}
.pay-amount-field { margin-top: 16px; }
.pay-amount-field .hint { margin-top: 6px; }

.pay-invoice { display: grid; gap: 14px; }
.pay-invoice-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pay-invoice-head h4 { font-size: 14.5px; font-weight: 600; }
.pay-invoice-head .spacer { flex: 1; }
.pay-order { font-size: 11.5px; color: var(--ink-3); word-break: break-all; }
.pay-invoice-amount {
  font-size: 30px; font-weight: 600; line-height: 1.1;
  letter-spacing: -0.03em; font-variant-numeric: tabular-nums;
}
.pay-invoice-sub { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; }
.pay-invoice .hint { margin-top: 4px; }
.pay-address {
  display: grid; gap: 7px; padding: 12px 14px;
  background: var(--surface-inset); border-radius: var(--r-m);
}
.pay-address-k {
  font-size: 10.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--ink-3);
}
.pay-address-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pay-address-v { font-size: 12.5px; word-break: break-all; }
.pay-qr { display: flex; justify-content: center; }
.pay-qr-img {
  width: 220px; max-width: 100%; height: auto;
  border-radius: var(--r-m); background: var(--surface);
}
.pay-expiry {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.pay-expiry.expired { color: var(--warn); }
.pay-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.pay-manual { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 12px; }
.pay-manual-toggle svg { transition: transform 140ms var(--ease-out); }
.pay-manual-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.pay-manual-form { margin-top: 12px; }

@media (max-width: 640px) {
  .pay-methods { grid-template-columns: 1fr 1fr; }
  .pay-invoice-amount { font-size: 26px; }
}

/* ---------- финансы v3 ----------
   Модалка пополнения, пресеты суммы и история платежей. Слой поверх
   кабинета: .nav/.mtop — 30–40, шторка меню — 60, тосты — 100, поэтому
   backdrop сидит на 70 (выше навигации, ниже тостов). Тени вместо
   бордеров — как у карточек кабинета; hover — только на укажущих
   устройствах, чтобы тап не «залипал». */
.dialog-backdrop {
  position: fixed; inset: 0; z-index: 70;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 10vh 16px 24px;
  background: oklch(0.16 0.01 260 / 0.55);
  overflow-y: auto;
  animation: dialog-fade 160ms var(--ease-out);
}
:root[data-theme="dark"] .dialog-backdrop { background: oklch(0.08 0.01 260 / 0.68); }
@keyframes dialog-fade { from { opacity: 0; } to { opacity: 1; } }
.dialog {
  width: 100%; max-width: 480px; margin: 0 auto;
  max-height: 90dvh; overflow-y: auto;
  padding: 20px;
  background: var(--surface); border-radius: var(--r-l);
  box-shadow: var(--shadow-pop);
  animation: dialog-in 180ms var(--ease-out);
}
.dialog.wide { max-width: 640px; }
@keyframes dialog-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.dialog:focus { outline: none; }
.dialog:focus-visible { outline: 2px solid var(--seal); outline-offset: 3px; }
.dialog-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.dialog-body { min-width: 0; }
.dialog-title { font-size: 16px; font-weight: 600; letter-spacing: -0.02em; }
.dialog-head .dialog-close { margin-left: auto; }
/* на телефоне модалка — лист снизу: до 88dvh, скролл внутри, низ учтён */
@media (max-width: 640px) {
  .dialog-backdrop { align-items: flex-end; padding: 8vh 0 0; }
  .dialog {
    max-width: none; border-radius: var(--r-xl) var(--r-xl) 0 0;
    padding: 18px 16px calc(20px + env(safe-area-inset-bottom, 0px));
    max-height: 88dvh;
    animation-name: dialog-sheet-in;
  }
  @keyframes dialog-sheet-in {
    from { opacity: 0; transform: translateY(22px); }
    to { opacity: 1; transform: none; }
  }
}

/* пресеты суммы: та же идея, что .chip, но цель под палец — 34px/999px */
.pay-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.pay-preset {
  /* ревью Kimi: hit-area 28-34px мала — 40px десктоп, 44px touch */
  min-height: 40px; padding: 0 16px;
  border: none; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2);
  font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition-property: background-color, color, box-shadow;
  transition-duration: 130ms; transition-timing-function: var(--ease-out);
}
.pay-preset.on {
  background: var(--seal-soft); color: var(--seal-ink);
  box-shadow: inset 0 0 0 1px var(--seal-line);
}
.pay-preset[disabled] { opacity: 0.45; cursor: not-allowed; }
.pay-preset:active:not([disabled]) { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) {
  .pay-preset:hover:not(.on):not([disabled]) { background: var(--surface-3); color: var(--ink); }
  .pay-preset.on:hover { background: var(--seal-soft); color: var(--seal-ink); }
}

/* поле суммы: «$» — префикс визуально, число само остаётся числом.
   Селектор с .field — иначе общее правило .field input (0,1,1) перебивает
   класс и число наезжает на знак валюты. */
.pay-amount-wrap { position: relative; display: flex; align-items: center; }
.pay-amount-cur {
  position: absolute; left: 15px; z-index: 1;
  font-size: 17px; font-weight: 600; color: var(--ink-3);
  pointer-events: none;
}
.field .pay-amount-num {
  height: 52px; padding-left: 34px; padding-right: 92px;
  font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
/* суффикс «на баланс»: подсказка, а не единица измерения — тише числа */
.pay-amount-suf {
  position: absolute; right: 14px; z-index: 1;
  font-size: 11.5px; color: var(--ink-3);
  pointer-events: none; white-space: nowrap;
}
.pay-amount-hint { display: flex; flex-wrap: wrap; gap: 2px 4px; }
.pay-fee-note { margin-top: 10px; }
.pay-open-note { margin-top: 8px; color: var(--ink-3); }
.pay-form .hint { font-size: 11.5px; color: var(--ink-3); line-height: 1.5; }
.pay-form .btn.primary { margin-top: 14px; }

/* открытые счета и секции экрана */
.fin-sec { display: block; }
.fin-sec-title {
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  margin: 4px 2px 8px;
}
.fin-invoices .pay-open-card { padding: 18px 20px; }
.pay-history-card { overflow: hidden; }
.pay-hist-body { padding: 0 22px 18px; }
@media (max-width: 640px) { .pay-hist-body { padding: 0 16px 16px; } }
.pay-history thead th { white-space: nowrap; }
.pay-history td { font-variant-numeric: tabular-nums; }
.pay-sum-cell { font-weight: 600; white-space: nowrap; }
.pay-sum-cell.ok { color: var(--ok); }
.pay-hist-actions { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.pay-card { padding: 12px 16px; border-top: 1px solid var(--line); }
.pay-cards { display: block; }
.pay-card:first-child { border-top: none; }
.pay-card-top { display: flex; gap: 8px; align-items: baseline; }
.pay-card-method { font-size: 13px; font-weight: 600; }
.pay-card-amt {
  margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums;
}
.pay-card-amt.ok { color: var(--ok); }
.pay-card-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 4px;
  font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.pay-card .pay-hist-actions { justify-content: flex-start; margin-top: 8px; }
.pay-invoice-head .hint { font-size: 12px; color: var(--ink-3); }
/* секция «Другое» — это уже карточка: переключатель живёт в её шапке,
   поэтому верхняя черта .pay-manual здесь лишняя */
.pay-other .pay-manual { border-top: none; margin-top: 0; padding-top: 0; }
.pay-other .card-head { margin-bottom: 0; }
.pay-other .card-head .pay-manual-toggle { color: var(--ink-2); }
.pay-other .card-head .pay-manual-toggle svg { transition: transform 140ms var(--ease-out); }
.pay-other .card-head .pay-manual-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
@media (max-width: 640px) {
  .fin-invoices .pay-open-card { padding: 16px; }
  .pay-invoice-head .pay-order { width: 100%; }
}

/* ---------- использование v4 ----------
   KPI живут в .kpi-grid (общий компонент); .usage-kpi — только обёртка
   двух рядов (объём и качество), без своей сетки: до v4 это был grid на
   четыре колонки, и восемь карточек внутри сжимались в полоски. */
.usage-kpi { display: block; }
/* период — один на весь экран: строка над графиком, а не внутри его шапки */
.usage-period { display: flex; flex-wrap: wrap; align-items: center; }
/* подзаголовок экрана длиннее прочих hint'ов: не должен растягивать шапку */
.usage-sub { max-width: 46ch; }

/* 19.11: поставщики модели (тайные имена) — чипы на карточке и модалка */
.cat-provs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.cat-provs .spacer { flex: 1; }
.dialog.prov-dialog { max-width: 760px; }
.prov { display: grid; gap: 12px; }
.prov.busy { opacity: 0.6; pointer-events: none; }
.prov-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.prov-controls .spacer { flex: 1; }
.prov-mode { display: grid; gap: 6px; justify-items: start; }
.prov-mode .seg { flex-wrap: wrap; }
.prov-mode .seg button:disabled { opacity: 0.45; cursor: not-allowed; }
.prov-apply { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }
.prov-scope { height: 32px; max-width: 260px; }
.prov-lanes { display: grid; gap: 10px; }
.prov-lane {
  border-radius: var(--r-m); box-shadow: inset 0 0 0 1px var(--line);
  padding: 14px; display: grid; gap: 12px; background: var(--surface);
}
.prov-lane.off { background: var(--surface-2); }
.prov-lane.off .prov-stats { opacity: 0.55; }
.prov-lane-head { display: flex; align-items: flex-start; gap: 8px; }
.prov-name { font-size: 15px; font-weight: 600; letter-spacing: -0.012em; }
.prov-pin { display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.prov-pin code { font-family: "Orin Mono", monospace; font-size: 12px; color: var(--ink-2); }
.prov-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px 14px; }
.prov-stats .v.minor { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.prov-lane.down { box-shadow: inset 0 0 0 1px var(--line-strong); background: var(--surface-inset); }
.prov-caps { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.prov-caps .input.num { width: 9ch; }
.prov-lane.down .prov-stats { opacity: 0.6; }
.prov-down { margin: -4px 0 0; }
.prov-stats .k { font-size: 10.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; }
.prov-stats .v { font-size: 13.5px; font-weight: 550; margin-top: 2px; }
.prov-stats .v.num { font-family: "Orin Mono", monospace; font-variant-numeric: tabular-nums; }
.prov-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn.prov-exclude { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--bad); }
.btn.prov-exclude.on { background: var(--bad-soft); box-shadow: none; }
.prov-help summary { cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--ink-2); }
.prov-help p { font-size: 12.5px; color: var(--ink-2); line-height: 1.55; margin: 8px 0 0; }
@media (max-width: 640px) {
  .prov-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 19.11: каталог — строка на модель (формат витрины, язык OrinAPI:
   бумага, линия, чернила, один сигнальный цвет — сургучная зелень) */
.cat-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cat-toolbar .spacer { flex: 1; }
.cat-search { max-width: 280px; height: 34px; }
.cat-filters { display: flex; flex-wrap: wrap; gap: 4px; }
.cat-count { font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.cat-list {
  background: var(--surface); border-radius: var(--r-l); box-shadow: var(--shadow-card);
  display: grid; overflow: hidden;
}
.cat-row {
  display: grid; grid-template-columns: 28px 40px minmax(0, 1fr) minmax(220px, auto);
  gap: 0 14px; align-items: start; padding: 16px 18px 16px 12px;
  border-top: 1px solid var(--line);
}
.cat-row:first-child { border-top: none; }
.cat-row.clickable { cursor: pointer; transition: background-color 140ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .cat-row.clickable:hover { background: var(--surface-inset); }
  .cat-row.clickable:hover .cat-open { box-shadow: inset 0 0 0 1px var(--seal-line); color: var(--seal-ink); }
  .cat-star:hover { color: var(--ink-3); }
  .cat-copy:hover { opacity: 1; }
}
.cat-row:focus-visible { outline: 2px solid var(--seal); outline-offset: -2px; }
.cat-star {
  border: none; background: transparent; color: var(--line-strong); cursor: pointer;
  width: 28px; height: 28px; display: grid; place-items: center; border-radius: var(--r-s);
  margin-top: 6px; transition: color 140ms var(--ease-out);
}
.cat-star.on { color: var(--seal); }
.cat-star svg { width: 16px; height: 16px; }
/* логотип вендора в «штампе»: бумага + линия, знак 22px */
.cat-logo {
  width: 40px; height: 40px; border-radius: var(--r-m); display: grid; place-items: center;
  background: var(--surface-inset); box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink); font-family: "Orin Mono", monospace; font-weight: 600;
  font-size: 13px; letter-spacing: -0.02em;
}
.cat-logo svg { width: 22px; height: 22px; display: block; }
.cat-main { min-width: 0; display: grid; gap: 8px; }
.cat-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cat-title .cat-name { font-size: 15.5px; font-weight: 600; letter-spacing: -0.012em; }
.cat-id { display: flex; align-items: center; gap: 2px; margin-top: -6px; }
.cat-id code { font-family: "Orin Mono", monospace; font-size: 12px; color: var(--ink-3); }
.cat-copy { width: 24px; height: 24px; opacity: 0.6; }
.cat-caps { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.cat-cap { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink-3); }
.cat-cap svg { width: 13px; height: 13px; flex: none; }
.cat-provs { display: flex; flex-wrap: wrap; gap: 6px; }
.cat-prov {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px;
  border-radius: 999px; font-size: 12px; font-weight: 550; color: var(--ink-2);
  background: var(--surface-2);
}
.cat-prov i { width: 6px; height: 6px; border-radius: 50%; background: var(--seal); opacity: 0.85; }
.cat-prov.warn i { background: var(--warn); }
.cat-prov.down { color: var(--ink-3); background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.cat-prov.down i { background: var(--line-strong); }
.cat-hint { margin: 0; }
.cat-side { display: grid; justify-items: end; gap: 10px; }
.cat-price-wrap { display: flex; align-items: flex-end; gap: 10px; }
.cat-from, .cat-unit { font-size: 11.5px; color: var(--ink-3); padding-bottom: 3px; white-space: nowrap; }
.cat-price { display: grid; grid-template-columns: repeat(3, auto); gap: 0 18px; text-align: right; }
.cat-price .k {
  font-size: 10.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em;
}
.cat-price .v {
  font-family: "Orin Mono", monospace; font-size: 15px; font-weight: 600; margin-top: 2px;
  font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink);
}
.cat-price .minor .v { font-size: 13px; font-weight: 500; color: var(--ink-2); padding-top: 2px; }
.cat-price .approx { color: var(--ink-3); font-weight: 400; margin-right: 3px; }
.cat-price.none { display: block; font-size: 12px; color: var(--ink-3); }
.cat-side-foot { display: flex; align-items: center; gap: 10px; }
.cat-meta-line { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.cat-open svg { width: 14px; height: 14px; }
@media (max-width: 760px) {
  .cat-row { grid-template-columns: 28px 40px minmax(0, 1fr); gap: 10px 12px; }
  .cat-side { grid-column: 3; justify-items: start; }
  .cat-price { text-align: left; }
  .cat-price-wrap { flex-wrap: wrap; }
}

/* ---------- лог: провайдер и чек «как посчитано» (20.11) ----------
   Чек как квитанция: бумага, линия, чернила. Формула — приглушённым
   моноширинным («797 × $0.026 за 1M»), сумма — чернилами справа,
   итог — над двойной линией. Без цветных заливок: сигнал только у точки
   провайдера (тот же знак, что в каталоге). */
td.col-prov .cat-prov, .rc-prov .cat-prov { font-size: 12px; }
.receipt {
  margin: 4px 0 2px; padding: 14px 16px 12px; border-radius: var(--r-m);
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line);
}
.rc-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-3);
  padding-bottom: 8px;
}
.rc-prov { display: inline-flex; align-items: center; gap: 6px; text-transform: none; letter-spacing: 0; font-size: 12px; }
.rc-tbl { display: grid; grid-template-columns: minmax(130px, 0.9fr) minmax(0, 2fr) auto; }
.rc-row { display: contents; }
.rc-row > span { padding: 7px 0; border-top: 1px solid var(--line); font-size: 12.5px; }
.rc-k { color: var(--ink-2); padding-right: 12px !important; }
.rc-f { color: var(--ink-3); font-family: "Orin Mono", monospace; font-size: 12px !important;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.rc-f .rc-n { color: var(--ink-2); }
.rc-f .rc-u { font-family: inherit; }
.rc-op { color: var(--ink-3); }
.rc-v { text-align: right; font-family: "Orin Mono", monospace; font-variant-numeric: tabular-nums;
  color: var(--ink); padding-left: 16px !important; white-space: nowrap; }
.rc-row.adj .rc-k, .rc-row.adj .rc-v { color: var(--ink-3); }
.rc-row.total > span { border-top: 3px double var(--line-strong); padding-top: 9px; }
.rc-row.total .rc-k, .rc-row.total .rc-v { color: var(--ink); font-weight: 600; }
.rc-note { margin: 10px 0 0; font-size: 11.5px; color: var(--ink-3); line-height: 1.45; }
@media (max-width: 640px) {
  .rc-tbl { display: block; }
  .rc-row { display: grid; grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "k v" "f f"; border-top: 1px solid var(--line); padding: 7px 0; }
  .rc-row > span { border-top: 0; padding: 0; }
  .rc-row > .rc-k { grid-area: k; }
  .rc-row > .rc-v { grid-area: v; }
  .rc-row > .rc-f { grid-area: f; padding-top: 3px; }
  .rc-row.total { border-top: 3px double var(--line-strong); }
  .rc-row.total > span { border-top: 0; padding-top: 0; }
}

/* ============================================================
   КАБИНЕТ v4 (23.11): KPI-карточки, метрики, фильтры, вкладки,
   графики (viz.js), разрезы, полоса стабильности, календарь.

   Плотность — «дашбордная»: шаг сетки 12px, карточки без лишних
   рамок (тень = elevation, бордер = структура), числа tabular-nums.
   ============================================================ */

/* ---------- KPI-карточки ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi-grid.minor { margin-top: 12px; }
.kpi {
  position: relative; min-width: 0;
  display: flex; flex-direction: column; gap: 2px;
  padding: 14px 16px 15px; border-radius: var(--r-l);
  background: var(--surface); box-shadow: var(--shadow-card);
  color: inherit; text-decoration: none;
}
.kpi.accent { box-shadow: var(--shadow-card), inset 3px 0 0 0 var(--seal); }
.kpi-k { font-size: 11.5px; color: var(--ink-3); display: flex; align-items: center; gap: 4px; }
.kpi-hint { color: var(--ink-3); display: inline-flex; }
.kpi-hint svg { width: 13px; height: 13px; }
.kpi-v {
  font-size: 25px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.12;
  font-variant-numeric: tabular-nums;
}
.kpi-grid.minor .kpi-v { font-size: 20px; }
.kpi-s { font-size: 11.5px; color: var(--ink-3); overflow-wrap: anywhere; }
.kpi-d { margin-top: 1px; }
.kpi-a { margin-top: 8px; }
.kpi.link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
@media (hover: hover) and (pointer: fine) {
  .kpi.link:hover { box-shadow: var(--shadow-card-hover); }
}
/* дельта к прошлому периоду: знак — стрелкой и текстом, не только цветом */
.delta { font-size: 11.5px; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.delta.good { color: var(--ok); }
.delta.bad { color: var(--bad); }
.delta.flat { color: var(--ink-3); }
.delta-s { color: var(--ink-3); }

/* ---------- плитки метрик (здоровье) ---------- */
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 16px; }
.metrics.wide { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric { min-width: 0; }
.metric .k { font-size: 11px; color: var(--ink-3); }
.metric .v {
  font-size: 19px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2;
  font-variant-numeric: tabular-nums; margin-top: 1px;
}
.metric .s { font-size: 10.5px; color: var(--ink-3); margin-top: 1px; }
.health-foot {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line);
}
.health-foot .hint { font-size: 11.5px; }
.err-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.err-chips .chip b { margin-left: 5px; color: var(--ink-3); font-weight: 600; }

/* ---------- панель фильтров ---------- */
.filterbar {
  display: flex; align-items: flex-end; gap: 10px 16px; flex-wrap: wrap;
  padding: 12px 16px; border-radius: var(--r-l);
  background: var(--surface); box-shadow: var(--shadow-card);
}
.filterbar .spacer { flex: 1; }
.fb-item { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fb-k { font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); }
.fb-item .input, .fb-item select.input { height: 34px; min-width: 180px; max-width: 280px; }
.filterbar .hint { font-size: 11.5px; max-width: 34ch; text-align: right; }

/* ---------- переключатели внутри карточки ---------- */
.toggles { display: inline-flex; gap: 2px; padding: 2px; background: var(--surface-2); border-radius: var(--r-s); }
.tog {
  border: 0; background: none; cursor: pointer; border-radius: calc(var(--r-s) - 1px);
  height: 26px; padding: 0 10px; font-size: 12px; font-weight: 550; color: var(--ink-3);
  transition: background-color 120ms var(--ease-out), color 120ms var(--ease-out);
}
.tog[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-card); }
.card-total { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }

/* ---------- вкладки разрезов ---------- */
.tabs {
  display: flex; gap: 2px; padding: 0 16px; overflow-x: auto;
  box-shadow: inset 0 -1px 0 0 var(--line);
}
.tab {
  border: 0; background: none; cursor: pointer; white-space: nowrap;
  height: 38px; padding: 0 12px; font-size: 13px; font-weight: 550; color: var(--ink-3);
  display: inline-flex; align-items: center; gap: 6px;
}
.tab[aria-selected="true"] { color: var(--ink); box-shadow: inset 0 -2px 0 0 var(--seal); }
.tab-n { font-size: 10.5px; color: var(--ink-3); background: var(--surface-2); border-radius: 999px; padding: 1px 6px; }
.cut-body { padding: 4px 0 8px; }

/* ---------- графики viz.js ---------- */
.viz-box { position: relative; height: 200px; }
.viz-box.tall { height: 260px; }
.viz-box.short { height: 110px; }
@media (max-width: 640px) {
  .viz-box { height: 170px; }
  .viz-box.tall { height: 200px; }
}
.viz-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.viz-box .grid-line { stroke: var(--line); stroke-width: 1; }
.viz-box .axis-label {
  fill: var(--ink-3); font-size: 10.5px; font-variant-numeric: tabular-nums;
  font-family: "Orin Mono", monospace;
}
.viz-box .viz-hit { fill: transparent; }
.viz-col { transition: opacity 120ms var(--ease-out); }
.viz-col.dim { opacity: 0.42; }
.viz-box .cross { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; }
.viz-box .cross.on { opacity: 1; }
.viz-svg:focus-visible { outline: 2px solid var(--seal); outline-offset: 3px; border-radius: 6px; }
.viz-tip {
  position: absolute; z-index: 5; transform: translate(-50%, -100%);
  min-width: 140px; max-width: 260px; padding: 8px 10px;
  background: var(--tooltip-bg); color: var(--tooltip-ink);
  border-radius: var(--r-s); box-shadow: var(--shadow-pop);
  font-size: 11.5px; line-height: 1.45; pointer-events: none; opacity: 0;
  transition: opacity 120ms var(--ease-out);
}
.viz-tip.on { opacity: 1; }
.viz-tip-h { font-weight: 600; margin-bottom: 4px; }
.viz-tip-r { display: flex; align-items: center; gap: 6px; }
.viz-tip-r span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viz-tip-r b { margin-left: auto; font-variant-numeric: tabular-nums; }
.viz-tip-r.total { margin-top: 3px; padding-top: 3px; border-top: 1px solid currentColor; opacity: 0.85; }
.viz-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 10px; }
.viz-legend-i { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-2); }
.sw { width: 9px; height: 9px; border-radius: 2px; flex: none; display: inline-block; }
.sw.dash { height: 3px; width: 12px; border-radius: 2px; }
.sub-head {
  margin-top: 14px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--ink-3);
}
.chart-note { margin-top: 8px; font-size: 11.5px; }

/* донат долей */
.viz-donut-wrap { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.viz-donut { display: block; }
.viz-donut-track { fill: none; stroke: var(--surface-2); stroke-width: 16; }
.viz-donut-c { position: absolute; text-align: center; line-height: 1.2; }
.viz-donut-c b { display: block; font-size: 16px; font-weight: 600; letter-spacing: -0.02em; }
.viz-donut-c span { font-size: 10.5px; color: var(--ink-3); }
.share-split { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; align-items: center; }
.share-split.wide { gap: 22px; align-items: start; }
.share-row {
  display: grid; grid-template-columns: 10px minmax(0, 1fr) auto auto; gap: 10px; align-items: center;
  font-size: 12.5px;
}
.share-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-row .vl, .share-row .pc { font-variant-numeric: tabular-nums; }
.share-row .pc { color: var(--ink-3); min-width: 3.5ch; text-align: right; }
.share-row[role="button"] { cursor: pointer; border-radius: var(--r-xs); }
@media (hover: hover) and (pointer: fine) {
  .share-row[role="button"]:hover .nm { color: var(--seal); }
}
.m-dot { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.m-dot span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
tr.clickable { cursor: pointer; }
@media (hover: hover) and (pointer: fine) {
  tr.clickable:hover td { background: var(--surface-2); }
}

/* ---------- провайдеры: микс и стабильность ---------- */
.prov-mix { display: grid; gap: 8px; }
.prov-mix-row {
  display: grid; grid-template-columns: 7em minmax(60px, 1fr) 4.5em 4.5em 5em;
  gap: 10px; align-items: center; font-size: 12.5px;
}
.prov-mix-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.prov-mix-row .bar { height: 7px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.prov-mix-row .bar i { display: block; height: 100%; background: var(--seal); border-radius: 4px; }
.prov-mix-row .vl, .prov-mix-row .s { text-align: right; font-variant-numeric: tabular-nums; }
.prov-mix-row .s { color: var(--ink-3); }
.prov-mix-legend {
  display: grid; grid-template-columns: 7em minmax(60px, 1fr) 4.5em 4.5em 5em;
  gap: 10px; margin-top: 8px; font-size: 10.5px;
}
.prov-mix-legend span { text-align: right; }
.prov-mix-legend span:first-child { grid-column: 3; }

.viz-strip { display: flex; align-items: flex-end; gap: 2px; height: 34px; }
.viz-strip-box { position: relative; }
.viz-strip .viz-cell { cursor: default; outline: none; transition: filter 80ms var(--ease-out), box-shadow 80ms var(--ease-out); }
.viz-strip .viz-cell.on, .viz-strip .viz-cell:focus-visible { filter: brightness(1.12); box-shadow: 0 0 0 1.5px var(--ink-2); }
.strip-tip { min-width: 120px; white-space: nowrap; }
.strip-tip .viz-tip-r.mute { opacity: 0.72; }
.prov-window { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--r-s); background: var(--surface-2); }
.prov-window button { border: 0; background: transparent; padding: 4px 10px; border-radius: calc(var(--r-s) - 2px); font: inherit; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.prov-window button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-card); font-weight: 600; }
.prov-since { font-size: 11px; color: var(--ink-3); margin-top: 4px; }
.viz-cell { flex: 1; min-width: 3px; border-radius: 2px; background: var(--surface-3); }
.viz-cell.good { background: var(--ok); }
.viz-cell.warn { background: var(--warn); }
.viz-cell.bad { background: var(--bad); }
.viz-cell.none { background: var(--surface-3); }
.strip-legend { display: flex; gap: 12px; margin-top: 6px; font-size: 10.5px; color: var(--ink-3); }
.strip-legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 4px; }

/* ---------- календарь активности ---------- */
.viz-heat-wrap { display: flex; flex-direction: column; gap: 8px; }
.viz-heat {
  display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 12px);
  gap: 3px; overflow-x: auto; padding-bottom: 2px;
}
.viz-heat-c { width: 12px; height: 12px; border-radius: 3px; background: var(--surface-3); }
.viz-heat-c.l0 { background: var(--surface-3); }
.viz-heat-c.l1 { background: var(--seal-soft); }
.viz-heat-c.l2 { background: var(--seal-line); }
.viz-heat-c.l3 { background: var(--seal); opacity: 0.75; }
.viz-heat-c.l4 { background: var(--seal); }
.viz-heat-legend { display: flex; align-items: center; gap: 4px; font-size: 10.5px; color: var(--ink-3); }

/* ---------- таблицы-эквиваленты и раскрывашки ---------- */
.tbl-toggle { margin-top: 12px; }
.tbl-toggle > summary {
  cursor: pointer; font-size: 12px; color: var(--ink-2); display: flex; align-items: center; gap: 6px;
  list-style: none;
}
.tbl-toggle > summary::-webkit-details-marker { display: none; }
.tbl-toggle > summary svg { transition: transform 140ms var(--ease-out); }
.tbl-toggle[open] > summary svg { transform: rotate(180deg); }
table.compact { font-size: 12.5px; }
table.compact th, table.compact td { padding: 7px 10px; }
tfoot td { font-weight: 600; border-top: 1px solid var(--line-strong); }

.card.fold > summary {
  display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none;
  padding: 14px 20px;
}
.card.fold > summary::-webkit-details-marker { display: none; }
.card.fold > summary svg { margin-left: auto; transition: transform 140ms var(--ease-out); }
.card.fold[open] > summary svg { transform: rotate(180deg); }
.fold-t { font-size: 14.5px; font-weight: 600; }
.card-pad-x { padding: 0 20px 10px; }

/* ---------- топ дорогих запросов ---------- */
.top-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.top-list li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
.top-list li:last-child { border-bottom: 0; }
.top-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.top-main .mono { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-main .hint { font-size: 11px; }
.top-amt { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- широкая сетка «график + доли» ---------- */
.grid-wide { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 12px; }

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-wide { grid-template-columns: minmax(0, 1fr); }
  .metrics, .metrics.wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .apptop { display: none; }
  .main { padding: 18px 16px calc(88px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 640px) {
  .kpi-v { font-size: 21px; }
  .share-split, .share-split.wide { grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 14px; }
  .filterbar { padding: 12px; }
  .fb-item .input, .fb-item select.input { min-width: 0; width: 100%; max-width: none; }
  .fb-item { width: 100%; }
  .filterbar .hint { display: none; }
  .prov-mix-row { grid-template-columns: 5.5em minmax(40px, 1fr) 4em 4em; }
  .prov-mix-row .s:last-child { display: none; }
  .prov-mix-legend { display: none; }
  .main-in .page-head h1 { font-size: 20px; }
}
/* шапка экрана кабинета: без «воздуха» публичной страницы (site.css даёт
   .page-head padding 44px — кабинету он не нужен, сверху уже верхняя панель) */
.main-in .page-head { padding: 0; }
.main-in .quick-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .main-in .quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .main-in .quick-actions { grid-template-columns: minmax(0, 1fr); } }
/* строка-ошибка лога: красный только у метки, строка остаётся читаемой */
tr.err-row td { color: var(--ink-2); }
.badge.bad.soft { background: var(--bad-soft); color: var(--bad); }
.req-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }
.req-status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.req-status.bad .dot { background: var(--bad); }
.req-status.bad { color: var(--bad); }
.req-status.mute .dot { background: var(--ink-3); }
.req-status.mute { color: var(--ink-3); }
/* провайдер: здоровье за 24 ч — четыре цифры и полоса часов */
.prov-health { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.prov-health-k { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px; }
.prov-health-k .hint { text-transform: none; letter-spacing: 0; font-weight: 400; }
.prov-health-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 10px; }
.prov-health-stats .k { font-size: 10.5px; color: var(--ink-3); }
.prov-health-stats .v { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.prov-health-stats .v.good { color: var(--ok); }
.prov-health-stats .v.warn { color: var(--warn); }
.prov-health-stats .v.bad { color: var(--bad); }
.strip-legend .viz-cell { display: inline-block; width: 8px; height: 8px; min-width: 0; flex: none; margin-right: 4px; vertical-align: -1px; }
.prov-basis { font-size: 11px; }
@media (max-width: 640px) { .prov-health-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* ---------- ключи v4: таблица + диалог ---------- */
.key-name { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; }
.key-name .pill-n {
  font-size: 10.5px; font-weight: 600; color: var(--seal-ink);
  background: var(--seal-soft); border-radius: 999px; padding: 1px 7px;
}
.key-bar { height: 5px; width: 120px; margin: 5px 0 0 auto; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.key-bar i { display: block; height: 100%; background: var(--seal); border-radius: 3px; }
tr.key-archived td { color: var(--ink-3); }
.new-key-form { display: flex; gap: 8px; align-items: center; }
.new-key-form .input { height: 32px; min-width: 200px; }
.key-dialog { display: grid; gap: 18px; }
.key-dialog section + section { padding-top: 16px; border-top: 1px solid var(--line); }
.key-dialog h4 { margin: 0 0 8px; font-size: 13px; font-weight: 600; }
.key-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.key-meta code { font-size: 12.5px; }
.key-danger-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn.danger { color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad-soft); background: transparent; }
@media (hover: hover) and (pointer: fine) {
  .btn.danger:hover { background: var(--bad-soft); }
}
.key-all { display: flex; align-items: center; gap: 6px; }
@media (max-width: 1080px) { .col-created, .col-mode { display: none; } }
@media (max-width: 640px) {
  .col-models { display: none; }
  .new-key-form { width: 100%; }
  .new-key-form .input { flex: 1; min-width: 0; }
}
/* пустой график не держит полную высоту: три «нет данных» по 260px читались
   как сломанный экран (новый аккаунт) */
.viz-box:has(.empty), .chart-box:has(.empty) { height: auto; }
.viz-box:has(.empty) .empty, .chart-box:has(.empty) .empty { padding: 18px 12px; }
