/* Управленческий учёт — оформление в едином стиле с Кратно BI:
   светлая основа, насыщенный синий как акцент, крупные жирные заголовки,
   кнопки капслоком с разрядкой, карточки со скруглением 16. Каркас —
   светлая шапка, боковое меню слева, меню профиля справа вверху.

   Все текстовые токены проверены на контраст ≥ 4.5:1 (WCAG AA) ко всем
   поверхностям, на которых появляются. При правке цветов пересчитывать. */

:root {
  --bg:        #f7f8fc;
  --surface:   #ffffff;
  --sunken:    #f1f3f9;
  --ink:       #0d0d12;
  --muted:     #545b68;
  --faint:     #666d79;
  --line:      #e6e9f0;
  --line-soft: #eef1f6;
  --blue:      #2e4bf5;
  --blue-soft: #e9edff;
  --blue-ink:  #1f37c4;   /* синий для текста: контраст к белому 6.4:1 */
  --brand-red: #d63b33;
  --dark:      #0f1729;
  --green:     #0f7a37;
  --amber:     #a8560b;
  --red:       #c81e1e;
  --on-accent: #ffffff;
  --radius:    16px;
  --radius-sm: 10px;
  --shadow:    0 1px 2px rgba(13,13,18,.03), 0 8px 24px rgba(13,13,18,.04);
  --shadow-lg: 0 12px 32px rgba(13,13,18,.14);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

  /* Категориальная палитра данных — проверена валидатором на разделимость
     при дальтонизме. Порядок закреплён: проект не меняет цвет при фильтрации. */
  --c1: #2a78d6; --c2: #eb6834; --c3: #1baf7a; --c4: #eda100;
  --c5: #e87ba4; --c6: #008300; --c7: #4a3aa7; --c8: #e34948;
}

[data-theme="dark"] {
  --bg:        #0f1115;
  --surface:   #171a21;
  --sunken:    #12151b;
  --ink:       #e7eaf0;
  --muted:     #9aa3b2;
  --faint:     #8b94a4;
  --line:      #262b35;
  --line-soft: #1f242d;
  --blue:      #5b8dff;
  --blue-soft: #1b2740;
  --blue-ink:  #85aaff;
  --brand-red: #f87171;
  --dark:      #05070c;
  --green:     #34d399;
  --amber:     #fbbf24;
  --red:       #f87171;
  --on-accent: #0f1115;
  --shadow:    0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.28);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.5);
  --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500;
  --c5: #d55181; --c6: #008300; --c7: #9085e9; --c8: #e66767;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.pos { color: var(--green); }
.neg { color: var(--red); }
.warn { color: var(--amber); }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }

/* ── Вход ─────────────────────────────────────────────────────────── */
.login-screen {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1100px 520px at 50% -10%, var(--blue-soft), var(--bg));
}
.login-card {
  width: 100%; max-width: 400px; background: var(--surface); padding: 36px;
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 16px;
}
.login-card .logo { height: 40px; width: auto; align-self: flex-start; }
.login-card h1 {
  margin: 0; font-size: 20px; font-weight: 750; letter-spacing: -.2px;
}
.login-card p { margin: -10px 0 6px; font-size: 14px; color: var(--muted); }
.login-card label {
  display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted);
}
.login-error { color: var(--red); font-size: 13px; min-height: 18px; }

/* ── Шапка ────────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; gap: 16px;
  height: 68px; padding: 0 20px;
  background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.brand .logo { height: 26px; width: auto; display: block; }
/* Подпись рядом со знаком: приглушена, чтобы не спорить с логотипом */
.brand .sfx {
  font-size: 11.5px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
  padding-left: 12px; border-left: 1px solid var(--line);
}

/* Один и тот же логотип в двух вариантах: в тёмной теме надпись
   перекрашена в светлую, знак остаётся фирменным.
   Двойной класс нужен по специфичности — иначе `.brand .logo`
   и `.login-card .logo` перебивают скрытие, и видны оба файла сразу. */
.logo.logo-dark { display: none; }
[data-theme="dark"] .logo.logo-light { display: none; }
[data-theme="dark"] .logo.logo-dark { display: block; }
.top-spacer { flex: 1; }

