/* ============================================================
   POS SYSTEM — PREMIUM DESIGN SYSTEM v2.0
   A unified token-based design system for world-class UI/UX
   ============================================================ */

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

/* ── Design Tokens ── */
:root {
    /* Background layers */
    --bg-base:       #080e1a;
    --bg-surface:    #0d1526;
    --bg-elevated:   #111e35;
    --bg-overlay:    #162040;

    /* Brand Colors */
    --brand-primary:   #6366f1;  /* Indigo — modern SaaS */
    --brand-hover:     #818cf8;
    --brand-muted:     rgba(99,102,241,0.15);
    --brand-accent:    #FECB00;  /* Chad Gold */
    --brand-red:       #ef4444;

    /* Semantic Colors */
    --color-success:   #10b981;
    --color-success-bg: rgba(16,185,129,0.12);
    --color-warning:   #f59e0b;
    --color-warning-bg: rgba(245,158,11,0.12);
    --color-danger:    #ef4444;
    --color-danger-bg: rgba(239,68,68,0.12);
    --color-info:      #3b82f6;
    --color-info-bg:   rgba(59,130,246,0.12);

    /* Text */
    --text-primary:    #f1f5f9;
    --text-secondary:  #94a3b8;
    --text-muted:      #64748b;
    --text-dim:        #475569;

    /* Borders */
    --border:          rgba(255,255,255,0.07);
    --border-focus:    #6366f1;
    --border-hover:    rgba(255,255,255,0.15);

    /* Shadows */
    --shadow-sm:   0 1px 3px rgba(0,0,0,0.4);
    --shadow-md:   0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg:   0 10px 40px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 20px rgba(99,102,241,0.3);

    /* Radii */
    --radius-sm:   6px;
    --radius-md:   10px;
    --radius-lg:   16px;
    --radius-xl:   24px;
    --radius-full: 9999px;

    /* Spacing Scale (8px base) */
    --space-1:  4px;
    --space-2:  8px;
    --space-3:  12px;
    --space-4:  16px;
    --space-5:  20px;
    --space-6:  24px;
    --space-8:  32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    /* Sidebar */
    --sidebar-width: 240px;
    --sidebar-collapsed: 64px;
    --topbar-height: 60px;

    /* Transitions */
    --transition: all 0.2s ease;
    --transition-slow: all 0.4s ease;
}

/* ── Light Mode Overrides ── */
body.light-mode {
    --bg-base:      #f0f4f8;
    --bg-surface:   #ffffff;
    --bg-elevated:  #f8fafc;
    --bg-overlay:   #e8edf5;
    --text-primary:  #0f172a;
    --text-secondary: #475569;
    --text-muted:    #64748b;
    --border:        rgba(0,0,0,0.08);
    --border-hover:  rgba(0,0,0,0.15);
    --shadow-md:     0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg:     0 10px 40px rgba(0,0,0,0.1);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Tajawal', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* RTL/LTR Support */
[dir="rtl"] { text-align: right; }
[dir="ltr"] { text-align: left; }

a { color: var(--brand-primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--brand-hover); }

img { max-width: 100%; height: auto; }

/* ── Layout ── */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 200;
    transition: transform 0.3s ease, width 0.3s ease;
    overflow: hidden;
}
[dir="rtl"] .sidebar { left: auto; right: 0; border-right: none; border-left: 1px solid var(--border); }

.sidebar-brand {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 var(--space-5);
    border-bottom: 1px solid var(--border);
    gap: var(--space-3);
    flex-shrink: 0;
}
.sidebar-brand .brand-icon {
    width: 32px; height: 32px;
    background: var(--brand-primary);
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: 16px;
    flex-shrink: 0;
}
.sidebar-brand .brand-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
    white-space: nowrap;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-4) var(--space-3);
    overflow-y: auto;
    overflow-x: hidden;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.nav-section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: var(--space-4) var(--space-3) var(--space-2);
    white-space: nowrap;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
    margin-bottom: 2px;
}
.nav-item:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    text-decoration: none;
}
.nav-item.active {
    background: var(--brand-muted);
    color: var(--brand-primary);
}
.nav-item.active .nav-icon { color: var(--brand-primary); }
.nav-item .nav-icon {
    width: 20px; height: 20px;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
    transition: var(--transition);
}
.nav-item:hover .nav-icon { color: var(--text-primary); }
.nav-item.nav-pos {
    background: rgba(254,203,0,0.1);
    color: #FECB00;
    border: 1px solid rgba(254,203,0,0.2);
    margin-bottom: var(--space-2);
}
.nav-item.nav-pos:hover { background: rgba(254,203,0,0.18); }
.nav-item.nav-pos .nav-icon { color: #FECB00; }

.sidebar-footer {
    padding: var(--space-4) var(--space-3);
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.nav-divider { height: 1px; background: var(--border); margin: var(--space-2) 0; }

/* TOP BAR */
.topbar {
    height: calc(var(--topbar-height) + env(titlebar-area-height, 0px));
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: env(titlebar-area-height, 0px) var(--space-6) 0 var(--space-6);
    padding-left: max(var(--space-6), env(titlebar-area-x, 0px));
    padding-right: max(var(--space-6), calc(100vw - (env(titlebar-area-x, 0px) + env(titlebar-area-width, 100vw))));
    position: sticky;
    top: 0;
    z-index: 100;
    -webkit-app-region: drag; /* WCO draggable area */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Ensure interactive elements in topbar are not draggable */
.topbar button, .topbar a, .topbar input, .topbar .search-box {
    -webkit-app-region: no-drag;
}

.topbar-start { display: flex; align-items: center; gap: var(--space-4); }
.topbar-end { display: flex; align-items: center; gap: var(--space-3); }

.hamburger-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-md);
    transition: var(--transition);
}
.hamburger-btn:hover { background: var(--bg-elevated); color: var(--text-primary); }

.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 13px;
    color: var(--text-muted);
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--text-primary); }
.breadcrumb-sep { color: var(--text-dim); }
.breadcrumb-current { color: var(--text-primary); font-weight: 500; }

