/**
 * Alkafeel University HR System - Native Mobile Application Architecture (PWA)
 * Complete Mobile-First Native UX/UI Framework:
 * - Edge-to-Edge Viewport & Touch Optimization
 * - Contextual Top App Bar with Navigation Stack & Back Button
 * - Hardware-Accelerated SPA Screen Transitions & Micro-Progress Bar
 * - Docked Native Bottom Navigation TabBar with Animated Pill Indicator
 * - Native Pull-to-Refresh & Haptic Feedback Simulation
 * - Universal Tabular Data to Native Mobile Card Feed Transformation
 * - Universal Mobile Bottom Sheets for All Dialogs & Modals
 * - Mobile Segmented Controls, Single-Column Forms & Sticky Action Bar
 * - Full Dark Mode Synchronization & Safe Areas
 */

/* =============================================================================
   1. GLOBAL MOBILE TOKENS & RESET
   ============================================================================= */
:root {
    --mobile-nav-height: 64px;
    --mobile-top-bar-height: 56px;
    --mobile-drawer-width: 320px;
    --mobile-tap-target-min: 44px;
    --mobile-sheet-radius: 24px;
    --mobile-card-radius: 16px;
    --mobile-app-bg: #F8FAFC;
    --mobile-surface: #FFFFFF;
    --mobile-border: #E2E8F0;
    --mobile-primary: #0A3D62;
    --mobile-primary-subtle: rgba(10, 61, 98, 0.08);
}

[data-style="dark"],
.dark-style {
    --mobile-app-bg: #0B1120;
    --mobile-surface: #1E293B;
    --mobile-border: #334155;
    --mobile-primary: #38BDF8;
    --mobile-primary-subtle: rgba(56, 189, 248, 0.12);
}

