@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800;900&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Tajawal:wght@400;500;700;800&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css');

/* ==========================================================================
   Print Shop Management System - Modern UI/UX Design System 2026
   ========================================================================== */

:root {
    --font-primary: 'Cairo', 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-numbers: 'Plus Jakarta Sans', 'Cairo', -apple-system, sans-serif;
    --font-mono: 'Plus Jakarta Sans', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    
    /* Modern Color Palette */
    --primary: #0284c7;
    --primary-hover: #0369a1;
    --primary-light: #e0f2fe;
    --primary-dark: #075985;
    
    --success: #10b981;
    --success-light: #d1fae5;
    --success-dark: #047857;
    
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --danger-dark: #b91c1c;
    
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --warning-dark: #b45309;
    
    --slate-bg: #f8fafc;
    --slate-card: #ffffff;
    --slate-border: #e2e8f0;
    --slate-text: #0f172a;
    --slate-muted: #64748b;

    --sidebar-width: 260px;
    --sidebar-collapsed-width: 78px;
    --topbar-height: 64px;
    
    /* Modern Soft Shadows */
    --shadow-subtle: 0 2px 6px rgba(0,0,0,0.03), 0 1px 3px rgba(0,0,0,0.02);
    --shadow-card: 0 10px 32px rgba(15, 23, 42, 0.05), 0 4px 12px rgba(15, 23, 42, 0.03);
    --shadow-hover: 0 18px 44px rgba(15, 23, 42, 0.09), 0 8px 20px rgba(15, 23, 42, 0.04);
    --shadow-glow: 0 0 25px rgba(2, 132, 199, 0.25);
    
    --radius-sm: 0.625rem;
    --radius-md: 0.875rem;
    --radius-lg: 1.125rem;
    --radius-xl: 1.5rem;
    --radius-2xl: 2rem;
    --radius-pill: 9999px;
}

/* ─────────────────────────────────────────────────────────────
   Dark Theme Variables
   ───────────────────────────────────────────────────────────── */
body.dark-theme,
[data-theme="dark"] {
    --slate-bg: #070d1d;
    --slate-card: #0f172a;
    --slate-border: #1e293b;
    --slate-text: #f8fafc;
    --slate-muted: #94a3b8;
    --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.5);
    --shadow-hover: 0 12px 30px -4px rgba(0, 0, 0, 0.7);
}

body.dark-theme .app-topbar {
    background: rgba(15, 23, 42, 0.94);
    border-bottom-color: #1e293b;
}

body.dark-theme .topbar-breadcrumb-parent {
    color: #94a3b8;
}

body.dark-theme .topbar-breadcrumb-current {
    color: #f8fafc;
}

body.dark-theme .topbar-toggle-btn {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

body.dark-theme .topbar-currency-badge {
    background: #27271a;
    border-color: #785a15;
    color: #fde047;
}

body.dark-theme .topbar-wa-badge {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}

body.dark-theme .topbar-wa-badge.status-connected {
    background: #064e3b;
    border-color: #047857;
    color: #6ee7b7;
}

body.dark-theme .topbar-wa-badge.status-disconnected {
    background: #7f1d1d;
    border-color: #991b1b;
    color: #fca5a5;
}

body.dark-theme .topbar-wa-badge.status-warning {
    background: #78350f;
    border-color: #92400e;
    color: #fde047;
}

body.dark-theme .topbar-user-chip {
    background: #0f172a;
    border-color: #1e293b;
}

body.dark-theme .topbar-user-name {
    color: #f8fafc;
}

body.dark-theme .table th {
    background-color: #0b1329;
    color: #94a3b8;
    border-bottom-color: #1e293b;
}

body.dark-theme .table td {
    color: #e2e8f0;
    border-bottom-color: #1a2744;
}

body.dark-theme .table tr:hover td {
    background-color: #162444;
}

body.dark-theme .stat-card {
    background: #0f172a;
    border-color: #1e293b;
}

body.dark-theme .stat-card .value {
    color: #f8fafc;
}

body.dark-theme .card-footer {
    background-color: #0b1329;
    border-top-color: #1e293b;
}

body.dark-theme .form-group label {
    color: #cbd5e1;
}

body.dark-theme .form-group input,
body.dark-theme .form-group select,
body.dark-theme .form-group textarea,
body.dark-theme .input {
    background-color: #070d1d;
    border-color: #1e293b;
    color: #f8fafc;
}

body.dark-theme .btn-secondary {
    background: #1e293b;
    color: #e2e8f0;
    border-color: #334155;
}
body.dark-theme .btn-secondary:hover {
    background: #334155;
    color: #ffffff;
}

/* Theme Toggle Button Style */
.theme-toggle-btn {
    width: 2.35rem;
    height: 2.35rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border: 1px solid var(--slate-border);
    color: #334155;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
}
body.dark-theme .theme-toggle-btn {
    background: #1e293b;
    border-color: #334155;
    color: #fbbf24;
}
.theme-toggle-btn:hover {
    transform: scale(1.08);
}

/* Base Setup */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 15px;
    text-rendering: optimizeLegibility;
    -webkit-text-size-adjust: 100%;
    overflow-x: clip;
}

body {
    font-family: var(--font-primary);
    background-color: var(--slate-bg);
    color: var(--slate-text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: clip;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-primary);
    letter-spacing: -0.015em;
    font-weight: 700;
}

.font-mono,
.font-numbers,
.stat-card-value,
.badge-mono {
    font-family: var(--font-numbers) !important;
    font-feature-settings: 'tnum' on, 'lnum' on;
}

/* ─────────────────────────────────────────────────────────────
   Modern Sidebar (Collapsible & RTL Native)
   ───────────────────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    z-index: 50;
    top: 0;
    bottom: 0;
    right: 0;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #0b1329 0%, #111e38 50%, #0d172e 100%);
    color: #f8fafc;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 30px rgba(0, 0, 0, 0.18);
    transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1), transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.2rem 1.1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    min-height: var(--topbar-height);
}

.sidebar-brand-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    text-decoration: none;
    color: #ffffff;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-brand-icon {
    font-size: 1.75rem;
    flex-shrink: 0;
}

.sidebar-custom-logo {
    max-height: 40px;
    max-width: 48px;
    width: auto;
    height: auto;
    object-fit: contain;
    flex-shrink: 0;
    filter: invert(1) hue-rotate(180deg);
    transition: transform 0.2s ease;
}

.sidebar-brand-link:hover .sidebar-custom-logo {
    transform: scale(1.05);
}

.sidebar-brand-text {
    transition: opacity 0.2s ease, max-width 0.28s ease;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-brand-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: #ffffff;
    display: block;
    line-height: 1.2;
}

.sidebar-brand-badge {
    display: block;
    font-size: 0.7rem;
    color: #38bdf8;
    font-weight: 700;
}

.sidebar-collapse-btn {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: #94a3b8;
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sidebar-collapse-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
    padding: 1rem 0.85rem;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-section-label {
    font-size: 0.68rem;
    font-weight: 800;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.4rem 0.75rem 0.2rem;
    white-space: nowrap;
    transition: opacity 0.2s ease;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.7rem 0.9rem;
    color: #94a3b8;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    white-space: nowrap;
    position: relative;
}

.sidebar-link-icon {
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex-shrink: 0;
}

.sidebar-link-text {
    transition: opacity 0.2s ease;
}

.sidebar-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(-3px);
}

.sidebar-link.active {
    color: #ffffff;
    background: linear-gradient(90deg, #0284c7 0%, #0369a1 100%);
    box-shadow: 0 4px 16px rgba(2, 132, 199, 0.38);
    font-weight: 700;
}

.sidebar-footer {
    padding: 0.85rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.sidebar-portal-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: var(--radius-md);
    color: #34d399;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.84rem;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.sidebar-portal-btn:hover {
    background: rgba(16, 185, 129, 0.22);
    color: #6ee7b7;
}

.sidebar-logout-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    color: #fca5a5;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.84rem;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.sidebar-logout-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #fee2e2;
}

/* ─────────────────────────────────────────────────────────────
   Desktop Collapsed Sidebar Mode
   ───────────────────────────────────────────────────────────── */
body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .sidebar-brand-text,
body.sidebar-collapsed .sidebar-link-text,
body.sidebar-collapsed .sidebar-section-label {
    opacity: 0;
    pointer-events: none;
    display: none;
}

body.sidebar-collapsed .sidebar-collapse-btn i {
    transform: rotate(180deg);
}

body.sidebar-collapsed .sidebar-link,
body.sidebar-collapsed .sidebar-portal-btn,
body.sidebar-collapsed .sidebar-logout-btn {
    justify-content: center;
    padding: 0.75rem 0;
}

body.sidebar-collapsed .sidebar-link:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    right: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: #0f172a;
    color: #ffffff;
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 100;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ─────────────────────────────────────────────────────────────
   Unified App Topbar
   ───────────────────────────────────────────────────────────── */
.app-topbar {
    position: sticky !important;
    top: 0 !important;
    z-index: 1000 !important;
    height: var(--topbar-height) !important;
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border-bottom: 1px solid var(--slate-border) !important;
    margin-right: var(--sidebar-width);
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0 1rem !important;
    gap: 0.75rem !important;
    overflow: hidden !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05) !important;
    transition: margin-right 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

body.sidebar-collapsed .app-topbar {
    margin-right: var(--sidebar-collapsed-width);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-shrink: 0;
    white-space: nowrap;
}

.topbar-toggle-btn {
    background: #f1f5f9;
    border: 1px solid var(--slate-border);
    color: #334155;
    width: 2.35rem;
    height: 2.35rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.topbar-toggle-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
    transform: scale(1.04);
}

.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.92rem;
    font-weight: 700;
}

.topbar-breadcrumb-parent {
    color: var(--slate-muted);
}

.topbar-breadcrumb-sep {
    color: #cbd5e1;
}

.topbar-breadcrumb-current {
    color: #0f172a;
    display: flex;
    align-items: center;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
    white-space: nowrap;
}

.topbar-currency-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    font-weight: 800;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    line-height: 1.2;
}

.topbar-wa-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #64748b;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    line-height: 1.2;
}

.topbar-wa-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.topbar-wa-badge.status-connected {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}

.topbar-wa-badge.status-disconnected {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.topbar-wa-badge.status-warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.topbar-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-md);
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.topbar-action-btn.btn-invoice {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
    color: #ffffff !important;
}
.topbar-action-btn.btn-invoice:hover {
    background: linear-gradient(135deg, #0369a1 0%, #075985 100%) !important;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.4) !important;
}

.topbar-action-btn.btn-payment {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    color: #ffffff !important;
}
.topbar-action-btn.btn-payment:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4) !important;
}

.topbar-action-btn.btn-operation {
    background: linear-gradient(135deg, #9333ea 0%, #7e22ce 100%) !important;
    color: #ffffff !important;
}
.topbar-action-btn.btn-operation:hover {
    background: linear-gradient(135deg, #7e22ce 0%, #6b21a8 100%) !important;
    box-shadow: 0 4px 12px rgba(147, 51, 234, 0.4) !important;
}

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

.topbar-actions-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.topbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.45rem 1rem;
    border-radius: var(--radius-pill);
    font-size: 0.82rem;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.topbar-btn-primary {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff !important;
}
.topbar-btn-primary:hover {
    background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}

.topbar-btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff !important;
}
.topbar-btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.topbar-user-chip {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: #f8fafc;
    border: 1px solid var(--slate-border);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-pill);
}

.topbar-user-avatar {
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 50%;
    background: #e0f2fe;
    color: #0284c7;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.topbar-user-info {
    line-height: 1.1;
}

.topbar-user-name {
    display: block;
    font-size: 0.82rem;
    font-weight: 800;
    color: #0f172a;
}

.topbar-user-status {
    font-size: 0.68rem;
    color: #10b981;
    font-weight: 700;
}

.topbar-user-logout {
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.85rem;
    padding: 0.2rem;
    transition: color 0.2s ease;
}
.topbar-user-logout:hover {
    color: #ef4444;
}

/* ─────────────────────────────────────────────────────────────
   Main Content Layout
   ───────────────────────────────────────────────────────────── */