.topbar-actions { display: flex; align-items: center; gap: var(--space-2); }

.icon-btn {
    width: 36px; height: 36px;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
    text-decoration: none;
}
.icon-btn:hover {
    background: var(--bg-elevated);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

/* ── Topbar User Area (replaces inline styles) ── */
.topbar-user {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}
.topbar-user-info {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.topbar-avatar {
    width: 32px; height: 32px;
    border-radius: var(--radius-full);
    background: var(--brand-primary);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
    flex-shrink: 0;
}
.topbar-username {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}
.topbar-divider {
    width: 1px; height: 24px;
    background: var(--border);
}
.topbar-logout {
    color: var(--color-danger) !important;
    text-decoration: none;
}
.topbar-logout:hover { background: var(--color-danger-bg) !important; }

/* Keep backward-compat .user-menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    text-decoration: none;
    color: var(--text-primary);
}
.user-menu:hover { border-color: var(--border-hover); background: var(--bg-overlay); color: var(--text-primary); }
.user-avatar {
    width: 28px; height: 28px;
    background: var(--brand-primary);
    border-radius: var(--radius-full);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
    color: #fff; flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 500; }

/* ── H-07: Sidebar Collapsed Mini Mode ── */
.sidebar.collapsed {
    width: var(--sidebar-collapsed); /* 64px */
}
.sidebar.collapsed .brand-name,
.sidebar.collapsed .sidebar-label,
.sidebar.collapsed .nav-section-label {
    display: none;
}
.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: var(--space-2);
}
.sidebar.collapsed .nav-item .nav-icon {
    width: 36px; height: 36px;
    border-radius: var(--radius-md);
}
.sidebar.collapsed .sidebar-footer {
    padding: var(--space-3) var(--space-2);
}
.sidebar.collapsed .sidebar-brand {
    justify-content: center;
    padding: 0 var(--space-2);
}
.sidebar.collapsed .sidebar-collapse-btn { display: flex; }
.sidebar.collapsed + * + .main-content,
.main-content.sidebar-collapsed {
    margin-left: var(--sidebar-collapsed);
}
[dir="rtl"] .main-content.sidebar-collapsed {
    margin-left: 0;
    margin-right: var(--sidebar-collapsed);
}
/* Tooltip on collapsed sidebar items */
.sidebar.collapsed .nav-item { position: relative; }
.sidebar.collapsed .nav-item:hover::after {
    content: attr(title);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%; transform: translateY(-50%);
    background: var(--bg-overlay);
    color: var(--text-primary);
    padding: 4px 10px;
    border-radius: var(--radius-md);
    font-size: 12px;
    white-space: nowrap;
    border: 1px solid var(--border);
    z-index: 300;
    pointer-events: none;
}
[dir="rtl"] .sidebar.collapsed .nav-item:hover::after {
    left: auto; right: calc(100% + 8px);
}

/* ── Nav logout color ── */
.nav-logout { color: var(--color-danger) !important; }
.nav-logout .nav-icon { color: var(--color-danger) !important; }

/* ══════════════════════════════════════════════════════
   PWA — Install & Push Notification Cards
   ══════════════════════════════════════════════════════ */

/* Offline Banner */
.global-connectivity-banner {
    background: linear-gradient(90deg, #ef4444, #dc2626);
    color: #fff;
    text-align: center;
    padding: 8px 16px;
    font-weight: 500;
    font-size: 13px;
    position: sticky;
    top: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Base Card */
.pwa-install-card {
    position: fixed;
    bottom: 24px;
    left: 24px;
    background: var(--bg-surface, #0d1526);
    border: 1px solid var(--border, #1e3a5f);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(99,102,241,0.15);
    z-index: 9999;
    max-width: 360px;
    width: calc(100vw - 48px);
    animation: pwaSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* RTL flip */
html[dir=rtl] .pwa-install-card {
    right: 24px;
    left: auto;
}

/* Icon container */
.pwa-install-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(99,102,241,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Text block */
.pwa-install-info {
    flex: 1;
    min-width: 0;
}

.pwa-install-info h4 {
    margin: 0 0 4px 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary, #f8fafc);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pwa-install-info p {
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary, #94a3b8);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Actions */
.pwa-install-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.pwa-btn-primary {
    background: var(--brand-primary, #6366f1);
    color: #fff;
    border: none;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, transform 0.1s;
}
.pwa-btn-primary:hover {
    background: var(--brand-hover, #818cf8);
    transform: translateY(-1px);
}

.pwa-btn-outline {
    background: transparent;
    color: var(--text-secondary, #94a3b8);
    border: 1px solid var(--border, #334155);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color 0.15s, color 0.15s;
}
.pwa-btn-outline:hover {
    border-color: var(--text-muted, #64748b);
    color: var(--text-primary, #f8fafc);
}

/* Slide-up animation */
@keyframes pwaSlideUp {
    from { transform: translateY(120px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* Light mode overrides */
body.light-mode .pwa-install-card {
    background: #fff;
    border-color: #e2e8f0;
    box-shadow: 0 16px 48px rgba(0,0,0,0.12), 0 0 0 1px rgba(99,102,241,0.08);
}
body.light-mode .pwa-install-info h4 { color: #0f172a; }
body.light-mode .pwa-install-info p  { color: #64748b; }
body.light-mode .pwa-btn-outline     { border-color: #cbd5e1; color: #64748b; }

/* Mobile */
@media (max-width: 640px) {
    .pwa-install-card {
        bottom: 16px;
        right: 16px !important;
        left: 16px !important;
        max-width: none;
        width: calc(100vw - 32px);
        border-radius: 14px;
    }
}

/* ── M-03: Focus-visible on all interactive elements ── */
:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}
.btn:focus-visible,
.icon-btn:focus-visible,
.nav-item:focus-visible,
.page-btn:focus-visible,
.filter-select:focus-visible,
.form-control:focus-visible,
.search-box input:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

/* ── SweetAlert2 Dark Theme Override ── */
.swal2-popup.swal-custom-popup {
    background: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-xl) !important;
    box-shadow: var(--shadow-lg) !important;
}
.swal2-popup .swal2-title { color: var(--text-primary) !important; }
.swal2-popup .swal2-html-container { color: var(--text-secondary) !important; }
.swal2-popup .swal2-icon { border-color: var(--border) !important; }
.swal2-popup .swal-cancel-btn {
    background: var(--bg-elevated) !important;
    color: var(--text-secondary) !important;
    border: 1px solid var(--border) !important;
}
.swal2-popup .swal-cancel-btn:hover {
    background: var(--bg-overlay) !important;
    color: var(--text-primary) !important;
}


/* MAIN CONTENT */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
[dir="rtl"] .main-content { margin-left: 0; margin-right: var(--sidebar-width); }

.page-content {
    padding: var(--space-6);
    flex: 1;
}

/* PAGE HEADER */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-6);
    gap: var(--space-4);
    flex-wrap: wrap;
}
.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}
.page-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ── Cards ── */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    margin-bottom: var(--space-5);
    transition: var(--transition);
}
.card:hover { border-color: var(--border-hover); }
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border);
}
.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}
.card-body { /* default */ }

/* STAT CARDS */
.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 80px; height: 80px;
    border-radius: 0 0 0 80px;
    opacity: 0.06;
}
.stat-card:hover { border-color: var(--border-hover); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card .stat-icon {
    width: 42px; height: 42px;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
}
.stat-card .stat-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -1px;
    line-height: 1;
}
.stat-card .stat-change {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}
.stat-card.stat-primary .stat-icon { background: var(--brand-muted); color: var(--brand-primary); }
.stat-card.stat-success .stat-icon { background: var(--color-success-bg); color: var(--color-success); }
.stat-card.stat-warning .stat-icon { background: var(--color-warning-bg); color: var(--color-warning); }
.stat-card.stat-danger  .stat-icon { background: var(--color-danger-bg);  color: var(--color-danger); }
.stat-card.stat-info    .stat-icon { background: var(--color-info-bg);    color: var(--color-info); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-6); }

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 { color: var(--text-primary); font-weight: 600; line-height: 1.3; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.125rem; }
p { color: var(--text-secondary); line-height: 1.7; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.5;
    -webkit-user-select: none;
    user-select: none;
}
.btn:hover { text-decoration: none; }
.btn:focus-visible { outline: 2px solid var(--brand-primary); outline-offset: 2px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #fff;
}
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; box-shadow: 0 0 0 3px rgba(99,102,241,0.2); }

.btn-secondary {
    background: var(--bg-elevated);
    border-color: var(--border);
    color: var(--text-primary);
}
.btn-secondary:hover { background: var(--bg-overlay); border-color: var(--border-hover); color: var(--text-primary); }

.btn-outline {
    background: transparent;
    border-color: var(--border);
    color: var(--text-secondary);
}
.btn-outline:hover { background: var(--bg-elevated); border-color: var(--border-hover); color: var(--text-primary); }

.btn-success { background: var(--color-success); border-color: var(--color-success); color: #fff; }
.btn-success:hover { opacity: 0.88; color: #fff; }
.btn-danger  { background: var(--color-danger);  border-color: var(--color-danger);  color: #fff; }
.btn-danger:hover { opacity: 0.88; color: #fff; }
.btn-ghost { background: none; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-elevated); color: var(--text-primary); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }
.btn-xl { padding: 14px 28px; font-size: 16px; font-weight: 600; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; width: 36px; height: 36px; }

/* ── Forms ── */
.form-group { margin-bottom: var(--space-4); }
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}
.form-control {
    width: 100%;
    padding: 9px 12px;
    font-size: 14px;
    font-family: inherit;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: var(--transition);
    line-height: 1.5;
}
.form-control::placeholder { color: var(--text-dim); }
.form-control:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
    background: var(--bg-overlay);
}
.form-control:hover { border-color: var(--border-hover); }
select.form-control { appearance: none; cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.input-group {
    display: flex;
    gap: var(--space-2);
    align-items: stretch;
}
.input-group .form-control { flex: 1; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Form Sections */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-4); }
@media (max-width: 640px) {
    .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
}
.form-actions { display: flex; align-items: center; gap: var(--space-3); margin-top: var(--space-5); padding-top: var(--space-5); border-top: 1px solid var(--border); }

/* ── Tables ── */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-lg);
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
thead { position: sticky; top: 0; z-index: 1; }
thead tr { background: var(--bg-elevated); }
th {
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    text-align: inherit;
}
td {
    padding: 12px 14px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tbody tr { transition: var(--transition); }
tbody tr:hover td { background: var(--bg-elevated); color: var(--text-primary); }
.table-mono { font-family: 'Courier New', monospace; font-size: 12px; }

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}
.badge-primary { background: var(--brand-muted); color: var(--brand-primary); }
.badge-success { background: var(--color-success-bg); color: var(--color-success); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-danger  { background: var(--color-danger-bg);  color: var(--color-danger); }
.badge-info    { background: var(--color-info-bg);    color: var(--color-info); }
.badge-muted   { background: var(--bg-elevated); color: var(--text-muted); }
.badge-dot::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: var(--radius-full);
    background: currentColor;
}

/* ── Alerts ── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    border: 1px solid transparent;
}
.alert-success { background: var(--color-success-bg); color: var(--color-success); border-color: rgba(16,185,129,0.2); }
.alert-error   { background: var(--color-danger-bg);  color: var(--color-danger);  border-color: rgba(239,68,68,0.2); }
.alert-warning { background: var(--color-warning-bg); color: var(--color-warning); border-color: rgba(245,158,11,0.2); }
.alert-info    { background: var(--color-info-bg);    color: var(--color-info);    border-color: rgba(59,130,246,0.2); }

/* ── Toast Notifications ── */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
[dir="rtl"] #toast-container { right: auto; left: 24px; }
.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    max-width: 360px;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: auto;
}
[dir="rtl"] .toast { transform: translateX(-120%); }
.toast.show { transform: translateX(0); opacity: 1; }
.toast::before {
    content: '';
    width: 4px;
    height: 100%;
    position: absolute;
    left: 0; top: 0;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
.toast.success::before { background: var(--color-success); }
.toast.error::before   { background: var(--color-danger); }

/* ── Scanner Modal ── */
.scanner-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(8px);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s ease;
}
.scanner-modal.active { display: flex; }
.scanner-content {
    width: 90%;
    max-width: 480px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    text-align: center;
    box-shadow: var(--shadow-lg);
}
.scanner-content h3 { margin-bottom: var(--space-4); }
#reader { border-radius: var(--radius-lg); overflow: hidden; background: #000; }

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: var(--space-16) var(--space-6);
    color: var(--text-muted);
}
.empty-state svg { width: 48px; height: 48px; margin: 0 auto var(--space-4); opacity: 0.4; }
.empty-state h3 { font-size: 16px; color: var(--text-secondary); margin-bottom: var(--space-2); }
.empty-state p { font-size: 14px; }

/* ── Loading Skeleton ── */
.skeleton {
    background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-overlay) 50%, var(--bg-elevated) 75%);
    background-size: 400% 100%;
    animation: skeleton-wave 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}
@keyframes skeleton-wave {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Utilities ── */
.container { max-width: 1280px; margin: 0 auto; padding: 0 var(--space-6); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.grid { display: grid; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--color-success); }
.text-danger  { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }
.font-bold { font-weight: 700; }
.font-mono { font-family: 'Courier New', monospace; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }
.w-100 { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Animations ── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideInRight {
    from { transform: translateX(20px); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}
.animate-fade-in { animation: fadeIn 0.3s ease forwards; }

/* ── Mobile Sidebar Overlay ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 150;
    backdrop-filter: blur(4px);
}
.sidebar-overlay.active { display: block; }

/* ══════════════════════════════════════════════════
   FILTER BAR — Search + Filters above tables
   ══════════════════════════════════════════════════ */
.filter-bar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    background: var(--bg-surface);
}
.filter-bar-start { display: flex; align-items: center; gap: var(--space-3); flex: 1; flex-wrap: wrap; }
.filter-bar-end   { display: flex; align-items: center; gap: var(--space-2); flex-shrink: 0; }

.search-box {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 360px;
}
.search-box-icon {
    position: absolute;
    inset-inline-start: 12px;
    top: 50%; transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    display: flex;
}
.search-box input {
    width: 100%;
    padding: 9px 12px 9px 36px;
    font-size: 14px;
    font-family: inherit;
    background: var(--bg-elevated);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: var(--transition);
}
[dir="rtl"] .search-box input { padding: 9px 36px 9px 12px; }
.search-box input::placeholder { color: var(--text-dim); }
.search-box input:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
    background: var(--bg-overlay);
}

.filter-select {
    padding: 9px 12px;
    font-size: 13px;
    font-family: inherit;
    background: var(--bg-elevated);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: var(--transition);
    cursor: pointer;
    min-width: 120px;
}
.filter-select:focus { outline: none; border-color: var(--brand-primary); }

/* ── Pagination ── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4);
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
    gap: var(--space-3);
}
.pagination-info {
    font-size: 13px;
    color: var(--text-muted);
}
.pagination-controls {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}
.page-btn {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-family: inherit;
}
.page-btn:hover { background: var(--bg-overlay); color: var(--text-primary); border-color: var(--border-hover); }
.page-btn.active { background: var(--brand-primary); border-color: var(--brand-primary); color: #fff; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ══════════════════════════════════════════════════
   TABLE → CARD MODE (H-02)
   On ≤640px, tables transform into stacked cards
   ══════════════════════════════════════════════════ */
@media (max-width: 640px) {
    /* Hide desktop table header */
    .responsive-table thead { display: none; }

    /* Each row becomes a card */
    .responsive-table,
    .responsive-table tbody,
    .responsive-table tr {
        display: block;
        width: 100%;
    }

    .responsive-table tr {
        background: var(--bg-surface);
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        margin-bottom: var(--space-3);
        padding: var(--space-3);
        position: relative;
    }
    .responsive-table tbody tr:hover td { background: transparent; }

    /* Each cell: show label via data-label attr */
    .responsive-table td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 7px 4px;
        border-bottom: 1px solid var(--border);
        font-size: 13px;
        gap: var(--space-2);
    }
    .responsive-table td:last-child { border-bottom: none; }
    .responsive-table td::before {
        content: attr(data-label);
        font-size: 10px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: var(--text-dim);
        flex-shrink: 0;
        min-width: 80px;
    }

    /* Hide columns marked as mobile-hidden */
    .responsive-table td.mobile-hidden { display: none; }

    /* Actions cell: full width row */
    .responsive-table td.td-actions {
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: var(--space-2);
    }
    .responsive-table td.td-actions::before { display: none; }

    /* Wrapper: no horizontal scroll needed */
    .table-wrapper { border-radius: var(--radius-lg); }
}

/* ══════════════════════════════════════════════════
   MAIN RESPONSIVE SYSTEM
   ══════════════════════════════════════════════════ */

/* ── 1024px: Hide sidebar, show hamburger ── */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    [dir="rtl"] .sidebar { transform: translateX(100%); }
    .sidebar.open { transform: translateX(0) !important; }
    .main-content { margin-left: 0 !important; margin-right: 0 !important; }
    .hamburger-btn { display: flex !important; }
    .page-content { padding: var(--space-4); }
}

/* ── 768px: Tablet Portrait ── */
@media (max-width: 768px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .form-grid-2 { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; gap: var(--space-3); }
    .page-header > * { width: 100%; }
    .page-header .btn { align-self: flex-start; width: auto; }
    .topbar { padding: 0 var(--space-4); }
    th, td { padding: 10px; }
    .filter-bar { padding: var(--space-3); gap: var(--space-2); }
    .search-box { max-width: 100%; }
    .pagination { flex-direction: column; align-items: flex-start; }
}

/* ── 640px: Large Phones ── */
@media (max-width: 640px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-2); }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .filter-bar-start, .filter-bar-end { width: 100%; }
    .search-box { max-width: 100%; min-width: 0; }
    .filter-select { width: 100%; }
}

/* ── 480px: Standard Phones ── */
@media (max-width: 480px) {
    .stat-grid { grid-template-columns: 1fr; }
    .page-content { padding: var(--space-3); }
    .btn-lg { padding: 9px 16px; font-size: 14px; }
    .pagination-controls .page-btn { width: 28px; height: 28px; font-size: 12px; }
}

/* ── 375px: Small Phones ── */
@media (max-width: 375px) {
    .page-content { padding: var(--space-2); }
    .stat-grid { gap: var(--space-2); }
    .card { border-radius: var(--radius-lg); }
}

/* ── Auth Layout ── */
.auth-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-base);
    padding: var(--space-6);
    position: relative;
    overflow: hidden;
}
.auth-layout::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99,102,241,0.12) 0%, transparent 70%);
    top: -200px; right: -200px;
}
.auth-layout::after {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99,102,241,0.08) 0%, transparent 70%);
    bottom: -100px; left: -100px;
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 1;
}
.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-6);
}
.auth-logo-icon {
    width: 48px; height: 48px;
    background: var(--brand-primary);
    border-radius: var(--radius-lg);
    display: flex; align-items: center; justify-content: center;
    color: #fff;
}
.auth-title {
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 4px;
}
.auth-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: var(--space-6);
}

