/* ============================================
   ADI ARI POS - Stylesheet
   Premium Dark Theme with Emerald Accents
   ============================================ */

:root {
    --bg-dark: #0a0d12;
    --bg-card: #111520;
    --bg-surface: #171d2a;
    --bg-input: #0e1219;
    --bg-hover: #1e2538;
    --border: #232d42;
    --border-light: #2f3d58;
    --text: #f0f4f8;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --accent: #34d399;
    --accent-hover: #10b981;
    --accent-glow: rgba(52, 211, 153, 0.15);
    --accent-2: #22d3ee;
    --danger: #f87171;
    --danger-hover: #ef4444;
    --warning: #fbbf24;
    --success: #34d399;
    --purple: #a78bfa;
    --sidebar-w: 250px;
    --topbar-h: 56px;
    --radius: 14px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --shadow: 0 4px 30px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 12px 50px rgba(0, 0, 0, 0.5);
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    overflow: hidden;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ============================================
   LOGIN SCREEN
   ============================================ */

.login-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top right, #0e1e2d 0%, #050b14 50%, #02060b 100%);
    z-index: 9999;
    perspective: 1000px;
    overflow: hidden;
}

.login-bg-shapes {
    position: absolute;
    inset: 0;
    pointer-events: none;
    transform-style: preserve-3d;
}

/* 3D Glass Panels */
.shape {
    position: absolute;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01));
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    border-radius: 30px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.shape-1 {
    width: 300px; height: 300px;
    top: 15%; left: 10%;
    animation: rotate3d_1 25s infinite linear;
}

.shape-2 {
    width: 250px; height: 250px;
    bottom: 15%; right: 10%;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.01));
    border: 1px solid rgba(16, 185, 129, 0.2);
    animation: rotate3d_2 20s infinite linear reverse;
}

.shape-3 {
    width: 180px; height: 180px;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) translateZ(-400px);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(59, 130, 246, 0.01));
    border: 1px solid rgba(59, 130, 246, 0.2);
    animation: floatZ 15s infinite ease-in-out;
}

@keyframes rotate3d_1 {
    0% { transform: translateZ(-200px) rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
    100% { transform: translateZ(-200px) rotateX(360deg) rotateY(180deg) rotateZ(360deg); }
}

@keyframes rotate3d_2 {
    0% { transform: translateZ(-100px) rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
    100% { transform: translateZ(-100px) rotateX(-360deg) rotateY(360deg) rotateZ(180deg); }
}

@keyframes floatZ {
    0%, 100% { transform: translate(-50%, -50%) translateZ(-400px) rotate(0deg); }
    50% { transform: translate(-50%, -50%) translateZ(-100px) rotate(90deg); }
}

/* Premium Glassmorphism Card */
.login-card {
    background: rgba(18, 24, 38, 0.65);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    border-left: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 24px;
    padding: 48px 40px;
    width: 420px;
    max-width: 95%;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4), 0 0 40px rgba(16, 185, 129, 0.1);
    position: relative;
    z-index: 10;
    transform-style: preserve-3d;
    animation: cardEntrance 1s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    transform: translateY(50px) translateZ(-100px) rotateX(-10deg);
    opacity: 0;
}

@keyframes cardEntrance {
    to { 
        opacity: 1; 
        transform: translateY(0) translateZ(0) rotateX(0); 
    }
}

.login-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 24px;
    padding: 2px;
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 50%, rgba(16,185,129,0.2) 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    pointer-events: none;
}

.login-logo {
    text-align: center;
    margin-bottom: 36px;
    transform: translateZ(30px);
}

.logo-icon {
    width: 72px; height: 72px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: white;
    margin-bottom: 16px;
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.4), inset 0 2px 0 rgba(255,255,255,0.3);
    animation: floatLogo 4s ease-in-out infinite;
    position: relative;
}

.logo-icon::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 24px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    filter: blur(12px);
    opacity: 0.5;
    z-index: -1;
    animation: glowPulse 4s ease-in-out infinite;
}

@keyframes floatLogo {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-8px) scale(1.05); }
}
@keyframes glowPulse {
    0%, 100% { opacity: 0.4; filter: blur(12px); }
    50% { opacity: 0.8; filter: blur(20px); }
}

.login-logo h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.5px;
}
.login-logo p {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 4px;
}

.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.form-group label i {
    width: 16px;
    margin-right: 4px;
}
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-group input::placeholder { color: var(--text-dim); }

.password-wrap {
    position: relative;
}
.toggle-pass {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 14px;
}
.toggle-pass:hover { color: var(--text); }

