/* ========================================
   GLOBAL SCROLLBAR & SELECTION
   ======================================== */

/* Webkit (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--neutral-100);
}

::-webkit-scrollbar-thumb {
    background: var(--neutral-300);
    border-radius: 10px;
    border: 2px solid var(--neutral-100);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-400);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--neutral-300) var(--neutral-100);
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

::selection {
    background: var(--primary-100);
    color: var(--primary-900);
}


/* Modern Color System - CSS Custom Properties */
:root {
    /* Primary Brand Blues - Organization Colors */
    --primary-50: #f0f7ff;
    --primary-100: #e0effe;
    --primary-200: #bae0fd;
    --primary-300: #7cc7fb;
    --primary-400: #38a9f8;
    --primary-500: #1e40af;
    /* Main Brand Blue */
    --primary-600: #1d4ed8;
    --primary-700: #1e40af;
    --primary-800: #1e3a8a;
    --primary-900: #172554;

    /* Neutral Colors - Professional Whites & Grays */
    --neutral-50: #ffffff;
    --neutral-100: #f8fafc;
    --neutral-200: #f1f5f9;
    --neutral-300: #e2e8f0;
    --neutral-400: #94a3b8;
    --neutral-500: #64748b;
    --neutral-600: #475569;
    --neutral-700: #334155;
    --neutral-800: #1e293b;
    --neutral-900: #0f172a;


    /* Glassmorphic Effects */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);


    /* Success Colors */
    --success-50: #f0fdf4;
    --success-100: #dcfce7;
    --success-500: #22c55e;
    --success-600: #16a34a;
    --success-700: #15803d;

    /* Warning Colors */
    --warning-50: #fffbeb;
    --warning-100: #fef3c7;
    --warning-500: #f59e0b;
    --warning-600: #d97706;
    --warning-700: #b45309;

    /* Error/Danger Colors */
    --error-50: #fef2f2;
    --error-100: #fee2e2;
    --error-500: #ef4444;
    --error-600: #dc2626;
    --error-700: #b91c1c;

    /* Semantic Colors */
    --background: var(--neutral-100);
    --surface: #ffffff;
    --text-primary: var(--neutral-900);
    --text-secondary: var(--neutral-600);
    --text-tertiary: var(--neutral-500);
    --border: var(--neutral-300);
    --border-light: var(--neutral-200);


    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

body {
    font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}


/* Screen Management */
.screen {
    display: none;
}

.screen.active {
    display: flex;
}

/* Login Screen - 50/50 Split */
#loginScreen.active {
    min-height: 100vh;
    display: flex;
    overflow: hidden;
}

.login-split-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Left Side - Elite Blue Branding */
.login-branding {
    flex: 1;
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    position: relative;
    overflow: hidden;
}


.login-branding::before {
    content: '';
    position: absolute;
    top: -20%;
    left: -20%;
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.branding-content {
    width: 100%;
    max-width: 480px;
    text-align: center;
    z-index: 1;
}


.branding-content h1 {
    font-size: 42px;
    font-weight: 800;
    margin-bottom: 12px;
    letter-spacing: -2px;
    line-height: 1;
    color: #ffffff;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.branding-subtitle {
    font-size: 17px;
    font-weight: 500;
    opacity: 0.9;
    line-height: 1.4;
    margin-bottom: 32px;
    color: #ffffff;
}

.branding-features {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.feature-item {
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
}


.feature-item:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateX(10px) translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.feature-text strong {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 3px;
    letter-spacing: -0.2px;
}

.feature-text span {
    font-size: 13.5px;
    opacity: 0.85;
    color: #ffffff;
    line-height: 1.4;
    font-weight: 400;
}




/* Right Side - White Login Form */
.login-form-section {
    flex: 1;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 40px;
    position: relative;
    overflow-y: hidden;
}


/* Restored & Scaled Brand Logo */
.login-logo-top {
    position: absolute;
    top: 30px;
    right: 30px;
    z-index: 10;
}

.login-logo-top img {
    width: 180px;
    height: auto;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.95;
}

.login-logo-top img:hover {
    transform: scale(1.05);
    opacity: 1;
}



.login-form-wrapper {
    width: 100%;
    max-width: 420px;
}

.login-form-wrapper h2 {
    font-size: 22px;
    font-weight: 700;
    color: #1e40af;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
    text-align: center;
}



.login-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.login-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
    text-align: left;
}

.login-form .form-group label {
    font-size: 12px;
    font-weight: 500;
    color: #334155;
    margin-bottom: 1px;
}

.login-form .form-group small {
    font-size: 10px;
    margin-top: 1px;
}

.login-form input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--neutral-50);
    color: var(--neutral-900);
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary-500);
    background: #ffffff;
    box-shadow: 0 0 0 4px var(--primary-50);
}


.login-form input::placeholder {
    color: #94a3b8;
}

.btn-login {
    width: 100%;
    padding: 12px;
    background: var(--primary-600);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 6px;
}


.btn-login:hover {
    background: var(--primary-700);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(30, 64, 175, 0.25);
}


.btn-login:active {
    transform: translateY(0);
}

/* Registration Screen Optimizations */
#registrationScreen .login-form-section {
    padding: 60px 40px;
    align-items: flex-start;
    overflow-y: hidden;
}

#registrationScreen .login-form-wrapper {
    max-width: 650px;
}

#registrationScreen .login-form-wrapper h2 {
    margin-bottom: 25px;
    font-size: 30px;
}

.registration-grid-container {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 15px 25px !important;
}

.registration-grid-container .full-width {
    grid-column: span 2;
    margin-top: 10px;
}

#registrationScreen .login-form .form-group {
    gap: 6px;
}

#registrationScreen .login-form label {
    font-size: 13px;
    font-weight: 600;
}

#registrationScreen .login-form input {
    padding: 12px 16px;
    font-size: 14px;
}

/* Mobile Responsive Login */
@media (max-width: 768px) {
    .login-split-container {
        flex-direction: column;
    }

    .login-branding {
        padding: 30px 20px;
        min-height: 40vh;
    }

    .branding-content h1 {
        font-size: 28px;
    }

    .branding-subtitle {
        font-size: 14px;
        margin-bottom: 24px;
    }

    .branding-features {
        gap: 10px;
    }

    .feature-item {
        padding: 12px 16px;
    }

    .feature-text strong {
        font-size: 14px;
    }

    .feature-text span {
        font-size: 12px;
    }

    .login-form-section {
        padding: 30px 20px;
    }

    .login-logo-top {
        top: 20px;
        right: 20px;
    }

    .login-logo-top img {
        max-width: 120px;
    }

    .login-form-wrapper h2 {
        font-size: 28px;
        margin-bottom: 24px;
    }

    /* Enable scrolling on login screen for mobile */
    #loginScreen.active,
    #registrationScreen.active {
        overflow-y: auto !important;
        height: auto !important;
        display: block !important;
        /* Allow normal block flow for scrolling */
    }

    .login-split-container {
        height: auto !important;
        /* Allow container to grow */
        min-height: 100vh;
    }

    .login-form-section {
        padding: 30px 20px;
        overflow-y: visible !important;
        /* Allow content to overflow/scroll within parent */
        height: auto !important;
    }

    /* Force registration to single column on mobile */
    .registration-grid-container {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    .registration-grid-container .full-width {
        grid-column: auto !important;
    }
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.login-form button:active {
    transform: translateY(0);
}

.demo-credentials {
    margin-top: 24px;
    padding: 16px;
    background: #f1f5f9;
    border-radius: 8px;
    font-size: 13px;
    border-left: 3px solid #1e40af;
}

.demo-credentials p {
    margin: 6px 0;
    color: #475569;
}

.demo-credentials strong {
    color: #1e293b;
}

/* Premium Loader Styles */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loader-overlay.fade-out {
    opacity: 0;
    visibility: hidden;
}

.loader-content {
    text-align: center;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--primary-100);
    border-top-color: var(--primary-600);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.loader-text {
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-900);
    letter-spacing: -0.5px;
    animation: pulse 2s ease-in-out infinite;
}

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

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.7;
        transform: scale(0.98);
    }
}

/* Skeleton Screens & Shimmer */
@keyframes shimmer {
    0% {
        background-position: -468px 0;
    }

    100% {
        background-position: 468px 0;
    }
}

.skeleton {
    background: #f6f7f8;
    background-image: linear-gradient(to right, #f6f7f8 0%, #edeef1 20%, #f6f7f8 40%, #f6f7f8 100%);
    background-repeat: no-repeat;
    background-size: 800px 104px;
    display: inline-block;
    position: relative;
    animation: shimmer 1.2s linear infinite forwards;
    border-radius: 4px;
}

.skeleton-card {
    height: 120px;
    width: 100%;
    border-radius: 16px;
    margin-bottom: 20px;
}

.skeleton-row {
    height: 50px;
    width: 100%;
    border-radius: 8px;
    margin-bottom: 12px;
}

.skeleton-text {
    height: 14px;
    width: 70%;
    margin-bottom: 8px;
    border-radius: 2px;
}

/* Staggered Entry Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.stagger-1 {
    animation-delay: 0.05s;
}

.stagger-2 {
    animation-delay: 0.1s;
}

.stagger-3 {
    animation-delay: 0.15s;
}

.stagger-4 {
    animation-delay: 0.2s;
}

.stagger-5 {
    animation-delay: 0.25s;
}


/* Micro-animations & Glassmorphism */
.sidebar {
    backdrop-filter: blur(10px);
    background: var(--glass-bg);
    border-right: 1px solid var(--glass-border);
}

.metric-card {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: var(--shadow-xl);
}

.nav-btn {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-btn:hover {
    transform: translateX(4px);
}

.btn-primary,
.btn-login {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn-primary:active,
.btn-login:active {
    transform: scale(0.98);
}


.error-message {
    color: #e74c3c;
    margin-top: 10px;
    font-size: 14px;
}

/* Main App Layout */
#mainApp {
    display: none;
    height: 100vh;
}

#mainApp.active {
    display: flex;
}

/* ========================================
/* ========================================
   SIDEBAR NAVIGATION - Premium Dark Design
   ======================================== */

/* Sidebar Container */
.sidebar {
    width: 260px;
    background: #ffffff;
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.02);
}


/* Brand Header */
.nav-brand {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-light);
}

.sidebar-logo {
    height: 32px;
    width: auto;
}

.sidebar-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary-500);
    letter-spacing: -0.8px;
    margin: 0;
    padding-left: 0;
    line-height: 1.2;
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-800) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;

}


/* Navigation Menu */
.nav-menu {
    display: flex;
    flex-direction: column;
    padding: 16px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    gap: 4px;
}

/* Scrollbar styling for sidebar */
.nav-menu::-webkit-scrollbar {
    width: 4px;
}

.nav-menu::-webkit-scrollbar-track {
    background: transparent;
}

.nav-menu::-webkit-scrollbar-thumb {
    background: var(--neutral-200);
    border-radius: 2px;
}

