/* ==========================================================================
   Аренда ТЦ — стайлшит приложения
   Светлый минимализм. Мобильный — первый. Без фреймворков и внешних CDN.
   Порядок секций:
     1. Токены
     2. Сброс и база
     3. Типографика
     4. Утилиты раскладки и отступов
     5. Каркас: topbar, sidebar, content, tabbar, fab
     6. Карточки
     7. Кнопки
     8. Статус-таблетки и чипы
     9. Формы
    10. Фото-поле
    11. Инструкции (шаги)
    12. Таблицы
    13. Прогресс
    14. Шторка снизу
    15. Тосты
    16. Пустые состояния
    17. Прочее: divider, avatar, stat
    18. Широкий экран (min-width: 900px)
    19. Служебное: печать, reduced motion
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Токены
   -------------------------------------------------------------------------- */

:root {
  /* Цвет */
  --bg: #FFFFFF;
  --surface: #F7F9FC;
  --surface-alt: #EEF3FA;
  --border: #E4EAF2;

  --text: #1F2937;
  --text-muted: #6B7280;
  --text-invert: #FFFFFF;

  --primary: #3B82F6;
  --primary-hover: #2563EB;
  --primary-soft: #DCEBFB;

  --tint-blue: #E8F1FD;
  --tint-peach: #FDE9DE;
  --tint-mint: #E4F5EC;
  --tint-lilac: #EFE9FB;

  --success: #16A34A;
  --warning: #F59E0B;
  --danger: #DC2626;
  --info: #3B82F6;
  --neutral: #94A3B8;

  /* Производные мягкие подложки статусов */
  --danger-soft: #FDECEC;
  --warning-soft: #FEF3E2;
  --success-soft: var(--tint-mint);
  --success-ink: #14532D;
  --danger-ink: #991B1B;
  --warning-ink: #92400E;
  --info-ink: #1E40AF;
  --neutral-ink: #475569;

  /* Геометрия */
  --radius-field: 12px;
  --radius-card: 16px;
  --radius-block: 20px;
  --radius-pill: 999px;

  /* Тень одна, мягкая */
  --shadow: 0 2px 8px rgba(31, 41, 55, .06);

  /* Отступы: сетка 4px */
  --gap-screen: 16px;
  --pad-card: 16px;

  /* Зоны нажатия */
  --tap: 44px;
  --tap-primary: 52px;

  /* Прочее */
  --topbar-h: 56px;
  --tabbar-h: 60px;
  --content-max: 1200px;
  --font: -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
  --transition: .18s ease;
}

/* --------------------------------------------------------------------------
   2. Сброс и база
   -------------------------------------------------------------------------- */

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 24px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
}

img,
svg,
video,
canvas { max-width: 100%; height: auto; }

a {
  color: var(--primary);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

a:hover { color: var(--primary-hover); }

button,
input,
select,
textarea { font: inherit; color: inherit; }

/* Атрибут hidden должен побеждать любые display из компонентов */
[hidden] { display: none !important; }

/* Единый фокус для клавиатуры */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 6px;
}

/* --------------------------------------------------------------------------
   3. Типографика
   -------------------------------------------------------------------------- */

.h1 {
  margin: 0;
  font-size: 24px;
  line-height: 32px;
  font-weight: 600;
  letter-spacing: -.01em;
}

.h2 {
  margin: 0;
  font-size: 18px;
  line-height: 26px;
  font-weight: 600;
}

.muted {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 20px;
}

.small {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-muted);
}

.big-amount {
  font-size: 30px;
  line-height: 36px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}

.mono-nums {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* --------------------------------------------------------------------------
   4. Утилиты раскладки и отступов
   -------------------------------------------------------------------------- */

.row {
  display: flex;
  flex-direction: row;
  align-items: center;
}

.col {
  display: flex;
  flex-direction: column;
}

.flex {
  display: flex;
  align-items: center;
  gap: 8px;
}

.between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.center {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.wrap { flex-wrap: wrap; }

.grid {
  display: grid;
  gap: 12px;
}

.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.hidden { display: none; }

.text-right { text-align: right; }

.grow { flex: 1 1 auto; min-width: 0; }

/* --------------------------------------------------------------------------
   5. Каркас приложения
   -------------------------------------------------------------------------- */

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--topbar-h);
  padding: 8px var(--gap-screen);
  background: rgba(255, 255, 255, .94);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}

.topbar-title {
  margin: 0;
  font-size: 18px;
  line-height: 26px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Боковое меню на телефоне скрыто, показывается с 900px */
.sidebar { display: none; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--tap);
  padding: 10px 12px;
  border-radius: var(--radius-field);
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}

.sidebar-link:hover {
  background: var(--surface);
  color: var(--text);
}