.login-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-xs);
    padding: 10px 14px;
    color: #fca5a5;
    font-size: 13px;
    margin-bottom: 16px;
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-login:hover {
    background: linear-gradient(135deg, var(--accent-hover), #047857);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
    transform: translateY(-1px);
}
.btn-login:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ============================================
   MAIN APP LAYOUT
   ============================================ */

.main-app {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, #111827 0%, #0a0f18 100%);
    border-right: 1px solid rgba(52, 211, 153, 0.08);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s ease;
    box-shadow: 4px 0 30px rgba(0,0,0,0.2);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
}
.sidebar-logo i {
    font-size: 22px;
}
.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}
.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text);
}
.nav-item.active {
    background: linear-gradient(135deg, rgba(52, 211, 153, 0.15), rgba(34, 211, 238, 0.08));
    color: var(--accent);
    border-left: 3px solid var(--accent);
    box-shadow: 0 2px 12px rgba(52, 211, 153, 0.1);
}
.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.user-avatar {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: white;
}
.user-details {
    display: flex;
    flex-direction: column;
}
.user-name { font-weight: 600; font-size: 13px; }
.user-role { font-size: 11px; color: var(--text-muted); text-transform: capitalize; }

.btn-logout {
    width: 100%;
    padding: 10px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-xs);
    color: #f87171;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.btn-logout:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* Top Bar */
.top-bar {
    height: var(--topbar-h);
    background: linear-gradient(90deg, #111827 0%, #0f172a 100%);
    border-bottom: 1px solid rgba(52, 211, 153, 0.06);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 16px;
    flex-shrink: 0;
    box-shadow: 0 2px 20px rgba(0,0,0,0.15);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    font-size: 20px;
    cursor: pointer;
}

.top-bar-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.stat-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(255,255,255,0.04);
    backdrop-filter: blur(8px);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-muted);
    border: 1px solid rgba(255,255,255,0.06);
    transition: var(--transition);
}
.stat-pill:hover { background: rgba(255,255,255,0.07); }
.stat-pill strong { color: var(--text); }
.stat-pill.revenue { color: var(--accent); border-color: rgba(52,211,153,0.15); background: rgba(52,211,153,0.06); }
.stat-pill.revenue strong { color: var(--accent); }

.top-bar-right { display: flex; align-items: center; gap: 12px; }
.clock {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

/* ============================================
   PAGES
   ============================================ */

.page {
    display: none;
    flex: 1;
    overflow: auto;
    min-height: 0;
}
.page.active { display: flex; flex-direction: column; }

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    flex-shrink: 0;
}
.page-header h1 {
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}
.page-header h1 i { color: var(--accent); }

/* ============================================
   POS TERMINAL
   ============================================ */

.pos-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* Products Side */
.pos-products {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 16px;
    gap: 12px;
    min-width: 0;
    min-height: 0;
}

.search-bar {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}
.search-input-wrap {
    flex: 1;
    position: relative;
}
.search-input-wrap i.fa-search {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    font-size: 14px;
}
.search-input-wrap input {
    width: 100%;
    padding: 12px 40px 12px 42px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
}
.search-input-wrap input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.search-input-wrap input::placeholder { color: var(--text-dim); }
.clear-search {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 13px;
}
.clear-search:hover { color: var(--text); }

.category-filter select {
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    min-width: 160px;
    transition: var(--transition);
}
.category-filter select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Premium Products Grid */
.products-grid {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
    gap: 14px;
    align-content: start;
    padding: 8px 4px 20px 4px;
    min-height: 0;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}
.products-grid::-webkit-scrollbar { width: 5px; }
.products-grid::-webkit-scrollbar-track { background: transparent; }
.products-grid::-webkit-scrollbar-thumb { background: rgba(52,211,153,0.2); border-radius: 10px; }
.products-grid::-webkit-scrollbar-thumb:hover { background: rgba(52,211,153,0.4); }

.product-card {
    background: #1e2538;
    border: 1px solid #2a3550;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.product-card:hover {
    border-color: rgba(52, 211, 153, 0.4);
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3), 0 0 20px rgba(52, 211, 153, 0.08);
}
.product-card:active {
    transform: translateY(-2px) scale(1.01);
    transition-duration: 0.1s;
}

.product-card .product-image {
    width: 100%;
    padding-top: 75%;
    overflow: hidden;
    background: #151d2e;
    border-bottom: 1px solid #2a3550;
    position: relative;
}
.product-card .product-image img {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 10px;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}
.product-card:hover .product-image img {
    transform: scale(1.1);
}

.product-card .product-info {
    padding: 14px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 8px;
}

.product-card .product-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--text);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 36px;
}

.product-card .product-meta {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: auto;
    padding-top: 6px;
    border-top: 1px solid var(--border-light);
}

.product-card .product-price {
    font-size: 16px;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -0.5px;
}
.product-card .product-price.on-sale {
    color: var(--danger);
}
.product-card .product-price .original-price {
    font-size: 11px;
    color: var(--text-dim);
    text-decoration: line-through;
    margin-left: 5px;
    font-weight: 500;
}

.product-card .product-stock {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 6px;
    background: rgba(255,255,255,0.05);
    border-radius: 6px;
}
.product-card .product-stock.low { color: var(--warning); background: rgba(245, 158, 11, 0.1); }
.product-card .product-stock.out { color: var(--danger); background: rgba(239, 68, 68, 0.1); opacity: 0.8; }
.product-card.out-of-stock { opacity: 0.6; filter: grayscale(0.8); }