/* ══════════════════════════════════════════════════════════════
   M-01 — LOGIN PAGE CSS (moved from inline <style> to here)
   ══════════════════════════════════════════════════════════════ */

.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 70px);
    padding: 40px 20px;
}
.login-card {
    width: 100%;
    max-width: 420px;
    background: rgba(255,255,255,0.04);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-xl);
    padding: 44px 40px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.5);
    position: relative;
    overflow: hidden;
}
.login-card::before {
    content: '';
    position: absolute;
    top: -1px; left: -1px; right: -1px; bottom: -1px;
    background: linear-gradient(135deg, rgba(99,102,241,0.3), rgba(254,203,0,0.15), transparent 60%);
    border-radius: calc(var(--radius-xl) + 1px);
    z-index: -1;
}
/* Light mode login card */
body.light-mode .login-card {
    background: rgba(255,255,255,0.85);
    border-color: rgba(0,0,0,0.08);
    box-shadow: 0 24px 60px rgba(0,0,0,0.12);
}
.login-logo {
    width: 52px; height: 52px;
    background: linear-gradient(135deg, var(--brand-primary), #818cf8);
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 8px 20px rgba(99,102,241,0.35);
}
.login-logo svg { width: 26px; height: 26px; color: #fff; }
.login-title {
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.login-subtitle {
    text-align: center;
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 28px;
}
.login-alert {
    padding: 11px 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.login-alert.error   { background: var(--color-danger-bg);  border: 1px solid rgba(239,68,68,0.3);   color: #fca5a5; }
.login-alert.success { background: var(--color-success-bg); border: 1px solid rgba(16,185,129,0.3);  color: #6ee7b7; }
.login-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.login-input {
    width: 100%;
    padding: 11px 14px;
    font-size: 14px;
    font-family: inherit;
    background: rgba(0,0,0,0.25);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: var(--transition);
    box-sizing: border-box;
}
body.light-mode .login-input {
    background: rgba(0,0,0,0.04);
    color: var(--text-primary);
}
.login-input::placeholder { color: var(--text-muted); }
.login-input:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--brand-muted);
}
.login-form-group { margin-bottom: 18px; }
.login-btn {
    width: 100%;
    padding: 13px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    background: linear-gradient(135deg, var(--brand-primary), #818cf8);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    margin-top: 8px;
    box-shadow: 0 4px 15px rgba(99,102,241,0.35);
}
.login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(99,102,241,0.45);
}
.login-btn:active { transform: translateY(0); }
.login-btn:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 3px;
}
.login-footer {
    text-align: center;
    margin-top: 22px;
    font-size: 13px;
    color: var(--text-muted);
}
.login-footer a { color: var(--brand-accent); font-weight: 500; text-decoration: none; }
.login-footer a:hover { text-decoration: underline; }
.login-lang {
    text-align: center;
    margin-top: 14px;
}
.login-lang a {
    font-size: 12px;
    color: var(--text-dim);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: var(--transition);
}
.login-lang a:hover { color: var(--text-secondary); }

/* ── Login Responsive ── */
@media (max-width: 480px) {
    .login-wrapper { padding: 20px 12px; }
    .login-card    { padding: 32px 24px; border-radius: var(--radius-lg); }
    .login-title   { font-size: 20px; }
}
@media (max-width: 375px) {
    .login-card  { padding: 24px 16px; border-radius: var(--radius-lg); }
    .login-input { padding: 10px 12px; font-size: 15px; }
    .login-btn   { padding: 12px; font-size: 14px; }
}

/* ══════════════════════════════════════════════════════════════
   PHASE 6 — ANIMATIONS & MICRO-INTERACTIONS
   ══════════════════════════════════════════════════════════════ */

/* ── Nav Item Active Indicator Bar (Phase 6) ── */
.nav-item.active {
    position: relative;
}
.nav-item.active::before {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    top: 20%;
    height: 60%;
    width: 3px;
    background: var(--brand-primary);
    border-radius: 0 3px 3px 0;
}
[dir="rtl"] .nav-item.active::before {
    border-radius: 3px 0 0 3px;
}

/* ── Card Hover Lift (Phase 6) ── */
.card-hover {
    transition: transform 0.25s cubic-bezier(0.4,0,0.2,1),
                box-shadow 0.25s cubic-bezier(0.4,0,0.2,1),
                border-color 0.25s ease;
}
.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 40px rgba(0,0,0,0.35);
    border-color: var(--border-hover);
}

/* ── Stat Card Hover Glow ── */
.stat-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ── Button Press Micro-animation ── */
.btn:active:not(:disabled) {
    transform: scale(0.97);
}
.btn-primary:active:not(:disabled) {
    box-shadow: 0 2px 8px rgba(99,102,241,0.3);
}

/* ── Cart Item Slide-in Animation (Phase 6) ── */
@keyframes cartSlideIn {
    from {
        opacity: 0;
        transform: translateX(16px);
        max-height: 0;
    }
    to {
        opacity: 1;
        transform: translateX(0);
        max-height: 200px;
    }
}
@keyframes cartSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
        max-height: 200px;
    }
    to {
        opacity: 0;
        transform: translateX(-16px);
        max-height: 0;
    }
}
.cart-item-enter { animation: cartSlideIn 0.25s cubic-bezier(0.4,0,0.2,1) both; }
.cart-item-exit  { animation: cartSlideOut 0.2s ease both; }

