:root {
    --hasopa-red: #b91c1c;
    --hasopa-red-dark: #7f1d1d;
    --hasopa-red-soft: #fef2f2;
    --hasopa-red-border: #fecaca;
    --hasopa-dark: #1e293b;
    --hasopa-darker: #0f172a;
    --hasopa-bg: #f4f6f9;
    --hasopa-gray: #f8fafc;
    --hasopa-border: #e2e8f0;
    --hasopa-text-main: #1e293b;
    --hasopa-text-muted: #64748b;
    --sidebar-width: 256px;
    --sidebar-collapsed-width: 78px;
}

body {
    font-family: 'Cairo', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--hasopa-bg);
    color: var(--hasopa-text-main);
    font-weight: 400;
    overflow-x: hidden;
}

.sales-formal-wrapper {
    font-family: 'Cairo', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--hasopa-text-main);
    font-weight: 400;
    letter-spacing: 0;
}

/* =====================================================================
   Desktop Collapsible Right Sidebar (RTL) + Centered Comfortable Layout
   ===================================================================== */
.hasopa-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: -4px 0 24px rgba(15, 23, 42, 0.14);
    z-index: 1035;
    display: flex;
    flex-direction: column;
    transition: width 0.24s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.hasopa-sidebar-header {
    padding: 16px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 68px;
}

.hasopa-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #ffffff;
    overflow: hidden;
    white-space: nowrap;
}

.hasopa-brand-logo {
    width: 38px;
    height: 38px;
    object-fit: contain;
    background: #ffffff;
    border-radius: 10px;
    padding: 2px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    flex-shrink: 0;
}

.hasopa-sidebar-toggle-btn {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06);
    color: #cbd5e1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

    .hasopa-sidebar-toggle-btn:hover {
        background: rgba(185, 28, 28, 0.3);
        border-color: rgba(185, 28, 28, 0.65);
        color: #ffffff;
    }

.hasopa-sidebar-nav {
    flex: 1;
    padding: 14px 10px;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hasopa-sidebar-section-label {
    font-size: 0.69rem;
    font-weight: 700;
    color: #64748b;
    padding: 6px 12px 2px 12px;
    text-transform: uppercase;
    white-space: nowrap;
}

.hasopa-side-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 13px;
    border-radius: 11px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.86rem;
    font-weight: 600;
    background: transparent;
    border: none;
    width: 100%;
    text-align: right;
    cursor: pointer;
    position: relative;
    white-space: nowrap;
    transition: all 0.18s ease;
}

    .hasopa-side-link i {
        width: 22px;
        text-align: center;
        font-size: 1.02rem;
        flex-shrink: 0;
        color: #94a3b8;
        transition: color 0.18s ease;
    }

    .hasopa-side-link:hover {
        background: rgba(255, 255, 255, 0.07);
        color: #ffffff;
    }

        .hasopa-side-link:hover i {
            color: #f87171;
        }

    .hasopa-side-link.active {
        background: linear-gradient(90deg, rgba(185, 28, 28, 0.92) 0%, rgba(127, 29, 29, 0.96) 100%);
        color: #ffffff;
        box-shadow: 0 4px 14px rgba(185, 28, 28, 0.34);
    }

        .hasopa-side-link.active i {
            color: #ffffff;
        }

.hasopa-side-badge {
    margin-right: auto;
    background: #ef4444;
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 999px;
}

.hasopa-sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(15, 23, 42, 0.45);
}

.hasopa-sidebar-user-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    margin-bottom: 8px;
    overflow: hidden;
}