.product-card .product-barcode {
    font-size: 10px;
    color: var(--text-dim);
    font-family: 'Inter', monospace;
    font-weight: 500;
}

.product-card .sale-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: linear-gradient(135deg, #f43f5e, #e11d48);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 14px rgba(244, 63, 94, 0.5);
    z-index: 5;
    animation: salePulse 2s ease-in-out infinite;
}
@keyframes salePulse {
    0%, 100% { box-shadow: 0 4px 14px rgba(244, 63, 94, 0.5); }
    50% { box-shadow: 0 4px 20px rgba(244, 63, 94, 0.8); }
}

/* ============================================
   CART
   ============================================ */

.pos-cart {
    width: 400px;
    background: linear-gradient(180deg, #111827 0%, #0c1018 100%);
    border-left: 1px solid rgba(52, 211, 153, 0.06);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    box-shadow: -4px 0 30px rgba(0,0,0,0.15);
}

.cart-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.cart-header h2 {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}
.cart-header h2 i { color: var(--accent); }
.btn-clear-cart {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 14px;
    padding: 6px;
    border-radius: 6px;
    transition: var(--transition);
}
.btn-clear-cart:hover { color: var(--danger); background: rgba(239,68,68,0.1); }

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

.btn-new-sale {
    padding: 6px 12px;
    background: var(--accent-glow);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 6px;
    color: var(--accent);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 5px;
}
.btn-new-sale:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.3);
}

/* Customer Selection */
.cart-customer {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    position: relative;
    flex-shrink: 0;
}
.customer-selected {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--accent-glow);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-xs);
    font-size: 13px;
    color: var(--accent);
}
.customer-selected i { font-size: 14px; }
.remove-customer {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
}
.remove-customer:hover { color: var(--danger); }

.customer-search-wrap {
    display: flex;
    gap: 8px;
}
.customer-search-wrap input {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    outline: none;
}
.customer-search-wrap input:focus { border-color: var(--accent); }
.customer-search-wrap input::placeholder { color: var(--text-dim); }
.btn-add-customer {
    padding: 8px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--accent);
    cursor: pointer;
    transition: var(--transition);
}
.btn-add-customer:hover { background: var(--accent-glow); border-color: var(--accent); }

.customer-dropdown {
    position: absolute;
    left: 20px;
    right: 20px;
    top: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    max-height: 200px;
    overflow-y: auto;
    z-index: 50;
    box-shadow: var(--shadow);
}
.customer-dropdown-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
    font-size: 13px;
}
.customer-dropdown-item:last-child { border-bottom: none; }
.customer-dropdown-item:hover { background: var(--bg-hover); }
.customer-dropdown-item .cdi-name { font-weight: 500; color: var(--text); }
.customer-dropdown-item .cdi-info { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

/* Cart Items */
.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    min-height: 0;
}

.empty-cart {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-dim);
    text-align: center;
}
.empty-cart i { font-size: 40px; margin-bottom: 12px; opacity: 0.3; }
.empty-cart p { font-size: 14px; font-weight: 500; }
.empty-cart small { font-size: 12px; margin-top: 4px; }

.cart-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    gap: 14px;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateX(10px); }
    to { opacity: 1; transform: translateX(0); }
}

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

.cart-item-info {
    flex: 1;
    min-width: 0;
}
.cart-item-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}
.cart-item-price {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-input);
    padding: 2px;
    border-radius: 8px;
    border: 1px solid var(--border);
}
.qty-btn {
    width: 28px; height: 28px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.qty-btn:hover { background: var(--bg-hover); color: var(--accent); }
.qty-btn.minus:hover { color: var(--danger); }
.cart-item-qty span {
    width: 24px;
    text-align: center;
    font-weight: 700;
    font-size: 14px;
    color: var(--text);
}

.cart-item-total {
    font-weight: 800;
    font-size: 15px;
    color: var(--accent);
    min-width: 65px;
    text-align: right;
    letter-spacing: -0.5px;
}

.cart-item-remove {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid transparent;
    color: var(--danger);
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: var(--transition);
}
.cart-item-remove:hover { background: var(--danger); color: white; transform: scale(1.05); }

/* Cart Summary */
.cart-summary {
    padding: 18px 20px;
    border-top: 1px solid rgba(52, 211, 153, 0.08);
    background: linear-gradient(180deg, rgba(17,24,39,0.95), rgba(10,13,18,1));
    flex-shrink: 0;
    box-shadow: 0 -6px 30px rgba(0,0,0,0.2);
    backdrop-filter: blur(12px);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dim);
}
.summary-row span:last-child { font-variant-numeric: tabular-nums; }
.summary-row.total-row {
    padding-top: 14px;
    margin-top: 10px;
    border-top: 1px solid rgba(52, 211, 153, 0.12);
    font-size: 26px;
    font-weight: 900;
    color: var(--text);
    align-items: center;
}
.summary-row.total-row span:last-child { 
    color: var(--accent); 
    letter-spacing: -1px;
    text-shadow: 0 0 20px rgba(52, 211, 153, 0.3);
}
.summary-row.discount-row span:last-child { color: var(--danger); font-weight: 600; }

