/* DataCenterQoima — стили приложения. Значения только из css/tokens.css. Без свечений и градиентов. */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--surface-page);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
.muted { color: var(--text-muted); }
.small { font-size: 13px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.input, label { position: relative; }
svg.i { flex: none; }

/* ---------- Плотность: компактная — для ноутбука ---------- */
:root[data-density="compact"] { --space-4: 10px; --space-5: 12px; --space-6: 16px; --space-7: 24px; --space-8: 32px; }
[data-density="compact"] body { font-size: 14px; }

/* ---------- Каркас ---------- */
.app { min-height: 100vh; padding: var(--space-6); display: flex; flex-wrap: wrap; gap: var(--space-6); align-items: flex-start; }
.main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: var(--space-6); }
.main:focus { outline: none; }
.page-body { display: flex; flex-direction: column; gap: var(--space-6); min-width: 0; }

.sidebar {
  flex: 1 1 264px; max-width: 100%;
  background: var(--surface-card); border-radius: var(--radius-md); box-shadow: var(--shadow-regular);
  padding: var(--space-7) 20px; display: flex; flex-direction: column; gap: var(--space-6);
}
[data-density="compact"] .sidebar { flex-basis: 244px; padding: 20px 14px; }
.brand { display: flex; align-items: center; gap: var(--space-3); padding: 0 var(--space-4); }
.brand-link { display: flex; align-items: center; gap: var(--space-3); min-width: 0; font-size: 20px; font-weight: 600; line-height: 1.25; color: var(--text); text-decoration: none; }
[data-density="compact"] .brand-link { font-size: 18px; }
.brand-sub { padding: 0 var(--space-4); font-size: 14px; color: var(--text-muted); margin-top: -12px; }
[data-density="compact"] .brand-sub { display: none; }
.divider { height: 1px; background: var(--line); margin: 0 var(--space-4); }
.nav-group { display: flex; flex-direction: column; gap: var(--space-2); }
.nav-group-title { padding: 0 var(--space-4) var(--space-2); font-size: 13px; font-weight: 500; letter-spacing: 0.02em; color: var(--text-muted); }
[data-density="compact"] .nav-group-title { font-size: 12px; padding-bottom: 0; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a, .side-btn {
  display: flex; align-items: center; gap: var(--space-4); height: 38px; padding: 0 var(--space-4);
  border-radius: var(--radius-sm); text-decoration: none; font-size: 15px; color: var(--text-muted);
  background: transparent; border: 1px solid transparent; width: 100%; cursor: pointer; text-align: left;
}
[data-density="compact"] .nav a, [data-density="compact"] .side-btn { height: 34px; font-size: 14px; }
.nav a svg { color: var(--accent-text); }
.nav a[data-soon] svg { color: var(--text-faint); }
.nav a:hover, .side-btn:hover { background: var(--surface-inset); color: var(--text); }
.nav a[aria-current="page"] { background: var(--surface-inset); color: var(--text); font-weight: 600; }
.nav a[aria-current="page"] svg { color: var(--accent-text); }
.nav a .soon { margin-left: auto; font-size: 12px; color: var(--text-faint); }
.nav a { white-space: nowrap; }
.nav a .side-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.side-foot { display: flex; flex-direction: column; gap: var(--space-2); }
.side-box { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4) var(--space-5); margin-bottom: var(--space-3); border-radius: var(--radius-md); background: var(--surface-inset); font-size: 13px; }
.tool-slot { display: block; }
.rail-only, .mode-dot { display: none; }

/* Узкое меню: только иконки, подписи — во всплывающей подсказке */
.app[data-menu="rail"] .sidebar { flex: 0 0 72px; width: 72px; padding: var(--space-5) var(--space-3); align-items: center; gap: var(--space-4); }
.app[data-menu="rail"] .side-label,
.app[data-menu="rail"] .soon,
.app[data-menu="rail"] .brand-sub,
.app[data-menu="rail"] .side-box,
.app[data-menu="rail"] .nav-group-title { display: none; }
.app[data-menu="rail"] .brand { flex-direction: column; padding: 0; gap: var(--space-3); }
.app[data-menu="rail"] .brand-link { justify-content: center; width: 44px; height: 36px; }
.app[data-menu="rail"] .divider { margin: 0; width: 32px; }
.app[data-menu="rail"] .nav-group + .nav-group { border-top: 1px solid var(--line); padding-top: var(--space-3); }
.app[data-menu="rail"] .nav a,
.app[data-menu="rail"] .side-btn { width: 44px; height: 40px; padding: 0; justify-content: center; }
.app[data-menu="rail"] .side-foot { align-items: center; }
.app[data-menu="rail"] .rail-only { display: flex; }
.app[data-menu="rail"] .mode-dot { display: grid; place-items: center; width: 44px; height: 32px; color: var(--warning); }

