/* Манила-веб · дизайн-система (Фаза 0)
   Единый дашборд, а не теле-меню: сайдбар-группы + карточки-действия.
   Тема авто по prefers-color-scheme + ручной тумблер (data-theme на <html>).
   Всё локально, без CDN. Комментарии по-русски, тире - только дефис. */

/* ── Токены темы ─────────────────────────────────────────────── */
:root {
  color-scheme: light dark;

  /* Светлая тема - значения по умолчанию */
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --surface-hover: #eef1f5;
  --border: #e3e6ea;
  --border-strong: #d3d8de;
  --text: #14181f;
  --text-muted: #667085;
  --text-faint: #98a2b3;

  --accent: #0f9d76;          /* энергичный тил-изумруд */
  --accent-strong: #0b7d5e;
  --accent-soft: #e6f6f0;
  --accent-contrast: #ffffff;

  --danger: #d64545;
  --danger-soft: #fbe9e9;
  --warn: #c77700;
  --warn-soft: #fdf1df;
  --info: #2f6fed;
  --info-soft: #e8f0fe;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .05);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, .10), 0 2px 6px rgba(16, 24, 40, .06);
  --shadow-lg: 0 16px 40px rgba(16, 24, 40, .18);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;

  --sidebar-w: 246px;
  --header-h: 60px;
  --maxw: 1180px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

/* Тёмная тема: авто (когда система тёмная и юзер не выбрал светлую вручную) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1014;
    --surface: #171a21;
    --surface-2: #1d212a;
    --surface-hover: #222834;
    --border: #262b36;
    --border-strong: #333a48;
    --text: #e7e9ee;
    --text-muted: #9aa4b2;
    --text-faint: #6b7482;

    --accent: #23c299;
    --accent-strong: #38d4ad;
    --accent-soft: #113029;
    --accent-contrast: #06120e;

    --danger: #ef6b6b;
    --danger-soft: #341c1e;
    --warn: #e0a13a;
    --warn-soft: #33291a;
    --info: #6ea0ff;
    --info-soft: #1a2740;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 6px 18px rgba(0, 0, 0, .45);
    --shadow-lg: 0 20px 48px rgba(0, 0, 0, .6);
  }
}

/* Тёмная тема: ручной выбор (перебивает системную) */
:root[data-theme="dark"] {
  --bg: #0e1014;
  --surface: #171a21;
  --surface-2: #1d212a;
  --surface-hover: #222834;
  --border: #262b36;
  --border-strong: #333a48;
  --text: #e7e9ee;
  --text-muted: #9aa4b2;
  --text-faint: #6b7482;

  --accent: #23c299;
  --accent-strong: #38d4ad;
  --accent-soft: #113029;
  --accent-contrast: #06120e;

  --danger: #ef6b6b;
  --danger-soft: #341c1e;
  --warn: #e0a13a;
  --warn-soft: #33291a;
  --info: #6ea0ff;
  --info-soft: #1a2740;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, .45);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, .6);
}

/* ── База ────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ── Экран логина ────────────────────────────────────────────── */
.auth-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1200px 480px at 50% -10%, var(--accent-soft), transparent 60%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 30px 28px;
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 20px;
  margin-bottom: 4px;
}
.auth-brand .logo { font-size: 26px; }
.auth-sub { color: var(--text-muted); font-size: 13.5px; margin: 0 0 22px; }
.auth-card form { display: grid; gap: 14px; }
.totp-qr-wrap {
  display: grid;
  place-items: center;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.totp-qr {
  width: min(220px, 100%);
  height: auto;
  display: block;
}
.mono-token {
  display: block;
  max-width: 100%;
  padding: 9px 10px;
  overflow-wrap: anywhere;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* ── Поля форм ───────────────────────────────────────────────── */
.field { display: grid; gap: 6px; }
.field > label { font-weight: 600; font-size: 13px; color: var(--text-muted); }
.field .req { color: var(--danger); }
.field .help { font-size: 12px; color: var(--text-faint); }
.input, select.input, textarea.input {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color .12s, box-shadow .12s;
  appearance: none;
}
select.input {
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
                    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}
.input:focus, textarea.input:focus, select.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}
textarea.input { resize: vertical; min-height: 92px; font-family: inherit; }
input[type="file"].input { padding: 8px; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row .field { flex: 1 1 140px; }

/* ── Кнопки ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 14.5px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: background .12s, border-color .12s, transform .04s;
}
.btn:hover { background: var(--surface-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary {
  color: var(--accent-contrast);
  background: var(--accent);
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-danger { color: #fff; background: var(--danger); border-color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-hover); }
.btn-block { width: 100%; }
.btn-lg { padding: 13px 20px; font-size: 16px; }

/* ── Каркас приложения ───────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100dvh;
}

/* Сайдбар */
.sidebar {
  grid-row: 1 / -1;
  position: sticky;
  top: 0;
  align-self: start;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  font-weight: 700;
  font-size: 17px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.sidebar-brand .logo { font-size: 22px; }
.sidebar-nav { padding: 10px 10px 16px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  text-align: left;
  font-weight: 500;
  font-size: 14.5px;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--surface-hover); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; }
.nav-item .nav-count {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-faint);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 1px 8px;
}
.nav-item.active .nav-count { color: var(--accent-strong); background: var(--surface); }
.sidebar-foot {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-faint);
}