/* Cart Actions */
.cart-actions {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.discount-section { position: relative; }
.btn-discount {
    padding: 8px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-muted);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}
.btn-discount:hover { border-color: var(--accent); color: var(--accent); }

.discount-panel {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.discount-type-tabs {
    display: flex;
    gap: 4px;
}
.dt-tab {
    padding: 6px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-dim);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}
.dt-tab.active {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--accent);
}
.discount-panel input {
    flex: 1;
    padding: 6px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    min-width: 100px;
}
.discount-panel input:focus { border-color: var(--accent); }

.payment-section select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    outline: none;
}

.cash-input-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.cash-input-wrap label {
    font-size: 12px;
    color: var(--text-dim);
}
.cash-input-wrap input {
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text);
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    outline: none;
}
.cash-input-wrap input:focus { border-color: var(--accent); }

.change-display {
    font-size: 14px;
    color: var(--accent);
    font-weight: 600;
    padding: 8px 12px;
    background: var(--accent-glow);
    border-radius: var(--radius-xs);
    text-align: center;
}

.quick-cash {
    display: flex;
    gap: 6px;
}
.quick-cash button {
    flex: 1;
    padding: 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-muted);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}
.quick-cash button:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}

.btn-checkout {
    padding: 16px;
    background: linear-gradient(135deg, #34d399 0%, #10b981 50%, #059669 100%);
    background-size: 200% 200%;
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.btn-checkout::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    transition: left 0.5s ease;
}
.btn-checkout:hover:not(:disabled)::before {
    left: 100%;
}
.btn-checkout:hover:not(:disabled) {
    box-shadow: 0 6px 30px rgba(52, 211, 153, 0.45);
    transform: translateY(-2px);
    background-position: right center;
}
.btn-checkout:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 12px rgba(52, 211, 153, 0.3);
}
.btn-checkout:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
    background: var(--bg-hover);
    color: var(--text-dim);
}

/* ============================================
   INVOICES PAGE
   ============================================ */

.filter-bar {
    display: flex;
    gap: 10px;
}
.filter-bar input,
.filter-bar select {
    padding: 8px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    outline: none;
}
.filter-bar input:focus,
.filter-bar select:focus { border-color: var(--accent); }

.invoices-stats {
    display: flex;
    gap: 16px;
    padding: 0 24px 16px;
    flex-wrap: wrap;
}

.inv-stat-card {
    padding: 16px 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    flex: 1;
    min-width: 180px;
}
.inv-stat-card .ist-label {
    font-size: 12px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.inv-stat-card .ist-value {
    font-size: 24px;
    font-weight: 700;
    margin-top: 4px;
}
.inv-stat-card.green .ist-value { color: var(--accent); }
.inv-stat-card.blue .ist-value { color: var(--accent-2); }
.inv-stat-card.purple .ist-value { color: var(--purple); }

.invoices-table-wrap {
    flex: 1;
    overflow: auto;
    padding: 0 24px 20px;
}

.invoices-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.invoices-table thead th {
    padding: 12px 16px;
    background: var(--bg-surface);
    border-bottom: 2px solid var(--border);
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 5;
}
.invoices-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.invoices-table tbody tr:hover { background: var(--bg-hover); }
.loading-cell { text-align: center; padding: 40px !important; color: var(--text-dim); }

.payment-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.payment-badge.cash { background: rgba(34,197,94,0.1); color: #22c55e; }
.payment-badge.card { background: rgba(6,182,212,0.1); color: #06b6d4; }
.payment-badge.mobile,
.payment-badge.paypay,
.payment-badge.linepay { background: rgba(139,92,246,0.1); color: #8b5cf6; }

.btn-view-invoice {
    padding: 6px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--accent);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}
.btn-view-invoice:hover { border-color: var(--accent); background: var(--accent-glow); }

/* ============================================
   DASHBOARD PAGE
   ============================================ */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 0 24px 24px;
    overflow-y: auto;
}

.dash-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    position: relative;
    overflow: hidden;
}
.dash-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--radius) var(--radius) 0 0;
}
.dash-card.green::before { background: var(--accent); }
.dash-card.blue::before { background: var(--accent-2); }
.dash-card.purple::before { background: var(--purple); }
.dash-card.orange::before { background: var(--warning); }
.dash-card.red::before { background: var(--danger); }

.dash-card .dc-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-bottom: 16px;
}
.dash-card.green .dc-icon { background: rgba(16,185,129,0.1); color: var(--accent); }
.dash-card.blue .dc-icon { background: rgba(6,182,212,0.1); color: var(--accent-2); }
.dash-card.purple .dc-icon { background: rgba(139,92,246,0.1); color: var(--purple); }
.dash-card.orange .dc-icon { background: rgba(245,158,11,0.1); color: var(--warning); }
.dash-card.red .dc-icon { background: rgba(239,68,68,0.1); color: var(--danger); }

