/* ============================================================
   Опросник для пациентов — МОБИЛЬНАЯ ВЕРСИЯ (mobile-first)
   ============================================================ */

:root {
  --brand-primary: #2563eb;
  --brand-primary-dark: #1d4ed8;
  --brand-primary-light: #eff6ff;
  --brand-accent: #06b6d4;
  --brand-success: #16a34a;
  --brand-warning: #f59e0b;
  --brand-danger: #dc2626;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06);
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-body);
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-bottom);
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-primary); text-decoration: none; }

/* ============================================================
   Основной контент (мобильный)
   ============================================================ */

.site-main {
  flex: 1;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 16px 32px;
}

/* ============================================================
   Hero-блок (компактный)
   ============================================================ */

.hero {
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-accent) 100%);
  border-radius: var(--radius-md);
  padding: 22px 20px;
  color: #fff;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: '';
  position: absolute;
  right: -40px;
  top: -40px;
  width: 140px;
  height: 140px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
}

.hero__content { position: relative; z-index: 1; }

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 12px;
}

.hero__title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 8px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.hero__subtitle {
  font-size: 14px;
  opacity: 0.95;
  margin: 0;
  line-height: 1.45;
}

/* ============================================================
   Заголовки
   ============================================================ */

.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 4px;
}

.section-subtitle {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin: 0 0 16px;
}

/* ============================================================
   Карточки анкет
   ============================================================ */

.survey-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.survey-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s;
  /* Убираем hover-эффект на мобиле, добавляем active */
}

.survey-card:active {
  transform: scale(0.985);
  background: #fafbff;
}

.survey-card__badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  align-self: flex-start;
  margin-bottom: 10px;
}

.survey-card__badge--survey {
  background: var(--brand-primary-light);
  color: var(--brand-primary-dark);
}

.survey-card__badge--test {
  background: #fef3c7;
  color: #92400e;
}

.survey-card__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 6px;
  line-height: 1.35;
}

.survey-card__desc {
  color: var(--text-secondary);
  font-size: 13.5px;
  flex-grow: 1;
  margin: 0 0 14px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.survey-card__meta {
  display: flex;
  gap: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
  margin-bottom: 14px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.survey-card__meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.survey-card__meta-item i {
  color: var(--brand-primary);
  font-size: 14px;
}

/* ============================================================
   Кнопки — крупные тап-зоны (min 48px)
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.1s, background 0.15s;
  line-height: 1.3;
  text-align: center;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--brand-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.btn-primary:active {
  background: var(--brand-primary-dark);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-outline:active {
  background: var(--bg-body);
}

.btn-success {
  background: var(--brand-success);
  color: #fff;
}

.btn-danger {
  background: var(--brand-danger);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  min-height: 40px;
  padding: 8px 12px;
  font-size: 14px;
}

.btn-ghost:active {
  background: var(--brand-primary-light);
  color: var(--brand-primary);
}

.btn-block { width: 100%; }
.btn-lg {
  min-height: 54px;
  font-size: 16px;
  padding: 14px 24px;
}
.btn-sm {
  min-height: 38px;
  padding: 8px 14px;
  font-size: 13px;
}

/* ============================================================
   Карточки / контейнеры
   ============================================================ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

.card__header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  margin: -18px -18px 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  background: #fafbfd;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.card__header i {
  color: var(--brand-primary);
  font-size: 17px;
}

/* ============================================================
   Формы — крупные поля
   ============================================================ */

.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.form-label__required { color: var(--brand-danger); margin-left: 3px; }

.form-control {
  width: 100%;
  min-height: 50px;
  padding: 13px 16px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 16px; /* 16px предотвращает зум на iOS */
  color: var(--text-primary);
  background: #fff;
  transition: border-color 0.15s;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control::placeholder { color: #94a3b8; }

textarea.form-control {
  resize: vertical;
  min-height: 100px;
  line-height: 1.5;
  padding-top: 14px;
}

.form-hint {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* ============================================================
   Чекбоксы и радио — крупные карточки-кнопки
   ============================================================ */

.check {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  padding: 14px 16px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.12s;
  background: #fff;
  margin-bottom: 10px;
  -webkit-tap-highlight-color: transparent;
}

.check:active {
  background: #f8fafc;
  transform: scale(0.995);
}

.check input[type="radio"],
.check input[type="checkbox"] {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--brand-primary);
  flex-shrink: 0;
  cursor: pointer;
}

.check__label {
  flex: 1;
  font-size: 15px;
  line-height: 1.4;
  cursor: pointer;
  color: var(--text-primary);
  word-break: break-word;
}

.check--selected {
  border-color: var(--brand-primary);
  background: var(--brand-primary-light);
}

.check--selected .check__label {
  color: var(--brand-primary-dark);
  font-weight: 500;
}

/* ============================================================
   Вопросы
   ============================================================ */

.question {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

.question:focus-within {
  border-color: var(--brand-primary);
}

.question__header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
}

.question__number {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--brand-primary-light);
  color: var(--brand-primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}

.question__text {
  font-size: 15.5px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  flex: 1;
  padding-top: 4px;
  word-break: break-word;
}

.question__required { color: var(--brand-danger); margin-left: 3px; }

.question__points {
  /* Скрыто для пациента — не даём подсказку о количестве правильных ответов */
  display: none !important;
}

/* ============================================================
   Range — крупный слайдер
   ============================================================ */

.range {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}

.range__bound {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 600;
  min-width: 16px;
  text-align: center;
}

.range input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  background: var(--border-color);
  border-radius: 999px;
  outline: none;
  touch-action: manipulation;
}

.range input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-primary);
  cursor: pointer;
  border: 4px solid #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.5);
}

.range input[type="range"]::-moz-range-thumb {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-primary);
  cursor: pointer;
  border: 4px solid #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.5);
}