/* Область контента */
.main { display: flex; flex-direction: column; min-width: 0; }

/* Шапка */
.header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--header-h);
  padding: 0 20px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.header .burger { display: none; }
.search {
  flex: 1;
  max-width: 520px;
  position: relative;
}
.search input {
  width: 100%;
  padding: 9px 12px 9px 38px;
  font-size: 15px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 999px;
  transition: border-color .12s, background .12s;
}
.search input:focus { background: var(--surface); border-color: var(--accent); outline: none; }
.search .search-ico {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}
.header .spacer { flex: 1; }

/* Плашка пользователя */
.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 8px 5px 5px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 13px;
  color: var(--accent-contrast);
  background: var(--accent);
}
.user-chip .u-name { font-weight: 600; font-size: 13.5px; line-height: 1; }
.user-chip .u-role { font-size: 11.5px; color: var(--text-muted); }
.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 16px;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.logout-form {
  margin: 0;
  display: flex;
}

/* ── Контент дашборда ────────────────────────────────────────── */
.content { padding: 22px 20px 60px; width: 100%; max-width: var(--maxw); margin: 0 auto; }
.page-title { margin: 4px 0 2px; font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.page-sub { margin: 0 0 18px; color: var(--text-muted); font-size: 14px; }

.group-section { margin-bottom: 30px; }
.group-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 12px;
}
.group-head h2 { margin: 0; font-size: 16.5px; font-weight: 700; }
.group-head .g-count { font-size: 12.5px; color: var(--text-faint); }

/* Сетка карточек */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}
.favorites-section {
  margin-bottom: 26px;
  padding-bottom: 4px;
}
.card-shell {
  position: relative;
  display: flex;
  min-width: 0;
}
.fav-toggle {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  color: color-mix(in srgb, var(--text) 62%, transparent);
  font-size: 20px;
  line-height: 1;
  text-shadow: 0 0 1px color-mix(in srgb, var(--surface) 80%, transparent);
  transition: color .12s, background .12s, transform .08s;
}
.fav-toggle:hover,
.fav-toggle:focus-visible {
  color: var(--text);
  background: var(--surface-hover);
  outline: none;
}
.fav-toggle:active { transform: scale(.94); }
.fav-toggle.is-active {
  color: #facc15;
  background: color-mix(in srgb, #facc15 16%, var(--surface));
  text-shadow: 0 0 8px color-mix(in srgb, #facc15 38%, transparent);
}
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  padding: 15px 42px 13px 15px;
  min-height: 96px;
  min-width: 0;                 /* grid-элемент: даём ужиматься, иначе текст лезет за край */
  overflow-wrap: anywhere;      /* длинные слова переносятся, не вылезают из рамки */
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform .08s, box-shadow .14s, border-color .14s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.card:active { transform: translateY(0); }
.card:disabled, .card.is-disabled {
  cursor: not-allowed;
  opacity: .58;
  filter: grayscale(.3);
}
.card:disabled:hover, .card.is-disabled:hover { transform: none; box-shadow: var(--shadow-sm); }
.card-top { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.card-icon { font-size: 22px; line-height: 1; flex-shrink: 0; }
.card-label { flex: 1; min-width: 0; overflow-wrap: anywhere; word-break: break-word; font-weight: 650; font-size: 15px; line-height: 1.25; }
.card-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.card-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }

/* Секция «Расширенные» */
.advanced {
  margin-top: 14px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 4px 14px 14px;
  background: color-mix(in srgb, var(--surface-2) 60%, transparent);
}
.advanced > summary {
  cursor: pointer;
  list-style: none;
  padding: 10px 2px;
  font-weight: 650;
  font-size: 14px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.advanced > summary::-webkit-details-marker { display: none; }
.advanced > summary::before { content: "▸"; transition: transform .15s; }
.advanced[open] > summary::before { transform: rotate(90deg); }

/* ── Бейджи ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 650;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  line-height: 1.5;
}
.badge-instant { color: var(--accent-strong); background: var(--accent-soft); }
.badge-period  { color: var(--info); background: var(--info-soft); }
.badge-form    { color: var(--warn); background: var(--warn-soft); }
.badge-wizard  { color: #8a4fd8; background: color-mix(in srgb, #8a4fd8 14%, transparent); }
.badge-slow    { color: var(--text-muted); background: var(--surface-2); }
.badge-mutating{ color: var(--danger); background: var(--danger-soft); }
.badge-neutral { color: var(--text-muted); background: var(--surface-2); }

/* Плашка «данные неполны» */
.degraded {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 13px;
  margin: 0 0 16px;
  font-size: 13.5px;
  color: var(--warn);
  background: var(--warn-soft);
  border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  border-radius: var(--radius-sm);
}
.degraded .d-ico { flex-shrink: 0; }
.degraded ul { margin: 4px 0 0; padding-left: 18px; }

/* ── Панель-выезд (drawer) для действия ──────────────────────── */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 20, .42);
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s, visibility .2s;
  z-index: 40;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100dvh;
  width: min(560px, 100%);
  transform: translateX(100%);
  transition: transform .24s cubic-bezier(.4, 0, .2, 1);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 41;
  display: flex;
  flex-direction: column;
}
body.drawer-open .drawer-backdrop { opacity: 1; visibility: visible; }
body.drawer-open .drawer { transform: translateX(0); }
.drawer-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
}
.drawer-head .d-title { font-weight: 700; font-size: 16px; flex: 1; min-width: 0; }
.drawer-body { padding: 18px; overflow-y: auto; flex: 1; }