/* Section Labels */
.nav-section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #475569;
    padding: 20px 12px 10px 12px;
    margin: 0;
}

.nav-section-label:first-child {
    padding-top: 0;
}

/* Collapsible Section Label */
.collapsible-section {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: color 0.2s ease;
}

.collapsible-section:hover {
    color: #94a3b8;
}

.section-arrow {
    font-size: 8px;
    transition: transform 0.2s ease;
    color: #64748b;
}

/* Collapsible Items Container */
.collapsible-items {
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 1;
}

.collapsible-items.collapsed {
    max-height: 0;
    opacity: 0;
}

/* Navigation Buttons */
.nav-btn {
    width: 100%;
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    color: var(--neutral-600);
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
    min-height: 44px;
    margin-bottom: 2px;
}

.nav-btn:hover {
    background-color: var(--neutral-50);
    color: var(--primary-700);
}

.nav-btn.active {
    background-color: var(--primary-50);
    color: var(--primary-500);
    font-weight: 700;
    border-left: 4px solid var(--primary-500);
    border-radius: 0 8px 8px 0;
}


/* Icons */
.nav-icon {
    display: block;
    opacity: 0.7;
    transition: all 0.2s ease;
}

.nav-text {
    flex: 1;
    line-height: normal;
}

.nav-tooltip {
    background: var(--primary-900);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    position: absolute;
    left: 270px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: var(--shadow-md);
}

.nav-btn:hover .nav-tooltip {
    opacity: 1;
    left: 250px;
}


/* Hover State */
/* Conflicting dark theme styles removed */

/* User Section */
/* User Section */
.nav-user {
    padding: 20px;
    border-top: 1px solid var(--border-light);
    background: var(--neutral-50);
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: auto;
}

.nav-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: default;
    transition: none;
}

.nav-user-info:hover {
    border-color: transparent;
    box-shadow: none;
}

.nav-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--primary-100);
    color: var(--primary-700);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    flex-shrink: 0;
    box-shadow: none;
    border: 1px solid var(--primary-200);
}

.nav-user-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.nav-user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--neutral-900);
    line-height: 1.2;
}

.nav-user-role {
    font-size: 12px;
    color: var(--neutral-500);
    line-height: 1.2;
}

/* Logout Button */
.nav-logout-btn {
    width: 100%;
    padding: 10px 0;
    background: transparent;
    border: none;
    font-size: 13px;
    font-weight: 500;
    color: #ef4444;
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    margin-top: 12px;
    opacity: 0.8;
}

.nav-logout-btn:hover {
    color: #f87171;
    opacity: 1;
}

.nav-logout-btn .nav-icon {
    display: block;
}

/* ========================================
   OFFLINE STATUS INDICATORS
   ======================================== */

.offline-status-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    margin: 8px 0;
    border-top: 1px solid var(--neutral-200);
    border-bottom: 1px solid var(--neutral-200);
}

.offline-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    font-size: 11px;
    font-weight: 600;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
    animation: pulse-offline 2s ease-in-out infinite;
}

.offline-indicator svg {
    flex-shrink: 0;
}

@keyframes pulse-offline {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.offline-queue-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    font-size: 11px;
    font-weight: 700;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
    transition: all 0.2s ease;
}

.offline-queue-badge:hover {
    transform: scale(1.1);
    background: linear-gradient(135deg, #f87171, #ef4444);
}

/* Offline Queue Modal Styles */
.offline-queue-list {
    max-height: 400px;
    overflow-y: auto;
}

.offline-queue-header {
    font-size: 14px;
    font-weight: 600;
    color: var(--neutral-700);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--neutral-200);
}

.offline-queue-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.offline-queue-item {
    padding: 12px;
    background: var(--neutral-50);
    border-radius: 8px;
    border-left: 4px solid var(--primary-500);
}

.offline-queue-item.status-failed {
    border-left-color: #ef4444;
    background: #fef2f2;
}

.offline-queue-item.status-pending {
    border-left-color: #f59e0b;
}

.oqi-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.oqi-type {
    font-weight: 600;
    color: var(--neutral-800);
    text-transform: uppercase;
    font-size: 11px;
    padding: 2px 8px;
    background: var(--primary-100);
    border-radius: 4px;
}

.oqi-amount {
    font-weight: 700;
    color: var(--neutral-900);
    font-size: 14px;
}

.oqi-date {
    font-size: 11px;
    color: var(--neutral-500);
    margin-left: auto;
}

.oqi-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.oqi-status-badge {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
}

.oqi-status-badge.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.oqi-status-badge.status-failed {
    background: #fee2e2;
    color: #991b1b;
}

.oqi-error {
    font-size: 11px;
    color: #dc2626;
    font-style: italic;
}

.oqi-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.oqi-actions .btn-sm {
    padding: 4px 12px;
    font-size: 11px;
}

.offline-queue-actions {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--neutral-200);
    display: flex;
    justify-content: flex-end;
}

/* Offline Mode Toggle */
.offline-toggle-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    margin-bottom: 8px;
}

.offline-toggle-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--neutral-600);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--neutral-300);
    transition: 0.3s;
    border-radius: 22px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(18px);
}

.toggle-switch input:disabled + .toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Main Content Area */
.main-content {
    margin-left: 260px;
    width: calc(100% - 260px);
    height: 100vh;
    overflow-y: auto;
    background: #f8fafc;
}

/* ========================================
   MOBILE RESPONSIVENESS
   ======================================== */

/* Mobile Menu Button - Hidden (using bottom nav instead) */
.mobile-menu-btn {
    display: none !important;
    visibility: hidden;
}

.mobile-menu-btn span {
    display: none;
}

/* Mobile Overlay - Hidden (using bottom nav instead) */
.mobile-overlay {
    display: none !important;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-overlay.active {
    display: block;
    opacity: 1;
}

/* Media Queries */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        /* Slightly wider on mobile for better touch */
        box-shadow: none;
    }

    .sidebar.active {
        transform: translateX(0);
        box-shadow: 10px 0 25px rgba(0, 0, 0, 0.2);
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding-top: 60px;
        /* Space for hidden header/button */
    }

    .mobile-menu-btn {
        display: block;
    }
}

/* Tab Content */
.tab-content {
    display: none;
    padding: 30px;
    max-width: 1400px;
    margin: 0 auto;
}

.tab-content.active {
    display: block;
}

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.tab-header h2 {
    color: #333;
}

/* Dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* Custom Dashboard Layout: 2 large items top, 3 smaller items bottom */
.dashboard-grid-custom {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 25px;
    margin-bottom: 30px;
}

/* User View: Simple 3-column layout */
.dashboard-grid-custom.user-view {
    grid-template-columns: repeat(3, 1fr) !important;
}

.dashboard-grid-custom.user-view .metric-card {
    grid-column: span 1 !important;
}