.range__value {
  min-width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--brand-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 17px;
  flex-shrink: 0;
}

/* ============================================================
   Согласие на ПДн
   ============================================================ */

.consent {
  border: 2px solid var(--brand-primary-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 16px;
  background: #fff;
}

.consent__header {
  background: var(--brand-primary-light);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--brand-primary-dark);
  font-size: 14px;
}

.consent__header i { font-size: 18px; }

.consent__body { padding: 16px; }

.consent__text {
  max-height: 180px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.55;
  color: #334155;
}

.consent__version {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ============================================================
   Алерты
   ============================================================ */

.alert {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.45;
}

.alert i { font-size: 20px; flex-shrink: 0; margin-top: 1px; }

.alert-danger { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warning { background: #fffbeb; color: #854d0e; border: 1px solid #fde68a; }

/* ============================================================
   Результат
   ============================================================ */

.result {
  text-align: center;
  padding: 24px 8px;
}

.result__icon {
  font-size: 64px;
  line-height: 1;
  margin-bottom: 14px;
}

.result__icon--success { color: var(--brand-success); }
.result__icon--fail { color: var(--brand-warning); }

.result__title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 6px;
  line-height: 1.25;
}

.result__score {
  font-size: 52px;
  font-weight: 800;
  color: var(--brand-primary);
  line-height: 1;
  margin: 20px 0 6px;
}

.result__score-label {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
}

.progress-bar {
  height: 12px;
  background: var(--border-color);
  border-radius: 999px;
  overflow: hidden;
  margin: 0 auto 24px;
  max-width: 100%;
}

.progress-bar__fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.6s ease;
}

.progress-bar__fill--success {
  background: linear-gradient(90deg, #22c55e, #16a34a);
}

.progress-bar__fill--fail {
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

/* ============================================================
   Сертификат
   ============================================================ */

.certificate-card {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 2px solid var(--brand-primary-light);
  border-radius: var(--radius-md);
  padding: 22px 18px;
  margin: 20px 0;
  text-align: center;
}

.certificate-card__icon {
  font-size: 40px;
  color: var(--brand-primary);
  margin-bottom: 8px;
}

.certificate-card__title {
  font-size: 17px;
  font-weight: 700;
  color: var(--brand-primary-dark);
  margin: 0 0 4px;
}

.certificate-card__number {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 14px;
  word-break: break-all;
}

/* ============================================================
   Таблицы (админка) — на мобиле превращаются в карточки
   ============================================================ */

.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table thead {
  display: none; /* скрываем шапку на мобиле */
}

.table tr {
  display: block;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
}

.table tr:last-child {
  border-bottom: none;
}

.table td {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border: none;
  font-size: 13.5px;
  gap: 12px;
}

.table td::before {
  content: attr(data-label);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.table td:first-child {
  padding-top: 0;
}

.table td:last-child {
  padding-bottom: 0;
  padding-top: 10px;
  margin-top: 6px;
  border-top: 1px solid var(--border-color);
}

.table td:last-child::before {
  display: none;
}

.table__actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  width: 100%;
}

/* ============================================================
   Подвал
   ============================================================ */

.site-footer {
  border-top: 1px solid var(--border-color);
  padding: 18px 16px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 12px;
  background: var(--bg-card);
}

/* ============================================================
   Нижняя фиксированная панель действий (для форм)
   ============================================================ */

.sticky-bottom {
  position: sticky;
  bottom: 0;
  background: linear-gradient(to top, #fff 70%, transparent);
  padding: 12px 0 calc(12px + var(--safe-bottom));
  margin: 16px -16px calc(-32px - var(--safe-bottom));
  z-index: 10;
}

/* ============================================================
   Утилиты
   ============================================================ */

.text-center { text-align: center; }
.text-muted { color: var(--text-secondary); }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

/* ============================================================
   Редактор анкет — улучшения
   ============================================================ */

.question-card {
  border: 1px solid var(--border-color);
  background: #fafbfd;
}

.question-card:focus-within {
  background: #fff;
  border-color: var(--brand-primary);
}

/* Адаптив для админ-страниц */
@media (max-width: 500px) {
  .q-options [data-option] {
    flex-wrap: wrap;
  }

  .q-options .o-text {
    min-width: 0;
  }
}


/* ============================================================
   ДЕСКТОПНАЯ АДАПТАЦИЯ
   ============================================================ */

/* --- Большие экраны (≥ 900px) --- */
@media (min-width: 900px) {
  body {
    font-size: 15.5px;
  }

  .site-main {
    max-width: 1080px;
    padding: 32px 32px 48px;
  }

  /* Шапка становится просторнее */
  .site-header__inner {
    padding: 16px 32px;
    gap: 20px;
    max-width: 1200px;
  }

  .brand__logo,
  .brand__logo-placeholder {
    width: 48px;
    height: 48px;
    font-size: 24px;
  }

  

  

  /* Иконки-кнопки в шапке превращаются в текстовые кнопки */
  .header-action {
    width: auto;
    height: 40px;
    padding: 0 14px;
    gap: 6px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
  }

  /* Hero — крупнее */
  .hero {
    padding: 56px 48px;
    margin-bottom: 40px;
    border-radius: 24px;
  }

  .hero__title {
    font-size: 40px;
  }

  .hero__subtitle {
    font-size: 18px;
  }

  /* Заголовки секций */
  .section-title {
    font-size: 26px;
  }

  .section-subtitle {
    font-size: 15px;
    margin-bottom: 28px;
  }

  /* Сетка карточек — 2 или 3 колонки */
  .survey-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
  }

  .survey-card {
    padding: 26px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
  }

  .survey-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(37, 99, 235, 0.12);
  }

  .survey-card:hover .btn-primary {
    background: var(--brand-primary-dark);
  }

  /* Восстанавливаем hover-эффекты для десктопа */
  .btn {
    transition: all 0.15s ease;
  }

  .btn-primary:hover {
    background: var(--brand-primary-dark);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  }

  .btn-outline:hover {
    background: var(--brand-primary-light);
    border-color: var(--brand-primary);
    color: var(--brand-primary);
  }

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

  .btn:active {
    transform: none;
  }

  /* Формы — десктопные размеры */
  .form-control {
    min-height: 44px;
    font-size: 15px;
    padding: 10px 14px;
  }

  textarea.form-control {
    min-height: 100px;
  }

  /* Чекбоксы — компактнее */
  .check {
    min-height: 48px;
    padding: 12px 16px;
  }

  .check:hover {
    border-color: var(--brand-primary-light);
    background: #fafbff;
  }

  .check:active {
    transform: none;
  }

  /* Карточки вопросов */
  .question {
    padding: 24px 28px;
    margin-bottom: 16px;
  }

  .question:hover {
    border-color: var(--brand-primary-light);
  }

  /* Карточки в целом */
  .card {
    padding: 28px 32px;
    margin-bottom: 20px;
  }

  .card__header {
    margin: -28px -32px 20px;
    padding: 18px 32px;
    font-size: 15px;
  }

  /* Согласие — в две колонки? нет, оставляем, но шире */
  .consent__text {
    max-height: 260px;
    font-size: 13.5px;
  }

  /* Результат — крупнее */
  .result {
    padding: 56px 40px;
  }

  .result__icon {
    font-size: 88px;
  }

  .result__title {
    font-size: 30px;
  }

  .result__score {
    font-size: 72px;
  }

  /* Таблицы админки — показываем как настоящие таблицы */
  .table {
    font-size: 14px;
  }

  .table thead {
    display: table-header-group;
  }

  .table tr {
    display: table-row;
    padding: 0;
    border-bottom: 1px solid var(--border-color);
  }

  .table td {
    display: table-cell;
    padding: 14px 18px;
    vertical-align: middle;
    text-align: left;
    border: none;
  }

  .table td::before {
    display: none;
  }

  .table td:last-child {
    padding-top: 14px;
    margin-top: 0;
    border-top: none;
    text-align: right;
  }

  .table tr:hover td {
    background: #fafbff;
  }

  .table__actions {
    justify-content: flex-end;
  }

  /* Sticky bottom — на десктопе обычная кнопка */
  .sticky-bottom {
    position: static;
    background: none;
    padding: 0;
    margin: 16px 0 0;
  }

  .sticky-bottom .btn {
    max-width: 320px;
    margin: 0 auto;
    display: flex;
  }

  /* Подвал */
  .site-footer {
    padding: 24px 32px;
    font-size: 13.5px;
  }
}

/* --- Очень широкие экраны (≥ 1280px) --- */
@media (min-width: 1280px) {
  .site-main {
    max-width: 1200px;
  }
}

/* --- Планшеты (600–899px) --- */
@media (min-width: 600px) and (max-width: 899px) {
  .site-main {
    max-width: 720px;
    padding: 24px 24px 40px;
  }

  .site-header__inner {
    padding: 14px 24px;
  }

  .brand__logo,
  .brand__logo-placeholder {
    width: 44px;
    height: 44px;
  }

  

  .survey-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .hero {
    padding: 40px 32px;
  }

  .hero__title {
    font-size: 30px;
  }

  .hero__subtitle {
    font-size: 16px;
  }
}

/* --- Отключаем :active эффекты на устройствах с мышью --- */
@media (hover: hover) and (pointer: fine) {
  .btn:active {
    transform: none;
  }

  .survey-card:active {
    transform: none;
    background: var(--bg-card);
  }

  .check:active {
    transform: none;
    background: #fff;
  }
}


/* ============================================================
   Подпись у иконок в шапке (видна только на десктопе)
   ============================================================ */

.header-action {
  display: inline-flex;
  align-items: center;
  gap: 0;
}

.header-action__label {
  display: none;
  font-size: 14px;
  font-weight: 500;
}

@media (min-width: 900px) {
  .header-action {
    gap: 8px;
  }

  .header-action__label {
    display: inline;
  }
}


/* ============================================================
   БЭКАПЫ — статистика и карточки
   ============================================================ */

/* Сетка статистики */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stat-card__icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 8px;
}

.stat-card__value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 2px;
}

