/* ============================================================
   Hotel Clean (СГХ Чек-листы) — единая дизайн-система
   Версия 1.11.6 (финальная мобильная адаптация)
   ============================================================ */

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --surface-3: #f3f4f6;
  --border: #e5e7eb;
  --border-strong: #d6dbe3;
  --text: #1f2933;
  /* Вторичный текст: было #6b7280 — 4.47:1 на --bg (ниже AA).
     #5b6472 даёт 5.53 на --bg и 5.98 на белом. */
  --muted: #5b6472;
  --primary: #4c3fa8;
  --primary-hover: #3b3090;
  --primary-light: #eeeafd;
  /* Фон «залитых» элементов (кнопки, активный пункт меню).
     Отдельно от --primary: в тёмной теме --primary светлый (для ссылок),
     а на заливке нужен тёмный фон под белый текст. */
  --primary-btn: #4c3fa8;
  --primary-btn-hover: #3b3090;
  --danger-btn: #b91c1c;
  --danger-btn-hover: #991b1b;
  /* Статусы: текст (--x) читаем на заливке (--x-bg), --x-solid — только
     для иконок/точек/легенды, где нужна насыщенность, а не контраст текста.
     Замеры на --x-bg: ok 6.38, warn 6.37, danger 6.80, info 7.32 (AA >= 4.5). */
  --ok: #166534;
  --ok-bg: #e7f6ec;
  --ok-solid: #16a34a;
  --warn: #92400e;
  --warn-bg: #fef3c7;
  --warn-solid: #b45309;
  --danger: #991b1b;
  --danger-bg: #fee2e2;
  --danger-solid: #b91c1c;
  --info: #1e40af;
  --info-bg: #e0ecff;
  --info-solid: #1d4ed8;
  /* Рамки статусов — отдельные значения, НЕ ссылки на себя.
     Было `--ok-border: var(--ok-border)`: самоссылка делает свойство невалидным,
     `border-color` падал в currentColor, и бейдж получал сатурационную обводку
     цветом текста (замер: --ok-border = "", рамка = rgb(22,163,74)). */
  --ok-border: #a9dfbd;
  --warn-border: #f2d489;
  --danger-border: #f3b4b4;
  --info-border: #b6cdf7;
  --check-orange-bg: #ffe4b5;
  --check-orange-border: #f0c68a;
  --legend-red: #fca5a5;
  --legend-orange: #ffb347;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 10px 25px rgba(0, 0, 0, 0.2);
  /* Высота .topbar: по ней встаёт рельс настроек (2.3.1).
     На мобильном топбар 52px, но там рельса нет. */
  --topbar-h: 56px;
}

/* ============================================================
   Тёмная тема
   Включается атрибутом data-theme="dark" на <html>.
   Переключатель и сохранение в localStorage — в base.html.
   ============================================================ */
[data-theme="dark"] {
  --bg: #12141a;
  --surface: #1b1e26;
  --surface-2: #22262f;
  --surface-3: #2a2f3a;
  --border: #333a47;
  --border-strong: #3d4555;
  --text: #e6e8ee;
  --muted: #9aa3b2;
  --primary: #8c7ff0;          /* ссылки и акценты на тёмном: 5.6:1 */
  --primary-hover: #a094f5;
  --primary-light: #2a2440;
  --primary-btn: #6d5fd4;      /* заливка кнопок: белый текст 4.96:1 */
  --primary-btn-hover: #5b4fc4;
  --danger-btn: #dc2626;       /* белый текст 4.83:1 */
  --danger-btn-hover: #b91c1c;
  --ok: #4ade80;
  --ok-bg: #12301f;
  --warn: #fbbf24;
  --warn-bg: #33260a;
  --danger: #f87171;
  --danger-bg: #3a1717;
  --info: #7dd3fc;
  --info-bg: #122636;
  --ok-border: #2f6b45;
  --warn-border: #6b5416;
  --danger-border: #7a2e2e;
  --info-border: #23506b;
  --check-orange-bg: #3a2a12;
  --check-orange-border: #7c5a1e;
  --legend-red: #d95757;
  --legend-orange: #f0a03c;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 25px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] {
  color-scheme: dark;
}

/* Тёмная тема: рельс темнее общего фона, подписи и пункты — на #b6bccb.
   Селекторы под .rail-item/.rail-cap; старые .sidebar nav a и .sidebar .bottom
   удалены вместе с прежней разметкой. */
[data-theme="dark"] .sidebar {
  background: linear-gradient(180deg,
    rgba(13, 15, 20, 0.96) 0%,
    rgba(13, 15, 20, 0.92) 100%);
}
[data-theme="dark"] .sidebar .rail-item,
[data-theme="dark"] .sidebar .rail-cap,
[data-theme="dark"] .sidebar .rail-title {
  color: #b6bccb;
}
[data-theme="dark"] .sidebar .rail-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================
   Оболочка: топбар сверху, рельс слева, контент справа
   ============================================================ */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.layout {
  display: flex;
  flex: 1;
  min-height: 0;       /* иначе контент не получает свой скролл */
  position: relative;  /* рельс вылетает ПОВЕРХ контента */
  overflow: hidden;
}

/* ---------- Рельс навигации ----------
   64px в покое (только иконки), 236px при наведении/фокусе — вылет поверх
   контента, поэтому ширина страницы не «прыгает» при раскрытии.
   Стекло уместно именно здесь: под рельсом прокручивается контент, и
   размытие видно (паспорт §15a, правило про blur). */
.sidebar {
  position: absolute;
  left: 0;
  /* Топбар теперь fixed и выведен из потока: .layout начинается с y=0,
     поэтому рельс тоже должен начинаться под топбаром, иначе его шапка
     (знак приложения) уезжает под стекло. */
  top: var(--topbar-h);
  bottom: 0;
  z-index: 40;
  width: 64px;
  display: flex;
  flex-direction: column;
  padding: 10px 8px;
  overflow-x: hidden;
  overflow-y: auto;
  color: #cdc6f4;
  background: linear-gradient(180deg,
    rgba(34, 27, 74, 0.96) 0%,
    rgba(34, 27, 74, 0.92) 100%);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  transition: width 0.22s cubic-bezier(.2,.7,.2,1), box-shadow 0.22s ease;
}
.sidebar:hover,
.sidebar:focus-within,
.sidebar.open {
  width: 236px;
  box-shadow: var(--shadow-md);
}
/* Браузер без blur — сплошной фон, а не прозрачный (иначе текст на тексте). */
@supports not ((backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px))) {
  .sidebar { background: #221b4a; }
}

.sidebar .rail-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 6px 14px;
  flex: 0 0 auto;
}
.sidebar .rail-mono {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  background: var(--primary-btn);
  text-transform: uppercase;
}
.sidebar .rail-title {
  color: #fff;
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.12s;
}
.sidebar:hover .rail-title,
.sidebar:focus-within .rail-title,
.sidebar.open .rail-title { opacity: 1; }

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
.sidebar nav::-webkit-scrollbar { width: 0; }

.sidebar .rail-group { display: flex; flex-direction: column; gap: 1px; }

/* Подпись группы: в свёрнутом рельсе скрыта, в раскрытом — разделитель. */
.sidebar .rail-cap {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #b3aede;
  padding: 9px 10px 4px;
  white-space: nowrap;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.12s, max-height 0.12s, padding 0.12s;
}
.sidebar:hover .rail-cap,
.sidebar:focus-within .rail-cap,
.sidebar.open .rail-cap { opacity: 1; max-height: 30px; }
.sidebar .rail-group + .rail-group .rail-cap {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 6px;
  padding-top: 11px;
}

.sidebar .rail-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: 8px;
  color: #cdc6f4;
  text-decoration: none;
  font-size: 13.5px;
  white-space: nowrap;
  flex: 0 0 auto;
  transition: background 0.12s, color 0.12s;
}
.sidebar .rail-item:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.sidebar .rail-item.active { background: var(--primary-btn); color: #fff; font-weight: 600; }
.sidebar .rail-item:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -2px;
}
.sidebar .rail-ico {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sidebar .rail-lbl {
  opacity: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.12s;
}
.sidebar:hover .rail-lbl,
.sidebar:focus-within .rail-lbl,
.sidebar.open .rail-lbl { opacity: 1; }

.content {
  flex: 1;
  /* Место под свёрнутый рельс: он вылетает поверх, не сдвигая страницу. */
  margin-left: 64px;
  /* Вертикальный отступ в две части. --content-pad-top — это «воздух» между
     топбаром и первой карточкой; по нему же считается липкая шапка таблиц
     (см. .table thead th), поэтому он вынесен в переменную, а не зашит. */
  --content-pad-top: 22px;
  padding: calc(var(--topbar-h) + var(--content-pad-top)) 28px 22px;
  min-width: 0;
  height: 100%;
  overflow-y: auto;
}
/* ---------- Заголовок страницы (восстановлено после правки оболочки) ---------- */
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-title { font-size: 22px; font-weight: 700; margin: 0; }
.page-sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
/* ---------- Топбар ---------- */
.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 56px;
  padding: 0 12px;
  /* fixed, а не relative: топбар должен висеть НАД прокручиваемым контентом.
     С relative контент начинался ровно под ним (top=56), под полосой 0–56
     лежал только --bg, и backdrop-filter размывал однородную заливку —
     то есть стекла не было видно вообще. Теперь .layout начинается с y=0,
     страница уезжает под топбар, и blur работает. Место под топбар
     возвращает .content через padding-top. */
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  border-bottom: 1px solid var(--border);
}
@supports not ((backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px))) {
  .topbar { background: var(--bg); }
}

.tb-burger {
  display: none;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border: none;
  background: none;
  border-radius: 9px;
  color: var(--muted);
  cursor: pointer;
}
.tb-burger:hover { background: var(--surface-3); color: var(--text); }
.tb-burger svg,
.tb-ico {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tb-search {
  position: relative;
  flex: 1 1 240px;
  max-width: 440px;
  margin: 0;
}
.tb-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  margin: 0;
  font-weight: 400;
}
.tb-search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent);
}
.tb-search-box input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: none;
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
  padding: 0;
  width: auto;
}
.tb-search-box input:focus { outline: none; box-shadow: none; border: none; }
.tb-search-box input::placeholder { color: var(--muted); }
.tb-search-box kbd {
  font: inherit;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
  background: var(--surface-3);
  white-space: nowrap;
}

