/* Кабинет нейроботов — бенто-оформление и слой «ткни что угодно».
   Поверхности плиток совпадают с поверхностями графиков (#fcfcfb / #1a1a19),
   на которых проверялась палитра серий: свечения и градиенты берут те же
   оттенки с низкой прозрачностью и не влияют на читаемость данных. */

:root {
  color-scheme: light;

  --page: #f4f4f1;
  --surface: #fcfcfb;
  --surface-2: #f2f1ec;
  --surface-3: #e9e8e2;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --line: #c3c2b7;
  --border: rgba(11, 11, 11, 0.1);
  --border-strong: rgba(11, 11, 11, 0.18);

  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-1-wash: rgba(42, 120, 214, 0.1);
  --ramp-track: #cde2fb;

  --good: #0ca30c;
  --good-ink: #006300;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;

  --glow-1: rgba(42, 120, 214, 0.16);
  --glow-2: rgba(235, 104, 52, 0.14);
  --glow-3: rgba(27, 175, 122, 0.14);
  --sheen: rgba(255, 255, 255, 0.7);

  --r-xl: 22px;
  --r-lg: 16px;
  --r-md: 11px;
  --r-sm: 8px;
  --shadow-1: 0 1px 2px rgba(11, 11, 11, 0.06);
  --shadow-2: 0 2px 6px rgba(11, 11, 11, 0.06), 0 18px 40px -28px rgba(11, 11, 11, 0.4);
  --shadow-3: 0 8px 18px rgba(11, 11, 11, 0.1), 0 30px 60px -30px rgba(11, 11, 11, 0.45);
  --sans: system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'Cascadia Mono', Consolas, monospace;
  --sidebar-w: 216px;
  --inspector-w: 344px;
  --topbar-h: 58px;
}

/* Тёмная схема объявлена дважды: медиазапрос ловит настройку системы,
   scope [data-theme] — переключатель в шапке, и он должен побеждать. */
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme='light'])) {
    color-scheme: dark;
    --page: #0a0a0b;
    --surface: #1a1a19;
    --surface-2: #232322;
    --surface-3: #2c2c2a;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --line: #383835;
    --border: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.2);
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-1-wash: rgba(57, 135, 229, 0.16);
    --ramp-track: #184f95;
    --good-ink: #0ca30c;
    --glow-1: rgba(57, 135, 229, 0.3);
    --glow-2: rgba(217, 89, 38, 0.22);
    --glow-3: rgba(25, 158, 112, 0.22);
    --sheen: rgba(255, 255, 255, 0.06);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-2: 0 2px 8px rgba(0, 0, 0, 0.5), 0 20px 44px -28px rgba(0, 0, 0, 0.9);
    --shadow-3: 0 10px 24px rgba(0, 0, 0, 0.55), 0 34px 70px -30px rgba(0, 0, 0, 0.95);
  }
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --page: #0a0a0b;
  --surface: #1a1a19;
  --surface-2: #232322;
  --surface-3: #2c2c2a;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --muted: #898781;
  --grid: #2c2c2a;
  --line: #383835;
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.2);
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-1-wash: rgba(57, 135, 229, 0.16);
  --ramp-track: #184f95;
  --good-ink: #0ca30c;
  --glow-1: rgba(57, 135, 229, 0.3);
  --glow-2: rgba(217, 89, 38, 0.22);
  --glow-3: rgba(25, 158, 112, 0.22);
  --sheen: rgba(255, 255, 255, 0.06);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-2: 0 2px 8px rgba(0, 0, 0, 0.5), 0 20px 44px -28px rgba(0, 0, 0, 0.9);
  --shadow-3: 0 10px 24px rgba(0, 0, 0, 0.55), 0 34px 70px -30px rgba(0, 0, 0, 0.95);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Крупные мягкие пятна света за интерфейсом — фон перестаёт быть плоским. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(58% 42% at 12% -6%, var(--glow-1), transparent 68%),
    radial-gradient(46% 38% at 88% 4%, var(--glow-3), transparent 66%),
    radial-gradient(38% 34% at 62% 96%, var(--glow-2), transparent 70%);
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.22; }
h1 { font-size: 27px; letter-spacing: -0.02em; }
h2 { font-size: 20px; letter-spacing: -0.01em; }
h3 { font-size: 15.5px; }
h4 { font-size: 13.5px; }
p { margin: 0 0 10px; }
a { color: var(--series-1); text-decoration: none; }
a:hover { text-decoration: underline; }
small { font-size: 13px; }
::selection { background: var(--series-1-wash); }