/* Profit Metrics Layout: 2 cards on top, 3 below */
.profit-metrics-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.profit-metrics-top {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.profit-metrics-bottom {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* Large cards span 3 columns each (2 cards = 6 columns) */
.metric-card-large {
    grid-column: span 3;
    padding: 50px 40px;
    min-height: 180px;
}

/* Large card values - bigger font size */
.metric-card-large .metric-value {
    font-size: 56px;
}

.metric-card-large h3 {
    font-size: 15px;
}

/* Small cards span 2 columns each (3 cards = 6 columns) */
.metric-card-small {
    grid-column: span 2;
    padding: 35px 30px;
    min-height: 140px;
}

/* Small card values - standard size */
.metric-card-small .metric-value {
    font-size: 44px;
}

.metric-card {
    background: white;
    padding: 40px 35px;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 1px solid #e2e8f0;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
    border-color: #cbd5e1;
}

.metric-card h3 {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 16px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.metric-value {
    font-size: 48px;
    font-weight: 700;
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
    word-break: break-word;
}

.metric-card.alert .metric-value {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.dashboard-section {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.dashboard-section h3 {
    margin-bottom: 15px;
    color: #333;
}

.alert-list,
.recent-list {
    max-height: 300px;
    overflow-y: auto;
}

.alert-item,
.recent-item {
    padding: 12px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.alert-item:last-child,
.recent-item:last-child {
    border-bottom: none;
}

.alert-item.critical {
    background: #ffe6e6;
    border-left: 4px solid #e74c3c;
}

/* Buttons */
.btn-primary {
    padding: 11px 22px;
    background: linear-gradient(135deg, var(--primary-700) 0%, var(--primary-900) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
}

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

.btn-secondary {
    padding: 11px 22px;
    background: var(--neutral-200);
    color: var(--text-secondary);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--neutral-300);
    color: var(--text-primary);
}

.btn-success {
    padding: 8px 16px;
    background: var(--success-600);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-success:hover {
    background: var(--success-700);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(34, 197, 94, 0.3);
}

.btn-danger {
    padding: 8px 16px;
    background: var(--error-500);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-danger:hover {
    background: var(--error-600);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

.btn-info {
    padding: 8px 16px;
    background: var(--primary-500);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-info:hover {
    background: var(--primary-600);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.btn-warning {
    padding: 8px 16px;
    background: var(--warning-500);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-warning:hover {
    background: var(--warning-600);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(245, 158, 11, 0.3);
}

.btn-remove {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

/* Button loading spinner for preventing double-clicks */
.btn-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: btn-spin 0.75s linear infinite;
    vertical-align: middle;
    margin-right: 4px;
}

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

button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Sub-tab Buttons */
/* Sub-Navigation Tabs */
.sub-nav-tabs {
    display: flex;
    gap: 8px;
    padding-bottom: 16px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-light);
}

.sub-nav-btn {
    padding: 8px 16px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.sub-nav-btn:hover {
    color: var(--primary-700);
    background: var(--primary-50);
}

.sub-nav-btn.active {
    background: var(--primary-600);
    color: white;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

/* Profit Section Visibility */
.profit-section {
    display: none !important;
}

.profit-section.active {
    display: block !important;
}

/* Search Bar */
.search-bar {
    margin-bottom: 20px;
}

.search-bar input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

/* Tables */
.table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
    border: 1px solid #e2e8f0;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: #f8fafc;
}

th {
    padding: 16px 18px;
    text-align: left;
    font-weight: 600;
    color: #475569;
    border-bottom: 2px solid #e2e8f0;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

th.sortable {
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}

th.sortable:hover {
    background: #e2e8f0;
    color: #1e40af;
}

td {
    padding: 16px 18px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    font-size: 14px;
}

tbody tr:hover {
    background: #f8fafc;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
    letter-spacing: 0.3px;
}

.status-badge.low-stock {
    background: #fee2e2;
    color: #dc2626;
}

.status-badge.in-stock {
    background: #d1fae5;
    color: #059669;
}

.status-badge.pending {
    background: #fef3c7;
    color: #d97706;
}

.status-badge.approved {
    background: #d1fae5;
    color: #059669;
}

.status-badge.rejected {
    background: #fee2e2;
    color: #dc2626;
}

.status-badge.completed {
    background: #d1fae5;
    color: #059669;
}

.status-badge.partial-return {
    background: #fef3c7;
    color: #d97706;
}

.status-badge.returned {
    background: #fee2e2;
    color: #dc2626;
}

/* Modals */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1200;
}

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

.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    z-index: 1201;
    max-height: 90vh;
    overflow-y: auto;
}

.modal.active {
    display: block;
}

.modal-content {
    padding: 32px;
    min-width: 500px;
}

.modal-content.large {
    min-width: 700px;
}

.modal-content h2 {
    margin-bottom: 24px;
    color: #1e293b;
    font-size: 24px;
    font-weight: 700;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 11px 15px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: #ffffff;
    color: var(--neutral-900);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 4px var(--primary-50);
    background: #ffffff;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.modal-actions {
    margin-top: 25px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Sale Items */
#saleItems {
    margin-bottom: 15px;
}

.sale-item {
    display: grid;
    grid-template-columns: 2fr 0.7fr 1fr 1fr auto;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    border: 1px solid var(--border-light);
    transition: all 0.2s ease;
}

/* Ensure grid children respect their column sizes */
.sale-item>* {
    min-width: 0;
}

/* Desktop: Flatten the row structure into grid */
.sale-item .sale-item-row-1 {
    display: contents;
}

.sale-item .sale-item-row-2 {
    display: contents;
}

.sale-item .price-group,
.sale-item .subtotal-group {
    display: contents;
}

/* Hide labels on desktop */
.sale-item .price-label,
.sale-item .subtotal-label {
    display: none;
}

/* Desktop: Hide qty stepper buttons, show simple input */
.sale-item .qty-stepper {
    display: contents;
}

.sale-item .qty-btn {
    display: none;
}

.sale-item select,
.sale-item input {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.item-subtotal {
    font-weight: 600;
    color: #1e40af;
}

.sale-total {
    text-align: right;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid #ddd;
}

.sale-total h3 {
    color: #1e40af;
    font-size: 24px;
}

.info-box {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 15px;
}

.info-box p {
    margin: 5px 0;
}

/* Autocomplete Suggestions */
.autocomplete-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 5px 5px;
    max-height: 350px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

.autocomplete-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.2s;
    color: var(--text-primary);
}

.autocomplete-item:hover {
    background: var(--hover-bg);
}

.autocomplete-item:last-child {
    border-bottom: none;
    border-radius: 0 0 8px 8px;
}

.autocomplete-item span {
    color: var(--text-secondary);
}

.autocomplete-suggestions.show {
    display: block;
}

.suggestion-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f1f1f1;
    transition: background 0.2s;
}

.suggestion-item:hover {
    background: #f8f9fa;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-name {
    font-weight: 600;
    color: #333;
}

.suggestion-details {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}

/* Action buttons in tables */
.action-buttons {
    display: flex;
    gap: 5px;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-menu {
        flex-wrap: wrap;
    }

    .nav-btn {
        font-size: 12px;
        padding: 8px 12px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        min-width: 90vw;
    }

    .table-container {
        overflow-x: scroll;
    }

    .sale-item {
        grid-template-columns: 1fr;
    }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #999;
}

.empty-state h3 {
    margin-bottom: 10px;
}

/* ========================================
   ENHANCED MOBILE RESPONSIVENESS
   ======================================== */

/* Viewport meta tag reminder - add to index.html if not present:
   <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0">
*/

/* ========================================
   TABLET OPTIMIZATION (768px - 1024px)
   ======================================== */
@media (min-width: 769px) and (max-width: 1024px) {

    /* ==========================================
       LOGIN & REGISTER - TABLET OPTIMIZED
       ========================================== */

    /* Keep side-by-side layout on tablet */
    .login-split-container {
        flex-direction: row;
    }

    /* Branding section - narrower on tablet */
    .login-branding {
        flex: 0.45;
        padding: 32px 28px;
        min-height: 100vh;
    }

    .branding-content {
        max-width: 100%;
    }

    .branding-content h1 {
        font-size: 32px;
        margin-bottom: 8px;
    }

    .branding-subtitle {
        font-size: 14px;
        margin-bottom: 24px;
    }

    .branding-features {
        gap: 10px;
    }

    .feature-item {
        padding: 12px 16px;
    }

    .feature-text strong {
        font-size: 14px;
    }

    .feature-text span {
        font-size: 12px;
    }

    /* Form section - wider on tablet */
    .login-form-section {
        flex: 0.55;
        padding: 32px 40px;
        overflow-y: auto;
    }

    .login-logo-top {
        top: 20px;
        right: 20px;
    }

    .login-logo-top img {
        width: 140px;
    }

    .login-form-wrapper {
        max-width: 380px;
    }

    .login-form-wrapper h2 {
        font-size: 20px;
        margin-bottom: 20px;
    }

    /* Touch-friendly form inputs */
    .login-form .form-group {
        margin-bottom: 16px;
    }

    .login-form .form-group label {
        font-size: 13px;
        margin-bottom: 6px;
    }

    .login-form input {
        padding: 14px 16px;
        font-size: 16px;
        min-height: 50px;
        border-radius: 10px;
    }

    .btn-login {
        padding: 16px;
        font-size: 16px;
        min-height: 52px;
        border-radius: 10px;
        margin-top: 8px;
    }

    /* Registration - Keep side-by-side but stack form fields */
    #registrationScreen .login-form-section {
        padding: 32px 36px;
        align-items: center;
        overflow-y: auto;
    }

    #registrationScreen .login-form-wrapper {
        max-width: 420px;
        width: 100%;
    }

    #registrationScreen .login-form-wrapper h2 {
        font-size: 24px;
        margin-bottom: 20px;
    }

    /* Stack registration form fields on tablet */
    .registration-grid-container {
        display: flex !important;
        flex-direction: column;
        gap: 12px !important;
    }

    .registration-grid-container .form-group {
        width: 100%;
    }

    .registration-grid-container .full-width {
        margin-top: 8px;
    }

    #registrationScreen .login-form input {
        padding: 14px 16px;
        font-size: 16px;
        min-height: 50px;
    }

    #registrationScreen .btn-login {
        padding: 16px;
        font-size: 16px;
        min-height: 52px;
    }

    /* Success message and shop number display */
    .shop-number-display {
        padding: 16px;
        border-radius: 12px;
    }

    /* Links below form */
    .login-form-wrapper a,
    .login-form-wrapper .form-link {
        font-size: 14px;
        padding: 8px 0;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    /* Sidebar - Hidden by default, hamburger menu triggers it */
    .sidebar {
        position: fixed;
        left: -280px;
        width: 280px;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    }

    .sidebar.mobile-open {
        left: 0;
    }

    /* Main content takes full width */
    .main-content {
        margin-left: 0;
        width: 100%;
        padding-top: 20px;
    }

    /* Show hamburger menu on tablet */
    .mobile-menu-btn {
        display: flex;
    }

    .mobile-overlay {
        display: block;
    }

    /* Tab content */
    .tab-content {
        padding: 20px;
    }

    /* Dashboard grid - 2 columns */
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .dashboard-grid-custom {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .metric-card-large,
    .metric-card-small {
        grid-column: span 1;
    }

    .metric-card {
        padding: 24px 20px;
        min-height: 120px;
    }

    .metric-value {
        font-size: 36px;
    }

    /* ==========================================
       CARD-BASED SALE ITEMS FOR TABLET
       ========================================== */
    .sale-item {
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: 20px;
        background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
        border-radius: 16px;
        border: 1px solid var(--border-light);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
        margin-bottom: 16px;
        transition: all 0.2s ease;
    }

    .sale-item:hover {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
        border-color: var(--primary-200);
    }

    /* Row 1: Search + Quantity Stepper + Remove */
    .sale-item .sale-item-row-1 {
        display: flex;
        align-items: center;
        gap: 16px;
    }

    .sale-item .searchable-dropdown {
        flex: 1;
    }

    .sale-item .item-select {
        width: 100%;
        padding: 14px 16px;
        font-size: 16px;
        min-height: 52px;
        border-radius: 12px;
        border: 2px solid var(--border);
        background: #ffffff;
        transition: all 0.2s ease;
    }

    .sale-item .item-select:focus {
        border-color: var(--primary-500);
        box-shadow: 0 0 0 4px var(--primary-100);
    }

    /* Quantity Stepper */
    .sale-item .qty-stepper {
        display: flex;
        align-items: center;
        gap: 0;
        background: var(--neutral-100);
        border-radius: 12px;
        padding: 4px;
    }

    .sale-item .qty-btn {
        width: 48px;
        height: 48px;
        border: none;
        background: #ffffff;
        color: var(--primary-600);
        font-size: 24px;
        font-weight: 600;
        cursor: pointer;
        border-radius: 10px;
        transition: all 0.15s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }

    .sale-item .qty-btn:hover {
        background: var(--primary-50);
        color: var(--primary-700);
    }

    .sale-item .qty-btn:active {
        transform: scale(0.95);
        background: var(--primary-100);
    }

    .sale-item .item-quantity {
        width: 60px;
        text-align: center;
        font-size: 18px;
        font-weight: 700;
        color: var(--text-primary);
        border: none;
        background: transparent;
        padding: 8px 4px;
        -moz-appearance: textfield;
    }

    .sale-item .item-quantity::-webkit-outer-spin-button,
    .sale-item .item-quantity::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }

    /* Remove button */
    .sale-item .btn-remove {
        width: 48px;
        height: 48px;
        font-size: 24px;
        border-radius: 12px;
        flex-shrink: 0;
    }

    /* Row 2: Price + Subtotal (right-aligned) */
    .sale-item .sale-item-row-2 {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-top: 12px;
        border-top: 1px solid var(--border-light);
    }

    .sale-item .price-group {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .sale-item .price-label {
        font-size: 14px;
        color: var(--text-tertiary);
        font-weight: 500;
    }

    .sale-item .item-price {
        width: 120px;
        padding: 10px 12px;
        font-size: 16px;
        font-weight: 600;
        text-align: right;
        border-radius: 8px;
        border: 1.5px solid var(--border);
        background: #ffffff;
        min-height: 44px;
    }

    .sale-item .item-price:focus {
        border-color: var(--primary-500);
        box-shadow: 0 0 0 3px var(--primary-100);
    }

    .sale-item .subtotal-group {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .sale-item .subtotal-label {
        font-size: 14px;
        color: var(--text-tertiary);
        font-weight: 500;
    }

    .sale-item .item-subtotal {
        font-size: 20px;
        font-weight: 700;
        color: var(--primary-700);
        background: var(--primary-50);
        padding: 10px 16px;
        border-radius: 10px;
        min-width: 120px;
        text-align: right;
    }

    /* Modals - Better use of tablet space */
    .modal-content {
        width: 80%;
        max-width: 600px;
        min-width: auto;
        padding: 24px;
        max-height: 85vh;
    }

    .modal-content.large {
        width: 90%;
        max-width: 800px;
        min-width: auto;
    }

    /* Forms - Keep 2 columns on tablet */
    .form-row {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 12px 14px;
        font-size: 15px;
        min-height: 44px;
    }

    /* Tables - Touch-friendly */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 14px;
    }

    th,
    td {
        padding: 14px 12px;
    }

    /* Action buttons - Horizontal but larger */
    .action-buttons {
        display: flex;
        flex-direction: row;
        gap: 6px;
    }

    .action-buttons button {
        padding: 10px 14px;
        font-size: 13px;
        min-height: 40px;
    }

    /* Buttons - Touch-friendly sizes */
    .btn-primary,
    .btn-secondary,
    .btn-success,
    .btn-danger,
    .btn-info,
    .btn-warning {
        min-height: 44px;
        padding: 12px 20px;
        font-size: 14px;
    }

    /* Search bar */
    .search-bar input {
        padding: 12px 16px;
        font-size: 15px;
        min-height: 44px;
    }

    /* Pagination */
    .pagination-controls {
        padding: 16px;
    }

    .btn-pagination {
        min-height: 44px;
        min-width: 44px;
        padding: 10px 14px;
    }

    /* Profit cards */
    .profit-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .analysis-grid {
        grid-template-columns: 1fr;
    }

    /* Searchable dropdown - Touch optimized */
    .searchable-dropdown .dropdown-option {
        padding: 10px 14px;
        font-size: 14px;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    /* Nav buttons in sidebar */
    .nav-btn {
        min-height: 48px;
        padding: 12px 16px;
        font-size: 15px;
    }
}

/* Tablets and Small Laptops - Legacy support */
@media (max-width: 1024px) {
    .main-container {
        padding: 15px;
    }
}

/* Tablets Portrait */
@media (max-width: 768px) {

    /* Login Screen - Stack vertically on mobile */
    .login-split-container {
        flex-direction: column;
    }

    .login-branding {
        min-height: 40vh;
        padding: 40px 24px;
    }

    .branding-content h1 {
        font-size: 32px;
    }

    .branding-subtitle {
        font-size: 16px;
        margin-bottom: 32px;
    }

    .branding-features {
        gap: 16px;
    }

    .feature-item {
        padding: 16px 20px;
    }

    .feature-icon {
        font-size: 28px;
    }

    .feature-item span:last-child {
        font-size: 14px;
    }

    .login-logo img {
        max-width: 200px;
    }

    .login-form-section {
        padding: 40px 24px;
        min-height: 60vh;
    }

    .login-form-container h2 {
        font-size: 28px;
    }

    .login-subtitle {
        font-size: 14px;
        margin-bottom: 32px;
    }

    /* Sidebar becomes overlay/drawer */
    .sidebar {
        position: fixed;
        left: -250px;
        width: 250px;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    .sidebar.mobile-open {
        left: 0;
    }

    .content,
    .main-content {
        margin-left: 0;
        width: 100%;
    }

    /* Header adjustments */
    .header {
        padding: 12px 15px;
        flex-wrap: wrap;
    }

    .header h2 {
        font-size: 20px;
        margin-bottom: 8px;
    }

    /* User info responsive */
    .nav-user {
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
        justify-content: space-between;
    }

    /* Dashboard cards */
    .dashboard-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    /* Tab content on tablets */
    .tab-content {
        padding: 20px 16px;
    }

    .dashboard-grid-custom {
        grid-template-columns: 1fr 1fr;
        gap: 18px;
    }

    /* Profit Metrics - Keep 2 on top, stack 3 below on tablet */
    .profit-metrics-top {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }

    .profit-metrics-bottom {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }

    .profit-metrics-bottom .metric-card:nth-child(3) {
        grid-column: 1 / -1;
        /* Make 3rd card full width */
    }

    .metric-card-large {
        grid-column: span 1;
        padding: 35px 28px;
        min-height: 150px;
    }

    .metric-card-large .metric-value {
        font-size: 46px;
    }

    .metric-card-small {
        grid-column: span 1;
        padding: 28px 22px;
        min-height: 120px;
    }

    .metric-card-small .metric-value {
        font-size: 38px;
    }

    .metric-card {
        padding: 30px 25px;
        min-height: 130px;
    }

    .metric-value {
        font-size: 42px;
    }

    .stat-card h3 {
        font-size: 14px;
    }

    .stat-card .value {
        font-size: 24px;
    }

    /* Tables */
    table {
        font-size: 13px;
    }

    th,
    td {
        padding: 10px 8px;
    }

    /* Action buttons in tables */
    .action-buttons {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }

    .action-buttons button {
        width: 100%;
        font-size: 12px;
        padding: 6px 10px;
    }

    /* Modals */
    .modal-content {
        width: 95%;
        max-width: 500px;
        padding: 24px 16px;
        max-height: 90vh;
        overflow-y: auto;
    }

    /* Forms */
    .form-row {
        grid-template-columns: 1fr;
    }

    /* Search and filter bars */
    .search-bar {
        flex-direction: column;
        gap: 10px;
    }

    .search-bar input {
        width: 100%;
    }

    .search-bar button {
        width: 100%;
    }
}

/* Mobile Phones */
@media (max-width: 480px) {

    /* Login Screen */
    .login-branding {
        min-height: 35vh;
        padding: 32px 20px;
    }

    .branding-content h1 {
        font-size: 28px;
    }

    .branding-subtitle {
        font-size: 15px;
        margin-bottom: 24px;
    }

    .login-logo img {
        max-width: 160px;
    }

    .login-form-section {
        padding: 32px 20px;
    }

    .login-form-container h2 {
        font-size: 24px;
    }

    .login-form input {
        padding: 14px;
        font-size: 16px;
        /* Prevents zoom on iOS */
    }

    .btn-login {
        padding: 16px;
        font-size: 16px;
    }

    .btn-primary {
        padding: 14px;
        font-size: 16px;
    }

    /* Header */
    .header {
        padding: 10px 12px;
    }

    .header h2 {
        font-size: 18px;
    }

    .user-info {
        font-size: 12px;
    }

    /* Dashboard - Single column on mobile */
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-grid-custom {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    /* Profit Metrics - Stack all vertically on mobile */
    .profit-metrics-top {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .profit-metrics-bottom {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .metric-card-large,
    .metric-card-small {
        grid-column: 1 / -1;
        padding: 25px 20px;
        min-height: 120px;
    }

    .metric-card-large .metric-value,
    .metric-card-small .metric-value {
        font-size: 36px;
    }

    .metric-card {
        padding: 25px 20px;
        min-height: 120px;
    }

    .metric-value {
        font-size: 36px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-card h3 {
        font-size: 13px;
    }

    .stat-card .value {
        font-size: 22px;
    }

    /* Tables - Horizontal scroll with better touch support */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -16px;
        /* Extend to screen edges */
        padding: 0 16px;
    }

    table {
        min-width: 100%;
        /* Responsive width */
        font-size: 12px;
    }

    th,
    td {
        padding: 10px 8px;
        font-size: 12px;
        min-width: 80px;
        /* Minimum column width */
    }

    /* Make action buttons stack on mobile */
    td .action-buttons {
        display: flex;
        flex-direction: column;
        gap: 4px;
        min-width: 100px;
    }

    td .action-buttons button {
        width: 100%;
        padding: 6px 10px;
        font-size: 11px;
    }

    /* Alternative: Card view for tables on mobile */
    .table-card-view {
        display: none;
    }

    /* Buttons */
    .btn-primary,
    .btn-success,
    .btn-info,
    .btn-danger {
        padding: 10px 16px;
        font-size: 14px;
    }

    /* Modals - Full screen on mobile for better UX */
    .modal {
        padding: 0;
        top: 0 !important;
        left: 0 !important;
        transform: none !important;
        width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important;
        margin: 0 !important;
        overflow: hidden !important;
        /* Let modal-content handle scroll */
        display: none;
        /* Keep hidden by default */
    }

    .modal.active {
        display: block !important;
    }

    .modal-content {
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        padding: 0;
        /* Remove padding from container, move to children */
        overflow: hidden;
        /* Prevent container scroll, use flex children */
        display: flex;
        flex-direction: column;
    }

    /* Wrap form content in a scrollable area */
    .modal-content form {
        display: flex;
        flex-direction: column;
        height: 100%;
        overflow: hidden;
    }

    /* The actual scrollable part */
    .modal-content .form-scroll-area,
    /* Fallback for forms without the wrapper class checking direct children could be risky, 
       so we will target the scrollable middle part universally */
    .modal-content form>div:not(.modal-header):not(.modal-actions):not(.modal-footer),
    /* Or better, make the detailed form rows scroll */
    .form-row,
    .form-group,
    #saleItems {
        /* This strategy is tricky because structure varies. 
            Better strategy: Make the form itself the flex container 
            and the actions strictly at bottom. */
    }

    /* NEW STRATEGY: 
       Header fixed at top.
       Footer (modal-actions) fixed at bottom.
       Everything in between scrolls.
    */

    .modal-header {
        flex-shrink: 0;
        padding: 16px;
        background: white;
        border-bottom: 1px solid #e2e8f0;
        margin-bottom: 0;
    }

    /* Create a scrollable container for the form inputs */
    .modal-content form {
        flex: 1;
        overflow-y: auto;
        padding: 16px;
        padding-bottom: 80px;
        /* Space for fixed footer */
        -webkit-overflow-scrolling: touch;
        display: block;
        /* Reset flex if it was set */
    }

    /* Fix the actions to the bottom */
    .modal-actions {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        padding: 12px 16px;
        border-top: 1px solid #e2e8f0;
        z-index: 20;
        margin-top: 0;
        display: flex;
        gap: 12px;
        box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
    }

    .modal-actions button {
        flex: 1;
        /* Make buttons verify full width/equal width */
        margin: 0;
        height: 48px;
        /* Touch friendly height */
    }

    .modal-header {
        position: sticky;
        top: 0;
        background: white;
        z-index: 10;
        padding-bottom: 12px;
        margin-bottom: 16px;
        border-bottom: 1px solid #e2e8f0;
    }

    .modal-header h3 {
        font-size: 18px;
        padding-right: 40px;
        /* Space for close button */
    }

    .modal-body {
        padding-bottom: 80px;
        /* Space for fixed footer if any */
    }

    /* Forms */
    .form-group label {
        font-size: 13px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 10px 12px;
        font-size: 16px;
        /* Prevents zoom on iOS */
    }

    /* Tab content padding adjustment */
    .tab-content {
        padding: 16px;
    }

    /* Sale items in forms */
    .sale-item {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 12px;
    }

    .sale-item select,
    .sale-item input {
        width: 100%;
    }

    /* Search bars and filters */
    .search-bar,
    .filters {
        flex-direction: column;
        gap: 10px;
    }

    .search-bar input,
    .search-bar select,
    .search-bar button {
        width: 100%;
    }

    /* Cards and sections */
    .card,
    .section {
        margin: 0 0 16px 0;
        border-radius: 8px;
    }

    /* Better touch targets for all interactive elements */
    button,
    .btn,
    a.btn {
        min-height: 44px;
        /* iOS recommended touch target */
        display: inline-flex;
        align-items: center;
        justify-content: center;
        -webkit-tap-highlight-color: rgba(16, 185, 129, 0.3);
        /* Visual feedback on tap */
        touch-action: manipulation;
        /* Disable double-tap zoom on buttons */
    }

    /* Ensure clickable elements are accessible */
    button,
    .btn,
    input[type="button"],
    input[type="submit"],
    select,
    .nav-btn {
        cursor: pointer;
        pointer-events: auto;
    }

    /* Responsive images */
    img {
        max-width: 100%;
        height: auto;
    }

    /* Status badges */
    .status-badge {
        font-size: 11px;
        padding: 4px 8px;
    }

    /* Navigation */
    .nav-btn {
        padding: 10px;
        font-size: 13px;
    }

    .nav-btn i {
        font-size: 16px;
    }

    /* Pagination on mobile */
    .pagination-controls {
        flex-direction: column;
        gap: 12px;
        padding: 16px;
    }

    .pagination-info {
        width: 100%;
        text-align: center;
        font-size: 13px;
    }

    .pagination-buttons {
        width: 100%;
        justify-content: center;
    }

    .btn-pagination {
        padding: 10px 14px;
        font-size: 13px;
        min-width: 44px;
        /* Better touch target */
    }

    /* Receipt and print styles on mobile */
    .receipt-container {
        width: 100%;
        padding: 16px;
        font-size: 12px;
    }

    /* Better spacing for form groups */
    .form-group {
        margin-bottom: 16px;
    }

    /* Improve modal close button visibility */
    .close-btn {
        position: absolute;
        top: 16px;
        right: 16px;
        width: 32px;
        height: 32px;
        font-size: 24px;
        z-index: 10;
    }
}

/* Very Small Phones */
@media (max-width: 360px) {
    .login-branding {
        padding: 24px 16px;
    }

    .login-form-section {
        padding: 24px 16px;
    }

    .branding-content h1 {
        font-size: 24px;
    }

    .login-form-container h2 {
        font-size: 22px;
    }

    .header h2 {
        font-size: 16px;
    }

    .stat-card .value {
        font-size: 20px;
    }

    table {
        font-size: 11px;
    }

    .btn-primary,
    .btn-success {
        font-size: 13px;
        padding: 8px 12px;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {

    /* Larger tap targets for touch devices */
    button,
    .btn-primary,
    .btn-success,
    .btn-info,
    .btn-danger {
        min-height: 44px;
        /* Apple's recommended minimum */
        min-width: 44px;
    }

    .nav-btn {
        min-height: 48px;
    }

    /* Remove hover effects on touch devices */
    button:hover,
    .nav-btn:hover {
        transform: none;
    }

    /* Better focus states for accessibility */
    button:active,
    .nav-btn:active {
        transform: scale(0.97);
        opacity: 0.9;
    }
}

/* Landscape mode for phones */
@media (max-width: 768px) and (orientation: landscape) {
    .login-split-container {
        flex-direction: row;
    }

    .login-branding {
        min-height: 100vh;
        flex: 0.4;
    }

    .login-form-section {
        flex: 0.6;
        overflow-y: auto;
    }

    .branding-features {
        display: none;
        /* Hide features in landscape to save space */
    }

    .modal-content {
        max-height: 85vh;
    }
}

/* Print styles */
@media print {

    .sidebar,
    .header,
    .action-buttons,
    .search-bar,
    .btn-primary,
    .btn-success {
        display: none !important;
    }

    .content {
        margin-left: 0;
        width: 100%;
    }

    table {
        page-break-inside: avoid;
    }

    .pagination-controls {
        display: none !important;
    }
}

/* Pagination Controls */
.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    margin-top: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    flex-wrap: wrap;
    gap: 15px;
}

.pagination-info {
    font-size: 14px;
    color: #64748b;
    font-weight: 500;
}

.pagination-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.btn-pagination {
    padding: 8px 12px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #475569;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 40px;
}

.btn-pagination:hover:not(:disabled) {
    background: #f8fafc;
    border-color: #1e40af;
    color: #1e40af;
    transform: translateY(-1px);
}

.btn-pagination:active:not(:disabled) {
    transform: translateY(0);
}

.btn-pagination.active {
    background: var(--primary-500);
    border-color: var(--primary-500);
    color: white;
    font-weight: 700;
}


.btn-pagination:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f8fafc;
}

/* Responsive pagination */
@media (max-width: 768px) {
    .pagination-controls {
        flex-direction: column;
        align-items: stretch;
        padding: 15px;
    }

    .pagination-info {
        text-align: center;
        order: 1;
    }

    .pagination-buttons {
        justify-content: center;
        order: 2;
    }

    .btn-pagination {
        padding: 10px 12px;
        min-width: 35px;
        font-size: 13px;
    }
}

/* Loading spinner animation */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ========================================
   MOBILE MENU BUTTON & OVERLAY
   ======================================== */

/* Mobile Menu Button (Hamburger) */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: #1e40af;
    border: none;
    border-radius: 8px;
    width: 45px;
    height: 45px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.mobile-menu-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-menu-btn:hover {
    background: #1e3a8a;
    transform: scale(1.05);
}

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

/* Hamburger animation when menu is open */
.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Mobile Overlay */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}

.mobile-overlay.active {
    opacity: 1;
}

/* Show mobile menu button and overlay on mobile devices */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
    }

    .mobile-overlay {
        display: block;
    }

    /* Ensure sidebar is above overlay */
    .sidebar {
        z-index: 1000;
    }
}

/* Tablet size - keep menu button but adjust size */
@media (max-width: 1024px) and (min-width: 769px) {
    .mobile-menu-btn {
        display: flex;
        width: 40px;
        height: 40px;
    }

    .mobile-menu-btn span {
        width: 20px;
    }
}

/* ============================
   PROFIT ANALYSIS SECTION
   ============================ */

.profit-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.profit-card {
    background: white;
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    border-left: 3px solid;
    display: flex;
    gap: 12px;
    align-items: center;
    transition: all 0.2s ease;
}

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

.profit-card.primary {
    border-color: var(--primary-500);
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.05);
}


.profit-card.success {
    border-color: var(--success-500);
    background: white;
}

.profit-card.info {
    border-color: var(--info-500);
    background: white;
}

.profit-card.warning {
    border-color: var(--warning-500);
    background: white;
}

.profit-content {
    flex: 1;
}

.profit-content h3 {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.profit-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.profit-subtitle {
    font-size: 10px;
    color: var(--text-tertiary);
}

/* Analysis Grid */
.analysis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.analysis-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.analysis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-light);
}

.analysis-header h3 {
    font-size: 18px;
    color: var(--text-primary);
    font-weight: 700;
}

.analysis-badge {
    padding: 4px 12px;
    background: var(--primary-100);
    color: var(--primary-700);
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.items-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--neutral-50);
    border-radius: 12px;
    border-left: 4px solid var(--primary-500);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border-light);
    border-left: 4px solid var(--primary-500);
}


.item-row:hover {
    background: var(--primary-50);
    transform: translateX(4px);
}

.item-row.top {
    border-left-color: var(--success-500);
}

.item-row.low {
    border-left-color: var(--error-500);
}

.item-info {
    flex: 1;
}

.item-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
    margin-bottom: 4px;
}

.item-sku {
    font-size: 12px;
    color: var(--text-tertiary);
}

.item-stats {
    text-align: right;
}

.item-value {
    font-weight: 700;
    font-size: 16px;
    color: var(--primary-600);
}

.item-label {
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
}

/* Analysis Table Section */
.analysis-table-section {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.analysis-table-section h3 {
    font-size: 20px;
    color: var(--text-primary);
    margin-bottom: 20px;
    font-weight: 700;
}

.profit-positive {
    color: var(--success-600);
    font-weight: 600;
}

.profit-negative {
    color: var(--error-600);
    font-weight: 600;
}

.margin-high {
    background: var(--success-50);
    color: var(--success-700);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.margin-medium {
    background: var(--warning-50);
    color: var(--warning-700);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.margin-low {
    background: var(--error-50);
    color: var(--error-700);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.period-select {
    padding: 8px 16px;
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    background: white;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.period-select:hover {
    border-color: var(--primary-500);
}

.period-select:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-100);
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* ========================================
   P&L REPORTS & EXPENSE MANAGEMENT STYLES
   ======================================== */

/* Sub-tabs styling */
.sub-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--neutral-200);
    padding-bottom: 0;
}

.sub-tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    color: var(--neutral-600);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

.sub-tab-btn:hover {
    color: var(--primary-600);
    background: var(--primary-50);
}

.sub-tab-btn.active {
    color: var(--primary-700);
    border-bottom-color: var(--primary-700);
}

.sub-tab-content {
    display: none;
}

.sub-tab-content.active {
    display: block;
}

/* Section container for grouped content */
.section-container {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.section-container h3 {
    margin: 0 0 16px 0;
    color: var(--neutral-800);
    font-size: 18px;
    font-weight: 600;
}

.section-header {
    margin-bottom: 24px;
}

/* Expense form styling */
#expenseCategory {
    width: 100%;
}

#expenseDescription {
    width: 100%;
    resize: vertical;
    font-family: inherit;
    padding: 10px;
    border: 1px solid var(--neutral-300);
    border-radius: var(--radius-md);
    font-size: 14px;
}

#expenseDescription:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-100);
}

/* Button icon styling */
.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    opacity: 0.7;
    transition: opacity 0.2s, transform 0.1s;
}

.btn-icon:hover {
    opacity: 1;
    transform: scale(1.1);
}

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

/* Period select styling enhancement */
.period-select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--neutral-200);
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.period-select:hover {
    background: var(--neutral-300);
    color: var(--text-primary);
    border-color: var(--neutral-400);
}

/* Status badge enhancements for expense categories */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    background: var(--primary-100);
    color: var(--primary-700);
}

