@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --sidebar-bg: #352656;
    --sidebar-dark: #291d45;
    --sidebar-hover: rgba(255, 255, 255, 0.08);
    --sidebar-active: #4a3875;
    --sidebar-text: #d8cde9;
    --sidebar-text-bright: #ffffff;
    --tree-line: rgba(255, 255, 255, 0.15);
    
    --primary: #6c5ce7;
    --primary-dark: #5641e5;
    --accent-gold: #f8c146;
    --teal-badge: #1abc9c;
    --teal-btn: #17a2b8;
    --blue-btn: #007bff;
    --green-btn: #8bc34a;
    --danger-btn: #e74c3c;
    
    --body-bg: #f4f6f9;
    --card-bg: #ffffff;
    --text-main: #2d3436;
    --text-muted: #636e72;
    --border-color: #e2e8f0;
    --table-header-bg: #494d52;
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --radius: 8px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--body-bg);
    color: var(--text-main);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar Styling */
.app-sidebar {
    width: 270px;
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-dark) 100%);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
    z-index: 100;
    box-shadow: 3px 0 15px rgba(0, 0, 0, 0.15);
}

.app-sidebar::-webkit-scrollbar {
    width: 5px;
}
.app-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.brand-header {
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0,0,0,0.1);
}

.brand-logo {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: linear-gradient(135deg, #a29bfe, var(--primary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: 0 4px 10px rgba(108, 92, 231, 0.4);
}

.brand-info h2 {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 600;
    color: #fff;
    line-height: 1.2;
}
.brand-info span {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.6);
    letter-spacing: 0.5px;
}

/* Sidebar Nav */
.sidebar-menu {
    list-style: none;
    padding: 10px 0;
    flex-grow: 1;
}

.menu-item {
    position: relative;
}

.menu-link {
    display: flex;
    align-items: center;
    padding: 11px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    user-select: none;
}

.menu-link:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-bright);
}

.menu-link.active {
    background: var(--sidebar-active);
    color: #ffffff;
    font-weight: 600;
}

.menu-link .icon {
    width: 22px;
    display: inline-flex;
    justify-content: center;
    margin-right: 12px;
    font-size: 1.05rem;
    opacity: 0.85;
}

.menu-link .title {
    flex-grow: 1;
}

.menu-link .arrow {
    font-size: 0.75rem;
    transition: transform 0.25s ease;
    opacity: 0.6;
}

.menu-item.open > .menu-link .arrow {
    transform: rotate(180deg);
}

.active-dot {
    width: 7px;
    height: 7px;
    background-color: var(--teal-badge);
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px var(--teal-badge);
}

/* Tree view submenus */
.submenu {
    list-style: none;
    padding-left: 36px;
    position: relative;
    display: none;
    background: rgba(0, 0, 0, 0.12);
}

.menu-item.open > .submenu {
    display: block;
}

.submenu::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 28px;
    width: 1px;
    background: var(--tree-line);
}

.submenu-item {
    position: relative;
}

.submenu-item::before {
    content: '';
    position: absolute;
    top: 20px;
    left: -8px;
    width: 10px;
    height: 1px;
    background: var(--tree-line);
}

.submenu-link {
    display: flex;
    align-items: center;
    padding: 9px 15px 9px 6px;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    font-size: 0.82rem;
    transition: var(--transition);
}

.submenu-link:hover {
    color: #ffffff;
    padding-left: 10px;
}

.submenu-link.active {
    color: #ffd166;
    font-weight: 600;
}

.submenu-link .sub-icon {
    margin-right: 8px;
    font-size: 0.85rem;
    opacity: 0.7;
}

/* Child Submenus (Accordion / Collapsible Sub-levels) */
.child-submenu {
    display: none;
    list-style: none;
    padding-left: 14px;
    margin: 2px 0 6px 0;
    position: relative;
    border-left: 1px dashed rgba(255, 255, 255, 0.15);
}