.dash-card .dc-label {
    font-size: 12px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.dash-card .dc-value {
    font-size: 28px;
    font-weight: 800;
    margin-top: 4px;
}

.dash-card-full {
    grid-column: 1 / -1;
}

.low-stock-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}
.low-stock-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-card);
    border-radius: var(--radius-xs);
    font-size: 13px;
}
.low-stock-item .ls-name { font-weight: 500; }
.low-stock-item .ls-qty {
    padding: 2px 10px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 12px;
}
.low-stock-item .ls-qty.critical { background: rgba(239,68,68,0.1); color: var(--danger); }
.low-stock-item .ls-qty.warning { background: rgba(245,158,11,0.1); color: var(--warning); }

.recent-invoices-list {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.ri-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-card);
    border-radius: var(--radius-xs);
    font-size: 13px;
}
.ri-item .ri-number { font-weight: 500; color: var(--accent); font-size: 12px; }
.ri-item .ri-amount { font-weight: 600; }
.ri-item .ri-time { font-size: 11px; color: var(--text-dim); }

/* ============================================
   CUSTOMERS PAGE
   ============================================ */

.compact-search { padding: 0 24px 16px; }

.customers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    padding: 0 24px 24px;
    overflow-y: auto;
    align-content: start;
}

.customer-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: var(--transition);
}
.customer-card:hover { border-color: var(--accent); }

.cc-avatar {
    width: 44px; height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    color: white;
    flex-shrink: 0;
}
.cc-info { flex: 1; min-width: 0; }
.cc-name { font-weight: 600; font-size: 14px; }
.cc-detail { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.cc-source {
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}
.cc-source.pos { background: rgba(16,185,129,0.1); color: var(--accent); }
.cc-source.user { background: rgba(6,182,212,0.1); color: var(--accent-2); }

/* ============================================
   MODALS
   ============================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeOverlay 0.2s ease;
}
@keyframes fadeOverlay {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 440px;
    max-width: 95%;
    max-height: 90vh;
    overflow: auto;
    box-shadow: var(--shadow-lg);
    animation: slideModal 0.3s ease;
}
@keyframes slideModal {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-lg { width: 700px; }

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}
.modal-header h3 i { color: var(--accent); }
.modal-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 22px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
}
.modal-close:hover { color: var(--text); background: var(--bg-hover); }

.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-primary {
    padding: 10px 20px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-xs);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-cancel {
    padding: 10px 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-muted);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}
.btn-cancel:hover { border-color: var(--text-dim); color: var(--text); }

/* ============================================
   INVOICE DETAIL
   ============================================ */

.invoice-detail {
    font-size: 14px;
}
.invoice-header-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.invoice-header-info .ihi-left h4 {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
}
.invoice-header-info .ihi-right {
    text-align: right;
    color: var(--text-muted);
    font-size: 13px;
}

.invoice-items-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}
.invoice-items-table th {
    text-align: left;
    padding: 8px 12px;
    font-size: 12px;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
}
.invoice-items-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.invoice-totals {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}
.invoice-totals .it-row {
    display: flex;
    gap: 40px;
    font-size: 13px;
}
.invoice-totals .it-row span:first-child { color: var(--text-muted); }
.invoice-totals .it-row.total {
    font-size: 18px;
    font-weight: 700;
    padding-top: 8px;
    border-top: 2px solid var(--border);
    margin-top: 4px;
}
.invoice-totals .it-row.total span:last-child { color: var(--accent); }

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow);
    animation: toastIn 0.3s ease forwards;
    max-width: 400px;
}
.toast.success {
    background: #065f46;
    border: 1px solid #10b981;
    color: #a7f3d0;
}
.toast.error {
    background: #7f1d1d;
    border: 1px solid #ef4444;
    color: #fca5a5;
}
.toast.info {
    background: #1e3a5f;
    border: 1px solid #3b82f6;
    color: #93c5fd;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

.toast.removing {
    animation: toastOut 0.3s ease forwards;
}
@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100%); }
}

/* ============================================
   LOADING / UTILITY
   ============================================ */

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-dim);
    grid-column: 1 / -1;
}
.loading-spinner i { font-size: 28px; margin-bottom: 12px; color: var(--accent); }
.loading-spinner p { font-size: 14px; }

.no-data {
    text-align: center;
    padding: 40px;
    color: var(--text-dim);
    grid-column: 1 / -1;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    body * { visibility: hidden; }
    #printArea, #printArea * { visibility: visible; }
    #printArea {
        position: absolute;
        left: 0;
        top: 0;
        width: 80mm;
        font-size: 12px;
        color: #000;
        background: #fff;
    }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1200px) {
    .pos-cart { width: 340px; }
    .products-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}



/* ============================================
   RESPONSIVE — ALL PHONES (≤768px)
   Mobile-first: side-by-side → top/bottom tabs
   ============================================ */