.stat-card__label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Бэкап-карточка */
.backup-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border-color);
}

.backup-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.backup-item:first-child {
  padding-top: 0;
}

.backup-item__head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.backup-item__icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--brand-primary-light);
  color: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.backup-item__info {
  flex: 1;
  min-width: 0;
}

.backup-item__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  line-height: 1.35;
}

.badge-type {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--brand-primary-dark);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.backup-item__meta {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 3px;
}

.backup-item__files {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.backup-file {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: #fafbfd;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 13px;
  transition: all 0.12s;
}

.backup-file:hover {
  border-color: var(--brand-primary);
  background: var(--brand-primary-light);
}

.backup-file:active {
  transform: scale(0.985);
}

.backup-file > i:first-child {
  color: var(--brand-primary);
  font-size: 16px;
  flex-shrink: 0;
}

.backup-file__name {
  flex: 1;
  min-width: 0;
  font-family: 'Courier New', monospace;
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.backup-file__size {
  font-size: 11.5px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.backup-file__dl {
  color: var(--brand-primary);
  font-size: 14px;
  flex-shrink: 0;
}

.backup-item__actions {
  display: flex;
  gap: 6px;
}

/* Десктоп */
@media (min-width: 600px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
  }

  .stat-card {
    padding: 20px;
  }

  .stat-card__value {
    font-size: 26px;
  }

  .backup-item__files {
    flex-direction: row;
  }

  .backup-file {
    flex: 1;
  }

  .backup-item__actions {
    justify-content: flex-end;
  }

  .backup-item__actions form {
    flex: 0 0 auto !important;
  }
}

/* Десктоп */
@media (min-width: 900px) {
  .backup-item {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 16px;
    align-items: center;
    padding: 16px 0;
  }

  .backup-item__head {
    margin-bottom: 0;
  }

  .backup-item__files {
    flex-direction: column;
    margin-bottom: 0;
  }

  .backup-item__actions {
    flex-shrink: 0;
  }
}




/* ============================================================
   АДМИНКА — десктопная версия
   ============================================================ */

/* --- Шапка админки --- */

.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  padding-top: var(--safe-top);
}

.site-header__inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 68px;
}