.submenu-item.open > .child-submenu {
    display: block;
    animation: fadeInSubmenu 0.2s ease;
}

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

.submenu-link[data-toggle="child-submenu"] {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.submenu-link[data-toggle="child-submenu"] .child-arrow {
    font-size: 0.68rem;
    transition: transform 0.25s ease;
    opacity: 0.7;
    margin-left: auto;
}

.submenu-item.open > .submenu-link[data-toggle="child-submenu"] .child-arrow {
    transform: rotate(180deg);
}

.child-submenu li a {
    display: flex;
    align-items: center;
    padding: 6px 10px 6px 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    text-decoration: none;
    transition: var(--transition);
    border-radius: 4px;
}

.child-submenu li a:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    padding-left: 12px;
}

.child-submenu li a.active {
    color: #ffd166;
    font-weight: 600;
    background: rgba(255, 209, 102, 0.12);
}

/* Main Layout */
.app-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: #f7f9fc;
}

/* Top Navbar */
.top-navbar {
    height: 60px;
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: var(--shadow-sm);
    z-index: 50;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.company-badge {
    background: #f1f3f9;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #4b5563;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #e5e7eb;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 18px;
}

.nav-icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.15rem;
    color: #64748b;
    position: relative;
    padding: 6px;
    border-radius: 50%;
    transition: var(--transition);
}

.nav-icon-btn:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Content Area */
.app-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

/* ERP Viewport & Cards */
.page-header-card {
    background: linear-gradient(90deg, #423561 0%, #30244b 100%);
    color: white;
    border-radius: var(--radius);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    box-shadow: var(--shadow-md);
}

.page-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--accent-gold);
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-group-actions {
    display: flex;
    gap: 8px;
}