/* Standalone PWA adjustments */
body.pwa-standalone {
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

body.pwa-standalone input,
body.pwa-standalone textarea,
body.pwa-standalone [contenteditable="true"] {
    user-select: text;
    -webkit-user-select: text;
}

/* =============================================================================
   2. DESKTOP ONLY DEFAULTS (>= 1200px)
   ============================================================================= */
@media (min-width: 1200px) {
    #mobile-top-bar,
    #mobile-bottom-nav,
    #mobile-app-drawer,
    #mobile-drawer-backdrop,
    #mobile-notif-backdrop,
    #mobile-notifications-sheet,
    #mobile-search-backdrop,
    #mobile-search-sheet,
    #mobile-nav-progress,
    #mobile-ptr-indicator,
    #mobile-network-toast {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }
}

/* =============================================================================
   3. NATIVE MOBILE APPLICATION EXPERIENCE (< 1200px)
   ============================================================================= */
@media (max-width: 1199.98px) {

    /* ─── 3.1 Viewport & App Shell Overrides ─── */
    html {
        height: 100%;
        height: 100dvh;
        overflow-x: hidden;
        -webkit-text-size-adjust: 100%;
    }

    body {
        min-height: 100%;
        min-height: 100dvh;
        background-color: var(--mobile-app-bg) !important;
        overscroll-behavior-y: none; /* Disables browser elastic pull-down reload */
        -webkit-tap-highlight-color: transparent;
        touch-action: pan-x pan-y;
        font-family: 'Alkafeel', Tahoma, Arial, sans-serif !important;
    }

    /* Content container padding to prevent bottom-nav obscuring */
    .content-wrapper,
    .layout-page,
    .container-fluid,
    .container-xxl,
    .container-p-y {
        padding-bottom: calc(var(--mobile-nav-height) + 20px + env(safe-area-inset-bottom)) !important;
    }

    /* Lock desktop sidebar and navbar */
    #layout-menu,
    aside#layout-menu,
    .layout-menu,
    #layout-navbar,
    nav.layout-navbar,
    .layout-navbar {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    /* Force full-width presentation */
    html .layout-page,
    html[dir="rtl"] .layout-page,
    [dir=rtl].layout-menu-fixed .layout-page,
    .layout-content-navbar .layout-page,
    .layout-page {
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        flex-basis: 100% !important;
    }

    .layout-container {
        display: block !important;
        width: 100% !important;
    }

    /* Lock body scroll when sheets or drawers are open */
    body.mobile-drawer-open,
    body.mobile-sheet-open {
        overflow: hidden !important;
        touch-action: none;
    }

    /* ─── 3.2 Top Progress Bar (Active during seamless SPA transitions) ─── */
    .mobile-nav-progress {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 3px;
        background: linear-gradient(90deg, #0A3D62 0%, #2D8BF7 50%, #38BDF8 100%);
        z-index: 999999;
        transform: scaleX(0);
        transform-origin: right; /* RTL */
        transition: transform 0.22s ease, opacity 0.2s ease;
        opacity: 0;
        pointer-events: none;
    }
    .mobile-nav-progress.loading {
        opacity: 1;
        transform: scaleX(0.72);
    }
    .mobile-nav-progress.finishing {
        opacity: 1;
        transform: scaleX(1);
    }

    /* ─── 3.3 Pull-To-Refresh Floating Indicator ─── */
    .mobile-ptr-indicator {
        position: fixed;
        top: calc(var(--mobile-top-bar-height) + env(safe-area-inset-top) + 12px);
        left: 50%;
        transform: translateX(-50%) scale(0);
        width: 42px;
        height: 42px;
        border-radius: 50%;
        background: var(--mobile-surface);
        color: var(--mobile-primary);
        box-shadow: 0 4px 18px rgba(10, 61, 98, 0.18);
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 1045;
        pointer-events: none;
        transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
        opacity: 0;
        border: 1px solid var(--mobile-border);
    }
    .mobile-ptr-indicator.active {
        transform: translateX(-50%) scale(1);
        opacity: 1;
    }
    .mobile-ptr-indicator.refreshing .mobile-ptr-icon {
        animation: ptrSpin 0.75s linear infinite;
    }
    @keyframes ptrSpin {
        from { transform: rotate(0deg); }
        to { transform: rotate(360deg); }
    }

    /* ─── 3.4 Offline Network Pill Banner ─── */
    .mobile-network-toast {
        position: fixed;
        top: calc(var(--mobile-top-bar-height) + env(safe-area-inset-top) + 8px);
        left: 0;
        right: 0;
        display: flex;
        justify-content: center;
        z-index: 1048;
        pointer-events: none;
        animation: networkPillIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .mobile-network-pill {
        background: #DC2626;
        color: #ffffff;
        font-size: 0.78rem;
        font-weight: 700;
        padding: 6px 16px;
        border-radius: 20px;
        box-shadow: 0 4px 14px rgba(220, 38, 38, 0.35);
        display: flex;
        align-items: center;
        pointer-events: auto;
    }
    @keyframes networkPillIn {
        from { transform: translateY(-20px); opacity: 0; }
        to { transform: translateY(0); opacity: 1; }
    }

    /* ─── 3.5 Contextual Native Top App Bar ─── */
    #mobile-top-bar {
        position: sticky;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1035;
        height: calc(var(--mobile-top-bar-height) + env(safe-area-inset-top));
        padding-top: env(safe-area-inset-top) !important;
        background: var(--mobile-surface);
        border-bottom: 1px solid var(--mobile-border);
        box-shadow: 0 1px 6px rgba(10, 61, 98, 0.05);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        transition: background-color 0.2s ease, border-color 0.2s ease;
    }

    .mobile-nav-action-btn {
        width: 38px;
        height: 38px;
        min-width: 38px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 10px;
        color: var(--ak-text-secondary, #334155);
        background: transparent;
        border: none;
        transition: transform 0.12s ease, background-color 0.15s ease;
        -webkit-tap-highlight-color: transparent;
    }
    .mobile-nav-action-btn:active {
        background: var(--ak-surface-hover, #F1F5F9);
        transform: scale(0.92);
    }
    .mobile-nav-back-btn {
        color: var(--mobile-primary) !important;
        font-weight: 700;
    }

    /* ─── 3.6 Hardware-Accelerated Screen Transitions ─── */
    .mobile-view-container {
        position: relative;
        width: 100%;
        min-height: 100%;
    }
    .mobile-view-slide-in-right {
        animation: mobileSlideInRight 0.26s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }
    .mobile-view-slide-out-right {
        animation: mobileSlideOutRight 0.24s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }
    .mobile-view-fade-in {
        animation: mobileFadeIn 0.2s ease-out forwards;
    }

    @keyframes mobileSlideInRight {
        from { transform: translateX(100%); opacity: 0.85; }
        to { transform: translateX(0); opacity: 1; }
    }
    @keyframes mobileSlideOutRight {
        from { transform: translateX(0); opacity: 1; }
        to { transform: translateX(100%); opacity: 0.85; }
    }
    @keyframes mobileFadeIn {
        from { opacity: 0; transform: translateY(6px); }
        to { opacity: 1; transform: translateY(0); }
    }

    /* ─── 3.7 Fixed Docked Native Bottom Navigation Bar ─── */
    #mobile-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1040;
        height: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
        background: var(--mobile-surface);
        border-top: 1px solid var(--mobile-border);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
        display: flex;
        align-items: stretch;
        justify-content: space-around;
        backdrop-filter: blur(25px);
        -webkit-backdrop-filter: blur(25px);
    }

    .bottom-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-height: var(--mobile-tap-target-min);
        color: var(--ak-text-muted, #64748B);
        text-decoration: none;
        padding: 6px 2px;
        transition: color 0.18s ease;
        -webkit-tap-highlight-color: transparent;
        position: relative;
    }

    .bottom-nav-icon-box {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 30px;
        border-radius: 10px;
        transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s ease;
    }

    .bottom-nav-icon-box i {
        font-size: 1.35rem;
        transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), color 0.18s ease;
    }

    .bottom-nav-label {
        font-size: 0.68rem;
        font-weight: 600;
        margin-top: 2px;
        white-space: nowrap;
        transition: color 0.18s ease, font-weight 0.18s ease;
    }

    /* Tactile tap bounce effect */
    .bottom-nav-item:active .bottom-nav-icon-box {
        transform: scale(0.85);
    }

    /* Active State (High Contrast Native Pill Indicator) */
    .bottom-nav-item.active {
        color: var(--mobile-primary) !important;
    }

    .bottom-nav-item.active .bottom-nav-icon-box {
        background: var(--mobile-primary-subtle);
        transform: translateY(-2px);
    }

    .bottom-nav-item.active .bottom-nav-icon-box i {
        color: var(--mobile-primary) !important;
    }

    .bottom-nav-item.active .bottom-nav-label {
        font-weight: 800;
        color: var(--mobile-primary) !important;
    }

    .bottom-nav-badge {
        position: absolute;
        top: -3px;
        left: -5px;
        background: #DC2626;
        color: #ffffff;
        font-size: 0.62rem;
        font-weight: 800;
        padding: 1px 5px;
        border-radius: 10px;
        border: 2px solid var(--mobile-surface);
        min-width: 18px;
        text-align: center;
        box-shadow: 0 2px 6px rgba(220, 38, 38, 0.3);
    }

    /* ─── 3.8 Native Slide-Out App Drawer / Hub ─── */
    #mobile-drawer-backdrop,
    .mobile-drawer-backdrop {
        position: fixed !important;
        inset: 0 !important;
        background: rgba(15, 23, 42, 0.65) !important;
        backdrop-filter: blur(6px) !important;
        -webkit-backdrop-filter: blur(6px) !important;
        z-index: 99998 !important;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.28s ease !important;
    }

    #mobile-drawer-backdrop.active,
    .mobile-drawer-backdrop.active {
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    #mobile-app-drawer,
    .mobile-app-drawer {
        position: fixed !important;
        top: 0 !important;
        bottom: 0 !important;
        height: 100% !important;
        height: 100dvh !important;
        width: var(--mobile-drawer-width, 320px) !important;
        max-width: 86vw !important;
        background: var(--mobile-surface) !important;
        z-index: 99999 !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        box-shadow: -6px 0 30px rgba(0, 0, 0, 0.28) !important;
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    }

    /* RTL default */
    html[dir="rtl"] #mobile-app-drawer,
    #mobile-app-drawer {
        right: 0 !important;
        left: auto !important;
    }
    html[dir="rtl"] #mobile-app-drawer:not(.active),
    #mobile-app-drawer:not(.active) {
        transform: translateX(100%) !important;
    }
    html[dir="rtl"] #mobile-app-drawer.active,
    #mobile-app-drawer.active {
        transform: translateX(0) !important;
        visibility: visible !important;
        opacity: 1 !important;
        display: flex !important;
    }

    .mobile-drawer-header {
        background: linear-gradient(135deg, #0A3D62 0%, #17467C 100%);
        padding: 24px 18px 18px 18px;
        padding-top: calc(18px + env(safe-area-inset-top));
    }

    .mobile-user-card {
        background: rgba(255, 255, 255, 0.14);
        backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.25);
    }

    .mobile-drawer-body {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 14px 16px;
    }

    .mobile-drawer-nav-group {
        margin-bottom: 20px;
    }

    .mobile-group-title {
        font-size: 0.72rem;
        font-weight: 800;
        text-transform: uppercase;
        color: var(--ak-text-muted, #64748B);
        letter-spacing: 0.5px;
        margin-bottom: 8px;
        padding: 0 8px;
    }

    .mobile-nav-item {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 14px;
        border-radius: 12px;
        color: var(--ak-text-secondary, #334155);
        text-decoration: none;
        font-size: 0.9rem;
        font-weight: 600;
        transition: all 0.15s ease;
        margin-bottom: 4px;
        min-height: var(--mobile-tap-target-min);
    }

    .mobile-nav-item i {
        font-size: 1.25rem;
        color: var(--mobile-primary);
        width: 24px;
        text-align: center;
    }

    .mobile-nav-item:active,
    .mobile-nav-item.active {
        background: var(--mobile-primary-subtle);
        color: var(--mobile-primary);
        font-weight: 800;
    }

    .mobile-drawer-footer {
        padding-bottom: calc(16px + env(safe-area-inset-bottom)) !important;
        background: var(--mobile-surface);
    }

    /* ─── 3.9 Interactive Native Bottom Sheets ─── */
    #mobile-notifications-sheet,
    #mobile-search-sheet,
    .mobile-bottom-sheet {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 99999 !important;
        background: var(--mobile-surface) !important;
        border-radius: var(--mobile-sheet-radius) var(--mobile-sheet-radius) 0 0 !important;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3) !important;
        transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1) !important;
        padding-bottom: env(safe-area-inset-bottom) !important;
        max-height: 85vh !important;
        display: flex;
        flex-direction: column;
    }

    #mobile-notifications-sheet:not(.active),
    #mobile-search-sheet:not(.active),
    .mobile-bottom-sheet:not(.active) {
        transform: translateY(100%) !important;
    }

    #mobile-notifications-sheet.active,
    #mobile-search-sheet.active,
    .mobile-bottom-sheet.active {
        transform: translateY(0) !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .sheet-handle-bar {
        padding: 10px 0 6px 0;
        display: flex;
        justify-content: center;
        cursor: grab;
        touch-action: none;
    }

    .sheet-handle {
        width: 40px;
        height: 5px;
        background: #CBD5E1;
        border-radius: 3px;
    }

    /* Universal Modal-to-Bottom-Sheet Conversion on Mobile */
    .modal-dialog {
        margin: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 1095 !important;
    }
    .modal-content {
        border-radius: var(--mobile-sheet-radius) var(--mobile-sheet-radius) 0 0 !important;
        border: none !important;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3) !important;
        max-height: 88vh !important;
        overflow-y: auto !important;
        padding-bottom: calc(12px + env(safe-area-inset-bottom)) !important;
    }
    .modal.fade .modal-dialog {
        transform: translateY(100%) !important;
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    }
    .modal.show .modal-dialog {
        transform: translateY(0) !important;
    }

    /* ─── 3.10 Compact Page Headers & Elimination of Web Breadcrumbs ─── */
    .ak-breadcrumb {
        display: none !important; /* Hide breadcrumbs on mobile */
    }

    .ak-page-header {
        margin-bottom: 0.95rem !important;
        padding-bottom: 0.5rem !important;
        flex-direction: column !important;
        gap: 0.6rem !important;
    }

    .ak-page-title {
        font-size: 1.18rem !important;
        line-height: 1.35 !important;
        font-weight: 800 !important;
    }

    .ak-page-subtitle {
        font-size: 0.8rem !important;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .ak-page-actions {
        width: 100% !important;
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    .ak-page-actions .btn {
        flex: 1 1 auto;
        font-size: 0.82rem !important;
        padding: 8px 12px !important;
        justify-content: center;
        min-height: 42px;
        border-radius: 10px;
    }

    /* ─── 3.11 UNIVERSAL TABULAR DATA TO NATIVE MOBILE CARDS ─── */
    .table-responsive:not(.table-keep-scroll) {
        border: none !important;
        background: transparent !important;
        overflow: visible !important;
        padding: 0 !important;
    }

    #table-csv-employees,
    #table-csv-submissions,
    .table-responsive:not(.table-keep-scroll) table,
    .table-mobile-cards {
        display: block !important;
        width: 100% !important;
        border: none !important;
        background: transparent !important;
    }

    #table-csv-employees thead,
    #table-csv-submissions thead,
    .table-responsive:not(.table-keep-scroll) thead,
    .table-mobile-cards thead {
        display: none !important;
    }

    #table-csv-employees tbody,
    #table-csv-submissions tbody,
    .table-responsive:not(.table-keep-scroll) tbody,
    .table-mobile-cards tbody {
        display: flex !important;
        flex-direction: column !important;
        gap: 14px !important;
        width: 100% !important;
        background: transparent !important;
    }

    #table-csv-employees tbody tr,
    #table-csv-submissions tbody tr,
    .table-responsive:not(.table-keep-scroll) tbody tr,
    .table-mobile-cards tbody tr {
        display: block !important;
        background: var(--mobile-surface) !important;
        border: 1px solid var(--mobile-border) !important;
        border-radius: var(--mobile-card-radius, 16px) !important;
        padding: 16px 18px !important;
        box-shadow: 0 2px 10px rgba(10, 61, 98, 0.05) !important;
        position: relative !important;
        width: 100% !important;
        transition: transform 0.15s ease, box-shadow 0.15s ease !important;
        -webkit-tap-highlight-color: transparent;
    }

    #table-csv-employees tbody tr:active,
    #table-csv-submissions tbody tr:active,
    .table-responsive:not(.table-keep-scroll) tbody tr:active,
    .table-mobile-cards tbody tr:active {
        transform: scale(0.985) !important;
    }

    #table-csv-employees tbody td,
    #table-csv-submissions tbody td,
    .table-responsive:not(.table-keep-scroll) tbody td,
    .table-mobile-cards tbody td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 9px 0 !important;
        border: none !important;
        border-bottom: 1px dashed var(--ak-border-subtle, #EDF2F7) !important;
        font-size: 0.88rem !important;
        width: 100% !important;
    }

    #table-csv-employees tbody td:last-child,
    #table-csv-submissions tbody td:last-child,
    .table-responsive:not(.table-keep-scroll) tbody td:last-child,
    .table-mobile-cards tbody td:last-child {
        border-bottom: none !important;
        padding-bottom: 0 !important;
        margin-top: 8px !important;
        justify-content: flex-end !important;
        gap: 8px;
    }

    /* Assign label on right (RTL) */
    #table-csv-employees tbody td[data-label]::before,
    #table-csv-submissions tbody td[data-label]::before,
    .table-responsive:not(.table-keep-scroll) tbody td[data-label]::before,
    .table-mobile-cards tbody td[data-label]::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--ak-text-muted, #64748B);
        font-size: 0.82rem;
        margin-left: 14px;
        flex-shrink: 0;
    }

    /* Primary identifier / Name Cell styling */
    .table-responsive:not(.table-keep-scroll) tbody td:nth-child(3),
    .table-mobile-cards tbody td:nth-child(3) {
        font-size: 0.98rem !important;
        font-weight: 800 !important;
        color: var(--mobile-primary) !important;
        border-bottom: 1.5px solid var(--mobile-border) !important;
        padding-bottom: 10px !important;
    }

    /* Financial payroll tables keep smooth horizontal scroll */
    .table-keep-scroll {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        border-radius: var(--mobile-card-radius);
    }

    /* ─── 3.12 Segmented Controls & Horizontal Swipeable Chips ─── */
    .mobile-chips-scroll,
    .admin-tabs-scroll {
        overflow-x: auto !important;
        white-space: nowrap !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
        padding: 6px 2px !important;
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        border: none !important;
    }
    .mobile-chips-scroll::-webkit-scrollbar,
    .admin-tabs-scroll::-webkit-scrollbar {
        display: none !important;
    }

    .mobile-filter-chip,
    .admin-tabs-scroll .nav-link {
        font-size: 0.82rem !important;
        font-weight: 700 !important;
        padding: 8px 16px !important;
        border-radius: 20px !important;
        transition: all 0.18s ease !important;
        border: 1px solid var(--mobile-border) !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        cursor: pointer !important;
        background: var(--mobile-surface) !important;
        color: var(--ak-text-secondary, #334155) !important;
    }

    .mobile-filter-chip.active,
    .admin-tabs-scroll .nav-link.active {
        background: var(--mobile-primary) !important;
        color: #ffffff !important;
        border-color: var(--mobile-primary) !important;
        box-shadow: 0 3px 10px rgba(10, 61, 98, 0.22) !important;
    }

    /* ─── 3.13 Native Mobile ID Cards ─── */
    .ak-mobile-idcard-card {
        background: var(--mobile-surface) !important;
        border: 1px solid var(--mobile-border) !important;
        border-radius: 18px !important;
        padding: 16px !important;
        margin-bottom: 14px !important;
        box-shadow: 0 3px 12px rgba(10, 61, 98, 0.06) !important;
        transition: transform 0.15s ease, box-shadow 0.15s ease !important;
        -webkit-tap-highlight-color: transparent;
    }
    .ak-mobile-idcard-card:active {
        transform: scale(0.985) !important;
    }

    /* ─── 3.14 Native Mobile Form Controls & Sticky Action Bar ─── */
    .form-control:not(.input-group > .form-control),
    .form-select:not(.input-group > .form-select) {
        min-height: 44px !important;
        font-size: 16px !important; /* Prevents auto-zoom in Safari iOS */
        border-radius: 12px !important;
    }

    .input-group > .form-control,
    .input-group > .form-select,
    .input-group > .input-group-text,
    .input-group > .btn {
        min-height: 44px !important;
        font-size: 16px !important;
    }

    [dir="rtl"] .input-group > :first-child:not(:last-child) {
        border-top-right-radius: 12px !important;
        border-bottom-right-radius: 12px !important;
        border-top-left-radius: 0 !important;
        border-bottom-left-radius: 0 !important;
        border-left: 0 !important;
    }

    [dir="rtl"] .input-group > :last-child:not(:first-child) {
        border-top-left-radius: 12px !important;
        border-bottom-left-radius: 12px !important;
        border-top-right-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
    }

    .form-label {
        font-size: 0.86rem !important;
        font-weight: 700 !important;
        margin-bottom: 6px !important;
    }

    /* Sticky form actions container */
    .ak-form-actions-sticky {
        position: sticky !important;
        bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom) + 8px) !important;
        background: var(--mobile-surface);
        padding: 12px 16px !important;
        border-radius: 16px;
        box-shadow: 0 8px 28px rgba(0, 0, 0, 0.15);
        z-index: 1025;
        border: 1px solid var(--mobile-border);
        margin-top: 18px;
        backdrop-filter: blur(12px);
    }

    /* ─── 3.15 KPI Grid on Mobile ─── */
    .mobile-kpi-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
    .desktop-only-kpis,
    .scientific-desktop-kpis {
        display: none !important;
    }

    /* ─── 3.16 Mobile Form Steps Stepper & Header ─── */
    .form-step-card .card-header {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 14px 16px !important;
        gap: 12px !important;
        width: 100% !important;
    }

    .form-step-card .card-header > div:first-child {
        width: 100% !important;
    }

    .mobile-stepper-progress {
        width: 100% !important;
        background: var(--mobile-surface, #ffffff) !important;
        border: 1px solid var(--mobile-border, #E2E8F0) !important;
        border-radius: 14px !important;
        padding: 12px 14px !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
        margin-bottom: 0 !important;
    }

    .steps-container .steps-nav {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        justify-content: flex-start !important;
        gap: 12px !important;
        padding: 12px 14px !important;
        border-radius: 16px !important;
    }
    .steps-container .steps-nav::-webkit-scrollbar {
        display: none !important;
    }
    .steps-container .step-item {
        flex-shrink: 0 !important;
    }
    .steps-container .step-divider {
        min-width: 24px !important;
        max-width: 36px !important;
        flex-shrink: 0 !important;
    }

    /* Native Floating Action Dock above Mobile Bottom Nav */
    #mobile-form-actions-dock {
        display: flex !important;
        position: fixed !important;
        bottom: calc(var(--mobile-nav-height, 64px) + env(safe-area-inset-bottom, 0px) + 8px) !important;
        left: 12px !important;
        right: 12px !important;
        z-index: 1040 !important;
        padding: 8px 12px !important;
        background: rgba(255, 255, 255, 0.96) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        border: 1px solid rgba(0, 0, 0, 0.08) !important;
        border-radius: 999px !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12) !important;
        align-items: center !important;
        gap: 10px !important;
    }

    .dark-style #mobile-form-actions-dock {
        background: rgba(30, 34, 54, 0.96) !important;
        border-color: rgba(255, 255, 255, 0.12) !important;
        box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35) !important;
    }

    .mob-dock-btn {
        height: 44px !important;
        font-size: 0.92rem !important;
        font-weight: 700 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
        flex: 1 1 auto !important;
    }

    #mobBtnPrev.mob-dock-btn {
        flex: 0 0 35% !important;
        max-width: 130px !important;
    }

    .mob-dock-btn.d-none {
        display: none !important;
    }

    /* ─── 3.17 Salaries Tabs Mobile Swipeable Bar ─── */
    #salariesTabs {
        display: flex !important;
        flex-direction: row !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        padding-bottom: 6px;
        gap: 8px !important;
    }
    #salariesTabs::-webkit-scrollbar {
        display: none !important;
    }
    #salariesTabs .nav-item {
        flex-shrink: 0 !important;
    }
    #salariesTabs .nav-link {
        border-radius: 20px !important;
        padding: 8px 16px !important;
        font-size: 0.82rem !important;
    }

    /* ─── 3.18 Native Mobile Login & Onboarding Screen ─── */
    @media (max-width: 767.98px) {
        .authentication-wrapper.authentication-basic {
            min-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
            padding: 0 !important;
            align-items: flex-start !important;
        }
        .authentication-wrapper .authentication-inner {
            max-width: 100% !important;
            width: 100% !important;
            padding: 24px 16px !important;
        }
        .authentication-wrapper .card {
            border: none !important;
            box-shadow: none !important;
            background: transparent !important;
        }
        .authentication-wrapper .card-body {
            padding: 0 !important;
        }
    }
}

/* =============================================================================
   4. SMART PWA INSTALL BANNER
   ============================================================================= */
#pwa-install-banner {
    animation: pwaSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

@keyframes pwaSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 767.98px) {
    #pwa-install-banner {
        left: 12px !important;
        right: 12px !important;
        bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom) + 12px) !important;
        width: calc(100% - 24px) !important;
        max-width: 100% !important;
    }
}

/* =============================================================================
   5. TOAST NOTIFICATIONS CONTAINER
   ============================================================================= */
#pwa-toast-container {
    z-index: 1090;
    pointer-events: none;
}

#pwa-toast-container .toast {
    pointer-events: auto;
    font-family: inherit;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

@media (max-width: 767.98px) {
    #pwa-toast-container {
        bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom) + 8px) !important;
        left: 12px !important;
        right: 12px !important;
        width: auto !important;
    }
}
