/* mobile-fixes.css — мобильный аудит 20.10 (v1.0, Тимур с айфона). Подключается последним; всё — только до 768 px, десктоп не трогает.
   1) Высота экрана: iPhone Safari считает 100vh по «большому» окну (без полосы адреса), поэтому body был выше видимой области, документ листался,
      шапка с кнопкой меню уезжала за край, а низ ящика меню оставался под панелью браузера. Теперь высота — по видимой области (dvh / fill-available),
      документ не листается, листается только #app-main.
   2) Ящик меню: листается целиком, внизу запас под нижнюю панель и «чёлку».
   3) Пальцем попадать надо: 44×44 px у кнопок, вкладок, полей, значков шапки; закрытие окна — крупное.
   4) Окна: форма — на весь экран (уже было), диалог — нижний лист на всю ширину, не колонка по центру. */

@media (max-width: 768px) {
  /* 1. высота и прокрутка */
  html { height: -webkit-fill-available; }
  body {
    width: 100%;
    height: 100vh; height: -webkit-fill-available; height: 100dvh;
    overflow: hidden; overscroll-behavior: none;
  }
  #app-main { overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; }
  #app-header { position: sticky; top: 0; z-index: 20; }
  .ak-header { padding-top: env(safe-area-inset-top, 0px); }

  /* 2. ящик меню */
  #app-sidebar { height: 100vh; height: -webkit-fill-available; height: 100dvh; max-height: 100dvh; bottom: auto; }
  .ak-nav { height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px)); }
  .ak-item, .ak-subitem { min-height: 44px; box-sizing: border-box; }

  /* 3. размер касания */
  .ak-hamb, .ak-ibtn, .ak-bell, .ak-avbtn, .ak-nav__close, .ak-create { min-width: 44px; min-height: 44px; }
  .ak-hamb, .ak-ibtn, .ak-nav__close { width: 44px; height: 44px; }
  .ak-bell, .ak-avbtn { width: 44px; height: 44px; }
  .ak-create { height: 44px; }
  .ak-menu__item { min-height: 44px; }
  .btn, button.btn, a.btn { min-height: 44px; }
  .btn--sm, .btn--xs { min-height: 44px; padding-left: 14px; padding-right: 14px; }
  .core-tabs__chip, .ark-tab, .ak-tab { min-height: 44px; }
  .form-input, .form-select, select.form-input, input.form-input { min-height: 44px; }
  .form-input, .form-select, .form-textarea, input, select, textarea { font-size: 16px; }            /* iOS приближает страницу при фокусе на поле мельче 16 px */
  label.ua-chk, label:has(> input[type="checkbox"]), label:has(> input[type="radio"]) { min-height: 44px; display: flex; align-items: center; gap: 10px; }
  .badge { min-height: 24px; }

  /* 4. окна */
  .modal__dismiss { width: 44px; height: 44px; font-size: 22px; }
  .modal__header { min-height: 56px; }
  .modal-overlay:not(:has(.modal--form, .modal--editor)) { align-items: flex-end; padding: 0; }
  .modal-overlay:not(:has(.modal--form, .modal--editor)) .modal { width: 100% !important; margin: 0 !important; max-width: 100% !important; max-height: 92vh; max-height: 92dvh; border-radius: 16px 16px 0 0; border-width: 1px 0 0; }
  .modal-overlay:not(:has(.modal--form, .modal--editor)) .modal__footer { padding-bottom: calc(var(--space-3, 12px) + env(safe-area-inset-bottom, 0px)); flex-wrap: wrap; }
  .modal__footer .btn { flex: 1 1 auto; }
  .modal__body { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
}

@media (max-width: 768px) {
  html body #app-main .core-tabs__chip, html body #app-main .ark-tab, html body .ak-tab, html body .core-tabs__chip, html body .ark-tab { min-height: 44px; }
  .ak-logo-mob { min-width: 44px; min-height: 44px; justify-content: center; }
  .ak-nav__logout, .ak-nav__close { min-height: 44px; }
  .cs-back, .csw-step__b { min-height: 44px; display: inline-flex; align-items: center; }
  .csw-step__b { display: flex; }
  .d3-part, .d3-preview__off, .d3-chip { min-height: 44px; box-sizing: border-box; }
  .core-table__checkbox { width: 22px; height: 22px; margin: 11px; }
  .page-header { flex-wrap: wrap; gap: 10px 12px; }
  .page-header > * { min-width: 0; }
  .page-header .btn { flex: 0 1 auto; }
  .hm-btn { min-height: 44px; }
  .hm-all, .cs-qr__l { display: inline-flex; align-items: center; min-height: 44px; padding-left: 6px; padding-right: 6px; }
  .d3-btn, .tk-tab, .hm-add, .so-chip, .hm-btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  #app-main a:not([class]) { display: inline-flex; align-items: center; min-height: 44px; }
  html body .tk-tab { min-height: 44px; height: auto; }
  html body .so-btn, html body .so-tool, html body .so-rx { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; }
  /* вход: высота по видимой области (клавиатура), форма листается, если не влезла */
  body.login-mode #app-main, .auth-root { height: 100vh; height: 100dvh; }
  .auth-root { overflow-y: auto; }
  .wpc-back, .wpc-email { display: inline-flex; align-items: center; min-height: 44px; }
  .advisor-card__btn, .rn__b { min-height: 44px; min-width: 44px; }
  html body #app-main .tk-tab, html body #app-main .so-cm { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; }
}
