/* Матовая тёмная тема: чёрный и графит, бирюзовый акцент. Без градиентов и стекла. */
:root {
  color-scheme: dark;
  --bg: #0e0f11;
  --surface: #16181b;
  --surface-2: #1d2024;
  --border: #2b2f35;
  --text: #e6e8eb;
  --muted: #a0a7b0;
  --accent: #3bb3a6;
  --accent-hover: #4cc4b7;
  --accent-soft: #3bb3a61f;
  --pending: #e2a23b;
  --pending-soft: #e2a23b1f;
  --declined: #ec6a5e;
  --declined-soft: #ec6a5e1f;
  --expired: #8b929b;
  --info: #6aa8ff;
  --info-soft: #6aa8ff1f;
  --ink-on-color: #0e0f11;
  --radius: 8px;
  --tap: 44px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

h1 { font-size: 24px; line-height: 1.25; margin: 0 0 16px; font-weight: 600; }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 600; }
code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; overflow-wrap: anywhere; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 600; }
.num { font-variant-numeric: tabular-nums; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* --- Каркас: меню слева, контент справа --- */
.shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}
.brand { display: flex; flex-direction: column; color: var(--text); }
.brand:hover { color: var(--text); text-decoration: none; }
.brand__name { font-weight: 700; letter-spacing: .02em; }
.brand__sub { font-size: 12px; color: var(--muted); }

.mobilebar { display: none; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px 14px;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.sidebar__brand { padding: 0 8px; }
.sidenav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
/* Категория-шторка: заголовок раскрывает список разделов. */
.sidenav__group { margin-top: 6px; }
.sidenav__toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 10px;
  border-radius: var(--radius);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.sidenav__toggle::-webkit-details-marker { display: none; }
.sidenav__toggle:hover { background: var(--surface-2); }
.sidenav__toggle > span:first-child { flex: 1; }
/* Число заявок на шторке видно, только пока она закрыта: внутри оно есть у «Все заявки». */
.sidenav__group[open] > .sidenav__toggle .sidenav__count { display: none; }
.sidenav__chevron {
  width: 8px;
  height: 8px;
  margin-right: 4px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform .2s ease;
}
.sidenav__group[open] .sidenav__chevron { transform: rotate(45deg); }
.sidenav__items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 2px 0 6px 14px;
  padding-left: 8px;
  border-left: 1px solid var(--border);
}
/* Плавное выезжание шторки там, где браузер это умеет; в остальных — просто раскрывается. */
:root { interpolate-size: allow-keywords; }
.sidenav__group::details-content {
  block-size: 0;
  overflow: hidden;
  transition: block-size .2s ease, content-visibility .2s allow-discrete;
}
.sidenav__group[open]::details-content { block-size: auto; }
@media (prefers-reduced-motion: reduce) {
  .sidenav__group::details-content, .sidenav__chevron { transition: none; }
}
.sidenav__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 40px;
  padding: 0 10px;
  border-radius: var(--radius);
  color: var(--muted);
}
.sidenav__link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.sidenav__link.is-active {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: inset 3px 0 0 var(--accent);
}
.sidenav__count {
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 11px;
  background: var(--pending); color: var(--ink-on-color);
  font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.sidenav__count[hidden] { display: none; }
.sidebar__logout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  padding: 12px 10px 0;
  border-top: 1px solid var(--border);
}
.linkbtn {
  min-height: 40px;
  padding: 0 10px;
  border-radius: var(--radius);
  background: none;
  border: 0;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}
.linkbtn:hover { background: var(--surface-2); color: var(--text); }

/* --- Страница --- */
.page {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 24px 48px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.panel__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.empty { text-align: center; padding: 24px 16px; }

.flash, .alert {
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 16px;
  background: var(--surface);
}
.flash--ok { border-left-color: var(--accent); }
.flash--warn, .alert--warn { border-left-color: var(--pending); background: var(--pending-soft); }
.flash--error, .alert--error { border-left-color: var(--declined); background: var(--declined-soft); }
.alert--muted { border-left-color: var(--expired); }

/* --- Статусы --- */
.dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  background: var(--expired);
  flex: none;
}
.dot--pending, .badge--pending .dot { background: var(--pending); }
.dot--approved, .badge--approved .dot { background: var(--accent); }
.dot--declined, .badge--declined .dot { background: var(--declined); }
.dot--expired, .badge--expired .dot { background: var(--expired); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 13px;
  white-space: nowrap;
}
.badge--pending { border-color: var(--pending); background: var(--pending-soft); }
.badge--approved { border-color: var(--accent); background: var(--accent-soft); }
.badge--declined { border-color: var(--declined); background: var(--declined-soft); }
.badge--expired { border-color: var(--expired); }