@media (max-width: 768px) {

    /* ──── Body / Base ──── */
    html, body { overflow: auto; font-size: 15px; }

    /* ──── Sidebar (drawer style) ──── */
    .sidebar {
        position: fixed;
        top: 0; left: 0;
        width: 280px;
        height: 100%;
        z-index: 9000;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 4px 0 40px rgba(0,0,0,0.6);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-close { display: flex; }
    .menu-toggle { display: flex; font-size: 22px; }

    /* ──── Main layout ──── */
    .main-app { flex-direction: column; height: 100dvh; overflow: hidden; }
    .main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }

    /* ──── Top bar ──── */
    .top-bar { height: 52px; padding: 0 14px; gap: 10px; flex-shrink: 0; }
    .top-bar-info { gap: 6px; }
    .stat-pill { padding: 5px 10px; font-size: 11px; gap: 5px; }
    .stat-pill i { font-size: 11px; }
    .clock { display: none; }

    /* ──── POS Layout: mobile tab approach ──── */
    .pos-layout {
        flex-direction: column;
        flex: 1;
        overflow: hidden;
        min-height: 0;
    }

    /* Products panel */
    .pos-products {
        flex: 1;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        padding: 10px;
        gap: 8px;
        min-height: 0;
    }

    /* Search bar — compact */
    .search-bar { gap: 6px; flex-wrap: nowrap; }
    .search-input-wrap input {
        padding: 11px 36px 11px 38px;
        font-size: 15px;
    }
    .btn-scan { padding: 10px 12px; font-size: 17px; }
    .category-filter select {
        padding: 10px 10px;
        font-size: 13px;
        min-width: 110px;
    }

    /* Products grid */
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 8px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 8px;
    }
    .product-card { padding: 10px 10px 8px; gap: 6px; }
    .product-card .product-name { font-size: 12px; }
    .product-card .product-price { font-size: 15px; }
    .product-card .product-stock { font-size: 10px; }
    .product-card .product-barcode { display: none; } /* hide on mobile for space */

    /* ──── Cart — slides up from bottom ──── */
    .pos-cart {
        width: 100%;
        height: auto;
        max-height: 56vh;          /* take up to 56% of screen */
        border-left: none;
        border-top: 2px solid var(--accent);
        display: flex;
        flex-direction: column;
        flex-shrink: 0;
        background: var(--bg-card);
        overflow: hidden;
    }

    /* Cart header — compact */
    .cart-header { padding: 10px 14px; }
    .cart-header h2 { font-size: 14px; gap: 6px; }
    .btn-hold-sale { padding: 5px 9px; font-size: 11px; }
    .btn-new-sale { padding: 5px 9px; font-size: 11px; }

    /* Customer search — compact */
    .cart-customer { padding: 8px 12px; }
    .customer-search-wrap input { padding: 9px 12px; font-size: 13px; }

    /* Cart items — scrollable */
    .cart-items {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        min-height: 60px;
        max-height: 180px;
    }

    /* Cart item row */
    .cart-item {
        padding: 8px 12px;
        gap: 6px;
        align-items: flex-start;
    }
    .cart-item-info { flex: 1; min-width: 0; }
    .cart-item-name { font-size: 13px; }
    .cart-item-price { font-size: 11px; }

    /* Per-item discount — hide label on mobile, keep input */
    .item-disc-label { display: none; }
    .item-discount-input { width: 60px; font-size: 11px; }

    /* Qty control */
    .cart-item-qty { flex-shrink: 0; }
    .qty-btn { width: 28px; height: 28px; font-size: 17px; }
    .qty-direct { width: 38px; height: 28px; font-size: 12px; }

    .cart-item-total { font-size: 13px; font-weight: 700; flex-shrink: 0; }
    .cart-item-remove { padding: 6px; font-size: 13px; }

    /* Cart summary */
    .cart-summary { padding: 8px 14px; }
    .summary-row { font-size: 12px; padding: 3px 0; }
    .total-row { font-size: 15px; }

    /* Cart actions — stacked compact */
    .cart-actions { padding: 8px 12px; gap: 6px; }
    .discount-section { gap: 4px; }
    .btn-discount { padding: 8px 10px; font-size: 12px; }
    .btn-notes { padding: 8px 10px; font-size: 14px; }

    /* Payment section */
    .payment-section select {
        width: 100%;
        padding: 10px 12px;
        font-size: 14px;
    }
    .cash-input-wrap input {
        padding: 10px 12px;
        font-size: 15px;
    }

    /* Quick cash buttons — 2×2 grid on phones */
    .quick-cash {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
    .quick-cash button {
        padding: 9px 6px;
        font-size: 13px;
        font-weight: 600;
    }

    /* Checkout button — large, easy to tap */
    .btn-checkout {
        padding: 14px;
        font-size: 16px;
        font-weight: 700;
        min-height: 50px;
        border-radius: var(--radius-sm);
    }

    /* Order notes */
    .order-notes-wrap { padding: 0 12px 6px; }
    .order-notes-wrap textarea { font-size: 13px; padding: 8px 10px; }

    /* Held sales bar */
    .held-sales-bar { padding: 6px 10px; font-size: 11px; }

    /* Pages other than POS */
    .page-header { flex-direction: column; gap: 10px; align-items: flex-start; padding: 14px 16px; }
    .page-header h1 { font-size: 18px; }
    .filter-bar { flex-wrap: wrap; gap: 8px; }
    .filter-bar input, .filter-bar select { flex: 1; min-width: 130px; font-size: 13px; }

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

    /* Invoices */
    .invoices-stats { flex-direction: column; gap: 8px; padding: 10px 14px; }
    .invoices-table-wrap { padding: 0 10px 10px; overflow-x: auto; }
    .invoices-table { font-size: 12px; }
    .invoices-table th, .invoices-table td { padding: 8px 10px; }

    /* Customers */
    .customers-grid { grid-template-columns: 1fr; gap: 8px; padding: 10px 12px; }

    /* Modal adjustments */
    .modal {
        margin: 12px;
        max-height: calc(100dvh - 24px);
        overflow-y: auto;
    }
    .modal-body { padding: 14px 16px; }
    .modal-footer { padding: 12px 16px; }
}