/* ── Payment Method Selection Pulse (Phase 6) ── */
@keyframes payPulse {
    0%   { box-shadow: 0 0 0 0 rgba(99,102,241,0.4); }
    70%  { box-shadow: 0 0 0 8px rgba(99,102,241,0); }
    100% { box-shadow: 0 0 0 0 rgba(99,102,241,0); }
}
.payment-method-btn.active,
.method-btn.active {
    animation: payPulse 0.5s ease;
}

/* ── Page Content Fade In (Phase 6) ── */
@keyframes pageIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.page-content {
    animation: pageIn 0.3s ease both;
}

/* ── Toast Slide In ── */
@keyframes toastIn {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}
.toast.show {
    animation: toastIn 0.3s cubic-bezier(0.4,0,0.2,1) both;
}

/* ── Filter Bar slide open ── */
@keyframes filterIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.filter-bar { animation: filterIn 0.2s ease both; }

/* ══════════════════════════════════════════════════════════════
   PHASE 7 — RTL / MARGIN-INLINE FIXES
   ══════════════════════════════════════════════════════════════ */

/* ── RTL-safe spacing utilities ── */
.ms-auto { margin-inline-start: auto; }
.me-auto { margin-inline-end:   auto; }
.ps-4    { padding-inline-start: var(--space-4); }
.pe-4    { padding-inline-end:   var(--space-4); }