.sidebar-link.active {
  background: var(--primary-soft);
  color: var(--primary-hover);
  font-weight: 600;
}

.content {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--gap-screen);
  /* место под таб-бар и «шторку» iPhone */
  padding-bottom: calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom));
}

/* Нижний таб-бар — только телефон */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  align-items: stretch;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}

.tabbar-item {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: var(--tabbar-h);
  padding: 6px 4px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 16px;
  text-align: center;
  transition: color var(--transition);
}

.tabbar-item:hover { color: var(--text); }

.tabbar-item.active {
  color: var(--primary);
  font-weight: 600;
}

.tabbar-item svg,
.tabbar-item .icon { width: 22px; height: 22px; }

/* Плавающая кнопка главного действия */
.fab {
  position: fixed;
  right: var(--gap-screen);
  bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom));
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: var(--text-invert);
  box-shadow: 0 6px 16px rgba(59, 130, 246, .32);
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}

.fab:hover { background: var(--primary-hover); }
.fab:active { transform: scale(.96); }
.fab svg { width: 26px; height: 26px; }

/* --------------------------------------------------------------------------
   6. Карточки
   -------------------------------------------------------------------------- */

.card {
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: var(--pad-card);
  box-shadow: var(--shadow);
}

.card-title {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 26px;
  font-weight: 600;
}

.card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--tap);
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.card-row:last-child { border-bottom: 0; }

/* Кликабельная карточка/строка со стрелкой */
.card-link {
  position: relative;
  display: block;
  padding-right: 32px;
  color: inherit;
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
}

.card-link::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 14px;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  border-right: 2px solid var(--neutral);
  border-bottom: 2px solid var(--neutral);
  transform: rotate(-45deg);
}

.card-link:hover {
  background: var(--primary-soft);
  color: inherit;
}

.card-link:active { transform: scale(.995); }

/* Пастельные варианты (информационные блоки) */
.card-tint-blue { background: var(--tint-blue); box-shadow: none; }
.card-tint-peach { background: var(--tint-peach); box-shadow: none; }
.card-tint-mint { background: var(--tint-mint); box-shadow: none; }
.card-tint-lilac { background: var(--tint-lilac); box-shadow: none; }

/* --------------------------------------------------------------------------
   7. Кнопки
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: var(--surface-alt);
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  line-height: 20px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: .5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: var(--text-invert);
  min-height: var(--tap-primary);
}

.btn-primary:hover { background: var(--primary-hover); color: var(--text-invert); }

.btn-secondary {
  background: var(--primary-soft);
  color: var(--primary-hover);
}

.btn-secondary:hover { background: #CFE3F9; color: var(--primary-hover); }

.btn-ghost {
  background: transparent;
  color: var(--primary);
}

.btn-ghost:hover { background: var(--surface); color: var(--primary-hover); }

.btn-danger {
  background: var(--danger);
  color: var(--text-invert);
}

.btn-danger:hover { background: #B91C1C; color: var(--text-invert); }

.btn-block {
  display: flex;
  width: 100%;
}

.btn-sm {
  min-height: 36px;
  padding: 0 14px;
  font-size: 14px;
  line-height: 18px;
}

/* Основная кнопка формы — заметно крупнее на телефоне */
.btn.btn-primary.btn-block { min-height: var(--tap-primary); }

/* --------------------------------------------------------------------------
   8. Статус-таблетки и чипы
   -------------------------------------------------------------------------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-alt);
  color: var(--text-muted);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  white-space: nowrap;
}

.pill-success { background: var(--success-soft); color: var(--success-ink); }
.pill-warning { background: var(--warning-soft); color: var(--warning-ink); }
.pill-danger { background: var(--danger-soft); color: var(--danger-ink); }
.pill-info { background: var(--tint-blue); color: var(--info-ink); }
.pill-neutral { background: var(--surface-alt); color: var(--neutral-ink); }

/* Чип-фильтр: та же форма, но крупнее и кликабельный */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.chip:hover { background: var(--surface); color: var(--text); }

