:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1b1f24;
  --muted: #687280;
  --line: #e3e6ea;
  --soft: #f0f2f5;
  --accent: #2f6fed;
  --accent-soft: #e8efff;
  --ok: #1f8a4c;
  --ok-soft: #e4f5ea;
  --warn: #b26a00;
  --warn-soft: #fff3dc;
  --bad: #c62f3a;
  --bad-soft: #fde8ea;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111418; --card: #1a1e24; --text: #e7eaee; --muted: #9aa3ad; --line: #2b3139; --soft: #232831;
    --accent: #6c9bff; --accent-soft: #1f2a44; --ok: #4cc283; --ok-soft: #173126; --warn: #f0b04a;
    --warn-soft: #3a2c12; --bad: #ff6b74; --bad-soft: #3d1c20; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111418; --card: #1a1e24; --text: #e7eaee; --muted: #9aa3ad; --line: #2b3139; --soft: #232831;
  --accent: #6c9bff; --accent-soft: #1f2a44; --ok: #4cc283; --ok-soft: #173126; --warn: #f0b04a;
  --warn-soft: #3a2c12; --bad: #ff6b74; --bad-soft: #3d1c20; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mono { font-family: ui-monospace, Consolas, monospace; }

/* --- шапка */
.top {
  position: sticky; top: 0; z-index: 20; background: var(--card); border-bottom: 1px solid var(--line);
}
.top-in { display: flex; align-items: center; gap: 14px; padding: 0 16px; height: 56px; }
.logo { font-weight: 700; font-size: 16px; color: var(--text); white-space: nowrap; }
.logo:hover { text-decoration: none; }
.logo-mark {
  display: inline-block; background: var(--accent); color: #fff; border-radius: 7px; padding: 1px 6px;
  font-size: .85em; font-weight: 800; letter-spacing: .5px; vertical-align: 1px;
}
.badge {
  display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; font-size: 11px;
  line-height: 18px; text-align: center; background: var(--bad); color: #fff; font-weight: 600;
}
.top-search { margin-left: auto; }
.top-search input { width: 220px; }
.top-user { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.icon-btn { background: none; border: 1px solid var(--line); color: var(--text); border-radius: 8px; height: 32px; min-width: 32px; cursor: pointer; }

.wrap { max-width: 1280px; margin: 0 auto; padding: 20px 16px 60px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* --- карточки, сетки */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card + .card { margin-top: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > h2 { padding: 14px 16px 0; }
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.side { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 22px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 12px; }
a.stat { color: inherit; }
a.stat:hover { text-decoration: none; border-color: var(--accent); }

/* --- таблицы */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--soft); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--soft); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-link { color: var(--text); font-weight: 600; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }

/* --- статусы */
.chip { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--soft); color: var(--muted); }
.page-head .chip, .access-head .chip { white-space: normal; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.info { background: var(--accent-soft); color: var(--accent); }

/* --- формы */
input, select, textarea {
  font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 10px; width: 100%; min-height: 36px;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[type=checkbox] { width: auto; min-height: 0; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; font-weight: 500; }
.field { margin-bottom: 12px; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 12px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); margin: 4px 0 12px; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline > * { width: auto; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters select, .filters input { width: auto; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 12px 12px 0; margin: 0 0 14px; }
legend { font-weight: 600; padding: 0 6px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center; font: inherit; font-weight: 600;
  padding: 7px 14px; min-height: 36px; border-radius: 8px; border: 1px solid var(--line); background: var(--card);
  color: var(--text); cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--soft); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--bad); }
.btn.small { padding: 3px 9px; min-height: 28px; font-size: 12px; }
.btn.link { border: 0; background: none; color: var(--accent); padding: 0; min-height: 0; font-weight: 500; }
form.inline-form { display: inline; }

/* --- сообщения */
.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; border: 1px solid transparent; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.error { background: var(--bad-soft); color: var(--bad); }
.flash.warn, .hint-warn { background: var(--warn-soft); color: var(--warn); }
.hint-warn { padding: 8px 12px; border-radius: 8px; margin: 10px 0 0; }
.hint-warn[hidden] { display: none; }

/* --- доступы в карточке клиента */
.access-card { border-left: 4px solid var(--accent); }
.access-card.is-left { border-left-color: var(--line); }
.access-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.access-actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.sub-block { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.sub-block table { margin-top: 8px; }
dialog.wide { width: min(780px, calc(100vw - 32px)); }

/* --- разделы */
.section-bar { border-top: 1px solid var(--line); background: var(--soft); }
.section-in { padding: 6px 16px 6px 232px; display: flex; flex-wrap: wrap; gap: 6px; }
.section-in::-webkit-scrollbar { display: none; }
.section-in a {
  padding: 4px 12px; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: 13px; white-space: nowrap;
  border: 1px solid transparent;
}
.section-in a:hover { color: var(--text); text-decoration: none; border-color: var(--line); background: var(--card); }
.section-in a.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.section-in .sep { width: 1px; background: var(--line); margin: 4px 4px; flex: none; }
.section-in a.all.on { background: var(--text); border-color: var(--text); color: var(--card); }
.sec-chip { display: inline-block; font-size: 11px; font-weight: 600; padding: 0 7px; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent); white-space: nowrap; vertical-align: 1px; }
.section-choice { display: flex; flex-direction: column; gap: 8px; }
.section-choice .btn { justify-content: flex-start; }
tr.total-row td { font-weight: 700; background: var(--soft); }

/* --- права сотрудников */
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px 16px; }
.check.perm { align-items: flex-start; margin: 4px 0; }
.check.perm input { margin-top: 3px; }
tr.is-off td { opacity: .55; }