/* ── Badge RTL margin fix ── */
.badge + .badge { margin-inline-start: var(--space-1); }

/* ── Pagination RTL ── */
[dir="rtl"] .pagination-controls { flex-direction: row-reverse; }

/* ── Table actions RTL ── */
[dir="rtl"] .td-actions { text-align: start; }

/* ── Filter bar RTL ── */
[dir="rtl"] .filter-bar-end { margin-inline-start: 0; margin-inline-end: auto; }

/* ── Search box icon RTL ── */
[dir="rtl"] .search-box-icon {
    left: auto;
    right: var(--space-3);
}
[dir="rtl"] .search-box input {
    padding-left:  var(--space-3);
    padding-right: calc(var(--space-3) * 2 + 15px);
}

/* ── Topbar RTL ── */
[dir="rtl"] .topbar-start { flex-direction: row-reverse; }
[dir="rtl"] .topbar-end   { flex-direction: row-reverse; }
[dir="rtl"] .breadcrumb   { flex-direction: row-reverse; }

/* ── Sidebar brand RTL collapse fix ── */
[dir="rtl"] .sidebar.collapsed .nav-item:hover::after {
    left: auto;
    right: calc(100% + 8px);
}

/* ══════════════════════════════════════════════════════════════
   PHASE 4 — PERFORMANCE: 4K MAX-WIDTH CONSTRAINT
   ══════════════════════════════════════════════════════════════ */