main,
.app-main,
footer {
    margin-right: var(--sidebar-width);
    transition: margin-right 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

body.no-sidebar main,
body.no-sidebar .app-main,
body.no-sidebar footer,
body.no-sidebar header,
body.no-sidebar .app-topbar {
    margin-right: 0 !important;
}

body.sidebar-collapsed main,
body.sidebar-collapsed .app-main,
body.sidebar-collapsed footer {
    margin-right: var(--sidebar-collapsed-width);
}

.sidebar-placeholder {
    display: contents;
}

/* ─────────────────────────────────────────────────────────────
   Mobile & Tablet Off-Canvas Drawer (<= 992px)
   ───────────────────────────────────────────────────────────── */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 45;
    opacity: 0;
    transition: opacity 0.25s ease;
}

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(100%);
        width: 280px !important;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    body.sidebar-open .sidebar-backdrop {
        display: block;
        opacity: 1;
    }

    .app-topbar,
    main,
    .app-main,
    footer,
    body.sidebar-collapsed .app-topbar,
    body.sidebar-collapsed main,
    body.sidebar-collapsed .app-main,
    body.sidebar-collapsed footer {
        margin-right: 0 !important;
    }

    .topbar-actions-group {
        display: none;
    }

    .sidebar-collapse-btn {
        display: none;
    }

    body.sidebar-collapsed .sidebar-brand-text,
    body.sidebar-collapsed .sidebar-link-text,
    body.sidebar-collapsed .sidebar-section-label {
        opacity: 1 !important;
        pointer-events: auto !important;
        display: block !important;
    }

    body.sidebar-collapsed .sidebar-link {
        justify-content: flex-start !important;
        padding: 0.7rem 0.9rem !important;
    }
}

@media (max-width: 576px) {
    .topbar-currency-badge {
        display: none;
    }
    .topbar-breadcrumb-parent,
    .topbar-breadcrumb-sep {
        display: none;
    }
    .app-topbar {
        padding: 0 1rem;
    }
}

/* ─────────────────────────────────────────────────────────────
   Container & Cards
   ───────────────────────────────────────────────────────────── */
.container-max {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.narrow-container {
    max-width: 860px;
}

.card {
    background: var(--slate-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--slate-border);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    transition: box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--slate-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    padding: 1.5rem;
}

@media (min-width: 768px) {
    .card-body {
        padding: 2rem;
    }
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--slate-border);
    background-color: #f8fafc;
}

/* ─────────────────────────────────────────────────────────────
   Unified Modern Stat Cards & Boxes (2026 UI Architecture)
   ───────────────────────────────────────────────────────────── */