/* Main Shell pushed left of the Right Sidebar on Desktop */
.hasopa-main-shell {
    margin-right: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-right 0.24s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Slim, Calm Top Context Bar */
.hasopa-slim-topbar {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--hasopa-border);
    padding: 10px 24px;
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

/* Centered Comfortable Content Wrapper (Eye-Friendly Margins on Wide Screens) */
.hasopa-content-container {
    width: 100%;
    max-width: 1360px;
    margin: 0 auto;
    padding: 20px 28px 32px 28px;
}

/* Collapsed Sidebar State (Mini Icon Rail on Desktop) */
body.sidebar-collapsed .hasopa-sidebar {
    width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .hasopa-main-shell {
    margin-right: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .hasopa-sidebar-header {
    justify-content: center;
    padding: 14px 8px;
}

body.sidebar-collapsed .hasopa-sidebar-brand {
    display: none;
}

body.sidebar-collapsed .sidebar-text,
body.sidebar-collapsed .hasopa-sidebar-section-label {
    display: none !important;
}

body.sidebar-collapsed .hasopa-side-link {
    justify-content: center;
    padding: 11px 0;
}

body.sidebar-collapsed .hasopa-side-badge {
    position: absolute;
    top: 4px;
    left: 12px;
    margin: 0;
    padding: 1px 5px;
    font-size: 0.62rem;
}

body.sidebar-collapsed .hasopa-sidebar-user-box {
    justify-content: center;
    padding: 8px 4px;
}

body.sidebar-collapsed .hasopa-sidebar-toggle-btn i {
    transform: rotate(180deg);
}

/* Mobile Header (Shown only on < 992px, clean without Hamburger) */
.hasopa-mobile-header {
    display: none;
}

/* =====================================================================
   iOS Bottom Navigation Dock (Mobile Only - Replaces Hamburger Menu)
   ===================================================================== */
.ios-bottom-dock {
    display: none;
}

@media (max-width: 991.98px) {
    body {
        padding-bottom: 88px !important;
    }

    .hasopa-sidebar,
    .hasopa-slim-topbar {
        display: none !important;
    }

    .hasopa-main-shell,
    body.sidebar-collapsed .hasopa-main-shell {
        margin-right: 0 !important;
    }

    .hasopa-content-container {
        padding: 14px 12px 24px 12px;
    }

    .hasopa-mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: linear-gradient(90deg, #0f172a 0%, #1e293b 100%);
        border-bottom: 3px solid var(--hasopa-red);
        padding: 10px 14px;
        position: sticky;
        top: 0;
        z-index: 1030;
        box-shadow: 0 4px 14px rgba(15, 23, 42, 0.14);
    }

    .ios-bottom-dock {
        display: flex;
        position: fixed;
        bottom: 10px;
        left: 12px;
        right: 12px;
        z-index: 1040;
        background: rgba(15, 23, 42, 0.94);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-top: 2px solid rgba(185, 28, 28, 0.85);
        border-radius: 20px;
        padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px)) 8px;
        box-shadow: 0 12px 32px rgba(15, 23, 42, 0.28);
        justify-content: space-around;
        align-items: center;
        gap: 4px;
    }

    .ios-dock-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 6px 4px;
        border-radius: 14px;
        color: #94a3b8;
        text-decoration: none;
        background: transparent;
        border: none;
        position: relative;
        transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
        cursor: pointer;
    }

        .ios-dock-item i {
            font-size: 1.15rem;
            line-height: 1;
            transition: transform 0.2s ease;
        }

        .ios-dock-item span.dock-label {
            font-size: 0.67rem;
            font-weight: 600;
            line-height: 1.1;
            white-space: nowrap;
        }

        .ios-dock-item:active {
            transform: scale(0.94);
        }

        .ios-dock-item.active {
            color: #ffffff;
            background: linear-gradient(135deg, rgba(185, 28, 28, 0.92) 0%, rgba(127, 29, 29, 0.95) 100%);
            box-shadow: 0 4px 12px rgba(185, 28, 28, 0.4);
        }

            .ios-dock-item.active i {
                transform: translateY(-1px);
            }

    .ios-dock-badge {
        position: absolute;
        top: 2px;
        left: 50%;
        transform: translateX(6px);
        background: #ef4444;
        color: #ffffff;
        font-size: 0.63rem;
        font-weight: 700;
        min-width: 18px;
        height: 18px;
        line-height: 18px;
        padding: 0 4px;
        border-radius: 999px;
        border: 1.5px solid #0f172a;
        text-align: center;
    }
}