@media (min-width: 901px) {
  .sidebar { position: sticky; top: var(--space-6); max-height: calc(100vh - 2 * var(--space-6)); overflow-y: auto; scrollbar-width: thin; }
}
@media (max-width: 900px) {
  .app { padding: var(--space-4); gap: var(--space-4); }
  .sidebar { padding: var(--space-5); }
  /* На телефоне узкое меню — строка иконок сверху */
  .app[data-menu="rail"] .sidebar { flex: 1 1 100%; width: auto; flex-direction: row; align-items: center; overflow-x: auto; padding: var(--space-3); gap: var(--space-2); }
  .app[data-menu="rail"] .brand { flex-direction: row; }
  .app[data-menu="rail"] .divider { display: none; }
  .app[data-menu="rail"] .nav-group, .app[data-menu="rail"] .nav, .app[data-menu="rail"] .side-foot { flex-direction: row; }
  .app[data-menu="rail"] .nav-group + .nav-group { border-top: 0; padding-top: 0; border-left: 1px solid var(--line); padding-left: var(--space-2); }
  .app[data-menu="rail"] .nav a, .app[data-menu="rail"] .side-btn { flex: none; }
}

/* ---------- Шапка страницы ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4) var(--space-5); flex-wrap: wrap; }
.page-head h1 { font-size: 30px; line-height: 1.25; font-weight: 600; }
.page-head p { font-size: 16px; color: var(--text-muted); margin-top: var(--space-2); }
[data-density="compact"] .page-head h1 { font-size: 24px; }
[data-density="compact"] .page-head p { font-size: 14px; margin-top: 2px; }
.actions { display: flex; gap: var(--space-4); flex-wrap: wrap; align-items: center; }

/* ---------- Карточки и сетки ---------- */
.card {
  background: var(--surface-card); border-radius: var(--radius-md); box-shadow: var(--shadow-regular);
  padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-5); min-width: 0;
}
.card-title { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.card-title h2 { font-size: 18px; line-height: 1.25; font-weight: 600; }
[data-density="compact"] .card-title h2 { font-size: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(var(--min, 240px), 100%), 1fr)); gap: var(--space-6); align-items: start; }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.row { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
.spacer { flex: 1; }
.toolbar { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; padding: var(--space-4) var(--space-5); background: var(--surface-card); border-radius: var(--radius-md); box-shadow: var(--shadow-regular); }
.section-title { font-size: 20px; font-weight: 600; }
[data-density="compact"] .section-title { font-size: 17px; }

/* ---------- Сворачиваемые карточки ---------- */
.cc > .card-title { justify-content: flex-start; }
.cc-h { display: flex; min-width: 0; }
.cc-head { display: inline-flex; align-items: center; gap: var(--space-3); margin-left: -3px; padding: 0; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.cc-chev { color: var(--text-muted); transition: transform 0.15s ease; }
.cc-head:hover .cc-chev { color: var(--text); }
.cc[data-open="false"] .cc-chev { transform: rotate(-90deg); }
.cc[data-open="false"] > .cc-body,
.cc[data-open="false"] > .card-title > .cc-actions { display: none; }
.cc-meta { font-size: 13px; color: var(--text-muted); min-width: 0; }
.cc-meta.warn { color: var(--warning); font-weight: 600; }
.cc-actions { margin-left: auto; display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.cc-body { display: flex; flex-direction: column; gap: var(--space-5); min-width: 0; }
@media (prefers-reduced-motion: reduce) { .cc-chev { transition: none; } }

/* ---------- Вкладки ---------- */
.tabs { display: flex; gap: var(--space-6); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: var(--space-2); height: 42px; padding: 0 2px; margin-bottom: -1px;
  border: 0; border-bottom: 2px solid transparent; background: none; color: var(--text-muted);
  font-size: 14px; font-weight: 500; white-space: nowrap; cursor: pointer;
}
[data-density="compact"] .tab { height: 38px; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }
.tab-count { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: var(--radius-sm); background: var(--surface-inset); color: var(--text-muted); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tab-count.t-warn { background: var(--warning-tint); color: var(--warning); }
.tab-count.t-pos { background: var(--positive-tint); color: var(--positive); }
.card.tabbed { gap: 0; padding-top: var(--space-2); }
.tab-panel { display: flex; flex-direction: column; gap: var(--space-5); padding-top: var(--space-5); min-width: 0; }
.seg-view button { display: inline-flex; align-items: center; gap: var(--space-2); }
.toolbar > .seg, .page-head > .seg, .page-head .actions > .seg, .card-title > .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.toolbar > .seg::-webkit-scrollbar, .page-head > .seg::-webkit-scrollbar, .page-head .actions > .seg::-webkit-scrollbar, .card-title > .seg::-webkit-scrollbar { display: none; }
.page-head .actions { max-width: 100%; min-width: 0; }
.seg .tab-count { margin-left: 6px; height: 18px; }
.seg button { flex: none; }
.seg-view .tab-count { height: 18px; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-3);
  height: 34px; padding: 0 20px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: 14px; font-weight: 600; line-height: 1; white-space: nowrap; cursor: pointer; text-decoration: none;
}
[data-density="compact"] .btn { height: 32px; padding: 0 16px; }
.btn-lg { height: 46px; padding: 0 24px; font-size: 16px; }
[data-density="compact"] .btn-lg { height: 40px; padding: 0 20px; font-size: 15px; }
.btn-sm, [data-density="compact"] .btn-sm { height: 28px; padding: 0 10px; font-size: 13px; font-weight: 500; }
.btn-icon, [data-density="compact"] .btn-icon { width: 34px; padding: 0; }
[data-density="compact"] .btn-icon { width: 32px; }
.btn-primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); box-shadow: var(--shadow-primary-sm); }
.btn-primary:hover { filter: brightness(0.94); }
.btn-secondary { background: var(--surface-inset); color: var(--text); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--surface-card); }
.btn-ghost { background: transparent; color: var(--accent-text); border-color: transparent; }
.btn-ghost:hover { background: var(--surface-inset); }
.btn-outline { background: var(--surface-card); color: var(--text); border-color: var(--text); }
.btn-danger { background: var(--negative-tint); color: var(--negative); border-color: var(--negative-tint); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; filter: none; }
.btn:focus-visible, .input:focus-within, a:focus-visible, .seg button:focus-visible, select:focus-visible,
.tab:focus-visible, .cc-head:focus-visible, .side-btn:focus-visible, .chip:focus-visible, .hint:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Бейджи и чипы ---------- */
.badge { display: inline-flex; align-items: center; gap: var(--space-1); height: 24px; padding: 0 var(--space-3); border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; line-height: 1; white-space: nowrap; }
.badge-lg { height: 36px; padding: 0 var(--space-5); font-size: 16px; }
.b-tint { background: var(--surface-inset); color: var(--accent-text); }
.b-grey { background: var(--line-strong); color: var(--text); }
.b-accent { background: var(--accent); color: var(--on-accent); }
.b-pos { background: var(--positive-tint); color: var(--positive); }
.b-neg { background: var(--negative-tint); color: var(--negative); }
.b-warn { background: var(--warning-tint); color: var(--warning); }
.chip { display: inline-flex; align-items: center; gap: var(--space-2); height: 28px; padding: 0 10px; border: 0; border-radius: var(--radius-full); background: var(--surface-inset); color: var(--text-muted); font-size: 13px; font-weight: 500; white-space: nowrap; }
.chip svg { color: var(--positive); }
.chip.warn { background: var(--warning-tint); color: var(--warning); }
.chip.warn svg { color: var(--warning); }
button.chip { cursor: pointer; }
button.chip:hover { color: var(--text); }