.brand__logo,
.brand__logo-placeholder {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  flex-shrink: 0;
  object-fit: contain;
}

.brand__logo {
  background: var(--brand-primary-light);
  padding: 4px;
}

.brand__logo-placeholder {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
}







/* --- Навигация админки --- */

.admin-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.admin-nav::-webkit-scrollbar { display: none; }

.admin-nav__item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.12s;
  flex-shrink: 0;
}

.admin-nav__item i {
  font-size: 16px;
}

.admin-nav__item:hover {
  background: var(--brand-primary-light);
  color: var(--brand-primary);
}

.admin-nav__item--active {
  background: var(--brand-primary);
  color: #fff;
}

.admin-nav__item--active i {
  color: #fff;
}

/* --- Меню пользователя --- */

.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 6px 12px;
  border-radius: 999px;
  background: #f1f5f9;
  flex-shrink: 0;
}

.user-menu__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.user-menu__info {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}

.user-menu__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-menu__role {
  font-size: 10.5px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}

.user-menu__logout {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.12s;
}

.user-menu__logout:hover {
  background: #fee2e2;
  color: var(--brand-danger);
}

/* --- Заголовок страницы --- */

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-head__text {
  min-width: 0;
}

.page-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 4px;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
}

.page-head__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* --- Админ-таблица --- */

