@import url("https://fonts.googleapis.com/css2?family=Google+Sans:wght@400;500;700&display=swap");

/* =========================================================================
   Токены. Монохромная палитра + один смысловой акцент (--danger) для
   «проблемных» значений: отошёл > 30%, услуга отключена, ошибки.
   ========================================================================= */
:root {
  --font: "Google Sans", "Product Sans", Roboto, -apple-system, "Segoe UI", sans-serif;

  --bg: #f5f5f5;
  --surface: #ffffff;
  --surface-2: #f0f0f0;
  --surface-3: #e6e6e6;
  --ink: #111111;
  --ink-2: #3d3d3d;
  --muted: #707070;
  --line: #e3e3e3;
  --line-strong: #c9c9c9;
  --accent: #111111;
  --accent-ink: #ffffff;
  --danger: #c0271e;
  --danger-soft: #fbecea;
  --row-hover: #f6f6f6;
  --overlay: rgba(0, 0, 0, .45);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .05);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, .22);

  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px;
  --fs-xs: 11px; --fs-sm: 12px; --fs: 14px; --fs-md: 15px; --fs-lg: 18px; --fs-xl: 24px; --fs-kpi: 26px;
  --sidebar-w: 256px;
  --control-h: 36px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0a0a; --surface: #141414; --surface-2: #1c1c1c; --surface-3: #262626;
    --ink: #f0f0f0; --ink-2: #cfcfcf; --muted: #8e8e8e; --line: #252525; --line-strong: #3a3a3a;
    --accent: #f0f0f0; --accent-ink: #0a0a0a; --danger: #ff6a5f; --danger-soft: #2b1614;
    --row-hover: #1a1a1a; --overlay: rgba(0, 0, 0, .6);
    --shadow-sm: none; --shadow-lg: 0 24px 64px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0a0a; --surface: #141414; --surface-2: #1c1c1c; --surface-3: #262626;
  --ink: #f0f0f0; --ink-2: #cfcfcf; --muted: #8e8e8e; --line: #252525; --line-strong: #3a3a3a;
  --accent: #f0f0f0; --accent-ink: #0a0a0a; --danger: #ff6a5f; --danger-soft: #2b1614;
  --row-hover: #1a1a1a; --overlay: rgba(0, 0, 0, .6);
  --shadow-sm: none; --shadow-lg: 0 24px 64px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

/* =========================================================================
   База
   ========================================================================= */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs);
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
}
body.has-modal { overflow: hidden; }
h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: -.01em; }
a { color: inherit; }
b, strong { font-weight: 700; }
small { font-size: var(--fs-sm); }
.muted { color: var(--muted); }
.danger { color: var(--danger); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.icon {
  width: 18px; height: 18px; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.icon--hint { width: 13px; height: 13px; color: var(--muted); opacity: .8; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================================================
   Каркас: боковое меню + основная область
   ========================================================================= */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: var(--s4);
  padding: var(--s5) var(--s3);
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.sidebar__top { display: flex; align-items: center; justify-content: space-between; padding: 0 var(--s2); }
.sidebar__menu { display: none; }
.brand { display: flex; align-items: center; gap: var(--s3); text-decoration: none; }
.brand__mark {
  display: grid; place-items: center; width: 36px; height: 36px;
  border-radius: var(--r); background: var(--accent); color: var(--accent-ink);
}
.brand__text { display: flex; flex-direction: column; line-height: 1.2; }
.brand__text b { font-weight: 500; font-size: var(--fs-md); }
.brand__text small { color: var(--muted); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav__item {
  display: flex; align-items: flex-start; gap: var(--s3);
  padding: 10px var(--s3); border-radius: var(--r);
  text-decoration: none; color: var(--ink-2);
}
.nav__item .icon { margin-top: 1px; color: var(--muted); }
.nav__item:hover { background: var(--surface-2); color: var(--ink); }
.nav__item.is-active { background: var(--accent); color: var(--accent-ink); }
.nav__item.is-active .icon, .nav__item.is-active small { color: var(--accent-ink); opacity: .85; }
.nav__text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.nav__text b { font-weight: 500; }
.nav__text small { color: var(--muted); font-size: var(--fs-xs); line-height: 1.35; }

.sidebar__bottom { margin-top: auto; display: flex; flex-direction: column; gap: var(--s3); padding: 0 var(--s1); }
.data-status {
  display: flex; flex-direction: column; gap: var(--s2);
  padding: var(--s3); border: 1px solid var(--line); border-radius: var(--r);
  font-size: var(--fs-sm); color: var(--ink-2);
}
.data-status:empty { display: none; }
.data-status div { display: flex; align-items: flex-start; gap: var(--s2); }
.data-status .icon { width: 15px; height: 15px; margin-top: 1px; color: var(--muted); }
.sidebar__actions { display: flex; justify-content: space-between; gap: var(--s2); }

.main { min-width: 0; padding: var(--s6) var(--s8) var(--s8); }
.page { display: flex; flex-direction: column; gap: var(--s4); }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4) var(--s6);
  flex-wrap: wrap; margin-bottom: var(--s2);
}
.page-head h1 { font-size: var(--fs-xl); }
.page-desc { margin: var(--s1) 0 0; color: var(--muted); max-width: 72ch; }
.page-head__actions { display: flex; align-items: flex-end; gap: var(--s2); flex-wrap: wrap; }

@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky; top: 0; z-index: 30; height: auto; max-height: 100vh;
    flex-direction: column; gap: 0; padding: var(--s3) var(--s4);
    border-right: 0; border-bottom: 1px solid var(--line);
  }
  .sidebar__top { padding: 0; }
  .sidebar__menu { display: inline-flex; }
  .sidebar .nav, .sidebar .sidebar__bottom { display: none; }
  .sidebar.is-open .nav, .sidebar.is-open .sidebar__bottom { display: flex; }
  .sidebar.is-open .nav { margin-top: var(--s3); }
  .sidebar.is-open .sidebar__bottom { margin-top: var(--s4); padding-bottom: var(--s2); }
  .main { padding: var(--s5) var(--s4) var(--s8); }
}