/* ========================================
   NOTIFICATIONS
   ======================================== */
#notificationContainer {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    /* Allow clicks to pass through container */
}

.notification {
    background: white;
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
    transform: translateX(120%);
    transition: transform 0.3s ease;
    pointer-events: auto;
    /* Re-enable clicks on notifications */
    border-left: 4px solid #333;
    font-size: 14px;
    color: #333;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    border-left-color: #22c55e;
}

.notification.success::before {
    content: '✓';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #dcfce7;
    color: #16a34a;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
}

.notification.error {
    border-left-color: #ef4444;
}

.notification.error::before {
    content: '!';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #fee2e2;
    color: #dc2626;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
}

.notification.info {
    border-left-color: #3b82f6;
}

.notification.info::before {
    content: 'i';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #dbeafe;
    color: #2563eb;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
}

.notification.warning {
    border-left-color: #f59e0b;
}

.notification.warning::before {
    content: '⚠';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #fef3c7;
    color: #d97706;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
}

/* ========================================
   PURCHASE ITEMS UI IMPROVEMENTS
   ======================================== */
.purchase-items-header {
    display: grid;
    grid-template-columns: 1fr 3fr 1fr 1.5fr 1.5fr auto;
    gap: 10px;
    padding: 10px 15px;
    background: #f1f5f9;
    font-weight: 600;
    font-size: 13px;
    color: #475569;
    border-radius: 6px;
    margin-bottom: 8px;
    align-items: center;
}