/* ---------- Поля ---------- */
.input, .select {
  display: inline-flex; align-items: center; gap: var(--space-3); height: 34px; padding: 0 var(--space-4);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface-card); box-shadow: var(--shadow-sm);
}
[data-density="compact"] .input, [data-density="compact"] .select { height: 32px; }
.input input { border: 0; outline: 0; background: transparent; min-width: 0; width: 100%; font-size: 14px; color: var(--text); }
.input input::placeholder { color: var(--text-muted); }
.select { appearance: none; -webkit-appearance: none; padding-right: 32px; font-size: 14px; color: var(--text); cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text) 50%), linear-gradient(135deg, var(--text) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.input.warn { border-color: var(--warning); }
.input:has(input:disabled) { background: var(--surface-inset); border-style: dashed; box-shadow: none; cursor: not-allowed; }
input[type="date"] { color-scheme: inherit; }
.label { font-size: 14px; font-weight: 600; }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-inset); border-radius: var(--radius-sm); }
.seg button { height: 28px; padding: 0 var(--space-4); border: 0; border-radius: var(--radius-sm); background: transparent; font-size: 14px; font-weight: 500; color: var(--text-muted); cursor: pointer; white-space: nowrap; }
[data-density="compact"] .seg button { height: 26px; font-size: 13px; }
.seg button[aria-pressed="true"] { background: var(--surface-card); color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm); }
[data-theme="dark"] .seg button[aria-pressed="true"] { background: var(--line-strong); }