/* --- перетаскивание строк */
th.drag-col, td.drag-col { width: 28px; padding-left: 8px; padding-right: 0; }
.drag-handle {
  cursor: grab; color: var(--muted); user-select: none; touch-action: none; display: inline-block;
  padding: 4px 6px; border-radius: 6px; letter-spacing: -3px; font-weight: 800; font-size: 17px; line-height: 1;
}
.drag-handle:hover { background: var(--soft); color: var(--text); }
tr.dragging td { background: var(--accent-soft) !important; }
tr.dragging .drag-handle { cursor: grabbing; }
tr.saving td { opacity: .6; }
tr.saved td { background: var(--ok-soft) !important; transition: background .3s; }

/* --- задачи */
.task { display: flex; gap: 12px; align-items: center; padding: 11px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.task:first-of-type { border-top: 0; }
.task .what { flex: 1 1 280px; min-width: 0; }
.task .what b { display: block; }
.task .btns { display: flex; gap: 6px; flex-wrap: wrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--muted); }
.dot.bad { background: var(--bad); }
.dot.warn { background: var(--warn); }
.dot.info { background: var(--accent); }
.section-title { display: flex; align-items: center; gap: 8px; padding: 14px 16px 10px; font-weight: 700; }
.section-title .chip { margin-left: auto; }