.btn-action {
    padding: 7px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #fff;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.btn-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-excel { background-color: var(--teal-btn); }
.btn-print { background-color: var(--blue-btn); }
.btn-pdf { background-color: #17a2b8; }
.btn-show { background-color: var(--green-btn); }
.btn-primary { background-color: var(--primary); }

/* Filter & Search Bar */
.filter-card {
    background: #ffffff;
    border-radius: var(--radius);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
}

.search-box {
    display: flex;
    align-items: center;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 6px 12px;
    width: 320px;
    transition: var(--transition);
}

.search-box:focus-within {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

.search-box input {
    border: none;
    outline: none;
    background: transparent;
    width: 100%;
    margin-left: 8px;
    font-size: 0.88rem;
}

.filter-select {
    padding: 7px 14px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background-color: #f8fafc;
    font-size: 0.85rem;
    color: #334155;
    outline: none;
    cursor: pointer;
}

.filter-select:focus {
    border-color: var(--primary);
    background: #fff;
}

/* Data Table Component */
.table-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.table-responsive {
    overflow-x: auto;
}

.erp-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.88rem;
}

.erp-table thead th {
    background-color: var(--table-header-bg);
    color: #ffffff;
    padding: 12px 18px;
    font-weight: 500;
    letter-spacing: 0.3px;
    border: none;
}

.erp-table tbody td {
    padding: 11px 18px;
    border-bottom: 1px solid #edf2f7;
    color: #334155;
}

.erp-table tbody tr:hover {
    background-color: #f8fafc;
}

.badge-code {
    font-family: monospace;
    font-weight: 600;
    color: #4a5568;
    background: #edf2f7;
    padding: 3px 8px;
    border-radius: 4px;
}

.badge-barcode {
    font-family: monospace;
    font-weight: 600;
    color: #2b6cb0;
    background: #ebf8ff;
    padding: 3px 8px;
    border-radius: 4px;
}

/* Pagination */
.pagination-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-top: 1px solid var(--border-color);
    background: #ffffff;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.pagination-controls {
    display: flex;
    gap: 6px;
}

.page-btn {
    padding: 6px 12px;
    border: 1px solid #cbd5e1;
    background: #fff;
    border-radius: 5px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
}

.page-btn:hover:not(:disabled) {
    background: #f1f5f9;
    border-color: var(--primary);
    color: var(--primary);
}

.page-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Dashboard Cards Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-val {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.82rem;
    color: #64748b;
    font-weight: 500;
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 3px solid rgba(108, 92, 231, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 0.8s linear infinite;
}

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

.loading-state {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-card {
    background: #fff;
    border-radius: 12px;
    width: 550px;
    max-width: 90vw;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: modalPop 0.25s ease-out;
}

@keyframes modalPop {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    padding: 16px 20px;
    background: var(--sidebar-bg);
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 20px;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: #475569;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.88rem;
}

.modal-footer {
    padding: 14px 20px;
    background: #f8fafc;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ==========================================================================
   ENTERPRISE SUITE: LOGIN OVERLAY, COMMAND PALETTE, & EXECUTIVE DASHBOARD
   ========================================================================== */

/* 1. Login Screen */
.login-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: radial-gradient(circle at 50% 20%, #1e293b 0%, #0f172a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    width: 100%;
    max-width: 440px;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45);
    padding: 36px 32px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.login-brand-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    background: linear-gradient(135deg, #0284c7, #0369a1);
    color: #fff;
    border-radius: 12px;
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 14px;
    box-shadow: 0 8px 16px -4px rgba(2, 132, 199, 0.4);
}

/* 2. Global Command Palette (Ctrl + K) */
.cmd-palette-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 70px;
}

.cmd-palette-window {
    background: #ffffff;
    width: 100%;
    max-width: 620px;
    border-radius: 14px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    border: 1px solid #e2e8f0;
    animation: cmdPop 0.15s ease-out;
}

@keyframes cmdPop {
    from { opacity: 0; transform: scale(0.96) translateY(-10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.cmd-palette-search {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.cmd-palette-search input {
    border: none;
    background: transparent;
    width: 100%;
    font-size: 1rem;
    color: #1e293b;
    outline: none;
    margin-left: 10px;
}

.cmd-palette-results {
    max-height: 380px;
    overflow-y: auto;
    padding: 8px 0;
}

.cmd-palette-item {
    display: flex;
    align-items: center;
    padding: 10px 18px;
    cursor: pointer;
    transition: background 0.1s ease;
}

.cmd-palette-item:hover, .cmd-palette-item.active {
    background: #f1f5f9;
}

.cmd-palette-item .cmd-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    background: #e2e8f0;
    color: #475569;
    font-size: 0.95rem;
}

/* 3. Executive Dashboard Enhancements */
.kpi-card-enterprise {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kpi-card-enterprise:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(0,0,0,0.08);
}

/* ==========================================================================
   4. Comprehensive Mobile & Tablet Responsive Architecture
   ========================================================================== */

/* Mobile Menu Toggle Button */
.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    color: #1e293b;
    font-size: 1.1rem;
    cursor: pointer;
    margin-right: 6px;
    flex-shrink: 0;
    transition: var(--transition);
}

.mobile-menu-btn:hover, .mobile-menu-btn:active {
    background: #e2e8f0;
    color: var(--primary);
}

/* Sidebar Close Button for Mobile Drawer */
.sidebar-close-mobile {
    display: none;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 6px 10px;
    margin-left: auto;
    transition: var(--transition);
}
.sidebar-close-mobile:hover {
    color: #ffffff;
}

/* Dark Backdrop Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(3px);
    z-index: 9998;
    transition: opacity 0.25s ease;
}

.sidebar-overlay.active {
    display: block;
}

/* Tablet & Mobile Breakpoint (<= 992px) */
@media (max-width: 992px) {
    body {
        position: relative;
        overflow-x: hidden;
        width: 100vw;
    }

    .mobile-menu-btn {
        display: inline-flex;
    }

    .sidebar-close-mobile {
        display: inline-block;
    }

    /* Off-canvas Sliding Sidebar */
    .app-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: 285px;
        max-width: 85vw;
        height: 100vh;
        z-index: 9999;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
    }

    .app-sidebar.show-mobile {
        transform: translateX(0);
        box-shadow: 6px 0 30px rgba(0, 0, 0, 0.45);
    }

    .brand-header {
        padding: 14px 18px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .app-container {
        width: 100vw;
        min-width: 100vw;
        overflow-x: hidden;
    }
}

/* Mobile Phone Breakpoint (<= 768px) */
@media (max-width: 768px) {
    /* Navbar compact styling */
    .top-navbar {
        height: 56px;
        padding: 0 10px;
    }

    .navbar-left {
        gap: 6px;
    }

    .company-badge {
        max-width: 140px;
        padding: 4px 8px;
        font-size: 0.72rem;
    }

    .company-badge select {
        max-width: 105px;
        font-size: 0.72rem;
        text-overflow: ellipsis;
        white-space: nowrap;
        overflow: hidden;
    }

    .zatca-badge-text {
        display: none !important;
    }

    .global-search-trigger {
        display: none !important;
    }

    .navbar-right {
        gap: 6px;
    }

    .user-profile div:last-child {
        display: none !important;
    }

    /* Content viewport */
    .app-content {
        padding: 12px 10px;
        width: 100%;
        overflow-x: hidden;
    }

    /* Cards & Header */
    .page-header-card {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px;
        padding: 12px 14px;
    }

    .page-title {
        font-size: 1.15rem;
    }

    .btn-group-actions {
        flex-wrap: wrap;
        gap: 6px;
        width: 100%;
    }

    .btn-group-actions .btn-action {
        flex: 1 1 calc(50% - 6px);
        justify-content: center;
        padding: 6px 8px;
        font-size: 0.78rem;
    }

    /* Filter cards */
    .filter-card {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px;
        padding: 12px;
    }

    .search-box {
        width: 100% !important;
        min-width: 100% !important;
    }

    .filter-card > div {
        width: 100%;
        flex-wrap: wrap;
        gap: 6px;
    }

    .filter-select {
        flex: 1 1 calc(50% - 4px);
        min-width: 120px;
        font-size: 0.8rem;
    }

    /* Dynamic filter grid responsive collapse */
    div[style*="grid-template-columns"],
    .table-card div[style*="grid-template-columns"],
    form div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    /* Table horizontal touch scroll */
    .table-card {
        padding: 12px 10px !important;
        border-radius: 6px;
    }

    .table-responsive,
    div[style*="overflow-x: auto"] {
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        display: block;
        border-radius: 6px;
    }

    .erp-table,
    table.box-table,
    table.summary-table {
        min-width: 580px;
        font-size: 0.78rem !important;
    }

    .erp-table th,
    .erp-table td {
        padding: 6px 6px !important;
        white-space: nowrap;
    }

    /* Grand totals banners */
    div[id$="GrandTotalsBanner"],
    #prGrandTotalsBanner,
    div[id$="totalsBanner"],
    #prGrandTotalsBanner {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
        padding: 12px !important;
    }

    div[id$="GrandTotalsBanner"] > div,
    #prGrandTotalsBanner > div {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 6px !important;
    }

    /* Pagination */
    .pagination-footer {
        flex-direction: column !important;
        align-items: center !important;
        gap: 10px !important;
        text-align: center;
    }

    .pagination-controls {
        flex-wrap: wrap;
        justify-content: center;
    }

    /* Modals responsive */
    .modal-overlay {
        padding: 10px !important;
        align-items: flex-start !important;
        overflow-y: auto !important;
    }

    .modal-card {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 94vh !important;
        margin: 10px auto !important;
        border-radius: 8px !important;
    }

    .modal-body {
        padding: 12px 10px !important;
    }

    .modal-footer {
        flex-wrap: wrap !important;
        gap: 6px !important;
        padding: 10px 12px !important;
    }

    .modal-footer button {
        flex: 1 1 calc(50% - 4px) !important;
        font-size: 0.78rem !important;
        justify-content: center !important;
        padding: 7px 10px !important;
    }
}