.tag {
  display: inline-block;
  font-size: 12px;
  padding: 1px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}
.tag--ok { color: var(--accent); border-color: var(--accent-soft); }
.tag--warn { color: var(--pending); border-color: var(--pending-soft); }
.tag--bad { color: var(--declined); border-color: var(--declined-soft); }

.new {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-on-color);
  background: var(--accent);
  border-radius: 4px;
  padding: 0 6px;
  vertical-align: middle;
}

/* --- Плитки --- */
.tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  color: var(--text);
}
a.tile:hover { border-color: var(--accent); text-decoration: none; color: var(--text); }
.tile__label { color: var(--muted); font-size: 13px; display: flex; align-items: center; }
.tile__value { font-size: 32px; font-weight: 600; line-height: 1.1; }
.tile__value--text { font-size: 22px; }
.tile__hint { color: var(--muted); font-size: 12px; }
.today { margin: 0 0 16px; }
.today b { color: var(--text); font-weight: 600; }

/* --- Список ожидающих на обзоре --- */
.waitlist { list-style: none; margin: 0; padding: 0; }
.waitlist__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--border);
}
.waitlist__item:first-child { border-top: 0; }
.waitlist__main { display: flex; flex-direction: column; padding: 10px 0; color: var(--text); min-width: 0; }
.waitlist__main:hover { text-decoration: none; color: var(--text); }
.waitlist__main:hover .waitlist__name { color: var(--accent); }
.waitlist__name { font-weight: 600; }

