/* EdoWiFi — responsif universal (SEMUA halaman: root, admin, pelanggan, WA, captive) */

html {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

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

    body {
        padding-left: max(8px, env(safe-area-inset-left, 0px));
        padding-right: max(8px, env(safe-area-inset-right, 0px));
        padding-top: max(8px, env(safe-area-inset-top, 0px));
        padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
    }

    img,
    video,
    svg,
    canvas,
    iframe {
        max-width: 100%;
        height: auto;
    }

    pre,
    code {
        overflow-x: auto;
        word-break: break-word;
        max-width: 100%;
    }

    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="search"],
    input[type="url"],
    select,
    textarea {
        font-size: 16px;
        max-width: 100%;
    }

    .box,
    .container,
    .wrap,
    .page,
    .card,
    [class*="-wrap"]:not(.reel-window):not(.leaflet-map-pane) {
        max-width: 100%;
        box-sizing: border-box;
    }

    .status-card,
    .profil-card,
    .pin-page .container {
        padding: 20px 16px !important;
    }

    .status-card .nama {
        font-size: 1.35rem !important;
        word-break: break-word;
    }

    .pin-page {
        padding: 16px !important;
        min-height: 100dvh;
        align-items: flex-start !important;
        padding-top: max(16px, env(safe-area-inset-top, 16px)) !important;
    }

    .daftar-wrap,
    .daftar-map {
        max-width: 100%;
    }

    .daftar-map {
        height: min(280px, 45vh) !important;
    }

    .map-page,
    .page {
        grid-template-columns: 1fr !important;
    }

    .map-sidebar,
    .left {
        order: 2;
    }

    .map-wrap,
    .right {
        order: 1;
        min-height: 50vh !important;
    }

    h1 {
        font-size: clamp(1.1rem, 5vw, 1.5rem);
        line-height: 1.3;
        word-break: break-word;
    }

    h2 {
        font-size: clamp(1rem, 4.5vw, 1.25rem);
    }

    table:not(.no-mobile-cards) {
        border: none;
    }

    table:not(.no-mobile-cards) thead {
        display: none;
    }

    table:not(.no-mobile-cards) tbody tr {
        display: block;
        margin-bottom: 10px;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        padding: 12px;
        background: #fff;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    }

    table:not(.no-mobile-cards) tbody tr:hover {
        background: #fff;
    }

    table:not(.no-mobile-cards) td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 10px;
        padding: 6px 0;
        border: none;
        text-align: right;
    }

    table:not(.no-mobile-cards) td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #64748b;
        font-size: 12px;
        text-align: left;
        flex: 1;
        padding-right: 8px;
    }

    table:not(.no-mobile-cards) tbody tr > td:first-child {
        display: block;
        padding: 0 0 8px;
        margin-bottom: 6px;
        border-bottom: 1px solid #e2e8f0;
        font-weight: 700;
        text-align: left;
        font-size: 15px;
    }

    table:not(.no-mobile-cards) tbody tr > td:first-child::before {
        display: none;
    }

    table:not(.no-mobile-cards) td:last-child {
        display: block;
        padding-top: 10px;
        margin-top: 4px;
        border-top: 1px solid #e2e8f0;
    }

    table:not(.no-mobile-cards) td:last-child::before {
        display: none;
    }

    table:not(.no-mobile-cards) td:last-child .btn,
    table:not(.no-mobile-cards) td:last-child a.btn,
    table:not(.no-mobile-cards) td:last-child button,
    table:not(.no-mobile-cards) td:last-child form {
        width: 100%;
        margin: 4px 0;
        display: block;
        text-align: center;
        box-sizing: border-box;
    }

    table:not(.no-mobile-cards) td[colspan] {
        display: block;
        text-align: center;
    }

    table:not(.no-mobile-cards) td[colspan]::before {
        display: none;
    }

    .btn,
    button,
    a.btn {
        min-height: 40px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    .modal,
    .dash-modal,
    .inv-modal,
    .forgot-overlay,
    .suspend-overlay {
        align-items: flex-end !important;
        padding: 0 !important;
    }

    .modal-content,
    .dash-modal__panel,
    .inv-modal__panel,
    .forgot-popup,
    .suspend-popup {
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        border-radius: 16px 16px 0 0 !important;
        max-height: 92vh;
        overflow-y: auto;
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
    }
}

@media (max-width: 400px) {
    .stats-grid,
    .dashboard,
    .inv-kpi {
        grid-template-columns: 1fr !important;
    }
}