.stats-grid-responsive {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

@media (min-width: 540px) {
    .stats-grid-responsive {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 992px) {
    .stats-grid-responsive {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 992px) and (max-width: 1280px) {
    body:not(.sidebar-collapsed) .stats-grid-responsive {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (min-width: 1280px) and (max-width: 1536px) {
    body:not(.sidebar-collapsed) .xl\:grid-cols-6 {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

/* منع ظهور أي نقاط اختصار أو قص للأرقام والعملات في كافة بطاقات الإحصائيات */
.stat-card-pro .stat-card-value,
.stat-card-value {
    white-space: normal !important;
    word-break: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
}

.stat-card-pro .stat-card-label {
    white-space: normal !important;
    word-break: break-word !important;
    overflow: visible !important;
    text-overflow: clip !important;
}

.stats-grid-4 {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
    transition: all 0.35s ease;
}

@media (min-width: 540px) {
    .stats-grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* توزيع ذكي للكروت عند فتح القائمة الجانبية في الشاشات العادية/المحمولة لضمان عدم انضغاط الأرقام */
@media (min-width: 992px) and (max-width: 1400px) {
    body:not(.sidebar-collapsed) .stats-grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 1.15rem !important;
    }
}

@media (min-width: 992px) {
    body.sidebar-collapsed .stats-grid-4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (min-width: 1400px) {
    .stats-grid-4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* Base Card Pro */
.stat-card-pro {
    background: var(--slate-card);
    border-radius: 1.25rem;
    border: 1px solid var(--slate-border);
    box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.04), 0 2px 6px -1px rgba(15, 23, 42, 0.02);
    padding: 1.15rem 1.25rem;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 120px;
    height: 100%;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), 
                box-shadow 0.35s ease, 
                border-color 0.35s ease,
                padding 0.3s ease;
    animation: statCardFadeIn 0.5s ease-out both;
}

.stat-card-pro:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 32px -4px rgba(15, 23, 42, 0.1), 0 4px 12px -2px rgba(15, 23, 42, 0.05);
}

/* Subtle top gradient bar */
.stat-card-pro::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 4px;
    background: var(--stat-accent, #0284c7);
    border-radius: 1.25rem 1.25rem 0 0;
    opacity: 0.9;
}

/* Background watermark icon */
.stat-card-pro .stat-watermark {
    position: absolute;
    left: -0.75rem;
    bottom: -0.75rem;
    font-size: 5rem;
    opacity: 0.04;
    color: var(--stat-accent, currentColor);
    pointer-events: none;
    transition: transform 0.5s ease, opacity 0.5s ease;
}

.stat-card-pro:hover .stat-watermark {
    transform: scale(1.15) rotate(-8deg);
    opacity: 0.08;
}

/* Icon bubble */
.stat-icon-bubble {
    width: 2.85rem;
    height: 2.85rem;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    background: var(--stat-bg, #e0f2fe);
    color: var(--stat-color, #0284c7);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), width 0.3s ease, height 0.3s ease;
}

.stat-card-pro:hover .stat-icon-bubble {
    transform: scale(1.12) rotate(6deg);
}

/* Head row inside card */
.stat-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    position: relative;
    z-index: 1;
}

.stat-card-info {
    flex: 1;
    min-width: 0;
}

.stat-card-label {
    font-size: 0.78rem;
    font-weight: 800;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-bottom: 0.25rem;
    display: block;
    white-space: normal;
    word-break: break-word;
    line-height: 1.35;
    overflow: visible;
}

.stat-card-value {
    font-size: clamp(1.1rem, 1.55vw, 1.55rem);
    font-weight: 900;
    letter-spacing: -0.02em;
    line-height: 1.25;
    margin: 0.25rem 0;
    color: var(--stat-val-color, #0f172a);
    white-space: normal;
    word-break: break-word;
    overflow: visible;
    display: block;
}

/* التجاوب السلس عند فتح القائمة الجانبية */
body:not(.sidebar-collapsed) .stat-card-pro {
    padding: 1rem 1.15rem;
}
body:not(.sidebar-collapsed) .stat-icon-bubble {
    width: 2.45rem;
    height: 2.45rem;
    border-radius: 0.85rem;
    font-size: 1.05rem;
}
body:not(.sidebar-collapsed) .stat-card-value {
    font-size: clamp(1rem, 1.4vw, 1.45rem);
}

.stat-card-sub {
    font-size: 0.75rem;
    font-weight: 600;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.35rem;
    white-space: nowrap;
}

/* Color theme presets */
.stat-theme-blue {
    --stat-accent: linear-gradient(90deg, #0284c7 0%, #38bdf8 100%);
    --stat-bg: #e0f2fe;
    --stat-color: #0284c7;
    --stat-val-color: #0f172a;
}
.stat-theme-red {
    --stat-accent: linear-gradient(90deg, #ef4444 0%, #f87171 100%);
    --stat-bg: #fee2e2;
    --stat-color: #ef4444;
    --stat-val-color: #dc2626;
}
.stat-theme-amber {
    --stat-accent: linear-gradient(90deg, #f59e0b 0%, #fbbf24 100%);
    --stat-bg: #fef3c7;
    --stat-color: #d97706;
    --stat-val-color: #b45309;
}
.stat-theme-purple {
    --stat-accent: linear-gradient(90deg, #8b5cf6 0%, #a78bfa 100%);
    --stat-bg: #ede9fe;
    --stat-color: #7c3aed;
    --stat-val-color: #6d28d9;
}
.stat-theme-emerald {
    --stat-accent: linear-gradient(90deg, #10b981 0%, #34d399 100%);
    --stat-bg: #d1fae5;
    --stat-color: #059669;
    --stat-val-color: #047857;
}
.stat-theme-slate {
    --stat-accent: linear-gradient(90deg, #334155 0%, #64748b 100%);
    --stat-bg: #f1f5f9;
    --stat-color: #334155;
    --stat-val-color: #1e293b;
}

/* Dark mode stat card overrides */
body.dark-theme .stat-card-pro {
    background: #0f172a;
    border-color: #1e293b;
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.4);
}
body.dark-theme .stat-theme-blue { --stat-bg: rgba(2, 132, 199, 0.18); --stat-val-color: #f8fafc; }
body.dark-theme .stat-theme-red { --stat-bg: rgba(239, 68, 68, 0.18); --stat-val-color: #f87171; }
body.dark-theme .stat-theme-amber { --stat-bg: rgba(245, 158, 11, 0.18); --stat-val-color: #fbbf24; }
body.dark-theme .stat-theme-purple { --stat-bg: rgba(139, 92, 246, 0.18); --stat-val-color: #c084fc; }
body.dark-theme .stat-theme-emerald { --stat-bg: rgba(16, 185, 129, 0.18); --stat-val-color: #34d399; }
body.dark-theme .stat-theme-slate { --stat-bg: rgba(71, 85, 105, 0.25); --stat-val-color: #cbd5e1; }

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

/* Staggered Entrance Animations */
.stats-grid-responsive > :nth-child(1), .stats-grid-4 > :nth-child(1) { animation-delay: 0.04s; }
.stats-grid-responsive > :nth-child(2), .stats-grid-4 > :nth-child(2) { animation-delay: 0.08s; }
.stats-grid-responsive > :nth-child(3), .stats-grid-4 > :nth-child(3) { animation-delay: 0.12s; }
.stats-grid-responsive > :nth-child(4), .stats-grid-4 > :nth-child(4) { animation-delay: 0.16s; }
.stats-grid-responsive > :nth-child(5) { animation-delay: 0.20s; }
.stats-grid-responsive > :nth-child(6) { animation-delay: 0.24s; }

/* Enhanced theme hover glows */
.stat-theme-blue:hover {
    border-color: #7dd3fc;
    box-shadow: 0 16px 32px -4px rgba(2, 132, 199, 0.15), 0 4px 12px rgba(2, 132, 199, 0.08);
}
.stat-theme-red:hover {
    border-color: #fca5a5;
    box-shadow: 0 16px 32px -4px rgba(239, 68, 68, 0.15), 0 4px 12px rgba(239, 68, 68, 0.08);
}
.stat-theme-amber:hover {
    border-color: #fcd34d;
    box-shadow: 0 16px 32px -4px rgba(245, 158, 11, 0.15), 0 4px 12px rgba(245, 158, 11, 0.08);
}
.stat-theme-purple:hover {
    border-color: #c4b5fd;
    box-shadow: 0 16px 32px -4px rgba(139, 92, 246, 0.15), 0 4px 12px rgba(139, 92, 246, 0.08);
}
.stat-theme-emerald:hover {
    border-color: #6ee7b7;
    box-shadow: 0 16px 32px -4px rgba(16, 185, 129, 0.15), 0 4px 12px rgba(16, 185, 129, 0.08);
}
.stat-theme-slate:hover {
    border-color: #cbd5e1;
    box-shadow: 0 16px 32px -4px rgba(71, 85, 105, 0.15), 0 4px 12px rgba(71, 85, 105, 0.08);
}

@media (max-width: 640px) {
    .stat-card-pro {
        padding: 1rem 1.15rem;
        min-height: 110px;
    }
    .stat-icon-bubble {
        width: 2.65rem;
        height: 2.65rem;
        font-size: 1.1rem;
    }
    .stat-card-value {
        font-size: 1.35rem;
    }
}


/* ─────────────────────────────────────────────────────────────
   Buttons
   ───────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.55rem 1.1rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-subtle);
}

.btn:active {
    transform: scale(0.98);
}

/* ─────────────────────────────────────────────────────────────
   Solid High-Contrast Button Variants (Guaranteed styling)
   ───────────────────────────────────────────────────────────── */
.btn-primary {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
    color: #ffffff !important;
    border: 1px solid #0284c7 !important;
}
.btn-primary:hover {
    background: linear-gradient(135deg, #0369a1 0%, #075985 100%) !important;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4) !important;
    color: #ffffff !important;
}

.btn-success, .btn-emerald, .btn-whatsapp {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    color: #ffffff !important;
    border: 1px solid #059669 !important;
}
.btn-success:hover, .btn-emerald:hover, .btn-whatsapp:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4) !important;
    color: #ffffff !important;
}

.btn-danger, .btn-rose, .btn-pdf {
    background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%) !important;
    color: #ffffff !important;
    border: 1px solid #e11d48 !important;
}
.btn-danger:hover, .btn-rose:hover, .btn-pdf:hover {
    background: linear-gradient(135deg, #e11d48 0%, #be123c 100%) !important;
    box-shadow: 0 4px 14px rgba(225, 29, 72, 0.4) !important;
    color: #ffffff !important;
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    color: #ffffff !important;
    border: 1px solid #d97706 !important;
}
.btn-warning:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%) !important;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4) !important;
    color: #ffffff !important;
}

.btn-thermal, .btn-dark, .btn-slate {
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%) !important;
    color: #ffffff !important;
    border: 1px solid #1e293b !important;
}
.btn-thermal:hover, .btn-dark:hover, .btn-slate:hover {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
    box-shadow: 0 4px 14px rgba(30, 41, 59, 0.4) !important;
    color: #ffffff !important;
}

.btn-purple {
    background: linear-gradient(135deg, #9333ea 0%, #7e22ce 100%) !important;
    color: #ffffff !important;
    border: 1px solid #7e22ce !important;
}
.btn-purple:hover {
    background: linear-gradient(135deg, #7e22ce 0%, #6b21a8 100%) !important;
    box-shadow: 0 4px 14px rgba(147, 51, 234, 0.4) !important;
    color: #ffffff !important;
}

.btn-secondary, .btn-account {
    background: #f1f5f9 !important;
    color: #1e293b !important;
    border: 1.5px solid #cbd5e1 !important;
    font-weight: 700;
}
.btn-secondary:hover, .btn-account:hover {
    background: #e2e8f0 !important;
    color: #0f172a !important;
    border-color: #94a3b8 !important;
}
body.dark-theme .btn-secondary,
body.dark-theme .btn-account {
    background: #1e293b !important;
    color: #f8fafc !important;
    border-color: #475569 !important;
}
body.dark-theme .btn-secondary:hover,
body.dark-theme .btn-account:hover {
    background: #334155 !important;
    color: #ffffff !important;
}

.btn-light {
    background: #f8fafc !important;
    color: #0f172a !important;
    border: 1.5px solid #cbd5e1 !important;
}
.btn-light:hover {
    background: #e2e8f0 !important;
    color: #0284c7 !important;
}

.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-xs {
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 0.85rem 1.75rem;
    font-size: 1rem;
    border-radius: var(--radius-lg);
}

.btn-block {
    width: 100%;
}

/* ─────────────────────────────────────────────────────────────
   Modern Product Card & WhatsApp Order Showcase
   ───────────────────────────────────────────────────────────── */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
}

.product-card {
    background: var(--slate-card);
    border: 1px solid var(--slate-border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 32px -8px rgba(15, 23, 42, 0.12);
    border-color: var(--primary);
}

.product-image-box {
    position: relative;
    width: 100%;
    height: 180px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
body.dark-theme .product-image-box {
    background: #070d1d;
}
.product-image-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.product-card:hover .product-image-box img {
    transform: scale(1.06);
}

.product-info-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    justify-content: space-between;
}

.btn-wa-order {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff !important;
    border-radius: var(--radius-md);
    padding: 0.65rem 1rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
    transition: all 0.2s ease;
    text-decoration: none;
    width: 100%;
}
.btn-wa-order:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.4);
    transform: translateY(-2px);
}

/* ─────────────────────────────────────────────────────────────
   Badges
   ───────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    font-weight: 700;
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info    { background: #e0f2fe; color: #075985; }
.badge-secondary { background: #f1f5f9; color: #475569; }

/* ─────────────────────────────────────────────────────────────
   Forms & Inputs
   ───────────────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.45rem;
    font-size: 0.875rem;
    font-weight: 700;
    color: #334155;
}

.form-group input,
.form-group select,
.form-group textarea,
.input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--slate-border);
    border-radius: var(--radius-md);
    background-color: #ffffff;
    color: #0f172a;
    font-family: inherit;
    font-size: 0.92rem;
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3.5px rgba(2, 132, 199, 0.15);
    background-color: #ffffff;
}

/* ─────────────────────────────────────────────────────────────
   Tables
   ───────────────────────────────────────────────────────────── */
.table-container {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-md);
}

.table {
    width: 100%;
    text-align: right;
    border-collapse: collapse;
}

.table th {
    background-color: #f8fafc;
    color: #475569;
    font-weight: 800;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.95rem 1.1rem;
    border-bottom: 1.5px solid var(--slate-border);
}

.table td {
    padding: 1rem 1.1rem;
    color: #1e293b;
    font-size: 0.88rem;
    border-bottom: 1px solid #f1f5f9;
}

.table tr:last-child td {
    border-bottom: none;
}

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

/* ─────────────────────────────────────────────────────────────
   Alerts
   ───────────────────────────────────────────────────────────── */
.alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    border-right: 4px solid;
}

.alert-success {
    background-color: #f0fdf4;
    border-color: #22c55e;
    color: #15803d;
}

.alert-danger {
    background-color: #fef2f2;
    border-color: #ef4444;
    color: #b91c1c;
}

.alert-warning {
    background-color: #fffbeb;
    border-color: #f59e0b;
    color: #b45309;
}

.alert-info {
    background-color: #f0f9ff;
    border-color: #0284c7;
    color: #0369a1;
}

/* ─────────────────────────────────────────────────────────────
   KPI Statistics Cards
   ───────────────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: #ffffff;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--slate-border);
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.stat-card h3 {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--slate-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.4rem;
}

.stat-card .value {
    font-size: 1.85rem;
    font-weight: 900;
    color: #0f172a;
    font-family: var(--font-primary);
}

.stat-card .subtitle {
    font-size: 0.78rem;
    color: var(--slate-muted);
    margin-top: 0.35rem;
}

/* ─────────────────────────────────────────────────────────────
   Tom-Select, Flatpickr & SweetAlert2 Modern Styling (RTL & Dark Mode)
   ───────────────────────────────────────────────────────────── */
.ts-wrapper {
    width: 100%;
}
.ts-control {
    border-radius: var(--radius-md) !important;
    border: 1.5px solid var(--slate-border) !important;
    padding: 0.65rem 0.9rem !important;
    font-family: var(--font-primary) !important;
    font-size: 0.95rem !important;
    background-color: var(--slate-card) !important;
    color: var(--slate-text) !important;
    box-shadow: var(--shadow-subtle) !important;
    transition: all 0.2s ease !important;
}
.ts-control:focus, .ts-wrapper.focus .ts-control {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15) !important;
}
.ts-dropdown {
    border-radius: var(--radius-md) !important;
    border: 1px solid var(--slate-border) !important;
    box-shadow: var(--shadow-hover) !important;
    background: var(--slate-card) !important;
    color: var(--slate-text) !important;
    z-index: 1000 !important;
    font-family: var(--font-primary) !important;
}
.ts-dropdown .option {
    padding: 0.6rem 0.9rem !important;
    font-size: 0.9rem !important;
    border-bottom: 1px solid var(--slate-border) !important;
}
.ts-dropdown .option:last-child {
    border-bottom: none !important;
}
.ts-dropdown .active {
    background-color: var(--primary-light) !important;
    color: var(--primary-dark) !important;
}
body.dark-theme .ts-dropdown .active {
    background-color: #1e3a8a !important;
    color: #93c5fd !important;
}
body.dark-theme .ts-dropdown .option {
    border-bottom-color: #1e293b !important;
}
body.dark-theme .ts-control {
    background-color: #070d1d !important;
    border-color: #1e293b !important;
    color: #f8fafc !important;
}

/* Flatpickr RTL & Dark Mode */
.flatpickr-calendar {
    font-family: var(--font-primary) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-hover) !important;
    border: 1px solid var(--slate-border) !important;
}
body.dark-theme .flatpickr-calendar {
    background: #0f172a !important;
    border-color: #1e293b !important;
    color: #f8fafc !important;
}
body.dark-theme .flatpickr-day {
    color: #e2e8f0 !important;
}
body.dark-theme .flatpickr-day.today {
    border-color: var(--primary) !important;
}
body.dark-theme .flatpickr-day.selected {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #ffffff !important;
}
body.dark-theme .flatpickr-months .flatpickr-month,
body.dark-theme .flatpickr-current-month .flatpickr-monthDropdown-months,
body.dark-theme span.flatpickr-weekday {
    background: #0f172a !important;
    color: #f8fafc !important;
}

/* SweetAlert2 RTL Theme Overrides */
.swal2-popup {
    font-family: var(--font-primary) !important;
    border-radius: var(--radius-xl) !important;
}
body.dark-theme .swal2-popup {
    background: #0f172a !important;
    color: #f8fafc !important;
    border: 1px solid #1e293b !important;
}
body.dark-theme .swal2-title {
    color: #f8fafc !important;
}
body.dark-theme .swal2-html-container {
    color: #94a3b8 !important;
}

/* Chart Canvas Card */
.chart-container-card {
    position: relative;
    width: 100%;
    min-height: 280px;
}

/* Print Overrides */
@media print {
    .sidebar, .app-topbar, .sidebar-backdrop, .no-print {
        display: none !important;
    }
    main,
    .app-main,
    footer {
        margin: 0 !important;
        padding: 0 !important;
    }
    body {
        background: #ffffff !important;
        font-size: 12pt;
    }
    .card {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
}

/* ─────────────────────────────────────────────────────────────
   Tabulator Modern Rounded Styling & Seamless Integration
   ───────────────────────────────────────────────────────────── */
.tabulator {
    border: none !important;
    background-color: transparent !important;
    font-family: var(--font-primary) !important;
    font-size: 0.9rem !important;
}

.tabulator .tabulator-header {
    background-color: #f8fafc !important;
    border-bottom: 1.5px solid var(--slate-border) !important;
    color: #475569 !important;
    font-weight: 800 !important;
    border-top: none !important;
}

body.dark-theme .tabulator .tabulator-header {
    background-color: #0b1329 !important;
    border-bottom-color: #1e293b !important;
    color: #94a3b8 !important;
}

.tabulator .tabulator-header .tabulator-col {
    background-color: transparent !important;
    border-right: none !important;
    padding: 0.85rem 0.75rem !important;
}

.tabulator .tabulator-row {
    background-color: #ffffff !important;
    border-bottom: 1px solid #f1f5f9 !important;
    transition: background-color 0.15s ease !important;
}

.tabulator .tabulator-row:hover {
    background-color: #f8fafc !important;
}

body.dark-theme .tabulator .tabulator-row {
    background-color: #0f172a !important;
    border-bottom-color: #1a2744 !important;
    color: #e2e8f0 !important;
}

body.dark-theme .tabulator .tabulator-row:hover {
    background-color: #162444 !important;
}

.tabulator .tabulator-row .tabulator-cell {
    border-right: none !important;
    padding: 0.85rem 0.75rem !important;
    vertical-align: middle !important;
}

.tabulator .tabulator-footer {
    background-color: #f8fafc !important;
    border-top: 1px solid var(--slate-border) !important;
    padding: 0.75rem 1rem !important;
    color: #64748b !important;
}

body.dark-theme .tabulator .tabulator-footer {
    background-color: #0b1329 !important;
    border-top-color: #1e293b !important;
    color: #94a3b8 !important;
}

.tabulator-page {
    border-radius: var(--radius-sm) !important;
    border: 1px solid var(--slate-border) !important;
    padding: 0.35rem 0.75rem !important;
    font-weight: 700 !important;
    font-size: 0.8rem !important;
    margin: 0 0.15rem !important;
    transition: all 0.15s ease !important;
}

.tabulator-page.active {
    background-color: var(--primary) !important;
    color: #ffffff !important;
    border-color: var(--primary) !important;
}

.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title {
    white-space: nowrap !important;
    text-overflow: clip !important;
    font-size: 0.82rem !important;
}

body.dark-theme .tabulator .bg-amber-50 {
    background-color: rgba(120, 53, 15, 0.3) !important;
    color: #fde68a !important;
    border-color: #78350f !important;
}

body.dark-theme .tabulator .bg-sky-50 {
    background-color: rgba(3, 105, 161, 0.3) !important;
    color: #7dd3fc !important;
    border-color: #0369a1 !important;
}

/* ─────────────────────────────────────────────────────────────
   Premium Action Buttons (Edit, Delete, View)
   ───────────────────────────────────────────────────────────── */
.action-btn-group {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: 2.35rem;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.action-btn:hover {
    transform: translateY(-2px) scale(1.08);
}

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

.action-btn-edit {
    background: #eff6ff;
    color: #2563eb;
    border-color: #bfdbfe;
}
.action-btn-edit:hover {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.action-btn-delete {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}
.action-btn-delete:hover {
    background: #dc2626;
    color: #ffffff;
    border-color: #dc2626;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.35);
}

.action-btn-view {
    background: #f0fdf4;
    color: #16a34a;
    border-color: #bbf7d0;
}
.action-btn-view:hover {
    background: #16a34a;
    color: #ffffff;
    border-color: #16a34a;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.35);
}

body.dark-theme .action-btn-edit {
    background: rgba(37, 99, 235, 0.15);
    color: #93c5fd;
    border-color: rgba(37, 99, 235, 0.3);
}
body.dark-theme .action-btn-edit:hover {
    background: #2563eb;
    color: #ffffff;
}

body.dark-theme .action-btn-delete {
    background: rgba(220, 38, 38, 0.15);
    color: #fca5a5;
    border-color: rgba(220, 38, 38, 0.3);
}
body.dark-theme .action-btn-delete:hover {
    background: #dc2626;
    color: #ffffff;
}

body.dark-theme .action-btn-view {
    background: rgba(22, 163, 74, 0.15);
    color: #86efac;
    border-color: rgba(22, 163, 74, 0.3);
}
body.dark-theme .action-btn-view:hover {
    background: #16a34a;
    color: #ffffff;
}

/* ==========================================================================
   Customer Portal Dedicated Design System 2026 (Ultra-Modern, RTL Native)
   ========================================================================== */

/* ─── 1. Hero Welcome Banner ─── */
.portal-hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #1e1b4b 100%) !important;
    color: #ffffff !important;
    border-radius: var(--radius-2xl);
    padding: 1.75rem 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 16px 36px -8px rgba(15, 23, 42, 0.35);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.portal-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -20%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.15) 0%, transparent 70%);
    pointer-events: none;
}

.portal-hero-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    position: relative;
    z-index: 2;
}

.portal-user-meta {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.portal-user-avatar {
    width: 3.85rem;
    height: 3.85rem;
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, rgba(2, 132, 199, 0.4) 0%, rgba(99, 102, 241, 0.4) 100%);
    border: 1.5px solid rgba(56, 189, 248, 0.35);
    color: #38bdf8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    flex-shrink: 0;
    box-shadow: inset 0 2px 8px rgba(255, 255, 255, 0.15);
}

.portal-welcome-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #38bdf8;
    margin-bottom: 0.35rem;
}

.portal-status-dot {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.4);
    padding: 0.15rem 0.6rem;
    border-radius: var(--radius-pill);
    font-size: 0.7rem;
    font-weight: 700;
}

.portal-hero-title {
    font-size: 1.65rem;
    font-weight: 900;
    color: #ffffff !important;
    line-height: 1.2;
    margin: 0;
}

.portal-hero-subtitle {
    font-size: 0.88rem;
    color: #94a3b8 !important;
    margin-top: 0.25rem;
}

.portal-hero-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* ─── 2. Financial Stats Grid ─── */
.portal-stats-grid {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

@media (min-width: 640px) {
    .portal-stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .portal-stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.portal-stat-card {
    background: var(--slate-card);
    border: 1px solid var(--slate-border);
    border-radius: 1.25rem;
    padding: 1.5rem;
    box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.04);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.35s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 140px;
    height: 100%;
}

.portal-stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 32px -4px rgba(15, 23, 42, 0.1);
}

.portal-stat-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.85rem;
}

.portal-stat-label {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--slate-muted);
    text-transform: uppercase;
}

.portal-stat-icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.portal-stat-value {
    font-size: 1.85rem;
    font-weight: 900;
    font-family: var(--font-primary), monospace;
    line-height: 1.2;
    margin-bottom: 0.6rem;
}

.portal-stat-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-pill);
    font-size: 0.76rem;
    font-weight: 800;
}

/* Specific Stat Card Colors */
.stat-debt-danger .portal-stat-icon {
    background: #fee2e2;
    color: #dc2626;
}
.stat-debt-danger .portal-stat-value {
    color: #dc2626;
}
.stat-debt-danger .portal-stat-tag {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.stat-debt-success .portal-stat-icon {
    background: #d1fae5;
    color: #059669;
}
.stat-debt-success .portal-stat-value {
    color: #059669;
}
.stat-debt-success .portal-stat-tag {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.stat-paid .portal-stat-icon {
    background: #dcfce7;
    color: #16a34a;
}
.stat-paid .portal-stat-value {
    color: #16a34a;
}
.stat-paid-sub {
    font-size: 0.8rem;
    color: var(--slate-muted);
}

.stat-invoices .portal-stat-icon {
    background: #ede9fe;
    color: #7c3aed;
}
.stat-invoices .portal-stat-value {
    color: #7c3aed;
}

/* Dark mode stat overrides */
body.dark-theme .stat-debt-danger .portal-stat-icon {
    background: rgba(220, 38, 38, 0.2);
    color: #f87171;
}
body.dark-theme .stat-debt-success .portal-stat-icon {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}
body.dark-theme .stat-paid .portal-stat-icon {
    background: rgba(22, 163, 74, 0.2);
    color: #4ade80;
}
body.dark-theme .stat-invoices .portal-stat-icon {
    background: rgba(124, 58, 237, 0.2);
    color: #a78bfa;
}

/* ─── 3. Progress Percentage Bar ─── */
.portal-progress-card {
    background: var(--slate-card);
    border: 1px solid var(--slate-border);
    border-radius: var(--radius-xl);
    padding: 1.35rem 1.75rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-card);
}

.portal-progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.portal-progress-track {
    width: 100%;
    height: 0.85rem;
    background: #e2e8f0;
    border-radius: var(--radius-pill);
    overflow: hidden;
    padding: 2px;
}
body.dark-theme .portal-progress-track {
    background: #1e293b;
}

.portal-progress-fill {
    height: 100%;
    border-radius: var(--radius-pill);
    background: linear-gradient(90deg, #0284c7 0%, #38bdf8 100%);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.portal-progress-fill.completed {
    background: linear-gradient(90deg, #10b981 0%, #34d399 100%);
}

.portal-progress-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 0.65rem;
    font-size: 0.82rem;
    color: var(--slate-muted);
}

/* ─── 4. Catalog Highlight Banner ─── */
.portal-catalog-banner {
    background: linear-gradient(135deg, #0284c7 0%, #4338ca 100%) !important;
    border-radius: var(--radius-2xl);
    padding: 1.5rem 2rem;
    color: #ffffff !important;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 2.25rem;
    box-shadow: 0 12px 28px -6px rgba(2, 132, 199, 0.35);
}

.portal-catalog-left {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.portal-catalog-icon {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: var(--radius-xl);
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    backdrop-filter: blur(8px);
}

.portal-catalog-title {
    font-size: 1.35rem;
    font-weight: 900;
    color: #ffffff !important;
    margin: 0;
}

.portal-catalog-desc {
    font-size: 0.88rem;
    color: #e0f2fe !important;
    margin-top: 0.25rem;
}

.portal-catalog-btn {
    background: #ffffff !important;
    color: #0369a1 !important;
    font-weight: 900;
    font-size: 0.92rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-pill);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.portal-catalog-btn:hover {
    background: #f0f9ff !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

/* ─── 5. Pending Weekly Withdrawals (مسحوبات الأسبوع الحالي) ─── */
.portal-pending-card {
    background: var(--slate-card);
    border: 1.5px solid #fde68a !important;
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-card);
    margin-bottom: 2.25rem;
    overflow: hidden;
}
body.dark-theme .portal-pending-card {
    border-color: #854d0e !important;
}

.portal-pending-header {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-bottom: 1.5px solid #fde68a;
    padding: 1.25rem 1.75rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
body.dark-theme .portal-pending-header {
    background: linear-gradient(135deg, #1c1917 0%, #292524 100%);
    border-bottom-color: #78350f;
}

.portal-pending-header-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.portal-pending-header-icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: var(--radius-lg);
    background: #d97706;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(217, 119, 6, 0.3);
}

.portal-pending-main-title {
    font-size: 1.15rem;
    font-weight: 900;
    color: #78350f;
    margin: 0;
}
body.dark-theme .portal-pending-main-title {
    color: #fde68a;
}

.portal-pending-sub {
    font-size: 0.8rem;
    color: #92400e;
    margin-top: 0.15rem;
}
body.dark-theme .portal-pending-sub {
    color: #d97706;
}

.portal-pending-badge-total {
    background: #fffbeb;
    border: 1.5px solid #f59e0b;
    color: #b45309;
    padding: 0.45rem 1.1rem;
    border-radius: var(--radius-pill);
    font-size: 0.84rem;
    font-weight: 800;
}
body.dark-theme .portal-pending-badge-total {
    background: #1c1917;
    border-color: #d97706;
    color: #fde68a;
}

.portal-pending-body {
    padding: 1.5rem 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.portal-product-group {
    background: #ffffff;
    border: 1px solid var(--slate-border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-subtle);
}
body.dark-theme .portal-product-group {
    background: #0b1329;
    border-color: #1e293b;
}

.portal-product-group-head {
    background: #f8fafc;
    border-bottom: 1px solid var(--slate-border);
    padding: 0.85rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}
body.dark-theme .portal-product-group-head {
    background: #070d1d;
    border-bottom-color: #1e293b;
}

.portal-prod-title-wrap {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--slate-text);
}

.portal-prod-sku {
    font-family: var(--font-mono, monospace);
    font-size: 0.75rem;
    color: var(--slate-muted);
    background: #e2e8f0;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
}
body.dark-theme .portal-prod-sku {
    background: #1e293b;
    color: #94a3b8;
}

.portal-prod-total-pill {
    background: #fef3c7;
    border: 1px solid #fde68a;
    color: #92400e;
    font-size: 0.8rem;
    font-weight: 800;
    padding: 0.25rem 0.85rem;
    border-radius: var(--radius-pill);
}
body.dark-theme .portal-prod-total-pill {
    background: #27271a;
    border-color: #785a15;
    color: #fde047;
}

.portal-days-grid {
    padding: 1rem 1.25rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.85rem;
}

.portal-day-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg);
    padding: 0.85rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
}
.portal-day-item:hover {
    border-color: #cbd5e1;
    background: #f1f5f9;
}
body.dark-theme .portal-day-item {
    background: #070d1d;
    border-color: #1e293b;
}
body.dark-theme .portal-day-item:hover {
    background: #0f172a;
    border-color: #334155;
}

.portal-day-info {
    line-height: 1.3;
}

.portal-day-date {
    font-size: 0.84rem;
    font-weight: 800;
    color: var(--slate-text);
    display: block;
}

.portal-day-note {
    font-size: 0.74rem;
    color: var(--slate-muted);
}

.portal-day-qty {
    font-family: var(--font-primary), monospace;
    font-size: 0.95rem;
    font-weight: 900;
    color: #0369a1;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-md);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
body.dark-theme .portal-day-qty {
    background: #1e293b;
    border-color: #334155;
    color: #38bdf8;
}

.portal-info-notice {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--radius-xl);
    padding: 1rem 1.35rem;
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    color: #78350f;
    font-size: 0.86rem;
    line-height: 1.5;
}
body.dark-theme .portal-info-notice {
    background: #1c1917;
    border-color: #78350f;
    color: #fde68a;
}
.portal-info-notice i {
    font-size: 1.35rem;
    color: #d97706;
    margin-top: 0.15rem;
    flex-shrink: 0;
}

/* ─── 6. Invoices Accordion Section ─── */
.portal-invoices-card {
    background: var(--slate-card);
    border: 1px solid var(--slate-border);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-card);
    margin-bottom: 2.25rem;
    overflow: hidden;
}

.portal-invoices-header {
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid var(--slate-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.invoice-row-btn {
    width: 100%;
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--slate-border);
    cursor: pointer;
    text-align: right;
    transition: background-color 0.15s ease;
    font-family: inherit;
}
.invoice-row-btn:hover {
    background-color: #f8fafc;
}
body.dark-theme .invoice-row-btn:hover {
    background-color: #0b1329;
}

.invoice-main-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 240px;
}

.invoice-icon-badge {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: var(--radius-lg);
    background: #f0f9ff;
    color: #0284c7;
    border: 1px solid #bae6fd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}
body.dark-theme .invoice-icon-badge {
    background: rgba(2, 132, 199, 0.15);
    border-color: rgba(2, 132, 199, 0.3);
    color: #38bdf8;
}

.invoice-no-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: #0284c7;
}

.invoice-period-text {
    font-size: 0.78rem;
    color: var(--slate-muted);
    margin-top: 0.2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.invoice-price-block {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.invoice-price-val {
    font-size: 1.35rem;
    font-weight: 900;
    color: var(--slate-text);
    font-family: var(--font-primary), monospace;
}

.invoice-chevron {
    width: 2.15rem;
    height: 2.15rem;
    border-radius: var(--radius-pill);
    background: #f1f5f9;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: transform 0.25s ease;
}
body.dark-theme .invoice-chevron {
    background: #1e293b;
    color: #94a3b8;
}

.invoice-row-btn[aria-expanded="true"] .invoice-chevron {
    transform: rotate(180deg);
    background: #0284c7;
    color: #ffffff;
}

.invoice-expand-panel {
    background: #f8fafc;
    border-bottom: 1px solid var(--slate-border);
    padding: 1.5rem 1.75rem;
}
body.dark-theme .invoice-expand-panel {
    background: #070d1d;
}

.invoice-period-ribbon {
    background: linear-gradient(135deg, #0284c7 0%, #3b82f6 100%);
    color: #ffffff;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.82rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.2);
}

/* ─── 7. Mobile Responsive Overrides ─── */
@media (max-width: 768px) {
    .portal-hero {
        padding: 1.25rem 1.35rem;
    }
    .portal-hero-title {
        font-size: 1.35rem;
    }
    .portal-user-avatar {
        width: 3.25rem;
        height: 3.25rem;
        font-size: 1.4rem;
    }
    .portal-stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .portal-pending-header {
        padding: 1rem 1.25rem;
    }
    .portal-pending-body {
        padding: 1.25rem 1rem;
    }
    .portal-days-grid {
        grid-template-columns: 1fr;
    }
    .invoice-row-btn {
        padding: 1rem;
    }
    .invoice-price-val {
        font-size: 1.15rem;
    }
    .portal-catalog-banner {
        padding: 1.25rem;
    }
}

/* ==========================================================================
   Modern Product Catalog Design System (E-Commerce Luxury & WhatsApp Ordering)
   ========================================================================== */

/* ─── 1. Catalog Hero Banner ─── */
.catalog-hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0369a1 100%) !important;
    color: #ffffff !important;
    border-radius: var(--radius-2xl);
    padding: 1.75rem 2rem;
    margin-bottom: 1.75rem;
    box-shadow: 0 16px 36px -8px rgba(2, 132, 199, 0.3);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
}

.catalog-hero-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    position: relative;
    z-index: 2;
}

.catalog-hero-meta {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.catalog-hero-icon {
    width: 3.75rem;
    height: 3.75rem;
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.3) 0%, rgba(99, 102, 241, 0.3) 100%);
    border: 1.5px solid rgba(56, 189, 248, 0.4);
    color: #38bdf8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    flex-shrink: 0;
    box-shadow: inset 0 2px 8px rgba(255, 255, 255, 0.2);
}

.catalog-hero-title {
    font-size: 1.65rem;
    font-weight: 900;
    color: #ffffff !important;
    line-height: 1.2;
    margin: 0;
}

.catalog-hero-subtitle {
    font-size: 0.88rem;
    color: #cbd5e1 !important;
    margin-top: 0.25rem;
}

/* ─── 2. Search & Filter Bar ─── */
.catalog-toolbar-card {
    background: var(--slate-card);
    border: 1px solid var(--slate-border);
    border-radius: var(--radius-2xl);
    padding: 1.25rem 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-card);
}

.catalog-toolbar-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.catalog-search-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.catalog-search-box {
    position: relative;
    flex: 1;
    min-width: 260px;
}

.catalog-search-box i {
    position: absolute;
    right: 1.1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--slate-muted);
    font-size: 1rem;
    pointer-events: none;
}

.catalog-search-input {
    width: 100%;
    height: 3rem;
    padding: 0 3rem 0 1.25rem;
    background: #f8fafc;
    border: 1.5px solid var(--slate-border);
    border-radius: var(--radius-xl);
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--slate-text);
    outline: none;
    transition: all 0.2s ease;
}
body.dark-theme .catalog-search-input {
    background: #070d1d;
    border-color: #1e293b;
    color: #f8fafc;
}
.catalog-search-input:focus {
    border-color: #0284c7;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.15);
}
body.dark-theme .catalog-search-input:focus {
    background: #0f172a;
}

.catalog-tabs-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    border-top: 1px solid var(--slate-border);
    padding-top: 0.85rem;
}