.purchase-item-row {
    display: grid;
    grid-template-columns: 1fr 3fr 1fr 1.5fr 1.5fr auto;
    gap: 10px;
    padding: 8px 15px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    margin-bottom: 8px;
    align-items: center;
    transition: all 0.2s ease;
}

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

.purchase-item-row input {
    margin: 0 !important;
    width: 100%;
}

/* Special styling for remove button */
.btn-remove-item {
    width: 24px;
    height: 24px;
    padding: 0;
    background: #fee2e2;
    color: #dc2626;
    border: none;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: all 0.2s;
}

.btn-remove-item:hover {
    background: #dc2626;
    color: white;
}

/* Make read-only total input look distinct */
.item-total {
    background-color: #f8fafc !important;
    border-color: #e2e8f0 !important;
    font-weight: 600;
    color: #334155 !important;
}

/* Supplier Autocomplete Suggestions */
.autocomplete-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0 0 8px 8px;
    z-index: 1000;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.suggestion-item {
    padding: 10px 15px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 14px;
    color: #334155;
    border-bottom: 1px solid #f1f5f9;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: #f1f5f9;
    color: #2563eb;
}

#addPurchaseModal .modal-content {
    padding: 15px 25px;
    max-height: 85vh;
}

#addPurchaseForm .form-row {
    margin-bottom: 8px;
}