/* =========================================================================
   Элементы управления
   ========================================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  height: var(--control-h); padding: 0 14px;
  font: inherit; font-weight: 500; color: var(--ink); text-decoration: none; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r);
  cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn--primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn--primary:hover:not(:disabled) { background: var(--accent); opacity: .88; }
.btn--ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn--ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn--danger { color: var(--danger); }
.btn--sm { height: 30px; padding: 0 10px; font-size: var(--fs-sm); }
.btn--sm .icon { width: 15px; height: 15px; }
.btn--icon { width: var(--control-h); padding: 0; }
.btn--wide { width: 100%; }

.control {
  height: var(--control-h); min-width: 0; padding: 0 var(--s3);
  font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r);
}
.control:focus { outline: none; border-color: var(--ink); }
.control::placeholder { color: var(--muted); }
.control--sm { height: 28px; padding: 0 var(--s2); font-size: var(--fs-sm); border-radius: var(--r-sm); width: 100%; }
select.control { padding-right: var(--s6); }

.field { display: flex; flex-direction: column; gap: var(--s1); font-size: var(--fs-sm); color: var(--muted); }
.field--grow { flex: 1; min-width: 220px; }
.input-icon { position: relative; display: flex; align-items: center; }
.input-icon > .icon { position: absolute; left: 11px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.input-icon > .control { width: 100%; padding-left: 34px; }
.search { flex: 1; min-width: 220px; max-width: 420px; }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: var(--r); }
.seg button {
  height: 30px; padding: 0 12px; font: inherit; font-size: 13px; font-weight: 500;
  color: var(--muted); background: transparent; border: 0; border-radius: 7px; cursor: pointer; white-space: nowrap;
}
.seg button:hover { color: var(--ink); }
.seg button.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line-strong); }
.seg--full { display: flex; }
.seg--full button { flex: 1; }

.check { display: inline-flex; align-items: center; gap: var(--s2); cursor: pointer; color: var(--ink-2); user-select: none; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.check small { color: var(--muted); }

.hint { font-size: var(--fs-sm); color: var(--muted); }
.hint:empty { display: none; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips:empty { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 4px 3px 10px; border: 1px solid var(--line-strong); border-radius: 999px;
  font-size: var(--fs-sm); background: var(--surface);
}
.chip small { color: var(--muted); }
.chip--static { padding-right: 10px; }
.chip__x { display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); cursor: pointer; }
.chip__x:hover { background: var(--surface-3); color: var(--ink); }
.chip__x .icon { width: 13px; height: 13px; }

/* статус «включено / отключено» */
.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px;
  border-radius: 999px; font-size: var(--fs-sm); font-weight: 500; white-space: nowrap;
}
.pill .icon { width: 13px; height: 13px; }
.pill--on { background: var(--accent); color: var(--accent-ink); }
.pill--off { border: 1px solid var(--danger); color: var(--danger); }
.pill--break { border: 1px solid var(--ink); color: var(--ink); }
.pill--muted { border: 1px solid var(--line-strong); color: var(--muted); }