.admin-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-table thead th {
  background: #f8fafc;
  padding: 12px 18px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.admin-table tbody tr {
  border-bottom: 1px solid var(--border-color);
  transition: background 0.1s;
}

.admin-table tbody tr:last-child {
  border-bottom: none;
}

.admin-table tbody tr:hover {
  background: #fafbff;
}

.admin-table td {
  padding: 16px 18px;
  vertical-align: middle;
  color: var(--text-primary);
}

.admin-table__id {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 600;
}

.admin-table__title {
  font-weight: 600;
  font-size: 14.5px;
  color: var(--text-primary);
  line-height: 1.35;
  word-break: break-word;
}

.admin-table__desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 3px;
  line-height: 1.4;
  word-break: break-word;
}

.admin-table__num {
  text-align: center;
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
}

.admin-table__date {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.admin-table__actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

/* --- Иконки-кнопки действий --- */

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--border-color);
  background: #fff;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.12s;
  padding: 0;
}

.icon-btn:hover {
  background: var(--brand-primary-light);
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.icon-btn--danger:hover {
  background: #fee2e2;
  border-color: var(--brand-danger);
  color: var(--brand-danger);
}

/* --- Бейджи типа --- */

.badge-type {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-type--survey {
  background: var(--brand-primary-light);
  color: var(--brand-primary-dark);
}

.badge-type--test {
  background: #fef3c7;
  color: #92400e;
}

/* --- Статус-пилюля --- */

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s;
  font-family: inherit;
}

.status-pill--active {
  background: #dcfce7;
  color: #15803d;
}

.status-pill--active:hover {
  background: #bbf7d0;
}

.status-pill--hidden {
  background: #f1f5f9;
  color: #64748b;
}

.status-pill--hidden:hover {
  background: #e2e8f0;
}

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

.empty-state {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 64px 24px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.empty-state > i {
  font-size: 56px;
  color: #cbd5e1;
  display: block;
  margin-bottom: 16px;
}

.empty-state h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 6px;
}

.empty-state p {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 0 0 20px;
}

/* ============================================================
   АДАПТАЦИЯ АДМИНКИ ПОД МОБИЛЬНЫЙ
   ============================================================ */

@media (max-width: 900px) {
  .site-header__inner {
    padding: 0 16px;
    height: auto;
    min-height: 64px;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  

  .admin-nav {
    order: 3;
    flex-basis: 100%;
    padding: 4px 0;
    margin: 0 -16px;
    padding-left: 16px;
    padding-right: 16px;
    border-top: 1px solid var(--border-color);
    padding-top: 8px;
    margin-top: 6px;
  }

  .admin-nav__item {
    font-size: 13px;
    padding: 7px 12px;
  }

  .user-menu__info {
    display: none;
  }

  .user-menu {
    padding: 4px;
    background: transparent;
  }

  .page-title {
    font-size: 22px;
  }

  .page-head {
    margin-bottom: 16px;
  }

  .page-head__actions {
    width: 100%;
  }

  .page-head__actions .btn {
    flex: 1;
  }

  /* Таблица превращается в карточки */
  .admin-table-wrap {
    border: none;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
  }

  .admin-table thead {
    display: none;
  }

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

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

  .admin-table td {
    padding: 6px 0;
    text-align: left;
  }

  .admin-table__id {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
  }

  .admin-table__title {
    font-size: 15px;
    margin-bottom: 6px;
  }

  .admin-table__desc {
    margin-bottom: 10px;
  }

  .admin-table__num {
    display: inline-flex;
    text-align: left;
    margin-right: 16px;
    font-size: 13px;
    color: var(--text-secondary);
  }

  .admin-table__num::before {
    content: attr(data-label) ': ';
    font-weight: 500;
    margin-right: 4px;
  }

  .admin-table__num::after {
    content: attr(data-value);
    font-weight: 700;
    color: var(--text-primary);
  }

  .admin-table__date {
    margin-top: 6px;
    font-size: 12px;
  }

  .admin-table__actions {
    justify-content: flex-start;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
  }

  .icon-btn {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }

  .status-pill {
    padding: 8px 14px;
  }
}


/* ============================================================
   ПРОСМОТР РЕЗУЛЬТАТОВ
   ============================================================ */

/* Бейдж-счётчик на иконке */
.icon-btn {
  position: relative;
}

.icon-btn__badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--brand-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  line-height: 1;
}

/* Карточка с информацией */
.result-info {
  padding: 0;
}

.result-info__row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
}