#addPurchaseForm .form-group label {
    font-size: 0.9rem;
    margin-bottom: 3px;
}

#addPurchaseForm input,
#addPurchaseForm select {
    padding: 8px 10px;
    font-size: 0.9rem;
}

#addPurchaseForm h3 {
    margin-top: 10px !important;
    margin-bottom: 6px !important;
    font-size: 1rem;
}

/* Hide scrollbar but allow content to fit */
#addPurchaseModal .modal-content {
    overflow-y: hidden !important;
}

/* Filter Section Layout */
.filter-section {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-section .btn-secondary {
    margin-left: auto;
}

@keyframes successPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }

    50% {
        transform: scale(1.02);
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.success-pulse {
    animation: successPulse 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

#notificationContainer {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.notification {
    padding: 16px 24px;
    border-radius: 12px;
    background: white;
    color: var(--neutral-900);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 12px;
    border-left: 4px solid var(--primary-500);
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 300px;
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification.success {
    border-left-color: #10b981;
}

.notification.error {
    border-left-color: #ef4444;
}

.notification.warning {
    border-left-color: #f59e0b;
}

/* ========================================
   ENHANCED DROPDOWN & SELECT STYLES
   ======================================== */

/* Base select styling */
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M2.22 4.22a.75.75 0 0 1 1.06 0L6 6.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L2.22 5.28a.75.75 0 0 1 0-1.06z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 36px !important;
    cursor: pointer;
}

select:hover {
    border-color: var(--primary-400);
}

/* Enhanced form select styling */
.form-group select {
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%234f46e5' d='M4.22 6.22a.75.75 0 0 1 1.06 0L8 8.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L4.22 7.28a.75.75 0 0 1 0-1.06z'/%3E%3C/svg%3E");
    background-position: right 14px center;
    background-size: 14px;
    padding-right: 40px !important;
    font-weight: 500;
    transition: all 0.2s ease;
}

.form-group select:hover {
    border-color: var(--primary-400);
    background-color: var(--primary-50);
}

.form-group select:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 4px var(--primary-100);
    background-color: #ffffff;
}

/* Select option styling */
select option {
    padding: 12px 16px;
    background: #ffffff;
    color: var(--neutral-900);
    font-weight: 400;
}

select option:hover,
select option:focus,
select option:checked {
    background: var(--primary-50);
    color: var(--primary-700);
}


/* Sale item grid children sizing */
.sale-item .searchable-dropdown {
    width: 100%;
    min-width: 0;
}

/* Sale item select (item picker in sales modal) */
.sale-item .item-select {
    width: 100%;
    min-width: 0;
    background: #ffffff;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 500;
    color: var(--neutral-800);
    transition: all 0.2s ease;
}

.sale-item .item-select:hover {
    border-color: var(--primary-400);
    background-color: var(--primary-50);
}

.sale-item .item-select:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-100);
    background-color: #ffffff;
}

.sale-item .item-select::placeholder {
    color: var(--neutral-400);
    font-weight: 400;
}

/* Enhanced sale item inputs */
.sale-item input[type="number"] {
    width: 100%;
    min-width: 0;
    background: #ffffff;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--neutral-800);
    transition: all 0.2s ease;
    text-align: center;
}

.sale-item input[type="number"]:hover {
    border-color: var(--primary-400);
}

.sale-item input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-100);
}

/* Enhanced period select styling override */
.period-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding: 10px 40px 10px 16px;
    border: 2px solid var(--border-light);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    background: white;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath fill='%236366f1' d='M3.22 5.22a.75.75 0 0 1 1.06 0L7 7.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L3.22 6.28a.75.75 0 0 1 0-1.06z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 140px;
}

.period-select:hover {
    border-color: var(--primary-400);
    background-color: var(--primary-50);
}

.period-select:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 4px var(--primary-100);
    background-color: white;
}

/* Return invoice select */
#returnInvoice {
    padding: 12px 40px 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    background: white;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath fill='%236366f1' d='M3.22 5.22a.75.75 0 0 1 1.06 0L7 7.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L3.22 6.28a.75.75 0 0 1 0-1.06z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 14px;
    width: 100%;
    cursor: pointer;
    transition: all 0.2s ease;
}

#returnInvoice:hover {
    border-color: var(--primary-400);
}

#returnInvoice:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 4px var(--primary-100);
}

/* Report modal selects */
#reportType,
#dateRange,
#exportFormat {
    padding: 12px 40px 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    background: white;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath fill='%236366f1' d='M3.22 5.22a.75.75 0 0 1 1.06 0L7 7.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L3.22 6.28a.75.75 0 0 1 0-1.06z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#reportType:hover,
#dateRange:hover,
#exportFormat:hover {
    border-color: var(--primary-400);
    background-color: var(--primary-50);
}

#reportType:focus,
#dateRange:focus,
#exportFormat:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 4px var(--primary-100);
    background-color: white;
}

/* Purchase form selects */
#addPurchaseForm select,
#purchasePaymentMethod {
    appearance: none;
    -webkit-appearance: none;
    padding: 12px 40px 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    background: white;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath fill='%236366f1' d='M3.22 5.22a.75.75 0 0 1 1.06 0L7 7.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L3.22 6.28a.75.75 0 0 1 0-1.06z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#addPurchaseForm select:hover,
#purchasePaymentMethod:hover {
    border-color: var(--primary-400);
}

#addPurchaseForm select:focus,
#purchasePaymentMethod:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 4px var(--primary-100);
}

/* User role select */
#newUserRole {
    padding: 12px 40px 12px 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath fill='%236366f1' d='M3.22 5.22a.75.75 0 0 1 1.06 0L7 7.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L3.22 6.28a.75.75 0 0 1 0-1.06z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 14px;
}

/* Payment method selects */
#salePaymentMethod,
#expensePaymentMethod {
    padding: 12px 40px 12px 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath fill='%236366f1' d='M3.22 5.22a.75.75 0 0 1 1.06 0L7 7.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L3.22 6.28a.75.75 0 0 1 0-1.06z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 14px;
}

.sale-item:hover {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border-color: var(--primary-200);
}

/* Remove button styling */
.sale-item .btn-remove {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--error-50);
    color: var(--error-600);
    border: 1px solid var(--error-200);
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sale-item .btn-remove:hover {
    background: var(--error-100);
    border-color: var(--error-300);
    color: var(--error-700);
    transform: scale(1.05);
}

/* Enhanced subtotal display */
.item-subtotal {
    font-weight: 700;
    color: var(--primary-700);
    font-size: 15px;
    background: var(--primary-50);
    padding: 8px 12px;
    border-radius: 8px;
    text-align: center;
    min-width: 100px;
}

/* ========================================
   SEARCHABLE DROPDOWN COMPONENT
   ======================================== */

.searchable-dropdown {
    position: relative;
    width: 100%;
}

.searchable-dropdown input {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--neutral-50);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.searchable-dropdown input:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.searchable-dropdown input::placeholder {
    color: var(--neutral-400);
    font-weight: 400;
}

.searchable-dropdown .dropdown-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 300px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: none;
}

.searchable-dropdown .dropdown-options.show {
    display: block;
}

.searchable-dropdown .dropdown-option {
    padding: 6px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    color: var(--text-primary);
    transition: background 0.1s ease;
    line-height: 1.3;
}

.searchable-dropdown .dropdown-option:last-child {
    border-bottom: none;
}

.searchable-dropdown .dropdown-option:hover {
    background: var(--primary-50);
}

.searchable-dropdown .dropdown-option.selected {
    background: var(--primary-100);
    font-weight: 600;
}

.searchable-dropdown .no-options {
    padding: 10px;
    text-align: center;
    color: var(--text-tertiary);
    font-style: italic;
    font-size: 13px;
}

/* Return Items List Styling */
.return-item-row {
    background: white;
    border: 1px solid transparent;
}

.return-item-checkbox {
    width: 18px;
    height: 18px;
}

.item-details {
    flex: 1;
}

.return-qty-label {
    font-size: 12px;
    margin-right: 5px;
}

.return-qty-input {
    width: 60px;
    padding: 4px;
    border: 1px solid #ddd;
    border-radius: 3px;
}

/* Clickable Dashboard Cards */
.clickable-card {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.clickable-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Non-clickable Dashboard Cards (for non-admin users) */
.non-clickable-card {
    cursor: default !important;
    pointer-events: none;
}

.non-clickable-card:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* ========================================
   MOBILE ENHANCEMENTS - SMARTPHONE OPTIMIZATION
   ======================================== */

/* Bottom Navigation Bar */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    z-index: 1001;
    padding: 8px 0;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
}

.bottom-nav-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-width: 100%;
    margin: 0 auto;
}

.bottom-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 70px;
    min-height: 56px;
    border-radius: 12px;
    -webkit-tap-highlight-color: rgba(30, 64, 175, 0.2);
    touch-action: manipulation;
    user-select: none;
    position: relative;
    z-index: 1;
}

.bottom-nav-btn svg {
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
    stroke-width: 1.8;
    pointer-events: none;
}

.bottom-nav-btn span {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
    pointer-events: none;
}

.bottom-nav-btn.active {
    color: var(--primary-500);
    background: var(--primary-50);
}