.catalog-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 1.15rem;
    border-radius: var(--radius-pill);
    font-size: 0.84rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--slate-muted);
    background: #f1f5f9;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}
body.dark-theme .catalog-tab-btn {
    background: #1e293b;
    color: #94a3b8;
}
.catalog-tab-btn:hover {
    background: #e2e8f0;
    color: var(--slate-text);
}
body.dark-theme .catalog-tab-btn:hover {
    background: #334155;
    color: #f8fafc;
}
.catalog-tab-btn.active {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}

/* ─── 3. Modern Product Cards Grid ─── */
/* ─── 3. Modern Compact Product Cards Grid ─── */
.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.catalog-card {
    background: var(--slate-card);
    border: 1.5px solid var(--slate-border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    position: relative;
}
.catalog-card:hover {
    transform: translateY(-4px);
    border-color: #0284c7;
    box-shadow: 0 14px 28px -6px rgba(15, 23, 42, 0.12);
}

.catalog-media {
    position: relative;
    width: 100%;
    height: 120px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 50%, #f8fafc 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-bottom: 1px solid var(--slate-border);
}
body.dark-theme .catalog-media {
    background: linear-gradient(135deg, #0b1329 0%, #111e38 100%);
}

.catalog-media-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.catalog-card:hover .catalog-media-img {
    transform: scale(1.05);
}

.catalog-media-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    color: #0284c7;
    opacity: 0.85;
}
.catalog-media-icon {
    font-size: 2.25rem;
    filter: drop-shadow(0 2px 6px rgba(2, 132, 199, 0.18));
}

.catalog-type-pill {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-pill);
    font-size: 0.68rem;
    font-weight: 800;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    backdrop-filter: blur(8px);
    z-index: 5;
}
.pill-tiered {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
}
.pill-fixed {
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.catalog-card-body {
    padding: 0.9rem 1rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    justify-content: space-between;
}

.catalog-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.catalog-prod-name {
    font-size: 0.98rem;
    font-weight: 800;
    color: var(--slate-text);
    line-height: 1.3;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.catalog-sku-tag {
    font-family: var(--font-mono, monospace);
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--slate-muted);
    background: #f1f5f9;
    border: 1px solid var(--slate-border);
    padding: 0.12rem 0.4rem;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    flex-shrink: 0;
}
body.dark-theme .catalog-sku-tag {
    background: #1e293b;
    color: #94a3b8;
}

.catalog-price-highlight {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 0.3rem 0.6rem;
    margin-bottom: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
body.dark-theme .catalog-price-highlight {
    background: #070d1d;
    border-color: #1e293b;
}

.catalog-price-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--slate-muted);
}