.onoff { display: inline-flex; gap: var(--s2); font-size: var(--fs-sm); font-weight: 500; white-space: nowrap; }
.onoff span { display: inline-flex; align-items: center; gap: 2px; }
.onoff .icon { width: 13px; height: 13px; }
.onoff .off { color: var(--danger); }

.badge-pct { display: inline-block; min-width: 44px; padding: 1px 7px; border-radius: var(--r-sm); text-align: right; }
.badge-pct.is-danger { background: var(--danger-soft); color: var(--danger); font-weight: 700; }

/* =========================================================================
   Карточки, KPI, подсказки, состояния
   ========================================================================= */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line); }
.card__head h2, .card__head h3 { font-size: var(--fs-md); }
.card__body { padding: var(--s4) var(--s5); }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--s3); }
.kpi { display: flex; flex-direction: column; justify-content: space-between; padding: var(--s4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.kpi__label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.kpi__label .icon { width: 16px; height: 16px; }
.kpi__value { margin-top: var(--s2); font-size: var(--fs-kpi); font-weight: 500; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.kpi__sub { margin-top: 2px; color: var(--muted); font-size: var(--fs-sm); }
.kpi.is-danger .kpi__value { color: var(--danger); }
.kpi--button { font: inherit; color: inherit; text-align: left; cursor: pointer; }
.kpi--button:hover { border-color: var(--line-strong); background: var(--surface-2); }
.reasons { display: flex; align-items: center; gap: var(--s3) var(--s4); flex-wrap: wrap; }
.reasons .section-title { margin: 0; }
.chip--button { font: inherit; font-size: var(--fs-sm); color: var(--ink); cursor: pointer; }
.chip--button:hover { background: var(--surface-2); }

.toolbar { display: flex; align-items: center; gap: var(--s3) var(--s4); flex-wrap: wrap; }
.toolbar__end { margin-left: auto; display: flex; align-items: center; gap: var(--s3); color: var(--muted); font-size: 13px; }
.legend { display: inline-flex; align-items: center; gap: 6px; }
.legend__swatch { width: 3px; height: 14px; border-radius: 2px; background: var(--danger); }

.callout {
  display: flex; gap: var(--s3); padding: var(--s3) var(--s4);
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2);
  color: var(--ink-2); font-size: 13px;
}
.callout .icon { margin-top: 1px; color: var(--muted); }
.callout--danger { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.callout--danger .icon { color: var(--danger); }

.state {
  display: flex; align-items: center; justify-content: center; gap: var(--s2);
  padding: var(--s8) var(--s4); color: var(--muted); text-align: center;
}
.state--error { color: var(--danger); }

.link-btn { padding: 0; border: 0; background: none; font: inherit; color: var(--ink); text-decoration: underline; cursor: pointer; }

/* =========================================================================
   Таблица данных (table.js)
   ========================================================================= */
.dt { --dt-max-h: calc(100vh - 260px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.dt-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  min-height: 44px; padding: 6px var(--s3) 6px var(--s4); border-bottom: 1px solid var(--line); }
.dt-count { color: var(--muted); font-size: 13px; }
.dt-bar__actions { display: flex; gap: var(--s1); }
.dt-scroll { overflow: auto; max-height: var(--dt-max-h); }
.dt-table { width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
.dt-table th, .dt-table td { padding: 9px 10px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
.dt-table .is-right { text-align: right; }
/* числовые колонки — по содержимому, остальное место отдаётся тексту (ФИО, услуги) */
.dt-table th.is-right { width: 1%; }
.dt-table thead th { position: sticky; background: var(--surface); z-index: 2; }
.dt-head th { top: 0; font-size: var(--fs-sm); font-weight: 500; color: var(--muted); user-select: none; border-bottom: 0; padding-bottom: 6px;
  white-space: normal; vertical-align: bottom; line-height: 1.25; }
.dt-filters th { top: 36px; padding-top: 0; padding-bottom: var(--s2); border-bottom: 1px solid var(--line-strong); }
.dt-filters .control--sm { min-width: 70px; }
.dt-filters select.control--sm { min-width: 64px; max-width: 140px; }
.dt-th { display: inline-flex; align-items: center; gap: 4px; }
.dt-head th.is-right .dt-th { flex-direction: row-reverse; }
.dt-head th.is-sortable { cursor: pointer; }
.dt-head th.is-sortable:hover { color: var(--ink); }
.dt-head th.is-sorted { color: var(--ink); }
.dt-sort { display: inline-flex; align-items: center; gap: 1px; }
.dt-sort .icon { width: 14px; height: 14px; }
.dt-sort b { font-size: 10px; font-weight: 700; min-width: 14px; height: 14px; line-height: 14px; text-align: center;
  border-radius: 7px; background: var(--accent); color: var(--accent-ink); }
.dt-table tbody tr:hover td { background: var(--row-hover); }
.dt-table tbody tr.is-clickable { cursor: pointer; }
.dt-table tbody tr.is-warn td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.dt-table tbody tr.is-dim td { color: var(--muted); }
.dt-table tbody tr:last-child td { border-bottom: 0; }
.dt-table tfoot td { position: sticky; bottom: 0; background: var(--surface-2); font-weight: 700; border-top: 1px solid var(--line-strong); border-bottom: 0; }
.dt-empty { display: flex; align-items: center; justify-content: center; gap: var(--s2); padding: var(--s8) var(--s4); color: var(--muted); }
.dt--flat { border-radius: var(--r); }
.dt--compact { --dt-max-h: 360px; }
.dt--compact .dt-table th, .dt--compact .dt-table td { padding: 6px 10px; font-size: 13px; }
.dt--compact .dt-filters th { top: 30px; }
.cell-strong { font-weight: 500; }
.dt-table td.cell-wrap { white-space: normal; min-width: 180px; }
.cell-danger { color: var(--danger); font-weight: 500; }

/* =========================================================================
   Модальное окно
   ========================================================================= */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; }
.modal__backdrop { position: fixed; inset: 0; background: var(--overlay); }
.modal__card {
  position: relative; width: min(880px, calc(100% - 32px)); margin: 40px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); padding: var(--s6);
}
.modal__close { position: absolute; top: var(--s3); right: var(--s3); }
.modal__head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s5);
  padding: 0 var(--s8) var(--s4) 0; border-bottom: 1px solid var(--line); }
.modal__title h2 { font-size: 20px; }
.modal__meta { display: flex; gap: var(--s4); flex-wrap: wrap; margin-top: var(--s1); color: var(--muted); font-size: 13px; }
.modal__meta b { color: var(--ink); font-weight: 500; }
.modal__body { display: flex; flex-direction: column; gap: var(--s5); padding-top: var(--s5); }
.stat-badge { display: flex; flex-direction: column; align-items: center; min-width: 110px; padding: var(--s2) var(--s4);
  border: 1px solid var(--line-strong); border-radius: var(--r); }
.stat-badge b { font-size: 28px; font-weight: 500; line-height: 1.1; }
.stat-badge span { font-size: var(--fs-xs); color: var(--muted); text-align: center; }
.stat-badge.is-danger { border-color: var(--danger); background: var(--danger-soft); }
.stat-badge.is-danger b { color: var(--danger); }
.section-title { display: flex; align-items: center; gap: var(--s2); margin: 0 0 var(--s3); font-size: 13px; font-weight: 500; color: var(--muted); }
.section-title .icon { width: 16px; height: 16px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s2); }
.stat { padding: 10px var(--s3); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
.stat__label { display: flex; align-items: center; gap: 4px; font-size: var(--fs-sm); color: var(--muted); }
.stat__value { margin-top: 2px; font-size: 17px; font-weight: 500; font-variant-numeric: tabular-nums; }
.stat.is-danger .stat__value { color: var(--danger); }

/* =========================================================================
   Формы-«шаги» (Выгрузка) и панель фильтров (По часам)
   ========================================================================= */
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 420px); gap: var(--s5); align-items: start; }
.sticky-side { position: sticky; top: var(--s5); }
.steps { display: flex; flex-direction: column; gap: var(--s3); }
.step { padding: var(--s4) var(--s5); }
.step__head { display: flex; align-items: baseline; gap: var(--s3); margin-bottom: var(--s3); }
.step__num { display: grid; place-items: center; width: 24px; height: 24px; flex-shrink: 0; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-size: var(--fs-sm); font-weight: 700; }
.step__head h2 { font-size: var(--fs-md); }
.step__head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: var(--s3); }
.row { display: flex; align-items: flex-end; gap: var(--s3); flex-wrap: wrap; }
.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s2); }
.option {
  display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3);
  border: 1px solid var(--line-strong); border-radius: var(--r); cursor: pointer;
}
.option:hover { background: var(--surface-2); }
.option:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.option:has(input:disabled) { opacity: .45; cursor: not-allowed; }
.option input { margin: 2px 0 0; accent-color: var(--accent); }
.option b { display: block; font-weight: 500; }
.option small { color: var(--muted); }
.col-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--s4); }
.col-group__head { margin-bottom: 6px; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.col-groups .check { display: flex; padding: 3px 0; font-size: 13px; }
.is-off { opacity: .4; pointer-events: none; }
.group-list { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r); }
.group-list .check { display: flex; padding: 8px var(--s3); border-bottom: 1px solid var(--line); font-size: 13px; }
.group-list .check:last-child { border-bottom: 0; }
.group-list .check:hover { background: var(--surface-2); }
.group-list .check span { flex: 1; }
.preview { padding: var(--s5); display: flex; flex-direction: column; gap: var(--s3); }
.preview-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
.preview-stats div { padding: 10px var(--s2); text-align: center; border: 1px solid var(--line); border-radius: var(--r); }
.preview-stats b { display: block; font-size: 20px; font-weight: 500; }
.preview-stats span { font-size: var(--fs-xs); color: var(--muted); }