.bottom-nav-btn:active {
    transform: scale(0.92);
    background: var(--primary-100);
}

/* Mobile Table Card View */
@media (max-width: 768px) {

    /* Show bottom navigation - managed by JS to show only after login */
    .bottom-nav {
        display: none;
    }

    /* Hide FAB on mobile as it duplicates bottom nav functionality */
    .fab {
        display: none !important;
    }

    /* Ensure body and html allow scrolling */
    html,
    body {
        overflow-x: hidden;
        overflow-y: auto !important;
        height: auto;
        min-height: 100vh;
        -webkit-overflow-scrolling: touch;
    }

    /* Add padding to main content to account for bottom nav */
    .main-content {
        padding-top: 0 !important;
        margin-top: 0 !important;
        padding-bottom: calc(80px + env(safe-area-inset-bottom)) !important;
        overflow-y: auto !important;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        height: auto;
        min-height: 100vh;
    }

    /* Tab content should scroll */
    .tab-content {
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        max-height: none;
    }

    /* Screen containers */
    .screen {
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }

    /* Allow mainApp to expand beyond viewport */
    #mainApp {
        height: auto !important;
        min-height: 100vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    #mainApp.active {
        display: block !important;
    }

    /* Hide scrollbar on mobile for cleaner look */
    .table-container {
        -ms-overflow-style: none;
        scrollbar-width: none;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-container::-webkit-scrollbar {
        display: none;
    }

    /* Table to Card Transformation */
    .data-table.mobile-cards,
    #inventoryTable.mobile-cards,
    #salesTable.mobile-cards,
    #customersTable.mobile-cards,
    #returnsTable.mobile-cards,
    #purchasesTable.mobile-cards {
        display: block;
    }

    .data-table.mobile-cards thead,
    #inventoryTable.mobile-cards thead,
    #salesTable.mobile-cards thead,
    #customersTable.mobile-cards thead,
    #returnsTable.mobile-cards thead,
    #purchasesTable.mobile-cards thead {
        display: none;
    }

    .data-table.mobile-cards tbody,
    #inventoryTable.mobile-cards tbody,
    #salesTable.mobile-cards tbody,
    #customersTable.mobile-cards tbody,
    #returnsTable.mobile-cards tbody,
    #purchasesTable.mobile-cards tbody {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .data-table.mobile-cards tr,
    #inventoryTable.mobile-cards tr,
    #salesTable.mobile-cards tr,
    #customersTable.mobile-cards tr,
    #returnsTable.mobile-cards tr,
    #purchasesTable.mobile-cards tr {
        display: block;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 16px;
        box-shadow: var(--shadow-sm);
    }

    .data-table.mobile-cards td,
    #inventoryTable.mobile-cards td,
    #salesTable.mobile-cards td,
    #customersTable.mobile-cards td,
    #returnsTable.mobile-cards td,
    #purchasesTable.mobile-cards td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border-bottom: 1px solid var(--border-light);
        font-size: 14px;
    }

    .data-table.mobile-cards td:last-child,
    #inventoryTable.mobile-cards td:last-child,
    #salesTable.mobile-cards td:last-child,
    #customersTable.mobile-cards td:last-child,
    #returnsTable.mobile-cards td:last-child,
    #purchasesTable.mobile-cards td:last-child {
        border-bottom: none;
        padding-top: 12px;
    }

    .data-table.mobile-cards td::before,
    #inventoryTable.mobile-cards td::before,
    #salesTable.mobile-cards td::before,
    #customersTable.mobile-cards td::before,
    #returnsTable.mobile-cards td::before,
    #purchasesTable.mobile-cards td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary);
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        flex-shrink: 0;
        margin-right: 16px;
    }

    /* Action buttons in card view */
    .data-table.mobile-cards td .btn-group,
    .data-table.mobile-cards td .action-buttons,
    .mobile-cards .action-buttons {
        display: flex;
        gap: 8px;
        width: 100%;
        justify-content: stretch;
        flex-wrap: wrap;
    }

    .data-table.mobile-cards td .btn-group .btn,
    .data-table.mobile-cards td .action-buttons button,
    .mobile-cards .action-buttons button,
    .action-buttons button {
        flex: 1;
        min-width: 80px;
        min-height: 44px;
        padding: 10px 16px;
        font-size: 14px;
        font-weight: 600;
        border-radius: 8px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
        cursor: pointer;
    }

    /* Card header styling for first cell */
    .data-table.mobile-cards td:first-child {
        font-weight: 600;
        font-size: 15px;
        color: var(--text-primary);
        padding-bottom: 12px;
        margin-bottom: 4px;
        border-bottom: 2px solid var(--primary-100);
    }

    .data-table.mobile-cards td:first-child::before {
        display: none;
    }

    /* Global mobile button improvements */
    button,
    .btn,
    .btn-primary,
    .btn-secondary,
    .btn-success,
    .btn-danger,
    .btn-info,
    .btn-warning,
    [type="button"],
    [type="submit"] {
        min-height: 44px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(30, 64, 175, 0.2);
        cursor: pointer;
    }

    /* Ensure buttons in tables are clickable */
    table button,
    .table-container button,
    td button {
        position: relative;
        z-index: 1;
        min-height: 36px;
        padding: 8px 12px;
    }

    /* Nav buttons in sidebar */
    .nav-btn {
        min-height: 48px;
        touch-action: manipulation;
    }

    /* Hide company name in dashboard header on mobile, show only 'Dashboard' */
    #dashboardBusinessName {
        display: none !important;
    }
}

/* Purchase/Inventory Form Mobile Optimization */
@media (max-width: 768px) {

    /* Purchase item grid - stack on mobile */
    .purchase-item-row,
    .inventory-form-grid,
    .sale-item-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
        padding: 16px !important;
        background: var(--neutral-50);
        border-radius: 12px;
        margin-bottom: 12px;
        border: 1px solid var(--border);
    }

    .purchase-item-row input,
    .purchase-item-row select,
    .inventory-form-grid input,
    .inventory-form-grid select {
        width: 100% !important;
        min-height: 48px;
        font-size: 16px !important;
    }

    /* Form sections */
    .form-section {
        padding: 16px;
        margin-bottom: 16px;
    }

    .form-section h3,
    .form-section h4 {
        font-size: 16px;
        margin-bottom: 16px;
    }

    /* Form grid single column on mobile */
    .form-grid,
    .form-row {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    /* Input groups */
    .input-group {
        flex-direction: column;
    }

    .input-group label {
        margin-bottom: 6px;
        font-size: 13px;
        font-weight: 600;
        color: var(--text-secondary);
    }

    .input-group input,
    .input-group select,
    .input-group textarea {
        width: 100%;
        min-height: 48px;
        font-size: 16px;
        padding: 12px 14px;
        border-radius: 10px;
    }

    /* Remove item button in forms */
    .remove-item-btn,
    .delete-row-btn {
        position: static !important;
        width: 100% !important;
        margin-top: 8px;
        min-height: 44px;
    }

    /* Quantity steppers */
    .quantity-stepper,
    .qty-stepper {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
    }

    .quantity-stepper button,
    .qty-stepper button {
        min-width: 48px;
        min-height: 48px;
        font-size: 20px;
    }

    .quantity-stepper input,
    .qty-stepper input {
        width: 80px;
        text-align: center;
        font-size: 18px;
        font-weight: 600;
    }
}

/* Very Small Screen Optimizations (360px and below) */
@media (max-width: 360px) {
    .bottom-nav-btn {
        padding: 6px 8px;
        min-width: 56px;
    }

    .bottom-nav-btn svg {
        width: 22px;
        height: 22px;
    }

    .bottom-nav-btn span {
        font-size: 9px;
    }

    /* Smaller card padding */
    .data-table.mobile-cards tr {
        padding: 12px;
    }

    .data-table.mobile-cards td {
        font-size: 13px;
    }

    /* Compact form inputs */
    .input-group input,
    .input-group select {
        min-height: 44px;
        padding: 10px 12px;
    }
}

/* Touch Device Specific Enhancements */
@media (hover: none) and (pointer: coarse) {

    /* Larger touch targets */
    .bottom-nav-btn {
        min-height: 56px;
    }

    /* Disable hover effects */
    .bottom-nav-btn:hover {
        background: transparent;
    }

    .bottom-nav-btn.active:hover {
        background: var(--primary-50);
    }

    /* Better tap feedback */
    .data-table.mobile-cards tr:active {
        background: var(--neutral-100);
        transform: scale(0.99);
    }

    /* Ensure all buttons are easily tappable */
    button,
    .btn,
    [type="button"],
    [type="submit"],
    a.btn {
        min-height: 44px;
        min-width: 44px;
        position: relative;
    }

    /* Active state feedback for all buttons */
    button:active,
    .btn:active,
    [type="button"]:active,
    [type="submit"]:active {
        transform: scale(0.97);
        opacity: 0.9;
    }

    /* Prevent text selection on buttons */
    button,
    .btn {
        user-select: none;
        -webkit-user-select: none;
    }

    /* Swipe hint for tables not in card mode */
    .table-container::after {
        content: '';
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 40px;
        background: linear-gradient(to left, var(--surface), transparent);
        pointer-events: none;
        opacity: 0.8;
    }

    .table-container.scrolled-right::after {
        opacity: 0;
    }
}

/* Landscape Orientation Adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    .bottom-nav {
        padding: 6px 0;
        padding-bottom: calc(6px + env(safe-area-inset-bottom));
    }

    .bottom-nav-btn svg {
        width: 20px;
        height: 20px;
        margin-bottom: 2px;
    }

    .bottom-nav-btn span {
        font-size: 9px;
    }

    /* Reduce main content bottom padding in landscape */
    .main-content {
        padding-bottom: calc(60px + env(safe-area-inset-bottom)) !important;
    }
}

/* Mobile Modal Improvements */
@media (max-width: 768px) {
    .modal-content {
        border-radius: 20px 20px 0 0 !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        transform: none !important;
        max-height: 90vh !important;
        width: 100% !important;
        animation: slideUpModal 0.3s ease-out;
    }

    @keyframes slideUpModal {
        from {
            transform: translateY(100%);
        }

        to {
            transform: translateY(0);
        }
    }

    .modal-header {
        padding: 20px 16px 16px;
        border-bottom: 1px solid var(--border);
        position: sticky;
        top: 0;
        background: var(--surface);
        z-index: 1;
        border-radius: 20px 20px 0 0;
    }

    .modal-header::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 4px;
        background: var(--neutral-300);
        border-radius: 2px;
    }

    .modal-body {
        padding: 16px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        max-height: calc(90vh - 140px);
        overscroll-behavior: contain;
    }

    .modal-footer {
        padding: 16px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
        border-top: 1px solid var(--border);
        position: sticky;
        bottom: 0;
        background: var(--surface);
    }

    .modal-footer .btn {
        width: 100%;
        min-height: 48px;
        margin: 4px 0;
    }
}