.muted { color: var(--muted); }
.dim { color: var(--ink-2); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mono-num { font-variant-numeric: tabular-nums; }
.stack { display: flex; flex-direction: column; gap: 4px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grow { flex: 1; }
.hidden { display: none !important; }

/* Надпись-рубрика: мелкие прописные с разрядкой, метка любого блока. */
.eyebrow {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── бенто-сетка ─────────────────────────────────────────────────────── */

.bento {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.b1 { grid-column: span 1; }
.b2 { grid-column: span 2; }
.b3 { grid-column: span 3; }
.b4 { grid-column: span 4; }
.b6 { grid-column: span 6; }
.rows2 { grid-row: span 2; }

/* Общая основа плитки и панели. */
.card, .tile {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.card { padding: 18px 20px; }
.card-tight { padding: 14px 16px; }

/* Верхний блик: тонкая световая линия по кромке, как на стекле. */
.card::before, .tile::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--sheen), transparent);
  opacity: 0.9;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.card-head .sub { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.card-title { display: flex; align-items: center; gap: 8px; }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cards { grid-template-columns: repeat(auto-fit, minmax(258px, 1fr)); }
.section { margin-bottom: 14px; }

/* ── плитки-показатели ───────────────────────────────────────────────── */

.tile {
  padding: 15px 17px 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 118px;
}
.tile-label { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.tile-value {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin-top: 2px;
}
.tile-value .unit { font-size: 14px; font-weight: 500; color: var(--ink-2); margin-left: 4px; letter-spacing: 0; }
.tile-foot { margin-top: auto; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.tile-spark { margin: 2px 0 -2px; }

/* Узкая плитка в бенто (b1): число мельче, иначе оно ломается в две строки. */
.tile-compact { min-height: 106px; padding: 13px 15px 12px; }
.tile-compact .tile-label { font-size: 11.5px; }
.tile-compact .tile-value { font-size: 20px; }
.tile-compact .tile-value .unit { font-size: 11.5px; margin-left: 3px; }
.tile-compact .tile-foot { font-size: 11px; }

/* Акцентная плитка: за числом расходится свечение своего оттенка. */
.tile-glow-1::after, .tile-glow-2::after, .tile-glow-3::after {
  content: '';
  position: absolute;
  inset: auto -30% -60% -10%;
  height: 150%;
  pointer-events: none;
  background: radial-gradient(52% 60% at 22% 100%, var(--glow-1), transparent 72%);
}
.tile-glow-2::after { background: radial-gradient(52% 60% at 22% 100%, var(--glow-2), transparent 72%); }
.tile-glow-3::after { background: radial-gradient(52% 60% at 22% 100%, var(--glow-3), transparent 72%); }
.tile > * { position: relative; z-index: 1; }

.hero-tile { min-height: 190px; justify-content: space-between; padding: 20px 22px; }
.hero-figure {
  font-size: 52px;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1;
}
.hero-figure .unit { font-size: 18px; }

.delta-up { color: var(--good-ink); }
.delta-down { color: var(--critical); }

/* ── «ткни что угодно»: общий вид всего интерактивного ───────────────── */

.is-probe {
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
  -webkit-tap-highlight-color: transparent;
}
.is-probe:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-2);
}
.is-probe:focus-visible {
  outline: 2px solid var(--series-1);
  outline-offset: 2px;
}
/* Уголок-стрелка проявляется на наведении: подсказка «здесь есть разбор». */
.is-probe .probe-arrow {
  position: absolute;
  top: 12px;
  right: 13px;
  font-size: 12px;
  color: var(--muted);
  opacity: 0;
  transform: translate(-3px, 3px);
  transition: opacity 0.16s, transform 0.16s;
  z-index: 2;
}
.is-probe:hover .probe-arrow, .is-probe:focus-visible .probe-arrow { opacity: 1; transform: none; }

/* Выбранная плитка/строка остаётся отмеченной, пока открыта в инспекторе. */
.is-probe.is-active {
  border-color: var(--series-1);
  box-shadow: 0 0 0 1px var(--series-1), var(--shadow-2);
}
.is-probe.is-active .probe-arrow { opacity: 1; color: var(--series-1); transform: none; }

/* Строки таблиц и списков — тот же контракт, но без подъёма. */
tr.is-probe:hover, li.is-probe:hover, .probe-row:hover {
  transform: none;
  background: var(--surface-2);
  box-shadow: none;
}
tr.is-probe.is-active, .probe-row.is-active {
  background: var(--series-1-wash);
  box-shadow: inset 2px 0 0 var(--series-1);
}

/* Мелкая инлайн-цель: число или слово, которое можно ткнуть. */
.probe-inline {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  border-bottom: 1px dashed var(--line);
}
.probe-inline:hover { color: var(--series-1); border-bottom-color: var(--series-1); }

/* ── кнопки и поля ───────────────────────────────────────────────────── */

.btn {
  appearance: none;
  position: relative;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink);
  font: 500 13.5px/1 var(--sans);
  padding: 9px 14px;
  border-radius: var(--r-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  transition: background 0.14s, border-color 0.14s, transform 0.14s, box-shadow 0.14s;
}
.btn:hover { background: var(--surface-3); transform: translateY(-1px); box-shadow: var(--shadow-1); }
.btn:active { transform: none; }
.btn:focus-visible { outline: 2px solid var(--series-1); outline-offset: 2px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary {
  background: var(--series-1);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 18px -8px var(--series-1);
}
.btn-primary:hover { background: var(--series-1); filter: brightness(1.1); }
.btn-danger { color: var(--critical); border-color: color-mix(in oklab, var(--critical) 38%, transparent); background: transparent; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn-block { width: 100%; justify-content: center; }
.btn-kbd { font-family: var(--mono); font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; }

/* Сегментированный переключатель — для диапазонов и режимов. */
.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 2px; gap: 2px; }
.segmented button {
  appearance: none; border: none; background: none; cursor: pointer;
  font: 500 12.5px var(--sans); color: var(--muted);
  padding: 6px 11px; border-radius: 8px;
  transition: background 0.14s, color 0.14s;
}
.segmented button:hover { color: var(--ink); }
.segmented button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

label { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 5px; }
.field { margin-bottom: 13px; }
input[type='text'], input[type='email'], input[type='password'], input[type='number'],
input[type='search'], select, textarea {
  width: 100%;
  background: var(--page);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 12px;
  font: 14.5px/1.4 var(--sans);
  transition: border-color 0.14s, box-shadow 0.14s;
}
textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--series-1);
  box-shadow: 0 0 0 3px var(--series-1-wash);
}
input[type='range'] { accent-color: var(--series-1); padding: 0; border: none; background: none; }
input[type='checkbox'] { accent-color: var(--series-1); width: auto; }
.hint { font-size: 12px; color: var(--muted); margin-top: 5px; line-height: 1.5; }
.error-text { color: var(--critical); font-size: 13px; }

/* ── бейджи ──────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-2);
  white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge-plain::before { display: none; }
.badge-good { color: var(--good-ink); background: color-mix(in oklab, var(--good) 12%, transparent); border-color: color-mix(in oklab, var(--good) 28%, transparent); }
.badge-warn { color: var(--ink); background: color-mix(in oklab, var(--warning) 20%, transparent); border-color: color-mix(in oklab, var(--warning) 42%, transparent); }
.badge-crit { color: var(--critical); background: color-mix(in oklab, var(--critical) 12%, transparent); border-color: color-mix(in oklab, var(--critical) 30%, transparent); }
.badge-info { color: var(--series-1); background: var(--series-1-wash); border-color: color-mix(in oklab, var(--series-1) 28%, transparent); }
.badge-live::before { animation: pulse 1.8s ease-in-out infinite; }

/* ── таблицы, метры, полосы ──────────────────────────────────────────── */

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0 12px 9px;
  border-bottom: 1px solid var(--grid);
}
td { padding: 10px 12px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tfoot td { border-top: 1px solid var(--line); border-bottom: none; padding-top: 12px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }

.meter { display: flex; flex-direction: column; gap: 7px; }
.meter-track {
  position: relative;
  height: 9px;
  border-radius: 999px;
  background: var(--ramp-track);
  overflow: hidden;
}
.meter-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--series-1);
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.meter-fill.is-warning { background: var(--warning); }
.meter-fill.is-critical { background: var(--critical); }
.meter-legend { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }

.hbars { display: flex; flex-direction: column; gap: 4px; }
.hbar-row {
  display: grid;
  grid-template-columns: minmax(84px, 32%) 1fr auto;
  align-items: center;
  gap: 11px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
}
.hbar-name { font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 10px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.hbar-fill {
  height: 100%;
  border-radius: 0 4px 4px 0;
  background: var(--series-1);
  transform-origin: left center;
  animation: grow-x 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.hbar-value { font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--ink); min-width: 74px; text-align: right; }

/* ── каркас кабинета: шапка, меню, полотно, инспектор ────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  background: color-mix(in oklab, var(--surface) 82%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; letter-spacing: -0.015em; }
.brand-mark {
  width: 27px; height: 27px; border-radius: 9px;
  background: linear-gradient(145deg, var(--series-1), color-mix(in oklab, var(--series-1) 60%, var(--series-3)));
  color: #fff;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
  box-shadow: 0 4px 14px -6px var(--series-1);
}
.account-chip {
  font-size: 12.5px; color: var(--ink-2);
  padding: 5px 11px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
}

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--inspector-w);
  align-items: start;
}
.sidebar {
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  height: calc(100vh - var(--topbar-h));
  padding: 14px 11px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 12px 10px 6px; font-weight: 600; }
.nav-link {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: var(--r-md);
  color: var(--ink-2); font-size: 13.5px; font-weight: 500;
  text-decoration: none;
  transition: background 0.14s, color 0.14s, transform 0.14s;
}
.nav-link:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; transform: translateX(2px); }
.nav-link.active { background: var(--series-1-wash); color: var(--series-1); }
.nav-link .nav-icon { width: 17px; text-align: center; opacity: 0.9; }
.nav-badge { margin-left: auto; font-size: 11px; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 1px 7px; }

main.view { padding: 20px 20px 60px; min-width: 0; }
.view-head { margin-bottom: 16px; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.view-head .sub { color: var(--muted); margin-top: 6px; font-size: 13.5px; }

/* Инспектор: постоянная панель справа, отвечает на каждый клик. */
.inspector {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  border-left: 1px solid var(--border);
  background: color-mix(in oklab, var(--surface) 55%, transparent);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.insp-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.insp-body { padding: 14px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 12px; }
.insp-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 40px 18px; line-height: 1.7; }
.insp-empty .insp-mark { font-size: 26px; display: block; margin-bottom: 10px; opacity: 0.5; }
.insp-title { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.insp-sub { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.insp-hero { font-size: 32px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.05; }
.insp-hero .unit { font-size: 14px; color: var(--ink-2); font-weight: 500; margin-left: 4px; letter-spacing: 0; }
.insp-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 13px 14px;
}
.insp-block .eyebrow { margin-bottom: 9px; }

/* Строка «показатель → значение», по клику копируется. */
.insp-kv {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--grid);
  font-size: 12.5px;
}
.insp-kv:last-child { border-bottom: none; }
.insp-kv-label { color: var(--muted); }
.insp-kv-value { font-variant-numeric: tabular-nums; text-align: right; }
.insp-copy { cursor: copy; }
.insp-copy:hover .insp-kv-value { color: var(--series-1); }

/* Формула: как из токенов получились рубли. */
.insp-formula { font-family: var(--mono); font-size: 11.5px; line-height: 1.9; color: var(--ink-2); }
.insp-formula b { color: var(--ink); font-weight: 600; }
.insp-actions { display: flex; flex-direction: column; gap: 7px; }

/* ── графики ─────────────────────────────────────────────────────────── */

.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .axis-line { stroke: var(--line); stroke-width: 1; }
.chart .tick-text { fill: var(--muted); font: 11px var(--sans); font-variant-numeric: tabular-nums; }
.chart .label-text { fill: var(--ink-2); font: 600 11px var(--sans); }
.chart .bar {
  fill: var(--series-1);
  transform-origin: center bottom;
  animation: grow-y 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
  transition: filter 0.14s, opacity 0.14s;
}
.chart .bar-hit { fill: transparent; cursor: pointer; }
.chart .bar.is-hot { filter: brightness(1.18); }
.chart .col-active .bar { filter: brightness(1.25); }
.chart .col-marker { fill: var(--series-1); opacity: 0; transition: opacity 0.14s; }
.chart .col-active .col-marker { opacity: 1; }

.chart-tooltip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  background: color-mix(in oklab, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-3);
  padding: 9px 11px;
  font-size: 12px;
  min-width: 138px;
  transform: translate(-50%, -100%);
}
.chart-tooltip .tt-title { color: var(--muted); margin-bottom: 4px; font-size: 11px; }
.chart-tooltip .tt-row { display: flex; justify-content: space-between; gap: 14px; }
.chart-tooltip .tt-value { font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-tooltip .tt-hint { color: var(--muted); font-size: 10.5px; margin-top: 5px; }

.chart-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 11px; font-size: 12px; }
.chart-legend .key { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.chart-legend .swatch { width: 9px; height: 9px; border-radius: 3px; flex: none; }

.spark { display: block; height: 28px; width: 100%; max-width: 120px; overflow: visible; }
.spark .spark-line { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark .spark-area { fill: var(--series-1-wash); stroke: none; }
.spark .spark-dot { fill: var(--series-1); }

/* ── командная палитра (Ctrl+K) ──────────────────────────────────────── */

.palette-backdrop {
  position: fixed; inset: 0; z-index: 70;
  background: color-mix(in oklab, var(--page) 55%, transparent);
  backdrop-filter: blur(6px);
  display: flex; justify-content: center; padding: 12vh 20px 20px;
}
.palette {
  width: min(620px, 100%);
  max-height: 62vh;
  background: color-mix(in oklab, var(--surface) 96%, transparent);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-3);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: pop 0.16s ease-out;
}
.palette input {
  border: none; border-bottom: 1px solid var(--border); border-radius: 0;
  background: transparent; padding: 16px 18px; font-size: 15.5px;
}
.palette input:focus { box-shadow: none; border-color: var(--border); }
.palette-list { overflow-y: auto; padding: 7px; }
.palette-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: var(--r-md);
  cursor: pointer; font-size: 13.5px;
  border: 1px solid transparent;
}
.palette-item .pi-icon { width: 20px; text-align: center; color: var(--muted); }
.palette-item .pi-sub { color: var(--muted); font-size: 12px; }
.palette-item .pi-kind { margin-left: auto; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.palette-item.active { background: var(--series-1-wash); border-color: color-mix(in oklab, var(--series-1) 30%, transparent); }
.palette-foot { border-top: 1px solid var(--border); padding: 9px 14px; font-size: 11.5px; color: var(--muted); display: flex; gap: 14px; }

/* ── модалка, тосты, заметки ─────────────────────────────────────────── */

.backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(8, 8, 9, 0.5);
  backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 20px;
}
.modal {
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-xl); box-shadow: var(--shadow-3);
  width: min(580px, 100%); max-height: 88vh; overflow-y: auto; padding: 22px;
  animation: pop 0.17s ease-out;
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; margin-top: 18px; }

#toasts {
  position: fixed; right: 18px; bottom: 18px; z-index: 80;
  display: flex; flex-direction: column; gap: 9px; max-width: 380px;
}
.toast {
  background: color-mix(in oklab, var(--surface) 94%, transparent);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--series-1);
  border-radius: var(--r-md); box-shadow: var(--shadow-3);
  padding: 11px 14px; font-size: 13px;
  animation: toast-in 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  transition: opacity 0.2s;
}
.toast.is-good { border-left-color: var(--good); }
.toast.is-bad { border-left-color: var(--critical); }