.burger {
  display: grid; place-items: center; width: 38px; height: 38px; flex: none;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--muted); cursor: pointer; padding: 0;
}
.burger:hover { color: var(--ink); border-color: #cfd6e4; }
.burger svg { width: 19px; height: 19px; fill: currentColor; }

.usermenu { position: relative; }
.usermenu > summary {
  display: flex; align-items: center; gap: 11px; cursor: pointer;
  list-style: none; padding: 6px 12px 6px 6px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
}
.usermenu > summary::-webkit-details-marker { display: none; }
.usermenu > summary:hover { border-color: #cfd6e4; }
.who-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px;
  background: linear-gradient(135deg, var(--blue), #6d7ff8);
}
.who-text { display: flex; flex-direction: column; line-height: 1.15; }
.who-name { font-size: 14px; font-weight: 600; }
.who-role { font-size: 11.5px; color: var(--muted); }
.who-caret { color: var(--faint); font-size: 15px; }

.usermenu-body {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40;
  width: 258px; max-height: calc(100vh - 100px); overflow-y: auto;
  padding: 6px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg);
}
.usermenu-body button, .usermenu-body a {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 9px 12px; border-radius: 9px; border: 0; background: none;
  color: var(--ink); font: inherit; font-size: 14px; text-align: left; cursor: pointer;
  text-transform: none; letter-spacing: 0;
}
.usermenu-body button:hover, .usermenu-body a:hover {
  background: var(--bg); text-decoration: none; filter: none;
}
.usermenu-body .on { color: var(--blue-ink); font-weight: 600; }
.usermenu-body svg { width: 17px; height: 17px; flex: none; fill: var(--faint); }
.usermenu-body .on svg { fill: var(--blue); }
.menu-group {
  padding: 12px 12px 5px; font-size: 11px; font-weight: 700; color: var(--faint);
  text-transform: uppercase; letter-spacing: .06em;
}
.usermenu-exit {
  margin-top: 6px; border-top: 1px solid var(--line-soft);
  padding-top: 12px !important; color: var(--brand-red) !important;
}
.usermenu-exit svg { fill: var(--brand-red) !important; opacity: .8; }

/* ── Каркас ───────────────────────────────────────────────────────── */
.shell { display: flex; align-items: flex-start; min-height: calc(100vh - 68px); }

.sidebar {
  width: 252px; flex: none; background: var(--surface);
  border-right: 1px solid var(--line); padding: 14px 0;
  position: sticky; top: 68px;
  height: calc(100vh - 68px); overflow-y: auto; overscroll-behavior: contain;
  transition: width .16s ease;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.sidebar nav { display: flex; flex-direction: column; }
.sidebar button {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 11px 22px; border: 0; border-left: 3px solid transparent;
  background: none; color: var(--ink); font: inherit; font-size: 14.5px;
  text-align: left; cursor: pointer; text-transform: none; letter-spacing: 0;
  border-radius: 0; white-space: nowrap;
}
.sidebar button:hover { background: var(--bg); filter: none; }
.sidebar button.on {
  color: var(--blue-ink); border-left-color: var(--blue);
  font-weight: 650; background: var(--blue-soft);
}
.sidebar svg { width: 20px; height: 20px; fill: var(--faint); flex: none; }
.sidebar button.on svg { fill: var(--blue); }
.nav-group {
  padding: 16px 22px 6px; font-size: 11px; font-weight: 700; color: var(--faint);
  text-transform: uppercase; letter-spacing: .06em;
}

/* Свёрнутое меню: остаются только значки, подписи всплывают по наведению */
body.nav-collapsed .sidebar { width: 62px; }
body.nav-collapsed .sidebar .label,
body.nav-collapsed .sidebar .nav-group { display: none; }
body.nav-collapsed .sidebar button { justify-content: center; padding: 12px 0; gap: 0; }
body.nav-collapsed .sidebar button::after {
  content: attr(data-title); position: absolute; left: 62px; z-index: 50;
  background: var(--dark); color: #fff; font-size: 12.5px; font-weight: 500;
  padding: 6px 10px; border-radius: 8px; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .1s;
}
body.nav-collapsed .sidebar button { position: relative; }
body.nav-collapsed .sidebar button:hover::after { opacity: 1; }

.content { flex: 1; padding: 24px 28px 72px; min-width: 0; }

/* ── Заголовки ────────────────────────────────────────────────────── */
.page-head { margin-bottom: 18px; }
.page-head h1 {
  font-size: 30px; font-weight: 800; margin: 0 0 6px; letter-spacing: -.9px;
}
.page-head .sub { color: var(--muted); font-size: 14px; margin: 0; }

/* ── Панель фильтров ──────────────────────────────────────────────── */
.filters {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 18px; margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label {
  font-size: 11px; color: var(--faint); font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
}
.field.grow { flex: 1 1 190px; max-width: 320px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dash { color: var(--faint); }
.filters-spacer { flex: 1; }

.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.segmented button {
  border: 0; border-radius: 0; background: var(--surface); color: var(--muted);
  padding: 8px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
  text-transform: none; letter-spacing: 0;
}
.segmented button + button { border-left: 1px solid var(--line); }
.segmented button:hover { background: var(--bg); filter: none; color: var(--ink); }
.segmented button.on { background: var(--blue-soft); color: var(--blue-ink); }

input, select, textarea {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 8px 12px; outline: none; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: -1px; }
input[type="date"], input[type="month"] { min-width: 140px; }
textarea { resize: vertical; min-height: 64px; }

.multi {
  position: relative; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); padding: 5px 8px; min-height: 38px; cursor: pointer;
  display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
}
.multi .chip {
  background: var(--blue-soft); color: var(--blue-ink); border-radius: 6px;
  padding: 2px 7px; font-size: 12.5px; display: inline-flex; gap: 6px; align-items: center;
}
.multi .chip b { cursor: pointer; opacity: .65; }
.multi .placeholder { color: var(--faint); font-size: 14px; padding: 2px; }
.multi-menu {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 60;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); max-height: 300px; overflow: auto; padding: 4px;
}
.multi-menu label {
  display: flex; gap: 9px; align-items: center; padding: 7px 9px;
  border-radius: 7px; font-size: 14px; cursor: pointer;
}
.multi-menu label:hover { background: var(--bg); }
.multi-menu input { min-width: auto; }

/* ── Кнопки ───────────────────────────────────────────────────────── */
button, .btn {
  font: inherit; background: var(--blue); color: var(--on-accent);
  border: 1px solid var(--blue); cursor: pointer; font-weight: 700;
  padding: 9px 18px; text-transform: uppercase; letter-spacing: .06em;
  font-size: 12.5px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  text-decoration: none; white-space: nowrap;
}
button:hover, .btn:hover { filter: brightness(1.08); text-decoration: none; color: var(--on-accent); }
.btn.plain, button.plain {
  background: var(--surface); color: var(--muted); border-color: var(--line);
}
.btn.plain:hover, button.plain:hover {
  color: var(--ink); border-color: var(--muted); filter: none;
}
.btn.danger, button.danger {
  background: transparent; color: var(--brand-red); border-color: #f3c9c6;
}
.btn.danger:hover, button.danger:hover { background: #fdf1f1; filter: none; color: var(--brand-red); }
[data-theme="dark"] .btn.danger:hover, [data-theme="dark"] button.danger:hover { background: #2a1618; }
.btn.small, button.small { padding: 6px 12px; font-size: 11.5px; }
.btn.wide { width: 100%; padding: 12px; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.link {
  background: none; border: 0; color: var(--blue-ink); text-transform: none;
  letter-spacing: 0; font-weight: 500; font-size: 13.5px; padding: 4px 6px;
}
button.link:hover { filter: none; text-decoration: underline; }

/* ── Карточки ─────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.card-head {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  padding: 14px 18px; border-bottom: 1px solid var(--line-soft);
}
.card-head h3 { margin: 0; font-size: 15px; font-weight: 650; }
.card-head .note { color: var(--muted); font-size: 13px; }
.card-head .spacer { flex: 1; }
.card-body { padding: 16px 18px; }
.card-body.tight { padding: 0; }

.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(430px, 100%), 1fr)); }
.cols-3 { grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }

/* ── Плитки показателей ───────────────────────────────────────────── */
.kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  gap: 14px; margin-bottom: 18px;
}
/* Шесть показателей раскладываем по три: иначе на широком экране пятеро
   встают в ряд, а шестой висит один в следующей строке. */
@media (min-width: 901px) {
  .kpis.six { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.kpi {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 17px 19px; box-shadow: var(--shadow);
}
.kpi .k {
  color: var(--muted); font-size: 11.5px; font-weight: 650;
  text-transform: uppercase; letter-spacing: .05em;
}
.kpi .v {
  font-size: 25px; font-weight: 680; margin-top: 7px;
  letter-spacing: -.7px; font-variant-numeric: tabular-nums;
}
.kpi .d {
  margin-top: 5px; font-size: 12.5px; font-variant-numeric: tabular-nums;
  color: var(--muted); display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap;
}
.kpi .d.up { color: var(--green); }
.kpi .d.down { color: var(--red); }

/* ── Таблицы ──────────────────────────────────────────────────────── */
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 18px; text-align: left; border-bottom: 1px solid var(--line-soft); }
th {
  font-size: 11.5px; font-weight: 700; color: var(--faint);
  text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
  position: sticky; top: 0; background: var(--surface); z-index: 2;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover td { background: var(--bg); }
tbody tr.group td { background: var(--sunken); font-weight: 700; }
tbody tr.subtotal td { font-weight: 700; border-top: 1px solid var(--line); }
tbody tr.result td { font-weight: 800; background: var(--blue-soft); }
td.indent { padding-left: 34px; }
.table-compact th, .table-compact td { padding: 7px 12px; font-size: 13px; }

.bar-cell { position: relative; }
.bar-cell .bar {
  position: absolute; left: 0; top: 4px; bottom: 4px; border-radius: 3px;
  background: var(--blue); opacity: .12;
}
.bar-cell span { position: relative; }

.pill {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 650; border: 1px solid var(--line); color: var(--muted);
}
.pill.income { color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, transparent); }
.pill.expense { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.pill.planned { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 40%, transparent); }
.pill.blue { color: var(--blue-ink); border-color: var(--blue); background: var(--blue-soft); }

/* ── Графики ──────────────────────────────────────────────────────── */
svg.chart { display: block; width: 100%; overflow: visible; }
svg.chart text { fill: var(--faint); font-size: 10.5px; font-family: inherit; }
svg.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--ink); margin-top: 12px; }
.legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; margin-right: 7px; }
.legend span { display: inline-flex; align-items: center; }

.barlist { display: flex; flex-direction: column; gap: 8px; }
.barlist-row { display: grid; grid-template-columns: minmax(90px, 200px) 1fr auto; gap: 12px; align-items: center; }
.barlist-name { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barlist-track { background: var(--sunken); border-radius: 5px; height: 18px; overflow: hidden; }
.barlist-fill { height: 100%; border-radius: 5px; }
.barlist-value { font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }

.donut-wrap { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.donut-legend { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 170px; }
.donut-item { display: grid; grid-template-columns: 11px 1fr auto; gap: 9px; align-items: center; font-size: 13px; }
.donut-item i { width: 11px; height: 11px; border-radius: 3px; }
.donut-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Модальное окно ───────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(13,13,18,.55); z-index: 100;
  display: grid; place-items: start center; padding: 40px 16px; overflow: auto;
}
.modal {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  width: 100%; max-width: 880px; box-shadow: 0 24px 64px rgba(13,13,18,.3);
}
.modal.wide { max-width: 1140px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--line-soft);
}
.modal-head h2 { margin: 0; font-size: 19px; font-weight: 750; letter-spacing: -.3px; }
.modal-body { padding: 20px 22px 8px; display: flex; flex-direction: column; gap: 16px; }
.modal-foot {
  display: flex; gap: 10px; justify-content: flex-end; padding: 14px 22px;
  border-top: 1px solid var(--line-soft); position: sticky; bottom: 0;
  background: var(--surface); border-radius: 0 0 var(--radius) var(--radius);
}
.icon-btn {
  background: none; border: 1px solid var(--line); color: var(--muted);
  width: 34px; height: 34px; border-radius: var(--radius-sm); padding: 0;
  font-size: 15px; text-transform: none; letter-spacing: 0;
}
.icon-btn:hover { color: var(--ink); border-color: var(--muted); filter: none; background: none; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.form-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.form-grid.one { grid-template-columns: 1fr; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field > label { font-size: 12.5px; color: var(--muted); font-weight: 550; }
.form-field .hint { font-size: 12px; color: var(--faint); }
.form-field.span-2 { grid-column: span 2; }
.form-field.span-all { grid-column: 1 / -1; }
.check { display: flex; gap: 9px; align-items: center; font-size: 14px; }
.check input { min-width: auto; }

.lines-table { width: 100%; border-collapse: collapse; }
.lines-table th {
  font-size: 11px; text-transform: uppercase; color: var(--faint);
  text-align: left; padding: 4px 5px; font-weight: 700; position: static;
  border: 0; letter-spacing: .04em;
}
.lines-table td { padding: 3px 5px; border: 0; }
.lines-table input, .lines-table select { width: 100%; padding: 7px 9px; font-size: 13.5px; }
.lines-total { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 10px; font-size: 14px; }

.section-title {
  font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--faint); font-weight: 700; margin: 4px 0 0;
  border-top: 1px solid var(--line-soft); padding-top: 14px;
}

/* ── Служебное ────────────────────────────────────────────────────── */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 9px; }
.toast {
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--blue);
  padding: 12px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  max-width: 400px; font-size: 14px; animation: slide-in .18s ease;
}
.toast.error { border-left-color: var(--red); }
.toast.ok { border-left-color: var(--green); }
@keyframes slide-in { from { opacity: 0; transform: translateX(14px); } }

.empty { padding: 48px 20px; text-align: center; color: var(--faint); }
.empty .big { font-size: 32px; margin-bottom: 10px; }
.loading { padding: 48px; text-align: center; color: var(--faint); }
.note-box {
  background: var(--sunken); border-radius: var(--radius-sm);
  padding: 12px 15px; font-size: 13.5px; color: var(--muted); line-height: 1.5;
}

/* ── Телефон и планшет ────────────────────────────────────────────── */
@media (max-width: 900px) {
  .topbar { height: 60px; padding: 0 12px; gap: 10px; }
  .brand .sfx { display: none; }
  .brand .logo { height: 22px; }
  .who-text { display: none; }
  .usermenu > summary { padding: 5px; }
  .content { padding: 14px 12px 60px; }
  .sidebar {
    position: fixed; top: 60px; left: 0; bottom: 0; z-index: 45;
    width: 252px; transform: translateX(-100%); transition: transform .18s ease;
    box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-collapsed .sidebar { width: 252px; }
  body.nav-collapsed .sidebar .label,
  body.nav-collapsed .sidebar .nav-group { display: block; }
  body.nav-collapsed .sidebar button { justify-content: flex-start; padding: 11px 22px; gap: 14px; }
  body.nav-collapsed .sidebar button::after { content: none; }
  .nav-scrim {
    position: fixed; inset: 60px 0 0; background: rgba(13,13,18,.4); z-index: 44;
  }

  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 13px 14px; }
  .kpi .v { font-size: 19px; }
  .kpi .k { font-size: 10px; }
  .page-head h1 { font-size: 22px; }
  .grid { gap: 10px; }
  .field.grow { max-width: none; flex-basis: 100%; }
  .filters { padding: 12px; gap: 10px; }
  .filters .field { flex: 1 1 100%; }

  .modal-backdrop { padding: 0; }
  .modal, .modal.wide { max-width: 100%; border-radius: 0; min-height: 100vh; }
  .modal-head { position: sticky; top: 0; background: var(--surface); z-index: 5; }
  .modal-body { padding: 14px; }
  .modal-foot { padding: 12px 14px; border-radius: 0; flex-wrap: wrap; }
  .modal-foot .btn, .modal-foot button { flex: 1 1 auto; }
  .form-grid, .form-grid.cols-4 { grid-template-columns: 1fr; }
  .form-field.span-2, .form-field.span-all { grid-column: auto; }

  /* Строки разбивки — карточкой на строку вместо широкой таблицы */
  .lines-table thead { display: none; }
  .lines-table, .lines-table tbody, .lines-table tr, .lines-table td { display: block; width: 100%; }
  .lines-table tr {
    border: 1px solid var(--line); border-radius: 12px; padding: 11px;
    margin-bottom: 10px; background: var(--sunken); position: relative;
  }
  .lines-table td { padding: 4px 0; }
  .lines-table td::before {
    content: attr(data-label); display: block; margin-bottom: 3px;
    font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em;
    color: var(--faint); font-weight: 700;
  }
  .lines-table td:last-child { position: absolute; top: 7px; right: 7px; width: auto; padding: 0; }
  .lines-table td:last-child::before { content: none; }

  th, td { padding: 8px 12px; font-size: 13px; }
  .toasts { left: 12px; right: 12px; bottom: 12px; }
  .toast { max-width: none; }
  .barlist-row { grid-template-columns: minmax(70px, 40%) 1fr auto; }
}
