/* ==================================================================
   Учёт заполнений — стили
   Главное правило: ЛЮБАЯ дата, попадающая на субботу/воскресенье,
   выводится красным (.weekend).
   ================================================================== */

:root {
  --weekend-color: #d32f2f;
  --app-bg: #f4f6fb;
  --app-surface: #ffffff;
  --app-border: #e3e8f0;
  --app-primary: #0d6efd;
  --app-text: #1f2937;
  --app-muted: #6b7280;
  --radius-lg: 14px;
  --radius-md: 10px;
}

/* ---------------------------- Выходные ---------------------------- */
.weekend,
.date-value.weekend,
.dp-day.is-weekend,
.dp-weekday.is-weekend,
.dp-input.is-weekend {
  color: var(--weekend-color) !important;
  font-weight: 600;
}

.text-weekend {
  color: var(--weekend-color) !important;
}

/* ---------------------------- База ---------------------------- */
* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--app-bg);
  color: var(--app-text);
  font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

body.modal-open-custom {
  overflow: hidden;
}

a {
  text-decoration: none;
}

.app-root {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------------------------- Шапка ---------------------------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: var(--app-surface);
  border-bottom: 1px solid var(--app-border);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.app-header-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 17px;
  color: var(--app-text);
  white-space: nowrap;
}

.app-brand-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, #0d6efd, #4dabf7);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.app-user-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-user-name {
  font-weight: 600;
  line-height: 1.1;
}

.app-user-role {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--app-muted);
}

/* ---------------------------- Навигация ---------------------------- */
.app-nav {
  display: flex;
  gap: 4px;
  padding: 0 12px 8px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
}

.app-nav::-webkit-scrollbar {
  height: 4px;
}

.app-nav::-webkit-scrollbar-thumb {
  background: #cfd6e4;
  border-radius: 4px;
}

.app-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 999px;
  color: var(--app-muted);
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease;
}

.app-nav-link:hover {
  background: #eef3ff;
  color: var(--app-primary);
}

.app-nav-link.active {
  background: #e7f0ff;
  color: var(--app-primary);
  border-color: #cfe0ff;
}

.app-nav-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #d32f2f;
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}

/* ---------------------------- Контент ---------------------------- */
.app-main {
  flex: 1 0 auto;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 18px 16px 40px;
}

.page-title {
  font-size: 21px;
  font-weight: 700;
  margin: 0;
}

.page-subtitle {
  color: var(--app-muted);
  font-size: 13px;
  margin-top: 2px;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card {
  border: 1px solid var(--app-border);
  border-radius: var(--radius-lg);
  background: var(--app-surface);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--app-border);
  font-weight: 600;
  padding: 12px 16px;
}

.card-body {
  padding: 16px;
}

.section-note {
  font-size: 13px;
  color: var(--app-muted);
}

/* ---------------------------- Таблицы ---------------------------- */
.table-app {
  margin-bottom: 0;
  font-size: 14px;
  vertical-align: middle;
}

.table-app thead th {
  background: #f7f9fc;
  color: #475467;
  font-weight: 600;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
  border-bottom: 1px solid var(--app-border);
}

.table-app tbody td {
  vertical-align: middle;
  border-color: #eef1f6;
}

.table-app tbody tr:hover {
  background: #fafbff;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.date-value {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cell-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  white-space: nowrap;
}

.num {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* ---------------------------- Формы ---------------------------- */
.form-label {
  font-size: 13px;
  font-weight: 600;
  color: #475467;
  margin-bottom: 4px;
}

.form-control,
.form-select {
  border-color: #dfe4ee;
  font-size: 14px;
}

.form-control:focus,
.form-select:focus {
  border-color: #9ec1ff;
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.12);
}

.form-hint {
  font-size: 12px;
  color: var(--app-muted);
  margin-top: 4px;
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  align-items: end;
}

.filters .filter-actions {
  display: flex;
  gap: 8px;
}

/* Сворачиваемая панель фильтров (на телефонах — «шторка») */
.filters-collapse > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  color: var(--app-text);
  cursor: pointer;
  list-style: none;
}

.filters-collapse > summary::-webkit-details-marker {
  display: none;
}