/* --- Фильтры --- */
.filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
}
.chip:hover { color: var(--text); text-decoration: none; border-color: var(--muted); }
.chip.is-active { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }
.search { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-field { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }

input[type=text], input[type=password], input[type=search], input[type=date] {
  min-height: var(--tap);
  padding: 0 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
input[type=search] { width: 280px; max-width: 100%; }
input:focus { border-color: var(--accent); outline: none; }

/* --- Кнопки --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 0 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .55; cursor: progress; }
.btn--primary, .btn--approve { background: var(--accent); color: var(--ink-on-color); }
.btn--primary:hover, .btn--approve:hover { background: var(--accent-hover); color: var(--ink-on-color); }
.btn--decline { background: transparent; color: var(--declined); border-color: var(--declined); }
.btn--decline:hover { background: var(--declined); color: var(--ink-on-color); }
.btn--ghost { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn--ghost:hover { border-color: var(--muted); color: var(--text); }
.btn--wide { width: 100%; }

.decide { display: flex; gap: 8px; }
.decide form { margin: 0; }
.decide--compact .btn { min-height: 38px; padding: 0 12px; }

/* --- Таблица → карточки на телефоне --- */
.rtable {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.rtable th, .rtable td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.rtable th { color: var(--muted); font-weight: 500; font-size: 13px; background: var(--surface-2); }
.rtable th.num, .rtable td.num { white-space: nowrap; }
.rtable tbody tr:last-child td { border-bottom: 0; }
.rtable tbody tr:hover { background: var(--surface-2); }
.rtable__actions { text-align: right; }
.rtable__actions .decide { justify-content: flex-end; }
.rtable--plain { border: 0; }
.rtable--plain th:not(:first-child), .rtable--plain td:not(:first-child) { text-align: right; }
.rtable tr.is-empty td { color: var(--muted); }

.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; }

/* --- Карточка заявки --- */
.back { display: inline-flex; align-items: center; min-height: var(--tap); margin-bottom: 4px; }
.detail-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.detail-head h1 { margin: 0; overflow-wrap: anywhere; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid2 > .panel { margin-bottom: 0; }
.grid2 + .panel { margin-top: 16px; }

.fields {
  display: grid;
  grid-template-columns: minmax(120px, 190px) 1fr;
  gap: 8px 16px;
  margin: 0;
}
.fields dt { color: var(--muted); }
.fields dd { margin: 0; overflow-wrap: anywhere; }
.bio { white-space: pre-wrap; }

.events { list-style: none; margin: 12px 0 0; padding: 0; }
.events li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}
.events li:first-child { border-top: 0; }
.events li > .small { flex-basis: 100%; }

.decision-bar {
  position: sticky;
  bottom: 0;
  margin: 16px -24px -48px;
  padding: 12px 24px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.decision-bar .decide .btn { min-height: 48px; min-width: 160px; }

/* --- Модерация --- */
.kbadge {
  display: inline-flex;
  align-items: center;
  padding: 1px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 13px;
  white-space: nowrap;
}
.kbadge--warn { border-color: var(--pending); background: var(--pending-soft); }
.kbadge--mute, .kbadge--restrict { border-color: var(--info); background: var(--info-soft); }
.kbadge--kick { border-color: var(--expired); }
.kbadge--ban { border-color: var(--declined); background: var(--declined-soft); }

select {
  min-height: var(--tap);
  padding: 0 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  max-width: 100%;
}
select:focus { border-color: var(--accent); outline: none; }
input[type=number] {
  width: 80px;
  min-height: var(--tap);
  padding: 0 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.field select, .field textarea { width: 100%; }

/* Выбор наказания плитками и срока кнопками (это радиокнопки, просто красиво оформленные). */
.sanction-form { max-width: 760px; }
.picker { border: 0; margin: 0; padding: 0; min-width: 0; }
.picker[hidden] { display: none; }
.picker legend { padding: 0 0 6px; color: var(--muted); font-size: 14px; }
.kind-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.kind-tile, .dchip { position: relative; cursor: pointer; }
.kind-tile input, .dchip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.kind-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 68px;
  padding: 8px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  text-align: center;
}
.kind-tile:hover { border-color: var(--muted); }
.kind-tile__icon { font-size: 22px; line-height: 1; }
.kind-tile__label { font-size: 12px; color: var(--muted); }
.kind-tile:has(input:checked) .kind-tile__label { color: var(--text); font-weight: 600; }
.kind-tile--warn:has(input:checked) { border-color: var(--pending); background: var(--pending-soft); }
.kind-tile--mute:has(input:checked), .kind-tile--restrict:has(input:checked) { border-color: var(--info); background: var(--info-soft); }
.kind-tile--kick:has(input:checked) { border-color: var(--muted); background: var(--surface-2); }
.kind-tile--ban:has(input:checked) { border-color: var(--declined); background: var(--declined-soft); }
.kind-tile:has(input:focus-visible), .dchip:has(input:focus-visible) span { outline: 2px solid var(--accent); outline-offset: 2px; }
.dchips { display: flex; flex-wrap: wrap; gap: 6px; }
.dchip span {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font-size: 14px;
}
.dchip:hover span { border-color: var(--muted); }
.dchip:has(input:checked) span { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sanction-form [hidden] { display: none; }
.inline-form { display: inline; margin: 0 0 0 auto; }
.term { font-size: 13px; color: var(--muted); }
.btn--small { min-height: 34px; padding: 0 12px; font-size: 14px; }

/* Ограничения */
.cat-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.cat-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 112px;
  padding: 14px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-align: center;
}
.cat-tile:hover { border-color: var(--accent); color: var(--text); text-decoration: none; }
.cat-tile__icon { font-size: 28px; line-height: 1; }
.cat-tile__label { font-weight: 600; }
.cat-tile__state { display: inline-flex; align-items: center; font-size: 12px; color: var(--muted); }
.cat-tile__state.is-on { color: var(--accent); }
.cat-tile__state.is-on .dot { background: var(--accent); }
.rule { border-left: 4px solid var(--border); }
.rule.is-on { border-left-color: var(--accent); }
.rule__form { display: flex; flex-direction: column; gap: 14px; }
.rule__head { display: flex; align-items: flex-start; gap: 12px; }
.rule__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 22px;
}
.rule.is-on .rule__icon { background: var(--accent-soft); }
.rule__title { flex: 1; min-width: 0; }
.rule__title h2 { margin-bottom: 2px; }
.rule__title p { margin: 0; }
.rule__hint { margin: 8px 0 0; }
.rule__form .check { white-space: normal; align-items: flex-start; }
.rule__form .check input { margin-top: 4px; flex: none; }
.tiles.rule__stats { margin: 16px 0 0; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.event__text { overflow-wrap: anywhere; max-width: 360px; }

.perms { margin-top: 14px; }
.perms__error { margin: 14px 0 0; }
.perm-group { margin-top: 10px; }
.perm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0 2px 28px;
  border-top: 1px solid var(--border);
  cursor: pointer;
}
.perm-row--main { padding-left: 0; font-weight: 600; }
.perm-row:hover { background: var(--surface-2); }
.switch:has(input[data-partial]) .switch__track { background: var(--accent-soft); border-color: var(--accent); }
.switch { display: inline-flex; align-items: center; gap: 10px; flex: none; min-height: var(--tap); cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__track {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: background .15s ease, border-color .15s ease;
}
.switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform .15s ease, background .15s ease;
}
.switch:has(input:checked) .switch__track { background: var(--accent); border-color: var(--accent); }
.switch:has(input:checked) .switch__track::after { transform: translateX(20px); background: var(--ink-on-color); }
.switch:has(input:focus-visible) .switch__track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch__state { font-size: 14px; color: var(--muted); min-width: 80px; }
.switch:has(input:checked) .switch__state { color: var(--accent); font-weight: 600; }
.switch:has(input:checked) .switch__state--off, .switch:not(:has(input:checked)) .switch__state--on { display: none; }
@media (prefers-reduced-motion: reduce) {
  .switch__track, .switch__track::after { transition: none; }
}

/* Сообщения участника */
.tiles--compact { margin-bottom: 10px; }
.tiles--compact .tile { padding: 10px 12px; }
.tiles--compact .tile__value { font-size: 22px; }
.tiles--compact .tile__value--text { font-size: 15px; }
.msg-types { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.msglist { list-style: none; margin: 0; padding: 0; }
.msg { padding: 10px 0; border-top: 1px solid var(--border); }
.msglist .msg:first-child { border-top: 0; }
.msg__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; color: var(--muted); font-size: 13px; }
.msg__meta a.tag:hover { color: var(--text); text-decoration: none; border-color: var(--muted); }
.msg__link { margin-left: auto; font-size: 13px; }
.msg__text { margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }

.appeal__head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.appeal__text {
  margin: 10px 0 14px;
  padding: 10px 14px;
  border-left: 3px solid var(--accent);
  background: var(--surface-2);
  border-radius: 0 var(--radius) var(--radius) 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Ізюминки */
.econ-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; align-items: end; }
.econ-fields input { width: 100%; }
.tiles.econ-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.econ-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}
.econ-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px 16px;
  border: 1px solid var(--pending);
  border-radius: var(--radius);
  background: var(--pending-soft);
  color: var(--text);
}
.econ-notice:hover { text-decoration: none; border-color: var(--text); }
.econ-notice__go { margin-left: auto; color: var(--pending); white-space: nowrap; }