/* ============================================
   RESPONSIVE — SMALL PHONES (≤480px)
   e.g. iPhone SE, Galaxy A04, Redmi 9
   ============================================ */
@media (max-width: 480px) {
    /* Even more compact products grid */
    .products-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; }
    .product-card { padding: 8px; }
    .product-card .product-price { font-size: 14px; }

    /* Cart shrinks a bit more */
    .pos-cart { max-height: 52vh; }
    .cart-items { max-height: 150px; }

    /* Login card */
    .login-card { padding: 28px 20px; border-radius: 16px; }
    .login-logo h1 { font-size: 22px; }

    /* Stat pills — hide secondary text */
    .stat-pill span { display: none; }
    .stat-pill strong { display: inline; color: var(--text); }
    .stat-pill { padding: 5px 8px; }

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

    /* Invoice table — hide less important cols */
    .invoices-table th:nth-child(3),
    .invoices-table td:nth-child(3),
    .invoices-table th:nth-child(6),
    .invoices-table td:nth-child(6) { display: none; }
}

/* ============================================
   RESPONSIVE — VERY SMALL (≤380px)
   e.g. iPhone SE 1st gen, Galaxy A02
   ============================================ */
@media (max-width: 380px) {
    :root { font-size: 13px; }

    .products-grid { grid-template-columns: repeat(2, 1fr); gap: 5px; }
    .product-card { padding: 7px 6px; }
    .product-card .product-name { font-size: 11px; }
    .product-card .product-price { font-size: 13px; }

    .pos-cart { max-height: 50vh; }
    .cart-items { max-height: 130px; }

    .quick-cash button { padding: 7px 4px; font-size: 12px; }
    .btn-checkout { padding: 12px; font-size: 15px; }

    .top-bar-info { display: none; } /* hide stat pills entirely on tiny screens */
}

/* ============================================
   IOS SAFE AREA (iPhone notch / home bar)
   ============================================ */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .btn-checkout {
        padding-bottom: calc(14px + env(safe-area-inset-bottom) / 2);
    }
    .cart-actions {
        padding-bottom: calc(8px + env(safe-area-inset-bottom) / 2);
    }
}

/* Prevent zoom on input focus (iOS) */
@media (max-width: 768px) {
    input, select, textarea {
        font-size: max(16px, 1em);
    }
}


/* ============================================
   BARCODE SCANNER
   ============================================ */

.btn-scan {
    padding: 10px 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.btn-scan:hover {
    background: linear-gradient(135deg, var(--accent-hover), #047857);
    box-shadow: 0 2px 12px rgba(16, 185, 129, 0.4);
    transform: translateY(-1px);
}
.btn-scan:active {
    transform: translateY(0);
}
.btn-scan.scanning {
    background: linear-gradient(135deg, var(--danger), var(--danger-hover));
    animation: scanPulse 1.5s ease infinite;
}

@keyframes scanPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

/* Scanner Modal */
.scanner-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.scanner-modal-content {
    width: 100%;
    max-width: 500px;
    margin: 16px;
    background: var(--bg-card);
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
    animation: slideUp 0.3s ease;
}

.scanner-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.scanner-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.scanner-header h3 i {
    color: var(--accent);
}
.scanner-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
}
.scanner-close:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

.scanner-viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    background: #000;
    overflow: hidden;
}
.scanner-target {
    width: 100%;
    height: 100%;
}
.scanner-target video,
.scanner-target canvas {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
}

/* Scan line animation */
.scanner-line {
    position: absolute;
    left: 10%;
    right: 10%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), var(--accent), transparent);
    box-shadow: 0 0 12px var(--accent), 0 0 30px rgba(16, 185, 129, 0.3);
    animation: scanLine 2s ease-in-out infinite;
    z-index: 2;
}

@keyframes scanLine {
    0%, 100% { top: 15%; }
    50% { top: 85%; }
}