.filters-collapse > summary::after {
  content: '▾';
  margin-left: auto;
  color: var(--app-muted);
  transition: transform 0.15s ease;
}

.filters-collapse[open] > summary::after {
  transform: rotate(180deg);
}

.filters-collapse[open] > summary {
  margin-bottom: 10px;
}

@media (min-width: 768px) {
  .filters-collapse > summary {
    display: none;
  }
}

/* ---------------------------- Календарь ---------------------------- */
.dp {
  position: relative;
  width: 100%;
}

.dp-input {
  padding-right: 38px;
  cursor: pointer;
  background: #fff;
}

.dp-toggle {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 36px;
  border: 0;
  background: transparent;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
}

.dp-toggle:hover {
  color: var(--app-primary);
}

.dp-popup {
  position: absolute;
  z-index: 3000;
  top: calc(100% + 5px);
  left: 0;
  width: 276px;
  max-width: 92vw;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--app-border);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
}

/*
 * Попап открытый «поверх окна»: координаты задаёт positionPopup() в JS.
 * position: fixed не обрезается прокручиваемыми контейнерами (modal-body,
 * modal-content, карточки фильтров), поэтому сетка дней всегда доступна,
 * а не только кнопки «Сегодня»/«Очистить».
 */
.dp-popup--fixed {
  position: fixed;
  top: auto;
  bottom: auto;
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 16px);
  overscroll-behavior: contain;
}

.dp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
}

.dp-nav {
  width: 28px;
  height: 28px;
  border: 1px solid var(--app-border);
  border-radius: 8px;
  background: #fff;
  color: #475467;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.dp-nav:hover {
  background: #eef3ff;
  color: var(--app-primary);
}

.dp-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.15;
}

.dp-title-month {
  font-weight: 700;
  font-size: 14px;
}

.dp-title-year {
  font-size: 12px;
  color: var(--app-muted);
}

.dp-weekdays,
.dp-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.dp-weekday {
  text-align: center;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--app-muted);
  padding: 4px 0;
}

.dp-day {
  aspect-ratio: 1 / 1;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--app-text);
  font-size: 13.5px;
  cursor: pointer;
  padding: 0;
}

.dp-day:hover:not(:disabled) {
  background: #eef3ff;
}

.dp-day.is-outside {
  color: #b6bfce;
  opacity: 0.75;
}

.dp-day.is-outside.is-weekend {
  color: #e8a3a3;
}

.dp-day.is-today {
  box-shadow: inset 0 0 0 1.5px #9ec1ff;
  font-weight: 700;
}

.dp-day.is-selected {
  background: var(--app-primary) !important;
  color: #fff !important;
  font-weight: 700;
}

.dp-day:disabled {
  color: #cbd5e1;
  cursor: not-allowed;
}

.dp-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #eef1f6;
}

.dp-foot-btn {
  border: 0;
  background: transparent;
  color: var(--app-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
}

.dp-foot-btn--danger {
  color: var(--weekend-color);
}

/* ---------------------------- Строки отчёта ---------------------------- */
.report-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.report-item-row {
  display: grid;
  grid-template-columns: minmax(140px, 2fr) 110px 120px 42px;
  gap: 8px;
  align-items: center;
}

@media (max-width: 575.98px) {
  .report-item-row {
    grid-template-columns: 1fr 1fr;
  }

  .report-item-row .item-category {
    grid-column: 1 / -1;
  }
}

/* ---------------------------- Уведомления ---------------------------- */
.app-toast {
  min-width: 260px;
  max-width: 360px;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 14px;
  animation: toast-in 0.18s ease-out;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------------------------- Модальные окна ---------------------------- */
.app-modal {
  z-index: 1055;
}

.app-modal-backdrop {
  z-index: 1050;
}

/* ---------------------------- Пустое состояние ---------------------------- */
.empty-state-icon {
  font-size: 34px;
  line-height: 1;
  opacity: 0.65;
}

/* ---------------------------- Счётчики ---------------------------- */
.stat-card {
  border: 1px solid var(--app-border);
  border-left: 4px solid var(--app-primary);
}

.stat-card--info {
  border-left-color: #0dcaf0;
}

.stat-card--success {
  border-left-color: #198754;
}

.stat-card--danger {
  border-left-color: var(--weekend-color);
}

.stat-card-title {
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--app-muted);
  font-weight: 600;
}

.stat-card-value {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
  margin-top: 4px;
}

.stat-card-hint {
  font-size: 12px;
  color: var(--app-muted);
}

/* ---------------------------- Сумма за расчётный период ---------------------------- */
.period-total {
  border: 1px solid var(--app-border);
  border-left: 4px solid var(--app-primary);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  height: 100%;
}

.period-total-label {
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--app-muted);
  font-weight: 600;
}