/* Main Page Card */
.zain-page-card {
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.035);
    border: 1px solid var(--hasopa-border);
    overflow: hidden;
}

    .zain-page-card::before {
        content: '';
        display: block;
        height: 4px;
        background: linear-gradient(90deg, #7f1d1d 0%, #b91c1c 50%, #dc2626 100%);
    }

/* Primary Buttons */
.btn-zain-primary {
    background: linear-gradient(90deg, #8b0000 0%, #b91c1c 100%);
    color: #ffffff;
    border: none;
    font-weight: 600;
    font-size: 0.86rem;
    border-radius: 10px;
    padding: 8px 18px;
    box-shadow: 0 2px 8px rgba(185, 28, 28, 0.22);
    transition: all 0.2s ease;
}

    .btn-zain-primary:hover {
        transform: translateY(-1px);
        color: #ffffff;
        background: linear-gradient(90deg, #7f1d1d 0%, #991b1b 100%);
        box-shadow: 0 4px 12px rgba(185, 28, 28, 0.32);
    }

    .btn-zain-primary:focus {
        color: #ffffff;
        box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.2);
    }

/* Form Controls */
.zain-form-control,
.zain-form-select {
    background-color: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    padding: 8px 12px;
    font-weight: 500;
    font-size: 0.86rem;
    color: var(--hasopa-text-main);
    transition: all 0.2s ease;
}

    .zain-form-control:focus,
    .zain-form-select:focus {
        background-color: #ffffff;
        border-color: var(--hasopa-red);
        box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.09);
        outline: none;
    }

.formal-label {
    font-weight: 600;
    font-size: 0.8rem;
    color: #334155;
    margin-bottom: 5px;
    display: block;
}

/* Smart Proactive Alert Strip */
.smart-alert-strip {
    background: #ffffff;
    border: 1px solid var(--hasopa-border);
    border-right: 4px solid var(--hasopa-red);
    border-radius: 12px;
    padding: 10px 16px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
}

.smart-alert-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 9px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

    .smart-alert-pill:hover {
        transform: translateY(-1px);
    }

/* KPI Mini Cards */
.kpi-mini-card {
    background: #ffffff;
    border: 1px solid var(--hasopa-border);
    border-radius: 12px;
    padding: 13px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.02);
    transition: transform 0.15s ease;
}

    .kpi-mini-card:hover {
        transform: translateY(-2px);
    }

.kpi-mini-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex-shrink: 0;
}

.kpi-title {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--hasopa-text-muted);
}

.kpi-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--hasopa-text-main);
}

/* Portal Product Cards */
.portal-product-card {
    background: #ffffff;
    border: 1px solid var(--hasopa-border);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: all 0.22s ease;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.03);
}

    .portal-product-card:hover {
        transform: translateY(-3px);
        border-color: #fca5a5;
        box-shadow: 0 12px 26px rgba(15, 23, 42, 0.07);
    }

.portal-product-img-box {
    height: 175px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
    position: relative;
    border-bottom: 1px solid #f1f5f9;
}

    .portal-product-img-box img {
        max-height: 100%;
        max-width: 100%;
        object-fit: contain;
    }

.spec-chip {
    display: inline-block;
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    padding: 2px 8px;
    font-size: 0.72rem;
    font-weight: 600;
}

/* Desktop Floating Cart Trigger */
.desktop-floating-cart {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 1030;
    border-radius: 50px;
    padding: 12px 22px;
    box-shadow: 0 10px 28px rgba(185, 28, 28, 0.35);
    display: flex;
    align-items: center;
    gap: 10px;
}

@media (max-width: 991.98px) {
    .desktop-floating-cart {
        display: none !important;
    }
}

/* Order Progress Stepper */
.order-stepper {
    display: flex;
    justify-content: space-between;
    position: relative;
    margin: 14px 0 8px 0;
}

    .order-stepper::before {
        content: '';
        position: absolute;
        top: 14px;
        right: 10%;
        left: 10%;
        height: 3px;
        background: #e2e8f0;
        z-index: 1;
    }

.order-step {
    position: relative;
    z-index: 2;
    text-align: center;
    flex: 1;
}

.order-step-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f1f5f9;
    border: 2px solid #cbd5e1;
    color: #94a3b8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    margin-bottom: 4px;
}

.order-step.done .order-step-dot {
    background: #16a34a;
    border-color: #16a34a;
    color: #ffffff;
}

.order-step.current .order-step-dot {
    background: #b91c1c;
    border-color: #b91c1c;
    color: #ffffff;
    box-shadow: 0 0 0 4px rgba(185, 28, 28, 0.16);
}

.order-step-label {
    font-size: 0.71rem;
    font-weight: 600;
    color: #64748b;
}

.order-step.done .order-step-label,
.order-step.current .order-step-label {
    color: #0f172a;
}