.catalog-price-main {
    font-family: var(--font-primary), monospace;
    font-size: 0.95rem;
    font-weight: 900;
    color: #0284c7;
}

/* ─── 4. Tiered Pricing Visual Table (Compact) ─── */
.catalog-tiers-container {
    background: #ffffff;
    border: 1px solid var(--slate-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 0.65rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
body.dark-theme .catalog-tiers-container {
    background: #0b1329;
    border-color: #1e293b;
}

.catalog-tiers-head {
    background: #f1f5f9;
    padding: 0.22rem 0.55rem;
    font-size: 0.67rem;
    font-weight: 800;
    color: var(--slate-muted);
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid var(--slate-border);
}
body.dark-theme .catalog-tiers-head {
    background: #070d1d;
}

.catalog-tier-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.22rem 0.55rem;
    font-size: 0.72rem;
    border-bottom: 1px solid #f1f5f9;
    color: var(--slate-text);
    transition: background-color 0.15s ease;
}
body.dark-theme .catalog-tier-row {
    border-bottom-color: #1e293b;
}
.catalog-tier-row:last-child {
    border-bottom: none;
}
.catalog-tier-row.active-tier {
    background: #ecfdf5 !important;
    color: #065f46 !important;
    font-weight: 800;
    border-right: 3px solid #10b981;
}
body.dark-theme .catalog-tier-row.active-tier {
    background: rgba(16, 185, 129, 0.15) !important;
    color: #6ee7b7 !important;
}

.catalog-tier-price {
    font-family: var(--font-primary), monospace;
    font-weight: 900;
}

/* ─── 5. Interactive Order Box (Compact Unified Row) ─── */
.catalog-order-wrapper {
    background: #f8fafc;
    border: 1px solid var(--slate-border);
    border-radius: var(--radius-lg);
    padding: 0.55rem 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
body.dark-theme .catalog-order-wrapper {
    background: #070d1d;
    border-color: #1e293b;
}

.catalog-qty-stepper-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.catalog-stepper {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1.5px solid var(--slate-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}
body.dark-theme .catalog-stepper {
    background: #0f172a;
    border-color: #334155;
}

.catalog-step-btn {
    width: 1.7rem;
    height: 1.85rem;
    background: #f1f5f9;
    border: none;
    color: var(--slate-text);
    font-size: 0.95rem;
    font-weight: 900;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease;
}
body.dark-theme .catalog-step-btn {
    background: #1e293b;
    color: #f8fafc;
}
.catalog-step-btn:hover {
    background: #e2e8f0;
}
body.dark-theme .catalog-step-btn:hover {
    background: #334155;
}

.catalog-qty-input {
    width: 3.2rem;
    height: 1.85rem;
    border: none;
    text-align: center;
    font-family: var(--font-primary), monospace;
    font-size: 0.88rem;
    font-weight: 900;
    color: var(--slate-text);
    background: transparent;
    outline: none;
}

.catalog-live-subtotal {
    background: #f0fdf4;
    border: 1px dashed #86efac;
    border-radius: var(--radius-md);
    padding: 0.25rem 0.55rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.74rem;
    font-weight: 700;
    color: #166534;
    flex: 1;
}
body.dark-theme .catalog-live-subtotal {
    background: rgba(22, 163, 74, 0.12);
    border-color: rgba(34, 197, 94, 0.35);
    color: #86efac;
}

.btn-wa-order-modern {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    color: #ffffff !important;
    border: none;
    border-radius: var(--radius-md);
    padding: 0.45rem 0.75rem;
    font-weight: 800;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    width: 100%;
}
.btn-wa-order-modern:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35);
    transform: translateY(-1px);
}
.btn-wa-order-modern:active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .catalog-hero {
        padding: 1.25rem 1.35rem;
    }
    .catalog-hero-title {
        font-size: 1.35rem;
    }
    .catalog-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
}