.result-info__row:last-child {
  border-bottom: none;
}

.result-info__label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  flex-shrink: 0;
}

.result-info__value {
  font-size: 14px;
  color: var(--text-primary);
  text-align: right;
  word-break: break-word;
}

/* Карточка ответа на вопрос */
.answer-card {
  padding: 16px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: #fafbfd;
  margin-bottom: 10px;
}

.answer-card:last-child {
  margin-bottom: 0;
}

.answer-card--correct {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.answer-card__head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.answer-card__num {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--brand-primary-light);
  color: var(--brand-primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}

.answer-card__text {
  flex: 1;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  padding-top: 3px;
}

.answer-card__mark {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
}

.answer-card__mark--ok {
  background: #dcfce7;
  color: #15803d;
}

.answer-card__mark--fail {
  background: #fee2e2;
  color: #b91c1c;
}

.answer-card__body {
  padding-left: 36px;
}

.answer-card__value {
  font-size: 14.5px;
  color: var(--text-primary);
  padding: 10px 14px;
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  margin-bottom: 8px;
  word-break: break-word;
  line-height: 1.5;
}

.answer-card__value i {
  color: var(--brand-primary);
  margin-right: 6px;
}

.answer-card--correct .answer-card__value {
  background: #fff;
  border-color: #86efac;
}

.answer-card__correct {
  font-size: 12.5px;
  color: var(--text-secondary);
  padding: 6px 12px;
  background: #f1f5f9;
  border-radius: 6px;
}

.answer-card__correct strong {
  color: var(--text-primary);
}

/* Мобильная адаптация */
@media (max-width: 600px) {
  .result-info__row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .result-info__value {
    text-align: left;
  }

  .answer-card__body {
    padding-left: 0;
    margin-top: 8px;
  }
}


/* ============================================================
   ГРАФИКИ
   ============================================================ */

/* Вертикальные столбцы (по дням / по шкале) */
.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 180px;
  padding: 12px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.chart-bars--small {
  height: 140px;
}

.chart-bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 28px;
  height: 100%;
  justify-content: flex-end;
}