/* Теги: таблица проверки */
.chip__count {
  margin-left: 6px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--pending-soft);
  color: var(--pending);
  font-size: 12px;
  line-height: 20px;
}
.bulkbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.bulkbar__count { min-width: 110px; margin-right: auto; }
.bulkbar input[name=reason] { flex: 1 1 220px; min-width: 0; }
.bulkbar .btn[disabled] { opacity: .45; cursor: not-allowed; }
/* Окно «Отклонить» выходит за строку — таблице нельзя обрезать содержимое. */
.rtable--review { overflow: visible; }
.rtable--review thead th:first-child { border-top-left-radius: var(--radius); }
.rtable--review thead th:last-child { border-top-right-radius: var(--radius); }
.rtable--review td { vertical-align: top; }
.rtable--review td.rtable__actions { vertical-align: middle; white-space: nowrap; }
/* Сотрудники */
.staff-add { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 12px; align-items: end; margin-bottom: 10px; }
.staff-add input { width: 100%; }
.staff-pass { display: flex; gap: 6px; }
.staff-pass input { width: 130px; min-width: 0; }
@media (max-width: 720px) {
  .staff-add { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 420px) {
  .staff-pass { flex: 1; min-width: 0; }
  .staff-pass input { flex: 1; width: auto; }
}
/* Широкая таблица прокручивается сама, а не вся страница. */
/* position: скрытые заголовки (sr-only) остаются внутри этого блока и не растягивают страницу. */
.rtable-scroll { position: relative; overflow-x: auto; }
.rtable__check { width: 40px; }
.rtable__check input { width: 18px; height: 18px; margin: 0; }
.rtable__decision .badge { margin-bottom: 4px; }
.rtable__decision .small:not(.muted) { overflow-wrap: anywhere; }
.reject-pop { position: relative; }
.reject-pop > summary { list-style: none; cursor: pointer; }
.reject-pop > summary::-webkit-details-marker { display: none; }
.reject-pop[open] > summary { background: var(--declined); color: var(--ink-on-color); }
.reject-pop__form {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 5;
  display: grid;
  gap: 8px;
  width: min(300px, calc(100vw - 48px));
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgb(0 0 0 / .45);
  white-space: normal;
}
.reject-pop__form input { width: 100%; }
.econ-give { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .6fr) minmax(0, 1.4fr) auto; gap: 8px; }
.econ-give input { width: 100%; min-width: 0; }
.econ-adjust { display: flex; gap: 6px; justify-content: flex-end; }
.econ-adjust--card { justify-content: flex-start; flex-wrap: wrap; }
.econ-adjust input[name=amount] { width: 96px; }
.econ-adjust input[name=note] { width: 170px; }
@media (max-width: 720px) {
  .tiles.econ-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .econ-give { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .econ-give input[name=note] { grid-column: 1 / -1; }
  .bulkbar input[name=reason] { flex-basis: 100%; }
  .bulkbar .btn { flex: 1 1 0; }
}
@media (max-width: 420px) {
  .econ-adjust { display: grid; grid-template-columns: 1fr 1fr auto; width: 100%; }
  .econ-adjust input[name=amount], .econ-adjust input[name=note] { width: 100%; }
}

/* Жалобы: сообщение нарушителя как в Telegram */
.cmp { padding: 0; overflow: hidden; }
.cmp.is-closed { opacity: .85; }
.cmp__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.cmp__msg { display: flex; align-items: flex-end; gap: 10px; padding: 16px 16px 4px; }
.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-weight: 700;
  color: var(--ink-on-color);
  background: var(--accent);
}
.avatar--1 { background: var(--info); }
.avatar--2 { background: var(--pending); }
.avatar--3 { background: var(--declined); }
.avatar--4 { background: var(--expired); }
.cmp__bubble {
  position: relative;
  min-width: 0;
  max-width: 640px;
  padding: 8px 12px 10px;
  border-radius: 14px 14px 14px 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.cmp__bubble.is-deleted .cmp__text { text-decoration: line-through; color: var(--muted); }
.cmp__author { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-size: 14px; margin-bottom: 2px; }
.cmp__open { margin-left: auto; padding-left: 12px; font-size: 13px; white-space: nowrap; }
.cmp__text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.cmp__reason { display: flex; gap: 10px; padding: 12px 16px 14px 64px; font-size: 14px; }
.cmp__flag { flex: none; }
.cmp__reason-text { margin-top: 2px; color: var(--text); font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.cmp__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.cmp__tools, .cmp__decide { display: flex; flex-wrap: wrap; gap: 8px; }
.cmp__tools form, .cmp__decide form { margin: 0; }
.cmp__done { margin: 0; }
@media (max-width: 420px) {
  .cmp__msg { padding: 14px 12px 4px; }
  .cmp__reason { padding: 10px 12px 12px; }
  .cmp__actions { padding: 12px; }
  .cmp__tools, .cmp__decide { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .cmp__tools .btn, .cmp__decide .btn { width: 100%; white-space: normal; text-align: center; line-height: 1.2; }
  .cmp__decide { order: -1; }
}

.ladder { display: flex; flex-direction: column; gap: 8px; }
.ladder__row { display: grid; grid-template-columns: 48px minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: center; }
.ladder__num { color: var(--muted); font-variant-numeric: tabular-nums; }
.reasons { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.reason-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1.3fr) auto auto;
  gap: 8px;
  align-items: center;
  margin: 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.reason-row:last-child { border-bottom: 0; }
.reason-row input[type=text] { width: 100%; }
.reason-row input[name=title] { grid-column: 1 / -1; }
.reason-row.is-off { opacity: .55; }
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); white-space: nowrap; }
h3 { font-size: 15px; margin: 8px 0 10px; }

/* --- Вход --- */
.page--login { max-width: 400px; padding-top: 12vh; }
.login {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.login__brand { display: flex; flex-direction: column; margin-bottom: 20px; }
.login h1 { font-size: 20px; }
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 14px; }

/* --- Планшет и телефон --- */
@media (max-width: 900px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid2 { grid-template-columns: 1fr; }

  /* Меню прячется под кнопку «Меню» в верхней строке. */
  /* minmax(0, …): широкое содержимое (ряд фильтров) не растягивает страницу шире экрана. */
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr; }
  .mobilebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
  }
  .menu-toggle { min-height: 40px; gap: 6px; }
  .sidebar {
    display: none;
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding: 12px 16px 16px;
  }
  .sidebar__brand { display: none; }
  .shell.nav-open .sidebar { display: flex; }
}