.action-meta { color: var(--text-muted); font-size: 13.5px; margin: 0 0 16px; }
.action-form { display: grid; gap: 15px; }
.form-note {
  font-size: 12.5px;
  color: var(--text-faint);
  display: flex;
  gap: 6px;
  align-items: center;
}
.confirm-box {
  display: flex;
  gap: 9px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  border: 1px solid color-mix(in srgb, var(--danger) 32%, transparent);
  font-size: 13.5px;
  color: var(--danger);
}
.confirm-box input { margin-top: 3px; }

/* ── Результат ───────────────────────────────────────────────── */
.result { margin-top: 18px; }
.result:empty { margin: 0; }
.result-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  margin: 0;
  overflow-x: auto;
}
.result-error {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 32%, transparent);
  font-family: var(--font);
}
.files { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.file-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color .12s, background .12s;
}
.file-row:hover { border-color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.file-ico { font-size: 20px; }
.file-name { flex: 1; font-weight: 600; font-size: 14px; color: var(--text); word-break: break-word; }
.file-dl { font-size: 12.5px; color: var(--accent-strong); font-weight: 650; }

/* Картинки-превью (PNG-отчёты) - по сессионным URL, не base64 */
.result-img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-top: 14px;
  display: block;
}

/* ── Задача (поллинг) ────────────────────────────────────────── */
.job {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.job .job-txt { font-weight: 600; }
.job .job-note { font-size: 12.5px; color: var(--text-muted); font-weight: 400; margin-top: 2px; }

/* Спиннер */
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid color-mix(in srgb, var(--accent) 28%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
.spinner-sm { width: 15px; height: 15px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Индикатор htmx (спиннер на кнопке во время запроса) */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-flex; }
.htmx-request.htmx-indicator { display: inline-flex; }
.htmx-request .btn-label-idle { display: none; }

/* Пустое состояние поиска */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .es-ico { font-size: 40px; opacity: .6; }
.empty-state p { margin: 10px 0 0; }

/* Тост-ошибки (htmx:responseError) */
.toast-host {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(440px, calc(100% - 32px));
}
.toast {
  padding: 12px 15px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--danger);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  animation: toast-in .2s ease;
}
.toast .t-ico { color: var(--danger); }
.toast button { margin-left: auto; border: 0; background: transparent; color: var(--text-faint); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.alert-inline {
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 12px;
}
.alert-error { color: var(--danger); background: var(--danger-soft); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); }
.alert-info  { color: var(--info); background: var(--info-soft); border: 1px solid color-mix(in srgb, var(--info) 30%, transparent); }

/* ── Мобильная вёрстка (команда с телефонов) ─────────────────── */
.backdrop-nav {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 20, .42);
  opacity: 0; visibility: hidden;
  transition: opacity .2s, visibility .2s;
  z-index: 29;
}

@media (max-width: 860px) {
  :root { --sidebar-w: 260px; }
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    width: var(--sidebar-w);
    transform: translateX(-100%);
    transition: transform .22s cubic-bezier(.4, 0, .2, 1);
    z-index: 30;
    box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .backdrop-nav { opacity: 1; visibility: visible; }
  .header .burger {
    display: grid;
    place-items: center;
    width: 40px; height: 40px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 18px;
    flex-shrink: 0;
  }
  .content { padding: 18px 14px 60px; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .card { min-height: 84px; padding: 13px; }
  .drawer { width: 100%; }
  .user-chip .u-meta { display: none; }
  .header { padding: 0 12px; gap: 8px; }
}

@media (max-width: 460px) {
  .cards { grid-template-columns: 1fr 1fr; }
  .card-label { font-size: 14px; }
  .card-icon { font-size: 20px; }
  .page-title { font-size: 19px; }
}

/* Уважать «уменьшить движение» */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .spinner { animation: spin 1s linear infinite; }
}