.chart-bar {
  width: 100%;
  min-height: 4px;
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  border-radius: 6px 6px 0 0;
  position: relative;
  transition: all 0.3s;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 4px;
  cursor: help;
}

.chart-bar:hover {
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
}

.chart-bar--accent {
  background: linear-gradient(180deg, #34d399, #10b981);
}

.chart-bar--accent:hover {
  background: linear-gradient(180deg, #10b981, #059669);
}

.chart-bar__value {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  padding: 1px 4px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 4px;
}

.chart-bar__label {
  font-size: 10.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  font-weight: 500;
}

/* Горизонтальные полосы (для radio/checkbox) */
.chart-horizontal {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chart-h-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chart-h-label {
  flex: 0 0 40%;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.35;
  word-break: break-word;
}

.chart-h-track {
  flex: 1;
  height: 28px;
  background: #f1f5f9;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.chart-h-fill {
  height: 100%;
  background: linear-gradient(90deg, #60a5fa, #2563eb);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10px;
  transition: width 0.5s ease;
  min-width: 40px;
}

.chart-h-value {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}

.chart-h-percent {
  flex: 0 0 50px;
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.chart-hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

/* Текстовые примеры */
.text-samples {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.text-sample {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-primary);
  word-break: break-word;
}

.text-sample i {
  color: var(--brand-primary);
  margin-right: 6px;
}

/* Числовая статистика */
.number-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.number-stat {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

.number-stat__value {
  font-size: 24px;
  font-weight: 800;
  color: var(--brand-primary);
  line-height: 1.1;
}

.number-stat__label {
  font-size: 11.5px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  margin-top: 4px;
}

/* Мобильная адаптация */
@media (max-width: 600px) {
  .chart-h-row {
    flex-wrap: wrap;
  }

  .chart-h-label {
    flex: 1 1 100%;
  }

  .chart-h-percent {
    flex: 0 0 44px;
  }

  .number-stats {
    grid-template-columns: 1fr;
  }
}


/* ============================================================
   ТАБЫ И НАСТРОЙКИ
   ============================================================ */

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border-color);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 10px 10px 0 0;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.12s;
  flex-shrink: 0;
}

.tab i {
  font-size: 17px;
}

.tab:hover {
  color: var(--brand-primary);
  background: var(--brand-primary-light);
}

.tab--active {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
  background: var(--brand-primary-light);
}

/* Строки списка (пользователи, расписания, бэкапы) */
.list-item,
.backup-row {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-color);
  align-items: flex-start;
}

.list-item:last-child,
.backup-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.list-item:first-child,
.backup-row:first-child {
  padding-top: 0;
}

.list-item__info,
.backup-row__info {
  flex: 1;
  min-width: 0;
}

.list-item__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  line-height: 1.35;
}

.list-item__meta {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 3px;
  line-height: 1.45;
  word-break: break-word;
}

.list-item__meta code {
  background: #f1f5f9;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
}

.list-item__actions,
.backup-row__actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  align-self: flex-start;
}

.user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}

.badge-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--brand-primary-light);
  color: var(--brand-primary-dark);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-tag--off {
  background: #fee2e2;
  color: #991b1b;
}

/* Мобильная адаптация */
@media (max-width: 600px) {
  .tab {
    padding: 10px 14px;
    font-size: 13px;
  }

  .list-item,
  .backup-row {
    flex-wrap: wrap;
  }

  .list-item__actions,
  .backup-row__actions {
    width: 100%;
    justify-content: flex-end;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
  }
}


/* ============================================================
   ШАБЛОН TXT
   ============================================================ */

.txt-template {
  background: #0f172a;
  border-radius: 12px;
  padding: 16px 20px;
  overflow-x: auto;
  margin-bottom: 20px;
}

.txt-template pre {
  margin: 0;
  color: #e2e8f0;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre;
}

.txt-rules h4 {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 10px;
  color: var(--text-primary);
}

.txt-rules ul {
  padding-left: 20px;
  margin: 0;
}

.txt-rules li {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.txt-rules code {
  background: #f1f5f9;
  padding: 2px 7px;
  border-radius: 5px;
  font-family: 'Consolas', monospace;
  font-size: 12.5px;
  color: #0f172a;
}

details {
  margin-bottom: 8px;
}

details summary {
  padding: 8px 0;
  font-size: 14px;
  color: var(--brand-primary);
  user-select: none;
}

details summary:hover {
  color: var(--brand-primary-dark);
}

details[open] summary {
  margin-bottom: 4px;
}


/* ============================================================
   ШАПКА — финальные правила
   ============================================================ */

/* Бренд — логотип + текст рядом */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
}