/* Tables */
.sales-table thead th {
    background: #1e293b;
    color: #f8fafc;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 11px 10px;
    border: none;
    text-align: center;
    white-space: nowrap;
}

.sales-table tbody td {
    padding: 10px 10px;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    font-weight: 500;
    font-size: 0.84rem;
    color: #334155;
    text-align: center;
}

.sales-table tbody tr {
    transition: background-color 0.15s ease;
}

    .sales-table tbody tr:hover {
        background-color: #f8fafc;
    }

.prod-title-cell {
    font-size: 0.88rem;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.35;
}

.prod-specs-cell {
    font-size: 0.77rem;
    font-weight: 400;
    color: #64748b;
    line-height: 1.35;
}

.price-num {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    font-weight: 600;
    font-size: 0.88rem;
}

/* Collapsible Capsule Bar */
.capsule-toggle-bar {
    background: #f1f5f9;
    border: 1px dashed #94a3b8;
    border-radius: 10px;
    padding: 9px 15px;
    color: #1e293b;
    font-weight: 600;
    font-size: 0.83rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
    user-select: none;
}

    .capsule-toggle-bar:hover {
        background: #e2e8f0;
        border-color: #64748b;
    }

    .capsule-toggle-bar[aria-expanded="true"] {
        background: #fff5f5;
        border-color: #fca5a5;
        color: #991b1b;
    }

        .capsule-toggle-bar[aria-expanded="true"] .capsule-chevron {
            transform: rotate(180deg);
        }

.capsule-chevron {
    transition: transform 0.25s ease;
}

/* Walk-in Client Mode */
body.client-mode .secret-col {
    display: none !important;
}

/* Responsive Mobile Cards for Tables */
@media (max-width: 991px) {
    .table-responsive-cards thead {
        display: none;
    }

    .table-responsive-cards tbody,
    .table-responsive-cards tr,
    .table-responsive-cards td {
        display: block;
        width: 100%;
    }

    .table-responsive-cards tr {
        background: #ffffff;
        border: 1px solid var(--hasopa-border);
        border-right: 3px solid var(--hasopa-red);
        border-radius: 12px;
        margin-bottom: 14px;
        padding: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.025);
    }

    .table-responsive-cards td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 7px 6px;
        border-bottom: 1px dashed #e2e8f0;
        text-align: left;
    }

        .table-responsive-cards td:last-child {
            border-bottom: none;
            padding-top: 10px;
        }

        .table-responsive-cards td::before {
            content: attr(data-label);
            font-weight: 600;
            color: #64748b;
            font-size: 0.78rem;
            text-align: right;
            margin-left: 10px;
        }
}

/* Official Crystal Report Style Printing */
#officialPrintContainer {
    display: none;
}

@media print {
    body {
        padding-bottom: 0 !important;
    }

        .hasopa-main-shell,
        body.sidebar-collapsed .hasopa-main-shell {
            margin-right: 0 !important;
        }

        body * {
            visibility: hidden !important;
        }

    .no-print, .hasopa-sidebar, .hasopa-slim-topbar, .hasopa-mobile-header, .ios-bottom-dock, .desktop-floating-cart, .modal, .modal-backdrop, .offcanvas {
        display: none !important;
    }

    #officialPrintContainer, #officialPrintContainer * {
        visibility: visible !important;
    }

    #officialPrintContainer {
        display: block !important;
        position: absolute;
        top: 0;
        right: 0;
        left: 0;
        width: 100%;
        background: #ffffff;
        color: #000000;
        direction: rtl;
        font-family: 'Cairo', sans-serif;
        padding: 0;
        margin: 0;
    }

    .print-header-title {
        font-size: 11.5pt;
        font-weight: 600;
        color: #1a1a1a;
    }

    .print-grid-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 8.5pt;
        font-weight: 500;
    }

        .print-grid-table th {
            background-color: #f1f5f9 !important;
            color: #000000 !important;
            border: 1px solid #94a3b8;
            padding: 6px 8px;
            font-size: 8.5pt;
            font-weight: 600;
            -webkit-print-color-adjust: exact;
            print-color-adjust: exact;
        }

        .print-grid-table td {
            border: 1px solid #cbd5e1;
            padding: 6px 8px;
            font-size: 8.5pt;
            font-weight: 500;
            vertical-align: middle;
        }
}