/* ==========================================================================
   Add-Operation / Withdrawals Form Modern Enhancements
   ========================================================================== */
.op-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 1.25rem;
    box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.05);
    overflow: hidden;
}

body.dark-theme .op-card {
    background: #0f172a;
    border-color: #1e293b;
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.3);
}

.op-customer-box {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    padding: 1.25rem;
    transition: all 0.2s ease;
}

body.dark-theme .op-customer-box {
    background: linear-gradient(135deg, #111e38 0%, #0d172e 100%);
    border-color: #1e293b;
}

.op-items-wrapper {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    padding: 1.25rem;
}

body.dark-theme .op-items-wrapper {
    background: #0b1329;
    border-color: #1e293b;
}

/* Row Styling */
.item-row {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.85rem;
    padding: 1.15rem 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark-theme .item-row {
    background: #111e38;
    border-color: #1e293b;
}

.item-row:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

body.dark-theme .item-row:hover {
    border-color: #334155;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* Clean Form Controls */
.op-select {
    width: 100%;
    padding: 0.65rem 2.25rem 0.65rem 0.85rem;
    font-size: 0.88rem;
    font-weight: 600;
    border: 1.5px solid #cbd5e1;
    border-radius: 0.65rem;
    background-color: #ffffff;
    color: #0f172a;
    transition: all 0.2s ease;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: left 0.65rem center;
    background-repeat: no-repeat;
    background-size: 1.25em 1.25em;
}

body.dark-theme .op-select {
    background-color: #070d1d;
    border-color: #1e293b;
    color: #f8fafc;
}

.op-select:focus {
    outline: none;
    border-color: #0284c7;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.op-input {
    width: 100%;
    padding: 0.65rem 0.85rem;
    font-size: 0.88rem;
    font-weight: 600;
    border: 1.5px solid #cbd5e1;
    border-radius: 0.65rem;
    background-color: #ffffff;
    color: #0f172a;
    transition: all 0.2s ease;
}

body.dark-theme .op-input {
    background-color: #070d1d;
    border-color: #1e293b;
    color: #f8fafc;
}

.op-input:focus {
    outline: none;
    border-color: #0284c7;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

/* Quantity input with unit badge on left */
.op-qty-group {
    position: relative;
    display: flex;
    align-items: center;
}

.op-qty-input {
    width: 100%;
    padding: 0.65rem 0.5rem 0.65rem 2.8rem;
    font-size: 0.95rem;
    font-family: var(--font-primary), monospace;
    font-weight: 800;
    text-align: center;
    border: 1.5px solid #cbd5e1;
    border-radius: 0.65rem;
    background-color: #ffffff;
    color: #0f172a;
    transition: all 0.2s ease;
}

body.dark-theme .op-qty-input {
    background-color: #070d1d;
    border-color: #1e293b;
    color: #f8fafc;
}

.op-qty-input:focus {
    outline: none;
    border-color: #0284c7;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.op-qty-badge {
    position: absolute;
    left: 0.4rem;
    top: 50%;
    transform: translateY(-50%);
    background: #f1f5f9;
    color: #475569;
    padding: 0.2rem 0.55rem;
    border-radius: 0.45rem;
    font-size: 0.72rem;
    font-weight: 800;
    pointer-events: none;
    border: 1px solid #e2e8f0;
}

body.dark-theme .op-qty-badge {
    background: #1e293b;
    color: #94a3b8;
    border-color: #334155;
}

/* Note / file input with icon on right */
.op-note-group {
    position: relative;
    display: flex;
    align-items: center;
}

.op-note-input {
    width: 100%;
    padding: 0.65rem 2.4rem 0.65rem 0.85rem;
    font-size: 0.88rem;
    border: 1.5px solid #cbd5e1;
    border-radius: 0.65rem;
    background-color: #ffffff;
    color: #0f172a;
    transition: all 0.2s ease;
}

body.dark-theme .op-note-input {
    background-color: #070d1d;
    border-color: #1e293b;
    color: #f8fafc;
}

.op-note-input:focus {
    outline: none;
    border-color: #0284c7;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.op-note-icon {
    position: absolute;
    right: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.85rem;
    pointer-events: none;
}

/* Delete Row Button */
.op-delete-btn {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.65rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    background: transparent;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    cursor: pointer;
}

.op-delete-btn:hover:not(:disabled) {
    color: #ef4444;
    background: #fef2f2;
    border-color: #fecaca;
    transform: scale(1.05);
}

body.dark-theme .op-delete-btn:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.op-delete-btn:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

/* Live Hint Bar */
.row-hint-bar {
    margin-top: 0.75rem;
    padding-top: 0.65rem;
    border-top: 1px dashed #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.78rem;
}

body.dark-theme .row-hint-bar {
    border-top-color: #1e293b;
}

/* Order Summary Live Bar */
.op-summary-bar {
    margin-top: 1.25rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1.5px solid #bae6fd;
    border-radius: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

body.dark-theme .op-summary-bar {
    background: linear-gradient(135deg, #0b1e38 0%, #0c274c 100%);
    border-color: #0369a1;
}

.op-stat-pill {
    background: #ffffff;
    padding: 0.35rem 0.85rem;
    border-radius: 0.5rem;
    border: 1px solid #bae6fd;
    font-family: var(--font-primary), monospace;
    font-weight: 900;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

body.dark-theme .op-stat-pill {
    background: #0f172a;
    border-color: #0369a1;
}

/* Customer Type Toggle Cards */
.cust-type-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

@media (max-width: 640px) {
    .cust-type-selector {
        grid-template-columns: 1fr;
    }
}

.cust-type-card {
    border: 2px solid #e2e8f0;
    border-radius: 0.85rem;
    padding: 0.85rem 1rem;
    cursor: pointer;
    background: #ffffff;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    user-select: none;
}

body.dark-theme .cust-type-card {
    background: #0b1329;
    border-color: #1e293b;
}

.cust-type-card:hover {
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.cust-type-card.active-type {
    border-color: #0284c7;
    background: #f0f9ff;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.12);
}

body.dark-theme .cust-type-card.active-type {
    border-color: #0284c7;
    background: rgba(2, 132, 199, 0.15);
}

.cust-type-radio {
    accent-color: #0284c7;
    width: 1.15rem;
    height: 1.15rem;
    cursor: pointer;
}

/* Walk-in instant settlement panel */
.walkin-settlement-panel {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 1.5px solid #a7f3d0;
    border-radius: 1rem;
    padding: 1.25rem;
    margin-top: 1.25rem;
    transition: all 0.3s ease;
}

body.dark-theme .walkin-settlement-panel {
    background: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
    border-color: #047857;
}

/* Manual Custom Item Row Styling */
.item-row.is-manual {
    border-color: #f59e0b;
    background: #fffdfa;
}

body.dark-theme .item-row.is-manual {
    border-color: #d97706;
    background: #1c1917;
}

.item-row.is-manual .op-select {
    border-color: #f59e0b;
    background-color: #fffbeb;
    color: #b45309;
    font-weight: 800;
}

body.dark-theme .item-row.is-manual .op-select {
    background-color: #292524;
    border-color: #d97706;
    color: #fde68a;
}

/* ==========================================================================
   Responsive Dashboard Grid & Split Layout Utilities
   ========================================================================== */
.dashboard-grid-split {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

@media (max-width: 1024px) {
    .dashboard-grid-split {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 1024px) {
    .lg\:grid-cols-12 {
        display: grid;
        grid-template-columns: repeat(12, minmax(0, 1fr));
    }
    .lg\:col-span-12 { grid-column: span 12 / span 12; }
    .lg\:col-span-8  { grid-column: span 8 / span 8; }
    .lg\:col-span-7  { grid-column: span 7 / span 7; }
    .lg\:col-span-6  { grid-column: span 6 / span 6; }
    .lg\:col-span-5  { grid-column: span 5 / span 5; }
    .lg\:col-span-4  { grid-column: span 4 / span 4; }
}

/* ==========================================================================
   Comprehensive Mobile & Tablet Responsiveness Enhancements (V2)
   ========================================================================== */

/* 1. منع الإزاحة الأفقية العامة على الهواتف */
html, body {
    max-width: 100vw;
    overflow-x: clip;
}

/* 2. تحسين الحاويات والهوامش على الشاشات الصغيرة */
@media (max-width: 768px) {
    .container-max {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    .card {
        border-radius: var(--radius-lg) !important;
    }

    .card-header {
        padding: 0.85rem 1rem !important;
    }

    .card-body {
        padding: 1rem !important;
    }
}

@media (max-width: 480px) {
    .container-max {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
}

/* 3. شريط التنقل العلوي المتجاوب (Responsive Topbar) */
@media (max-width: 640px) {
    .app-topbar {
        padding: 0 0.75rem !important;
        height: 56px !important;
    }
    
    :root {
        --topbar-height: 56px;
    }

    .topbar-breadcrumb-parent,
    .topbar-breadcrumb-sep,
    .topbar-currency-badge {
        display: none !important;
    }

    .topbar-wa-text {
        display: none !important;
    }

    .topbar-wa-badge {
        padding: 0.35rem 0.55rem !important;
    }

    .topbar-breadcrumb-current {
        font-size: 0.9rem !important;
        max-width: 150px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* إخفاء نصوص المستخدم وإبقاء الأيقونة لتوفير المساحة */
    .topbar-user-info {
        display: none !important;
    }

    .topbar-user-chip {
        padding: 0.25rem !important;
        background: transparent !important;
        border: none !important;
        gap: 0 !important;
    }

    .topbar-left {
        gap: 0.5rem !important;
    }

    .topbar-toggle-btn {
        width: 2.25rem !important;
        height: 2.25rem !important;
        font-size: 1.1rem !important;
    }
}

/* 4. معالجة الجداول وسلاسة التمرير بالماوس واللمس (High Performance Scrollable Tables) */
.table-responsive,
.table-scroll-wrapper,
.smart-table-wrapper {
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch !important;
    position: relative;
    overscroll-behavior-y: auto !important;
}

/* التمرير الرأسي يتدفق فوراً وبدون أي احتجاز بالماوس داخل جداول تابوليتر */
.tabulator,
.tabulator .tabulator-tableholder {
    overflow-y: visible !important;
    overscroll-behavior: auto !important;
    overscroll-behavior-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

[id$="-table"] {
    position: relative !important;
    width: 100% !important;
    overflow-y: visible !important;
}

@media (max-width: 768px) {
    /* ضمان عدم انضغاط أعمدة Tabulator لتظل مقروءة بأريحية عبر السحب الأفقي */
    .tabulator {
        min-width: 660px !important;
    }

    .tabulator .tabulator-cell,
    .tabulator .tabulator-col-title {
        font-size: 0.8rem !important;
        padding: 6px 8px !important;
    }
}

/* ────────────────── أنماط جدول ملخص المسحوبات التجميعية الذكية ────────────────── */
.smart-table-wrapper {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    border-radius: 0.875rem !important;
    border: 1px solid #e2e8f0 !important;
    background: #ffffff !important;
    margin-bottom: 1.25rem !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
}

.smart-grouped-table {
    width: 100% !important;
    min-width: 720px !important;
    border-collapse: collapse !important;
    font-size: 0.82rem !important;
    text-align: right !important;
}

.smart-grouped-table th {
    background: #f8fafc !important;
    color: #475569 !important;
    font-weight: 700 !important;
    padding: 0.85rem 1rem !important;
    border-bottom: 2px solid #e2e8f0 !important;
    white-space: nowrap !important;
}

.smart-grouped-table td {
    padding: 0.85rem 1rem !important;
    border-bottom: 1px solid #f1f5f9 !important;
    vertical-align: middle !important;
}

.smart-grouped-table tr:hover td {
    background-color: #f8fafc !important;
}

.smart-grouped-table tfoot td {
    background-color: #f8fafc !important;
    border-top: 2px solid #cbd5e1 !important;
    font-weight: 800 !important;
    padding: 0.95rem 1rem !important;
}

.smart-sku-tag {
    display: inline-block !important;
    font-family: var(--font-mono) !important;
    font-size: 0.72rem !important;
    color: #64748b !important;
    background: #f1f5f9 !important;
    padding: 0.1rem 0.4rem !important;
    border-radius: 0.35rem !important;
    border: 1px solid #e2e8f0 !important;
    white-space: nowrap !important;
    margin-right: 0.35rem !important;
}

/* شبكة البطاقات الثلاث أسفل جدول التجميع */
.pending-metric-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 1rem !important;
    margin-top: 1.25rem !important;
    margin-bottom: 1.25rem !important;
    clear: both !important;
}

@media (max-width: 768px) {
    .pending-metric-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }
}

.pending-metric-card {
    border-radius: 0.875rem !important;
    padding: 1.1rem 1.25rem !important;
    text-align: center !important;
    border-width: 1px !important;
    border-style: solid !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 96px !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

.pending-metric-card:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06) !important;
}

.pending-metric-card.card-blue {
    background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%) !important;
    border-color: #bfdbfe !important;
}

.pending-metric-card.card-amber {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%) !important;
    border-color: #fde68a !important;
}

.pending-metric-card.card-emerald {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%) !important;
    border-color: #a7f3d0 !important;
}

.pending-metric-title {
    font-size: 0.78rem !important;
    font-weight: 700 !important;
    margin-bottom: 0.35rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.35rem !important;
}

.pending-metric-val {
    font-family: var(--font-mono) !important;
    font-weight: 900 !important;
    font-size: 1.35rem !important;
    line-height: 1.2 !important;
}

.pending-notice-banner {
    display: flex !important;
    align-items: flex-start !important;
    gap: 0.75rem !important;
    padding: 0.9rem 1.15rem !important;
    background: #fffbeb !important;
    border: 1px solid #fde68a !important;
    border-radius: 0.875rem !important;
    font-size: 0.8rem !important;
    color: #92400e !important;
    margin-top: 1.25rem !important;
    clear: both !important;
    line-height: 1.5 !important;
}

.single-subtotal-bar {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: wrap !important;
    gap: 0.75rem !important;
    padding: 0.85rem 1.25rem !important;
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 0.875rem !important;
    margin-top: 0.85rem !important;
    margin-bottom: 1.5rem !important;
    font-size: 0.82rem !important;
}

/* الدعم الكامل للوضع الليلي Dark Mode */
body.dark-theme .smart-table-wrapper {
    background: #0f172a !important;
    border-color: #1e293b !important;
}
body.dark-theme .smart-grouped-table th {
    background: #1e293b !important;
    color: #94a3b8 !important;
    border-bottom-color: #334155 !important;
}
body.dark-theme .smart-grouped-table td {
    border-bottom-color: #1e293b !important;
    color: #f8fafc !important;
}
body.dark-theme .smart-grouped-table tr:hover td {
    background-color: rgba(30, 41, 59, 0.5) !important;
}
body.dark-theme .smart-grouped-table tfoot td {
    background-color: #1e293b !important;
    border-top-color: #334155 !important;
    color: #f8fafc !important;
}
body.dark-theme .smart-sku-tag {
    background: #1e293b !important;
    color: #94a3b8 !important;
    border-color: #334155 !important;
}
body.dark-theme .single-subtotal-bar {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #cbd5e1 !important;
}
body.dark-theme .pending-metric-card.card-blue {
    background: linear-gradient(135deg, #0c203a 0%, #0f2747 100%) !important;
    border-color: #1e3a8a !important;
}
body.dark-theme .pending-metric-card.card-amber {
    background: linear-gradient(135deg, #2b1d06 0%, #3d2708 100%) !important;
    border-color: #78350f !important;
}
body.dark-theme .pending-metric-card.card-emerald {
    background: linear-gradient(135deg, #062b1b 0%, #083b25 100%) !important;
    border-color: #065f46 !important;
}
body.dark-theme .pending-notice-banner {
    background: #2b1d06 !important;
    border-color: #78350f !important;
    color: #fde68a !important;
}

/* 5. شبكة البطاقات الإحصائية (Stats Cards) على الهواتف */
@media (max-width: 640px) {
    .stats-grid-responsive,
    .stats-grid-4,
    .portal-stats-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }

    .stat-card-pro {
        padding: 0.9rem 1rem !important;
        min-height: 100px !important;
    }

    .stat-card-value {
        font-size: 1.4rem !important;
    }

    .stat-icon-bubble {
        width: 2.5rem !important;
        height: 2.5rem !important;
        font-size: 1.1rem !important;
    }
}

/* 6. منع التقريب التلقائي المزعج في متصفحات الموبايل (iOS Safari Auto-Zoom Fix) */
@media (max-width: 768px) {
    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="number"],
    input[type="tel"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* 7. أزرار الإجراءات والمجموعات على الموبايل (Touch Friendly Action Buttons) */
@media (max-width: 768px) {
    .action-btn-group {
        gap: 0.35rem !important;
    }

    .action-btn {
        width: 2.1rem !important;
        height: 2.1rem !important;
        font-size: 0.85rem !important;
    }

    .btn {
        min-height: 2.35rem !important;
        padding-top: 0.45rem !important;
        padding-bottom: 0.45rem !important;
    }
}

/* 8. ترويسة الفاتورة وشريط أدواتها على الموبايل */
@media (max-width: 768px) {
    .inv-header-row {
        padding: 1rem !important;
        gap: 1rem !important;
    }

    .inv-brand-wrapper {
        gap: 0.65rem !important;
    }

    .inv-brand-badge {
        width: 2.5rem !important;
        height: 2.5rem !important;
        font-size: 1.15rem !important;
    }

    .inv-brand-text h2 {
        font-size: 1.15rem !important;
    }

    .inv-doc-meta-card {
        padding: 0.65rem 0.85rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .inv-cycle-strip {
        margin: 0.75rem 0 !important;
        padding: 0.75rem !important;
        font-size: 0.8rem !important;
    }
}

/* 9. شريط معاينة الإدارة في بوابة العميل على الموبايل */
@media (max-width: 640px) {
    #adminCustomerSwitcher {
        max-width: 150px !important;
        font-size: 0.75rem !important;
    }
}

/* 10. شاشات تسجيل الدخول وصفحات النماذج على الموبايل */
@media (max-width: 576px) {
    .login-card,
    .auth-card {
        padding: 1.25rem 1rem !important;
        margin: 1rem auto !important;
        border-radius: var(--radius-xl) !important;
    }

    .btn-mobile-full {
        width: 100% !important;
        justify-content: center !important;
    }
}

/* ─────────────────────────────────────────────────────────────
   Dynamic Island Topbar Component — الجزيرة التفاعلية للشريط العلوي
   ───────────────────────────────────────────────────────────── */
.topbar-dynamic-island {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    user-select: none;
    z-index: 10;
}

.dynamic-island-capsule {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.92));
    color: #f8fafc;
    padding: 0.38rem 1.15rem;
    border-radius: 9999px;
    box-shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.22), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: default;
}

body.dark-theme .dynamic-island-capsule {
    background: linear-gradient(135deg, rgba(2, 6, 23, 0.96), rgba(15, 23, 42, 0.94));
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(56, 189, 248, 0.25) inset;
}

.dynamic-island-capsule:hover {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 8px 24px -4px rgba(15, 23, 42, 0.32), 0 0 0 1px rgba(56, 189, 248, 0.45) inset;
}

.island-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 9999px;
    background: #10b981;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: islandPulse 2s infinite cubic-bezier(0.4, 0, 0.6, 1);
    flex-shrink: 0;
}

@keyframes islandPulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 7px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.island-content {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
}

.island-day-date {
    color: #94a3b8;
    font-weight: 600;
}

body.dark-theme .island-day-date {
    color: #cbd5e1;
}

.island-divider {
    color: #475569;
    font-size: 0.7rem;
}

.island-time {
    color: #38bdf8;
    letter-spacing: 0.02em;
    font-weight: 800;
}

@media (max-width: 992px) {
    .topbar-dynamic-island {
        display: none;
    }
}

/* ==========================================================================
   🏝️ Dynamic Island - Accounting Cycle Countdown & Interactive Center
   ========================================================================== */
.dynamic-island-wrapper {
    display: flex;
    justify-content: center;
    margin: 0.5rem 0 1.75rem 0;
    width: 100%;
    position: relative;
    z-index: 25;
}

.dynamic-island-container {
    width: 100%;
    max-width: 820px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.dynamic-island-container .dynamic-island-capsule {
    background: #090d16 !important;
    background: linear-gradient(135deg, #090d16 0%, #0f172a 100%) !important;
    color: #ffffff !important;
    border: 1.5px solid #2563eb !important;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.5), 0 0 25px rgba(37, 99, 235, 0.35) !important;
    border-radius: 9999px !important;
    padding: 0.75rem 1.6rem !important;
    cursor: pointer !important;
    user-select: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 1.25rem !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.dynamic-island-container .dynamic-island-capsule:hover {
    border-color: #38bdf8 !important;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6), 0 0 35px rgba(56, 189, 248, 0.45) !important;
    transform: translateY(-2px);
}

.dynamic-island-pulse {
    position: relative;
    display: flex;
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.dynamic-island-pulse .radar {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #10b981;
    opacity: 0.8;
    animation: island-radar-ping 1.6s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.dynamic-island-pulse .dot {
    position: relative;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
}

.dynamic-island-pulse.due .radar {
    background: #f59e0b;
}

.dynamic-island-pulse.due .dot {
    background: #f59e0b;
    box-shadow: 0 0 8px #f59e0b;
}

@keyframes island-radar-ping {
    75%, 100% {
        transform: scale(2.4);
        opacity: 0;
    }
}

.dynamic-island-countdown-badge {
    background: #1c1917 !important;
    border: 1.5px solid #f59e0b !important;
    color: #fbbf24 !important;
    font-family: 'Plus Jakarta Sans', ui-monospace, monospace !important;
    font-size: 1.05rem !important;
    font-weight: 900 !important;
    letter-spacing: 0.04em !important;
    padding: 0.35rem 1rem !important;
    border-radius: 0.75rem !important;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.5), 0 0 15px rgba(245, 158, 11, 0.3) !important;
    display: inline-block !important;
    white-space: nowrap !important;
}

.dynamic-island-cycle-tag {
    background: #172554 !important;
    border: 1px solid #3b82f6 !important;
    color: #93c5fd !important;
    font-size: 0.75rem !important;
    font-weight: 800 !important;
    padding: 0.3rem 0.85rem !important;
    border-radius: 9999px !important;
    white-space: nowrap !important;
}

.dynamic-island-chevron-btn {
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 50%;
    background: #1e293b;
    border: 1px solid #334155;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: all 0.25s;
    flex-shrink: 0;
}

.dynamic-island-expanded-box {
    background: #090d16 !important;
    background: linear-gradient(145deg, #090d16 0%, #0f172a 100%) !important;
    color: #ffffff !important;
    border: 1.5px solid #2563eb !important;
    border-radius: 1.75rem !important;
    padding: 1.5rem !important;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.65), 0 0 35px rgba(37, 99, 235, 0.3) !important;
    width: 100% !important;
    margin-top: 0.65rem !important;
    box-sizing: border-box !important;
}

/* ==========================================================================
   📅 Enhanced Period Filter Bar Styling
   ========================================================================== */
.date-filter-box {
    background: #ffffff !important;
    border: 1.5px solid #e2e8f0 !important;
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.05) !important;
    border-radius: 1.25rem !important;
    padding: 1.25rem 1.5rem !important;
    margin-bottom: 1.75rem !important;
    position: relative !important;
    clear: both !important;
    box-sizing: border-box !important;
}

.date-filter-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-bottom: 0.85rem;
    border-bottom: 1.5px solid #f1f5f9;
}

.date-filter-presets {
    padding: 0.85rem 0;
    border-bottom: 1.5px solid #f1f5f9;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.date-filter-btn-tab {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    padding: 0.6rem 1.25rem !important;
    border-radius: 0.85rem !important;
    font-size: 0.825rem !important;
    font-weight: 800 !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    cursor: pointer !important;
    border: 1.5px solid #cbd5e1 !important;
    background: #f8fafc !important;
    color: #334155 !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03) !important;
}

.date-filter-btn-tab:hover {
    background: #f1f5f9 !important;
    border-color: #94a3b8 !important;
    color: #0f172a !important;
    transform: translateY(-1px) !important;
}

.date-filter-btn-tab.active {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
    border-color: #0284c7 !important;
    color: #ffffff !important;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35) !important;
}

.date-filter-btn-tab.active-all {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
    border-color: #0f172a !important;
    color: #ffffff !important;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.35) !important;
}

.date-filter-btn-tab.active-purple {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%) !important;
    border-color: #7c3aed !important;
    color: #ffffff !important;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35) !important;
}

.date-filter-custom-section {
    padding-top: 0.85rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.date-chip-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: #f8fafc;
    border: 1.5px solid #cbd5e1;
    border-radius: 0.75rem;
    padding: 0.35rem 0.75rem;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
    transition: all 0.2s;
}

.date-chip-wrapper:focus-within {
    border-color: #0284c7;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.date-chip-wrapper input[type="date"] {
    background: transparent;
    border: none;
    outline: none;
    font-family: 'Plus Jakarta Sans', monospace;
    font-size: 0.825rem;
    font-weight: 800;
    color: #0f172a;
    cursor: pointer;
}

.date-filter-submit {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.45rem !important;
    height: 38px !important;
    padding: 0 1.25rem !important;
    border-radius: 0.75rem !important;
    font-size: 0.825rem !important;
    font-weight: 800 !important;
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
    color: #ffffff !important;
    border: 1px solid #0284c7 !important;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3) !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    transition: all 0.2s !important;
}

.date-filter-submit:hover {
    background: linear-gradient(135deg, #0369a1 0%, #075985 100%) !important;
    box-shadow: 0 6px 18px rgba(2, 132, 199, 0.45) !important;
    transform: translateY(-1px) !important;
}

.date-filter-reset {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.45rem !important;
    height: 38px !important;
    padding: 0 0.95rem !important;
    border-radius: 0.75rem !important;
    font-size: 0.825rem !important;
    font-weight: 800 !important;
    background: #f8fafc !important;
    color: #475569 !important;
    border: 1.5px solid #cbd5e1 !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    transition: all 0.2s !important;
}

.date-filter-reset:hover {
    background: #fee2e2 !important;
    border-color: #fca5a5 !important;
    color: #b91c1c !important;
}

/* ==========================================================================
   Dynamic Island (كبسولة العد التنازلي لموعد إغلاق الدورة المحاسبية)
   ========================================================================== */
.dynamic-island-wrapper {
    margin: 0.5rem auto 1.5rem auto !important;
    display: flex !important;
    justify-content: center !important;
    width: 100% !important;
}
.dynamic-island-container {
    width: 100% !important;
    max-width: 52rem !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}
.dynamic-island-capsule {
    background: linear-gradient(135deg, #090d16 0%, #0f172a 100%) !important;
    color: #ffffff !important;
    border-radius: 9999px !important;
    padding: 0.65rem 1.25rem !important;
    border: 1.5px solid #2563eb !important;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.6), 0 0 15px rgba(37, 99, 235, 0.25) !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0.75rem !important;
    user-select: none !important;
    transition: all 0.25s ease !important;
}
.dynamic-island-capsule:hover {
    background: linear-gradient(135deg, #0b1120 0%, #1e293b 100%) !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 12px 30px -5px rgba(15, 23, 42, 0.8), 0 0 20px rgba(59, 130, 246, 0.4) !important;
    transform: translateY(-1px);
}
.dynamic-island-pulse {
    position: relative;
    display: inline-flex;
    height: 10px;
    width: 10px;
    flex-shrink: 0;
}
.dynamic-island-pulse-ping {
    position: absolute;
    display: inline-flex;
    height: 100%;
    width: 100%;
    border-radius: 9999px;
    opacity: 0.75;
    animation: dynamicIslandPing 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}
.dynamic-island-pulse-dot {
    position: relative;
    display: inline-flex;
    border-radius: 9999px;
    height: 10px;
    width: 10px;
}
@keyframes dynamicIslandPing {
    75%, 100% {
        transform: scale(2.2);
        opacity: 0;
    }
}
.dynamic-island-countdown-badge {
    font-family: 'Plus Jakarta Sans', monospace !important;
    font-weight: 900 !important;
    font-size: 0.85rem !important;
    letter-spacing: 0.05em !important;
    color: #fbbf24 !important;
    background: rgba(245, 158, 11, 0.15) !important;
    border: 1px solid rgba(251, 191, 36, 0.35) !important;
    padding: 0.3rem 0.85rem !important;
    border-radius: 0.75rem !important;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.4), 0 0 12px rgba(245, 158, 11, 0.2) !important;
    white-space: nowrap !important;
}
.dynamic-island-cycle-tag {
    font-size: 0.72rem !important;
    font-weight: 800 !important;
    color: #93c5fd !important;
    background: rgba(30, 58, 138, 0.7) !important;
    border: 1px solid #1d4ed8 !important;
    padding: 0.2rem 0.65rem !important;
    border-radius: 9999px !important;
    white-space: nowrap !important;
}
.dynamic-island-expand-icon {
    width: 24px;
    height: 24px;
    border-radius: 9999px;
    background: #1e293b;
    border: 1px solid #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 0.7rem;
    transition: all 0.2s;
}
.dynamic-island-capsule:hover .dynamic-island-expand-icon {
    background: #334155;
    color: #ffffff;
}

/* Expanded State */
.dynamic-island-expanded-box {
    margin-top: 0.5rem !important;
    background: linear-gradient(135deg, #090d16 0%, #0f172a 100%) !important;
    color: #ffffff !important;
    border-radius: 1.5rem !important;
    padding: 1.25rem 1.5rem !important;
    border: 1.5px solid #2563eb !important;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.8), 0 0 25px rgba(37, 99, 235, 0.25) !important;
    animation: dynamicIslandSlideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}
@keyframes dynamicIslandSlideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.dynamic-island-stat-card {
    background: rgba(15, 23, 42, 0.8) !important;
    border: 1px solid #334155 !important;
    border-radius: 1rem !important;
    padding: 0.85rem !important;
}

/* ─── Modern Portal Tabs Switcher & Clean Invoices View ─── */
.portal-nav-switcher {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--slate-card);
    padding: 0.45rem;
    border-radius: var(--radius-xl);
    border: 1px solid var(--slate-border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.portal-nav-switcher::-webkit-scrollbar {
    display: none;
}
.portal-nav-tab {
    flex: 1;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-lg);
    border: none;
    background: transparent;
    color: var(--slate-muted);
    font-weight: 800;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    user-select: none;
}
.portal-nav-tab:hover {
    color: var(--slate-text);
    background: rgba(2, 132, 199, 0.06);
}
.portal-nav-tab.active {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}
.portal-nav-pill {
    padding: 0.15rem 0.55rem;
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
    font-weight: 900;
    background: rgba(255,255,255,0.2);
    color: inherit;
    flex-shrink: 0;
}
.portal-nav-tab:not(.active) .portal-nav-pill {
    background: #e2e8f0;
    color: #475569;
}
body.dark-theme .portal-nav-tab:not(.active) .portal-nav-pill {
    background: #334155;
    color: #cbd5e1;
}

@media (max-width: 640px) {
    .portal-hero {
        padding: 1.1rem 1rem !important;
        border-radius: 1.25rem !important;
    }
    .portal-hero-title {
        font-size: 1.2rem !important;
    }
    .portal-hero-subtitle {
        font-size: 0.78rem !important;
    }
    .portal-user-avatar {
        width: 2.75rem !important;
        height: 2.75rem !important;
        font-size: 1.15rem !important;
    }
    .portal-hero-actions {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    .portal-hero-actions .btn {
        width: 100%;
        justify-content: center;
        padding: 0.65rem 1rem !important;
        font-size: 0.84rem !important;
    }
    .portal-stat-card {
        padding: 1rem !important;
        border-radius: 1.25rem !important;
    }
    .portal-stat-value {
        font-size: 1.35rem !important;
    }
    .portal-nav-switcher {
        gap: 0.35rem;
        padding: 0.35rem;
        border-radius: 1rem;
    }
    .portal-nav-tab {
        padding: 0.55rem 0.75rem !important;
        font-size: 0.78rem !important;
        gap: 0.35rem !important;
        flex: 1 0 auto !important;
    }
    .portal-nav-pill {
        padding: 0.08rem 0.4rem !important;
        font-size: 0.65rem !important;
    }
}

/* Invoices Table (Desktop) */
.portal-inv-table-wrap {
    background: var(--slate-card);
    border: 1px solid var(--slate-border);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}
.portal-inv-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    text-align: right;
}
.portal-inv-table th {
    background: #f8fafc;
    color: #475569;
    font-size: 0.82rem;
    font-weight: 800;
    padding: 0.85rem 1.15rem;
    border-bottom: 1px solid var(--slate-border);
    white-space: nowrap;
}
body.dark-theme .portal-inv-table th {
    background: #0f172a;
    color: #94a3b8;
}
.portal-inv-table td {
    padding: 0.85rem 1.15rem;
    border-bottom: 1px solid var(--slate-border);
    vertical-align: middle;
    font-size: 0.88rem;
}
.portal-inv-table tr:last-child td {
    border-bottom: none;
}
.portal-inv-table tr:hover td {
    background: rgba(2, 132, 199, 0.03);
}

/* Mobile Invoices Cards (Compact & Smart) */
.portal-mobile-cards {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.portal-inv-card-m {
    background: var(--slate-card);
    border: 1px solid var(--slate-border);
    border-radius: 1rem;
    padding: 0.85rem 0.95rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    transition: transform 0.2s, box-shadow 0.2s;
}
.portal-inv-card-m:hover {
    box-shadow: 0 6px 16px rgba(0,0,0,0.06);
}
.portal-inv-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.portal-inv-card-no {
    font-size: 0.95rem;
    font-weight: 900;
    color: var(--slate-text);
    font-family: monospace;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.portal-inv-period-pill {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    color: #0369a1;
    padding: 0.35rem 0.65rem;
    border-radius: 0.6rem;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
body.dark-theme .portal-inv-period-pill {
    background: rgba(2, 132, 199, 0.15);
    border-color: rgba(2, 132, 199, 0.3);
    color: #7dd3fc;
}
.portal-inv-amount-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding-top: 0.35rem;
    border-top: 1px dashed var(--slate-border);
}
.portal-inv-amount-val {
    font-size: 1.15rem;
    font-weight: 900;
    font-family: monospace;
    color: #0284c7;
}

/* Mobile Payments Cards */
.portal-mobile-pay-cards {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}
.portal-pay-card-m {
    background: var(--slate-card);
    border: 1px solid var(--slate-border);
    border-radius: 1rem;
    padding: 0.85rem 0.95rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}
.portal-pay-card-m:hover {
    box-shadow: 0 6px 16px rgba(0,0,0,0.06);
}

/* Pagination Bar & Buttons */
.portal-pagination-bar {
    border-top: 1px solid var(--slate-border);
    background: var(--slate-card);
}
.portal-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.65rem;
    border-radius: 0.5rem;
    border: 1px solid var(--slate-border);
    background: var(--slate-card);
    color: var(--slate-text);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}
.portal-page-btn:hover:not(:disabled) {
    background: rgba(2, 132, 199, 0.08);
    border-color: #0284c7;
    color: #0284c7;
}
.portal-page-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}
.portal-page-btn.active {
    background: #0284c7 !important;
    border-color: #0284c7 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.35);
}

/* Fullscreen / Responsive Invoice Modal */
.portal-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(6px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
}
.portal-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}
.portal-modal-box {
    background: #ffffff;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    border-radius: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.portal-modal-overlay.active .portal-modal-box {
    transform: scale(1);
}
.portal-modal-header {
    padding: 1.25rem 1.75rem;
    background: #0f172a;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.portal-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
    background: #f8fafc;
}
.portal-modal-footer {
    padding: 1rem 1.75rem;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}






