/* =============================================================
   ROLLIN HOST 2026 — Mobile App Experience
   Faz o WHMCS parecer um app nativo no celular:
   - Safe area insets (iPhone notch/dynamic island)
   - Bottom navigation fixa
   - Bottom sheets ao invés de modais
   - Touch targets 44px+ (Apple HIG)
   - Momentum scrolling + scroll snap
   - Splash screen
   - PWA standalone mode
   ============================================================= */

/* ===== Safe area insets — iOS notch / Dynamic Island ===== */
:root {
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);

    /* Altura da bottom nav + safe area */
    --mobile-nav-height: 64px;
    --mobile-nav-total: calc(var(--mobile-nav-height) + var(--safe-bottom));
}

/* Quando PWA standalone (instalado) */
@media all and (display-mode: standalone) {
    :root {
        --is-standalone: 1;
    }
    body {
        user-select: none;
        -webkit-user-select: none;
        -webkit-touch-callout: none;
    }
    /* Esconder elementos desnecessários no app instalado */
    .pwa-hide { display: none !important; }
}

/* ===== Reset mobile-friendly ===== */
@media (max-width: 991px) {
    html {
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
        touch-action: manipulation; /* elimina delay de 300ms */
    }

    body {
        overscroll-behavior-y: contain; /* bloqueia pull-to-refresh nativo */
        -webkit-tap-highlight-color: transparent;
        padding-top: var(--safe-top) !important;
        padding-left: var(--safe-left) !important;
        padding-right: var(--safe-right) !important;
        padding-bottom: var(--mobile-nav-total) !important;
    }

    /* Header mobile-friendly */
    #header,
    .header.navbar-expand-lg {
        padding-top: calc(var(--safe-top) + 8px) !important;
        padding-left: var(--safe-left) !important;
        padding-right: var(--safe-right) !important;
    }

    /* Momentum scrolling iOS */
    .rollin-ai-messages,
    .rollin-bottom-sheet,
    .rollin-scroll-snap,
    .table-responsive {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }

    /* Prevenir zoom em inputs iOS (font-size 16px+) */
    input, textarea, select {
        font-size: 16px !important;
    }
}

/* =============================================================
   BOTTOM NAVIGATION — tipo app nativo
   ============================================================= */

.rollin-mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9996;

    /* Glass heavy */
    background: rgba(24, 0, 37, 0.85);
    /* backdrop-filter removido (perf) */
    /* -webkit-backdrop-filter removido (perf) */
    border-top: 1px solid var(--border-subtle);

    /* Safe area padding bottom pra notch/home indicator */
    padding: 8px var(--safe-right) calc(8px + var(--safe-bottom)) var(--safe-left);

    /* Sombra superior sutil pra destacar */
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.3);
}

@media (max-width: 991px) {
    .rollin-mobile-nav {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 4px;
    }
}

.rollin-nav-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 2px;
    min-height: 56px;                 /* touch target confortável */
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    -webkit-tap-highlight-color: transparent;
    letter-spacing: 0.01em;
}

.rollin-nav-item i,
.rollin-nav-item svg {
    font-size: 22px;
    transition: all var(--transition-base);
}

.rollin-nav-item:active {
    transform: scale(0.92);
    background: rgba(255, 255, 255, 0.06);
}

.rollin-nav-item.active {
    color: var(--accent-pink);
}

.rollin-nav-item.active i {
    transform: translateY(-2px);
    filter: drop-shadow(0 4px 12px rgba(250, 44, 104, 0.6));
}

/* Indicador superior animado */
.rollin-nav-item.active::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 3px;
    background: var(--gradient-primary);
    border-radius: 0 0 3px 3px;
    box-shadow: 0 2px 10px rgba(250, 44, 104, 0.5);
    animation: rollinNavIndicator 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes rollinNavIndicator {
    from { width: 0; opacity: 0; }
    to { width: 28px; opacity: 1; }
}