.tb-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 70;
  max-height: 70vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 4px 0 6px;
}
.tb-res-group {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 9px 12px 4px;
}
.tb-res {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  color: var(--text);
  text-decoration: none;
  font-size: 13.5px;
  border-left: 2px solid transparent;
}
.tb-res:hover { background: var(--surface-2); border-left-color: var(--primary); }
.tb-res-txt { display: flex; flex-direction: column; min-width: 0; }
.tb-res-txt span { font-size: 11.5px; color: var(--muted); }
.tb-res-badge {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface-3);
  border-radius: 999px;
  padding: 1px 7px;
  white-space: nowrap;
}
.tb-res-all {
  display: block;
  padding: 9px 12px 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.tb-right { margin-left: auto; display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }

.tb-profile {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 8px 4px 4px;
  border: none;
  background: none;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  color: var(--text);
}
.tb-profile:hover { background: var(--surface-3); }
.tb-profile[aria-expanded="true"] { background: var(--primary-light); }
.tb-ava {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(140deg, var(--primary) 0%, var(--primary-btn) 100%);
  letter-spacing: 0.02em;
}
.tb-who { display: flex; flex-direction: column; line-height: 1.22; min-width: 0; }
.tb-who b {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}
.tb-who small { font-size: 11px; color: var(--muted); white-space: nowrap; }

.tb-bell {
  position: relative;
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  border-radius: 10px;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.tb-bell:hover { background: var(--surface-3); color: var(--text); }
.tb-bell[aria-expanded="true"] { background: var(--primary-light); color: var(--primary); }
.tb-badge {
  position: absolute;
  top: 4px;
  right: 3px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger-btn);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
  border: 2px solid var(--bg);
  line-height: 1;
}

/* ---------- Панели топбара ---------- */
.pop {
  position: absolute;
  top: calc(100% - 6px);
  right: 8px;
  z-index: 65;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.pop-inbox { width: 372px; max-width: calc(100vw - 24px); }
.pop-menu { width: 248px; padding: 6px; }

.pop-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border);
}
.pop-head h4 { margin: 0; font-size: 14px; font-weight: 700; }
.pop-count {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--danger-bg);
  color: var(--danger);
}
.pop-head button {
  margin-left: auto;
  border: none;
  background: none;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 5px;
}
.pop-head button:hover { background: var(--primary-light); }

.tb-inbox-list { max-height: 330px; overflow-y: auto; }
.tb-msg {
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  position: relative;
}
.tb-msg:hover { background: var(--surface-2); }
.tb-msg.unread { background: color-mix(in srgb, var(--primary) 6%, transparent); }
.tb-msg.unread::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 16px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--primary);
}
.tb-msg-ico {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--muted);
}
.tb-msg-ico svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.tb-msg-ico.lv-success { background: var(--ok-bg); color: var(--ok); }
.tb-msg-ico.lv-warning { background: var(--warn-bg); color: var(--warn); }
.tb-msg-ico.lv-danger { background: var(--danger-bg); color: var(--danger); }
.tb-msg-txt { min-width: 0; flex: 1; }
.tb-msg-txt b { display: block; font-size: 13px; font-weight: 600; margin-bottom: 1px; }
.tb-msg-txt p {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tb-src {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--primary-light);
  color: var(--primary);
  margin-left: 6px;
  vertical-align: middle;
}
.tb-msg-time { font-size: 10.5px; color: var(--muted); white-space: nowrap; }

.tb-empty { padding: 14px 14px; font-size: 12.5px; color: var(--muted); line-height: 1.45; }

.pop-foot { padding: 9px 14px; border-top: 1px solid var(--border); background: var(--surface-2); }
.pop-note { font-size: 11px; color: var(--muted); line-height: 1.35; display: block; }

.pop-who {
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 8px 8px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.pop-menu a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 9px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
}
.pop-menu a:hover { background: var(--surface-3); }
.pop-menu a.danger { color: var(--danger); }
.pop-sep { height: 1px; background: var(--border); margin: 6px 0; }
.pop-about { padding: 2px 9px 4px; }
.pop-about b { display: block; font-size: 12.5px; }
.pop-about span { font-size: 11px; color: var(--muted); }

/* ---------- Страница поиска ---------- */
.search-page-form {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.search-page-form input { flex: 1; }
.search-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin: 0 0 10px;
}
.search-hits { display: flex; flex-direction: column; gap: 2px; }
.search-hit {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid transparent;
}
.search-hit:hover { background: var(--surface-2); border-color: var(--border); }
.search-hit-txt { display: flex; flex-direction: column; min-width: 0; }
.search-hit-txt b { font-size: 13.5px; font-weight: 600; }
.search-hit-txt span { font-size: 12px; color: var(--muted); }
/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 16px;
}
.card h2 { font-size: 16px; margin: 0 0 12px; font-weight: 700; }

/* ---------- Forms ---------- */
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin: 12px 0 4px;
}
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font: inherit;
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  /* Сплошной контур вместо полупрозрачной тени: rgb(76,63,168) на белом = 8.13:1,
     прежняя тень rgba(...,0.15) давала 1.28:1 — фокус был практически невидим. */
  outline: 2px solid var(--primary);
  outline-offset: 1px;
  border-color: var(--primary);
  box-shadow: none;
}
input:disabled, select:disabled, textarea:disabled {
  background: var(--surface-3);
  color: var(--muted);
  cursor: not-allowed;
}
textarea { min-height: 110px; font-family: inherit; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border: none;
  border-radius: 8px;
  background: var(--primary-btn);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--primary-btn-hover); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; box-shadow: none; }
.btn:disabled { background: var(--surface-3); color: var(--muted); cursor: not-allowed; }
.btn.secondary { background: var(--surface-3); color: var(--text); }
.btn.secondary:hover { background: var(--surface-3); }
.btn.danger { background: var(--danger-btn); }
.btn.danger:hover { background: var(--danger-btn-hover); }

/* Опасное действие в таблице не должно быть самым заметным элементом строки:
   на одном экране /tasks/manage 89 красных «Удалить», и цвет опасности
   перестаёт что-либо значить (паспорт §15a, правило 21). В таблице — тихая
   контурная кнопка, красная только при наведении и в фокусе. */
.table .btn.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger-border);
}
.table .btn.danger:hover {
  background: var(--danger-bg);
  border-color: var(--danger);
}
.table .btn.danger:focus-visible {
  outline: 2px solid var(--danger);
  outline-offset: 2px;
}

/* ---------- Tables ---------- */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th, .table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.table th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
}
/* Шапка длинной таблицы держится при прокрутке: на /tasks/manage 96 строк и
   11 856 px контента, без этого к середине списка неизвестно, что за колонка.
   Работает, пока предок не создаёт свой скролл-контейнер: у /tasks/manage
   обёртка карточки использует overflow: clip, а не hidden. */
.table thead th {
  position: sticky;
  /* Sticky отсчитывает top от content-box скролл-порта, т.е. от
     «верха .content + его padding-top». При top:0 шапка застревала на
     56 + 22 = 78, и в полосе 56–78 были видны строки таблицы — тот самый
     «обрезок над шапкой». Отрицательный top поднимает её вплотную к топбару. */
  top: calc(-1 * var(--content-pad-top, 22px));
  z-index: 2;
  background: var(--surface);
  /* Граница «прилипшей» шапки: box-shadow не схлопывается вместе с border */
  box-shadow: inset 0 -1px 0 var(--border);
}
/* На телефоне шапка скрыта (table-cards), правило выше не мешает. */
@media print {
  .table thead th { position: static; box-shadow: none; }
  /* Фиксированный топбар печатался бы на каждой странице. */
  .topbar { position: static; }
  .content { padding-top: var(--content-pad-top); }
}
.table tr:hover td { background: var(--surface-2); }

/* Обёртка для таблиц — горизонтальный скролл */
.table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-responsive > table.table {
  min-width: 720px;
  width: 100%;
}
.table-responsive .table th,
.table-responsive .table td {
  white-space: nowrap;
  vertical-align: top;
}
.table-responsive .table td .notes-preview,
.table-responsive .table td .tag-badge {
  white-space: normal;
  word-break: break-word;
}
/* ---------- Задания: обёртка тегов в ячейке ---------- */
.tags-container {
  display: inline-block;
  max-width: 100%;
  word-break: break-word;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge.gray { background: var(--surface-3); color: var(--text); border-color: var(--border); }
.badge.blue { background: var(--info-bg); color: var(--info); border-color: var(--info-border); }
.badge.red { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
.badge.green { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-border); }
.badge.amber { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-border); }

/* ---------- Alerts ---------- */
.alert {
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin: 12px 0;
}
.alert.error { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-border); }
.alert.ok { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-border); }
.alert.info { background: var(--info-bg); color: var(--info); border: 1px solid var(--info-border); }

/* ---------- Empty state ---------- */
.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 16px;
  font-size: 14px;
}

/* ---------- Lists ---------- */
.list { display: grid; gap: 12px; }
.list-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  background: var(--surface);
}
/* ---------- Новое назначение для горничной ---------- */
.list-item.is-new {
  background-color: rgba(29, 78, 216, 0.08);   /* полупрозрачный синий */
  border-color: var(--info-border);
  transition: background-color 2s ease, border-color 2s ease;
}
.list-item.is-new:hover {
  background-color: rgba(29, 78, 216, 0.12);
}
/* ---------- Новое назначение для горничной ---------- */
.list-item .row1 {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.list-item .title { font-weight: 600; font-size: 15px; }
.list-item .meta {
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
}
.list-item .actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- Check-list rows ---------- */
.check-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  margin: 6px 0;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background-color 0.2s;
}
.check-row:hover { background-color: var(--bg); }

