/* Shared small-screen safeguards for the PHP pages in both applications. */
@media screen and (max-width: 768px) {
    html, body { max-width: 100%; overflow-x: hidden; }
    img, video, canvas { max-width: 100%; height: auto; }
    input, select, textarea, button { min-width: 0; max-width: 100%; }
    .container, .container-fluid, .wrap, .main-content, main { max-width: 100%; }
    .row { --bs-gutter-x: 1rem; }

    .table-responsive, .table-card, .table-container, .table-wrap,
    .table-wrapper, .table-scroll, .table-box {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    table {
        display: block;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .modal, .modal-box, .modal-content, .dialog, .popup {
        max-width: calc(100vw - 16px);
        max-height: calc(100dvh - 16px);
        overflow: auto;
    }

    .filter, .filters, .filter-row, .form-row, .actions, .action-group {
        flex-wrap: wrap;
    }
    .filterGroup, .form-group { min-width: 0; max-width: 100%; }
    .admin-layout { flex-direction: column; }
    .admin-layout .sidebar {
        display: block !important;
        width: 100% !important;
        padding: 12px !important;
        box-shadow: none !important;
    }
    .admin-layout .sidebar .logo { margin-bottom: 10px; }
    .admin-layout .sidebar nav { display: flex; flex-wrap: wrap; gap: 6px; }
    .admin-layout .sidebar nav a { flex: 1 1 120px; }
}

@media screen and (max-width: 560px) {
    body { font-size: 14px; }
    .container, .container-fluid, .wrap, .main-content { padding-inline: 12px; }
    .page-header, .head, .admin-bar, .toolbar { flex-wrap: wrap; gap: 10px; }
    .form-row, .form-grid, .cards-grid, .systems, .features { grid-template-columns: minmax(0, 1fr) !important; }
    .modal-body, .modal-header, .modal-footer { padding-inline: 14px; }
    .btn, button, input[type="submit"] { min-height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