/* --- карточка клиента */
.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 6px 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.secret { display: inline-flex; gap: 6px; align-items: center; }
.secret .val { font-family: ui-monospace, Consolas, monospace; }
.copy { cursor: pointer; border: 0; background: none; color: var(--muted); padding: 0 2px; font-size: 13px; }
.copy:hover { color: var(--accent); }
.big-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.msg-box { white-space: pre-wrap; background: var(--soft); border-radius: 10px; padding: 12px; margin: 8px 0; min-height: 60px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0; border-top: 1px solid var(--line); }
.timeline li:first-child { border-top: 0; }
details > summary { cursor: pointer; font-weight: 600; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸ "; color: var(--muted); }
details[open] > summary::before { content: "▾ "; }

/* --- окна */
dialog {
  border: 1px solid var(--line); border-radius: 14px; padding: 0; width: min(520px, calc(100vw - 32px));
  background: var(--card); color: var(--text); box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
}
dialog::backdrop { background: rgba(15, 20, 30, .45); }
dialog .dlg-head { padding: 14px 18px; border-bottom: 1px solid var(--line); font-weight: 700; display: flex; align-items: center; }
dialog .dlg-head button { margin-left: auto; }
dialog .dlg-body { padding: 16px 18px 4px; max-height: 70vh; overflow-y: auto; }
dialog .dlg-foot { padding: 12px 18px 16px; display: flex; gap: 8px; justify-content: flex-end; }

/* --- график */
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 11px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* --- вход */
.auth { max-width: 380px; margin: 10vh auto; padding: 0 16px; }
.auth .card { padding: 24px; }
.auth h1 { margin-bottom: 4px; }

@media (max-width: 1000px) {
  .side { grid-template-columns: minmax(0, 1fr); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .top-search input { width: 150px; }
}
@media (max-width: 720px) {
  .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .top-in { height: 52px; padding: 0 12px; gap: 8px; }
  .top-search { margin-left: auto; }
  .top-search input { width: 120px; }
  .top-user .who { display: none; }
  .kv { grid-template-columns: 1fr; gap: 0 0; }
  .kv dt { margin-top: 8px; }
  .hide-sm { display: none; }
  .wrap { padding-top: 14px; }
}

/* массовые действия */
.bulk-bar { position: sticky; top: 8px; z-index: 5; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 14px; border: 1px solid var(--accent, #2f6fed); }
.bulk-bar[hidden] { display: none; }
.bulk-bar .inline { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.bulk-bar .inline[hidden] { display: none; }
.check-col { width: 28px; text-align: center; }
.msg-list .msg-box { white-space: pre-wrap; }
.bulk-preview td { font-size: 13px; }
.bulk-preview tr.skip td { opacity: .55; }
.issue-box { white-space: pre-wrap; }

.dupe-hint { margin: 10px 0; padding: 10px 12px; border-radius: 10px; background: var(--warn-soft, #fff5e0); border: 1px solid var(--warn, #f0b04a); }
.dupe-hint[hidden] { display: none; }
.dupe-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; padding: 6px 0; border-top: 1px solid rgba(0,0,0,.06); }


/* цели месяца */
.goals { display: grid; gap: 12px; }
.goal .bar { position: relative; height: 10px; border-radius: 6px; background: var(--line, #e7e9ef); margin-top: 6px; overflow: visible; }
.goal .bar span { display: block; height: 100%; border-radius: 6px; background: var(--ok, #2fa36b); }
.goal .bar span.warn { background: var(--warn, #f0b04a); }
.goal .bar i { position: absolute; top: -3px; width: 2px; height: 16px; background: var(--text, #222); opacity: .5; }
/* метки */
.tag-chip { display: inline-block; font-size: 11px; padding: 1px 7px; margin: 2px 4px 0 0; border-radius: 10px; background: var(--accent-soft, #e8efff); color: var(--accent, #2f6fed); }
.tag-pick { display: flex; flex-wrap: wrap; gap: 4px 14px; }
/* сегменты */
.seg-menu { position: relative; }
.seg-menu summary { list-style: none; cursor: pointer; }
.seg-menu summary::-webkit-details-marker { display: none; }
.seg-list { position: absolute; z-index: 20; right: 0; top: 110%; background: var(--card, #fff); border: 1px solid var(--line, #e5e7eb); border-radius: 12px; padding: 6px; min-width: 280px; box-shadow: 0 10px 30px rgba(0,0,0,.15); }
.seg-list a { display: block; padding: 7px 10px; border-radius: 8px; color: inherit; text-decoration: none; }
.seg-list a:hover { background: var(--accent-soft, #e8efff); }
/* календарь */
.cal { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cal th { font-size: 12px; color: var(--muted, #888); padding: 6px; text-align: left; }
.cal td { vertical-align: top; border: 1px solid var(--line, #e5e7eb); height: 92px; padding: 4px 6px; font-size: 12px; }
.cal td.out { opacity: .35; }
.cal td.today { outline: 2px solid var(--accent, #2f6fed); outline-offset: -2px; }
.cal .day { font-weight: 700; font-size: 13px; }
.cal .ev { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: inherit; text-decoration: none; border-radius: 6px; padding: 1px 4px; margin-top: 2px; background: var(--accent-soft, #e8efff); }
.cal .ev.acc { background: var(--warn-soft, #fff3dc); }
.cal .ev.debt { background: var(--bad-soft, #fde8e8); }
/* переписка */
.chat { display: flex; flex-direction: column; gap: 6px; max-height: 340px; overflow-y: auto; margin-bottom: 10px; }
.chat .msg { max-width: 85%; padding: 6px 10px; border-radius: 12px; white-space: pre-wrap; font-size: 13px; }
.chat .msg.in { align-self: flex-start; background: var(--line, #eef0f4); }
.chat .msg.out { align-self: flex-end; background: var(--accent-soft, #e8efff); }
.chat .msg small { display: block; opacity: .6; font-size: 11px; margin-top: 2px; }
/* быстрый поиск */
.qs-back { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 100; display: flex; justify-content: center; align-items: flex-start; padding: 10vh 16px 0; }
.qs-box { width: 100%; max-width: 620px; background: var(--card, #fff); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.3); overflow: hidden; }
.qs-box input { width: 100%; border: 0; border-bottom: 1px solid var(--line, #e5e7eb); padding: 16px 18px; font-size: 17px; outline: none; border-radius: 0; }
.qs-list { max-height: 60vh; overflow-y: auto; }
.qs-item { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 10px 18px; cursor: pointer; }
.qs-item.on, .qs-item:hover { background: var(--accent-soft, #e8efff); }
.qs-item .sub { font-size: 12px; opacity: .65; }
.qs-hint { padding: 8px 18px; font-size: 12px; opacity: .6; }
/* мобильная нижняя панель */
.mob-nav { display: none; }
@media (max-width: 700px) {
  .mob-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--card, #fff); border-top: 1px solid var(--line, #e5e7eb); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .mob-nav a, .mob-nav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 11px; color: inherit; text-decoration: none; background: none; border: 0; padding: 6px 0; position: relative; }
  .mob-nav b { font-size: 20px; line-height: 1.1; }
  .mob-nav .on { color: var(--accent, #2f6fed); }
  .mob-nav .badge { position: absolute; top: 2px; right: 22%; }
  body { padding-bottom: 70px; }
  .task { flex-wrap: wrap; }
  .task .btns, .task > form { width: 100%; display: flex; flex-wrap: wrap; gap: 6px; }
  .task .btns .btn, .task .btns form, .task .btns .btn.small { flex: 1 1 auto; }
  .task .btn.small { padding: 10px 12px; font-size: 14px; }
  .seg-list { right: auto; left: 0; }
}
@media print {
  .top, .mob-nav, .no-print { display: none !important; }
  body { background: #fff; padding: 0; }
}

/* «что делаем?» у закончившейся подписки */
.decide { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft, #e8efff); }
.decide-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
@media (max-width: 700px) { .decide-btns > * , .decide-btns .btn { flex: 1 1 100%; } .decide-btns form .btn { width: 100%; } }


.help ol { padding-left: 20px; line-height: 1.55; } .help li { margin-bottom: 6px; } .help ul { padding-left: 18px; margin: 4px 0; }


/* сворачиваемые блоки настроек */
.fold-head { cursor: pointer; user-select: none; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fold { border: 1px solid var(--line, #e5e7eb); background: var(--card, #fff); color: inherit; border-radius: 8px; width: 28px; height: 28px; font-size: 14px; cursor: pointer; flex: none; }
.card.collapsed > :not(h2) { display: none !important; }
.card.collapsed > h2 { margin-bottom: 0; }


/* база знаний */
.kb { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }
.kb-toc { position: sticky; top: 12px; padding: 12px; max-height: calc(100vh - 24px); overflow-y: auto; }
.kb-toc input { width: 100%; margin-bottom: 8px; }
.kb-toc nav a { display: block; padding: 6px 8px; border-radius: 8px; color: inherit; text-decoration: none; font-size: 14px; }
.kb-toc nav a:hover { background: var(--accent-soft, #e8efff); }
.kb-toc nav a[hidden] { display: none; }
.kb-body section { scroll-margin-top: 12px; line-height: 1.6; }
.kb-body section[hidden] { display: none; }
.kb-body section h2 { margin-top: 0; }
.kb-body li { margin-bottom: 4px; }
.kb-tip { background: var(--accent-soft, #e8efff); border-radius: 10px; padding: 10px 12px; }
.kb-table { width: 100%; border-collapse: collapse; }
.kb-table td, .kb-table th { padding: 8px 10px; border-bottom: 1px solid var(--line, #e5e7eb); text-align: left; vertical-align: top; }
.kb-table th { font-size: 13px; color: var(--muted, #777); }
.kb-body details { padding: 8px 0; border-bottom: 1px solid var(--line, #e5e7eb); }
.kb-body details summary { cursor: pointer; font-weight: 600; }
a.icon-btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
@media (max-width: 860px) { .kb { grid-template-columns: minmax(0, 1fr); } .kb-toc { position: static; max-height: none; } }

/* скрытые блоки (атрибут hidden) не показывать, даже если у блока свой display */
[hidden] { display: none !important; }
/* порядок колонок в загрузке списком */
.col-order .col-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 10px; }

/* --- боковое меню */
.shell { display: flex; align-items: flex-start; }
.shell > main.wrap { flex: 1; min-width: 0; }
.sidenav {
  position: sticky; top: var(--head-h, 98px); height: calc(100vh - var(--head-h, 98px)); overflow-y: auto;
  width: 216px; flex: none; background: var(--card); border-right: 1px solid var(--line); padding: 6px 8px 24px;
}
.sidenav .grp { font-size: 11px; color: var(--muted); padding: 12px 10px 4px; letter-spacing: .3px; }
.sidenav a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; color: var(--text);
  font-weight: 500; white-space: nowrap; position: relative;
}
.sidenav a:hover { background: var(--soft); text-decoration: none; }
.sidenav a.on { background: var(--accent-soft); color: var(--accent); }
.sidenav .ic { width: 20px; text-align: center; flex: none; }
.sidenav .badge { margin-left: auto; }
.side-toggle { flex: none; }
.side-back { display: none; }
html.side-mini .sidenav { width: 60px; padding: 6px 6px 24px; }
html.side-mini .sidenav .lb, html.side-mini .sidenav .grp { display: none; }
html.side-mini .sidenav a { justify-content: center; padding: 9px 0; }
html.side-mini .sidenav .badge { position: absolute; top: 1px; right: 2px; margin: 0; min-width: 16px; line-height: 16px; font-size: 10px; }
html.side-mini .section-in { padding-left: 76px; }
@media (max-width: 720px) {
  .section-in, html.side-mini .section-in { padding-left: 12px; }
  .sidenav, html.side-mini .sidenav {
    position: fixed; top: 0; left: 0; bottom: 0; height: 100vh; z-index: 70; width: 270px; padding: 12px 10px 90px;
    transform: translateX(-102%); transition: transform .18s ease; box-shadow: 0 0 40px rgba(0,0,0,.25);
  }
  html.side-mini .sidenav .lb, html.side-mini .sidenav .grp { display: block; }
  html.side-mini .sidenav a { justify-content: flex-start; padding: 7px 10px; }
  html.side-mini .sidenav .badge { position: static; margin-left: auto; }
  html.side-open .sidenav { transform: none; }
  html.side-open .side-back { display: block; position: fixed; inset: 0; z-index: 65; background: rgba(0,0,0,.35); }
  .sidenav a { padding: 11px 10px; font-size: 15px; }
  .side-toggle { display: none; }
}

/* --- настройки: меню разделов слева */
.set-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 16px; align-items: start; }
.set-nav { position: sticky; top: calc(var(--head-h, 98px) + 12px); padding: 8px; }
.set-nav .grp { font-size: 11px; color: var(--muted); padding: 10px 10px 4px; }
.set-nav a { display: block; padding: 7px 10px; border-radius: 8px; color: var(--text); font-weight: 500; }
.set-nav a:hover { background: var(--soft); text-decoration: none; }
.set-nav a.on { background: var(--accent-soft); color: var(--accent); }
.set-body > .card { margin: 0 0 16px !important; max-width: none !important; }
.set-body > .card[data-set-hidden] { display: none; }
@media (max-width: 900px) {
  .set-layout { grid-template-columns: minmax(0, 1fr); }
  .set-nav { position: static; display: flex; flex-wrap: wrap; gap: 4px; }
  .set-nav .grp { width: 100%; padding: 6px 4px 0; }
  .set-nav a { padding: 6px 10px; background: var(--soft); }
}

/* вход: глазок у пароля, цифры с картинки, скрытая ловушка для ботов */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { width: 100%; padding-right: 42px; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: none; cursor: pointer; font-size: 16px; padding: 4px 8px; line-height: 1; }
.captcha-row { display: flex; align-items: center; gap: 8px; }
.captcha-row img { border: 1px solid var(--line); border-radius: 8px; flex: none; }
.captcha-row input { flex: 1; min-width: 0; font-size: 18px; letter-spacing: 3px; }
.hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