.check-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
  accent-color: var(--primary);
  cursor: pointer;
}
.check-row label {
  margin: 0;
  font-weight: 500;
  font-size: 15px;
  color: var(--text);
  cursor: pointer;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
}
.check-row .tag {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

/* Цветовые состояния пунктов */
.check-row.gray { background: var(--surface-2); }
.check-row.blue { background: var(--info-bg); border-color: var(--info-border); }
.check-row.red { background: var(--danger-bg); border-color: var(--danger-border); }
.check-row.orange { background: var(--check-orange-bg); border-color: var(--check-orange-border); }
.check-row.none { background: var(--surface-2); }

/* ---------- Legend ---------- */
.legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
  margin: 8px 0 16px;
}
.legend .dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: middle;
}
.legend .dot.gray { background: var(--muted); }
.legend .dot.blue { background: var(--info-solid); }
.legend .dot.red { background: var(--legend-red); }
.legend .dot.orange { background: var(--legend-orange); }
.legend .dot.none { background: var(--surface-2); border: 1px solid var(--border); }

/* ---------- Hints / helpers ---------- */
.hint { color: var(--muted); font-size: 12.5px; margin: 4px 0 12px; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Теги Logus ---------- */
.tag-badge {
  display: inline-block;
  background: var(--warn-bg);
  color: var(--warn);
  border: 1px solid var(--warn-border);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  margin-right: 4px;
  margin-bottom: 4px;
}
.notes-preview {
  font-size: 12px;
  /* --muted вместо литерала #666: тот не входил в палитру и не переключался
     на тёмную тему (в тёмной карточке текст оставался серым на тёмном). */
  color: var(--muted);
  margin-top: 6px;
  background: var(--surface-2);
  padding: 6px 10px;
  border-radius: 4px;
  border-left: 3px solid var(--info-border);
  max-width: 260px;
  white-space: normal;
  word-break: break-word;
  /* Примечание из Logus приходит абзацем на 400 px. В списке из 96 строк это
     давало строки высотой до 476 px: прокрутка на 11 856 px и не видно, где
     кончается задание. Четыре строки — достаточно для «о чём речь», полный
     текст остаётся в title и на странице задания. */
  display: -webkit-box;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Пагинация ---------- */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.pagination a, .pagination span {
  padding: 8px 14px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 14px;
  color: #333;
  border: 1px solid #ddd;
  background: var(--surface);
}
.pagination a:hover { background: var(--bg); }
.pagination .active { background: var(--primary-btn); color: #fff; border-color: var(--primary-btn); }
.pagination .disabled { color: #ccc; pointer-events: none; }

/* ---------- Тосты (B: плотные, с иконкой и цветной левой полосой) ---------- */
.toast-container {
  position: fixed;
  top: 60px;
  right: 16px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 180px;
  max-width: 340px;
  padding: 8px 10px 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--ok-solid);
  border-radius: 6px;
  box-shadow: var(--shadow-md);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  animation: toastIn .16s ease-out;
}
.toast .toast-ico { display: inline-flex; flex: 0 0 auto; color: var(--ok-solid); }
.toast .toast-ico svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.toast .toast-msg { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.toast .toast-close {
  flex: 0 0 auto;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
}
.toast .toast-close:hover { color: var(--text); }
.toast.success { border-left-color: var(--ok-solid); }
.toast.success .toast-ico { color: var(--ok); }
.toast.error { border-left-color: var(--danger-solid); }
.toast.error .toast-ico { color: var(--danger); }
.toast.info { border-left-color: var(--info-solid); }
.toast.info .toast-ico { color: var(--info); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Подтверждение (B: диалог с иконкой и последствиями) ---------- */
.b-modal {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.b-modal[hidden] { display: none !important; }
.b-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9, 13, 19, .52);
}
.b-modal-card {
  position: relative;
  width: min(480px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 16px 18px 14px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  box-shadow: 0 18px 48px rgba(15, 21, 30, .28);
}
.b-modal-head { display: flex; align-items: flex-start; gap: 10px; }
.b-modal-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}
.b-modal-icon.is-primary {
  background: var(--info-bg);
  color: var(--info);
  border-color: var(--info-border);
}
.b-modal-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.b-modal-copy { min-width: 0; flex: 1 1 auto; }
.b-modal-copy h2 {
  margin: 1px 0 4px;
  font-size: 16px;
  line-height: 1.3;
  font-weight: 650;
  color: var(--text);
}
#confirm-message {
  margin: 8px 0 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
  white-space: pre-line;
}
.b-modal-close { margin: -4px -6px 0 auto; }
.b-modal-close svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}
.b-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.b-modal-actions .btn { height: 34px; padding: 0 13px; font-size: 12.5px; }
.b-modal .b-modal-actions .btn.secondary {
  background: var(--surface) !important;
  border: 1px solid var(--border-strong) !important;
  color: var(--text) !important;
}
.b-modal .b-modal-actions .btn.secondary:hover { background: var(--surface-2) !important; }
.b-modal .b-modal-actions .btn.danger {
  background: var(--danger-btn) !important;
  border: 1px solid var(--danger-btn) !important;
  color: #fff !important;
}
.b-modal .b-modal-actions .btn.danger:hover {
  background: var(--danger-btn-hover) !important;
  border-color: var(--danger-btn-hover) !important;
}
.b-modal-actions .btn.b-primary {
  background: #24406b;
  border-color: #24406b;
  color: #fff;
}
.b-modal-actions .btn.b-primary:hover { background: #1a3257; border-color: #1a3257; }
[data-theme="dark"] .b-modal-actions .btn.b-primary {
  background: #3a6898;
  border-color: #3a6898;
}

/* ---------- Настройки: вкладки ---------- */
.settings-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.settings-tabs .tab {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.settings-tabs .tab:hover {
  color: var(--primary);
  background: var(--primary-light);
  text-decoration: none;
}
.settings-tabs .tab.active {
  background: var(--primary-btn);
  color: #fff;
  border-color: var(--primary-btn);
}

/* ---------- Настройки: разделы + под-вкладки ---------- */
.settings-tabs.settings-sections {
  gap: 6px;
  margin-bottom: 0;
  border-bottom: none;
}
.settings-tabs.settings-sections .tab {
  border-radius: 10px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  padding: 9px 18px;
}

.settings-subtabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin: 10px 0 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.settings-subtabs .subtab {
  padding: 6px 14px;
  font-size: 13px;
  line-height: 1.3;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  transition: color .12s, background .12s, border-color .12s;
}
.settings-subtabs .subtab:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-light);
  text-decoration: none;
}
.settings-subtabs .subtab.active {
  color: #fff;
  font-weight: 600;
  background: var(--primary-btn);
  border-color: var(--primary-btn);
}

/* ============================================================
   РЕЛЬС НАСТРОЕК (2.3.1)
   Второй уровень навигации: тёмный рельс приложения отвечает на «где я в
   продукте», этот светлый — на «где я в настройках». Активный раздел раскрыт,
   его под-страницы видны одновременно.
   Показываем только там, где контент умеет освободить место (:has): без этого
   рельс наехал бы на страницу. Поэтому базовое состояние — display:none, а
   раскрывает его пара «медиазапрос + @supports» в конце блока.
   ============================================================ */
.settings-rail {
  display: none;
  transition: left .22s cubic-bezier(.2,.7,.2,1), opacity .18s ease,
              background-color .2s ease;
  position: fixed;
  left: 64px;                        /* сразу за свёрнутым рельсом приложения */
  top: var(--topbar-h, 56px);
  bottom: 0;
  width: 212px;
  z-index: 30;                       /* ниже .sidebar (40): вылет 64→236 перекрывает */
  overflow-y: auto;
  padding: 14px 8px 20px;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.sr-title {
  padding: 0 8px 10px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.sr-nav { display: flex; flex-direction: column; gap: 1px; }

/* Раздел: <details> отдаёт раскрытость, aria-expanded и клавиатуру без JS. */
.sr-sum {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  list-style: none;
}
.sr-sum::-webkit-details-marker { display: none; }
.sr-sum:hover { background: var(--surface-3); }
.sr-chev {
  width: 12px; height: 12px; flex: 0 0 auto;
  fill: none; stroke: currentColor; stroke-width: 2.4;
  stroke-linecap: round; stroke-linejoin: round;
  color: var(--muted);
  transition: transform .15s ease;
}
.sr-sec[open] > .sr-sum .sr-chev { transform: rotate(90deg); }
.sr-dot {
  margin-left: auto;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--primary-btn);
}

/* Под-страницы: направляющая линия показывает вложенность, не съедая ширину. */
.sr-pages {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 2px 0 8px 14px;
  padding-left: 6px;
  border-left: 1px solid var(--border);
}
.sr-page {
  padding: 7px 8px;
  border-radius: 7px;
  font-size: 13.5px;
  line-height: 1.3;
  color: var(--muted);
  text-decoration: none;
}
.sr-page:hover { background: var(--primary-light); color: var(--primary); text-decoration: none; }
.sr-page.active { background: var(--primary-btn); color: #fff; font-weight: 600; }
/* Раздел из одной страницы («Интеграции») — ссылка на уровне названий разделов. */
.sr-solo { padding-left: 26px; font-size: 14px; font-weight: 600; color: var(--text); }
.sr-sum:focus-visible,
.sr-page:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

@media (min-width: 1024px) {
  @supports selector(:has(*)) {
    .settings-rail { display: block; }
    /* 64 (рельс приложения) + 212 (рельс настроек) */
    .content:has(.settings-rail) { margin-left: 276px; }
    .settings-tabs.settings-fallback,
    .settings-subtabs.settings-fallback { display: none; }
    /* Раскрытый рельс приложения (64→236) накрывает 236 из 276px: без этого
       из-под него торчала бы полоска рельса настроек с активной пилюлей.
       .sidebar и .content — соседние элементы в .layout, поэтому хватает ~.

       Мышь — visibility:hidden: рельс полностью убирается, случайный клик по
       полоске никуда не ведёт. Клавиатура — именно opacity, а НЕ visibility:
       visibility:hidden выкидывает ссылки из tab-порядка, и тогда при Tab
       из рельса приложения весь рельс настроек (единственная навигация
       настроек на этой ширине) пропускался бы. При opacity элемент остаётся
       фокусируемым, а в момент ухода фокуса из .sidebar :focus-within
       перестаёт совпадать — и пункт становится видимым уже сфокусированным. */
    /* Sidebar is an overlay, not a layout shifter. The settings rail
       remains in place and is visible through the glass. */
    .sidebar:hover ~ .content .settings-rail,
    .sidebar.open ~ .content .settings-rail,
    .sidebar:focus-within ~ .content .settings-rail {
      visibility: visible;
      opacity: 1;
    }
  }
}

/* ============================================================
   БАЗОВАЯ МОБИЛЬНАЯ АДАПТАЦИЯ
   ============================================================ */
@media (max-width: 768px) {
  .settings-tabs { gap: 6px; }
  .settings-tabs .tab { padding: 7px 10px; font-size: 13px; }
  .settings-tabs.settings-sections .tab { padding: 7px 12px; font-size: 14px; }
  .settings-subtabs { gap: 5px; }
  .settings-subtabs .subtab { padding: 5px 11px; font-size: 12px; }
  .content { padding: 12px; }
  .page-title { font-size: 20px; }
  .page-sub { font-size: 13px; }

  .list-item { padding: 16px; margin-bottom: 12px; border-radius: 12px; }
  .list-item .title { font-size: 17px; }
  .list-item .meta { font-size: 13px; gap: 8px; }
  .list-item .actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
  }
  .list-item .actions a,
  .list-item .actions button {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    border-radius: 8px;
    text-align: center;
    box-sizing: border-box;
  }

  .card .btn { flex: 1; text-align: center; padding: 10px; font-size: 14px; }

  .check-row { padding: 16px 12px; gap: 16px; border-radius: 10px; }
  .check-row input[type="checkbox"] { width: 28px; height: 28px; margin: 0; }
  .check-row label { font-size: 16px; line-height: 1.4; }

  #maid-form + div button,
  form[action*="/complete"] button,
  form[action*="/start"] button {
    padding: 16px;
    font-size: 18px;
    border-radius: 10px;
  }
  form[action*="/start"] .card { padding: 20px 16px; }

  .table-responsive .table { font-size: 12.5px; }
  .table-responsive .table th,
  .table-responsive .table td { padding: 8px 6px; }

  .page-head {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .page-head > div:last-child {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }
  .page-head > div:last-child .btn,
  .page-head > div:last-child form { width: 100%; }
  .page-head > div:last-child form .btn { width: 100%; }
}

/* ---------- Очень узкие экраны (iPhone SE) ---------- */
@media (max-width: 600px) {
  .table-responsive > table.table { min-width: 560px; }
  .page-title { font-size: 18px; }
  .btn { padding: 9px 12px; font-size: 14px; }
  .card { padding: 14px; }
}
/* ============================================================
   МОБИЛЬНАЯ СЕКЦИЯ: хром (нижняя панель) + карточки таблиц
   Хром написан без !important; правила для table.table-cards ниже сохраняют
   !important как технический долг (паспорт §15a, правило 18) — они перебивают
   десктопную разметку таблиц, которую трогать в этом шаге не стали.
   ============================================================ */
@media screen and (max-width: 768px) {
  /* 1. Хром: рельс превращается в нижнюю панель, топбар — компактным.
     Раньше сайдбар разворачивался в столбик и занимал 32% высоты (268 px,
     у админа 342 px). Теперь меню — одна прокручиваемая строка внизу, где до
     него достаёт большой палец. Правила без !important: прежний блок с ними
     удалён целиком, конкурировать больше нечему (паспорт §15a, правило 18). */
  /* Топбар на телефоне ниже (52px) — переменная должна это знать, иначе
     padding-top у .content оставит 4px мусорного зазора под стеклом. */
  .app-shell { height: 100dvh; --topbar-h: 52px; }

  .layout {
    flex-direction: column;
    /* Место под панель: иначе она перекрывает последнюю строку таблицы. */
    padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
  }

  /* Рельс: был absolute-вылетом слева, стал фиксированной нижней панелью.
     Наведение/фокус больше не раскрывают его — места нет. */
  .sidebar,
  .sidebar:hover,
  .sidebar:focus-within,
  .sidebar.open {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 60;
    width: 100%;
    max-width: 100%;
    height: 56px;
    flex-direction: row;
    align-items: center;
    gap: 2px;
    padding: 0 6px calc(0px + env(safe-area-inset-bottom, 0px));
    border-right: none;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: none;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }
  .sidebar::-webkit-scrollbar { display: none; }

  /* В нижней панели нет ни знака приложения, ни подписей групп. */
  .sidebar .rail-brand,
  .sidebar .rail-cap { display: none; }

  .sidebar nav {
    flex-direction: row;
    gap: 2px;
    min-width: 0;
    overflow: visible;
  }
  .sidebar .rail-group { flex-direction: row; gap: 2px; }
  .sidebar .rail-item,
  .sidebar:hover .rail-item {
    flex: 0 0 auto;
    padding: 9px 11px;
    margin: 0;
  }
  /* Подписи и иконки: в панели место есть, поэтому показываем текст. */
  .sidebar .rail-lbl,
  .sidebar:hover .rail-lbl,
  .sidebar:focus-within .rail-lbl,
  .sidebar.open .rail-lbl {
    opacity: 1;
    font-size: 12.5px;
  }
  .sidebar .rail-ico { width: 18px; height: 18px; }

  /* Топбар: бургер не нужен (рельс всегда виден), профиль — только аватар. */
  .topbar { height: 52px; padding: 0 8px; }
  .tb-burger { display: none; }
  .tb-who { display: none; }
  .tb-profile { padding: 4px; }
  .tb-search-box kbd { display: none; }
  .tb-search { max-width: none; }
  .pop-inbox { width: calc(100vw - 16px); right: 4px; }
  .pop-menu { right: 4px; }

  .content {
    width: 100%;
    margin-left: 0;
    padding: 12px;
    --content-pad-top: 12px;
    padding-top: calc(var(--topbar-h) + var(--content-pad-top));
    height: auto;
  }

  /* 2. Карточки для таблиц с .table-cards */
  table.table-cards { min-width: 0 !important; width: 100% !important; }
  table.table-cards thead { display: none !important; }
  table.table-cards,
  table.table-cards tbody,
  table.table-cards tr,
  table.table-cards td {
    display: block !important;
    width: 100% !important;
  }
  table.table-cards tr {
    border: 1px solid var(--border) !important;
    border-radius: 10px !important;
    margin-bottom: 12px !important;
    padding: 12px 14px !important;
    background: var(--surface) !important;
    box-shadow: var(--shadow-sm) !important;
  }
  table.table-cards tr:hover td { background: transparent !important; }
  table.table-cards td {
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    gap: 12px !important;
    padding: 6px 0 !important;
    border: none !important;
    font-size: 14px !important;
    white-space: normal !important;
    word-break: break-word !important;
  }
  table.table-cards td::before {
    content: attr(data-label);
    font-size: 12px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.04em !important;
    color: var(--muted) !important;
    font-weight: 600 !important;
    flex-shrink: 0 !important;
    min-width: 90px !important;
  }
  table.table-cards td[data-label=""],
  table.table-cards td[data-label="—"] {
    display: none !important;
  }
  table.table-cards td form { width: 100% !important; }
  table.table-cards td form select,
  table.table-cards td form button { flex: 1 !important; }
  table.table-cards td .tag-badge { white-space: normal !important; }
  table.table-cards td .notes-preview { max-width: none !important; }
  table.table-cards td[data-label="Действия"],
  table.table-cards td[data-label="Назначить"] {
    flex-direction: column !important;
    align-items: stretch !important;
    padding-top: 10px !important;
    border-top: 1px dashed var(--border) !important;
    margin-top: 8px !important;
  }
  table.table-cards td[data-label="Действия"]::before,
  table.table-cards td[data-label="Назначить"]::before {
    min-width: auto !important;
    margin-bottom: 6px !important;
  }

  /* 3. Исправление длинного текста в карточках */
  table.table-cards td > * {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    word-break: break-word !important;
  }

  /* 4. ЖЕСТКОЕ ИСПРАВЛЕНИЕ ДЛЯ ТЕГОВ И ПРИМЕЧАНИЙ (чтобы не сжимались в колонку) */
  table.table-cards td[data-label="Теги"],
  table.table-cards td[data-label="Теги / Примечание"] {
    flex-direction: column !important;
    align-items: flex-start !important;
  }
  
  table.table-cards td[data-label="Теги"] .tags-container,
  table.table-cards td[data-label="Теги"] > div,
  table.table-cards td[data-label="Теги / Примечание"] .tags-container,
  table.table-cards td[data-label="Теги / Примечание"] > div {
    width: 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  
  table.table-cards td[data-label="Теги"] .notes-preview,
  table.table-cards td[data-label="Теги / Примечание"] .notes-preview {
    width: 100% !important;
    max-width: 100% !important;
    margin-top: 8px !important;
    box-sizing: border-box !important;
  }
}

#sync-modal .step {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 14px;
}
#sync-modal .step-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #ccc;
  border-top-color: #4f46e5;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
#sync-modal .step.step-done .step-spinner {
  display: none;
}
#sync-modal .step.step-done::before {
  content: "✔";
  color: var(--ok-solid);
  font-weight: bold;
}
#sync-modal .step.step-error::before {
  content: "✖";
  color: var(--danger-solid);
  font-weight: bold;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Приоритетные карточки горничной */
.list-item.is-priority {
  box-shadow: 0 0 10px 2px var(--glow-color, #ef4444);
  border: 1px solid var(--glow-color, #ef4444);
}
.list-item.pulse-anim {
  /* Было `infinite`: вечная пульсация в очереди заданий утомляет за смену
     и жжёт батарею на телефоне. Два прохода — достаточно, чтобы заметить. */
  animation: pulse-glow 2s ease-out 2;
}
@keyframes pulse-glow {
  0% { box-shadow: 0 0 5px 1px var(--glow-color, #ef4444); }
  50% { box-shadow: 0 0 15px 5px var(--glow-color, #ef4444); }
  100% { box-shadow: 0 0 5px 1px var(--glow-color, #ef4444); }
}
.priority-badge {
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
  display: inline-block;
}

/* ============================================================
   ПАТЧ ДЛЯ /tasks/manage (ПК и Мобильная версия)
   ============================================================ */

/*
   1. ПК ВЕРСИЯ: Управление шириной колонок (без !important)
   Используем table-layout: fixed для жесткого распределения
/* ============================================================
   ПАТЧ ДЛЯ /tasks/manage (ПК)
   ============================================================ */

/* Убираем жесткую фиксацию, чтобы таблица дышала */
.table-cards {
  table-layout: auto;
  width: 100%;
}

/* Чекбокс (1-я колонка) - делаем узким, но без !important */
.table-cards th:first-child,
.table-cards td:first-child {
  width: 40px;
  text-align: center;
  padding-left: 8px;
  padding-right: 8px;
}

/* Центрируем сам чекбокс */
.table-cards td:first-child input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0 auto;
  display: block;
  cursor: pointer;
}

/* Заголовок группы (Горничная: Имя) */
.row-group-header {
  background: var(--surface-2) !important;
  cursor: pointer;
  user-select: none;
  font-weight: bold;
}

.row-group-header:hover {
  background: var(--surface-3) !important;
}

/*
   2. МОБИЛЬНАЯ ВЕРСИЯ (Карточки)
*/
@media (max-width: 768px) {
  /* Отключаем жесткую ширину колонок */
  .table-cards {
    table-layout: auto;
  }

  /* Прячем шапку */
  .table-cards thead {
    display: none !important;
  }

  /* Таблица превращается в блоки */
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td {
    display: block !important;
    width: 100% !important;
  }

  /* Карточка задания */
  .table-cards tbody tr:not(.row-group-header) {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 16px;
    padding: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  }

  /* Заголовок группы (Горничная) */
  .table-cards .row-group-header {
    background: transparent !important;
    border: none;
    box-shadow: none;
    margin: 16px 0 8px 0;
    padding: 0;
    display: flex !important;
    align-items: center;
  }
  .table-cards .row-group-header td {
    padding: 0 !important;
    border: none !important;
  }

  /* Ячейки внутри карточки */
  .table-cards td {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0 !important;
    border-bottom: 1px dashed var(--border) !important;
    text-align: right;
  }
  .table-cards td:last-child {
    border-bottom: none !important;
  }

  /* Подписи колонок (Номер, Статус и т.д.) */
  .table-cards td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    margin-right: 16px;
    text-align: left;
    flex-shrink: 0;
  }

  /* Колонки Статус и Действия в столбик */
  .table-cards td[data-label="Статус"],
  .table-cards td[data-label="Действия"] {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .table-cards td[data-label="Статус"]::before,
  .table-cards td[data-label="Действия"]::before {
    margin-bottom: 4px;
  }

  /* Формы и кнопки в карточках */
  .table-cards td[data-label="Действия"] form,
  .table-cards td[data-label="Действия"] select,
  .table-cards td[data-label="Действия"] button,
  .table-cards td[data-label="Статус"] form,
  .table-cards td[data-label="Статус"] button {
    width: 100%;
    max-width: 100%;
    margin-bottom: 6px;
  }

  /* Чекбокс в левом верхнем углу */
  .table-cards td:first-child {
    justify-content: flex-start;
    border-bottom: none !important;
    padding-bottom: 0 !important;
  }
  .table-cards td:first-child::before {
    display: none;
  }
  .table-cards td:first-child input[type="checkbox"] {
    margin: 0;
    width: 22px;
    height: 22px;
  }

  /* Скрытие свернутых групп */
  .table-cards tbody[style*="display: none"],
  .table-cards tbody[style*="display:none"] {
    display: none !important;
  }

  /* Кнопки в шапке на мобильном */
  .page-head .btn {
    width: 100%;
    margin-bottom: 8px;
  }
}

@media (max-width: 768px) {
  .toast-container {
    top: 62px;
    left: 12px;
    right: 12px;
    align-items: stretch;
    max-width: none;
  }
  .toast { max-width: none; width: 100%; }
  .b-modal { padding: 10px; align-items: flex-end; }
  .b-modal-card { width: 100%; max-height: 92vh; padding: 14px; }
  .b-modal-actions .btn { flex: 1 1 auto; min-height: 40px; }
}

/* ============================================================
   УВАЖЕНИЕ К НАСТРОЙКЕ «МЕНЬШЕ ДВИЖЕНИЯ»
   Системная настройка accessibility: пользователю плохо от анимации
   (вестибулярные расстройства, мигрень, эпилепсия). Гасим переходы,
   пульсацию приоритета и спиннеры, но НЕ саму смену состояния.
   Блок стоит последним, чтобы перебить конкретные правила выше.
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  /* Пульсация приоритета превращается в статичную рамку: сигнал остаётся,
     движение убирается. */
  .list-item.pulse-anim {
    animation: none !important;
  }
  .list-item.is-priority {
    box-shadow: 0 0 0 2px var(--glow-color, var(--danger-solid));
  }
  /* Тост появляется без выезда справа. */
  .toast {
    animation: none !important;
  }
  #sync-modal .step-spinner {
    animation: none !important;
    border-top-color: var(--primary);
  }
}


/* ===== Phase 3.1: shared macros + photo block ===== */
.text-muted { color: var(--muted); }
.mt-0 { margin-top: 0; }
.mt-4 { margin-top: 4px; }
.mt-6 { margin-top: 6px; }
.w-full { width: 100%; }
.btn-xs { padding: 4px 8px; font-size: 12px; line-height: 1.2; }
.input-xs { padding: 4px; font-size: 12px; }
.hint-sm { font-size: 12px; color: var(--muted); }
.label-static { cursor: default; }
.priority-row { border-left: 4px solid var(--danger-solid); background-color: var(--danger-bg); }
.bulk-checkbox-center { width: 40px; text-align: center; }
.badge-line { margin-top: 4px; }
.pause-row-cell { background: var(--surface-2); padding: 8px 12px; border-top: 1px dashed var(--border); }
.pause-resume-form { display: inline; margin-left: 8px; }
.pause-inline { margin: 0; }
.pause-form-inline { display: flex; gap: 4px; margin-top: 6px; }
.pause-select { max-width: 120px; }
.priority-cell { width: 100px; }
.inline-form { display: flex; gap: 4px; }
.priority-input { width: 50px; padding: 4px; }
.assign-inline { display: flex; gap: 6px; align-items: center; }
.assign-select { padding: 6px; flex: 1; }

/* settings modal (moved from macros.html) */
.settings-modal {
  display: none; position: fixed; inset: 0; z-index: 11000;
  background: rgba(0, 0, 0, .55); padding: 24px;
  align-items: center; justify-content: center;
}
.settings-modal.open { display: flex; }
.settings-modal-box {
  background: var(--surface); border-radius: 12px; width: 100%; max-width: 720px;
  max-height: 88vh; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35); overflow: hidden;
}
.settings-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 15px;
}
.settings-modal-close {
  background: none; border: none; font-size: 22px; line-height: 1;
  cursor: pointer; color: var(--muted); padding: 0 4px;
}
.settings-modal-close:hover { color: var(--text); }
#settings-modal-frame { border: 0; width: 100%; flex: 1; min-height: 60vh; background: var(--surface); }

/* sync modal */
.sync-modal {
  display: none; position: fixed; inset: 0; z-index: 9999;
  background: rgba(0, 0, 0, .5); align-items: center; justify-content: center;
}
.sync-modal.open { display: flex; }
.sync-dialog {
  background: var(--surface); border-radius: 12px; padding: 24px;
  width: 90%; max-width: 420px; box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
}
.step-dim { opacity: .3; }
.sync-result {
  margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border);
}
.sync-counts { font-size: 14px; color: var(--text); margin-bottom: 16px; }
.text-ok { color: var(--ok-solid); }
.text-warn { color: var(--warn); }
.text-danger { color: var(--danger); }

/* photo block */
.photo-card { margin-bottom: 16px; padding: 12px 14px; }
.photo-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.photo-title { margin: 0; font-size: 15px; }
.photo-alert { margin: 0 0 10px; padding: 8px 12px; font-size: 13px; }
.photo-stage { border-top: 1px solid var(--border); padding-top: 8px; margin-top: 8px; }
.photo-stage-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.photo-stage-title { font-size: 12.5px; }
.photo-stage-badge { font-size: 10px; }
.photo-stage-count { font-size: 11px; color: var(--muted); }
.photo-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.photo-item { width: 76px; position: relative; }
.photo-thumb { width: 76px; height: 76px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); display: block; }
.photo-hidden {
  width: 76px; height: 76px; border-radius: 6px; border: 1px dashed var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--muted);
}
.photo-delete-form { margin: 0; }
.photo-delete {
  position: absolute; top: 1px; right: 1px; width: 19px; height: 19px;
  padding: 0; line-height: 1; border-radius: 50%; border: none;
  background: rgba(0, 0, 0, .62); color: #fff; cursor: pointer; font-size: 12px;
}
.photo-meta {
  font-size: 9.5px; color: var(--muted); line-height: 1.25;
  margin-top: 2px; word-break: break-word;
}
.photo-meta-title { color: var(--text); }
.photo-empty { font-size: 12.5px; color: var(--muted); }
.photo-upload { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 10px 0 0; }
.photo-kind-select { padding: 6px 8px; font-size: 12.5px; }
.photo-kind-badge { font-size: 11px; }
.photo-file { font-size: 12px; flex: 1; min-width: 150px; }
.photo-upload-btn { padding: 5px 10px; font-size: 12.5px; }
.photo-hint { font-size: 10.5px; color: var(--muted); margin-top: 3px; }
.photo-limit { font-size: 11.5px; color: var(--muted); margin-top: 8px; }
.photo-lightbox {
  display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, .82);
  z-index: 10000; align-items: center; justify-content: center; padding: 16px;
}
.photo-lightbox.open { display: flex; }
.photo-lightbox-img { max-width: 100%; max-height: 100%; border-radius: 8px; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); }