.chip.active {
  background: var(--primary-soft);
  border-color: transparent;
  color: var(--primary-hover);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   9. Формы
   -------------------------------------------------------------------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.field-label {
  font-size: 14px;
  line-height: 20px;
  color: var(--text-muted);
  font-weight: 500;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-field);
  background: var(--surface);
  color: var(--text);
  /* 16px — чтобы iOS не масштабировал страницу при фокусе */
  font-size: 16px;
  line-height: 24px;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.textarea {
  min-height: 96px;
  resize: vertical;
}

.input::placeholder,
.textarea::placeholder { color: var(--neutral); }

.input:hover,
.select:hover,
.textarea:hover { border-color: #D3DCE8; }

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  background: var(--bg);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.input:disabled,
.select:disabled,
.textarea:disabled {
  background: var(--surface-alt);
  color: var(--text-muted);
  cursor: not-allowed;
}

.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  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) 21px, calc(100% - 13px) 21px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

/* Поле с ошибкой */
.field.has-error .input,
.field.has-error .select,
.field.has-error .textarea,
.input.is-invalid {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.field-error {
  font-size: 14px;
  line-height: 20px;
  color: var(--danger);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
  padding: 4px 0;
  font-size: 16px;
  cursor: pointer;
}

.checkbox-row input[type="checkbox"],
.checkbox-row input[type="radio"] {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Подсказка под числовым полем счётчика */
.meter-hint {
  font-size: 14px;
  line-height: 20px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.meter-hint.is-empty { visibility: hidden; }

/* Плашка «нет сети» */
.offline-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  padding: 8px 12px;
  border-radius: var(--radius-field);
  background: var(--tint-peach);
  color: var(--warning-ink);
  font-size: 14px;
  line-height: 20px;
}

.offline-note::before { content: "⚠"; font-size: 15px; }

/* --------------------------------------------------------------------------
   10. Фото-поле
   -------------------------------------------------------------------------- */

.photo-field {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.photo-field-preview {
  display: none;
  position: relative;
  border-radius: var(--radius-field);
  overflow: hidden;
  background: var(--surface-alt);
}

.photo-field.has-photo .photo-field-preview { display: block; }

.photo-field-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.photo-field-value {
  font-size: 32px;
  line-height: 40px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.photo-field-badge {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-alt);
  color: var(--text-muted);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
}

.photo-field-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* До выбора фото — только кнопка съёмки, после — только «переснять» */
.photo-field [data-photo-retake] { display: none; }
.photo-field.has-photo [data-photo-retake] { display: inline-flex; }
.photo-field.has-photo [data-photo-pick] { display: none; }

/* Сам input прячем визуально, но оставляем кликабельным программно */
.photo-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   11. Инструкции (шаги)
   -------------------------------------------------------------------------- */

.steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.step-num {
  flex: 0 0 auto;
  min-width: 40px;
  color: var(--primary);
  font-size: 24px;
  line-height: 32px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.step-title {
  font-size: 16px;
  line-height: 24px;
  font-weight: 600;
}

.step-text {
  margin: 2px 0 0;
  font-size: 14px;
  line-height: 20px;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   12. Таблицы
   Мобильный вид (.table-stack) — карточки, с 900px — обычная таблица.
   -------------------------------------------------------------------------- */

.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 22px;
}

.table th {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}

.table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tbody tr:nth-child(even) { background: var(--surface-alt); }

.table .num,
.table td.num,
.table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* --- .table-stack, мобильный вид: строки становятся карточками --- */

.table-stack thead {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.table-stack,
.table-stack tbody,
.table-stack tr,
.table-stack td { display: block; width: 100%; }

.table-stack tr {
  margin-bottom: 12px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--bg);
  box-shadow: var(--shadow);
}

.table-stack tbody tr:nth-child(even) { background: var(--bg); }

.table-stack td {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  text-align: right;
}

.table-stack tr td:last-child { border-bottom: 0; }

.table-stack td::before {
  content: attr(data-label);
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 20px;
  text-align: left;
}

/* Пустая ячейка (например, колонка действий) не тянет строку */
.table-stack td:empty { display: none; }

/* --------------------------------------------------------------------------
   13. Прогресс
   -------------------------------------------------------------------------- */

.progress {
  width: 100%;
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-alt);
  overflow: hidden;
}

.progress > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--primary);
  transition: width .3s ease;
}

.progress-bar {
  height: 100%;
  width: 0;
  border-radius: var(--radius-pill);
  background: var(--primary);
  transition: width .3s ease;
}

.progress-bar > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.progress-bar.is-success,
.progress-bar.is-success > i { background: var(--success); }

.progress-bar.is-warning,
.progress-bar.is-warning > i { background: var(--warning); }

.progress-bar.is-danger,
.progress-bar.is-danger > i { background: var(--danger); }

/* --------------------------------------------------------------------------
   14. Шторка снизу
   -------------------------------------------------------------------------- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  visibility: hidden;
  opacity: 0;
  transition: opacity var(--transition), visibility var(--transition);
}

.sheet.open {
  visibility: visible;
  opacity: 1;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 41, 55, .4);
  opacity: 0;
  transition: opacity var(--transition);
}

.sheet.open .sheet-backdrop { opacity: 1; }

.sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 88vh;
  max-height: 88dvh;
  overflow-y: auto;
  padding: 4px 16px calc(16px + env(safe-area-inset-bottom));
  border-radius: var(--radius-block) var(--radius-block) 0 0;
  background: var(--bg);
  box-shadow: 0 -6px 24px rgba(31, 41, 55, .12);
  transform: translateY(100%);
  transition: transform .25s ease;
}

.sheet.open .sheet-panel { transform: translateY(0); }

.sheet-handle {
  width: 40px;
  height: 4px;
  margin: 8px auto 12px;
  border-radius: var(--radius-pill);
  background: var(--border);
}

/* Блокировка прокрутки фона, пока шторка открыта */
body.sheet-is-open { overflow: hidden; }

/* --------------------------------------------------------------------------
   15. Тосты
   -------------------------------------------------------------------------- */

.toast-host {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom));
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-field);
  background: var(--bg);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 15px;
  line-height: 21px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-success {
  background: var(--success-soft);
  border-color: rgba(22, 163, 74, .25);
  color: var(--success-ink);
}

