/* Small-phone controls shared by ordinary pages, forms and dynamic dialogs. */
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft JhengHei", "Microsoft YaHei", sans-serif; }
/* Avoid hundreds of intermediate layout frames while navigation changes width. */
.main-sidebar, .content-wrapper, .main-header, .main-footer { transition: none !important; }
@media screen and (max-width: 767.98px) {
    .wrapper .shadow-lg, .wrapper .elevation-4 { box-shadow: none !important; }
    html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
    body { overflow-wrap: break-word; }
    body.layout-navbar-fixed > .wrapper > .content-wrapper {
        min-width: 0;
        padding-left: max(4px, env(safe-area-inset-left)) !important;
        padding-right: max(4px, env(safe-area-inset-right)) !important;
        font-size: 16px;
        line-height: 1.5;
    }
    body.layout-navbar-fixed .content-wrapper .card-body { min-width: 0; }
    body.layout-navbar-fixed .content-wrapper .card-header { overflow-wrap: anywhere; }
    body.layout-navbar-fixed .content-wrapper .form-group { min-width: 0; }
    body.layout-navbar-fixed .content-wrapper .d-flex.flex-wrap > .form-group { min-width: 0 !important; width: 100%; }
    body.layout-navbar-fixed .content-wrapper .form-inline > .form-group { min-width: 0 !important; width: 100%; flex-basis: 100%; }
    body.layout-navbar-fixed .content-wrapper h1,
    body.layout-navbar-fixed .content-wrapper h2 { font-size: 22px; line-height: 1.35; }
    body.layout-navbar-fixed .content-wrapper label { font-size: 14px; }
    body.layout-navbar-fixed .content-wrapper .table th,
    body.layout-navbar-fixed .content-wrapper .table td { font-size: 14px; line-height: 1.45; }
    body .modal .table th, body .modal .table td,
    body .swal2-popup .table th, body .swal2-popup .table td { font-size: 14px; line-height: 1.45; padding: 8px; word-break: normal; }
    body.layout-navbar-fixed .content-wrapper .small,
    body.layout-navbar-fixed .content-wrapper small { font-size: 13px; }

    body.layout-navbar-fixed .content-wrapper .form-control:not(.select2-hidden-accessible),
    body .content-wrapper .custom-select,
    body .modal .form-control, body .swal2-popup .form-control,
    body .swal2-input, body .swal2-textarea, body .swal2-select,
    body .select2-search__field, body .login-box .form-control {
        min-height: 44px;
        height: auto;
        font-size: 16px !important;
        line-height: 1.4;
        padding: 10px;
    }
    body .content-wrapper textarea.form-control, body .modal textarea.form-control { min-height: 96px; }
    body .content-wrapper input[type="file"] { max-width: 100%; font-size: 16px; }
    body .content-wrapper input[type="date"], body .content-wrapper input[type="datetime-local"] {
        min-width: 0; max-width: 100%; -webkit-appearance: none;
    }
    body .content-wrapper .select2-container { max-width: 100%; }
    body.layout-navbar-fixed .content-wrapper .select2-selection { min-height: 44px; }
    body.layout-navbar-fixed .content-wrapper .select2-selection--single .select2-selection__rendered { font-size: 16px; line-height: 42px; }
    body.layout-navbar-fixed .content-wrapper .select2-selection--single .select2-selection__arrow { height: 42px; }
    body .content-wrapper .bootstrap-switch .bootstrap-switch-handle-on,
    body .content-wrapper .bootstrap-switch .bootstrap-switch-handle-off,
    body .content-wrapper .bootstrap-switch .bootstrap-switch-label { min-height: 44px; padding: 10px 8px; line-height: 24px; font-size: 14px; }
    body .select2-results__option { min-height: 44px; padding: 11px 10px; font-size: 16px; }

    body .content-wrapper .btn:not(.btnScGroupCondition),
    body .main-footer .btn, body .modal .btn,
    body .swal2-styled, body .login-box button {
        min-height: 44px;
        font-size: 15px;
        line-height: 1.4;
        padding: 10px 12px;
        white-space: normal;
        touch-action: manipulation;
    }
    body .content-wrapper .btn-tool, body .modal .close, body .swal2-close { min-width: 44px; min-height: 44px; }
    body.layout-navbar-fixed.erp-table-workspace .content-wrapper .btn:not(.btnScGroupCondition) { min-height: 44px; }
    body.layout-navbar-fixed .content-wrapper .page-link { min-width: 44px; min-height: 44px; }
    body .content-wrapper .btn:focus-visible, body .main-footer .btn:focus-visible,
    body .main-sidebar a:focus-visible { outline: 3px solid #0284c7; outline-offset: 2px; }
    body .content-wrapper .nav-tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    body .content-wrapper .nav-tabs .nav-link { min-height: 44px; padding: 10px 12px; white-space: nowrap; }
    /* Let long action toolbars scroll away so they cannot cover the first rows. */
    body.erp-table-workspace .kkson-crud-table-header.card-header.sticky-top { position: static !important; }
    body.erp-table-workspace .erp-column-filter-toggle { display: inline-flex; align-items: center; }
    body .content-wrapper .alert, body .content-wrapper pre { overflow-wrap: anywhere; }
    body .content-wrapper pre { max-width: 100%; overflow-x: auto; }
    body .scrapper-cron-summary-region .flex-shrink-0 { flex-shrink: 1 !important; flex-wrap: wrap; min-width: 0; max-width: 100%; }
    body .scrapper-cron-summary-region h3 { max-width: 100%; margin-bottom: 6px !important; font-size: 18px; }
    body .scrapper-cron-summary-region .badge { white-space: normal; overflow-wrap: anywhere; line-height: 1.45; font-size: 14px; }
    body .scrapper-cron-master-datetime { max-width: 100%; white-space: normal; }

    body.layout-navbar-fixed .wrapper .main-header.navbar {
        height: calc(48px + env(safe-area-inset-top));
        min-height: 48px;
        padding: env(safe-area-inset-top) max(6px, env(safe-area-inset-right)) 0 max(6px, env(safe-area-inset-left));
    }
    body.layout-navbar-fixed .wrapper .main-header .nav-link { width: 44px; height: 44px; padding: 10px; font-size: 18px; }
    body.layout-navbar-fixed .wrapper .content-wrapper { margin-top: calc(52px + env(safe-area-inset-top)) !important; }
    body.layout-navbar-fixed .card-header.sticky-top { top: calc(52px + env(safe-area-inset-top)) !important; }
    body.layout-navbar-fixed .wrapper .main-header .navbar-nav { min-width: 0; max-width: 100%; }
    body.layout-navbar-fixed .wrapper .main-header .nav-item.d-flex { min-width: 0; }
    body.layout-navbar-fixed .wrapper .main-header .font-weight-bold { font-size: 18px !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    body.layout-navbar-fixed > .wrapper > .main-sidebar { padding-top: env(safe-area-inset-top); }
    body.layout-navbar-fixed .main-sidebar > .brand-link-wrapper { align-items: center; min-height: 52px; width: 100%; }
    body.layout-navbar-fixed .brand-link-wrapper .brand-link {
        display: flex; align-items: center; flex: 1 1 0; min-width: 0; width: auto !important;
        height: 52px; padding: 8px; font-size: 15px;
    }
    body.layout-navbar-fixed .brand-link-wrapper .brand-image { float: none; flex-shrink: 0; width: 28px; height: 28px; margin: 0 8px 0 0; }
    body.layout-navbar-fixed .brand-link-wrapper .brand-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    body.layout-navbar-fixed .brand-link-wrapper .sidebar-close-btn {
        position: static; flex: 0 0 44px; width: 44px; height: 44px; margin-right: 4px; padding: 10px;
    }
    body.layout-navbar-fixed .main-sidebar .nav-sidebar .nav-link { display: flex; align-items: center; min-height: 44px; padding: 10px 8px; font-size: 15px; }
    body.layout-navbar-fixed .main-sidebar .nav-sidebar .nav-link > p { flex: 1; white-space: normal; }
    body.layout-navbar-fixed .main-sidebar .nav-sidebar .nav-link > p > .right { top: 14px; }
    body.sidebar-open { overflow: hidden; }

    body.layout-navbar-fixed > .wrapper > .main-footer {
        padding: 10px max(12px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
        font-size: 12px;
        line-height: 1.4;
    }
    body.layout-navbar-fixed .main-footer > .mr-auto { min-width: 0; width: 100%; }
    body.layout-navbar-fixed .main-footer .btn { margin-bottom: 0; }
    body.erp-phone-keyboard.layout-footer-fixed > .wrapper { padding-bottom: 0; }
    body.erp-phone-keyboard.layout-footer-fixed > .wrapper > .main-footer { position: static !important; }

    body .dropdown-menu, body .dt-button-collection { max-width: calc(100vw - 24px); max-height: 60vh; max-height: 60dvh; overflow-y: auto; }
    body .dropdown-menu .dropdown-item { min-height: 44px; padding: 11px 12px; font-size: 15px; white-space: normal; }
    body .modal { padding-left: max(8px, env(safe-area-inset-left)) !important; padding-right: max(8px, env(safe-area-inset-right)) !important; }
    body .modal-dialog { width: auto; max-width: 100%; margin: max(8px, env(safe-area-inset-top)) 0; }
    body .modal-content { max-height: calc(var(--erp-visual-height, 100dvh) - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
    body .modal-body { min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
    body .modal-header, body .modal-footer { flex-shrink: 0; flex-wrap: wrap; gap: 8px; padding: 12px; }
    body .modal-title { overflow-wrap: anywhere; font-size: 20px; }
    body .modal-header .close { margin: -8px -8px -8px auto; padding: 10px; }
    body .swal2-container { padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); }
    body .swal2-popup { max-width: 100% !important; max-height: calc(var(--erp-visual-height, 100dvh) - 24px); padding: 16px; font-size: 16px; overflow: hidden; }
    body .swal2-popup.swal2-show, body .swal2-popup.swal2-noanimation { display: flex !important; flex-direction: column; }
    body .swal2-popup > .swal2-icon { flex-shrink: 0; width: 48px; height: 48px; margin: 8px auto; font-size: 12px; }
    body .swal2-title { flex-shrink: 0; font-size: 22px; overflow-wrap: anywhere; padding: 8px 0; }
    body .swal2-html-container, body .swal2-content { flex: 1 1 auto; min-width: 0; min-height: 0; max-width: 100%; margin: 12px 0 0; overflow-wrap: anywhere; overflow-y: auto; -webkit-overflow-scrolling: touch; }
    body .swal2-header, body .swal2-actions { flex-shrink: 0; }
    body .swal2-actions { flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }
    body .swal2-actions .swal2-styled { margin: 0; }
    body .daterangepicker { left: max(8px, env(safe-area-inset-left)) !important; right: max(8px, env(safe-area-inset-right)) !important; width: auto; max-width: none; max-height: calc(var(--erp-visual-height, 100dvh) - 24px); overflow-y: auto; }
    body .daterangepicker .drp-calendar { float: none; width: 100%; max-width: none; padding: 8px; }
    body .daterangepicker .calendar-table th, body .daterangepicker .calendar-table td { height: 36px; font-size: 14px; }
    body .daterangepicker select, body .daterangepicker .drp-buttons .btn { min-height: 44px; font-size: 16px; }

    body.login-page { justify-content: flex-start; min-height: 100vh !important; min-height: 100dvh !important; padding: max(24px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
    body .login-box { width: 100%; max-width: 380px; margin: auto; }
    body .login-box .card-header .h1 { font-size: 24px; line-height: 1.4; overflow-wrap: anywhere; }
    body .login-box .card-body { padding: 20px; }
    body .login-box .row > .col-4.offset-8 { flex: 0 0 100%; max-width: 100%; margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .main-sidebar, .content-wrapper, .main-header, .main-footer { transition: none !important; }
}