/* Corner markers */
.scanner-corners {
    position: absolute;
    inset: 10%;
    z-index: 1;
    pointer-events: none;
}
.scanner-corners span {
    position: absolute;
    width: 24px;
    height: 24px;
    border-color: var(--accent);
    border-style: solid;
    border-width: 0;
}
.sc-tl { top: 0; left: 0; border-top-width: 3px; border-left-width: 3px; border-radius: 4px 0 0 0; }
.sc-tr { top: 0; right: 0; border-top-width: 3px; border-right-width: 3px; border-radius: 0 4px 0 0; }
.sc-bl { bottom: 0; left: 0; border-bottom-width: 3px; border-left-width: 3px; border-radius: 0 0 0 4px; }
.sc-br { bottom: 0; right: 0; border-bottom-width: 3px; border-right-width: 3px; border-radius: 0 0 4px 0; }

.scanner-status {
    padding: 14px 20px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}
.scanner-status i {
    margin-right: 6px;
    color: var(--accent);
}

.scanner-result {
    padding: 12px 20px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-glow);
    border-top: 1px solid rgba(16, 185, 129, 0.2);
}

/* Mobile full screen scanner */
@media (max-width: 600px) {
    .scanner-modal-content {
        max-width: 100%;
        height: 100%;
        margin: 0;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }
    .scanner-viewport {
        flex: 1;
        aspect-ratio: unset;
    }
}

/* ============================================
   NEW FEATURES: CART BADGE, HOLD SALE, NOTES
   ============================================ */

/* Cart item count badge */
.cart-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: var(--accent);
    color: #000;
    font-size: 11px;
    font-weight: 700;
    border-radius: 11px;
    margin-left: 6px;
    vertical-align: middle;
    line-height: 1;
}

/* Hold Sale button */
.btn-hold-sale {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: var(--radius-sm);
    color: #f59e0b;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    white-space: nowrap;
}
.btn-hold-sale:hover {
    background: rgba(245, 158, 11, 0.22);
    border-color: rgba(245, 158, 11, 0.5);
    transform: translateY(-1px);
}
.btn-hold-sale i { font-size: 13px; }

/* Notes button */
.btn-notes {
    padding: 8px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}
.btn-notes:hover, .btn-notes.active {
    background: rgba(139, 92, 246, 0.12);
    border-color: rgba(139, 92, 246, 0.4);
    color: #a78bfa;
}

/* Order notes textarea */
.order-notes-wrap {
    padding: 0 16px 10px;
}
.order-notes-wrap textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
    line-height: 1.5;
}
.order-notes-wrap textarea:focus {
    border-color: rgba(139, 92, 246, 0.6);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}
.order-notes-wrap textarea::placeholder { color: var(--text-dim); }

/* Per-item discount row */
.item-disc-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}
.item-discount-input {
    width: 72px;
    padding: 3px 7px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text);
    font-size: 11px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
.item-discount-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15);
}
.item-disc-label {
    font-size: 10px;
    color: var(--text-dim);
}
.item-disc-tag {
    display: inline-block;
    margin-left: 5px;
    padding: 1px 5px;
    background: rgba(239, 68, 68, 0.12);
    border-radius: 4px;
    color: #f87171;
    font-size: 10px;
    font-weight: 600;
}

/* Direct qty input */
.qty-direct {
    width: 44px;
    height: 28px;
    text-align: center;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    /* Remove spinner arrows */
    -moz-appearance: textfield;
    appearance: textfield;
}
.qty-direct::-webkit-outer-spin-button,
.qty-direct::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty-direct:focus { border-color: var(--accent); }

/* Held sales indicator bar */
.held-sales-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin-top: 8px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: #fcd34d;
}
.held-sales-bar i { font-size: 14px; color: #f59e0b; }
.held-sales-bar span { font-weight: 700; }
.held-sales-bar button {
    margin-left: auto;
    padding: 4px 10px;
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid rgba(245, 158, 11, 0.4);
    border-radius: 5px;
    color: #fcd34d;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}
.held-sales-bar button:hover {
    background: rgba(245, 158, 11, 0.35);
}

/* Discount section flex layout (notes btn beside discount) */
.discount-section {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}


/* ============================================
   CATEGORY PILL TABS
   ============================================ */

.category-pills {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 2px 8px 2px;
    flex-shrink: 0;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}
.category-pills::-webkit-scrollbar { height: 3px; }
.category-pills::-webkit-scrollbar-track { background: transparent; }
.category-pills::-webkit-scrollbar-thumb { background: rgba(52,211,153,0.2); border-radius: 10px; }

.cat-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 30px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.cat-pill:hover {
    background: rgba(52,211,153,0.08);
    border-color: rgba(52,211,153,0.3);
    color: var(--accent);
    transform: translateY(-1px);
}
.cat-pill.active {
    background: linear-gradient(135deg, rgba(52,211,153,0.2), rgba(34,211,238,0.1));
    border-color: rgba(52,211,153,0.5);
    color: var(--accent);
    font-weight: 700;
    box-shadow: 0 2px 16px rgba(52,211,153,0.15);
}
.cat-pill i { font-size: 12px; }
.cat-pill-count {
    background: rgba(255,255,255,0.08);
    border-radius: 20px;
    padding: 1px 7px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-dim);
}
.cat-pill.active .cat-pill-count {
    background: rgba(52,211,153,0.2);
    color: var(--accent);
}
