
/* SkatteFix Mobile Rescue v5D
   Mycket försiktigare än v5C.
   Viktigt: inga globala pointer-events-regler, inga body:has-regler, ingen desktop-view påverkan.
*/

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

    .main-content {
        max-width: 100vw;
        overflow-x: hidden;
    }

    /* Growth Rewards / Referral */
    .sf-growth-mobile-page {
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }

    .sf-growth-mobile-page > div {
        max-width: 100% !important;
        padding-left: 14px !important;
        padding-right: 14px !important;
    }

    .sf-growth-mobile-page div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    .sf-growth-mobile-page div[style*="position:relative"][style*="display:grid"] {
        display: block !important;
    }

    .sf-growth-mobile-page div[style*="position:absolute"] {
        max-width: 45vw !important;
        opacity: .35;
    }

    .sf-growth-mobile-page h1 {
        font-size: clamp(2rem, 11vw, 3rem) !important;
        line-height: 1.02 !important;
        overflow-wrap: normal !important;
    }

    .sf-growth-mobile-page p {
        max-width: 100% !important;
    }

    .sf-growth-mobile-page button,
    .sf-growth-mobile-page a {
        max-width: 100% !important;
    }

    /* Cards/reward panels must not sit off-screen */
    .sf-growth-mobile-page .card,
    .sf-growth-mobile-page [class*="card"],
    .sf-growth-mobile-page div[style*="border-radius"] {
        max-width: 100% !important;
    }

    /* Lönespec: gör dokumentet till mobilkort istället för trasig sidledstabell */
    .sf-payslip-mobile-page {
        padding-left: 0 !important;
        padding-right: 0 !important;
        overflow-x: hidden !important;
    }

    .sf-payslip-mobile-page #payslip-print {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
        border-radius: 18px !important;
    }

    .sf-payslip-mobile-page #payslip-print > div:first-child {
        padding: 1.25rem !important;
        display: block !important;
    }

    .sf-payslip-mobile-page #payslip-print > div:first-child > div {
        text-align: left !important;
        margin-bottom: .8rem;
    }

    .sf-payslip-mobile-page #payslip-print [style*="grid-template-columns:1fr 1fr"] {
        display: block !important;
    }

    .sf-payslip-mobile-page #payslip-print [style*="border-right"] {
        border-right: 0 !important;
    }

    .sf-payslip-mobile-page #payslip-print table {
        width: 100% !important;
        min-width: 0 !important;
    }

    .sf-payslip-mobile-page #payslip-print th,
    .sf-payslip-mobile-page #payslip-print td {
        white-space: normal !important;
    }

    /* If lönespec uses hardcoded grid rows, allow inner scroll only on those blocks */
    .sf-payslip-mobile-page #payslip-print [style*="grid-template-columns"] {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Personalappen: säkerställ klickbarhet, men utan att stänga av overlays globalt */
    .sf-app-tabs,
    .sf-tabbar,
    .sf-tabs {
        position: relative;
        z-index: 50;
    }

    .sf-app-tabs a,
    .sf-app-tabs button,
    .sf-tabbar a,
    .sf-tabbar button,
    .sf-tabs a,
    .sf-tabs button,
    .sf-mobile-app a,
    .sf-mobile-app button {
        pointer-events: auto;
        touch-action: manipulation;
    }

    .sf-live-banner {
        z-index: 80;
    }
}