/* Badge de notificação */
.rollin-nav-badge {
    position: absolute;
    top: 4px;
    right: 50%;
    margin-right: -18px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--accent-pink);
    color: white;
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--rollin-purple-800);
    box-shadow: 0 2px 8px rgba(250, 44, 104, 0.5);
    animation: rollinBadgePop 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes rollinBadgePop {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

/* CTA central destacado (ex: "Contratar") */
.rollin-nav-item.rollin-nav-cta {
    position: relative;
}

.rollin-nav-item.rollin-nav-cta i {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: var(--shadow-glow-pink);
    margin-bottom: 2px;
    transition: all var(--transition-bounce);
}

.rollin-nav-item.rollin-nav-cta:active i {
    transform: scale(0.88) rotate(-8deg);
}

/* Esconde launcher IA quando a bottom nav está visível (evita sobreposição) */
@media (max-width: 991px) {
    #rollin-ai-launcher {
        bottom: calc(var(--mobile-nav-total) + 16px) !important;
        width: 52px !important;
        height: 52px !important;
        font-size: 22px !important;
    }
    #rollin-ai-panel {
        bottom: calc(var(--mobile-nav-total) + 80px) !important;
        width: calc(100vw - 16px) !important;
        right: 8px !important;
        left: 8px !important;
        height: calc(100vh - var(--mobile-nav-total) - 120px) !important;
        max-height: none !important;
    }
}

/* =============================================================
   BOTTOM SHEET — modais que sobem de baixo tipo iOS
   ============================================================= */

.rollin-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    /* backdrop-filter removido pra performance */
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
}

.rollin-sheet-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.rollin-bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: var(--rollin-purple-700);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    border-top: 1px solid var(--border-default);
    box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.5);
    padding: 8px var(--space-lg) calc(var(--space-lg) + var(--safe-bottom));
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform var(--transition-slow);
    touch-action: pan-y;
}

.rollin-bottom-sheet.open {
    transform: translateY(0);
    animation: rollinSheetBounce 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes rollinSheetBounce {
    0% { transform: translateY(100%); }
    60% { transform: translateY(-1.5%); }
    100% { transform: translateY(0); }
}

.rollin-sheet-handle {
    display: block;
    width: 40px;
    height: 4px;
    margin: 0 auto var(--space-md);
    background: var(--border-strong);
    border-radius: var(--radius-full);
    cursor: grab;
}

.rollin-sheet-title {
    font-size: var(--fs-lg);
    font-weight: 700;
    margin-bottom: var(--space-md);
    text-align: center;
}

/* =============================================================
   PULL-TO-REFRESH indicator
   ============================================================= */

.rollin-ptr {
    position: fixed;
    top: calc(var(--safe-top) + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    z-index: 9995;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--rollin-purple-700);
    border: 1px solid var(--border-default);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-base);
    pointer-events: none;
}

.rollin-ptr.pulling {
    transform: translateX(-50%) translateY(calc(var(--ptr-offset, 0px)));
    transition: none;
}

.rollin-ptr.refreshing {
    transform: translateX(-50%) translateY(20px);
}

.rollin-ptr i {
    color: var(--accent-pink);
    font-size: 18px;
    transition: transform var(--transition-base);
}

.rollin-ptr.refreshing i {
    animation: rollinSpin 900ms linear infinite;
}

@keyframes rollinSpin {
    to { transform: rotate(360deg); }
}

/* =============================================================
   MOBILE HEADER + DRAWER (≤ 991px)
   ============================================================= */

/* Por padrão (desktop), o mobile header e drawer ficam escondidos */
.rollin-mobile-header,
.rh-drawer,
.rh-drawer-overlay { display: none; }