@media (max-width: 520px) {
  .photo-upload .photo-file { flex: 1 1 100%; min-width: 0; }
  .photo-upload .photo-kind-select { width: 100%; }
  .photo-upload-btn { width: 100%; }
}


/* ===== Phase 3.1 batch 2: utility classes ===== */
.u-m-0 { margin: 0; }
.u-mt-0 { margin-top: 0; }
.u-mt-4 { margin-top: 4px; }
.u-mt-6 { margin-top: 6px; }
.u-mt-8 { margin-top: 8px; }
.u-mt-10 { margin-top: 10px; }
.u-mt-12 { margin-top: 12px; }
.u-mt-16 { margin-top: 16px; }
.u-mb-4 { margin-bottom: 4px; }
.u-mb-8 { margin-bottom: 8px; }
.u-mb-12 { margin-bottom: 12px; }
.u-mb-16 { margin-bottom: 16px; }
.u-flex { display: flex; }
.u-flex-col { flex-direction: column; }
.u-flex-wrap { flex-wrap: wrap; }
.u-items-center { align-items: center; }
.u-justify-between { justify-content: space-between; }
.u-justify-end { justify-content: flex-end; }
.u-gap-4 { gap: 4px; }
.u-gap-6 { gap: 6px; }
.u-gap-8 { gap: 8px; }
.u-gap-10 { gap: 10px; }
.u-gap-12 { gap: 12px; }
.u-gap-16 { gap: 16px; }
.u-w-full { width: 100%; }
.u-flex-1 { flex: 1; }
.u-min-w-200 { min-width: 200px; }
.u-grid { display: grid; }
.u-grid-gap-8 { gap: 8px; }
.u-font-13 { font-size: 13px; }
.u-font-15 { font-size: 15px; }
.u-font-16 { font-size: 16px; }
.u-font-18 { font-size: 18px; }
.u-font-600 { font-weight: 600; }
.u-cursor-pointer { cursor: pointer; }
.u-cursor-default { cursor: default; }
.u-text-muted { color: var(--muted); }