.period-total-value {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
  margin-top: 2px;
  word-break: break-word;
}

.period-total-hint {
  font-size: 12px;
  color: var(--app-muted);
}

/* ---------------------------- Итог за сегодня ---------------------------- */
.today-user-filter {
  max-width: 320px;
  margin-bottom: 12px;
}

/* Название позиции пишется как есть (в блоке периода подпись — капсом) */
.today-total .period-total-label {
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
}

.today-total .period-total-value {
  font-size: 20px;
}

.today-records td,
.today-records th {
  vertical-align: middle;
}

.today-records tbody tr:last-child td {
  border-bottom: 0;
}


/* ---------------------------- Экран входа ---------------------------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 20% 20%, #e8f0ff 0%, #f4f6fb 45%, #eef2f9 100%);
}

.login-card {
  width: 100%;
  max-width: 400px;
  border-radius: 18px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.12);
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

.login-brand-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: linear-gradient(135deg, #0d6efd, #4dabf7);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

/* ---------------------------- Служебное ---------------------------- */
.legend-weekend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--app-muted);
}

.legend-weekend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--weekend-color);
}

.text-truncate-cell {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #f1f5ff;
  color: #3559a8;
  font-size: 12.5px;
  font-weight: 600;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.pagination-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  border-top: 1px solid var(--app-border);
  font-size: 13.5px;
  color: var(--app-muted);
}

/* ---------------------------- Карточки (телефоны) ---------------------------- */
.reports-cards,
.users-cards {
  padding: 10px;
}

.report-card,
.user-card {
  border: 1px solid var(--app-border);
  border-left: 4px solid var(--app-primary);
  border-radius: var(--radius-md);
  background: var(--app-surface);
  padding: 12px;
}

.report-card + .report-card,
.user-card + .user-card {
  margin-top: 10px;
}

.report-card--weekend {
  border-left-color: var(--weekend-color);
}

.report-card-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.report-card-id {
  margin-left: auto;
  font-size: 12px;
}

.report-card-comment {
  margin-top: 8px;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.report-card-foot {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  font-size: 12px;
}

.report-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.user-card--inactive {
  opacity: 0.72;
}

.user-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.user-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 6px;
}

.user-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.user-card-actions .btn {
  flex: 1 1 46%;
}

/* ---------------------------- Уведомления (страница и панель) ---------------------------- */
.page-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Список уведомлений на странице «Уведомления» */
.notif-list-card .notif-empty {
  border: 0;
}

.notif-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
}

/* Карточка одного уведомления */
.notif {
  position: relative;
  padding: 10px 12px 8px 14px;
  background: #fff;
  border: 1px solid var(--app-border);
  border-left: 3px solid transparent;
  border-radius: 10px;
}

.notif-unread {
  background: #f5f9ff;
  border-left-color: #0d6efd;
}

.notif-unread .notif-header {
  font-weight: 600;
}

/* Акцентная полоска по типу события; у непрочитанных приоритет — синий */
.notif-create:not(.notif-unread) {
  border-left-color: #198754;
}

.notif-update:not(.notif-unread) {
  border-left-color: #ffc107;
}

.notif-delete:not(.notif-unread) {
  border-left-color: #dc3545;
}

.notif-categories:not(.notif-unread) {
  border-left-color: #6f42c1;
}

.notif-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px;
  font-size: 14px;
  color: var(--app-text);
  word-break: break-word;
}

/* Diff «было → стало» */
.notif-changes {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 13px;
  font-weight: 400;
  color: #333;
}