.switch { display: inline-flex; align-items: center; gap: var(--space-3); height: 34px; padding: 0; border: 0; background: transparent; font-size: 14px; color: var(--text); cursor: pointer; }
.switch .track { display: inline-flex; align-items: center; width: 32px; height: 18px; border-radius: var(--radius-full); background: var(--line-strong); }
.switch .knob { width: 14px; height: 14px; border-radius: var(--radius-full); background: #FFFFFF; margin-left: 2px; }
.switch[aria-checked="true"] .track { background: var(--accent); }
.switch[aria-checked="true"] .knob { margin-left: 16px; }

/* ---------- Загрузка файла ---------- */
.upload {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-3);
  padding: var(--space-7) var(--space-6); border: 1px dashed var(--text-muted); border-radius: var(--radius-md);
  background: var(--surface-inset); text-align: center; cursor: pointer;
}
.upload.over { background: var(--surface-card); border-color: var(--accent); }
.upload-icon { width: 48px; height: 48px; display: grid; place-items: center; border: 1.5px solid var(--text-faint); border-radius: var(--radius-md); background: var(--surface-card); }
.upload strong { font-size: 16px; font-weight: 600; }
.dropzone.over { outline: 2px dashed var(--accent); outline-offset: -6px; }

/* ---------- Таблицы ---------- */
.table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-md); }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; color: var(--text); }
table.t th { text-align: left; padding: var(--space-4) var(--space-5); font-size: 13px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.02em; color: var(--text-muted); border-bottom: 1px solid var(--line-strong); background: var(--surface-card); white-space: nowrap; }
table.t td { padding: 10px var(--space-5); border-bottom: 1px solid var(--surface-inset); vertical-align: middle; }
[data-density="compact"] table.t { font-size: 13px; }
[data-density="compact"] table.t th { padding: 8px 12px; font-size: 12px; }
[data-density="compact"] table.t td { padding: 5px 12px; }
table.t tbody tr:last-child td { border-bottom: 0; }
table.t th.num, table.t td.num { text-align: right; }
table.t tbody tr:hover { background: var(--surface-inset); }
table.t tfoot td { font-weight: 600; background: var(--surface-inset); border-bottom: 0; }
table.t tr.saved td { background: var(--positive-tint); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }

/* ---------- Плашки ---------- */
.note { display: flex; align-items: flex-start; gap: var(--space-4); flex-wrap: wrap; padding: var(--space-4) var(--space-5); border-radius: var(--radius-md); font-size: 14px; }
[data-density="compact"] .note { font-size: 13px; }
.note > svg { margin-top: 1px; }
.note p { flex: 1 1 280px; }
.note-warn { background: var(--warning-tint); }
.note-warn > svg { color: var(--warning); }
.note-info { background: var(--surface-card); border: 1px solid var(--line); }
.note-info > svg { color: var(--text-muted); }
.note-pos { background: var(--positive-tint); }
.note-pos > svg { color: var(--positive); }
.note-neg { background: var(--negative-tint); }
.note-neg > svg { color: var(--negative); }
.mode-banner { display: flex; align-items: center; gap: var(--space-4); padding: 6px 6px 6px var(--space-5); border-radius: var(--radius-md); background: var(--warning-tint); font-size: 13px; }
.mode-banner > svg { color: var(--warning); }
.mode-banner > span { flex: 1 1 auto; min-width: 0; }
.mode-close, [data-density="compact"] .mode-close { width: 28px; height: 28px; background: transparent; border: 0; color: var(--text-muted); }
.mode-close:hover { background: var(--surface-card); color: var(--text); }