@media (max-width: 720px) {
  .page { padding: 16px 16px 40px; }
  h1 { font-size: 21px; }
  .form-row { grid-template-columns: 1fr; }
  .kind-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 420px) {
  .kind-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rule__head { flex-wrap: wrap; }
  .rule__title { flex-basis: calc(100% - 56px); }
  .rule__head .switch { margin-left: 56px; }
  .event__text { max-width: none; text-align: left; }
  .reason-row { grid-template-columns: 1fr 1fr; }
  .reason-row input[name=rule] { grid-column: 1 / -1; }
  .ladder__row { grid-template-columns: 40px 1fr; }
  .ladder__row select[name=step_duration] { grid-column: 2; }

  /* nowrap: в колонке с переносом ширину строки задаёт содержимое, и поиск вылезал за экран. */
  .filters { flex-direction: column; flex-wrap: nowrap; align-items: stretch; }
  .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
  .chip { flex: none; }
  .search input[type=search] { flex: 1; width: auto; min-width: 0; }

  .rtable:not(.rtable--plain), .rtable:not(.rtable--plain) tbody,
  .rtable:not(.rtable--plain) tr, .rtable:not(.rtable--plain) td { display: block; width: 100%; }
  .rtable:not(.rtable--plain) { background: none; border: 0; }
  .rtable:not(.rtable--plain) thead { display: none; }
  .rtable:not(.rtable--plain) tr {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
    padding: 6px 14px 14px;
  }
  .rtable:not(.rtable--plain) tbody tr:hover { background: var(--surface); }
  .rtable:not(.rtable--plain) td {
    border: 0;
    padding: 6px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    text-align: right;
  }
  .rtable:not(.rtable--plain) td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 13px;
    text-align: left;
    flex: none;
  }
  .rtable:not(.rtable--plain) td.rtable__user {
    display: block;
    text-align: left;
    font-size: 16px;
    padding-top: 8px;
  }
  .rtable:not(.rtable--plain) td.rtable__user::before { content: none; }
  .rtable:not(.rtable--plain) td.rtable__check:empty { display: none; }
  .rtable:not(.rtable--plain) td.rtable__actions { display: block; padding-top: 10px; }
  .rtable:not(.rtable--plain) td.rtable__actions::before { content: none; }
  .rtable__actions .btn { width: 100%; }
  .rtable__actions .decide { display: grid; grid-template-columns: 1fr 1fr; }
  .decide--compact .btn { min-height: var(--tap); }

  .rtable--plain th, .rtable--plain td { padding: 8px 6px; }

  .fields { grid-template-columns: 1fr; gap: 2px; }
  .fields dd { margin-bottom: 10px; }

  .decision-bar { margin: 16px -16px -40px; }
  .decision-bar .decide { display: grid; grid-template-columns: 1fr 1fr; }
  .decision-bar .decide .btn { width: 100%; min-width: 0; }
}

@media (forced-colors: active) {
  .dot { forced-color-adjust: none; }
}
