:root {
    --primary-color: #2740cc;
    --primary-dark: #1e30a0;
    --secondary-color: #4f46e5;
    --accent-color: #8b5cf6;
    --text-main: #1e293b;
    --text-dim: #4b5563;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shine: rgba(255, 255, 255, 0.8);
    --sidebar-bg: rgba(255, 255, 255, 0.85);

    /* Z-Index Scale */
    --z-sidebar: 100;
    --z-sidebar-mobile: 200;
    --z-cart-mobile: 300;
    --z-modal: 400;
    --z-toast: 500;
    --z-overlay: 600;

    /* Type Scale */
    --text-xs: 0.75rem;
    --text-sm: 0.85rem;
    --text-base: 1rem;
    --text-lg: 1.15rem;
    --text-xl: 1.4rem;
    --text-2xl: 1.8rem;
}

/* Screen reader only - visually hidden but accessible */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus visible for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
}

body {
    background-color: #f8fafc;
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Dynamic Background */
.background-mesh {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background: radial-gradient(circle at 10% 20%, rgba(39, 64, 204, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(39, 64, 204, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, #ffffff 0%, #f1f5f9 100%);
    filter: blur(60px);
}

.dashboard-container,
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Glassmorphism Common Class */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
    border-radius: 20px;
}

/* Sidebar */
/* Sidebar - Responsive Logic */
.sidebar {
    width: 280px;
    height: 100vh;
    position: fixed;
    top: 0;
    right: 0;
    /* RTL default */
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    padding: 30px 20px;
    z-index: var(--z-sidebar-mobile);
    transform: translateX(100%);
    /* Hidden on Mobile by default */
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.1);
}

/* Desktop: Always Show Sidebar */
@media (min-width: 900px) {
    .sidebar {
        position: sticky;
        transform: none !important;
        box-shadow: none;
        border-inline-end: 1px solid rgba(0, 0, 0, 0.05);
        height: 100vh;
        z-index: var(--z-sidebar);
        width: 280px;
        display: flex !important;
    }
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.logo i {
    color: var(--secondary-color);
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-grow: 1;
}

.nav-item {
    text-decoration: none;
    color: var(--text-dim);
    padding: 9px 15px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
    font-size: 0.93rem;
}

.nav-item:hover,
.nav-item.active {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transform: translateX(-5px);
}

.nav-badge {
    background: #10b981;
    color: white;
    border-radius: 10px;
    font-size: 0.7rem;
    padding: 1px 6px;
    margin-inline-start: 4px;
    font-weight: 700;
}

.nav-item i {
    width: 25px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
    padding-top: 20px;
    border-top: 1px solid var(--glass-border);
}

.avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-info .name {
    font-weight: 600;
    font-size: 0.95rem;
}

.user-info .role {
    font-size: 0.8rem;
    color: var(--text-dim);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 100%;
}

.header {
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.welcome-text h1 {
    font-size: 1.8rem;
    margin-bottom: 5px;
    color: var(--text-main);
}

.welcome-text p {
    color: var(--text-dim);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-actions .platform-btn {
    width: auto;
    white-space: nowrap;
    padding: 10px 18px;
    font-size: var(--text-sm);
}

.shift-badge {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.logout-btn {
    background: transparent;
    border: 1px solid #fee2e2;
    color: #ef4444;
    padding: 8px 20px;
    border-radius: 10px;
    cursor: pointer;
    transition: 0.3s;
    font-family: 'Cairo', sans-serif;
    text-decoration: none;
    display: inline-block;
}

.logout-btn:hover {
    background: #fef2f2;
}

/* Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.card {
    padding: 30px;
    border-radius: 24px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    background: white;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(39, 64, 204, 0.1);
}

.icon-wrapper {
    width: 60px;
    height: 60px;
    border-radius: 18px;
    background: rgba(39, 64, 204, 0.1);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.icon-wrapper.secondary {
    background: rgba(236, 72, 153, 0.1);
    color: #ec4899;
}

.icon-wrapper.accent {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.card h3 {
    font-size: 1.4rem;
    color: var(--text-main);
}

.card p {
    color: var(--text-dim);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Primary Card Special */
.card.primary {
    background: linear-gradient(135deg, white, #f8fafc);
    border: 1px solid rgba(39, 64, 204, 0.2);
}

.btn {
    padding: 10px 25px;
    border-radius: 12px;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    transition: 0.3s;
    font-weight: 600;
    font-family: 'Cairo', sans-serif;
    text-align: center;
    display: inline-block;
    text-decoration: none;
}

.btn-glow {
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: 0 5px 15px rgba(39, 64, 204, 0.3);
    margin-top: auto;
    width: 100%;
}

.btn-glow:hover {
    box-shadow: 0 8px 25px rgba(39, 64, 204, 0.4);
    transform: scale(1.02);
}

.btn-outline {
    background: white;
    border: 1px solid var(--text-dim);
    color: var(--text-main);
}

.btn-outline:hover {
    background: #f1f5f9;
}

/* Info Panel */
.info-panel {
    grid-column: 1 / -1;
    padding: 25px;
    margin-top: 20px;
    background: white;
}

.info-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    color: #10b981;
}

.info-body {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.info-body p {
    color: var(--text-dim);
    max-width: 600px;
}

.actions-row {
    display: flex;
    gap: 10px;
}

/* Auth Pages & Forms */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 450px;
    padding: 40px;
    text-align: center;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05);
}

.auth-card h1 {
    margin-bottom: 10px;
    color: var(--primary-color);
}

.auth-card .lead {
    margin-bottom: 30px;
    color: var(--text-dim);
}

.form-group {
    margin-bottom: 20px;
    text-align: start;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-dim);
    font-size: 0.9rem;
    font-weight: 600;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
    transition: 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(39, 64, 204, 0.1);
}

.form-group select {
    width: 100%;
    padding: 12px 15px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: var(--text-main);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: 0.3s;
    cursor: pointer;
}

.form-actions {
    margin-top: 30px;
}

.platform-btn {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    border: none;
    background: var(--primary-color);
    color: white;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
}

.platform-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(39, 64, 204, 0.2);
}
.platform-btn.secondary {
    background: white;
    color: var(--primary-color);
    border: 1.5px solid var(--primary-color);
}
.platform-btn.secondary:hover {
    background: #eef2ff;
    box-shadow: 0 4px 12px rgba(39, 64, 204, 0.12);
}

/* Activity Page */
.activity-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 30px;
    text-align: start;
}

.activity-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 15px;
    border-radius: 15px;
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.activity-card:hover {
    background: white;
    border-color: var(--primary-color);
}

.activity-card.selected {
    background: rgba(39, 64, 204, 0.05);
    border-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: bold;
}

.activity-card input {
    accent-color: var(--primary-color);
}

/* Alerts */
.alert {
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.alert.error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.alert.success {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

/* Simple Nav */
.simple-nav {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 15px;
    font-size: 0.9rem;
}

.simple-nav a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

/* Responsiveness — Tablet (600-900px) */
@media (max-width: 900px) and (min-width: 601px) {
    .welcome-text h1 {
        font-size: 1.4rem;
    }

    .header {
        padding: 15px 20px;
    }

    .main-content {
        padding: 16px;
        gap: 16px;
    }

    .actions-panel h2 { font-size: var(--text-lg); }
}

/* Responsiveness — Small mobile (< 600px) */
@media (max-width: 600px) {
    .welcome-text h1 {
        font-size: 1.2rem;
    }

    .welcome-text p {
        font-size: 0.8rem;
    }

    .header {
        padding: 12px 16px;
    }

    .main-content {
        padding: 12px;
        gap: 14px;
    }

    /* Dashboard stat cards */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .stat-card { padding: 12px 14px; gap: 10px; }
    .stat-card .sc-icon { width: 34px; height: 34px; font-size: var(--text-sm); }
    .stat-card .sc-value { font-size: 1.05rem; }
    .stat-card .sc-label { font-size: 0.72rem; }
    .actions-panel { padding: 16px; gap: 12px; border-radius: 16px; }
    .actions-panel h2 { font-size: 1.1rem; }
    .actions-panel p { font-size: 0.82rem; }
    .history-panel { padding: 16px; border-radius: 16px; }
    .history-panel th, .history-panel td { padding: 10px 8px; font-size: 0.82rem; }
}

/* Responsiveness — Extra small (< 380px) */
@media (max-width: 380px) {
    .stats-grid { grid-template-columns: 1fr; }
    .stat-card .sc-value { font-size: var(--text-base); }
    .actions-panel h2 { font-size: var(--text-base); }
}

/* Responsiveness — Landscape phones (short viewport) */
@media (max-height: 500px) and (orientation: landscape) {
    .main-content {
        padding: 10px 16px;
        gap: 10px;
    }

    .header {
        padding: 8px 16px;
    }

    .welcome-text h1 {
        font-size: 1.1rem;
        margin-bottom: 0;
    }

    .welcome-text p {
        font-size: 0.75rem;
    }

    .sidebar {
        padding: 16px 14px;
    }

    .sidebar .logo {
        font-size: 1.3rem;
        margin-bottom: 10px;
    }

    .nav-item {
        padding: 6px 12px;
        font-size: 0.85rem;
    }

    .modal-content {
        max-height: 90vh;
        overflow-y: auto;
        padding: 20px;
    }

    /* Dashboard landscape */
    .stats-section { margin-bottom: 14px; }
    .stats-grid { gap: 8px; }
    .stat-card { padding: 10px 14px; gap: 10px; }
    .stat-card .sc-icon { width: 32px; height: 32px; font-size: 0.8rem; }
    .stat-card .sc-value { font-size: var(--text-base); }
    .actions-panel { padding: 14px; gap: 10px; margin-bottom: 14px; }
    .actions-panel h2 { font-size: var(--text-base); }
    .history-panel { padding: 14px; }
    .history-panel th, .history-panel td { padding: 8px 6px; font-size: 0.8rem; }
}

/* Responsiveness — unified breakpoint: 1024px */
@media (max-width: 1024px) {

    .dashboard-container,
    .app-layout {
        flex-direction: column;
    }

    /* Mobile Sidebar Logic */
    .sidebar {
        width: 280px;
        height: 100vh;
        position: fixed;
        top: 0;
        right: 0;
        /* RTL default */
        background: var(--sidebar-bg);
        display: flex;
        flex-direction: column;
        padding: 30px 20px;
        z-index: var(--z-sidebar-mobile);
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .sidebar.active {
        transform: translateX(0);
        /* Show on toggle */
    }

    .nav-links {
        display: flex;
        /* Always flex in column mode inside sidebar */
        overflow-x: visible;
        width: 100%;
        position: static;
        padding: 0;
        background: transparent;
        box-shadow: none;
    }

    .logo {
        margin-bottom: 20px;
    }

    .main-content {
        padding: 15px;
        padding-bottom: 80px;
    }

    .content-grid {
        grid-template-columns: 1fr;
    }
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--z-modal);
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    opacity: 1;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.modal.show .modal-content {
    transform: translateY(0);
}

button.close-modal {
    position: absolute;
    top: 12px;
    inset-inline-end: 16px;
    background: none;
    border: none;
    font-size: 1.8rem;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
}
button.close-modal:hover,
button.close-modal:focus-visible {
    background: #f1f5f9;
    color: #1e293b;
}

/* Status Badges */
.shift-badge.success {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.shift-badge.warning {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.badge-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    position: absolute;
    top: 10px;
    inset-inline-end: 10px;
    box-shadow: 0 0 0 2px white;
}

.active-shift {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

/* Action Buttons Grid (Equal Sizing) */
.action-buttons-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 15px;
}

.big-btn.primary-btn {
    flex: 1;
    background: white;
    color: var(--primary-color);
    text-align: center;
    justify-content: center;
}

.big-btn.secondary-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    text-align: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.big-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

@media (max-width: 480px) {
    .action-buttons-grid {
        gap: 10px;
    }
    .action-buttons-grid .big-btn {
        flex: 1 1 100%;
        font-size: 0.95rem;
        padding: 11px 16px;
    }
}

/* ========================================
   Dashboard (sales.php) — Base Rules
   ======================================== */

/* Stat Cards */
.stats-section { margin-bottom: 24px; }
.section-label {
    font-size: var(--text-xs);
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 12px 0;
    padding: 0 4px;
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
}
.stat-card {
    background: white;
    border-radius: 14px;
    padding: 16px 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    display: flex;
    align-items: center;
    gap: 14px;
    border-inline-start: 4px solid var(--card-accent, #6366f1);
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.07);
}
.stat-card .sc-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: var(--text-base);
    background: var(--icon-bg, #eef2ff);
    color: var(--card-accent, #6366f1);
}
.stat-card .sc-label {
    font-size: var(--text-xs);
    color: #64748b;
    margin-bottom: 2px;
}
.stat-card .sc-value {
    font-size: var(--text-xl);
    font-weight: 800;
    color: #1e293b;
}
.stat-card .sc-value .unit {
    font-size: 0.72rem;
    font-weight: 600;
    color: #94a3b8;
}
.stat-card .sc-value--sm {
    font-size: var(--text-lg);
}

/* Shift Banner */
.actions-panel {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 20px;
    border-radius: 20px;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
    box-shadow: 0 10px 30px rgba(39, 64, 204, 0.2);
}
.shift-info h2 {
    margin: 0 0 6px 0;
}
.shift-info .emp-name {
    margin: 0 0 4px;
    font-weight: 700;
    font-size: 1.05rem;
}
.shift-info p {
    margin: 0;
    opacity: 0.9;
}
.big-btn {
    background: white;
    color: var(--primary-color);
    padding: 12px 30px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: bold;
    font-size: var(--text-lg);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: 0.3s;
    border: none;
    cursor: pointer;
}

/* History Panel */
.history-panel {
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.history-header h3 { margin: 0; }
.table-responsive { overflow-x: auto; }
.history-panel table { width: 100%; border-collapse: collapse; }
.history-panel th { text-align: start; padding: 15px; color: var(--text-dim); font-size: var(--text-sm); }
.history-panel td { padding: 15px; border-top: 1px solid #f1f5f9; }
.status-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: var(--text-sm);
    font-weight: bold;
}
.status-closed { background: #fee2e2; color: #ef4444; }
.status-open { background: #dcfce7; color: #16a34a; }

/* Shift Summary (close modal) */
.shift-summary {
    background: #f8fafc;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
}
.shift-summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}
.shift-summary-total {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid #e2e8f0;
    padding-top: 10px;
    margin-top: 10px;
    font-size: var(--text-lg);
}

/* Diff Display */
.diff-section { text-align: center; margin-bottom: 20px; }
.diff-label { color: #64748b; }
.diff-value {
    font-size: 1.5rem;
    font-weight: bold;
    unicode-bidi: plaintext;
}
.text-positive { color: green; }
.text-negative { color: red; }

/* Modal Helpers */
.modal-subtitle {
    color: #64748b;
    font-size: var(--text-sm);
    margin-bottom: 20px;
}
.section-label i {
    margin-inline-end: 4px;
}
.shift-summary-total strong {
    color: var(--primary-color);
}
.shift-error {
    background: #fee2e2;
    color: #dc2626;
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.6;
}
.shift-error a { color: #dc2626; font-size: 0.82rem; text-decoration: underline; }

/* Special Inputs */
.pin-input {
    width: 100%;
    padding: 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    font-family: inherit;
    font-size: var(--text-xl);
    letter-spacing: 10px;
    text-align: center;
    box-sizing: border-box;
}
.cash-input-lg {
    font-size: 1.5rem;
    text-align: center;
    padding: 15px;
}

/* Icon-Only Buttons */
.btn-icon {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 1.2rem;
}

/* Print Render Target */
.print-render-target {
    position: absolute;
    top: -9999px;
    left: -9999px;
    width: 600px;
    background: white;
    z-index: -1;
}

/* Close Shift Modal Buttons */
.close-shift-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.close-shift-actions .btn-close-final {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: none;
    background: #ef4444;
    color: white;
    font-size: var(--text-base);
    font-weight: bold;
    cursor: pointer;
    font-family: inherit;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.close-shift-actions .btn-close-final:hover { background: #dc2626; }
.close-shift-actions .btn-print-report {
    width: 100%;
    padding: 11px;
    border-radius: 12px;
    border: 1.5px solid #e2e8f0;
    background: white;
    color: #64748b;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.close-shift-actions .btn-print-report:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: #f8fafc;
}

/* Menu Toggle Button (Hamburger) */
.menu-toggle {
    background: var(--primary-color);
    border: none;
    font-size: 1.2rem;
    color: white;
    cursor: pointer;
    padding: 10px 16px;
    border-radius: 12px;
    transition: 0.2s;
    display: none;
    /* Hidden on Desktop */
    box-shadow: 0 4px 12px rgba(39, 64, 204, 0.25);
    align-items: center;
    gap: 8px;
    font-family: 'Cairo', sans-serif;
    font-weight: 600;
    font-size: 0.92rem;
}
.menu-toggle i {
    font-size: 1.15rem;
}

.menu-toggle:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(39, 64, 204, 0.35);
}

@media (max-width: 1024px) {
    .menu-toggle {
        display: flex;
        /* Show on Tablet/Mobile */
    }

    /* Ensure Sidebar has Backdrop when active */
    .sidebar.active::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        /* Full screen width to cover right side */
        height: 100vh;
        background: rgba(0, 0, 0, 0.3);
        z-index: -1;
        backdrop-filter: blur(4px);
    }
}

/* Utility */
.text-dim { color: var(--text-dim); }
.text-xs { font-size: var(--text-xs); }
.text-primary { color: var(--primary-color); }

/* ========== Items Page ========== */

.table-container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    padding: 20px;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 15px;
    text-align: start;
    border-bottom: 1px solid #f1f5f9;
}

th {
    font-weight: 700;
    color: var(--text-dim);
    background: #f8fafc;
}

tr:last-child td {
    border-bottom: none;
}

.item-thumb-small {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    background: #f1f5f9;
}

.action-btn-small {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: 0.2s;
    color: white;
}

.action-btn-small:hover {
    opacity: 0.85;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.action-btn-small:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.btn-edit { background: var(--primary-color); }
.btn-delete { background: #ef4444; }
.btn-stock { background: #eef2ff; color: var(--primary-color); border: 1px solid rgba(39, 64, 204, 0.25); }

/* POS Display Section */
.pos-display-section {
    background: #f8fafc;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid #e2e8f0;
}

.pos-title {
    font-size: var(--text-sm);
    color: #64748b;
    margin-bottom: 15px;
    display: block;
    text-align: start;
}

.pos-layout {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    direction: rtl;
}

.preview-box {
    width: 100px;
    height: 100px;
    background: #f1f5f9;
    border-radius: 8px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed #cbd5e1;
    cursor: pointer;
}

.preview-box > i {
    font-size: 2rem;
    color: #cbd5e1;
}

.controls-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Color & Shape Pickers */
.color-grid {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.color-label {
    width: 45px;
    height: 45px;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    display: block;
}

.color-label input[type="radio"] {
    position: absolute;
    top: 4px;
    inset-inline-start: 4px;
    width: 14px;
    height: 14px;
    cursor: pointer;
    accent-color: var(--primary-color);
    margin: 0;
    display: block !important;
    background: white;
    border-radius: 50%;
}

.shape-grid {
    display: flex;
    gap: 15px;
    justify-content: flex-start;
}

.shape-label {
    cursor: pointer;
    position: relative;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shape-label input {
    display: none !important;
}

.shape-svg {
    width: 48px;
    height: 48px;
    fill: none;
    stroke: #cbd5e1;
    stroke-width: 2;
    transition: all 0.2s ease;
}

.shape-label:hover .shape-svg {
    stroke: #94a3b8;
}

.shape-label.selected .shape-svg {
    stroke: var(--primary-color);
    stroke-width: 3;
}

.shape-label.selected::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: var(--primary-color);
    position: absolute;
    top: 50%;
    inset-inline-start: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    pointer-events: none;
}

/* Low Stock Alert */
.low-stock-alert {
    background: #fff7ed;
    border: 1.5px solid #fed7aa;
    border-radius: 12px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.low-stock-alert i {
    color: #ea580c;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.low-stock-alert .alert-title {
    font-weight: 700;
    color: #ea580c;
}

.low-stock-alert .alert-count {
    color: #64748b;
    font-size: var(--text-sm);
    margin-inline-start: 8px;
}

.low-stock-badge {
    background: #fff7ed;
    color: #ea580c;
    border: 1px solid #fed7aa;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: var(--text-xs);
    font-weight: 700;
    margin: 2px;
    display: inline-block;
}

/* Search & Filter Bar */
.items-filter-bar {
    padding: 0 20px 16px;
}

.items-filter-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.search-wrapper {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.search-wrapper i {
    position: absolute;
    inset-inline-end: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: var(--text-sm);
}

.search-input {
    width: 100%;
    padding: 9px 12px;
    padding-inline-end: 36px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-family: inherit;
    font-size: var(--text-sm);
    box-sizing: border-box;
    outline: none;
    transition: border 0.2s;
}

.search-input:focus {
    border-color: var(--primary-color);
}

.filter-select {
    padding: 9px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-family: inherit;
    font-size: var(--text-sm);
    background: white;
    cursor: pointer;
}

.item-count {
    color: #64748b;
    font-size: var(--text-sm);
    white-space: nowrap;
}

/* Category Badge */
.cat-badge {
    background: #eef2ff;
    color: var(--primary-color);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: var(--text-sm);
}

/* Variant Badge */
.variant-badge {
    background: #dbeafe;
    color: #1d4ed8;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: var(--text-xs);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-dim);
}

.item-thumb-small.empty-state {
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.item-thumb-small.empty-state i {
    font-size: 1rem;
    margin-bottom: 0;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 15px;
    display: block;
}

/* Item Form Layout */
.item-image-upload {
    text-align: center;
    margin-bottom: 20px;
}

.item-image-upload label {
    cursor: pointer;
    display: inline-block;
}

.image-preview-box {
    width: 100px;
    height: 100px;
    background: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin: 0 auto;
}

.image-preview-box i {
    font-size: 1.5rem;
    color: #cbd5e1;
}

.image-preview-box img,
.preview-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

.image-upload-label {
    font-size: var(--text-xs);
    color: var(--primary-color);
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-row .form-group {
    flex: 1;
}

.checkbox-row {
    margin-bottom: 15px;
    display: flex;
    gap: 20px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.stock-fields {
    display: none;
    background: #f8fafc;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
}

/* Variants Section */
.variants-section {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.variants-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.variants-title {
    font-weight: 700;
    font-size: var(--text-sm);
}

.variants-title i {
    color: var(--primary-color);
    margin-inline-start: 6px;
}

.btn-add-variant {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 6px 14px;
    cursor: pointer;
    font-size: var(--text-sm);
}

/* Form Footer */
.form-footer {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-delete-item {
    background: #ef4444;
    width: auto;
    margin-top: 10px;
    border-radius: 10px;
}

.btn-delete-item:hover {
    background: #dc2626;
}

/* Stock Modal */
.stock-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.stock-modal-icon {
    width: 46px;
    height: 46px;
    background: #eff6ff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stock-modal-icon i {
    color: var(--primary-color);
    font-size: 1.2rem;
}

.stock-modal-name {
    font-weight: 700;
    color: #1e293b;
}

.stock-modal-current {
    font-size: var(--text-sm);
    color: #64748b;
}

.adj-type-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 18px;
}

.adj-type-btn {
    padding: 12px;
    border-radius: 10px;
    border: 1.5px solid #e2e8f0;
    background: white;
    color: #64748b;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    font-size: var(--text-sm);
}

.adj-type-btn.active-add {
    border-color: #86efac;
    background: #f0fdf4;
    color: #16a34a;
}

.adj-type-btn.active-remove {
    border-color: #fecaca;
    background: #fef2f2;
    color: #ef4444;
}

.adj-qty-group {
    margin-bottom: 18px;
}

.adj-qty-group label {
    display: block;
    font-weight: 600;
    color: #475569;
    margin-bottom: 8px;
    font-size: var(--text-sm);
}

.adj-qty-input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-family: inherit;
    font-size: 1.1rem;
    text-align: center;
    box-sizing: border-box;
}

.adj-footer {
    display: flex;
    gap: 10px;
}

.adj-submit {
    flex: 1;
    padding: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-weight: 700;
    font-size: var(--text-sm);
    cursor: pointer;
}

.adj-cancel {
    flex: 1;
    padding: 12px;
    background: white;
    color: #64748b;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
}

/* Pagination */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 16px 20px;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: white;
    color: var(--primary-color);
    border: 1.5px solid var(--primary-color);
    border-radius: 8px;
    font-family: inherit;
    font-weight: 600;
    font-size: var(--text-sm);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-info {
    font-size: var(--text-sm);
    font-weight: 600;
    color: #64748b;
    min-width: 60px;
    text-align: center;
}

/* Items page content spacing */
.items-content {
    padding: 0 20px;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 12px 24px;
    border-radius: 12px;
    font-family: inherit;
    font-weight: 600;
    font-size: var(--text-sm);
    z-index: var(--z-toast);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.toast-success {
    background: #047857;
    color: white;
}

.toast.toast-error {
    background: #b91c1c;
    color: white;
}

/* Delete Confirmation Modal */
.delete-modal-body {
    text-align: center;
    padding: 10px 0 20px;
}

.delete-modal-icon {
    width: 60px;
    height: 60px;
    background: #fef2f2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: #ef4444;
    font-size: 1.5rem;
}

.delete-modal-text {
    color: #475569;
    font-size: var(--text-sm);
    margin-top: 8px;
}

.delete-modal-actions {
    display: flex;
    gap: 10px;
}

.delete-modal-actions .btn-confirm-delete {
    flex: 1;
    padding: 12px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}

.delete-modal-actions .btn-confirm-delete:hover {
    background: #dc2626;
}

.delete-modal-actions .btn-cancel-delete {
    flex: 1;
    padding: 12px;
    background: white;
    color: #64748b;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
}

/* Variant Editor Classes */
.variant-group {
    background: #f8fafc;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
}

.variant-group-header {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
}

.variant-group-header input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-family: inherit;
}

.variant-group-delete {
    background: #fef2f2;
    color: #ef4444;
    border: none;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    flex-shrink: 0;
}

.variant-option-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
}

.variant-option-row input:first-child {
    flex: 2;
}

.variant-option-row input:nth-child(2) {
    flex: 1;
}

.variant-option-row input {
    padding: 6px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-family: inherit;
}

.variant-option-delete {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
}

.variant-add-option {
    background: none;
    border: 1px dashed #cbd5e1;
    color: #64748b;
    padding: 4px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: var(--text-xs);
    font-family: inherit;
}

.variant-empty {
    color: #94a3b8;
    font-size: var(--text-sm);
    margin: 0;
}

/* Empty search results */
.no-results {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
    display: none;
}

.no-results i {
    font-size: 2.5rem;
    margin-bottom: 12px;
    display: block;
}

/* Loading spinner on button */
.btn-loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading i.fa-spinner {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive Table → Card View */
@media (max-width: 768px) {
    #itemsTable thead {
        display: none;
    }

    #itemsTable tbody tr {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        padding: 14px;
        border-bottom: 1px solid #f1f5f9;
        align-items: center;
    }

    #itemsTable tbody tr:last-child {
        border-bottom: none;
    }

    #itemsTable td {
        padding: 0;
        border-bottom: none;
    }

    /* Image */
    #itemsTable td:nth-child(1) {
        width: 44px;
    }

    /* Name */
    #itemsTable td:nth-child(2) {
        flex: 1;
        min-width: 0;
    }

    /* Price */
    #itemsTable td:nth-child(3) {
        width: 100%;
        order: 10;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    #itemsTable td:nth-child(3)::before {
        content: '\u0627\u0644\u0633\u0639\u0631';
        color: #94a3b8;
        font-size: var(--text-xs);
        font-weight: 600;
    }

    /* Category */
    #itemsTable td:nth-child(4) {
        order: 11;
    }

    /* Stock */
    #itemsTable td:nth-child(5) {
        order: 12;
    }

    /* Actions */
    #itemsTable td:nth-child(6) {
        order: 1;
        margin-inline-start: auto;
    }

    .table-container {
        padding: 10px;
    }
}