/* ---------- KPI ---------- */
.kpi { gap: var(--space-3); padding: 20px; }
[data-density="compact"] .kpi { gap: 2px; padding: 12px 16px; }
.kpi-label { display: flex; align-items: center; gap: var(--space-3); font-size: 14px; color: var(--text-muted); }
[data-density="compact"] .kpi-label { font-size: 13px; }
.kpi-label svg { color: var(--accent-text); }
.kpi-value { font-size: 28px; line-height: 1.15; font-weight: 600; }
[data-density="compact"] .kpi-value { font-size: 22px; }
.kpi-sub { font-size: 13px; color: var(--text-muted); }
.kpi-value.muted { color: var(--text-faint); }
[data-density="compact"] .kpi-sub { font-size: 12px; }

.check-item { display: flex; gap: var(--space-4); align-items: flex-start; }
.check-item b { display: block; font-size: 14px; font-weight: 600; }
.check-item span { font-size: 13px; color: var(--text-muted); }
.check-item svg.ok { color: var(--positive); }
.check-item svg.warn { color: var(--warning); }

.mini { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4) var(--space-5); border-radius: var(--radius-md); background: var(--surface-inset); }
.step-dot { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: var(--radius-full); border: 1px solid var(--line-strong); color: var(--accent-text); font-size: 13px; font-weight: 600; flex: none; }

