/* Мобильная версия: удобно как приложение, никаких боковых прокруток */

html { -webkit-text-size-adjust: 100%; }
html, body { max-width: 100%; }

/* ВАЖНО: специально НЕ используем overflow-x: hidden на html/body —
   на iOS Safari это ломает вертикальную прокрутку страницы.
   `clip` обрезает по горизонтали, не создавая скролл-контейнер. */
body { overflow-x: clip; }

img { max-width: 100%; height: auto; }

/* убираем случайные переполнения по ширине */
.wrap, .card, .hero-inner, .tabpane, .board-table { min-width: 0; }

@media (max-width: 640px) {
  /* --- шапка --- */
  .hero { padding: 14px 12px; }
  .hero.small { padding: 12px; }
  .hero-inner { gap: 10px; align-items: center; }
  h1 { font-size: 19px; line-height: 1.25; }
  .sub { font-size: 13px; }
  .emblem { height: 46px; }

  /* --- контент --- */
  .wrap { padding: 0 10px; margin: 12px auto; gap: 12px; }
  .card { padding: 14px; border-radius: 14px; }
  h2 { font-size: 17px; }
  .info ul { padding-left: 18px; }

  /* --- дни: переносим в строки, без горизонтальной прокрутки --- */
  .days { flex-wrap: wrap; overflow: visible; gap: 6px; padding-bottom: 0; }
  .day { padding: 9px 12px; font-size: 14px; border-radius: 10px; flex: 1 1 auto; }

  /* --- слоты: 3 в ряд, крупные и удобные --- */
  .slots { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .slot { min-height: 54px; font-size: 17px; border-radius: 12px; }

  /* --- поля и кнопки --- */
  input[type=text], input[type=tel], textarea, select { font-size: 17px; }
  select { height: 52px; }
  .btn.big { min-height: 52px; font-size: 16px; }
  .rowform { grid-template-columns: 1fr; gap: 0; }
  .captcha { gap: 6px; }
  .captcha img { height: 52px; }
  /* поле кода растягивается по ширине строки (раньше было 92px — подсказка не влезала) */
  .captcha input { flex: 1 1 140px; max-width: none; }
  .foot { margin: 16px auto 24px; }

  /* --- таблица записей в админке превращается в карточки --- */
  .board-table { border: 0; font-size: 15px; }
  .board-table thead { display: none; }
  .board-table tbody, .board-table tr, .board-table td { display: block; width: 100%; }
  .board-table tr {
    border: 1px solid var(--line); border-radius: 14px; background: #fff;
    padding: 8px 12px; margin-bottom: 10px;
  }
  .board-table td {
    display: flex; gap: 10px; justify-content: space-between; align-items: flex-start;
    border: 0; padding: 6px 0; text-align: right;
  }
  .board-table td::before {
    content: attr(data-label);
    color: var(--muted); font-weight: 600; text-align: left; flex: 0 0 40%;
  }
  .board-table td[colspan] { justify-content: center; text-align: center; color: var(--muted); }
  .board-table td[colspan]::before { content: none; }
  .board-table .rowactions { width: 100%; gap: 8px; padding-top: 8px; }
  .board-table .rowactions .btn { flex: 1 1 0; min-height: 44px; font-size: 15px; }

  /* --- окна --- */
  .modal-box { padding: 16px; border-radius: 14px; }
  .confirm-table th { width: 44%; }

  /* --- уведомления растягиваем по ширине экрана --- */
  .toast-host { bottom: 12px; width: calc(100vw - 24px); }
  .toast { padding: 11px 12px; }
}

@media (max-width: 380px) {
  .slots { grid-template-columns: repeat(2, 1fr); }
  h1 { font-size: 17px; }
  .emblem { height: 40px; }
}