@media (max-width: 991px) {
    /* Esconde a navbar desktop no mobile */
    .rollin-navbar { display: none !important; }

    /* === Mobile header === */
    .rollin-mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        position: sticky;
        top: 0;
        z-index: 900;
        padding: 12px 16px;
        padding-top: calc(env(safe-area-inset-top, 0px) + 12px);
        background: rgba(10, 0, 20, 0.82);
        /* backdrop-filter removido (perf) */
        /* -webkit-backdrop-filter removido (perf) */
        border-bottom: 1px solid rgba(255,255,255,0.08);
    }
    [data-theme="light"] .rollin-mobile-header {
        background: rgba(250, 250, 252, 0.88);
        border-bottom-color: rgba(13,10,31,0.08);
    }

    /* Hamburger button */
    .rh-mh-burger {
        width: 42px;
        height: 42px;
        border-radius: 12px;
        border: 1px solid rgba(255,255,255,0.10);
        background: rgba(255,255,255,0.05);
        cursor: pointer;
        padding: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 5px;
        flex-shrink: 0;
        -webkit-tap-highlight-color: transparent;
        transition: background 160ms ease, transform 160ms ease;
    }
    .rh-mh-burger span {
        width: 18px;
        height: 2px;
        background: var(--text-primary);
        border-radius: 1px;
        transition: transform 220ms cubic-bezier(.2,.7,.2,1),
                    opacity 180ms ease;
    }
    .rh-mh-burger:active { transform: scale(0.94); background: rgba(138,43,214,0.18); }
    [data-theme="light"] .rh-mh-burger {
        border-color: rgba(13,10,31,0.10);
        background: rgba(255,255,255,0.7);
    }

    /* Burger morphs into X when drawer open */
    .rh-mh-burger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .rh-mh-burger.is-open span:nth-child(2) { opacity: 0; }
    .rh-mh-burger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    /* Brand */
    .rh-mh-brand {
        display: flex;
        align-items: center;
        text-decoration: none;
        flex: 1;
        justify-content: center;
        max-width: 60%;
    }
    .rh-mh-brand img {
        height: 26px;
        max-width: 140px;
        width: auto;
        display: block;
    }
    .rh-mh-brand .rh-logo-light { display: none; }
    .rh-mh-brand .rh-logo-dark  { display: block; }
    [data-theme="light"] .rh-mh-brand .rh-logo-light { display: block; }
    [data-theme="light"] .rh-mh-brand .rh-logo-dark  { display: none; }

    /* Right actions */
    .rh-mh-actions {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        flex-shrink: 0;
    }
    .rh-mh-icon {
        position: relative;
        width: 40px;
        height: 40px;
        border-radius: 12px;
        background: rgba(255,255,255,0.05);
        border: 1px solid rgba(255,255,255,0.10);
        color: var(--text-primary);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        text-decoration: none !important;
        -webkit-tap-highlight-color: transparent;
        transition: background 160ms ease, transform 160ms ease;
    }
    .rh-mh-icon:active { transform: scale(0.94); background: rgba(138,43,214,0.18); }
    .rh-mh-icon i { width: 18px; height: 18px; }
    [data-theme="light"] .rh-mh-icon {
        background: rgba(255,255,255,0.7);
        border-color: rgba(13,10,31,0.10);
    }
    .rh-mh-badge {
        position: absolute;
        top: -3px; right: -3px;
        min-width: 16px;
        height: 16px;
        padding: 0 4px;
        border-radius: 999px;
        background: #ff5c7c;
        color: #fff;
        font-size: 10px;
        font-weight: 700;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
        border: 2px solid rgba(10,0,20,0.95);
    }
    [data-theme="light"] .rh-mh-badge { border-color: #fafafc; }

    .rh-mh-avatar {
        width: 38px;
        height: 38px;
        border-radius: 50%;
        background: linear-gradient(135deg, #8a2bd6, #6a1ab0);
        color: #fff;
        font-weight: 700;
        font-size: 14px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 12px rgba(138,43,214,0.4);
        flex-shrink: 0;
    }

    /* === Drawer overlay === */
    .rh-drawer-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(5, 0, 12, 0.7);
        /* backdrop-filter removido pra performance */
        z-index: 1000;
        opacity: 0;
        pointer-events: none;
        transition: opacity 240ms ease;
    }
    .rh-drawer-overlay.is-open {
        opacity: 1;
        pointer-events: auto;
    }

    /* === Drawer === */
    .rh-drawer {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(86vw, 340px);
        background: rgba(15, 0, 28, 0.97);
        /* backdrop-filter removido (perf) */
        /* -webkit-backdrop-filter removido (perf) */
        border-right: 1px solid rgba(138,43,214,0.25);
        z-index: 1001;
        transform: translateX(-100%);
        transition: transform 280ms cubic-bezier(.2,.7,.2,1);
        box-shadow: 14px 0 60px rgba(0,0,0,0.55);
        padding: calc(env(safe-area-inset-top, 0px) + 16px) 0 calc(env(safe-area-inset-bottom, 0px) + 16px);
        overflow-y: auto;
        overscroll-behavior: contain;
    }
    .rh-drawer.is-open { transform: translateX(0); }
    [data-theme="light"] .rh-drawer {
        background: rgba(255, 255, 255, 0.98);
        border-right-color: rgba(106,26,176,0.15);
    }

    .rh-drawer-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 4px 18px 18px;
        border-bottom: 1px solid rgba(255,255,255,0.06);
    }
    [data-theme="light"] .rh-drawer-head { border-bottom-color: rgba(13,10,31,0.06); }
    .rh-drawer-brand img {
        height: 28px;
        max-width: 150px;
        width: auto;
        display: block;
    }
    .rh-drawer-brand .rh-logo-light { display: none; }
    .rh-drawer-brand .rh-logo-dark  { display: block; }
    [data-theme="light"] .rh-drawer-brand .rh-logo-light { display: block; }
    [data-theme="light"] .rh-drawer-brand .rh-logo-dark  { display: none; }

    .rh-drawer-close {
        width: 36px; height: 36px;
        border-radius: 50%;
        border: 1px solid rgba(255,255,255,0.10);
        background: rgba(255,255,255,0.05);
        color: var(--text-primary);
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        transition: background 160ms ease, transform 160ms ease;
    }
    .rh-drawer-close i { width: 16px; height: 16px; }
    .rh-drawer-close:active { transform: scale(0.92); background: rgba(138,43,214,0.18); }
    [data-theme="light"] .rh-drawer-close {
        background: rgba(255,255,255,0.7);
        border-color: rgba(13,10,31,0.10);
    }

    /* User block */
    .rh-drawer-user {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 16px 18px;
        margin: 0 12px 6px;
        border-radius: 14px;
        background: linear-gradient(135deg, rgba(138,43,214,0.18), rgba(1,250,213,0.05));
        border: 1px solid rgba(138,43,214,0.22);
    }
    [data-theme="light"] .rh-drawer-user {
        background: linear-gradient(135deg, rgba(106,26,176,0.07), rgba(255,255,255,0.5));
        border-color: rgba(106,26,176,0.15);
    }
    .rh-drawer-avatar {
        width: 44px; height: 44px;
        border-radius: 50%;
        background: linear-gradient(135deg, #8a2bd6, #6a1ab0);
        color: #fff;
        font-weight: 700;
        font-size: 16px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        box-shadow: 0 4px 12px rgba(138,43,214,0.4);
    }
    .rh-drawer-user-info {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 2px;
    }
    .rh-drawer-user-info strong {
        font-size: 14px;
        font-weight: 700;
        color: var(--text-primary);
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .rh-drawer-user-info span {
        font-size: 12px;
        color: var(--text-muted);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Nav links */
    .rh-drawer-nav {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 2px;
        padding: 10px 12px;
    }
    .rh-drawer-link {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 14px;
        border-radius: 12px;
        font-size: 14px;
        font-weight: 600;
        color: var(--text-secondary);
        text-decoration: none !important;
        transition: background 160ms ease, color 160ms ease, transform 160ms ease;
        position: relative;
    }
    .rh-drawer-link:active { transform: scale(0.98); }
    .rh-drawer-link i {
        width: 18px; height: 18px;
        color: var(--text-muted);
        flex-shrink: 0;
    }
    .rh-drawer-link span { flex: 1; }
    .rh-drawer-link:hover {
        background: rgba(138,43,214,0.12);
        color: var(--text-primary);
        text-decoration: none !important;
    }
    .rh-drawer-link:hover i { color: var(--rh-cyan); }
    .rh-drawer-link.active {
        background: rgba(138,43,214,0.18);
        color: var(--text-primary);
        border: 1px solid rgba(138,43,214,0.35);
    }
    .rh-drawer-link.active i { color: var(--rh-cyan); }
    [data-theme="light"] .rh-drawer-link:hover { background: rgba(106,26,176,0.07); }
    [data-theme="light"] .rh-drawer-link:hover i { color: var(--rh-purple); }
    [data-theme="light"] .rh-drawer-link.active {
        background: rgba(106,26,176,0.10);
        border-color: rgba(106,26,176,0.25);
    }
    [data-theme="light"] .rh-drawer-link.active i { color: var(--rh-purple); }

    .rh-drawer-link-cta {
        background: linear-gradient(135deg, #8a2bd6, #6a1ab0);
        color: #fff !important;
        margin-top: 6px;
        box-shadow: 0 6px 18px rgba(138,43,214,0.32);
    }
    .rh-drawer-link-cta i { color: #fff !important; }
    .rh-drawer-link-cta:hover {
        background: linear-gradient(135deg, #9b3deb, #7a26c8);
        color: #fff !important;
    }
    .rh-drawer-link-cta:hover i { color: #fff !important; }

    .rh-drawer-badge {
        min-width: 20px;
        height: 20px;
        padding: 0 6px;
        border-radius: 999px;
        background: #ff5c7c;
        color: #fff;
        font-size: 11px;
        font-weight: 700;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .rh-drawer-sep {
        margin: 8px 4px;
        border: none;
        height: 1px;
        background: rgba(255,255,255,0.08);
    }
    [data-theme="light"] .rh-drawer-sep { background: rgba(13,10,31,0.08); }

    /* Foot (theme + logout) */
    .rh-drawer-foot {
        display: flex;
        flex-direction: column;
        gap: 6px;
        padding: 10px 12px 4px;
        border-top: 1px solid rgba(255,255,255,0.06);
        margin-top: 8px;
    }
    [data-theme="light"] .rh-drawer-foot { border-top-color: rgba(13,10,31,0.06); }

    .rh-drawer-theme {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 14px;
        border-radius: 12px;
        border: 1px solid rgba(255,255,255,0.08);
        background: rgba(255,255,255,0.04);
        cursor: pointer;
        font-size: 13.5px;
        font-weight: 600;
        color: var(--text-primary);
        font-family: inherit;
        transition: background 160ms ease;
    }
    .rh-drawer-theme:active { background: rgba(138,43,214,0.18); }
    .rh-drawer-theme i { width: 18px; height: 18px; flex-shrink: 0; color: var(--rh-cyan); }
    .rh-drawer-theme .icon-light { display: none; }
    [data-theme="light"] .rh-drawer-theme {
        background: rgba(255,255,255,0.7);
        border-color: rgba(13,10,31,0.08);
    }
    [data-theme="light"] .rh-drawer-theme i { color: var(--rh-purple); }
    [data-theme="light"] .rh-drawer-theme .icon-light { display: inline-block; }
    [data-theme="light"] .rh-drawer-theme .icon-dark { display: none; }

    .rh-drawer-logout {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 14px;
        border-radius: 12px;
        font-size: 13.5px;
        font-weight: 600;
        color: #ff8aa0;
        background: rgba(255,92,124,0.08);
        border: 1px solid rgba(255,92,124,0.18);
        text-decoration: none !important;
        transition: background 160ms ease, transform 160ms ease;
    }
    .rh-drawer-logout:active { transform: scale(0.98); background: rgba(255,92,124,0.18); }
    .rh-drawer-logout:hover { color: #ff8aa0; text-decoration: none !important; }
    .rh-drawer-logout i { width: 18px; height: 18px; }

    /* Lock body scroll when drawer open */
    body.rh-drawer-open { overflow: hidden; }

    /* Esconde headers legacy no mobile */
    #header.header.navbar-expand-lg,
    .header.navbar-expand-lg:not(.rollin-mobile-header) {
        display: none !important;
    }
}

/* =============================================================
   SCROLL SNAP — carrossel horizontal de cards (tipo stories)
   ============================================================= */

.rollin-scroll-snap {
    display: flex;
    gap: var(--space-md);
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-padding: var(--space-lg);
    padding: 0 var(--space-lg) var(--space-md);
    margin: 0 calc(-1 * var(--space-lg));
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.rollin-scroll-snap::-webkit-scrollbar {
    display: none;
}

.rollin-scroll-snap > * {
    scroll-snap-align: start;
    flex-shrink: 0;
}

/* =============================================================
   TOUCH-OPTIMIZED COMPONENTS
   ============================================================= */

@media (max-width: 991px) {
    /* Botões precisam de 44x44 mínimo (Apple HIG) */
    .btn,
    button,
    a.btn,
    .rollin-hero-chip,
    .rollin-qa-card,
    .rollin-filter,
    .rollin-cycle-opt {
        min-height: 44px;
    }

    /* Links de lista (dashboard panel) — larger tap target */
    .rollin-panel-list a,
    .rollin-panel-list > li {
        min-height: 48px;
        padding: 14px var(--space-lg) !important;
    }

    /* Plan card CTA ocupa largura total */
    .rollin-plan-cta {
        min-height: 52px !important;
        font-size: var(--fs-base) !important;
    }

    /* Hero mobile mais compacto */
    .rollin-dashboard-hero {
        padding: var(--space-md) 0;
    }

    .rollin-hero-card {
        padding: var(--space-lg) !important;
        border-radius: var(--radius-lg) !important;
    }

    /* Stats em linha horizontal scrollable */
    .rollin-hero-stats {
        grid-template-columns: repeat(4, minmax(100px, 1fr));
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        scroll-snap-type: x mandatory;
        padding-bottom: 4px;
    }

    .rollin-hero-stats::-webkit-scrollbar {
        display: none;
    }

    .rollin-stat {
        scroll-snap-align: start;
        min-width: 120px;
    }

    /* Feed grid vira stack no mobile */
    .rollin-feed {
        grid-template-columns: 1fr;
    }

    .rollin-feed-item {
        border-radius: var(--radius-md);
    }

    /* Quick actions em 2 colunas */
    .rollin-qa-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-sm);
    }

    .rollin-qa-card {
        flex-direction: column;
        text-align: center;
        padding: var(--space-md);
        min-height: 120px;
    }

    .rollin-qa-card .rollin-qa-arrow {
        display: none;
    }

    .rollin-qa-icon {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }

    .rollin-qa-body h3 {
        font-size: var(--fs-sm);
    }

    .rollin-qa-body p {
        font-size: 11px;
    }

    /* Trust row vertical mobile */
    .rollin-trust-row {
        gap: 2px;
        padding: var(--space-sm);
    }

    .rollin-trust {
        font-size: 10px;
        padding: 6px 10px;
    }

    /* AI CTA mobile */
    .rollin-ai-cta-inner {
        grid-template-columns: 1fr !important;
        text-align: center;
        gap: var(--space-md);
    }

    .rollin-ai-cta-icon {
        margin: 0 auto;
        width: 64px;
        height: 64px;
        font-size: 28px;
    }

    /* Billing cycle em row compacto */
    .rollin-cycle-options {
        width: 100%;
        justify-content: center;
    }

    .rollin-cycle-opt {
        flex: 1;
        justify-content: center;
        padding: 10px 8px;
        font-size: var(--fs-xs);
    }
}

@media (max-width: 480px) {
    /* Feed filter vira scrollable */
    .rollin-feed-filters {
        overflow-x: auto;
        white-space: nowrap;
        scrollbar-width: none;
        padding: 4px;
    }

    .rollin-feed-filters::-webkit-scrollbar {
        display: none;
    }

    .rollin-filter {
        flex-shrink: 0;
        padding: 8px 14px;
    }

    /* Plans 1 coluna com padding menor */
    .rollin-plans-grid {
        gap: var(--space-md);
        padding: 0 var(--space-sm);
    }

    /* Stats 2 por linha fixo */
    .rollin-hero-stats {
        grid-template-columns: repeat(2, 1fr);
        overflow: visible;
    }

    /* Esconde textos muito longos */
    .rollin-greeting-meta {
        font-size: 11px;
    }
}

/* =============================================================
   SKELETON LOADERS (carrega com shimmer)
   ============================================================= */

.rollin-skeleton {
    background: linear-gradient(90deg,
        rgba(255, 255, 255, 0.04) 0%,
        rgba(255, 255, 255, 0.08) 50%,
        rgba(255, 255, 255, 0.04) 100%);
    background-size: 200% 100%;
    animation: rollinShimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

@keyframes rollinShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* =============================================================
   TOAST NOTIFICATIONS (feedback visual após ações)
   ============================================================= */

#rollin-toast-container {
    position: fixed;
    top: calc(var(--safe-top) + 16px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    width: 100%;
    max-width: 400px;
    padding: 0 16px;
}

.rollin-toast {
    background: var(--rollin-purple-700);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: var(--fs-sm);
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: auto;
    animation: rollinToastIn 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
    /* backdrop-filter removido pra performance */
}

.rollin-toast.rollin-toast-success {
    border-color: var(--accent-cyan);
}

.rollin-toast.rollin-toast-success i {
    color: var(--accent-cyan);
}

.rollin-toast.rollin-toast-error {
    border-color: var(--accent-pink);
}

.rollin-toast.rollin-toast-error i {
    color: var(--accent-pink);
}

.rollin-toast.removing {
    animation: rollinToastOut 300ms ease-in forwards;
}

@keyframes rollinToastIn {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes rollinToastOut {
    to { transform: translateY(-30px); opacity: 0; }
}

/* =============================================================
   SPLASH SCREEN (PWA standalone)
   ============================================================= */

.rollin-splash {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: var(--rollin-purple-800);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-lg);
    transition: opacity 500ms ease-out;
}

.rollin-splash.hidden {
    opacity: 0;
    pointer-events: none;
}

.rollin-splash-logo {
    width: 120px;
    height: 120px;
    border-radius: 30px;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 56px;
    color: white;
    box-shadow: var(--shadow-glow-pink);
    animation: rollinSplashPulse 2s ease-in-out infinite;
}

@keyframes rollinSplashPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.rollin-splash-text {
    color: var(--text-primary);
    font-size: var(--fs-xl);
    font-weight: 700;
    letter-spacing: 0.02em;
}

.rollin-splash-loader {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-pink);
    border-radius: 50%;
    animation: rollinSpin 900ms linear infinite;
}

/* =============================================================
   INSTALLED PWA — Ajustes quando o app está instalado
   ============================================================= */

@media all and (display-mode: standalone) {
    /* Esconde header desktop completamente, usa só mobile header */
    #header:not(.rollin-mobile-header),
    .header.navbar-expand-lg:not(.rollin-mobile-header) {
        display: none !important;
    }

    /* Esconde footer no app */
    footer,
    #footer,
    .footer {
        display: none !important;
    }

    /* Body não tem scroll-bounce visual */
    html, body {
        overscroll-behavior: none;
    }
}

/* =============================================================
   DARK MODE explicit (usuário do sistema)
   O tema já é dark por padrão, mas garantimos
   ============================================================= */

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
    }
}

/* =============================================================
   INSTALL BANNER (convite pra instalar como app)
   ============================================================= */

.rollin-install-banner {
    position: fixed;
    top: calc(var(--safe-top) + 8px);
    left: 8px;
    right: 8px;
    z-index: 9997;
    background: var(--gradient-primary);
    color: white;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    display: none;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    animation: rollinInstallIn 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.rollin-install-banner.show {
    display: flex;
}

@keyframes rollinInstallIn {
    from { transform: translateY(-100px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.rollin-install-banner i:first-child {
    font-size: 24px;
    flex-shrink: 0;
}

.rollin-install-content {
    flex: 1;
    font-size: var(--fs-sm);
    line-height: 1.3;
}

.rollin-install-content strong {
    display: block;
    font-size: var(--fs-base);
    margin-bottom: 2px;
}

.rollin-install-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.rollin-install-btn {
    padding: 8px 16px;
    background: white;
    color: var(--rollin-purple-800);
    border: none;
    border-radius: var(--radius-full);
    font-size: var(--fs-xs);
    font-weight: 700;
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.rollin-install-btn:active {
    transform: scale(0.95);
}

.rollin-install-dismiss {
    padding: 8px;
    background: transparent;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0.8;
}

/* =============================================================
   LANDSCAPE MOBILE — ajustes
   ============================================================= */

@media (max-width: 991px) and (orientation: landscape) and (max-height: 500px) {
    .rollin-dashboard-hero {
        padding: var(--space-sm) 0;
    }
    .rollin-hero-card {
        padding: var(--space-md) !important;
    }
    #rollin-ai-panel {
        height: calc(100vh - 80px) !important;
    }
}