.filter-bar { display: flex; align-items: flex-end; gap: var(--s3); flex-wrap: wrap; padding: var(--s4) var(--s5); }
.filter-bar__actions { margin-left: auto; display: flex; gap: var(--s2); flex-wrap: wrap; }
.stats-row { display: flex; gap: var(--s5); flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 13px; }
.stats-row b { color: var(--ink); font-weight: 500; }

@media (max-width: 1100px) {
  .two-col { grid-template-columns: 1fr; }
  .sticky-side { position: static; }
}

/* =========================================================================
   Список + детализация (Услуги, Ветки)
   ========================================================================= */
.split { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: var(--s4); align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }
.split > .card { min-width: 0; }
.list-card .card__body { display: flex; flex-direction: column; gap: var(--s3); }
.picklist { display: flex; flex-direction: column; gap: 2px; max-height: calc(100vh - 330px); min-height: 200px; overflow: auto; margin: 0 calc(-1 * var(--s2)); padding: 0 var(--s2); }
.pick {
  display: flex; flex-direction: column; gap: 5px; width: 100%; padding: 8px 10px;
  font: inherit; font-size: 13px; text-align: left; color: var(--ink);
  background: transparent; border: 0; border-radius: var(--r-sm); cursor: pointer;
}
.pick:hover { background: var(--surface-2); }
.pick.is-active { background: var(--accent); color: var(--accent-ink); }
.pick.is-active .onoff .off, .pick.is-active small { color: var(--accent-ink); }
.pick.is-kbd { box-shadow: inset 0 0 0 2px var(--ink); }
.pick__row { display: flex; align-items: center; gap: var(--s2); width: 100%; }
.pick__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick__bar { display: flex; height: 3px; overflow: hidden; border-radius: 2px; background: var(--surface-3); }
.pick__bar .on { background: var(--muted); }
.pick__bar .off { background: var(--danger); }
.pick.is-active .pick__bar .on { background: var(--accent-ink); }
.detail-head { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.detail-head h2 { font-size: var(--fs-lg); overflow-wrap: anywhere; }
.detail-head span { color: var(--muted); font-size: 13px; }
.tabs { display: flex; gap: var(--s5); padding: 0 var(--s5); border-bottom: 1px solid var(--line); }
.tab { display: inline-flex; align-items: center; gap: var(--s2); padding: var(--s3) 0; margin-bottom: -1px;
  font: inherit; font-weight: 500; color: var(--muted); background: none; border: 0; border-bottom: 2px solid transparent; cursor: pointer; }
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); border-bottom-color: var(--ink); }
.dash { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s5); }
@media (max-width: 760px) { .dash { grid-template-columns: 1fr; } }
.dash__row { display: flex; align-items: center; gap: var(--s3); width: 100%; padding: 8px; font: inherit; font-size: 13px;
  text-align: left; color: var(--ink); background: none; border: 0; border-radius: var(--r-sm); cursor: pointer; }
.dash__row:hover { background: var(--surface-2); }
.dash__rank { width: 18px; color: var(--muted); font-size: var(--fs-sm); }
.dash__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 10; max-height: 260px; overflow: auto;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r); box-shadow: var(--shadow-lg); }
.suggest .check { display: flex; padding: 8px var(--s3); font-size: 13px; }
.suggest .check:hover { background: var(--surface-2); }
.suggest .check span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rel { position: relative; }

/* =========================================================================
   Страница входа
   ========================================================================= */
.login { min-height: 100vh; display: grid; place-items: center; padding: var(--s4); }
.login__card { width: min(380px, 100%); padding: var(--s8) var(--s6); }
.login__card .brand { margin-bottom: var(--s6); }
.login__card form { display: flex; flex-direction: column; gap: var(--s3); }
.login__card .control { width: 100%; height: 42px; }
.login__card .btn { height: 42px; margin-top: var(--s2); }
.login__foot { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); margin-top: var(--s5); }
