:root {
  --bg: #f4f6fa;
  --panel: #fff;
  --ink: #17202e;
  --soft: #667085;
  --line: #e3e8ef;
  --line2: #cfd6e2;
  --accent: #2f5fe0;
  --accent-bg: #eaf0ff;
  --danger: #d92d20;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 8px 24px rgba(16,24,40,.06);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sidebar: 236px;
}

* { box-sizing: border-box; }
/* Собственные display:flex перебивают браузерное [hidden]{display:none} —
   без этого правила боковая панель и полоса массовых действий видны всегда. */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.45 -apple-system, "Segoe UI", Inter, Roboto, Arial, sans-serif;
  color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
button, input, select, textarea { font: inherit; }

svg.i { width: 18px; height: 18px; flex: none; display: block; }
.btn svg.i, .rowbtn svg.i { width: 16px; height: 16px; }

/* ── Вход ───────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1100px 500px at 50% -10%, #e6edff, var(--bg));
}
.login-card {
  width: 100%; max-width: 340px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 16px; padding: 28px 26px 26px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: stretch; gap: 14px;
}
.login-card .mark {
  width: 44px; height: 44px; border-radius: 12px; background: var(--accent); color: #fff;
  display: grid; place-items: center; margin: 0 auto 6px;
}
.login-card .mark svg.i { width: 25px; height: 25px; }
.login-card .field { margin: 0; }
.login-card input { padding: 10px 12px; }
.pwbox { position: relative; display: block; }
.pwbox input { padding-right: 40px; }
.pweye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: none; color: var(--soft); cursor: pointer;
  padding: 6px; border-radius: 7px; display: grid; place-items: center;
}
.pweye:hover { background: #f2f4f8; color: var(--ink); }
.login-card .btn { width: 100%; justify-content: center; margin-top: 2px; padding: 10px 14px; }
.login-err {
  background: #fef3f2; color: var(--danger); border: 1px solid #fecdca;
  border-radius: 9px; padding: 9px 12px; font-size: 13px;
}

/* ── Каркас ─────────────────────────────────────────────── */
/* Меню — узкая полоса с иконками; при наведении разворачивается ПОВЕРХ
   таблицы, не сдвигая её. Кнопкой можно закрепить развёрнутым. */
.app { display: block; --w: 62px; }
.app.pinned { --w: var(--sidebar); }

.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--w); z-index: 40;
  background: #101828; color: #cbd5e1; display: flex; flex-direction: column;
  overflow: hidden; transition: width .16s ease;
}
.app:not(.pinned) .sidebar:hover {
  width: var(--sidebar); box-shadow: 8px 0 30px rgba(16, 24, 40, .32);
}

/* Страница флоу — это сама таблица: шапка, фильтры и таблица на всю высоту. */
.content {
  margin-left: var(--w); padding: 0; min-width: 0; height: 100vh;
  display: flex; flex-direction: column;
  transition: margin-left .16s ease;
}
/* Шапка и фильтры со своими отступами, таблица — вплотную к краям экрана. */
.content > .pagehead { padding: 12px 16px 10px; }
.content > .toolbar,
.content > .bulkbar { border-radius: 0; border-left: 0; border-right: 0; box-shadow: none; }
.content > .toolbar { border-top: 0; }
.content > .pills { padding: 9px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.content > .tablewrap {
  border-radius: 0; border: 0; border-top: 1px solid var(--line); box-shadow: none;
}
/* Служебные страницы (статистика, пользователи, журнал) — обычная прокрутка. */
.content.scroll { height: auto; display: block; padding: 20px 24px 56px; }
.content.scroll > .toolbar, .content.scroll > .tablewrap { border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); }
.content.scroll > .pagehead { padding: 0; }

/* Свёрнутое состояние: прячем подписи, центрируем иконки */
.app:not(.pinned) .sidebar:not(:hover) .nav a .ttl,
.app:not(.pinned) .sidebar:not(:hover) .nav a .ro,
.app:not(.pinned) .sidebar:not(:hover) .navlabel,
.app:not(.pinned) .sidebar:not(:hover) .userbox .iconbtn,
.app:not(.pinned) .sidebar:not(:hover) .userbox .who { display: none; }
.app:not(.pinned) .sidebar:not(:hover) .nav a { justify-content: center; padding: 9px 0; }
.app:not(.pinned) .sidebar:not(:hover) .userbox { flex-direction: column; gap: 6px; padding: 10px 0; }