.toast-error {
  background: var(--danger-soft);
  border-color: rgba(220, 38, 38, .25);
  color: var(--danger-ink);
}

/* --------------------------------------------------------------------------
   16. Пустые состояния
   -------------------------------------------------------------------------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
}

.empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin-bottom: 4px;
  border-radius: var(--radius-pill);
  background: var(--surface-alt);
  color: var(--text-muted);
  font-size: 28px;
  line-height: 1;
}

.empty-icon svg { width: 28px; height: 28px; }

.empty .btn { margin-top: 8px; }

/* --------------------------------------------------------------------------
   17. Прочее
   -------------------------------------------------------------------------- */

.divider {
  height: 1px;
  margin: 12px 0;
  border: 0;
  background: var(--border);
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  background: var(--primary-soft);
  color: var(--primary-hover);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  overflow: hidden;
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--pad-card);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stat-value {
  font-size: 30px;
  line-height: 36px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}

.stat-label {
  font-size: 14px;
  line-height: 20px;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   18. Широкий экран
   -------------------------------------------------------------------------- */

@media (min-width: 900px) {
  :root {
    --gap-screen: 24px;
    --tabbar-h: 0px;
  }

  .app-shell {
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "sidebar topbar"
      "sidebar content";
    align-items: start;
  }

  .sidebar {
    grid-area: sidebar;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    padding: 16px 12px;
    border-right: 1px solid var(--border);
    background: var(--bg);
  }

  .topbar { grid-area: topbar; }

  .content { grid-area: content; }

  .topbar {
    padding: 8px var(--gap-screen);
    background: var(--bg);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .topbar-title { font-size: 20px; }

  .content {
    padding: var(--gap-screen) var(--gap-screen) 48px;
  }

  /* Таб-бар уступает место боковому меню */
  .tabbar { display: none; }

  .fab {
    bottom: 24px;
    right: 24px;
  }

  /* Шторка превращается в центрированное модальное окно */
  .sheet-panel {
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    width: min(560px, calc(100vw - 48px));
    max-height: 80vh;
    padding: 8px 24px 24px;
    border-radius: var(--radius-block);
    box-shadow: 0 12px 40px rgba(31, 41, 55, .18);
    transform: translate(-50%, calc(-50% + 12px));
  }

  .sheet.open .sheet-panel { transform: translate(-50%, -50%); }

  .sheet-handle { display: none; }

  .toast-host {
    left: auto;
    right: 24px;
    bottom: 24px;
    width: min(380px, calc(100vw - 48px));
  }

  /* .table-stack снова становится таблицей */
  .table-stack {
    display: table;
    border-collapse: collapse;
  }

  .table-stack thead {
    display: table-header-group;
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
    clip-path: none;
    white-space: normal;
  }

  .table-stack tbody { display: table-row-group; }
  .table-stack tr { display: table-row; }

  .table-stack tr,
  .table-stack tbody tr:nth-child(even) {
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
  }

  .table-stack tbody tr:nth-child(even) { background: var(--surface-alt); }

  .table-stack td,
  .table-stack tr td:last-child {
    display: table-cell;
    padding: 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
  }

  .table-stack td::before { content: none; }
  .table-stack td.num { text-align: right; }

  /* Зона нажатия на компьютере компактнее */
  .btn { min-height: 40px; }
  .btn-primary,
  .btn.btn-primary.btn-block { min-height: 40px; }
  .card-link { padding-right: 36px; }
}

/* --------------------------------------------------------------------------
   19. Служебное
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms;
    animation-iteration-count: 1;
    transition-duration: .01ms;
    scroll-behavior: auto;
  }
}

@media print {
  .topbar,
  .tabbar,
  .sidebar,
  .fab,
  .sheet,
  .toast-host { display: none !important; }

  .content { padding: 0; }
  .card { box-shadow: none; border: 1px solid var(--border); }
}