/* coordinator_check */
.check-meta-gap { margin-top: 6px; }
.checklist-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.h2-sm { font-size: 13px; }
.checklist-item-gap { margin-bottom: 6px; }
.photo-inline-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline-wrap-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.input-grow { flex: 1; min-width: 200px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
.check-note-gap { margin-top: 8px; }

/* workbench_task */
.wb-select { padding: 6px 8px; width: 100%; }
.wb-checklist-summary { cursor: pointer; font-size: 18px; font-weight: 700; }
.wb-save-row { display: flex; justify-content: flex-end; margin: 4px 0 6px; }
.wb-items-head { margin: 12px 0 2px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.wt-item { cursor: default; }
.wt-item-editable { cursor: pointer; }
.wb-item-check { width: auto; margin-top: 2px; }
.wb-problem-note {
  width: 100%; min-height: 70px; padding: 8px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text);
}
.wb-existing-row { border-left-color: var(--primary); background: var(--surface-2); }

/* maid_check */
.pause-box-warn { background: var(--warn-bg); border-color: var(--warn-border); }
.meta-box {
  background: var(--surface-2); padding: 12px 16px; border-radius: 8px;
  margin-bottom: 16px; display: flex; gap: 16px; flex-wrap: wrap;
  align-items: center; border: 1px solid var(--border);
}
.chip {
  background: var(--surface); padding: 4px 10px; border-radius: 12px;
  border: 1px solid var(--border); font-weight: 600;
}
.chip-row { display: flex; gap: 4px; flex-wrap: wrap; }
.btn-block { width: 100%; }
.btn-start { padding: 14px; font-size: 16px; }
.btn-finish { padding: 16px; font-size: 18px; background: var(--ok-solid); color: #fff; }
.btn-finish-sm { flex: 1; background: var(--ok-solid); color: #fff; }
.check-label { display: flex; align-items: center; gap: 10px; cursor: default; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.confirm-modal {
  display: none; position: fixed; inset: 0; z-index: 9999;
  background: rgba(0, 0, 0, .5); align-items: center; justify-content: center;
}
.confirm-modal.open { display: flex; }
.confirm-dialog {
  background: var(--surface); padding: 24px; border-radius: 12px;
  width: 90%; max-width: 340px; box-shadow: 0 10px 25px rgba(0, 0, 0, .2);
  text-align: center;
}
.confirm-text {
  font-size: 16px; color: var(--text); margin-bottom: 24px; line-height: 1.4;
}
.confirm-actions { display: flex; gap: 12px; }
.confirm-actions .btn { flex: 1; padding: 12px; }


/* ===== Phase 3.1 batch 3: lists, workbench, room, reports ===== */
.u-ml-6 { margin-left: 6px; }
.u-mb-10 { margin-bottom: 10px; }
.maid-filter-card {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 16px; padding: 12px 20px;
}
.maid-filter-btn { flex: 1; text-align: center; }
.maid-summary-card {
  margin-bottom: 16px; padding: 16px 20px;
  display: flex; gap: 16px; flex-wrap: wrap; align-items: center;
}
.maid-total { font-size: 15px; font-weight: 600; color: var(--text); width: 100%; }
.maid-stats { display: flex; gap: 8px; flex-wrap: wrap; width: 100%; }
.maid-stat-badge {
  background: var(--info-bg); color: var(--info);
  border: 1px solid var(--info-border, var(--border));
  font-size: 13px; padding: 6px 10px; flex: 1; text-align: center;
}
.maid-guest-meta {
  margin-top: 10px; background: var(--surface-2); padding: 12px;
  border-radius: 8px; display: block;
}
.maid-warn-note {
  margin-top: 8px; padding: 8px 10px; background: var(--warn-bg);
  border: 1px solid var(--warn-border); border-radius: 6px; font-size: 13px;
}
.maid-open-btn {
  width: 100%; display: block; box-sizing: border-box; text-align: center;
}

.wb-tabs-tight { margin-top: -4px; }
.wb-check-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted);
}
.wb-floor-select { min-width: 230px; max-width: 320px; padding: 6px 8px; }
.wb-bulkbar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 10px;
}
.wb-bulk-count { font-size: 12px; }
.wb-select-sm { padding: 6px 8px; }
.wb-dialog {
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text); padding: 0;
  width: min(480px, calc(100vw - 24px));
}
.wb-dialog-head {
  padding: 16px 18px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.wb-dialog-body { padding: 16px 18px; display: grid; gap: 9px; }
.wb-dialog-foot {
  padding: 12px 18px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
}

.room-num-lg { font-size: 16px; font-weight: 600; }
.room-thumb { height: 44px; border-radius: 6px; }
.room-wo-form { display: flex; gap: 6px; align-items: center; margin: 0; }
.room-wo-select { height: 32px; width: auto; }
.room-history-head { gap: 10px; }
.room-tl-filters { margin: 10px 0 14px; }

.report-filter-card {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 16px; padding: 12px 20px;
}
.report-head-card {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.report-title { font-weight: 600; color: var(--text); }
.report-export-btn {
  background: var(--info-bg); color: var(--info);
  border: 1px solid var(--info-border, var(--border));
}
.report-controls { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.report-table-card { padding: 0; overflow: hidden; }
.report-table-title { padding: 20px 20px 0; }
.report-table-note {
  padding: 0 20px 10px; color: var(--muted); font-size: 13px;
}

.list-item .meta.maid-guest-meta {
  display: block;
  margin-top: 10px;
  background: var(--surface-2);
  padding: 12px;
  border-radius: 8px;
}


/* ===== Phase 3.1 batch 4: admin, campaigns, reports, partials ===== */
.u-flex-1 { flex: 1; }
.u-min-w-250 { min-width: 250px; }
.u-mt-24 { margin-top: 24px; }
.u-mb-6 { margin-bottom: 6px; }
.u-gap-5 { gap: 5px; }
.u-block { display: block; }
.u-inline { display: inline; }
.u-w-full { width: 100%; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.page-sub-sm { font-size: 11px; margin-top: 3px; }
.table-card { padding: 0; overflow: hidden; }
.th-id { width: 40px; }
.th-actions { width: 180px; }
.form-contents { display: contents; }
.btn-sm { padding: 6px 12px; }
.icon-danger { color: var(--danger); }
.delete-form { display: inline; margin-left: auto; }
.row-actions { display: flex; gap: 8px; align-items: center; }

.campaign-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.manager-checks-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 4px 0; }
.tag-xs { font-size: 10px; }
.waive-form { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.waive-input { min-width: 160px; }
.check-group-head { margin: 14px 0 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.check-row-tight { padding: 3px 0; }
.font-10 { font-size: 10px; }

.quick-label { color: var(--muted); font-size: 14px; margin-right: 8px; align-self: center; }
.flex-none { flex: 0 0 auto; }
.error-table-card { padding: 0; overflow: auto; max-height: 70vh; }
.empty-lg { padding: 40px; text-align: center; color: var(--muted); }
.cell-strong { font-weight: 500; color: var(--text); }
.w-120 { width: 120px; }
.error-chip {
  display: inline-block; background: var(--danger-bg); color: var(--danger);
  padding: 2px 8px; border-radius: 12px; font-size: 12px; margin: 2px;
}

.status-note-box {
  margin-bottom: 12px; padding: 10px; background: var(--surface-2);
  border-radius: 6px; border: 1px solid var(--border);
}
.status-note-row { margin-bottom: 0; }
.tags-label { font-size: 12px; color: var(--muted); margin-right: 8px; }

.wb-select-check { width: auto; margin-top: 5px; }
.wb-card-select { padding: 4px 6px; font-size: 11px; max-width: 170px; }
.tm-board-grid { display: grid; gap: 8px; }
.priority-badge-danger { background: var(--danger); }


/* ===== Phase 3.1 batch 5: final utility/component classes ===== */
.u-m-0 { margin: 0; }
.u-mt-14 { margin-top: 14px; }
.u-mt-15 { margin-top: 15px; }
.u-mb-20 { margin-bottom: 20px; }
.u-min-w-200 { min-width: 200px; }
.w-160 { width: 160px; }
.p-0 { padding: 0; }
.text-right { text-align: right; }
.ml-auto { margin-left: auto; }
.is-hidden { display: none !important; }

.rooms-filter-label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); }
.rooms-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.rooms-index-note { font-size: 12px; color: var(--muted); margin-left: 6px; }
.rooms-bar { display: block; height: 100%; }

.fund-filter-form { display: flex; gap: 8px; align-items: center; }
.fund-days-input { width: 90px; }
.fund-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.fund-big { font-size: 34px; font-weight: 700; }
.fund-mid { font-size: 22px; font-weight: 600; }

.tm-create-modal {
  display: none; position: fixed; inset: 0; z-index: 1000;
  background: rgba(0, 0, 0, .5); align-items: center; justify-content: center;
}
.tm-create-modal.open { display: flex; }
.tm-create-dialog { width: 90%; max-width: 400px; margin: 0; }
.tm-create-actions { margin-top: 20px; display: flex; gap: 8px; justify-content: flex-end; }

.btn-info {
  background: var(--info-bg); color: var(--info);
  border: 1px solid var(--info-border, var(--border));
  padding: 8px 16px; border-radius: 6px; font-weight: 600;
  cursor: pointer; width: auto; margin: 0;
}
.password-card { max-width: 480px; }
.room-crumb-sm { font-size: 12px; color: var(--muted); }
.dash-source-card { padding: 0 14px; margin-bottom: 8px; }


/* Stage 4: backlog list; cards below 900px, no horizontal scroll. */
.backlog-cards { display: none; }
.backlog-table-wrap { margin: 0; }
.backlog-item {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.backlog-item-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.backlog-item form { margin: 0; }
.backlog-item .btn { width: 100%; }
@media (max-width: 900px) {
  .backlog-table-wrap { display: none; }
  .backlog-cards { display: grid; gap: 12px; }
}


/* WCF adapter: colour only, text remains readable in both themes. */
.wcf-version-select.wcf-ok { border-color: var(--primary); }
.wcf-version-select.wcf-untested,
.wcf-version-select.wcf-mismatch { border-color: var(--warn-solid); }
.wcf-version-select.wcf-unsupported { border-color: var(--danger-solid); }


/* /admin/settings/access/users: aligned columns, Variant A. */
.users-table { table-layout: fixed; width: 100%; min-width: 1020px; }
.users-table col.uc-id { width: 36px; }
.users-table col.uc-login { width: 86px; }
.users-table col.uc-name { width: 165px; }
.users-table col.uc-position { width: 125px; }
.users-table col.uc-email { width: 145px; }
.users-table col.uc-role { width: 105px; }
.users-table col.uc-status { width: 70px; }
.users-table col.uc-password { width: 125px; }
.users-table col.uc-actions { width: 180px; }
.users-table th, .users-table td { vertical-align: middle; }
.users-table th { white-space: nowrap; }
.users-table td { overflow: hidden; text-overflow: ellipsis; }
.users-table td:nth-child(1) { text-align: right; color: var(--muted); }
.users-table td:nth-child(7) { text-align: center; }
.users-table td:nth-child(9), .users-table th:nth-child(9) { text-align: right; overflow: visible; }
.users-table .row-edit-input { width: 100%; box-sizing: border-box; }
.users-table .actions-wrapper { justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
.users-table .view-field, .users-table .edit-field { min-width: 0; }
.users-table .actions-cell { overflow: visible; }


/* Users admin: Variant A dense table. */
.users-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap;
  padding: 12px; margin-bottom: 16px; }
.users-search { position: relative; flex: 1 1 260px; min-width: 180px; max-width: none; }
.users-search input { width: 100%; height: 38px; border: 1px solid var(--border);
  border-radius: 10px; padding: 0 36px 0 12px; background: var(--surface-2);
  color: var(--text); }
.users-search span { position: absolute; right: 12px; top: 10px; color: var(--muted); }
.users-select { height: 38px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); padding: 0 10px;
  flex: 0 0 180px; width: 180px; max-width: 180px; }
.users-count { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.users-group { margin-bottom: 16px; overflow: visible; }
.users-group-head { display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; border-bottom: 1px solid var(--border); }
.users-group-head > div { display: flex; align-items: center; gap: 8px; }
.users-group-head h2 { margin: 0; font-size: 13px; text-transform: uppercase;
  letter-spacing: .07em; }
.users-group-head a { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.users-table { table-layout: fixed; width: 100%; min-width: 720px; }
.users-table col.uc-user { width: 38%; }
.users-table col.uc-position { width: 20%; }
.users-table col.uc-last { width: 17%; }
.users-table col.uc-status { width: 11%; }
.users-table col.uc-actions { width: 14%; }
.users-table th, .users-table td { vertical-align: middle; }
.users-table th { white-space: nowrap; }
.users-table td { overflow: hidden; text-overflow: ellipsis; }
.users-table td.actions-cell { overflow: visible; }
.users-table .user-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.users-table .user-cell > div:last-child { min-width: 0; }
.users-table .user-cell b { display: block; font-size: 13px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.users-table .user-cell small { display: block; color: var(--muted); font-size: 11px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-avatar { width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; background: var(--primary-light, var(--surface-3));
  color: var(--primary); font-weight: 800; font-size: 11px; }
.users-table .last-activity { color: var(--muted); font-size: 12px; }
.users-table td:nth-child(4) { text-align: center; }
.users-table .th-actions, .users-table td.actions-cell { text-align: right; }
.users-table .actions-cell { white-space: nowrap; }
.row-menu { display: inline-block; position: relative; vertical-align: middle; }
.row-menu summary { list-style: none; cursor: pointer; }
.row-menu summary::-webkit-details-marker { display: none; }
.row-menu-panel { position: absolute; right: 0; top: 28px; z-index: 20;
  min-width: 150px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow); padding: 5px; }
.row-menu-panel form { margin: 0; }
.row-menu-item { width: 100%; border: 0; background: transparent; color: var(--text);
  text-align: left; padding: 8px 9px; border-radius: 7px; cursor: pointer; font-size: 12px; }
.row-menu-item:hover { background: var(--surface-2); }
.row-menu-item.danger { color: var(--danger); }
.row-menu-item:disabled { color: var(--muted); cursor: not-allowed; }
.users-table .icon-btn { margin-left: 3px; }
.users-empty { padding: 28px; color: var(--muted); text-align: center; }

.admin-dialog { width: min(560px, calc(100vw - 32px)); border: 1px solid var(--border);
  border-radius: 16px; background: var(--surface); color: var(--text);
  box-shadow: var(--shadow); padding: 0; }
.admin-dialog::backdrop { background: rgba(10, 15, 30, .46); }
.dialog-head { display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--border); }
.dialog-head h2 { margin: 0; font-size: 17px; }
.dialog-close { border: 0; background: transparent; color: var(--muted);
  font-size: 22px; line-height: 1; cursor: pointer; }
.dialog-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  padding: 16px 18px; }
.dialog-grid label { display: grid; gap: 5px; font-size: 12px; color: var(--muted); }
.dialog-grid label.span-2 { grid-column: 1 / -1; }
.dialog-grid input, .dialog-grid select { height: 36px; border: 1px solid var(--border);
  border-radius: 9px; padding: 0 10px; background: var(--surface-2); color: var(--text);
  width: 100%; box-sizing: border-box; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 18px 16px; border-top: 1px solid var(--border); }
.admin-dialog > form > .hint, .admin-dialog > form > label { margin: 14px 18px; }
.admin-dialog > form > label { display: grid; gap: 5px; font-size: 12px; color: var(--muted); }
.admin-dialog > form > label input { height: 36px; border: 1px solid var(--border);
  border-radius: 9px; padding: 0 10px; background: var(--surface-2); color: var(--text); }

@media (max-width: 760px) {
  .users-toolbar { flex-wrap: wrap; }
  .users-toolbar .users-search { flex-basis: 100%; max-width: none; }
  .users-toolbar .users-select { flex: 1 1 45%; width: auto; max-width: none; }
  .users-count { width: 100%; margin-left: 0; }
  .users-table { min-width: 0; }
  .users-table thead { display: none; }
  .users-table tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
  .users-table tbody td { display: block; padding: 0; border: 0; }
  .users-table tbody td:nth-child(1) { grid-column: 1 / -1; grid-row: 1; }
  .users-table tbody td:nth-child(2) { display: none; }
  .users-table tbody td:nth-child(3) { grid-column: 1; grid-row: 3; }
  .users-table tbody td:nth-child(4) { grid-column: 1; grid-row: 2; text-align: left; }
  .users-table tbody td:nth-child(5) { grid-column: 2; grid-row: 2 / 4; align-self: center; }
  .users-table .user-cell b, .users-table .user-cell small { white-space: normal; }
  .page-head > .topbar-actions { width: 100%; display: flex; gap: 8px; }
  .page-head > .topbar-actions .btn { width: auto; flex: 1; }
  .users-table .last-activity { font-size: 10.5px; }
  .dialog-grid { grid-template-columns: 1fr; }
  .dialog-grid label.span-2 { grid-column: auto; }
}


/* Variant A: one table, role group rows inside it. */
.users-table-card, .users-table-wrap { overflow: visible; }
.users-table { overflow: visible; }
.users-table .users-group-row td {
  padding: 0; background: var(--surface-2); border-bottom: 1px solid var(--border);
  overflow: visible;
}
.users-table .users-group-head { padding: 11px 16px; }
.users-table .users-group-row:hover td { background: var(--surface-2); }
.users-table .users-group-row .users-group-head h2 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .07em;
}
.users-table .users-group-row .users-group-head a { font-size: 11px; }

@media (max-width: 760px) {
  .users-table tbody tr.users-group-row {
    display: block; padding: 0; border-bottom: 1px solid var(--border);
  }
  .users-table tbody tr.users-group-row td { display: block; }
  .users-table .users-group-head { padding: 11px 14px; }
}


/* ---------- Theme-aware glass (System → General) ---------- */
html[data-glass="on"] .topbar {
  background: color-mix(in srgb, var(--topbar-brand) var(--glass-alpha), transparent);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border-bottom-color: color-mix(in srgb, var(--border) 70%, transparent);
}
html[data-glass="on"] .sidebar {
  background: color-mix(in srgb, var(--sidebar-brand) calc(var(--glass-alpha) + 22%), transparent);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}
html[data-glass="on"] .b-modal-card,
html[data-glass="on"] .admin-dialog,
html[data-glass="on"] .dialog-card,
html[data-glass="on"] .modal-content,
html[data-glass="on"] .dialog-form,
html[data-glass="on"] .wb-dialog,
html[data-glass="on"] .wb-order-dialog,
html[data-glass="on"] .settings-modal-box,
html[data-glass="on"] .sync-modal {
  background: color-mix(in srgb, var(--modal-brand) var(--glass-alpha), transparent);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}
html[data-glass="off"][data-topbar-custom="1"] .topbar { background: var(--topbar-brand); }
html[data-glass="off"][data-sidebar-custom="1"] .sidebar { background: var(--sidebar-brand); }
html[data-glass="off"][data-modal-custom="1"] .b-modal-card,
html[data-glass="off"][data-modal-custom="1"] .admin-dialog,
html[data-glass="off"][data-modal-custom="1"] .dialog-card,
html[data-glass="off"][data-modal-custom="1"] .modal-content,
html[data-glass="off"][data-modal-custom="1"] .dialog-form,
html[data-glass="off"][data-modal-custom="1"] .wb-dialog,
html[data-glass="off"][data-modal-custom="1"] .wb-order-dialog,
html[data-glass="off"][data-modal-custom="1"] .settings-modal-box,
html[data-glass="off"][data-modal-custom="1"] .sync-modal { background: var(--modal-brand); }
html[data-glass="off"] .topbar {
  background: var(--surface);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
html[data-glass="off"] .sidebar {
  background: var(--sidebar-brand);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
html[data-glass="off"] .b-modal-card,
html[data-glass="off"] .admin-dialog,
html[data-glass="off"] .dialog-card,
html[data-glass="off"] .modal-content,
html[data-glass="off"] .dialog-form,
html[data-glass="off"] .wb-dialog,
html[data-glass="off"] .wb-order-dialog,
html[data-glass="off"] .settings-modal-box,
html[data-glass="off"] .sync-modal {
  background: var(--surface);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
@supports not ((backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px))) {
  html[data-glass="on"] .topbar { background: var(--surface); }
  html[data-glass="on"] .sidebar { background: var(--sidebar-brand); }
  html[data-glass="on"] .b-modal-card,
  html[data-glass="on"] .admin-dialog,
  html[data-glass="on"] .dialog-card,
  html[data-glass="on"] .modal-content,
  html[data-glass="on"] .dialog-form,
  html[data-glass="on"] .wb-dialog,
  html[data-glass="on"] .wb-order-dialog,
  html[data-glass="on"] .settings-modal-box,
  html[data-glass="on"] .sync-modal { background: var(--surface); }
}


/* ---------- Global controls: buttons, switches, action icons ---------- */
.btn, a.btn, .btn:hover, .btn:focus, .btn:active, .btn:visited {
  text-decoration: none;
}
.btn {
  border: 1px solid transparent;
  transition: background .15s ease, border-color .15s ease,
              color .15s ease, box-shadow .15s ease, transform .06s ease;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.btn.secondary {
  background: var(--surface-3);
  color: var(--text);
  border-color: var(--border);
}
.btn.secondary:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}
.btn.secondary:active { background: var(--surface-3); }
.btn.danger:active { filter: brightness(.9); }

.ui-action-with-icon { gap: 6px; }
.ui-action-icon { display: inline-flex; align-items: center; justify-content: center; }
.ui-action-icon svg { width: 14px; height: 14px; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ui-icon-action {
  width: 30px; height: 28px; padding: 0; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-3); color: var(--text) !important;
  border: 1px solid var(--border);
}
.ui-icon-action svg {
  width: 15px; height: 15px; fill: none; stroke: currentColor;
  stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round;
}
.ui-icon-action:hover { background: var(--surface-2); border-color: var(--border-strong); }
.ui-icon-action:active { transform: translateY(1px); }
.ui-icon-action.ui-action-danger { color: var(--danger) !important; }
.ui-action-with-icon.ui-action-danger { color: inherit; }
.ui-icon-action.ui-action-danger:hover { background: var(--danger-bg); border-color: var(--danger-border); }
.ui-toggle-action {
  position: relative; width: 42px; height: 24px; min-width: 42px; padding: 0;
  border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--surface-3); vertical-align: middle; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.ui-toggle-action::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm);
  transition: transform .15s;
}
.ui-toggle-action.is-on { background: var(--primary-btn); border-color: var(--primary-btn); }
.ui-toggle-action.is-on::after { transform: translateX(18px); }
.ui-toggle-action:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.ui-toggle-action:disabled { opacity: .5; cursor: not-allowed; }

/* Standalone checkboxes are switches; table/matrix selection stays native. */
input[type="checkbox"]:not(.no-switch) {
  appearance: none; -webkit-appearance: none;
  width: 40px !important; height: 22px !important; flex: 0 0 auto;
  margin: 0 7px 0 0; padding: 0 !important;
  border: 1px solid var(--border-strong); border-radius: 999px;
  background-color: var(--surface-3); background-repeat: no-repeat;
  background-image: radial-gradient(circle at 11px 50%, #fff 0 7px, transparent 7.5px);
  vertical-align: middle; cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
input[type="checkbox"]:not(.no-switch):checked {
  background-color: var(--primary-btn); border-color: var(--primary-btn);
  background-image: radial-gradient(circle at 29px 50%, #fff 0 7px, transparent 7.5px);
}
input[type="checkbox"]:not(.no-switch):focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px;
}
input[type="checkbox"]:not(.no-switch):disabled { opacity: .5; cursor: not-allowed; }

table input[type="checkbox"]:not(.no-switch),
.matrix input[type="checkbox"]:not(.no-switch),
.perm-matrix input[type="checkbox"]:not(.no-switch),
[data-matrix] input[type="checkbox"]:not(.no-switch),
.check-policy input[type="checkbox"]:not(.no-switch) {
  appearance: auto !important; -webkit-appearance: auto !important;
  width: 16px !important; height: 16px !important; flex: none !important;
  margin: 0 !important; padding: 0 !important;
  border: initial !important; border-radius: initial !important;
  background: initial !important; background-image: none !important;
  cursor: pointer;
}


/* Permission matrix and existing custom switches keep native/own visuals. */
.perm-row input[type="checkbox"]:not(.no-switch),
.data-row input[type="checkbox"]:not(.no-switch),
.access-drawer input[type="checkbox"]:not(.no-switch) {
  appearance: auto !important; -webkit-appearance: auto !important;
  width: 17px !important; height: 17px !important; margin: 0 !important;
  border: initial !important; border-radius: initial !important;
  background: initial !important; background-image: none !important;
}
.switch input[type="checkbox"] {
  appearance: auto !important; -webkit-appearance: auto !important;
  width: 0 !important; height: 0 !important; margin: 0 !important;
  border: 0 !important; background: transparent !important;
  background-image: none !important;
}
.brand-switch input[type="checkbox"] {
  appearance: auto !important; -webkit-appearance: auto !important;
  width: 100% !important; height: 100% !important; margin: 0 !important;
  border: 0 !important; background: transparent !important;
  background-image: none !important; opacity: 0 !important;
}


/* Users row actions: pencil + switch + trash. */
.users-table .row-actions {
  display: inline-flex; align-items: center; justify-content: flex-end;
  gap: 5px; white-space: nowrap;
}
.users-table .row-action-form { display: inline-flex; margin: 0; }
.users-table .row-toggle.ui-toggle-action {
  width: 34px; height: 20px; min-width: 34px;
}
.users-table .row-toggle.ui-toggle-action::after {
  width: 14px; height: 14px; top: 2px; left: 2px;
}
.users-table .row-toggle.ui-toggle-action.is-on::after { transform: translateX(14px); }
.users-table .actions-cell .ui-icon-action { margin: 0; }

/* Logus settings use compact switches. */
.page-logus-settings input[type="checkbox"]:not(.no-switch) {
  width: 30px !important; height: 16px !important;
  background-image: radial-gradient(circle at 8px 50%, #fff 0 5.5px, transparent 6px);
}
.page-logus-settings input[type="checkbox"]:not(.no-switch):checked {
  background-image: radial-gradient(circle at 22px 50%, #fff 0 5.5px, transparent 6px);
}


/* Glass presets: readability first. */
:root { --glass-blur: 18px; --glass-sat: 150%; }
html[data-glass-kind="aero"] { --glass-blur: 18px; --glass-sat: 150%; }
html[data-glass-kind="vista"] { --glass-blur: 26px; --glass-sat: 185%; }
html[data-glass-kind="clear"] { --glass-blur: 30px; --glass-sat: 120%; }
html[data-glass-kind="solid"] { --glass-blur: 0px; --glass-sat: 100%; }
html[data-glass="on"] .topbar,
html[data-glass="on"] .sidebar,
html[data-glass="on"] .b-modal-card,
html[data-glass="on"] .admin-dialog,
html[data-glass="on"] .dialog-card,
html[data-glass="on"] .modal-content,
html[data-glass="on"] .dialog-form,
html[data-glass="on"] .wb-dialog,
html[data-glass="on"] .wb-order-dialog,
html[data-glass="on"] .settings-modal-box,
html[data-glass="on"] .sync-modal {
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
}
html[data-glass="on"] .settings-rail {
  background: color-mix(in srgb, var(--modal-brand) var(--glass-alpha), transparent);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
}




/* Task board selection checkboxes are not toggles. */
.tm-cb,
.tm-selectall input,
.tm-pick input,
.tm-node-hd .tm-pick input {
  appearance: auto !important; -webkit-appearance: auto !important;
  width: 15px !important; height: 15px !important;
  margin: 0 !important; padding: 0 !important;
  border: initial !important; border-radius: initial !important;
  background: initial !important; background-image: none !important;
  cursor: pointer;
}


/* Bindings status toggle and user row actions. */
.bind-toggle-form { margin: 0; display: flex; justify-content: center; }
.bind-toggle-form .ui-toggle-action.is-on {
  background: var(--ok-solid, #16a34a) !important;
  border-color: var(--ok-solid, #16a34a) !important;
}
.users-table .user-cell { align-items: flex-start; text-align: left; }
.users-table .user-cell > div:last-child { text-align: left; }
.users-table .user-cell b, .users-table .user-cell small { text-align: left; }
.users-table .row-actions .ui-icon-action:not(.ui-action-danger) {
  color: var(--primary) !important; background: var(--primary-light);
}
.users-table .row-actions .ui-icon-action:hover {
  color: var(--primary) !important; background: var(--primary-light);
}
.users-table .row-actions .ui-action-danger { color: var(--danger) !important; }
.users-table .row-actions .ui-action-danger:hover { background: var(--danger-bg); }


/* Sessions and devices in System settings. */
.sessions-table .uc-platform { width: 100px; }
.sessions-table .uc-device { width: 27%; }
.sessions-table .uc-last { width: 210px; }
.sessions-table .uc-status { width: 120px; }
.sessions-table .uc-actions { width: 108px; }
.sessions-table th { white-space: normal; }
.session-device { color: var(--muted); font-size: 11px; margin-top: 2px; word-break: break-word; }
#devices { margin-top: 16px; }
#devices .users-group-head { padding: 14px 16px 0; }