/* Mobile Search and Filter Improvements */
@media (max-width: 768px) {

    .search-filters,
    .filter-bar,
    .toolbar {
        flex-direction: column !important;
        gap: 12px !important;
        padding: 12px !important;
    }

    .search-filters input,
    .search-filters select,
    .filter-bar input,
    .filter-bar select {
        width: 100% !important;
        min-height: 48px;
    }

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

    .search-box input {
        width: 100%;
        padding-left: 44px;
    }

    /* Action buttons in toolbar */
    .toolbar .btn,
    .filter-bar .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Mobile Dashboard Cards */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .stat-card,
    .dashboard-card {
        padding: 16px !important;
    }

    .stat-card h3,
    .card-value {
        font-size: 24px !important;
    }

    .stat-card p,
    .card-label {
        font-size: 12px !important;
    }

    /* Ensure all scrollable containers work on mobile */
    .dashboard-grid-custom,
    .card-content,
    .table-wrapper,
    .form-container,
    .content-wrapper {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Tab header should not block scrolling */
    .tab-header {
        position: relative;
        z-index: 1;
    }

    /* Ensure cards and lists are scrollable */
    .metric-card,
    .stat-card,
    .dashboard-card {
        overflow: visible;
    }

    /* Fix any height constraints */
    .tab-content.active {
        display: block;
        height: auto;
        min-height: auto;
    }
}

/* Pull to Refresh Indicator (visual only - JS required for functionality) */
.pull-to-refresh {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--primary-50);
    justify-content: center;
    align-items: center;
    z-index: 999;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.pull-to-refresh.active {
    transform: translateY(0);
}

.pull-to-refresh .spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--primary-200);
    border-top-color: var(--primary-500);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Floating Action Button for Quick Actions */
.fab {
    display: none;
    position: fixed;
    bottom: calc(85px + env(safe-area-inset-bottom));
    right: 16px;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--primary-500);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.4);
    cursor: pointer;
    z-index: 998;
    transition: all 0.3s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.3);
}

.fab svg {
    width: 24px;
    height: 24px;
    pointer-events: none;
}

.fab:active {
    transform: scale(0.9);
    background: var(--primary-600);
}

@media (max-width: 768px) {
    .fab {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Hide sidebar completely on mobile - using bottom nav instead */
@media (max-width: 768px) {
    .sidebar {
        display: none !important;
        visibility: hidden;
    }

    /* Adjust main content to take full width */
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }
}

/* ========================================
   OFFLINE MODE STYLES
   ======================================== */

/* Persistent Offline Banner */
.offline-banner {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: white;
    padding: 10px 20px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    animation: slideDown 0.3s ease-out;
}

.offline-banner.show {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.offline-banner svg {
    flex-shrink: 0;
}

.offline-banner-text {
    display: flex;
    align-items: center;
    gap: 8px;
}

.offline-banner-dismiss {
    position: absolute;
    right: 15px;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.offline-banner-dismiss:hover {
    opacity: 1;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Adjust body padding when banner is visible */
body.offline-banner-visible {
    padding-top: 44px;
}

body.offline-banner-visible .sidebar {
    top: 44px;
    height: calc(100vh - 44px);
}

/* Disabled Navigation Items (Offline) */
.nav-btn.offline-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    position: relative;
}

.nav-btn.offline-disabled::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='1' y1='1' x2='23' y2='23'%3E%3C/line%3E%3Cpath d='M16.72 11.06A10.94 10.94 0 0 1 19 12.55'%3E%3C/path%3E%3Cpath d='M5 12.55a10.94 10.94 0 0 1 5.17-2.39'%3E%3C/path%3E%3Cpath d='M10.71 5.05A16 16 0 0 1 22.58 9'%3E%3C/path%3E%3Cpath d='M1.42 9a15.91 15.91 0 0 1 4.7-2.88'%3E%3C/path%3E%3Cpath d='M8.53 16.11a6 6 0 0 1 6.95 0'%3E%3C/path%3E%3Cline x1='12' y1='20' x2='12.01' y2='20'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
}

/* Offline Tooltip */
.nav-btn.offline-disabled .offline-tooltip {
    display: none;
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 10px;
    padding: 8px 12px;
    background: #333;
    color: white;
    font-size: 12px;
    border-radius: 6px;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.nav-btn.offline-disabled .offline-tooltip::before {
    content: '';
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-right-color: #333;
}

.nav-btn.offline-disabled:hover .offline-tooltip {
    display: block;
}

/* Bottom nav offline disabled state */
.bottom-nav-btn.offline-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.bottom-nav-btn.offline-disabled .bottom-nav-icon {
    position: relative;
}

.bottom-nav-btn.offline-disabled::after {
    content: '';
    position: absolute;
    top: 5px;
    right: 50%;
    transform: translateX(50%) translateX(12px);
    width: 12px;
    height: 12px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='1' y1='1' x2='23' y2='23'%3E%3C/line%3E%3Cpath d='M16.72 11.06A10.94 10.94 0 0 1 19 12.55'%3E%3C/path%3E%3Cpath d='M5 12.55a10.94 10.94 0 0 1 5.17-2.39'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
}

/* Disabled buttons within content */
.btn.offline-disabled,
button.offline-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    position: relative;
}

/* Card/Section disabled state */
.card.offline-disabled,
.section.offline-disabled {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.card.offline-disabled::before,
.section.offline-disabled::before {
    content: 'Requires Internet';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    z-index: 10;
    white-space: nowrap;
}

/* Dark mode adjustments */
[data-theme="dark"] .offline-banner {
    background: linear-gradient(135deg, #d35400 0%, #c0392b 100%);
}

[data-theme="dark"] .nav-btn.offline-disabled .offline-tooltip {
    background: #1a1a2e;
    border: 1px solid #333;
}

[data-theme="dark"] .nav-btn.offline-disabled .offline-tooltip::before {
    border-right-color: #1a1a2e;
}

/* ===================================================================
   BATCH TRACKING & EXPIRY MANAGEMENT STYLES
   =================================================================== */

/* Expiry Status Badge Colors */
.expiry-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.expiry-badge.expired {
    background: #fee;
    color: #c53030;
    border: 1px solid #fc8181;
}

.expiry-badge.critical {
    background: #fef5e7;
    color: #e67e22;
    border: 1px solid #f39c12;
}

.expiry-badge.warning {
    background: #fef4e6;
    color: #d68910;
    border: 1px solid #f59e0b;
}

.expiry-badge.info {
    background: #e8f4fd;
    color: #1e6bb8;
    border: 1px solid #2196F3;
}

.expiry-badge.normal {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #4caf50;
}

/* Expiry Status in Table Cells */
.expiry-status {
    font-weight: 500;
}

.expiry-status.expired {
    color: #c53030;
}

.expiry-status.critical {
    color: #e67e22;
}

.expiry-status.warning {
    color: #d68910;
}

.expiry-status.info {
    color: #1e6bb8;
}

/* Batch Row Highlighting */
.batch-row.expired {
    background-color: #fff5f5;
}

.batch-row.critical {
    background-color: #fffaf0;
}

.batch-row.warning {
    background-color: #fffbf0;
}

/* Expiry Alerts Dashboard */
.expiry-alerts-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.alert-card {
    padding: 15px;
    border-radius: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.alert-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.alert-card.critical {
    background: #fee;
    border-left: 4px solid #e53e3e;
}

.alert-card.warning {
    background: #fef4e6;
    border-left: 4px solid #f59e0b;
}

.alert-card.info {
    background: #e8f4fd;
    border-left: 4px solid #2196F3;
}

/* Badge on Navigation Button */
.nav-btn .badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #e53e3e;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: bold;
    min-width: 18px;
    text-align: center;
}

/* Batch Table Specific Styles */
#batchesTable tbody tr {
    transition: background-color 0.2s;
}

#batchesTable tbody tr:hover {
    background-color: #f8fafc;
}

/* Dark Mode Batch Styles */
[data-theme="dark"] .expiry-badge.expired {
    background: #4a1f1f;
    color: #fc8181;
    border-color: #c53030;
}

[data-theme="dark"] .expiry-badge.critical {
    background: #4a361f;
    color: #f6ad55;
    border-color: #e67e22;
}

[data-theme="dark"] .expiry-badge.warning {
    background: #4a3f1f;
    color: #fbd38d;
    border-color: #f59e0b;
}

[data-theme="dark"] .expiry-badge.info {
    background: #1f364a;
    color: #90cdf4;
    border-color: #2196F3;
}

[data-theme="dark"] .expiry-badge.normal {
    background: #1f4a2e;
    color: #9ae6b4;
    border-color: #4caf50;
}

[data-theme="dark"] .alert-card.critical {
    background: #2d1f1f;
    border-left-color: #fc8181;
}

[data-theme="dark"] .alert-card.warning {
    background: #2d271f;
    border-left-color: #fbd38d;
}

[data-theme="dark"] .alert-card.info {
    background: #1f2d3d;
    border-left-color: #90cdf4;
}

[data-theme="dark"] .batch-row.expired {
    background-color: #2d1f1f;
}

[data-theme="dark"] .batch-row.critical {
    background-color: #2d271f;
}

[data-theme="dark"] .batch-row.warning {
    background-color: #2d2a1f;
}

[data-theme="dark"] #batchesTable tbody tr:hover {
    background-color: #2a2a3e;
}
/* ========================================
   BATCH TRACKING ALERTS
   ======================================== */

.expiry-alerts-dashboard {
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); 
    gap: 15px; 
    margin: 20px 0;
}

.alert-card {
    padding: 15px; 
    border-radius: 8px;
    border-left-width: 4px;
    border-left-style: solid;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.alert-card .alert-label {
    font-size: 12px; 
    color: var(--neutral-600); 
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 5px;
}

.alert-card .alert-count {
    font-size: 32px; 
    font-weight: bold; 
    margin-bottom: 5px;
}

.alert-card .alert-desc {
    font-size: 13px; 
    color: var(--neutral-600);
}

/* Variant: Critical */
.alert-card.critical {
    background: #fee2e2; 
    border-left-color: #ef4444;
}

.alert-card.critical .alert-count {
    color: #ef4444;
}

/* Variant: Warning */
.alert-card.warning {
    background: #fef3c7; 
    border-left-color: #f59e0b;
}

.alert-card.warning .alert-count {
    color: #f59e0b;
}

/* Variant: Info */
.alert-card.info {
    background: #eff6ff; 
    border-left-color: #3b82f6;
}

.alert-card.info .alert-count {
    color: #3b82f6;
}


.batch-help-box {
    margin-top: 20px; 
    padding: 15px; 
    background: var(--neutral-100); 
    border-radius: 8px; 
    font-size: 13px;
    color: var(--text-secondary);
}

.batch-help-box strong {
    color: var(--text-primary);
    display: block;
    margin-bottom: 10px;
}

.batch-help-box ul {
    margin: 0;
    padding-left: 20px;
}

.batch-help-box li {
    margin-bottom: 5px;
}