.empty { padding: 30px 20px; text-align: center; color: var(--muted); font-size: 13.5px; }
.skeleton { color: var(--muted); padding: 44px; text-align: center; font-size: 13.5px; }
.notice {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 12px 15px; border-radius: var(--r-lg);
  background: var(--series-1-wash);
  border: 1px solid color-mix(in oklab, var(--series-1) 24%, transparent);
  font-size: 13px; line-height: 1.55;
}
.notice.is-warning { background: color-mix(in oklab, var(--warning) 13%, transparent); border-color: color-mix(in oklab, var(--warning) 38%, transparent); }
.notice.is-critical { background: color-mix(in oklab, var(--critical) 10%, transparent); border-color: color-mix(in oklab, var(--critical) 28%, transparent); }
.notice .notice-icon { font-size: 15px; line-height: 1.4; }

/* ── анимации ────────────────────────────────────────────────────────── */

@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes pop { from { opacity: 0; transform: scale(0.97); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes grow-y { from { transform: scaleY(0); } }
@keyframes grow-x { from { transform: scaleX(0); } }
@keyframes pulse { 50% { opacity: 0.35; } }

.animate-in > * { animation: rise 0.4s cubic-bezier(0.22, 1, 0.36, 1) both; }
.animate-in > *:nth-child(2) { animation-delay: 0.04s; }
.animate-in > *:nth-child(3) { animation-delay: 0.08s; }
.animate-in > *:nth-child(4) { animation-delay: 0.12s; }
.animate-in > *:nth-child(5) { animation-delay: 0.16s; }
.animate-in > *:nth-child(6) { animation-delay: 0.2s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .is-probe:hover { transform: none; }
}

/* ── тарифы и пакеты ─────────────────────────────────────────────────── */

.tariff-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(246px, 1fr)); align-items: stretch; }
.tariff {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-1);
  padding: 20px;
  display: flex; flex-direction: column; gap: 13px;
  overflow: hidden;
}
.tariff::before {
  content: '';
  position: absolute; inset: 0 0 auto; height: 1px;
  background: linear-gradient(90deg, transparent, var(--sheen), transparent);
}
.tariff.is-current { border-color: var(--series-1); box-shadow: 0 0 0 1px var(--series-1), var(--shadow-2); }
.tariff.is-current::after, .tariff.is-popular::after {
  content: '';
  position: absolute; inset: -40% -30% auto -30%; height: 90%;
  pointer-events: none;
  background: radial-gradient(50% 60% at 50% 0%, var(--glow-1), transparent 70%);
}
.tariff.is-popular::after { background: radial-gradient(50% 60% at 50% 0%, var(--glow-2), transparent 70%); }
.tariff > * { position: relative; z-index: 1; }
.tariff-flag {
  align-self: flex-start;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px; color: #fff; background: var(--series-2);
}
/* Пустой ярлык держит место: без него карточки в сетке съезжают по вертикали. */
.tariff-flag.is-hidden { visibility: hidden; }
.tariff.is-current .tariff-flag { background: var(--series-1); }
.tariff-name { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.tariff-tagline { font-size: 12.5px; color: var(--muted); min-height: 32px; line-height: 1.45; }
.tariff-price { font-size: 30px; font-weight: 600; letter-spacing: -0.03em; }
.tariff-price .per { font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.tariff-tokens { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.tariff-features { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; font-size: 13px; color: var(--ink-2); }
.tariff-features li { display: grid; grid-template-columns: 15px 1fr; gap: 7px; line-height: 1.45; }
.tariff-features li::before { content: '✓'; color: var(--good-ink); font-weight: 700; }
.tariff-meta { font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--grid); padding-top: 11px; display: flex; flex-direction: column; gap: 4px; margin-top: auto; }

/* ── база знаний ─────────────────────────────────────────────────────── */

.kb-layout { display: grid; grid-template-columns: minmax(210px, 262px) minmax(0, 1fr); gap: 14px; align-items: start; }
.kb-tree { display: flex; flex-direction: column; gap: 2px; }
.kb-section-head {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 10px 5px; font-size: 11px; font-weight: 600;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em;
}
.kb-article-link {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px 7px 20px; border-radius: var(--r-sm);
  font-size: 13px; color: var(--ink-2); cursor: pointer; border: none;
  background: none; text-align: left; width: 100%; font-family: var(--sans);
  transition: background 0.14s, color 0.14s, transform 0.14s;
}
.kb-article-link:hover { background: var(--surface-2); color: var(--ink); transform: translateX(2px); }
.kb-article-link.active { background: var(--series-1-wash); color: var(--series-1); }
.kb-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--good); }
.kb-dot.is-pending { background: var(--warning); }
.kb-body { white-space: pre-wrap; line-height: 1.68; font-size: 14.5px; }
.kb-search-result { padding: 12px 0; border-bottom: 1px solid var(--grid); }
.kb-search-result:last-child { border-bottom: none; }
.kb-snippet { font-size: 13px; color: var(--ink-2); margin-top: 4px; line-height: 1.55; }
.kb-snippet mark { background: color-mix(in oklab, var(--warning) 32%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }

/* ── лендинг ─────────────────────────────────────────────────────────── */

.landing { max-width: 1160px; margin: 0 auto; padding: 0 20px 70px; }
.landing-top { display: flex; align-items: center; justify-content: space-between; padding: 18px 0 0; }
.hero { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(330px, 0.92fr); gap: 40px; padding: 52px 0 34px; align-items: start; }
.hero h1 { font-size: 43px; letter-spacing: -0.03em; margin-bottom: 15px; }
.hero .lead { font-size: 16.5px; color: var(--ink-2); margin-bottom: 22px; max-width: 46ch; }
.hero-points { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 9px; font-size: 14px; }
.hero-points li { display: grid; grid-template-columns: 20px 1fr; gap: 9px; color: var(--ink-2); line-height: 1.5; }
.hero-points b { color: var(--ink); font-weight: 600; }
.auth-card {
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-xl); box-shadow: var(--shadow-3); padding: 22px;
  position: relative; overflow: hidden;
}
.demo-box { margin-top: 14px; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); font-size: 12.5px; color: var(--ink-2); }
.demo-box code { font-family: var(--mono); color: var(--ink); font-size: 12px; }
.section-title { margin: 44px 0 16px; }
.section-title h2 { font-size: 25px; letter-spacing: -0.02em; }
.section-title .sub { color: var(--muted); margin-top: 6px; }
.calc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(272px, 0.82fr); gap: 20px; }
.calc-result { background: var(--surface-2); border-radius: var(--r-lg); padding: 17px; display: flex; flex-direction: column; gap: 12px; }
.calc-figure { font-size: 33px; font-weight: 600; letter-spacing: -0.03em; }

