/* =============================================================================
   WhatsApp Inbox Pro — Mobile Fullscreen Layout (2026-05-23)
   كل القواعد داخل @media (max-width: 1023px) فقط، لا تؤثر على Desktop مطلقاً.
   تعتمد على توكنات المتغيرات الموجودة في whatsapp-inbox-pro.css.
   ============================================================================= */

/* العناصر التالية مخفية افتراضياً ولا تظهر إلا داخل الموبايل */
.wa-mobile-header,
.wa-mobile-stats-strip,
.wa-mobile-sheet-backdrop,
.wa-mobile-sheet,
.wa-mobile-details-back,
.wa-mobile-details-header {
    display: none;
}

/* ====================================================================
   MOBILE BREAKPOINT
   ==================================================================== */
@media (max-width: 1023px) {

    /* ----- 1) إخفاء القوائم العامة (Sidebar + Header + زر الدعم الفني العائم) ----- */
    body.wa-inbox-mobile-fullscreen .sidebar,
    body.wa-inbox-mobile-fullscreen .header,
    body.wa-inbox-mobile-fullscreen .sidebar-overlay,
    body.wa-inbox-mobile-fullscreen #sidebar,
    body.wa-inbox-mobile-fullscreen .support-fab {
        display: none !important;
    }

    body.wa-inbox-mobile-fullscreen .main-content {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        overflow: hidden !important;
        transform: none !important;
    }

    body.wa-inbox-mobile-fullscreen .content:has(.wa-pro-root),
    body.wa-inbox-mobile-fullscreen .content {
        padding: 0 !important;
        margin: 0 !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
    }

    /* ----- 2) جذر الصفحة على الموبايل ----- */
    body.wa-inbox-mobile-fullscreen .wa-pro-root {
        height: 100dvh !important;
        min-height: 100dvh !important;
        max-height: 100dvh !important;
        margin: 0 !important;
        border-top: 0 !important;
        background: var(--bg-main);
        overflow: hidden;
        position: relative;
    }

    /* ----- 3) إخفاء التوب بار الديسكتوب على الموبايل ----- */
    body.wa-inbox-mobile-fullscreen .wa-topbar {
        display: none !important;
    }

    /* ----- 4) Mobile Header (3 حالات: List / Chat / Details) ----- */
    body.wa-inbox-mobile-fullscreen .wa-mobile-header {
        display: flex;
        align-items: center;
        gap: 10px;
        height: 56px;
        flex-shrink: 0;
        padding: 0 12px;
        background: var(--accent-dark);
        color: #fff;
        padding-top: env(safe-area-inset-top);
        height: calc(56px + env(safe-area-inset-top));
        position: relative;
        z-index: 5;
    }

    body.wa-inbox-mobile-fullscreen .wa-mh-icon-btn {
        width: 44px;
        height: 44px;
        border: 0;
        background: transparent;
        color: #fff;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        cursor: pointer;
        transition: background .18s cubic-bezier(0.22, 0.61, 0.36, 1);
        padding: 0;
    }

    body.wa-inbox-mobile-fullscreen .wa-mh-icon-btn:hover,
    body.wa-inbox-mobile-fullscreen .wa-mh-icon-btn:active {
        background: rgba(255, 255, 255, 0.12);
    }

    body.wa-inbox-mobile-fullscreen .wa-mh-icon-btn .material-icons {
        font-size: 22px;
    }

    body.wa-inbox-mobile-fullscreen .wa-mh-icon-btn .wa-mh-badge {
        position: absolute;
        top: 6px;
        inset-inline-end: 6px;
        background: var(--red);
        color: #fff;
        font-size: 10px;
        font-weight: 800;
        min-width: 16px;
        height: 16px;
        border-radius: 8px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0 4px;
        line-height: 1;
    }

    body.wa-inbox-mobile-fullscreen .wa-mh-title {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        line-height: 1.2;
    }

    body.wa-inbox-mobile-fullscreen .wa-mh-title-main {
        font-size: 16px;
        font-weight: 800;
        color: #fff;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }

    body.wa-inbox-mobile-fullscreen .wa-mh-title-sub {
        font-size: 11px;
        color: rgba(255, 255, 255, 0.78);
        margin-top: 2px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    body.wa-inbox-mobile-fullscreen .wa-mh-conn-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        flex-shrink: 0;
    }

    body.wa-inbox-mobile-fullscreen .wa-mh-conn-dot.ok {
        background: #4ade80;
        box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.5);
        animation: waPulseDot 1.8s ease-out infinite;
    }

    body.wa-inbox-mobile-fullscreen .wa-mh-conn-dot.off {
        background: #f87171;
    }

    body.wa-inbox-mobile-fullscreen .wa-mh-avatar-wrap {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        overflow: hidden;
        flex-shrink: 0;
        background: rgba(255, 255, 255, 0.18);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        color: #fff;
        font-weight: 800;
        font-size: 13px;
    }

    /* Title inline mode (Chat & Details) — اسم + رقم/حالة */
    body.wa-inbox-mobile-fullscreen .wa-mh-title.start-aligned {
        align-items: flex-start;
        text-align: start;
    }

    body.wa-inbox-mobile-fullscreen .wa-mobile-header .wa-mh-actions {
        display: inline-flex;
        align-items: center;
        gap: 2px;
        flex-shrink: 0;
    }

    /* ----- 5) Mobile Stats Strip (تحت الـ Header مباشرة في List) ----- */
    body.wa-inbox-mobile-fullscreen .wa-pro-root.mobile-view-list .wa-mobile-stats-strip {
        display: flex;
        gap: 8px;
        padding: 8px 12px;
        overflow-x: auto;
        flex-shrink: 0;
        background: var(--bg-panel);
        border-bottom: 1px solid var(--border);
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    body.wa-inbox-mobile-fullscreen .wa-mobile-stats-strip::-webkit-scrollbar {
        display: none;
    }

    body.wa-inbox-mobile-fullscreen .wa-ms-pill {
        flex-shrink: 0;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 8px 12px;
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: 20px;
        font-size: 12px;
        color: var(--text-secondary);
        font-weight: 600;
        line-height: 1;
        white-space: nowrap;
    }

    body.wa-inbox-mobile-fullscreen .wa-ms-pill .wa-ms-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        flex-shrink: 0;
    }

    body.wa-inbox-mobile-fullscreen .wa-ms-pill .wa-ms-num {
        font-weight: 800;
        color: var(--text-primary);
        font-size: 13px;
    }

    /* ----- 6) View Stack: التحوّل بين 3 شاشات ----- */
    body.wa-inbox-mobile-fullscreen .wa-pro-root .wa-main {
        flex: 1;
        position: relative;
        overflow: hidden;
        height: auto;
    }

    body.wa-inbox-mobile-fullscreen .wa-pro-root .wa-sidebar,
    body.wa-inbox-mobile-fullscreen .wa-pro-root .wa-chat-area,
    body.wa-inbox-mobile-fullscreen .wa-pro-root .wa-right-panel {
        position: absolute !important;
        inset: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        border: 0 !important;
        margin: 0 !important;
        transition: transform .28s cubic-bezier(0.22, 0.61, 0.36, 1);
        will-change: transform;
    }

    /* List active */
    body.wa-inbox-mobile-fullscreen .wa-pro-root.mobile-view-list .wa-sidebar {
        transform: translateX(0);
        z-index: 3;
        display: flex;
    }

    body.wa-inbox-mobile-fullscreen .wa-pro-root.mobile-view-list .wa-chat-area,
    body.wa-inbox-mobile-fullscreen .wa-pro-root.mobile-view-list .wa-right-panel {
        /* RTL: slide right out */
        transform: translateX(-100%);
        z-index: 1;
        pointer-events: none;
    }

    html[dir="rtl"] body.wa-inbox-mobile-fullscreen .wa-pro-root.mobile-view-list .wa-chat-area,
    html[dir="rtl"] body.wa-inbox-mobile-fullscreen .wa-pro-root.mobile-view-list .wa-right-panel {
        transform: translateX(100%);
    }

    /* Chat active */
    body.wa-inbox-mobile-fullscreen .wa-pro-root.mobile-view-chat .wa-sidebar {
        transform: translateX(100%);
        z-index: 1;
        pointer-events: none;
    }

    html[dir="rtl"] body.wa-inbox-mobile-fullscreen .wa-pro-root.mobile-view-chat .wa-sidebar {
        transform: translateX(-100%);
    }

    body.wa-inbox-mobile-fullscreen .wa-pro-root.mobile-view-chat .wa-chat-area {
        transform: translateX(0);
        z-index: 3;
        display: flex;
        flex-direction: column;
    }

    body.wa-inbox-mobile-fullscreen .wa-pro-root.mobile-view-chat .wa-right-panel {
        transform: translateX(-100%);
        z-index: 1;
        pointer-events: none;
    }

    html[dir="rtl"] body.wa-inbox-mobile-fullscreen .wa-pro-root.mobile-view-chat .wa-right-panel {
        transform: translateX(100%);
    }

    /* Details active */
    body.wa-inbox-mobile-fullscreen .wa-pro-root.mobile-view-details .wa-sidebar,
    body.wa-inbox-mobile-fullscreen .wa-pro-root.mobile-view-details .wa-chat-area {
        transform: translateX(100%);
        z-index: 1;
        pointer-events: none;
    }

    html[dir="rtl"] body.wa-inbox-mobile-fullscreen .wa-pro-root.mobile-view-details .wa-sidebar,
    html[dir="rtl"] body.wa-inbox-mobile-fullscreen .wa-pro-root.mobile-view-details .wa-chat-area {
        transform: translateX(-100%);
    }

    body.wa-inbox-mobile-fullscreen .wa-pro-root.mobile-view-details .wa-right-panel {
        transform: translateX(0);
        z-index: 3;
        display: flex;
        flex-direction: column;
        background: var(--bg-main);
    }

    /* ----- 7) List View — تعديلات الـ Sidebar على الموبايل ----- */
    body.wa-inbox-mobile-fullscreen .wa-sidebar {
        background: var(--bg-panel);
    }

    body.wa-inbox-mobile-fullscreen .wa-sidebar-head {
        padding: 10px 12px 8px;
        background: var(--bg-panel);
        border-bottom: 1px solid var(--border);
    }

    body.wa-inbox-mobile-fullscreen .wa-search-wrap input {
        font-size: 16px !important;
        height: 44px;
        padding-inline-start: 40px;
        border-radius: 22px;
        background: var(--bg-card);
        border: 1px solid var(--border);
    }

    body.wa-inbox-mobile-fullscreen .wa-view-tabs {
        margin-top: 10px;
        gap: 0;
        border-bottom: 1px solid var(--border);
    }

    body.wa-inbox-mobile-fullscreen .wa-vtab {
        flex: 1;
        min-height: 44px;
        font-size: 14px;
        font-weight: 700;
        background: transparent;
        border: 0;
        border-bottom: 2px solid transparent;
        border-radius: 0;
        color: var(--text-secondary);
    }

    body.wa-inbox-mobile-fullscreen .wa-vtab.active {
        color: var(--accent-dark);
        border-bottom-color: var(--accent);
        background: transparent;
    }

    body.wa-inbox-mobile-fullscreen .wa-filter-tabs {
        gap: 6px;
        padding: 8px 4px 6px;
        overflow-x: auto;
        flex-wrap: nowrap;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    body.wa-inbox-mobile-fullscreen .wa-filter-tabs::-webkit-scrollbar {
        display: none;
    }

    body.wa-inbox-mobile-fullscreen .wa-ftab {
        flex-shrink: 0;
        min-height: 36px;
        padding: 6px 14px;
        font-size: 13px;
        border-radius: 18px;
        white-space: nowrap;
    }

    body.wa-inbox-mobile-fullscreen .wa-integration-tabs {
        margin-top: 4px !important;
        padding-bottom: 8px !important;
    }

    body.wa-inbox-mobile-fullscreen .wa-chat-list {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 80px; /* مساحة للـ FAB */
    }

    body.wa-inbox-mobile-fullscreen .wa-chat-item {
        padding: 12px 14px;
        min-height: 76px;
        gap: 12px;
    }

    body.wa-inbox-mobile-fullscreen .wa-chat-item .wa-avatar {
        width: 48px;
        height: 48px;
        font-size: 16px;
    }

    body.wa-inbox-mobile-fullscreen .wa-chat-name {
        font-size: 15px;
        font-weight: 700;
    }

    body.wa-inbox-mobile-fullscreen .wa-chat-preview {
        font-size: 13px;
    }

    body.wa-inbox-mobile-fullscreen .wa-chat-time {
        font-size: 11px;
    }

    /* ----- 8) Chat List padding — لا حاجة لمساحة FAB ----- */
    body.wa-inbox-mobile-fullscreen .wa-pro-root.mobile-view-list .wa-chat-list {
        padding-bottom: 16px;
    }

    /* ----- 9) Chat View — تعديلات منطقة الشات ----- */
    body.wa-inbox-mobile-fullscreen .wa-chat-area {
        display: flex;
        flex-direction: column;
    }

    /* إخفاء الـ chat-header الديسكتوب الأصلي على الموبايل لأن Mobile Header يحل محله */
    body.wa-inbox-mobile-fullscreen .wa-chat-header {
        display: none !important;
    }

    body.wa-inbox-mobile-fullscreen .wa-window-status-bar {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        padding: 6px 12px;
        background: var(--accent-soft);
        color: var(--accent-dark);
        font-size: 12px;
        font-weight: 600;
        flex-shrink: 0;
    }

    body.wa-inbox-mobile-fullscreen .wa-window-status-bar.expired {
        background: rgba(245, 159, 0, 0.12);
        color: var(--amber);
    }

    body.wa-inbox-mobile-fullscreen .wa-messages {
        flex: 1;
        padding: 12px 10px;
    }

    body.wa-inbox-mobile-fullscreen .wa-msg {
        max-width: 88%;
    }

    /* ===== Composer Redesign للجوال ===== */
    body.wa-inbox-mobile-fullscreen .wa-chat-input-area {
        flex-shrink: 0;
        background: var(--bg-panel);
        border-top: 1px solid var(--border);
        padding-bottom: env(safe-area-inset-bottom);
        box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.04);
    }

    /* شريط الردود السريعة (pills فوق المحرّر) */
    body.wa-inbox-mobile-fullscreen .wa-quick-replies-bar {
        gap: 8px;
        padding: 10px 12px 6px;
        overflow-x: auto;
        flex-wrap: nowrap;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        background: var(--bg-panel);
        border-bottom: 1px solid var(--border);
    }

    body.wa-inbox-mobile-fullscreen .wa-quick-replies-bar::-webkit-scrollbar {
        display: none;
    }

    body.wa-inbox-mobile-fullscreen .wa-qr-pill {
        flex-shrink: 0;
        min-height: 38px;
        padding: 8px 14px;
        font-size: 13.5px;
        font-weight: 600;
        border-radius: 19px;
        background: var(--bg-card);
        border: 1px solid var(--border);
        color: var(--text-primary);
        line-height: 1.2;
    }

    body.wa-inbox-mobile-fullscreen .wa-qr-pill:active {
        background: var(--bg-card-hover);
        transform: scale(0.97);
    }

    /* صف الإدخال — Layout مبسّط ومُتنفّس */
    body.wa-inbox-mobile-fullscreen .wa-input-row {
        padding: 10px 10px 12px;
        gap: 8px;
        align-items: flex-end;
        background: var(--bg-panel);
    }

    body.wa-inbox-mobile-fullscreen .wa-input-tools {
        gap: 0;
        flex-shrink: 0;
        align-items: flex-end;
        padding-bottom: 2px;
    }

    /* إخفاء أزرار "القوالب" و"الردود السريعة" من المحرّر على الجوال
       (تبقى متاحة عبر قائمة ⋮ في الـ Header) */
    body.wa-inbox-mobile-fullscreen .wa-input-tools .wa-templates-btn,
    body.wa-inbox-mobile-fullscreen .wa-input-tools .wa-quick-replies-btn {
        display: none !important;
    }

    /* زر الإرفاق الوحيد المتبقّي في المحرّر */
    body.wa-inbox-mobile-fullscreen .wa-input-icon-btn.wa-attach-btn {
        width: 44px;
        height: 44px;
        border-radius: 50%;
        background: var(--bg-card);
        color: var(--text-secondary);
        border: 1px solid var(--border);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: background .18s cubic-bezier(0.22, 0.61, 0.36, 1),
                    transform .12s cubic-bezier(0.22, 0.61, 0.36, 1);
    }

    body.wa-inbox-mobile-fullscreen .wa-input-icon-btn.wa-attach-btn:active {
        background: var(--bg-card-hover);
        transform: scale(0.94);
    }

    body.wa-inbox-mobile-fullscreen .wa-input-icon-btn.wa-attach-btn .material-icons {
        font-size: 22px;
    }

    /* textarea — pill كبيرة ومتنفّسة */
    body.wa-inbox-mobile-fullscreen .wa-input-box {
        font-size: 16px !important;
        line-height: 1.45;
        min-height: 44px;
        max-height: 132px;
        border-radius: 22px;
        padding: 11px 16px;
        background: var(--bg-card);
        border: 1px solid var(--border);
        flex: 1;
        resize: none;
    }

    body.wa-inbox-mobile-fullscreen .wa-input-box:focus {
        background: var(--bg-panel);
        border-color: var(--accent-mid);
        outline: none;
    }

    body.wa-inbox-mobile-fullscreen .wa-input-box::placeholder {
        color: var(--text-muted);
        font-weight: 400;
    }

    /* زر الإرسال — بارز ومتميّز */
    body.wa-inbox-mobile-fullscreen .wa-send-btn {
        width: 48px;
        height: 48px;
        border-radius: 50%;
        flex-shrink: 0;
        background: var(--accent);
        color: #fff;
        border: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(37, 211, 102, 0.32);
        transition: transform .12s cubic-bezier(0.22, 0.61, 0.36, 1),
                    box-shadow .18s,
                    opacity .18s;
    }

    body.wa-inbox-mobile-fullscreen .wa-send-btn:active {
        transform: scale(0.92);
        box-shadow: 0 1px 4px rgba(37, 211, 102, 0.4);
    }

    body.wa-inbox-mobile-fullscreen .wa-send-btn:disabled {
        opacity: 0.45;
        box-shadow: none;
        cursor: not-allowed;
    }

    body.wa-inbox-mobile-fullscreen .wa-send-btn .material-icons {
        font-size: 22px;
        margin-inline-start: -1px; /* تعديل بصري للسهم */
    }

    body.wa-inbox-mobile-fullscreen .wa-window-warn {
        margin: 0;
        padding: 10px 14px;
        font-size: 12.5px;
        border-radius: 0;
        background: rgba(245, 159, 0, 0.10);
        color: var(--amber);
        border-bottom: 1px solid var(--border);
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        font-weight: 600;
    }

    /* hint: tap على اسم المحادثة في الـ Header يفتح التفاصيل */
    body.wa-inbox-mobile-fullscreen .wa-mh-title.tappable {
        cursor: pointer;
        position: relative;
    }

    body.wa-inbox-mobile-fullscreen .wa-mh-title.tappable::after {
        content: "";
        position: absolute;
        inset: -8px;
    }

    /* ----- 10) Details Slide Page (يحل محل wa-right-panel) ----- */
    body.wa-inbox-mobile-fullscreen .wa-pro-root.mobile-view-details .wa-right-panel {
        background: var(--bg-main);
        width: 100% !important;
        border: 0;
    }

    body.wa-inbox-mobile-fullscreen .wa-right-scroll {
        padding: 14px 12px;
        gap: 14px;
        background: var(--bg-main);
    }

    /* تكبير البطاقات على الموبايل + Touch-friendly */
    body.wa-inbox-mobile-fullscreen .wa-rp-section {
        padding: 14px 14px;
        border-radius: 14px;
        background: var(--bg-panel);
        border: 1px solid var(--border);
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    }

    body.wa-inbox-mobile-fullscreen .wa-rp-title {
        font-size: 14px;
        margin-bottom: 10px;
    }

    body.wa-inbox-mobile-fullscreen .wa-rp-title-action {
        min-height: 32px;
        padding: 4px 10px;
        font-size: 12px;
        border-radius: 16px;
    }

    body.wa-inbox-mobile-fullscreen .wa-contact-avatar-big {
        width: 96px !important;
        height: 96px !important;
        font-size: 32px;
        margin: 6px auto 10px;
    }

    body.wa-inbox-mobile-fullscreen .wa-contact-name-big {
        font-size: 19px;
    }

    body.wa-inbox-mobile-fullscreen .wa-contact-phone {
        font-size: 14px;
    }

    body.wa-inbox-mobile-fullscreen .wa-contact-actions-row {
        gap: 8px;
        margin-top: 12px;
    }

    body.wa-inbox-mobile-fullscreen .wa-ca-btn {
        min-height: 40px;
        padding: 8px 14px;
        font-size: 13px;
        border-radius: 20px;
        flex: 1;
        justify-content: center;
    }

    body.wa-inbox-mobile-fullscreen .wa-star {
        width: 36px;
        height: 36px;
        font-size: 28px;
    }

    body.wa-inbox-mobile-fullscreen .wa-rating-num {
        font-size: 28px;
    }

    body.wa-inbox-mobile-fullscreen .wa-pipe-stage {
        min-height: 44px;
        padding: 8px 10px;
    }

    body.wa-inbox-mobile-fullscreen .wa-internal-note {
        font-size: 15px !important;
        min-height: 100px;
        padding: 12px;
        border-radius: 10px;
    }

    body.wa-inbox-mobile-fullscreen .wa-mini-stats {
        gap: 8px;
    }

    body.wa-inbox-mobile-fullscreen .wa-mini-stat {
        padding: 10px 6px;
    }

    body.wa-inbox-mobile-fullscreen .wa-mini-stat-val {
        font-size: 22px;
    }

    /* ----- 11) Bottom Sheet (Drawer من الأسفل) ----- */
    body.wa-inbox-mobile-fullscreen .wa-mobile-sheet-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 200;
        opacity: 0;
        animation: waSheetBackdropIn .22s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
    }

    body.wa-inbox-mobile-fullscreen .wa-mobile-sheet {
        display: flex;
        flex-direction: column;
        position: fixed;
        inset-inline-start: 0;
        inset-inline-end: 0;
        bottom: 0;
        max-height: 82vh;
        background: var(--bg-panel);
        border-top-left-radius: 18px;
        border-top-right-radius: 18px;
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.18);
        z-index: 201;
        transform: translateY(100%);
        animation: waSheetSlideUp .28s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
        padding-bottom: env(safe-area-inset-bottom);
        overflow: hidden;
    }

    body.wa-inbox-mobile-fullscreen .wa-sheet-handle {
        width: 40px;
        height: 4px;
        background: var(--border-mid);
        border-radius: 2px;
        margin: 10px auto 6px;
        flex-shrink: 0;
    }

    body.wa-inbox-mobile-fullscreen .wa-sheet-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 6px 18px 12px;
        border-bottom: 1px solid var(--border);
        flex-shrink: 0;
    }

    body.wa-inbox-mobile-fullscreen .wa-sheet-title {
        font-size: 16px;
        font-weight: 800;
        color: var(--text-primary);
    }

    body.wa-inbox-mobile-fullscreen .wa-sheet-close {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: var(--bg-card);
        border: 0;
        color: var(--text-secondary);
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    body.wa-inbox-mobile-fullscreen .wa-sheet-body {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 8px 0 12px;
    }

    body.wa-inbox-mobile-fullscreen .wa-sheet-item {
        display: flex;
        align-items: center;
        gap: 14px;
        width: 100%;
        min-height: 56px;
        padding: 12px 18px;
        background: transparent;
        border: 0;
        text-align: start;
        color: var(--text-primary);
        font-family: inherit;
        font-size: 15px;
        cursor: pointer;
        transition: background .15s cubic-bezier(0.22, 0.61, 0.36, 1);
        border-bottom: 1px solid var(--border);
    }

    body.wa-inbox-mobile-fullscreen .wa-sheet-item:last-child {
        border-bottom: 0;
    }

    body.wa-inbox-mobile-fullscreen .wa-sheet-item:active {
        background: var(--bg-card-hover);
    }

    body.wa-inbox-mobile-fullscreen .wa-sheet-item-icon {
        width: 40px;
        height: 40px;
        border-radius: 10px;
        background: var(--accent-soft);
        color: var(--accent-dark);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    body.wa-inbox-mobile-fullscreen .wa-sheet-item-icon .material-icons {
        font-size: 22px;
    }

    body.wa-inbox-mobile-fullscreen .wa-sheet-item-label {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    body.wa-inbox-mobile-fullscreen .wa-sheet-item-title {
        font-size: 15px;
        font-weight: 700;
        color: var(--text-primary);
        line-height: 1.3;
    }

    body.wa-inbox-mobile-fullscreen .wa-sheet-item-sub {
        font-size: 12px;
        color: var(--text-muted);
        line-height: 1.3;
    }

    body.wa-inbox-mobile-fullscreen .wa-sheet-item-chevron {
        color: var(--text-muted);
        flex-shrink: 0;
    }

    body.wa-inbox-mobile-fullscreen .wa-sheet-divider {
        height: 8px;
        background: var(--bg-card);
        margin: 4px 0;
        flex-shrink: 0;
    }

    body.wa-inbox-mobile-fullscreen .wa-sheet-item.danger .wa-sheet-item-icon {
        background: rgba(229, 57, 53, 0.10);
        color: var(--red);
    }

    body.wa-inbox-mobile-fullscreen .wa-sheet-item.primary .wa-sheet-item-icon {
        background: var(--accent);
        color: #fff;
    }

    /* ----- 12) Modals as full-screen on mobile ----- */
    body.wa-inbox-mobile-fullscreen .wa-modal-backdrop {
        background: rgba(0, 0, 0, 0.5);
    }

    body.wa-inbox-mobile-fullscreen .wa-modal,
    body.wa-inbox-mobile-fullscreen .wa-modal-lg {
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        margin: 0 !important;
        display: flex;
        flex-direction: column;
    }

    body.wa-inbox-mobile-fullscreen .wa-modal-head {
        padding: 14px 16px;
        flex-shrink: 0;
        padding-top: calc(14px + env(safe-area-inset-top));
    }

    body.wa-inbox-mobile-fullscreen .wa-modal-head h3 {
        font-size: 16px;
    }

    body.wa-inbox-mobile-fullscreen .wa-modal-body {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 14px 16px;
    }

    body.wa-inbox-mobile-fullscreen .wa-modal-foot {
        padding: 12px 16px;
        flex-shrink: 0;
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
        border-top: 1px solid var(--border);
        background: var(--bg-panel);
    }

    /* Inputs داخل المودالات: 16px ضد iOS zoom */
    body.wa-inbox-mobile-fullscreen .wa-modal input[type="text"],
    body.wa-inbox-mobile-fullscreen .wa-modal input[type="number"],
    body.wa-inbox-mobile-fullscreen .wa-modal input[type="email"],
    body.wa-inbox-mobile-fullscreen .wa-modal input[type="tel"],
    body.wa-inbox-mobile-fullscreen .wa-modal select,
    body.wa-inbox-mobile-fullscreen .wa-modal textarea {
        font-size: 16px !important;
        min-height: 44px;
    }

    body.wa-inbox-mobile-fullscreen .wa-modal textarea {
        min-height: 100px;
    }

    /* ----- 13) إلغاء margin السلبي للجذر على الموبايل ----- */
    body.wa-inbox-mobile-fullscreen .wa-pro-root {
        width: 100%;
    }
}

/* ====================================================================
   ANIMATIONS — خارج media query حتى تكون متاحة عند تفعيل الكلاسات
   ==================================================================== */
@keyframes waSheetBackdropIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes waSheetSlideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

@keyframes waPulseDot {
    0%   { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.55); }
    70%  { box-shadow: 0 0 0 8px rgba(74, 222, 128, 0); }
    100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

/* ====================================================================
   REDUCED MOTION
   ==================================================================== */
@media (prefers-reduced-motion: reduce) {
    body.wa-inbox-mobile-fullscreen .wa-pro-root .wa-sidebar,
    body.wa-inbox-mobile-fullscreen .wa-pro-root .wa-chat-area,
    body.wa-inbox-mobile-fullscreen .wa-pro-root .wa-right-panel,
    body.wa-inbox-mobile-fullscreen .wa-mobile-sheet,
    body.wa-inbox-mobile-fullscreen .wa-mobile-sheet-backdrop {
        transition: none !important;
        animation: none !important;
    }

    body.wa-inbox-mobile-fullscreen .wa-mh-conn-dot.ok {
        animation: none !important;
    }
}

/* ====================================================================
   ROUTE FALLBACK
   يعمل حتى لو لم تُضاف body.wa-inbox-mobile-fullscreen لأي سبب.
   MainLayout يضيف .wa-inbox-layout-host عند route /messaging/whatsapp-inbox.
   ==================================================================== */
@media (max-width: 1023px) {
    .wa-inbox-layout-host .sidebar,
    .wa-inbox-layout-host .header,
    .wa-inbox-layout-host .sidebar-overlay,
    .wa-inbox-layout-host #sidebar,
    .wa-inbox-layout-host .support-fab {
        display: none !important;
    }

    .wa-inbox-layout-host.main-content,
    .wa-inbox-layout-host .main-content {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        overflow: hidden !important;
        transform: none !important;
    }

    .wa-inbox-layout-host .content:has(.wa-pro-root),
    .wa-inbox-layout-host .content {
        padding: 0 !important;
        margin: 0 !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
    }

    .wa-inbox-layout-host .wa-pro-root {
        height: 100dvh !important;
        min-height: 100dvh !important;
        max-height: 100dvh !important;
        margin: 0 !important;
        border-top: 0 !important;
        overflow: hidden !important;
        position: relative !important;
    }

    .wa-inbox-layout-host .wa-topbar {
        display: none !important;
    }

    .wa-inbox-layout-host .wa-mobile-header {
        display: flex !important;
        align-items: center;
        gap: 10px;
        height: calc(56px + env(safe-area-inset-top));
        flex-shrink: 0;
        padding: env(safe-area-inset-top) 12px 0;
        background: var(--accent-dark);
        color: #fff;
        position: relative;
        z-index: 5;
    }

    .wa-inbox-layout-host .wa-pro-root.mobile-view-list .wa-mobile-stats-strip {
        display: flex !important;
        gap: 8px;
        padding: 8px 12px;
        overflow-x: auto;
        flex-shrink: 0;
        background: var(--bg-panel);
        border-bottom: 1px solid var(--border);
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .wa-inbox-layout-host .wa-mobile-stats-strip::-webkit-scrollbar {
        display: none;
    }

    .wa-inbox-layout-host .wa-main {
        flex: 1 !important;
        position: relative !important;
        overflow: hidden !important;
        height: auto !important;
    }

    .wa-inbox-layout-host .wa-sidebar,
    .wa-inbox-layout-host .wa-chat-area,
    .wa-inbox-layout-host .wa-right-panel {
        position: absolute !important;
        inset: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        border: 0 !important;
        margin: 0 !important;
        transition: transform .28s cubic-bezier(0.22, 0.61, 0.36, 1);
        will-change: transform;
    }

    .wa-inbox-layout-host .wa-pro-root.mobile-view-list .wa-sidebar,
    .wa-inbox-layout-host .wa-pro-root.mobile-view-chat .wa-chat-area,
    .wa-inbox-layout-host .wa-pro-root.mobile-view-details .wa-right-panel {
        transform: translateX(0) !important;
        z-index: 3 !important;
        display: flex !important;
        pointer-events: auto !important;
    }

    .wa-inbox-layout-host .wa-pro-root.mobile-view-list .wa-chat-area,
    .wa-inbox-layout-host .wa-pro-root.mobile-view-list .wa-right-panel {
        transform: translateX(100%) !important;
        z-index: 1 !important;
        pointer-events: none !important;
    }

    .wa-inbox-layout-host .wa-pro-root.mobile-view-chat .wa-sidebar,
    .wa-inbox-layout-host .wa-pro-root.mobile-view-details .wa-sidebar,
    .wa-inbox-layout-host .wa-pro-root.mobile-view-details .wa-chat-area {
        transform: translateX(-100%) !important;
        z-index: 1 !important;
        pointer-events: none !important;
    }

    .wa-inbox-layout-host .wa-pro-root.mobile-view-chat .wa-right-panel {
        transform: translateX(100%) !important;
        z-index: 1 !important;
        pointer-events: none !important;
    }

    .wa-inbox-layout-host .wa-chat-header {
        display: none !important;
    }

    .wa-inbox-layout-host .wa-chat-input-area {
        flex-shrink: 0 !important;
        background: var(--bg-panel) !important;
        border-top: 1px solid var(--border) !important;
        padding-bottom: env(safe-area-inset-bottom) !important;
        box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.04) !important;
    }

    .wa-inbox-layout-host .wa-input-row {
        padding: 10px 10px 12px !important;
        gap: 8px !important;
        align-items: flex-end !important;
        background: var(--bg-panel) !important;
    }

    .wa-inbox-layout-host .wa-input-tools .wa-templates-btn,
    .wa-inbox-layout-host .wa-input-tools .wa-quick-replies-btn {
        display: none !important;
    }

    .wa-inbox-layout-host .wa-input-icon-btn.wa-attach-btn {
        width: 44px !important;
        height: 44px !important;
        border-radius: 50% !important;
        background: var(--bg-card) !important;
        color: var(--text-secondary) !important;
        border: 1px solid var(--border) !important;
    }

    .wa-inbox-layout-host .wa-input-box {
        font-size: 16px !important;
        line-height: 1.45 !important;
        min-height: 44px !important;
        max-height: 132px !important;
        border-radius: 22px !important;
        padding: 11px 16px !important;
        background: var(--bg-card) !important;
        border: 1px solid var(--border) !important;
        flex: 1 !important;
        resize: none !important;
    }

    .wa-inbox-layout-host .wa-send-btn {
        width: 48px !important;
        height: 48px !important;
        border-radius: 50% !important;
        flex-shrink: 0 !important;
        background: var(--accent) !important;
        color: #fff !important;
        border: 0 !important;
        box-shadow: 0 2px 8px rgba(37, 211, 102, 0.32) !important;
    }
}