.app.pinned .collapse-btn { color: #6f9bff; }

.navlabel {
  padding: 18px 20px 6px; font-size: 10.5px; letter-spacing: .09em;
  text-transform: uppercase; color: #64748b; font-weight: 700; white-space: nowrap;
}
.nav { display: flex; flex-direction: column; gap: 1px; padding: 0 10px 10px; overflow-y: auto; overflow-x: hidden; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 11px; border-radius: 9px;
  color: #cbd5e1; text-decoration: none; cursor: pointer; font-weight: 550; font-size: 13.5px;
}
.nav a:hover { background: #1c2740; color: #fff; }
.nav a.active { background: var(--accent); color: #fff; }
.nav a .ttl { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav a .ro { font-size: 10px; opacity: .6; letter-spacing: .02em; white-space: nowrap; }
.userbox { border-top: 1px solid #1e293b; padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.userbox .av {
  width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none;
}
.userbox .who { flex: 1; min-width: 0; }
.userbox .who b { color: #fff; font-size: 13px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.userbox .who span { font-size: 11.5px; color: #8593ab; }
.userbox .iconbtn { color: #94a3b8; }
.userbox .iconbtn:hover { background: #1c2740; color: #fff; }

/* ── Шапка страницы ─────────────────────────────────────── */
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; flex: none; }
.content.scroll .pagehead { margin-bottom: 16px; }
.pagehead .who { display: flex; align-items: center; gap: 12px; }
.pagehead .phico {
  width: 36px; height: 36px; border-radius: 11px; background: var(--accent-bg);
  color: var(--accent); display: grid; place-items: center; flex: none;
}
.pagehead .phico svg.i { width: 21px; height: 21px; }
.pagehead h1 { font-size: 18px; }
.pagehead .sub { color: var(--soft); font-size: 12.5px; margin-top: 2px; }
.pagehead .acts { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }

/* ── Элементы ───────────────────────────────────────────── */
.btn {
  border: 1px solid var(--line2); background: var(--panel); color: var(--ink);
  padding: 8px 13px; border-radius: 9px; font-weight: 550; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  transition: background .12s, border-color .12s, transform .05s, color .12s;
}
.btn:hover { background: #f7f9fc; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #2750c4; }
.btn.danger { border-color: #f2b8b5; color: var(--danger); }
.btn.danger:hover { background: #fef3f2; }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.iconbtn {
  border: 0; background: none; cursor: pointer; color: var(--soft);
  padding: 6px; border-radius: 8px; display: inline-grid; place-items: center;
}
.iconbtn:hover { background: #f2f4f8; color: var(--ink); }

.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.field > span { color: var(--soft); font-weight: 550; }
input, select, textarea {
  color: var(--ink); background: var(--panel); border: 1px solid var(--line2);
  border-radius: 9px; padding: 8px 10px; outline: none; width: 100%;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,95,224,.14); }
input[type=checkbox], input[type=radio] { width: auto; }
textarea { resize: vertical; }
.readonly-note { color: var(--soft); font-size: 12.5px; background: #f7f9fc; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }

/* ── KPI ────────────────────────────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 15px; box-shadow: var(--shadow); min-width: 0; }
.kpi .label {
  font-size: 11.5px; color: var(--soft); font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.kpi .value { font-size: 23px; font-weight: 680; margin-top: 3px; letter-spacing: -.02em; }
.kpi .value small { font-size: 13px; font-weight: 550; color: var(--soft); margin-left: 3px; }
.kpi .bar { height: 4px; border-radius: 3px; background: #eef1f6; margin-top: 8px; overflow: hidden; }
.kpi .bar > i { display: block; height: 100%; border-radius: 3px; }

/* ── Панель фильтров ────────────────────────────────────── */
.toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: none;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; box-shadow: var(--shadow);
}
.searchbox { position: relative; flex: 0 0 250px; display: flex; align-items: center; }
.searchbox svg.i { position: absolute; left: 10px; color: var(--soft); width: 16px; height: 16px; pointer-events: none; }
.searchbox input { padding-left: 33px; }
.daterange { display: flex; align-items: center; gap: 6px; color: var(--soft); font-size: 12.5px; }
.daterange input { width: 145px; }
.toolbar .sep { width: 1px; align-self: stretch; background: var(--line); margin: 0 2px; }
.toolbar .grow { flex: 1; }

.dropdown { position: relative; }
.btn.dd.on { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); }
.btn.dd .cnt {
  background: var(--accent); color: #fff; border-radius: 999px;
  padding: 0 6px; font-size: 11px; font-weight: 700; line-height: 17px;
}
.ddpanel.right { left: auto; right: 0; }
.ddpanel {
  position: absolute; z-index: 25; top: calc(100% + 6px); left: 0;
  min-width: 236px; max-height: 330px; overflow: auto; background: var(--panel);
  border: 1px solid var(--line2); border-radius: 11px; padding: 6px;
  box-shadow: 0 14px 34px rgba(16,24,40,.17);
}
.ddrow { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.ddrow:hover { background: #f4f7fb; }
.ddrow .dot { width: 11px; height: 11px; border-radius: 3px; flex: none; border: 1px solid rgba(0,0,0,.08); }
.ddrow .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ddrow .n { color: var(--soft); font-variant-numeric: tabular-nums; font-size: 12px; }

.pills { display: flex; gap: 7px; flex-wrap: wrap; flex: none; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 5px 3px 10px;
  border-radius: 999px; font-size: 12.5px; font-weight: 600;
}
.pill button {
  border: 0; background: rgba(0,0,0,.13); color: inherit; border-radius: 50%;
  width: 17px; height: 17px; cursor: pointer; display: grid; place-items: center; padding: 0;
}
.pill button:hover { background: rgba(0,0,0,.26); }
.pill button svg.i { width: 11px; height: 11px; stroke-width: 2.6; }

.bulkbar {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  background: var(--accent-bg); border: 1px solid #c9d8ff; border-radius: var(--radius);
  padding: 9px 12px; font-weight: 550; flex: none;
}
.bulkbar select { width: auto; min-width: 148px; }

/* ── Таблица ────────────────────────────────────────────── */
.tablewrap {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: auto; box-shadow: var(--shadow); flex: 1; min-height: 0;
}
.content.scroll .tablewrap { flex: none; max-height: none; }
table.grid {
  border-collapse: separate; border-spacing: 0; font-size: 12.5px;
  width: 100%; table-layout: auto;
}
/* Таблицы флоу — по содержимому, но не уже контейнера. Служебные (журнал)
   остаются шириной с контейнер, иначе длинные тексты растягивают страницу. */
table.grid.data { width: max-content; min-width: 100%; }
.grid td.wrap { white-space: normal; min-width: 220px; }
.grid th {
  position: sticky; top: 0; z-index: 5; background: #f8fafc; text-align: left;
  padding: 7px 8px; font-weight: 620; color: #475467; white-space: nowrap;
  border-bottom: 1px solid var(--line2); cursor: pointer; user-select: none;
}
.grid th.plain { cursor: default; width: 34px; }
.grid th.stick, .grid td.stick {
  position: sticky; left: 0; z-index: 6; background: #f8fafc;
  box-shadow: 1px 0 0 var(--line);
}
.grid td.stick { background: var(--panel); z-index: 4; }
.grid tbody tr:hover td.stick { background: #fafbfe; }
.grid tbody tr.sel td.stick { background: #eef3ff; }
.grid th:not(.plain):hover { background: #eef2f7; }
.grid th .arrow { opacity: .3; font-size: 9px; margin-left: 4px; }
.grid th.sorted { color: var(--accent); }
.grid th.sorted .arrow { opacity: 1; }
.grid td {
  padding: 0 8px; height: 29px; border-bottom: 1px solid #eef1f6;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Обрезаем только длинный текст, короткие значения показываем целиком. */
.grid td.w-l { max-width: 260px; }
/* Даты — узкая колонка: в ячейке день.месяц, полная дата в подсказке и в редакторе */
.grid td.w-xs { max-width: 72px; }
.grid th.w-xs { white-space: normal; line-height: 1.15; max-width: 72px; }
.grid td.w-m { max-width: 190px; }
.grid tbody tr:hover td { background: #fafbfe; }
.grid tbody tr.sel td { background: #eef3ff; }
.grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
.grid td.mono { font-family: var(--mono); font-size: 12.5px; }
.grid td.tint { font-weight: 600; }
.grid td.soft { color: var(--soft); }
.grid td.center { text-align: center; }
.grid td a { color: var(--accent); display: inline-flex; }
.rowbtn { border: 0; background: none; cursor: pointer; color: var(--soft); padding: 4px; border-radius: 6px; opacity: 0; display: inline-grid; place-items: center; }
.grid tbody tr:hover .rowbtn { opacity: 1; }
.rowbtn:hover { background: var(--accent-bg); color: var(--accent); }
.empty { text-align: center; color: var(--soft); padding: 44px; margin: 0; }

/* ── Правка ячейки на месте ─────────────────────────────── */
.grid td.editable { cursor: cell; }
.grid td.locked { cursor: default; }
.grid td.editing { padding: 0; box-shadow: inset 0 0 0 2px var(--accent); background: var(--panel) !important; }
.grid td.editing.datecell { overflow: visible; position: relative; }
.datebar {
  position: absolute; top: 100%; left: -1px; z-index: 20; display: flex; gap: 4px;
  background: var(--panel); border: 1px solid var(--line2); border-radius: 0 8px 8px 8px;
  padding: 5px; box-shadow: 0 10px 26px rgba(16,24,40,.16); white-space: nowrap;
}
.qbtn {
  border: 1px solid var(--line2); background: var(--panel); color: var(--ink);
  border-radius: 7px; padding: 4px 9px; font-size: 12px; font-weight: 550; cursor: pointer;
}
.qbtn:hover { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.qbtn.clear { color: var(--soft); }
.cellinput {
  width: 100%; height: 27px; border: 0; border-radius: 0; padding: 0 7px;
  font: inherit; font-size: 12.5px; background: transparent; box-shadow: none;
}
.cellinput:focus { box-shadow: none; border: 0; }
select.cellinput { padding: 0 4px; }
.grid td.saved { animation: flash .7s ease; }
@keyframes flash { from { box-shadow: inset 0 0 0 2px #15a34a; } to { box-shadow: none; } }
.grid td.failed { animation: shake .5s ease; }
@keyframes shake { 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }

/* ── Сводка ─────────────────────────────────────────────── */
.summarybox {
  margin-top: 16px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.summarybox > summary {
  cursor: pointer; padding: 12px 16px; font-weight: 620; list-style: none;
  display: flex; align-items: center; gap: 9px; color: var(--ink);
}
.summarybox > summary::-webkit-details-marker { display: none; }
.summarybox > summary .chev { margin-left: auto; color: var(--soft); transition: transform .15s; }
.summarybox[open] > summary { border-bottom: 1px solid var(--line); }
.summarybox[open] > summary .chev { transform: rotate(180deg); }
.summarybox .cards { padding: 15px 16px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 16px; box-shadow: var(--shadow); }
.summarybox .card { box-shadow: none; }
.card h3 { font-size: 13.5px; margin-bottom: 12px; }
.bars { display: flex; flex-direction: column; gap: 8px; }
.barrow { display: grid; grid-template-columns: minmax(90px, 160px) 1fr 48px; align-items: center; gap: 10px; }
.barrow .name { font-size: 12.5px; font-weight: 600; padding: 2px 8px; border-radius: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barrow .track { height: 9px; background: #eef1f6; border-radius: 5px; overflow: hidden; }
.barrow .track > i { display: block; height: 100%; border-radius: 5px; transition: width .3s; }
.barrow .val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 680; font-size: 14px; }
.barrow .val small { color: var(--soft); font-weight: 500; margin-left: 3px; }

/* ── Пользователи ───────────────────────────────────────── */
.flowgrid { display: flex; flex-direction: column; gap: 6px; }
.flowpick {
  border: 1px solid var(--line2); border-radius: 10px; padding: 7px 10px;
  display: flex; align-items: center; gap: 10px; background: #fbfcfe;
}
.flowpick.on { border-color: var(--accent); background: var(--accent-bg); }
.flowpick .t { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; flex: 1; min-width: 0; }
.flowpick .t span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flowpick .t svg.i { width: 16px; height: 16px; color: var(--soft); flex: none; }
.flowpick.on .t svg.i { color: var(--accent); }
.seg { display: flex; border: 1px solid var(--line2); border-radius: 8px; overflow: hidden; flex: none; background: var(--panel); }
.seg label { padding: 4px 9px; font-size: 12px; cursor: pointer; color: var(--soft); border-left: 1px solid var(--line2); user-select: none; }
.seg label:first-child { border-left: 0; }
.seg label:hover { background: #f2f5fa; }
.seg label.on { background: var(--accent); color: #fff; }
.seg.rolesеg label { padding: 6px 12px; font-size: 12.5px; }
.grid td b { font-variant-numeric: tabular-nums; }
.seg input { display: none; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 650; margin: 1px 0; }
.badge.admin { background: #fff2e0; color: #a35b00; }
.badge.edit { background: #e6f6ec; color: #14713a; }
.badge.view { background: #eef1f6; color: #52607a; }
.badge.off { background: #fdeceb; color: #b42318; }
.badge.act { background: #ede9fe; color: #5b21b6; }
/* Строка пользователя: логин и пароль с кнопками показать/копировать */
.grid td.cred { white-space: nowrap; }
.grid td.cred .val {
  font-family: var(--mono); display: inline-block; min-width: 96px;
  vertical-align: middle; letter-spacing: .02em;
}
.grid td.cred .val.soft { color: var(--soft); font-family: inherit; }
.grid td.cred .rowbtn { opacity: .45; vertical-align: middle; }
.grid tbody tr:hover td.cred .rowbtn { opacity: 1; }
.grid td.nowrap { white-space: nowrap; }
.grid td.tags { white-space: normal; }
.grid td.tags .badge { margin: 1px 2px 1px 0; }

/* Логин и пароль, показанные после создания */
.creds { background: #f1f9f3; border: 1px solid #b7e3c4; border-radius: 11px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.creds h3 { font-size: 14px; }
.creds .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; }
.creds .row span { color: var(--soft); font-size: 12px; }
.creds .row b { font-family: var(--mono); font-size: 14.5px; word-break: break-all; text-align: right; }
.creds .warn { color: #92400e; background: #fef7e7; border: 1px solid #fcd9a0; border-radius: 8px; padding: 8px 11px; font-size: 12.5px; }
.inline { display: flex; gap: 8px; align-items: stretch; }
.inline input { flex: 1; min-width: 0; }
.dotstate { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: #17a34a; }
.dotstate.off { background: #cbd5e1; }
.checkline { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; }

/* ── Разделы статистики ─────────────────────────────────── */
.statsection { margin-bottom: 22px; }
.sectionhead { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.sectionhead h2 { font-size: 15px; }
.sectionhead span { color: var(--soft); font-size: 12.5px; }
.statsection .cards { margin-top: 14px; }
.card h3 .cnt {
  float: right; font-weight: 700; color: var(--soft);
  font-variant-numeric: tabular-nums; font-size: 13px;
}
.barrow .val { min-width: 44px; }

/* ── Отчёты ─────────────────────────────────────────────── */
.reportbox { display: flex; flex-direction: column; gap: 14px; }
.reportrow { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.reportrow .field { flex: 0 0 165px; }
.flowchecks { display: flex; flex-wrap: wrap; gap: 7px; }
.flowchk {
  display: flex; align-items: center; gap: 7px; padding: 6px 11px; cursor: pointer;
  border: 1px solid var(--line2); border-radius: 9px; font-size: 13px; font-weight: 550;
  background: #fbfcfe; user-select: none;
}
.flowchk.on { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); }
.flowchk svg.i { width: 16px; height: 16px; }

/* ── Занятое устройство: полоса и подсветка строки ──────── */
.fixbar {
  display: flex; align-items: center; gap: 12px; flex: none; flex-wrap: wrap;
  background: var(--accent-bg); border-bottom: 1px solid #c7d8ff; padding: 10px 16px;
}
.fixbar .fb-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 220px; }
.fixbar .fb-text b { font-size: 13.5px; color: #1e40af; display: flex; align-items: center; gap: 6px; }
.fixbar .fb-text b svg.i { width: 15px; height: 15px; }
.fixbar .fb-text span { font-size: 12.5px; color: #3355a8; }
.fixbar .btn { border-color: #b9cbff; background: #fbfcff; }
.fixbar .btn:hover { background: #eef3ff; }

.grid tbody tr.attention td { background: #e8f0ff !important; }
.grid tbody tr.attention td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

/* ── Что стоит в устройстве ─────────────────────────────── */
.devnotice {
  position: fixed; right: 20px; bottom: 20px; z-index: 55; width: min(430px, 92vw);
  background: var(--panel); border: 1px solid var(--line2); border-radius: 12px;
  box-shadow: 0 16px 44px rgba(16,24,40,.24); padding: 14px 16px;
  animation: slide .18s ease;
}
.devnotice .dn-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; padding-right: 24px; }
.devnotice .dn-head b { font-size: 14px; }
.devnotice .dn-head span { font-size: 12.5px; color: var(--soft); }
.dn-list { display: flex; flex-direction: column; gap: 5px; }
.dn-row {
  display: grid; grid-template-columns: minmax(60px, 1fr) auto auto auto;
  gap: 8px; align-items: center; font-size: 12.5px;
  padding: 5px 7px; border-radius: 7px; background: #f8fafc;
}
.dn-row .badge { white-space: nowrap; }
.dn-info {
  margin-top: 10px; font-size: 12.5px; color: #1e40af; line-height: 1.45;
  background: #eef4ff; border: 1px solid #c7d8ff; border-radius: 8px; padding: 8px 10px;
}
.dn-close {
  position: absolute; top: 10px; right: 10px; border: 0; background: none;
  color: var(--soft); cursor: pointer; padding: 4px; border-radius: 6px;
  display: grid; place-items: center;
}
.dn-close:hover { background: #f2f4f8; color: var(--ink); }

/* ── Форма сбоку ────────────────────────────────────────── */
.overlay { position: fixed; inset: 0; background: rgba(16,24,40,.42); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 96vw); background: var(--panel);
  z-index: 41; display: flex; flex-direction: column; box-shadow: -12px 0 40px rgba(16,24,40,.18);
  animation: slide .18s ease;
}
@keyframes slide { from { transform: translateX(28px); opacity: .4; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 16px; }
.drawer-body { padding: 18px 20px; overflow: auto; display: flex; flex-direction: column; gap: 13px; flex: 1; }
.drawer-foot { display: flex; gap: 9px; padding: 14px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: #17202e; color: #fff; padding: 10px 18px; border-radius: 10px;
  font-weight: 550; z-index: 60; box-shadow: 0 8px 28px rgba(16,24,40,.28); max-width: 80vw;
}
.toast.err { background: var(--danger); }
.hint { color: var(--soft); margin: 0 0 14px; max-width: 760px; }
.emptybox {
  max-width: 520px; margin: 60px auto; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 26px 28px; box-shadow: var(--shadow); text-align: center;
}
.emptybox h2 { font-size: 17px; margin-bottom: 10px; }
.emptybox p { margin: 0 0 8px; }
.emptybox p.soft { color: var(--soft); font-size: 13px; }

@media (max-width: 980px) {
  .sidebar { position: static; width: auto; height: auto; }
  .content { margin-left: 0; }
  .nav { flex-direction: row; overflow-x: auto; padding-bottom: 10px; }
  .nav a { white-space: nowrap; }
  .navlabel { display: none; }
  .tablewrap { max-height: none; }
  .searchbox { flex: 1 1 100%; }
}