.notif-changes li {
  word-break: break-word;
}

.notif-changes b {
  font-weight: 600;
}

/* Старое значение — зачёркнуто и серым */
.chg-from {
  text-decoration: line-through;
  text-decoration-color: rgba(211, 47, 47, 0.55);
  color: var(--app-muted);
}

.chg-added {
  color: #146c43;
}

.chg-removed {
  color: #b02a37;
}

.chg-changed {
  color: #333;
}

.chg-snapshot {
  color: var(--app-muted);
}

.chg-more {
  font-style: italic;
}

.notif-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--app-muted);
}

.notif-time {
  white-space: nowrap;
}

.notif-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
}

/* Мета-строка страницы (бейджи типа события и время создания) */
.notif-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px 2px 0 16px;
  font-size: 12px;
}

.notif-clickable {
  cursor: pointer;
}

.notif-clickable:hover {
  background: #f1f6ff;
  border-color: #c7dbff;
}

.notif-clickable:focus-visible {
  outline: 2px solid #0d6efd;
  outline-offset: 2px;
}

.notif-empty {
  padding: 24px 14px;
  text-align: center;
  color: var(--app-muted);
  font-size: 14px;
}

.notif-empty-icon {
  font-size: 26px;
  line-height: 1;
  margin-bottom: 6px;
}

/* ---------------------------- Панель уведомлений в шапке ---------------------------- */
.notif-panel {
  position: relative;
  display: flex;
}

.notif-bell {
  position: relative;
}

.notif-bell-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: #dc3545;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--app-surface);
}

.notif-bell-active {
  color: #0d6efd;
  border-color: #b6d4fe !important;
}

.notif-bell-error {
  border-color: #f1aeb5 !important;
}

.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 1050;
  width: min(380px, calc(100vw - 24px));
  max-height: min(70vh, 520px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--app-border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
  overflow: hidden;
}

.notif-dropdown-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--app-border);
  font-size: 14px;
}

.notif-dropdown-action {
  padding: 0;
  font-size: 12.5px;
  text-decoration: none;
}

.notif-dropdown-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  overflow-y: auto;
  font-size: 13px;
}

.notif-dropdown-foot {
  padding: 8px;
  border-top: 1px solid var(--app-border);
}

/* Кнопки-иконки в шапке */
.app-icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.app-icon-btn-icon {
  font-size: 15px;
  line-height: 1;
}

.app-nav-icon {
  font-size: 15px;
  line-height: 1;
}

.app-nav-label {
  white-space: nowrap;
}

/* STEALTH: приватный журнал действий скрытого администратора */
.audit-details {
  max-width: 46ch;
  color: #495057;
  line-height: 1.35;
  word-break: break-word;
}

@media (max-width: 767.98px) {
  .audit-details {
    max-width: none;
  }
}