/* H-05: 4K / Large screen max-width */
@media (min-width: 1920px) {
    .page-content {
        max-width: 1600px;
        margin-left:  auto;
        margin-right: auto;
        width: 100%;
    }
    .stat-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}
@media (min-width: 2560px) {
    .page-content { max-width: 2000px; }
}

/* ══════════════════════════════════════════════════════════════
   PHASE 5 — ACCESSIBILITY: REDUCED MOTION
   ══════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration:   0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration:  0.01ms !important;
        scroll-behavior: auto !important;
    }
    .skeleton { animation: none; background: var(--bg-elevated); }
    .stat-card { animation: none; }
    .page-content { animation: none; }
    .filter-bar { animation: none; }
    .toast.show { animation: none; }
}

/* ══════════════════════════════════════════════════════════════
   PRINT OPTIMIZATIONS
   ══════════════════════════════════════════════════════════════ */

@media print {
    .sidebar,
    .topbar,
    .hamburger-btn,
    .filter-bar,
    .pagination,
    .btn-primary,
    .btn-outline,
    .icon-btn,
    #toast-container,
    .sidebar-overlay { display: none !important; }

    .main-content {
        margin: 0 !important;
        padding: 0 !important;
    }
    .page-content { padding: 0 !important; }
    .card {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
        break-inside: avoid;
    }
    body { background: #fff !important; color: #000 !important; }
    a    { color: #000 !important; }
    .badge { border: 1px solid #ccc !important; background: transparent !important; color: #000 !important; }
}
/ *   P W A   C o r e   S t y l e s   * / . g l o b a l - c o n n e c t i v i t y - b a n n e r { b a c k g r o u n d : # e f 4 4 4 4 ; c o l o r : # f f f ; t e x t - a l i g n : c e n t e r ; p a d d i n g : 6 p x   1 2 p x ; f o n t - w e i g h t : 5 0 0 ; f o n t - s i z e : 1 3 p x ; p o s i t i o n : s t i c k y ; t o p : 0 ; z - i n d e x : 9 9 9 9 ; d i s p l a y : f l e x ; a l i g n - i t e m s : c e n t e r ; j u s t i f y - c o n t e n t : c e n t e r ; g a p : 8 p x } . p w a - i n s t a l l - c a r d { p o s i t i o n : f i x e d ; b o t t o m : 2 4 p x ; l e f t : 2 4 p x ; b a c k g r o u n d : v a r ( - - b g - c a r d , # 1 e 2 9 3 b ) ; b o r d e r : 1 p x   s o l i d   v a r ( - - b o r d e r , # 3 3 4 1 5 5 ) ; b o r d e r - r a d i u s : 1 2 p x ; p a d d i n g : 1 6 p x ; d i s p l a y : f l e x ; a l i g n - i t e m s : c e n t e r ; g a p : 1 6 p x ; b o x - s h a d o w : 0   1 0 p x   2 5 p x   r g b a ( 0 , 0 , 0 , 0 . 3 ) ; z - i n d e x : 9 9 9 9 ; a n i m a t i o n : s l i d e U p P w a   . 4 s   c u b i c - b e z i e r ( . 1 6 , 1 , . 3 , 1 )   f o r w a r d s ; m a x - w i d t h : 3 8 0 p x } h t m l [ d i r = r t l ]   . p w a - i n s t a l l - c a r d { r i g h t : 2 4 p x ; l e f t : a u t o } . p w a - i n s t a l l - i n f o   h 4 { m a r g i n : 0   0   4 p x   0 ; f o n t - s i z e : 1 5 p x ; c o l o r : v a r ( - - t e x t - p r i m a r y , # f 8 f a f c ) ; f o n t - w e i g h t : 7 0 0 } . p w a - i n s t a l l - i n f o   p { m a r g i n : 0 ; f o n t - s i z e : 1 3 p x ; c o l o r : v a r ( - - t e x t - s e c o n d a r y , # 9 4 a 3 b 8 ) ; l i n e - h e i g h t : 1 . 4 } . p w a - i n s t a l l - a c t i o n s { d i s p l a y : f l e x ; g a p : 8 p x ; f l e x - s h r i n k : 0 } . p w a - b t n - p r i m a r y { b a c k g r o u n d : v a r ( - - c o l o r - p r i m a r y , # 6 3 6 6 f 1 ) ; c o l o r : # f f f ; b o r d e r : n o n e ; p a d d i n g : 6 p x   1 2 p x ; b o r d e r - r a d i u s : 6 p x ; f o n t - s i z e : 1 2 p x ; c u r s o r : p o i n t e r } . p w a - b t n - o u t l i n e { b a c k g r o u n d : t r a n s p a r e n t ; c o l o r : v a r ( - - t e x t - s e c o n d a r y , # 9 4 a 3 b 8 ) ; b o r d e r : 1 p x   s o l i d   v a r ( - - b o r d e r , # 3 3 4 1 5 5 ) ; p a d d i n g : 6 p x   1 2 p x ; b o r d e r - r a d i u s : 6 p x ; f o n t - s i z e : 1 2 p x ; c u r s o r : p o i n t e r } @ k e y f r a m e s   s l i d e U p P w a { f r o m { t r a n s f o r m : t r a n s l a t e Y ( 1 0 0 p x ) ; o p a c i t y : 0 } t o { t r a n s f o r m : t r a n s l a t e Y ( 0 ) ; o p a c i t y : 1 } } @ m e d i a   ( m a x - w i d t h : 6 4 0 p x ) { . p w a - i n s t a l l - c a r d { b o t t o m : 1 6 p x ; r i g h t : 1 6 p x ! i m p o r t a n t ; l e f t : 1 6 p x ! i m p o r t a n t ; m a x - w i d t h : n o n e } }  
 