.brand__logo,
.brand__logo-placeholder {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  flex-shrink: 0;
  object-fit: contain;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand__logo {
  background: var(--brand-primary-light);
  padding: 4px;
}

.brand__logo-placeholder {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  color: #fff;
  font-size: 22px;
  font-weight: 700;
}

/* Текстовый блок — разрешаем перенос на 2 строки */


/* Название — переносится, максимум 2 строки */


/* Подзаголовок — одна строка с многоточием */


/* На широких экранах — название в одну строку */
@media (min-width: 700px) {
  .brand {
    flex: 0 1 auto;
    max-width: 380px;
  }

  

  

  .brand__logo,
  .brand__logo-placeholder {
    width: 46px;
    height: 46px;
  }
}


/* ============================================================
   ТИПЫ ВОПРОСОВ — блоки на странице импорта
   ============================================================ */

.type-block {
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
}

.type-block:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.type-block__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.type-block__badge {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--brand-primary-light);
  color: var(--brand-primary-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.type-block__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.type-block__code {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 10px;
  padding: 12px 16px;
  margin: 0 0 8px;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre;
  overflow-x: auto;
}

.type-block__note {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.type-block__note code {
  background: #f1f5f9;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: 'Consolas', monospace;
  font-size: 12px;
  color: #0f172a;
}


/* ============================================================
   ЖУРНАЛ СЕРТИФИКАТОВ
   ============================================================ */

.mono-link {
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 12.5px;
  color: var(--brand-primary);
  text-decoration: none;
  word-break: break-all;
}

.mono-link:hover {
  text-decoration: underline;
}


/* ============================================================
   УПРАВЛЕНИЕ ПОЛЬЗОВАТЕЛЯМИ
   ============================================================ */

.user-row {
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
}

.user-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.user-row:first-child {
  padding-top: 0;
}

.user-row__head {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.user-row__avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}

.user-row__info {
  flex: 1;
  min-width: 0;
}

.user-row__name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.user-row__meta {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 3px;
  word-break: break-word;
}

.user-row__row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.user-row__actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.badge-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--brand-primary-light);
  color: var(--brand-primary-dark);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-tag--off {
  background: #fee2e2;
  color: #991b1b;
}

@media (min-width: 700px) {
  .user-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 20px;
    align-items: start;
  }

  .user-row__head {
    grid-column: 1 / -1;
    margin-bottom: 6px;
  }

  .user-row__row {
    margin-bottom: 0;
  }

  .user-row__actions {
    grid-column: 1 / -1;
    margin-top: 8px;
  }
}


/* ============================================================
   ВЫБОР ДНЕЙ НЕДЕЛИ
   ============================================================ */

.weekdays-grid {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.weekday-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 2px solid var(--border-color);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 600;
  font-size: 14px;
  user-select: none;
  background: #fff;
}

.weekday-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--brand-primary);
  cursor: pointer;
  margin: 0;
}

.weekday-check:hover {
  border-color: var(--brand-primary-light);
  background: #fafbff;
}

.weekday-check:has(input:checked) {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
}

.weekday-check:has(input:checked) input {
  accent-color: #fff;
}

.weekdays-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}


/* ============================================================
   ПЕРЕНОС НАЗВАНИЯ УЧРЕЖДЕНИЯ В ШАПКЕ
   ============================================================ */

/* Блок с текстом в шапке */
.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
  flex: 1;
  gap: 2px;
}

/* Название учреждения — до 2 строк */
.brand__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;

  /* Переносим длинные названия */
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;

  /* Максимум 2 строки, дальше — многоточие */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Подзаголовок — 1 строка с многоточием */
.brand__subtitle {
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Десктоп (от 700px) */
@media (min-width: 700px) {
  .brand__title {
    font-size: 16px;
    -webkit-line-clamp: 2;
  }

  .brand__subtitle {
    font-size: 12.5px;
  }
}

/* Мобильная версия */
@media (max-width: 480px) {
  .brand__title {
    font-size: 13px;
    -webkit-line-clamp: 2;
    line-height: 1.2;
  }

  .brand__subtitle {
    font-size: 11px;
  }
}