/* ---------------------------- Адаптив ---------------------------- */
/* Телефоны и узкие планшеты: нижняя навигация, карточки вместо таблиц */
@media (max-width: 767.98px) {
  .app-main {
    padding: 14px 10px calc(82px + env(safe-area-inset-bottom));
  }

  /* Выпадающая панель уведомлений занимает почти всю ширину экрана */
  .notif-dropdown {
    width: calc(100vw - 20px);
    right: -6px;
    max-height: 70vh;
  }

  .notif-list {
    padding: 8px;
  }

  .notif-meta {
    padding-left: 0;
  }

  .page-title {
    font-size: 18px;
  }

  .page-subtitle {
    font-size: 12px;
  }

  .stat-card-value {
    font-size: 20px;
  }

  .app-user-login,
  .app-user-role {
    display: none;
  }

  .card-body {
    padding: 14px;
  }

  /* Навигация превращается в нижнюю панель — удобнее для пальцев */
  .app-nav {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 1035;
    gap: 2px;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    max-width: none;
    background: var(--app-surface);
    border-top: 1px solid var(--app-border);
    box-shadow: 0 -2px 12px rgba(15, 23, 42, 0.08);
    overflow: visible;
  }

  .app-nav-link {
    position: relative;
    flex: 1 1 0;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    min-height: 50px;
    padding: 6px 2px;
    border-radius: 10px;
    font-size: 10.5px;
  }

  .app-nav-icon {
    font-size: 19px;
  }

  .app-nav-label {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .app-nav-badge {
    position: absolute;
    top: 2px;
    right: calc(50% - 26px);
  }

  .app-footer {
    display: none;
  }

  /* Поля ввода 16px — иначе iOS масштабирует страницу при фокусе */
  .form-control,
  .form-select {
    font-size: 16px;
    min-height: 42px;
  }

  textarea.form-control {
    min-height: 60px;
  }

  .form-label {
    font-size: 12.5px;
  }

  /* Фильтры — в одну колонку, кнопки растянуты */
  .filters {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .filters .filter-actions {
    gap: 8px;
  }

  .filters .filter-actions .btn {
    flex: 1 1 0;
  }

  .page-head {
    align-items: stretch;
    margin-bottom: 12px;
  }

  .page-head > .btn,
  .page-head-actions {
    width: 100%;
  }

  .page-head-actions > .btn {
    flex: 1 1 0;
  }

  /* В карточках текст переносится, а не обрезается */
  .text-truncate-cell {
    max-width: 100%;
    white-space: normal;
  }

  .btn-sm {
    min-height: 34px;
  }

  .pagination-bar {
    padding: 10px 12px;
  }

  .dp-day {
    min-height: 34px;
  }

  .report-card-actions .btn,
  .notification-actions .btn {
    flex: 1 1 auto;
  }
}

/* Телефоны: модальные окна как «нижние шторки», крупные тач-элементы */
@media (max-width: 575.98px) {
  body {
    font-size: 15px;
  }

  .login-wrap {
    padding: 16px 12px;
  }

  .login-card .card-body {
    padding: 20px 16px !important;
  }

  .app-header-top {
    gap: 8px;
    padding: 8px 10px;
  }

  .app-brand {
    font-size: 15px;
  }

  .app-brand-icon {
    width: 26px;
    height: 26px;
    font-size: 13px;
  }

  .stat-card .card-body {
    padding: 10px 12px;
  }

  .stat-card-value {
    font-size: 18px;
  }

  .stat-card-hint {
    font-size: 11px;
  }

  /* Тосты — во всю ширину, но ниже шапки, чтобы не перекрывать кнопки */
  .toast-container {
    top: 52px !important;
    right: 0;
    left: 0;
    padding: 8px !important;
  }

  .app-toast {
    width: auto;
    min-width: 0;
    max-width: 100%;
    font-size: 13.5px;
  }

  /* Модальное окно прижимается к низу и занимает почти весь экран */
  .app-modal .modal-dialog {
    margin: 0;
    width: 100%;
    max-width: 100%;
    min-height: 100%;
    align-items: flex-end;
  }

  .app-modal .modal-content {
    max-height: 94vh;
    border-radius: 16px 16px 0 0;
  }

  .app-modal .modal-title {
    font-size: 16px;
  }

  .app-modal .modal-header {
    padding: 12px 14px;
  }

  .app-modal .modal-body {
    padding: 14px;
  }

  .app-modal .modal-footer {
    flex-wrap: nowrap;
    gap: 8px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  }

  .app-modal .modal-footer > * {
    flex: 1 1 auto;
  }

  /* Позиции отчёта: категория на всю ширину, количество/ед./удаление — в ряд */
  .report-item-row {
    grid-template-columns: 1fr 1fr auto;
    gap: 6px;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--app-border);
  }

  .report-item-row .item-category {
    grid-column: 1 / -1;
  }

  .report-items .report-item-row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
  }

  .notification-actions {
    width: 100%;
    margin-left: 0;
  }

  .notification-item {
    padding: 12px;
  }

  .dp-popup {
    width: 100%;
    max-width: 100%;
  }
}

/* Очень узкие экраны (до 360px) */
@media (max-width: 360px) {
  .app-brand-text {
    display: none;
  }

  .app-nav-label {
    font-size: 9.5px;
  }

  .stat-card-value {
    font-size: 16px;
  }

  .report-card-actions .btn {
    flex: 1 1 100%;
  }
}



