/**
 * Mobile platform — iOS / iPadOS (Safari / WKWebView).
 * Chỉ chrome & inset; view nghiệp vụ dùng chung mobile-shell.css.
 */
body.app-mobile-ios {
    --app-mobile-touch-min: 44px;
    /* Home indicator + nav app */
    --app-mobile-nav-clearance: calc(
        var(--app-mobile-nav-h, 3.75rem)
        + env(safe-area-inset-bottom, 0px)
        + var(--app-mobile-keyboard-inset, 0px)
    );
}

body.app-mobile-ios .mobile-bottom-nav {
    /* Nav đã có padding-bottom safe-area; giữ chiều nội dung ổn định */
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

body.app-mobile-ios .mobile-action-cell,
body.app-mobile-ios button.mobile-action-cell,
body.app-mobile-ios .mobile-detail-action-btn,
body.app-mobile-ios .mobile-filter-open-btn,
body.app-mobile-ios .mobile-form-actions .app-btn {
    min-height: var(--app-mobile-touch-min, 44px);
}

body.app-mobile-ios .mobile-detail-fab {
    bottom: calc(0.75rem + var(--app-mobile-nav-clearance, 3.75rem));
    min-height: var(--app-mobile-touch-min, 44px);
}

body.app-mobile-ios .mobile-detail-action-sheet-panel {
    padding-bottom: calc(0.65rem + var(--app-mobile-nav-clearance, 3.75rem) + env(safe-area-inset-bottom, 0px));
}

body.app-mobile-ios .mobile-view.is-showing-detail .mobile-view-detail {
    padding-bottom: 0;
}

body.app-mobile-ios .mobile-form-panel {
    padding-bottom: calc(1.5rem + var(--app-mobile-nav-clearance, 3.75rem));
}

/* Notch / Dynamic Island — drawer không chạm tai thỏ */
body.app-mobile-ios .mobile-drawer-panel {
    padding-top: env(safe-area-inset-top, 0px);
}

body.app-mobile-ios .mobile-filter-sheet-panel {
    max-height: min(78vh, calc(100dvh - var(--app-mobile-keyboard-inset, 0px) - 2rem));
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
}

body.app-mobile-ios .mobile-filter-sheet-foot {
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
}

/* Capacitor iOS: inset đầy từ Keyboard plugin — clearance đã gồm --app-mobile-keyboard-inset */
body.app-mobile-ios.app-mobile-capacitor .mobile-bottom-nav {
    /* Ẩn/đẩy nav khi IME lớn — clearance sticky actions đủ */
    bottom: 0;
}

/* Overlay: căn giữa nhẹ, bo góc hệ thống */
body.app-mobile-ios #app-overlay-host > [id$="-modal"],
body.app-mobile-ios #app-overlay-host > [data-app-modal] {
    align-items: center;
    padding: 0.5rem;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
}
body.app-mobile-ios #app-overlay-host .app-modal-panel {
    max-height: min(90dvh, calc(100dvh - var(--app-header-h, 4rem) - env(safe-area-inset-bottom, 0px)));
    border-radius: 0.85rem;
    width: min(100%, 40rem);
}
