/* Global mobile safety layer for legacy pages and admin tables. */
img,
video,
iframe {
    max-width: 100%;
}

iframe {
    border: 0;
}

.mobile-scroll-safe {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 767px) {
    html,
    body {
        max-width: 100%;
        overflow-x: hidden;
    }

    .mobile-scroll-safe {
        margin-left: -0.25rem;
        padding: 0 0.25rem 0.35rem;
    }

    table.mobile-card-table {
        width: 100% !important;
        min-width: 0 !important;
        border-collapse: separate !important;
        border-spacing: 0 0.85rem !important;
    }

    table.mobile-card-table thead,
    table.mobile-card-table colgroup {
        display: none !important;
    }

    table.mobile-card-table tbody,
    table.mobile-card-table tr,
    table.mobile-card-table td {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
    }

    table.mobile-card-table tr {
        border: 1px solid rgba(15, 23, 42, 0.1) !important;
        border-radius: 18px !important;
        background: #fff !important;
        box-shadow: 0 14px 34px rgba(15, 23, 42, 0.06) !important;
        overflow: hidden !important;
    }

    table.mobile-card-table td {
        position: relative !important;
        min-height: 44px !important;
        padding: 0.78rem 0.95rem !important;
        border: 0 !important;
        border-bottom: 1px solid rgba(15, 23, 42, 0.07) !important;
        background: transparent !important;
        color: #132238;
        white-space: normal !important;
        overflow-wrap: anywhere !important;
    }

    table.mobile-card-table td:last-child {
        border-bottom: 0 !important;
    }

    table.mobile-card-table td::before {
        content: attr(data-mobile-label);
        display: block;
        margin-bottom: 0.28rem;
        color: #64748b;
        font-size: 0.72rem;
        font-weight: 850;
        letter-spacing: 0.05em;
        text-transform: uppercase;
    }

    table.mobile-card-table td[data-mobile-label=""]::before,
    table.mobile-card-table td:not([data-mobile-label])::before {
        display: none;
    }

    table.mobile-card-table .btn,
    table.mobile-card-table button,
    table.mobile-card-table a[class*="btn"],
    table.mobile-card-table input,
    table.mobile-card-table select,
    table.mobile-card-table textarea {
        max-width: 100%;
    }

    table.mobile-card-table .btn,
    table.mobile-card-table button,
    table.mobile-card-table a[class*="btn"] {
        white-space: normal;
    }

    .datatable-wrapper,
    .dataTables_wrapper,
    .table-responsive {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media print {
    table.mobile-card-table,
    table.mobile-card-table thead,
    table.mobile-card-table tbody,
    table.mobile-card-table tr,
    table.mobile-card-table td,
    table.mobile-card-table th {
        display: revert !important;
        width: auto !important;
        min-width: 0 !important;
        border-collapse: collapse !important;
        border-spacing: 0 !important;
        box-shadow: none !important;
    }

    table.mobile-card-table td::before {
        display: none !important;
    }
}