/* ---------- Панель действия (прилипает к низу экрана) ---------- */
.actionbar {
  position: sticky; bottom: var(--space-4); z-index: 5;
  display: flex; align-items: center; gap: var(--space-4) var(--space-5); flex-wrap: wrap;
  padding: var(--space-4) var(--space-5); background: var(--surface-card); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-md);
}
.ab-text { flex: 1 1 220px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ab-text b { font-size: 15px; }
.ab-text span { font-size: 13px; color: var(--text-muted); }
.ab-text span.warn { color: var(--warning); font-weight: 600; }
.ab-text .hint { justify-content: flex-start; text-align: left; }
.ab-chips { display: flex; gap: var(--space-3); flex-wrap: wrap; }
@media (max-width: 600px) {
  .actionbar { padding: var(--space-3) var(--space-4); gap: var(--space-3); }
  .ab-chips { display: none; }
  .ab-text { flex: 1 1 0; }
  .actionbar .btn-lg { height: 40px; padding: 0 14px; font-size: 14px; }
}

/* ---------- Файлы в импорте ---------- */
.file-list { display: flex; flex-direction: column; gap: var(--space-4); }
.file-item { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-3) var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-card); }
.file-item[data-on="true"] { border-color: var(--accent); }
.file-row { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
.file-pick { flex: 1 1 220px; min-width: 0; display: flex; align-items: center; gap: var(--space-4); padding: var(--space-1) 0; border: 0; background: transparent; text-align: left; cursor: pointer; color: var(--text); }
.file-pick .grow { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.file-pick b { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-date { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.quick { display: inline-flex; gap: 2px; flex-wrap: wrap; }


/* ---------- Период и фильтры ---------- */
.period-bar, .filters { gap: var(--space-3) var(--space-4); }
.period-nav { display: inline-flex; align-items: center; gap: var(--space-3); }
.period-label { min-width: 150px; text-align: center; font-size: 15px; font-weight: 600; white-space: nowrap; }
.page-data { display: flex; flex-direction: column; gap: var(--space-6); min-width: 0; transition: opacity 0.12s ease; }
.page-data.is-loading { opacity: 0.55; pointer-events: none; }
.chip-x { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: -4px; padding: 0; border: 0; border-radius: var(--radius-full); background: transparent; color: inherit; cursor: pointer; }
.chip-x:hover { background: var(--line); }
.th-sort { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
.th-sort:hover { color: var(--text); }
th[aria-sort="ascending"] .th-sort, th[aria-sort="descending"] .th-sort { color: var(--text); font-weight: 600; }
.link-btn { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; font: inherit; font-weight: 600; color: var(--text); text-align: left; cursor: pointer; }
.link-btn svg { color: var(--text-faint); }
.link-btn:hover { color: var(--accent-text); }
.link-btn:hover svg { color: var(--accent-text); }

/* ---------- Изменение к прошлому периоду ---------- */
.kpi-delta { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; min-height: 20px; margin-top: 2px; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--positive); }
.delta.down { color: var(--negative); }
.delta.flat { color: var(--text-muted); }
.delta-none { font-size: 12px; color: var(--text-muted); }

/* ---------- Графики: полосы ---------- */
.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 32%) minmax(0, 1fr); align-items: center; gap: var(--space-4); width: 100%; padding: 4px 6px; border: 0; border-radius: var(--radius-sm); background: none; font: inherit; color: inherit; text-align: left; }
button.bar-row { cursor: pointer; }
.bar-row:hover { background: var(--surface-inset); }
.bar-row:hover .bar { filter: brightness(1.08); }
.bar-label { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.bar-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-sub { font-size: 11px; color: var(--text-muted); }
.bar-track { display: flex; align-items: center; gap: var(--space-3); min-width: 0; min-height: 22px; border-left: 1px solid var(--line-strong); }
.bar { flex: none; width: calc((100% - 130px) * var(--w)); min-width: 2px; height: 12px; border-radius: 0 4px 4px 0; background: var(--chart-1); }
.bar-value { font-size: 12px; color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Графики: столбики по датам ---------- */
.cols { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-3); padding-top: 18px; }
.cols-y { position: relative; height: 180px; min-width: 44px; }
.cols-y span { position: absolute; right: 0; transform: translateY(50%); font-size: 11px; color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cols-main { min-width: 0; }
.cols-plot { position: relative; height: 180px; display: flex; align-items: flex-end; gap: 2px; }
.cols-line { position: absolute; left: 0; right: 0; height: 1px; background: var(--line); }
.cols-line:first-child { background: var(--line-strong); }
.col-slot { position: relative; flex: 1 1 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; min-width: 0; }
.col-slot:hover { background: var(--surface-inset); }
.col { position: relative; width: min(24px, 70%); min-height: 2px; border-radius: 4px 4px 0 0; background: var(--chart-1); }
.col-max { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 4px; font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; }
.col-none { width: 4px; height: 4px; margin-bottom: 3px; border-radius: var(--radius-full); background: var(--line-strong); }
.cols-x { display: flex; gap: 2px; margin-top: 6px; }
.cols-x span { flex: 1 1 0; min-width: 0; font-size: 11px; color: var(--text-muted); text-align: center; white-space: nowrap; overflow: visible; }


/* ---------- Сравнение ---------- */
.div-track { display: grid; grid-template-columns: 1fr 1fr; align-items: center; min-width: 0; min-height: 22px; }
.div-half { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.div-half.neg { flex-direction: row-reverse; border-right: 1px solid var(--line-strong); }
.div-half.pos { border-left: 0; }
.div-bars .bar { width: calc((100% - 96px) * var(--w)); }
.bar.pos { background: var(--chart-up); border-radius: 0 4px 4px 0; }
.bar.neg { background: var(--chart-down); border-radius: 4px 0 0 4px; }
.col-slot.pair { gap: 2px; }
.col-slot.pair .col { width: min(12px, 42%); }
.col.base { background: var(--chart-base); }
.col.cur { background: var(--chart-1); }
.col-gap { display: flex; align-items: flex-end; justify-content: center; width: min(12px, 42%); height: 100%; }
.legend { display: inline-flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; font-size: 12px; color: var(--text-muted); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.sw.cur { background: var(--chart-1); }
.sw.base { background: var(--chart-base); }
.sw.up { background: var(--chart-up); }
.sw.down { background: var(--chart-down); }
.kpi-was { font-size: 13px; color: var(--text-muted); }
.ab-tag { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 700; color: #FFFFFF; flex: none; }
.ab-tag.cur { background: var(--chart-1); }
.ab-tag.base { background: var(--chart-base); }
.compare-bar { gap: var(--space-3) var(--space-4); }
td.up { color: var(--positive); }
td.down { color: var(--negative); }


/* ---------- Окна с формой ---------- */
.dlg { width: min(600px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-card); color: var(--text); box-shadow: var(--shadow-md); }
.dlg-wide { width: min(780px, calc(100vw - 24px)); }
.dlg::backdrop { background: rgba(9, 15, 28, 0.45); }
.dlg-form { display: flex; flex-direction: column; max-height: calc(100vh - 34px); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: 14px 20px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { font-size: 18px; font-weight: 600; line-height: 1.3; }
.dlg-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; padding: 16px 20px; overflow: auto; }
.dlg-foot { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: var(--space-3); padding: 12px 20px; border-top: 1px solid var(--line); }
.dlg-err { margin-right: auto; }
.fld { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fld-wide { grid-column: 1 / -1; }
.fld-label { font-size: 13px; font-weight: 600; }
.fld-hint { font-size: 12px; color: var(--text-muted); }
.fld .input, .fld .select { width: 100%; }
.sizes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: var(--space-3); }
.size-cell { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-muted); text-align: center; }
.size-cell .input { padding: 0 6px; }
.size-cell input { text-align: center; }
@media (max-width: 560px) { .dlg-body { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Закуп: доска ---------- */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); align-items: start; }
@media (max-width: 1180px) { .kanban { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .kanban { grid-template-columns: 1fr; } }
.kcol { display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-inset); }
.kcol-head { display: flex; align-items: center; gap: var(--space-3); font-size: 15px; font-weight: 600; }
.kcol-head svg { color: var(--accent-text); }
.kcol-head .btn { margin-left: auto; }
.kcol-sub { margin-top: -6px; font-size: 12px; color: var(--text-muted); }
.kcol-empty { padding: var(--space-4) 0; font-size: 13px; color: var(--text-muted); text-align: center; }
.kcard { display: flex; flex-direction: column; gap: 8px; padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-card); box-shadow: var(--shadow-sm); }
.kcard-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.kcard-head b { font-size: 14px; line-height: 1.3; overflow-wrap: anywhere; }
.kcard-qty { display: flex; align-items: baseline; gap: var(--space-3); flex-wrap: wrap; }
.kq { font-size: 20px; font-weight: 600; }
.kcard-meta { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-muted); }
.kcard-meta span { display: flex; align-items: center; gap: 6px; }
.kcard-meta .warn { color: var(--warning); font-weight: 600; }
.kcard-meta .neg { color: var(--negative); font-weight: 600; }
.kcard-meta .accent { color: var(--accent-text); }
.kcard-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.btn-icon.btn-sm { width: 28px; padding: 0; }

/* ---------- Цех ---------- */
.kpi-btn { border: 1px solid transparent; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.kpi-btn:hover { border-color: var(--line-strong); }
.kpi-btn[aria-pressed="true"] { border-color: var(--accent); }
.stepper { display: inline-flex; align-items: center; gap: 0; white-space: nowrap; }
.stepper b { margin-left: var(--space-3); font-size: 13px; font-weight: 600; }
.st-dot { display: inline-grid; place-items: center; width: 14px; height: 14px; border: 1.5px solid var(--line-strong); border-radius: var(--radius-full); background: var(--surface-card); color: var(--on-accent); }
.st-dot.done { background: var(--accent); border-color: var(--accent); }
.st-dot.cur { border: 3px solid var(--accent); }
.st-line { width: 12px; height: 1.5px; background: var(--line-strong); }

/* ---------- Склад ---------- */
.stock-t td.num, .stock-t th.num { padding-left: 8px; padding-right: 8px; }
td.st-low { background: var(--warning-tint); color: var(--warning); font-weight: 600; }
td.st-out { background: var(--negative-tint); color: var(--negative); font-weight: 600; }
.sw.st-low { background: var(--warning-tint); border: 1px solid var(--warning); }
.sw.st-out { background: var(--negative-tint); border: 1px solid var(--negative); }

/* ---------- Подсказка ---------- */
.tip { position: fixed; z-index: 60; pointer-events: none; display: flex; flex-direction: column; gap: 1px; max-width: 280px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface-card); box-shadow: var(--shadow-md); font-size: 12px; }
.tip b { font-size: 14px; font-weight: 600; color: var(--text); }
.tip span { color: var(--text-muted); }
@media (prefers-reduced-motion: reduce) { .page-data { transition: none; } }

/* ---------- Прочее ---------- */
.empty { display: flex; flex-direction: column; align-items: center; gap: var(--space-4); padding: var(--space-8) var(--space-6); text-align: center; color: var(--text-muted); }
.empty svg { color: var(--text-faint); }
.empty b { color: var(--text); font-size: 16px; }
.hint { display: inline-flex; align-items: center; gap: var(--space-2); font-size: 13px; font-weight: 600; color: var(--accent-text); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: none; }
.toast-host { position: fixed; right: var(--space-6); bottom: var(--space-6); display: flex; flex-direction: column; gap: var(--space-3); z-index: 50; }
.toast { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-radius: var(--radius-md); background: var(--text); color: var(--surface-card); font-size: 14px; box-shadow: var(--shadow-md); max-width: 420px; }
.toast.error { background: var(--negative); color: #FFFFFF; }

.login { min-height: 100vh; display: grid; place-items: center; padding: var(--space-6); }
.login .card { width: 100%; max-width: 400px; }
.login form { display: flex; flex-direction: column; gap: var(--space-5); }
.login label { display: flex; flex-direction: column; gap: var(--space-3); }
.login .input { height: 42px; }
.error-text { color: var(--negative); font-size: 14px; }

.boot { min-height: 100vh; display: grid; place-items: center; color: var(--text-muted); }

/* ── Оформление: знак и выбор схемы ── */
.logo-mark { color: var(--brand-mark, var(--accent)); }
.appearance { display: flex; flex-direction: column; gap: var(--space-6); min-width: 0; }
.ap-sec { display: flex; flex-direction: column; gap: var(--space-3); }
.ap-h { font-size: 15px; font-weight: 600; }
.ap-sub { font-size: 13px; color: var(--text-muted); margin-top: var(--space-2); }
.appearance .seg { align-self: flex-start; max-width: 100%; overflow-x: auto; }
.appearance .seg button { display: inline-flex; align-items: center; gap: var(--space-2); }
.scheme-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-3); }
@media (max-width: 760px) { .scheme-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); } }
.scheme-card { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-card); color: var(--text); text-align: left; cursor: pointer; font: inherit; }
.scheme-card:hover { border-color: var(--line-strong); }
.scheme-card[aria-checked="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.scheme-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.scheme-name { display: inline-flex; align-items: center; gap: var(--space-1); font-size: 14px; font-weight: 600; }
.scheme-name svg { color: var(--accent-text); }
.scheme-note { font-size: 12px; line-height: 1.35; color: var(--text-muted); }
/* Мини-превью: внутри стоят data-theme и data-scheme — токены берутся из этой схемы, а не из текущей. */
.scheme-prev { display: flex; gap: 6px; height: 76px; padding: 7px; border-radius: 6px; background: var(--surface-page); border: 1px solid var(--line); overflow: hidden; }
.scheme-prev span { display: block; }
.sp-side { width: 26%; display: flex; flex-direction: column; gap: 5px; }
.sp-mark { width: 11px; height: 11px; border-radius: 3px; background: var(--brand-mark); margin-bottom: 2px; }
.sp-line { height: 5px; border-radius: 3px; background: var(--line-strong); }
.sp-short { width: 65%; }
.sp-on { background: var(--surface-inset); box-shadow: inset 2px 0 0 var(--accent-text); height: 8px; }
.sp-card { flex: 1; display: flex; flex-direction: column; gap: 5px; padding: 7px; border-radius: 5px; background: var(--surface-card); border: 1px solid var(--line); }
.sp-text { height: 6px; width: 72%; border-radius: 3px; background: var(--text); }
.sp-muted { height: 5px; width: 50%; border-radius: 3px; background: var(--text-muted); }
.sp-row { display: flex !important; gap: 5px; margin-top: auto; }
.sp-btn { width: 34px; height: 12px; border-radius: 3px; background: var(--accent); }
.sp-chip { width: 24px; height: 12px; border-radius: 3px; background: var(--surface-inset); border: 1px solid var(--accent-text); }