.tabs { display: flex; gap: 3px; background: var(--surface-2); padding: 3px; border-radius: var(--r-md); margin-bottom: 16px; }
.tab {
  appearance: none; background: none; border: none; cursor: pointer; flex: 1;
  font: 500 13.5px var(--sans); color: var(--muted);
  padding: 8px 12px; border-radius: var(--r-sm);
  transition: background 0.14s, color 0.14s;
}
.tab:hover { color: var(--ink); }
.tab.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

/* ── адаптив ─────────────────────────────────────────────────────────── */

/* Инспектор уезжает вниз выдвижной панелью, когда места мало. */
@media (max-width: 1340px) {
  :root { --inspector-w: 300px; }
}
@media (max-width: 1180px) {
  .shell { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .inspector {
    position: fixed;
    right: 0; bottom: 0; top: auto;
    width: min(400px, 100%);
    height: min(66vh, 560px);
    z-index: 40;
    border-left: 1px solid var(--border);
    border-top: 1px solid var(--border-strong);
    border-radius: var(--r-xl) 0 0 0;
    background: color-mix(in oklab, var(--surface) 96%, transparent);
    backdrop-filter: blur(14px);
    box-shadow: var(--shadow-3);
    transform: translateY(calc(100% - 44px));
    transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .inspector.is-open { transform: none; }
  .insp-head { cursor: pointer; }
}
@media (max-width: 900px) {
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .b3, .b4, .b6 { grid-column: span 2; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .hero, .calc, .kb-layout { grid-template-columns: minmax(0, 1fr); }
  .hero h1 { font-size: 33px; }
}
@media (max-width: 700px) {
  :root { --sidebar-w: 0px; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .bento { grid-template-columns: minmax(0, 1fr); }
  .b2, .b3, .b4, .b6 { grid-column: span 1; }
  .rows2 { grid-row: auto; }
  main.view { padding: 16px 14px 80px; }
  .inspector { width: 100%; border-radius: var(--r-xl) var(--r-xl) 0 0; }
  .account-chip { display: none; }
}
