/* ========== CSS VARIABLES & RESET — PREMIUM LIGHT THEME ========== */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-primary: #f4f5fb;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #f1f2f8;
    --bg-hover: #e9eaf4;
    --text-primary: #171a2c;
    --text-secondary: #474b68;
    --text-muted: #8a8ea6;
    --accent: #6d28d9;
    --accent-hover: #5b21b6;
    --accent-light: rgba(109,40,217,0.08);
    --accent-grad: linear-gradient(135deg, #7c3aed 0%, #a21caf 55%, #db2777 100%);
    --accent-glow: 0 8px 26px rgba(124,58,237,0.38);
    --accent-2: #06b6d4;
    --accent-2-grad: linear-gradient(135deg, #06b6d4, #3b82f6);
    --success: #059669;
    --success-hover: #10b981;
    --success-grad: linear-gradient(135deg, #10b981, #06b6a4);
    --danger: #e11d48;
    --danger-hover: #f43f5e;
    --warning: #f59e0b;
    --info: #3b82f6;
    --border: #e3e5f1;
    --border-light: #eef0f7;
    --shadow: 0 1px 2px rgba(23,26,44,0.04), 0 4px 16px rgba(23,26,44,0.06);
    --shadow-lg: 0 2px 6px rgba(23,26,44,0.05), 0 16px 48px rgba(23,26,44,0.12);
    --shadow-float: 0 24px 64px -12px rgba(23,26,44,0.18);
    --radius: 16px;
    --radius-sm: 11px;
    --radius-xs: 7px;
    --sidebar-width: 240px;
    --topbar-height: 64px;
    --transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --font-display: 'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
    --font-body: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
}

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

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Prevent pull-to-refresh bounce on mobile */
html {
    overscroll-behavior: none;
    -webkit-tap-highlight-color: transparent;
}
body {
    -webkit-touch-callout: none;
}

/* PWA standalone mode — safe area padding only */
@media (display-mode: standalone) {
    body {
        padding-top: env(safe-area-inset-top, 0px);
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
}

/* ========== SCROLLBAR ========== */
::-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(--text-muted); }

/* ========== SIDEBAR ========== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
}

.sidebar-header img { height: 32px; width: 32px; border-radius: 8px; object-fit: cover; }
.sidebar-header i { font-size: 1.5rem; }

.nav-links { list-style: none; padding: 12px 8px; flex: 1; }

.nav-links li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
    margin-bottom: 4px;
    font-size: 0.95rem;
}

.nav-links li:hover { background: var(--accent-light); color: var(--accent); }
.nav-links li.active { background: var(--accent); color: white; }
.nav-links li i { width: 20px; text-align: center; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    text-align: center;
    font-size: 0.75rem;
}

/* ========== MAIN CONTENT ========== */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-width: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* ========== TOP BAR ========== */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar h1 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 600;
    flex: 1;
}

.topbar-actions { display: flex; align-items: center; gap: 12px; }
.date-display { color: var(--text-muted); font-size: 0.85rem; }

.menu-toggle {
    display: none;
    background: none; border: none;
    color: var(--text-primary);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 8px;
}

/* ========== PAGES ========== */
.page { display: none; padding: 24px; flex: 1; min-width: 0; overflow-x: hidden; }
.page.active { display: block; }

/* ========== CARDS ========== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

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

.card-header h2 {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h2 i { color: var(--accent); }
.card-body { padding: 20px; }

/* ========== BUTTONS ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); transform: translateY(-1px); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover:not(:disabled) { background: var(--success-hover); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); }
.btn-secondary { background: var(--bg-input); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--bg-hover); }
.btn-info { background: #3b82f6; color: white; }
.btn-info:hover:not(:disabled) { background: #2563eb; }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }

.btn-icon {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    width: 40px; height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon:hover { background: var(--accent); color: white; border-color: var(--accent); }
.btn-group { display: flex; gap: 12px; flex-wrap: wrap; }

/* ========== INPUTS ========== */
.text-input, .select-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    transition: var(--transition);
    outline: none;
}

.text-input:focus, .select-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.input-sm { width: 80px; text-align: center; }
.input-group { display: flex; gap: 8px; }
.input-group .text-input { flex: 1; }
.form-group { margin-bottom: 16px; }

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.select-input option { background: var(--bg-input); color: var(--text-primary); }

/* ========== TABLES ========== */
.table-wrapper { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    font-weight: 600;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.9rem;
}

.data-table tr:hover td { background: var(--accent-light); }

.data-table .qty-cell { display: flex; align-items: center; gap: 6px; }

.data-table .qty-cell button {
    width: 28px; height: 28px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem;
    transition: var(--transition);
}

.data-table .qty-cell button:hover { background: var(--accent); color: white; border-color: var(--accent); }
.data-table .qty-cell span { min-width: 30px; text-align: center; font-weight: 600; }

.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state i { font-size: 3rem; margin-bottom: 16px; display: block; }
.empty-state p { font-size: 1rem; margin-bottom: 8px; }

.badge {
    background: var(--accent-light);
    color: var(--accent);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ========== SCANNER PAGE ========== */
.scanner-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 24px;
    height: calc(100vh - var(--topbar-height) - 48px);
}

.scanner-panel { display: flex; flex-direction: column; }
.scanner-panel .card-header { flex-wrap: wrap; gap: 12px; }
.scanner-controls { display: flex; gap: 8px; align-items: center; }

.scanner-viewport {
    flex: 1;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#scanner-container {
    width: 100%;
    max-width: 640px;
    aspect-ratio: 4/3;
    background: #111;
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
}

#scanner-container video { width: 100%; height: 100%; object-fit: cover; display: block; }
#scanner-container canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

#scannerVideo { width: 100%; height: 100%; object-fit: cover; display: block; }

.scan-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }

.scan-line {
    position: absolute; width: 70%; height: 2px;
    background: var(--success);
    box-shadow: 0 0 12px var(--success);
    top: 50%; transform: translateY(-50%);
    animation: scanLine 2s ease-in-out infinite;
    display: none;
}

.scan-line.active { display: block; }
@keyframes scanLine { 0%, 100% { top: 30%; } 50% { top: 70%; } }

.scan-corners { width: 60%; height: 50%; position: relative; }
.scan-corners span { position: absolute; width: 24px; height: 24px; border-color: var(--accent); border-style: solid; }
.scan-corners span:nth-child(1) { top: 0; left: 0; border-width: 3px 0 0 3px; }
.scan-corners span:nth-child(2) { top: 0; right: 0; border-width: 3px 3px 0 0; }
.scan-corners span:nth-child(3) { bottom: 0; left: 0; border-width: 0 0 3px 3px; }
.scan-corners span:nth-child(4) { bottom: 0; right: 0; border-width: 0 3px 3px 0; }

.scan-guide-text {
    position: absolute; bottom: 15%; left: 50%; transform: translateX(-50%);
    color: rgba(255,255,255,0.7); font-size: 0.85rem; text-align: center;
    text-shadow: 0 1px 4px rgba(0,0,0,0.8); white-space: nowrap;
}

.scanner-placeholder {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    color: var(--text-muted);
}

.scanner-placeholder i { font-size: 4rem; margin-bottom: 16px; opacity: 0.3; }
.scanner-placeholder p { font-size: 1.1rem; }
.scanner-placeholder small { margin-top: 4px; }

/* ========== SCANNER SIDEBAR ========== */
.scanner-sidebar { display: flex; flex-direction: column; gap: 16px; }

.mini-bill-list { max-height: 200px; overflow-y: auto; margin-bottom: 12px; }

.mini-bill-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 0; border-bottom: 1px solid var(--border-light); font-size: 0.85rem;
}

.mini-bill-item:last-child { border-bottom: none; }
.mini-bill-item .item-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-right: 8px; }
.mini-bill-item .item-qty { color: var(--text-muted); margin-right: 8px; }

.mini-bill-total {
    display: flex; justify-content: space-between;
    padding: 12px 0; border-top: 2px solid var(--border);
    font-weight: 700; font-size: 1.1rem;
}

.total-amount { color: var(--success); }

.last-scanned-detail { display: flex; flex-direction: column; gap: 8px; }
.last-scanned-detail .detail-row { display: flex; justify-content: space-between; font-size: 0.9rem; }
.last-scanned-detail .detail-label { color: var(--text-muted); }
.last-scanned-detail .detail-value { font-weight: 600; }
.last-scanned-detail .found { color: var(--success); }
.last-scanned-detail .not-found { color: var(--danger); }

/* ========== BILLING PAGE ========== */
/* Billing page search bar */
.billing-search-bar {
    padding: 0 0 10px 0;
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg);
}
.billing-search-wrap {
    position: relative;
}
.billing-search-wrap .search-suggestions {
    max-height: 320px;
    overflow-y: auto;
}

.billing-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
    height: calc(100vh - var(--topbar-height) - 48px);
}

.billing-table-card { display: flex; flex-direction: column; }
.billing-table-card .table-wrapper { flex: 1; overflow-y: auto; }
.billing-calc-panel { display: flex; flex-direction: column; }
.billing-calc-panel .card-body { display: flex; flex-direction: column; gap: 12px; flex: 1; }

.calc-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.95rem; }
.calc-row span:first-child { color: var(--text-secondary); }
.discount-input-group { display: flex; align-items: center; gap: 8px; }
.calc-divider { height: 1px; background: var(--border); margin: 8px 0; }
.total-row { font-size: 1.3rem; font-weight: 700; padding: 8px 0; }
.total-row span:last-child { color: var(--success); font-family: var(--font-display); }

.customer-section, .payment-section { margin-top: 12px; }

.customer-section h3, .payment-section h3 {
    font-size: 0.85rem; color: var(--text-muted); margin-bottom: 10px;
    display: flex; align-items: center; gap: 6px;
}

.customer-section .text-input { margin-bottom: 8px; }

.payment-methods { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }

.payment-option {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 12px 8px;
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
}

.payment-option i { font-size: 1.2rem; }
.payment-option input { display: none; }
.payment-option.active, .payment-option:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-light);
    color: var(--accent);
}

.billing-actions { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.billing-share-row { display: flex; gap: 8px; }
.billing-share-btn { flex: 1; }
.billing-wa-btn {
    flex: 0 0 48px;
    background: #25D366;
    color: #fff;
    border: none;
    font-size: 1.2rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.billing-wa-btn:hover { background: #1ebe5d; }

/* ========== PRODUCTS PAGE ========== */
.products-layout { max-width: 1200px; }

/* ========== HISTORY PAGE ========== */
.header-actions { display: flex; gap: 8px; align-items: center; }
.header-actions .text-input { width: 180px; }

/* ========== SETTINGS PAGE ========== */
.settings-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    max-width: 1200px;
}

/* ========== MODAL ========== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    backdrop-filter: blur(6px);
}

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

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { transform: translateY(20px) scale(0.95); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

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

.modal-header h2 { font-family: var(--font-display); font-size: 1.1rem; }

.btn-close {
    background: none; border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.btn-close:hover { color: var(--danger); }
.modal-body { padding: 20px; }
.modal-footer { padding: 16px 20px; display: flex; justify-content: flex-end; gap: 12px; border-top: 1px solid var(--border); }

/* ========== LOOKUP STATUS ========== */
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 8px; }

.stat-card {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    text-align: center;
}

.stat-card .stat-value { font-size: 1.4rem; font-weight: 700; color: var(--accent); display: block; }
.stat-card .stat-label { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

.setup-guide-content { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.6; }
.setup-guide-content h3 { color: var(--text-primary); font-size: 0.95rem; margin: 16px 0 8px; }
.setup-guide-content ol { padding-left: 20px; }
.setup-guide-content li { margin-bottom: 6px; }
.setup-guide-content code { background: var(--bg-input); padding: 2px 6px; border-radius: 4px; font-size: 0.8rem; }

.lookup-status { text-align: center; padding: 32px 16px; color: var(--text-secondary); font-size: 0.95rem; }
.lookup-status i { font-size: 1.5rem; color: var(--accent); margin-bottom: 12px; display: block; }

.lookup-note {
    font-size: 0.8rem; color: var(--text-muted); text-align: center; margin-top: 8px;
    padding: 8px; background: var(--bg-input); border-radius: var(--radius-xs);
}

.lookup-note i { margin-right: 4px; }

/* ========== SALES OVERVIEW PAGE ========== */
.sales-period-bar { display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }
.sales-period-bar .btn.active { background: var(--accent); color: white; }

.sales-stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

.sales-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.stat-info { display: flex; flex-direction: column; gap: 4px; }
.stat-info .stat-label { font-size: 0.8rem; color: var(--text-muted); }
.stat-info .stat-value { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; color: var(--text-primary); }

.profit-input-row { display: flex; align-items: center; gap: 20px; margin-bottom: 20px; }

.profit-margin-display {
    font-family: var(--font-display);
    font-size: 2rem; font-weight: 800; color: var(--success);
    min-width: 100px; text-align: center;
}

#profitMargin {
    -webkit-appearance: none; height: 8px; border-radius: 4px;
    background: var(--border); outline: none;
}

#profitMargin::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 3px solid var(--bg-card);
    box-shadow: 0 2px 8px rgba(91,76,219,0.3);
}

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

.profit-card {
    text-align: center; padding: 20px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.profit-card.revenue { background: var(--accent-light); border-color: rgba(91,76,219,0.2); }
.profit-card.cost { background: rgba(231,76,60,0.06); border-color: rgba(231,76,60,0.2); }
.profit-card.profit { background: rgba(0,184,148,0.06); border-color: rgba(0,184,148,0.2); }
.profit-label { display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 6px; }
.profit-value { display: block; font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; }
.profit-card.revenue .profit-value { color: var(--accent); }
.profit-card.cost .profit-value { color: var(--danger); }
.profit-card.profit .profit-value { color: var(--success); }

.profit-breakdown {
    background: var(--bg-input); border-radius: var(--radius-sm);
    padding: 16px; font-size: 0.85rem; color: var(--text-secondary);
}

.profit-breakdown-row {
    display: flex; justify-content: space-between;
    padding: 6px 0; border-bottom: 1px solid var(--border-light);
}

.profit-breakdown-row:last-child { border-bottom: none; }
.profit-breakdown-row span:last-child { font-weight: 600; color: var(--text-primary); }

.payment-breakdown-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

.payment-method-stat {
    text-align: center; padding: 16px;
    background: var(--bg-input); border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.payment-method-stat .method-icon { font-size: 1.5rem; margin-bottom: 8px; display: block; color: var(--accent); }
.payment-method-stat .method-count { font-size: 1.1rem; font-weight: 700; display: block; }
.payment-method-stat .method-label { font-size: 0.75rem; color: var(--text-muted); display: block; margin-top: 4px; }

/* Responsive */
@media (max-width: 1024px) {
    .sales-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .sales-profit-grid { grid-template-columns: 1fr; }
    .payment-breakdown-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .sales-stats-grid { grid-template-columns: 1fr; }
    .payment-breakdown-grid { grid-template-columns: 1fr 1fr; }
}

/* ========== TOAST NOTIFICATIONS ========== */
.toast-container {
    position: fixed;
    top: 20px; right: 20px;
    z-index: 300;
    display: flex; flex-direction: column; gap: 8px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
    min-width: 280px;
    box-shadow: var(--shadow-lg);
}

.toast-success { background: var(--success); color: white; }
.toast-error { background: var(--danger); color: white; }
.toast-info { background: var(--info); color: white; }
.toast-warning { background: var(--warning); color: #1a1c2e; }

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

/* ========== RECEIPT PRINT AREA ========== */
.receipt-print-area { display: none; }

@media print {
    body * { visibility: hidden !important; }
    .receipt-print-area, .receipt-print-area * { visibility: visible !important; }
    .receipt-print-area { display: block !important; position: absolute; top: 0; left: 0; width: 100%; }
    @page { margin: 5mm; }
}

.receipt-print {
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 12px; color: #000;
    width: 100%; max-width: 302px;
    margin: 0 auto; padding: 8px;
    line-height: 1.3;
    letter-spacing: 0.2px;
}

.receipt-print .receipt-center { text-align: center; }
.receipt-print .receipt-bold { font-weight: bold; }
.receipt-print .receipt-line { border-top: 1px dashed #000; margin: 8px 0; }
.receipt-print .receipt-double-line { border-top: 3px double #000; margin: 8px 0; }
.receipt-print table { width: 100%; border-collapse: collapse; }
.receipt-print td { padding: 2px 0; vertical-align: top; }
.receipt-print .receipt-right { text-align: right; }
.receipt-print .receipt-footer { text-align: center; margin-top: 12px; font-size: 10px; }

.receipt-print-a4 {
    font-family: 'Segoe UI', sans-serif;
    font-size: 11px; color: #000; padding: 20px;
}

/* ========== SETUP WIZARD ========== */
#wizardOverlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    animation: wizardBgShift 10s ease infinite alternate;
}

#wizardOverlay.active { display: flex; }

.wizard-fade-out { animation: wizardFadeOut 0.6s ease forwards; }
@keyframes wizardFadeOut { to { opacity: 0; } }

.wizard-container {
    background: white;
    border-radius: 24px;
    width: 90%;
    max-width: 480px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    animation: wizardSlideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.wizard-progress {
    height: 4px;
    background: #e8e9f0;
    position: relative;
    overflow: hidden;
}

.wizard-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 2px;
}

.wizard-steps-wrapper {
    flex: 1;
    overflow-y: auto;
    position: relative;
    min-height: 380px;
}

.wizard-step {
    position: absolute;
    inset: 0;
    padding: 40px 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

.wizard-step.active {
    opacity: 1;
    transform: translateX(0);
    pointer-events: all;
    position: relative;
}

.wizard-step.prev {
    opacity: 0;
    transform: translateX(-30px);
    pointer-events: none;
}

.wizard-step-content {
    width: 100%;
    text-align: center;
}

.wizard-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1c2e;
    margin-bottom: 8px;
}

.wizard-subtitle {
    font-size: 0.9rem;
    color: #6b6f82;
    margin-bottom: 28px;
    line-height: 1.5;
}

/* Wizard icon */
.wizard-icon-animated {
    width: 80px; height: 80px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 24px;
    position: relative;
}

.wizard-icon-animated i { font-size: 2rem; color: white; z-index: 1; }

.wizard-icon-animated.done {
    background: linear-gradient(135deg, #00b894, #00cec9);
}

.wizard-ripple {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(102,126,234,0.4);
    animation: wizardRipple 2s ease infinite;
}

.wizard-ripple.delay1 { animation-delay: 0.6s; }
.wizard-ripple.delay2 { animation-delay: 1.2s; }

@keyframes wizardRipple {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(2); opacity: 0; }
}

/* Wizard input */
.wizard-input-icon {
    width: 48px; height: 48px;
    background: var(--accent-light);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 20px;
    font-size: 1.3rem;
    color: var(--accent);
}

.wizard-input {
    width: 100%;
    padding: 14px 18px;
    background: #f0f1f5;
    border: 2px solid transparent;
    border-radius: 12px;
    font-size: 1.1rem;
    text-align: center;
    outline: none;
    transition: 0.3s;
    font-family: var(--font-body);
}

.wizard-input:focus {
    border-color: var(--accent);
    background: white;
    box-shadow: 0 0 0 4px rgba(91,76,219,0.1);
}

.wizard-shake {
    animation: wizardShake 0.5s ease;
    border-color: var(--danger) !important;
}

@keyframes wizardShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

.wizard-skip-hint {
    font-size: 0.8rem;
    color: #8b8fa8;
    margin-top: 12px;
}

/* Category grid */
.wizard-category-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.wizard-category-card {
    padding: 16px 12px;
    background: #f5f6fa;
    border: 2px solid transparent;
    border-radius: 14px;
    cursor: pointer;
    transition: 0.3s;
    text-align: center;
}

.wizard-category-card:hover {
    background: white;
    border-color: var(--border);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.wizard-category-card.selected {
    border-color: var(--accent);
    background: var(--accent-light);
    transform: scale(1.02);
}

.wizard-category-card i { font-size: 1.5rem; margin-bottom: 8px; display: block; }
.wizard-category-card .cat-name { font-weight: 600; font-size: 0.9rem; display: block; color: #1a1c2e; }
.wizard-category-card .cat-desc { font-size: 0.75rem; color: #8b8fa8; display: block; margin-top: 4px; }

/* State list */
.wizard-state-list {
    max-height: 240px;
    overflow-y: auto;
    margin-top: 12px;
    text-align: left;
}

.wizard-state-item {
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: 0.2s;
    border: 1px solid transparent;
}

.wizard-state-item:hover { background: #f0f1f5; }
.wizard-state-item.selected { background: var(--accent-light); color: var(--accent); font-weight: 600; border-color: var(--accent); }

/* Logo upload */
.wizard-logo-upload {
    width: 160px; height: 160px;
    margin: 0 auto;
    border: 2px dashed var(--border);
    border-radius: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
    overflow: hidden;
}

.wizard-logo-upload:hover { border-color: var(--accent); background: var(--accent-light); }

.wizard-logo-placeholder {
    text-align: center;
    color: var(--text-muted);
}

.wizard-logo-placeholder i { font-size: 2rem; margin-bottom: 8px; display: block; }
.wizard-logo-placeholder span { font-size: 0.85rem; display: block; }
.wizard-logo-placeholder small { font-size: 0.7rem; display: block; margin-top: 4px; }

/* Product actions */
.wizard-product-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wizard-action-btn {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: #f5f6fa;
    border: 2px solid transparent;
    border-radius: 14px;
    cursor: pointer;
    transition: 0.3s;
    text-align: left;
}

.wizard-action-btn:hover { background: white; border-color: var(--border); transform: translateY(-1px); }
.wizard-action-btn i { font-size: 1.5rem; color: var(--accent); min-width: 40px; text-align: center; }
.wizard-action-btn span { font-weight: 600; font-size: 0.95rem; display: block; color: #1a1c2e; }
.wizard-action-btn small { font-size: 0.8rem; color: #8b8fa8; display: block; margin-top: 2px; }

.wizard-action-btn.secondary { background: transparent; border: 1px dashed var(--border); }
.wizard-action-btn.secondary:hover { background: #f5f6fa; }

/* Features list */
.wizard-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 24px;
}

.wizard-feature {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #f5f6fa;
    border-radius: 10px;
    font-size: 0.85rem;
    color: #4a4d6a;
}

.wizard-feature i { color: var(--accent); font-size: 1rem; }

/* Wizard nav */
.wizard-nav {
    padding: 16px 32px;
    display: flex;
    align-items: center;
    border-top: 1px solid #e8e9f0;
}

.wizard-nav-spacer { flex: 1; }

.wizard-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
    font-family: var(--font-body);
}

.wizard-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(102,126,234,0.4); }

.wizard-btn-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: transparent;
    color: #6b6f82;
    border: none;
    font-size: 0.9rem;
    cursor: pointer;
    transition: 0.2s;
    font-family: var(--font-body);
}

.wizard-btn-back:hover { color: #1a1c2e; }

.wizard-btn-skip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: transparent;
    color: #8b8fa8;
    border: 1px dashed #d0d2de;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: 0.2s;
    font-family: var(--font-body);
}

.wizard-btn-skip:hover { border-color: #8b8fa8; color: #4a4d6a; }

/* ========== FLASH ANIMATION ========== */
.flash-success { animation: flashGreen 0.5s ease; }
@keyframes flashGreen { 0% { box-shadow: 0 0 0 0 rgba(0,184,148,0.6); } 50% { box-shadow: 0 0 0 12px rgba(0,184,148,0); } 100% { box-shadow: none; } }

.flash-error { animation: flashRed 0.5s ease; }
@keyframes flashRed { 0% { box-shadow: 0 0 0 0 rgba(231,76,60,0.6); } 50% { box-shadow: 0 0 0 12px rgba(231,76,60,0); } 100% { box-shadow: none; } }

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
    .scanner-layout { grid-template-columns: 1fr; height: auto; }
    .billing-layout { grid-template-columns: 1fr; height: auto; }
    .settings-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .menu-toggle { display: block; }
    .payment-methods { grid-template-columns: repeat(2, 1fr); }
    .scanner-layout { gap: 12px; }
    #scanner-container { max-width: 100%; aspect-ratio: 3/4; border-radius: var(--radius-sm); }
    .scanner-controls { flex-wrap: wrap; }
    .scanner-controls .select-input { width: 100%; }
    .page { padding: 12px; }
    .wizard-container { width: 95%; border-radius: 20px; }
    .wizard-step { padding: 30px 20px; }
    .wizard-category-grid { grid-template-columns: 1fr; }
    .wizard-features { grid-template-columns: 1fr; }
}

@keyframes wizardBgShift {
    0% { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
    50% { background: linear-gradient(135deg, #764ba2 0%, #f093fb 100%); }
    100% { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
}

/* ============================================================
   PREMIUM LAYER v4 — single theme, futuristic motion design
   ============================================================ */

/* ---------- Ambient background ---------- */
body {
    background:
        radial-gradient(1200px 600px at 85% -10%, rgba(139,92,246,0.07), transparent 60%),
        radial-gradient(900px 500px at -10% 110%, rgba(99,102,241,0.06), transparent 60%),
        var(--bg-primary);
    background-attachment: fixed;
}

/* ---------- Keyframes ---------- */
@keyframes pageIn {
    from { opacity: 0; transform: translateY(14px) scale(0.995); filter: blur(2px); }
    to   { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}
@keyframes cardIn {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes popIn {
    0%   { opacity: 0; transform: scale(0.92) translateY(10px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes toastIn {
    0%   { opacity: 0; transform: translateX(64px) scale(0.95); }
    60%  { opacity: 1; transform: translateX(-6px) scale(1); }
    100% { transform: translateX(0); }
}
@keyframes shimmer {
    0%   { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}
@keyframes glowPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99,102,241,0.35); }
    50%      { box-shadow: 0 0 0 6px rgba(99,102,241,0); }
}
@keyframes rowIn {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes suggestDrop {
    from { opacity: 0; transform: translateY(-8px) scale(0.985); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Page & card entrance choreography ---------- */
.page.active { animation: pageIn 0.45s var(--ease-out) both; }
.page.active > * > .card,
.page.active > .card,
.page.active .sales-stat-card {
    animation: cardIn 0.5s var(--ease-out) both;
}
.page.active > * > .card:nth-child(2), .page.active .sales-stat-card:nth-child(2) { animation-delay: 0.06s; }
.page.active > * > .card:nth-child(3), .page.active .sales-stat-card:nth-child(3) { animation-delay: 0.12s; }
.page.active > * > .card:nth-child(4), .page.active .sales-stat-card:nth-child(4) { animation-delay: 0.18s; }

/* ---------- Cards: lift & glow on hover ---------- */
.card { transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out), border-color 0.3s; }
@media (hover: hover) {
    .card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: rgba(99,102,241,0.18); }
}

/* ---------- Topbar: frosted glass ---------- */
.topbar {
    background: rgba(255,255,255,0.72);
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    border-bottom: 1px solid rgba(227,229,241,0.8);
}

/* ---------- Sidebar nav: gradient active pill ---------- */
.nav-links li {
    position: relative;
    overflow: hidden;
    transition: color 0.25s, background 0.25s, transform 0.25s var(--ease-spring);
}
.nav-links li:hover { transform: translateX(3px); }
.nav-links li.active {
    background: var(--accent-grad);
    box-shadow: var(--accent-glow);
    color: #fff;
}
.nav-links li.active::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,0.18) 50%, transparent 70%);
    background-size: 250% 100%;
    animation: shimmer 2.8s linear infinite;
    pointer-events: none;
}

/* ---------- Buttons: shine sweep + tactile press ---------- */
.btn {
    position: relative;
    overflow: hidden;
    transition: transform 0.18s var(--ease-spring), box-shadow 0.25s, background 0.25s, opacity 0.2s;
}
.btn::after {
    content: '';
    position: absolute;
    top: 0; left: -80%;
    width: 60%; height: 100%;
    background: linear-gradient(115deg, transparent, rgba(255,255,255,0.25), transparent);
    transform: skewX(-20deg);
    transition: left 0.5s var(--ease-out);
    pointer-events: none;
}
@media (hover: hover) {
    .btn:hover:not(:disabled) { transform: translateY(-1px); }
    .btn:hover:not(:disabled)::after { left: 120%; }
    .btn-primary:hover:not(:disabled) { box-shadow: var(--accent-glow); }
    .btn-success:hover:not(:disabled) { box-shadow: 0 6px 22px rgba(16,185,129,0.35); }
}
.btn:active:not(:disabled) { transform: scale(0.96); }
.btn-primary { background: var(--accent-grad); border: none; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Inputs: animated focus ring ---------- */
.text-input, .select-input {
    transition: border-color 0.22s, box-shadow 0.22s, background 0.22s;
}
.text-input:focus, .select-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(99,102,241,0.14);
    background: #fff;
}

/* ---------- Tables: refined rows ---------- */
.data-table tbody tr { animation: rowIn 0.35s var(--ease-out) both; transition: background 0.18s; }
.data-table tbody tr:nth-child(2) { animation-delay: 0.03s; }
.data-table tbody tr:nth-child(3) { animation-delay: 0.06s; }
.data-table tbody tr:nth-child(4) { animation-delay: 0.09s; }
.data-table tbody tr:nth-child(5) { animation-delay: 0.12s; }
@media (hover: hover) { .data-table tbody tr:hover { background: var(--accent-light); } }

/* ---------- Modals: spring pop + deep blur ---------- */
.modal-overlay { backdrop-filter: blur(10px) saturate(120%); -webkit-backdrop-filter: blur(10px) saturate(120%); background: rgba(23,26,44,0.35); }
.modal-overlay.active .modal { animation: popIn 0.38s var(--ease-spring) both; box-shadow: var(--shadow-float); }

/* ---------- Toasts: bounce in ---------- */
.toast { animation: toastIn 0.45s var(--ease-out) both; box-shadow: var(--shadow-lg); }

/* ---------- Scanner: glow scan line + paused veil ---------- */
.scan-line.active {
    background: linear-gradient(90deg, transparent, #8b5cf6, #6366f1, #8b5cf6, transparent);
    box-shadow: 0 0 14px 2px rgba(139,92,246,0.65);
}
.scanner-viewport { position: relative; }
.scanner-paused::before {
    content: 'Camera paused — finish the form to resume';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(23,26,44,0.55);
    backdrop-filter: blur(4px);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    z-index: 5;
    border-radius: inherit;
    text-align: center;
    padding: 16px;
}

/* ---------- Lookup status: skeleton shimmer ---------- */
.lookup-status {
    background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-hover) 37%, var(--bg-input) 63%);
    background-size: 400px 100%;
    animation: shimmer 1.3s linear infinite;
    border-radius: var(--radius-sm);
    padding: 14px 16px;
}

/* ============================================================
   SMART PRODUCT SEARCH (above scanner)
   ============================================================ */
.smart-search-bar { padding: 14px 20px 4px; }
.smart-search-wrap { position: relative; }
.smart-search-input {
    width: 100%;
    padding: 13px 44px 13px 42px;
    font-size: 0.95rem;
    border-radius: 12px;
    border: 1.5px solid var(--border);
    background: var(--bg-input);
}
.smart-search-wrap .search-icon {
    position: absolute;
    left: 16px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
    pointer-events: none;
    transition: color 0.2s;
}
.smart-search-wrap:focus-within .search-icon { color: var(--accent); }
.search-clear {
    position: absolute;
    right: 12px; top: 50%;
    transform: translateY(-50%);
    display: none;
    align-items: center;
    justify-content: center;
    width: 24px; height: 24px;
    border: none;
    border-radius: 50%;
    background: var(--bg-hover);
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    transition: var(--transition);
}
.search-clear:hover { background: var(--danger); color: #fff; }

.search-suggestions {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0; right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-float);
    z-index: 60;
    max-height: 320px;
    overflow-y: auto;
    padding: 6px;
}
.search-suggestions.open { display: block; animation: suggestDrop 0.28s var(--ease-out) both; }

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
}
.suggestion-item:hover, .suggestion-item.active { background: var(--accent-light); }
.suggestion-item:active { transform: scale(0.985); }
.sug-icon {
    flex: 0 0 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: var(--accent-light);
    color: var(--accent);
    font-size: 0.85rem;
}
.sug-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sug-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sug-name mark { background: rgba(139,92,246,0.22); color: var(--accent-hover); border-radius: 3px; padding: 0 1px; }
.sug-meta { font-size: 0.72rem; color: var(--text-muted); display: flex; gap: 6px; align-items: center; }
.sug-meta code { font-size: 0.7rem; background: var(--bg-input); padding: 1px 5px; border-radius: 4px; }
.sug-stock { font-size: 0.68rem; padding: 1px 5px; border-radius: 4px; background: rgba(34,197,94,0.15); color: #16a34a; font-weight: 600; }
.sug-stock.out { background: rgba(239,68,68,0.15); color: #dc2626; }
.sug-price { font-weight: 700; font-size: 0.9rem; color: var(--text-primary); white-space: nowrap; }
.sug-add {
    flex: 0 0 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--success);
    color: #fff;
    font-size: 0.7rem;
    opacity: 0;
    transform: scale(0.7);
    transition: opacity 0.18s, transform 0.18s var(--ease-spring);
}
.suggestion-item:hover .sug-add, .suggestion-item.active .sug-add { opacity: 1; transform: scale(1); }
.suggestion-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* ============================================================
   NAME TRUNCATION (30-char cap + more/less toggle)
   ============================================================ */
.pname { word-break: break-word; overflow-wrap: anywhere; }
.name-cell { max-width: 240px; }
.name-cell .pname { display: inline; }
.more-btn {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 8px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--accent);
    background: var(--accent-light);
    border: 1px solid rgba(99,102,241,0.25);
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition);
    vertical-align: middle;
    white-space: nowrap;
}
.more-btn:hover { background: var(--accent); color: #fff; }
.more-btn.expanded { background: var(--accent); color: #fff; }

.mini-bill-item { align-items: flex-start; }
.mini-bill-item .item-name { flex: 1; min-width: 0; word-break: break-word; overflow-wrap: anywhere; }
.mini-bill-item .item-amt { white-space: nowrap; font-weight: 600; }

/* ============================================================
   LIVE SYNC PAGE
   ============================================================ */
.livesync-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    max-width: 760px;
    margin: 0 auto;
}
.muted-note { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 16px; line-height: 1.55; }

.live-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px;
}
.live-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 18px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    text-align: center;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.live-stat::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--accent-grad);
    opacity: 0;
    transition: opacity 0.25s;
}
@media (hover: hover) {
    .live-stat:hover { transform: translateY(-3px); box-shadow: var(--shadow); background: #fff; }
    .live-stat:hover::before { opacity: 1; }
}
.live-stat i { font-size: 1.2rem; color: var(--accent); }
.live-stat .ls-value { font-size: 1.45rem; font-weight: 700; font-family: var(--font-display); color: var(--text-primary); }
.live-stat .ls-label { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }

/* Upload progress */
.upload-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.upload-progress-track {
    flex: 1;
    height: 10px;
    background: var(--bg-input);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-light);
}
.upload-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--accent-grad);
    border-radius: 6px;
    transition: width 0.35s var(--ease-out);
    animation: glowPulse 1.6s ease-in-out infinite;
}
.upload-progress-text {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--accent);
    min-width: 84px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ---------- Badge polish ---------- */
.badge { transition: var(--transition); }

/* ---------- Sales stat cards hover ---------- */
.sales-stat-card, .payment-method-stat, .profit-card { transition: transform 0.25s var(--ease-out), box-shadow 0.25s; }
@media (hover: hover) {
    .sales-stat-card:hover, .payment-method-stat:hover, .profit-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
}

/* ---------- Mobile: keep proportions tidy ---------- */
@media (max-width: 768px) {
    .smart-search-bar { padding: 12px 14px 2px; }
    .name-cell { max-width: 150px; }
    .search-suggestions { max-height: 260px; }
    .live-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .sug-meta code { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
}

/* ---------- Accessibility: honor reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================
   PREMIUM LAYER v5 — auth, lock screen, iOS fixes, million-$ polish
   ============================================================ */

/* ---------- iOS / touch: kill tap delay, stop zoom-on-focus, big targets ---------- */
* { -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body, button, a, .nav-links li, .payment-option, .wizard-category-card,
.suggestion-item, .pin-pad button, .btn, .btn-icon, .menu-toggle {
    touch-action: manipulation;
}
/* Inputs must be >=16px on mobile or iOS Safari force-zooms */
input, select, textarea, .text-input, .select-input, .wizard-input {
    font-size: 16px;
}
button, .btn, a[role="button"] { cursor: pointer; }
/* Guarantee comfortable hit areas */
.nav-links li { min-height: 48px; }
.menu-toggle, .btn-icon { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
.btn { min-height: 44px; }
.btn-sm { min-height: 34px; }

/* ---------- Scanner controls always visible & tidy ---------- */
.scanner-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.scanner-controls .btn { flex: 0 0 auto; }
#btnStartScan, #btnStopScan { min-width: 96px; }
@media (max-width: 520px) {
    .card-header { flex-wrap: wrap; gap: 8px; }
    .scanner-controls { width: 100%; }
    .scanner-controls .btn { flex: 1 1 0; min-width: 0; }
    .scanner-controls .select-input { flex: 1 1 100%; order: 3; }
}

/* ============================================================
   LOCK / LOGIN SCREEN — dramatic, premium
   ============================================================ */
.lock-overlay {
    position: fixed; inset: 0; z-index: 4000;
    display: none;
    align-items: center; justify-content: center;
    padding: 20px;
    background:
        radial-gradient(1200px 700px at 20% -10%, #4c1d95 0%, transparent 55%),
        radial-gradient(1000px 600px at 110% 120%, #be185d 0%, transparent 55%),
        linear-gradient(140deg, #1e1b4b 0%, #2e1065 45%, #4a044e 100%);
    overflow: hidden;
}
.lock-overlay.active { display: flex; animation: lockFade 0.4s var(--ease-out) both; }
@keyframes lockFade { from { opacity: 0; } to { opacity: 1; } }

.lock-bg-orbs span {
    position: absolute; border-radius: 50%; filter: blur(60px); opacity: 0.55;
    animation: orbFloat 14s ease-in-out infinite;
}
.lock-bg-orbs span:nth-child(1) { width: 340px; height: 340px; background: #8b5cf6; top: -80px; left: -60px; }
.lock-bg-orbs span:nth-child(2) { width: 300px; height: 300px; background: #ec4899; bottom: -90px; right: -60px; animation-delay: -4s; }
.lock-bg-orbs span:nth-child(3) { width: 260px; height: 260px; background: #06b6d4; top: 40%; left: 60%; animation-delay: -8s; opacity: 0.35; }
@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(40px, -30px) scale(1.1); }
    66% { transform: translate(-30px, 30px) scale(0.95); }
}

.lock-card {
    position: relative; z-index: 2;
    width: 100%; max-width: 380px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.16);
    border-radius: 28px;
    padding: 34px 26px 26px;
    text-align: center;
    backdrop-filter: blur(22px) saturate(160%);
    -webkit-backdrop-filter: blur(22px) saturate(160%);
    box-shadow: 0 30px 80px -20px rgba(0,0,0,0.6);
    animation: popIn 0.5s var(--ease-spring) both;
}
.lock-brand {
    width: 68px; height: 68px; margin: 0 auto 18px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 20px;
    background: linear-gradient(135deg, #a855f7, #ec4899);
    color: #fff; font-size: 1.7rem;
    box-shadow: 0 12px 30px rgba(168,85,247,0.5);
    animation: glowPulse 2.4s ease-in-out infinite;
}
.lock-title { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; color: #fff; margin-bottom: 6px; }
.lock-sub { font-size: 0.9rem; color: rgba(255,255,255,0.7); margin-bottom: 22px; }

.lock-field {
    display: flex; align-items: center; gap: 10px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 14px;
    padding: 0 14px; margin-bottom: 18px;
}
.lock-field i { color: rgba(255,255,255,0.6); }
.lock-input {
    flex: 1; background: transparent; border: none; outline: none;
    color: #fff; padding: 14px 0; font-size: 16px;
}
.lock-input::placeholder { color: rgba(255,255,255,0.5); }

.pin-dots { display: flex; justify-content: center; gap: 16px; margin: 8px 0 14px; }
.pin-dots span {
    width: 16px; height: 16px; border-radius: 50%;
    background: rgba(255,255,255,0.15);
    border: 2px solid rgba(255,255,255,0.35);
    transition: transform 0.2s var(--ease-spring), background 0.2s, border-color 0.2s;
}
.pin-dots span.filled {
    background: linear-gradient(135deg, #a855f7, #ec4899);
    border-color: transparent;
    transform: scale(1.18);
    box-shadow: 0 0 14px rgba(236,72,153,0.7);
}
.pin-dots.shake { animation: shakeX 0.45s; }
@keyframes shakeX {
    0%,100% { transform: translateX(0); }
    20%,60% { transform: translateX(-9px); }
    40%,80% { transform: translateX(9px); }
}
.lock-error { min-height: 18px; color: #fca5a5; font-size: 0.82rem; font-weight: 600; margin-bottom: 8px; opacity: 0; transition: opacity 0.2s; }
.lock-error.show { opacity: 1; }

.pin-pad {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
    margin: 6px auto 18px; max-width: 300px;
}
.pin-pad button {
    height: 62px; border: none; border-radius: 18px;
    font-size: 1.4rem; font-weight: 600; font-family: var(--font-display);
    color: #fff;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.14);
    transition: transform 0.12s var(--ease-spring), background 0.2s;
}
.pin-pad button:active { transform: scale(0.92); background: rgba(255,255,255,0.25); }
.pin-pad button.pin-alt { background: rgba(255,255,255,0.04); font-size: 1.1rem; color: rgba(255,255,255,0.8); }

.lock-switch {
    background: none; border: none;
    color: rgba(255,255,255,0.8);
    font-size: 0.85rem; font-weight: 600;
    padding: 10px; border-radius: 10px;
    text-decoration: underline; text-underline-offset: 3px;
    transition: color 0.2s;
}
.lock-switch:active { color: #fff; }

/* ============================================================
   WIZARD — premium single-color vibrant background + account step
   ============================================================ */
#wizardOverlay {
    /* keep original position:fixed / inset:0 / z-index:9999 — only restyle the bg */
    background:
        radial-gradient(900px 500px at 15% 0%, rgba(168,85,247,0.55), transparent 55%),
        radial-gradient(900px 500px at 100% 100%, rgba(236,72,153,0.45), transparent 55%),
        linear-gradient(145deg, #2e1065 0%, #4c1d95 40%, #6d28d9 100%) !important;
    animation: none !important;
    overflow: hidden;
}
#wizardOverlay::before {
    content: ''; position: absolute; inset: 0;
    background:
        radial-gradient(600px 600px at 80% 20%, rgba(6,182,212,0.25), transparent 60%);
    animation: orbFloat 16s ease-in-out infinite;
    pointer-events: none;
}
.wizard-login-link {
    margin-top: 22px;
    background: rgba(255,255,255,0.14);
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    padding: 12px 22px;
    border-radius: 30px;
    font-size: 0.92rem; font-weight: 500;
    transition: transform 0.15s var(--ease-spring), background 0.2s;
    backdrop-filter: blur(8px);
}
.wizard-login-link strong { color: #fde68a; letter-spacing: 0.02em; }
.wizard-login-link:active { transform: scale(0.96); background: rgba(255,255,255,0.24); }

.wizard-username-reveal {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    background: rgba(255,255,255,0.14);
    border: 1px dashed rgba(255,255,255,0.4);
    border-radius: 18px;
    padding: 18px; margin: 10px 0 20px;
}
.wur-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.12em; color: rgba(255,255,255,0.7); font-weight: 700; }
.wur-value { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; color: #fff; word-break: break-word; }
.wur-hint { font-size: 0.75rem; color: rgba(255,255,255,0.7); line-height: 1.4; margin-top: 4px; }

.wizard-pin-group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.wizard-pin-label { font-size: 0.8rem; font-weight: 600; color: rgba(255,255,255,0.85); text-align: left; }
.wizard-pin-input {
    width: 100%;
    letter-spacing: 0.5em; text-align: center;
    font-size: 1.5rem; font-weight: 700;
    padding: 14px;
    border-radius: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.12);
    color: #fff;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.wizard-pin-input:focus { border-color: #fff; box-shadow: 0 0 0 4px rgba(255,255,255,0.18); }
.wizard-pin-input::placeholder { color: rgba(255,255,255,0.45); letter-spacing: 0.3em; }

/* ============================================================
   SCAN CONFIRM POPUP — proof of scan
   ============================================================ */
.scan-confirm-pop {
    position: fixed; z-index: 3500;
    left: 50%; top: 26%;
    transform: translate(-50%, -20px) scale(0.9);
    opacity: 0; pointer-events: none;
    transition: opacity 0.25s, transform 0.35s var(--ease-spring);
}
.scan-confirm-pop.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.scan-confirm-inner {
    background: rgba(17,24,39,0.92);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 22px;
    padding: 18px;
    text-align: center;
    box-shadow: var(--shadow-float);
    backdrop-filter: blur(12px);
    width: 240px;
}
.scan-confirm-ring {
    width: 54px; height: 54px; margin: 0 auto 12px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981, #06b6a4);
    color: #fff; font-size: 1.5rem;
    box-shadow: 0 0 0 8px rgba(16,185,129,0.2);
    animation: popIn 0.4s var(--ease-spring) both;
}
#scanConfirmCanvas {
    width: 100%; max-height: 130px; object-fit: cover;
    border-radius: 12px; margin-bottom: 10px;
    border: 1px solid rgba(255,255,255,0.12);
}
.scan-confirm-code { font-family: var(--font-display); font-size: 1rem; font-weight: 700; color: #fff; letter-spacing: 0.04em; word-break: break-all; }
.scan-confirm-label { font-size: 0.75rem; color: #6ee7b7; font-weight: 600; margin-top: 2px; }

/* ============================================================
   RESPONSIVE — fit every phone ratio
   ============================================================ */
@media (max-width: 480px) {
    .lock-card { padding: 26px 18px 20px; border-radius: 22px; }
    .lock-title { font-size: 1.35rem; }
    .pin-pad button { height: 54px; font-size: 1.25rem; }
    .pin-pad { gap: 10px; }
    .live-stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-height: 720px) {
    .pin-pad button { height: 50px; }
    .lock-brand { width: 56px; height: 56px; margin-bottom: 12px; }
    .pin-dots { margin: 6px 0 10px; }
}
/* very narrow / small phones */
@media (max-width: 360px) {
    .pin-pad button { height: 48px; font-size: 1.15rem; border-radius: 14px; }
    .wizard-pin-input { font-size: 1.3rem; }
}

/* ============================================================
   SOBER UI + MOBILE/POS FIXES
   ============================================================ */
:root {
    --bg-primary: #f6f7fb;
    --bg-input: #f7f8fb;
    --bg-hover: #eef2f7;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #6b7280;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-light: rgba(37,99,235,0.09);
    --accent-grad: #2563eb;
    --accent-glow: none;
    --success: #047857;
    --success-hover: #065f46;
    --success-grad: #047857;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --warning: #d97706;
    --info: #2563eb;
    --border: #e5e7eb;
    --border-light: #eef0f4;
    --shadow: 0 1px 2px rgba(17,24,39,0.04), 0 8px 24px rgba(17,24,39,0.06);
    --shadow-lg: 0 14px 38px rgba(17,24,39,0.12);
    --shadow-float: 0 20px 60px rgba(17,24,39,0.18);
    --radius: 10px;
    --radius-sm: 8px;
    --radius-xs: 6px;
}

html, body { background: var(--bg-primary) !important; }
body.modal-open { overflow: hidden; }

.btn::after,
.nav-links li.active::after,
#wizardOverlay::before,
.lock-bg-orbs,
.wizard-ripple {
    display: none !important;
}

.card,
.sales-stat-card,
.payment-method-stat,
.profit-card,
.live-stat {
    border-radius: var(--radius);
}

@media (hover: hover) {
    .card:hover,
    .sales-stat-card:hover,
    .payment-method-stat:hover,
    .profit-card:hover,
    .live-stat:hover {
        transform: none;
        box-shadow: var(--shadow);
    }
}

.btn-primary,
.wizard-btn-primary,
.nav-links li.active,
.sales-period-bar .btn.active {
    background: var(--accent) !important;
    color: #fff !important;
    box-shadow: none !important;
}

.btn-primary:hover:not(:disabled),
.wizard-btn-primary:hover {
    background: var(--accent-hover) !important;
    box-shadow: none !important;
}

.btn-success { background: var(--success) !important; color: #fff !important; }
.btn-success:hover:not(:disabled) { background: var(--success-hover) !important; box-shadow: none !important; }
.btn-danger { background: var(--danger) !important; color: #fff !important; }
.btn-danger:hover:not(:disabled) { background: var(--danger-hover) !important; }
.btn-secondary { background: #fff !important; color: var(--text-primary) !important; border: 1px solid var(--border) !important; }
.btn-icon:hover { background: var(--accent) !important; color: #fff !important; border-color: var(--accent) !important; }

.nav-links li:hover { transform: none; }
.topbar {
    background: rgba(255,255,255,0.92) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.scan-line.active,
.upload-progress-bar,
.live-stat::before {
    background: var(--accent) !important;
    box-shadow: none !important;
    animation: none !important;
}

/* Wizard and login: neutral surface, readable text */
#wizardOverlay {
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(246,247,251,0.98) !important;
    overflow-y: auto !important;
    animation: none !important;
}

.wizard-container {
    color: var(--text-primary);
    background: #fff !important;
    border: 1px solid var(--border);
    border-radius: 14px !important;
    width: min(94vw, 480px);
    max-height: calc(100dvh - 32px);
    box-shadow: var(--shadow-lg) !important;
}

.wizard-progress-bar { background: var(--accent) !important; }
.wizard-title { color: var(--text-primary) !important; }
.wizard-subtitle,
.wizard-skip-hint,
.wizard-category-card .cat-desc,
.wizard-action-btn small { color: var(--text-muted) !important; }
.wizard-input-icon,
.wizard-icon-animated {
    background: #eff6ff !important;
    color: var(--accent) !important;
    border-radius: 14px !important;
    box-shadow: none !important;
}
.wizard-icon-animated i { color: var(--accent) !important; }
.wizard-icon-animated.done { background: #ecfdf5 !important; }
.wizard-icon-animated.done i { color: var(--success) !important; }
.wizard-input,
.wizard-pin-input {
    background: #fff !important;
    color: var(--text-primary) !important;
    border: 1.5px solid var(--border) !important;
    box-shadow: none !important;
}
.wizard-input:focus,
.wizard-pin-input:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px var(--accent-light) !important;
}
.wizard-pin-label { color: var(--text-secondary) !important; }
.wizard-pin-input::placeholder { color: #9ca3af !important; }
.wizard-username-reveal {
    background: #f8fafc !important;
    border: 1px solid var(--border) !important;
    border-radius: 12px !important;
}
.wur-label,
.wur-hint { color: var(--text-muted) !important; }
.wur-value { color: var(--text-primary) !important; }
.wizard-login-link {
    background: #fff !important;
    border: 1px solid var(--border) !important;
    color: var(--text-primary) !important;
    border-radius: 10px !important;
    box-shadow: var(--shadow);
    backdrop-filter: none !important;
}
.wizard-login-link strong { color: var(--text-primary) !important; }
.wizard-category-card,
.wizard-action-btn { border-radius: 10px !important; }

.lock-overlay {
    background: var(--bg-primary) !important;
    overflow-y: auto;
}
.lock-card {
    background: #fff !important;
    border: 1px solid var(--border) !important;
    border-radius: 16px !important;
    color: var(--text-primary) !important;
    box-shadow: var(--shadow-lg) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
.lock-brand {
    background: #eff6ff !important;
    color: var(--accent) !important;
    box-shadow: none !important;
    animation: none !important;
}
.lock-title { color: var(--text-primary) !important; }
.lock-sub,
.lock-switch { color: var(--text-secondary) !important; }
.lock-field {
    background: #fff !important;
    border: 1px solid var(--border) !important;
}
.lock-field i { color: var(--text-muted) !important; }
.lock-input { color: var(--text-primary) !important; }
.lock-input::placeholder { color: #9ca3af !important; }
.pin-dots span {
    background: #fff !important;
    border-color: var(--border) !important;
}
.pin-dots span.filled {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    box-shadow: none !important;
}
.pin-pad button {
    color: var(--text-primary) !important;
    background: #fff !important;
    border: 1px solid var(--border) !important;
    border-radius: 12px !important;
}
.pin-pad button:active,
.pin-pad button.pin-alt { background: var(--bg-hover) !important; color: var(--text-secondary) !important; }

/* Bill-only money edits */
.money-edit,
.total-edit-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.money-edit span {
    color: var(--text-muted);
    font-weight: 700;
}
.money-input {
    width: 92px;
    min-width: 92px;
    padding: 8px 10px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.total-input {
    width: 140px;
    min-width: 126px;
    text-align: right;
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--success);
    font-variant-numeric: tabular-nums;
}
.total-input.is-overridden {
    color: var(--accent);
    border-color: var(--accent);
    background: #eff6ff;
}
.total-reset {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
}
.total-adjust-row {
    color: var(--text-muted);
    font-size: 0.85rem;
}
.temp-price-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 7px;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    background: #eff6ff;
    color: var(--accent);
    font-size: 0.68rem;
    font-weight: 700;
    vertical-align: middle;
    white-space: nowrap;
}

/* Mobile-safe modals for Add/Edit Product and scanned-product forms */
.modal-overlay {
    align-items: flex-start !important;
    justify-content: center;
    overflow-y: auto;
    padding: 24px 16px;
    background: rgba(17,24,39,0.38) !important;
    -webkit-overflow-scrolling: touch;
}
.modal {
    display: flex;
    flex-direction: column;
    max-height: calc(100dvh - 48px);
    overflow: hidden;
    border-radius: 14px !important;
}
.modal-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.modal-header,
.modal-footer {
    flex: 0 0 auto;
    background: var(--bg-card);
}
.modal-footer {
    position: sticky;
    bottom: 0;
    z-index: 1;
}

@media (max-width: 640px) {
    .modal-overlay {
        align-items: flex-end !important;
        padding: 8px;
    }
    .modal {
        width: 100%;
        max-height: calc(100dvh - 16px);
        border-radius: 16px 16px 10px 10px !important;
    }
    .modal-footer {
        justify-content: stretch;
        gap: 8px;
    }
    .modal-footer .btn {
        flex: 1 1 0;
        justify-content: center;
        padding-left: 12px;
        padding-right: 12px;
    }
    /* billing-layout mobile handled by @media max-width: 768px below */
    .total-row {
        align-items: flex-start;
        gap: 8px;
    }
    .total-edit-group {
        width: 100%;
        justify-content: flex-end;
    }
    .total-input { flex: 1 1 auto; min-width: 0; }
    .money-input { width: 86px; min-width: 86px; }
    .toast-container {
        top: 12px;
        left: 12px;
        right: 12px;
    }
    .toast { min-width: 0; width: 100%; }
}

/* Receipt printing for Android/iOS browser dialogs */
@media print {
    html,
    body {
        background: #fff !important;
        min-height: auto !important;
        overflow: visible !important;
    }
    body.is-printing-receipt .receipt-print-area {
        display: block !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        min-height: auto !important;
        padding: 0 !important;
        background: #fff !important;
    }
    body.is-printing-receipt .receipt-print {
        color: #000 !important;
        margin: 0 auto !important;
        padding: 2mm !important;
        white-space: pre-wrap !important;
        page-break-inside: avoid;
    }
    body.is-printing-receipt .receipt-print-area[data-receipt-width="58"] .receipt-print {
        width: 58mm !important;
        max-width: 58mm !important;
        font-size: 8.5px !important;
        line-height: 1.15 !important;
        letter-spacing: 0 !important;
        padding: 1mm !important;
    }
    body.is-printing-receipt .receipt-print-area[data-receipt-width="80"] .receipt-print {
        width: 80mm !important;
        max-width: 80mm !important;
    }
    body.is-printing-receipt .receipt-print-a4 {
        width: 190mm !important;
        margin: 0 auto !important;
        padding: 8mm !important;
        color: #000 !important;
        background: #fff !important;
    }
    @page { margin: 4mm; }
}

/* ============================================================
   PREMIUM PURPLE RESTORE
   ============================================================ */
:root {
    --bg-primary: #f4f1ff;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #f4f2fb;
    --bg-hover: #ece7fb;
    --text-primary: #151126;
    --text-secondary: #4d4667;
    --text-muted: #83789c;
    --accent: #6d28d9;
    --accent-hover: #5b21b6;
    --accent-light: rgba(109,40,217,0.1);
    --accent-grad: linear-gradient(135deg, #7c3aed 0%, #a21caf 52%, #db2777 100%);
    --accent-glow: 0 10px 28px rgba(124,58,237,0.36);
    --accent-2: #06b6d4;
    --accent-2-grad: linear-gradient(135deg, #06b6d4, #3b82f6);
    --success: #059669;
    --success-hover: #10b981;
    --success-grad: linear-gradient(135deg, #10b981, #06b6a4);
    --danger: #e11d48;
    --danger-hover: #f43f5e;
    --warning: #f59e0b;
    --info: #3b82f6;
    --border: #e6e0f5;
    --border-light: #f0ecfa;
    --shadow: 0 1px 2px rgba(32,20,64,0.04), 0 8px 24px rgba(71,42,138,0.08);
    --shadow-lg: 0 2px 8px rgba(32,20,64,0.06), 0 18px 54px rgba(71,42,138,0.16);
    --shadow-float: 0 24px 72px -14px rgba(46,16,101,0.26);
    --radius: 16px;
    --radius-sm: 11px;
    --radius-xs: 7px;
}

html,
body {
    background:
        radial-gradient(1100px 620px at 86% -12%, rgba(124,58,237,0.14), transparent 58%),
        radial-gradient(820px 520px at -8% 108%, rgba(219,39,119,0.11), transparent 60%),
        linear-gradient(180deg, #fbfaff 0%, var(--bg-primary) 100%) !important;
    background-attachment: fixed !important;
}

.btn::after,
.nav-links li.active::after,
#wizardOverlay::before,
.lock-bg-orbs,
.wizard-ripple {
    display: block !important;
}

.btn {
    border-radius: var(--radius-sm);
    transition: transform 0.18s var(--ease-spring), box-shadow 0.25s, background 0.25s, opacity 0.2s !important;
}
.btn-primary,
.wizard-btn-primary,
.nav-links li.active,
.sales-period-bar .btn.active {
    background: var(--accent-grad) !important;
    color: #fff !important;
    box-shadow: var(--accent-glow) !important;
}
.btn-primary:hover:not(:disabled),
.wizard-btn-primary:hover {
    background: var(--accent-grad) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 12px 32px rgba(124,58,237,0.42) !important;
}
.btn-success {
    background: var(--success-grad) !important;
    color: #fff !important;
}
.btn-success:hover:not(:disabled) {
    background: var(--success-grad) !important;
    box-shadow: 0 8px 24px rgba(16,185,129,0.34) !important;
}
.btn-secondary {
    background: rgba(255,255,255,0.84) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border) !important;
}
.btn-icon:hover {
    background: var(--accent-grad) !important;
    color: #fff !important;
    border-color: transparent !important;
    box-shadow: var(--accent-glow) !important;
}

.card {
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
@media (hover: hover) {
    .card:hover,
    .sales-stat-card:hover,
    .payment-method-stat:hover,
    .profit-card:hover,
    .live-stat:hover {
        transform: translateY(-3px) !important;
        box-shadow: var(--shadow-lg) !important;
        border-color: rgba(124,58,237,0.2);
    }
}

.topbar {
    background: rgba(255,255,255,0.72) !important;
    backdrop-filter: blur(14px) saturate(160%) !important;
    -webkit-backdrop-filter: blur(14px) saturate(160%) !important;
    border-bottom: 1px solid rgba(230,224,245,0.82) !important;
}
.nav-links li:hover {
    transform: translateX(3px) !important;
}
.nav-links li.active {
    color: #fff !important;
}
.scan-line.active {
    background: linear-gradient(90deg, transparent, #8b5cf6, #6366f1, #db2777, transparent) !important;
    box-shadow: 0 0 16px 2px rgba(139,92,246,0.68) !important;
    animation: scanLine 2s ease-in-out infinite !important;
}
.upload-progress-bar,
.live-stat::before {
    background: var(--accent-grad) !important;
}
code,
.sug-meta code {
    background: rgba(109,40,217,0.1) !important;
    color: #4c1d95 !important;
    border: 1px solid rgba(109,40,217,0.16);
}

/* Purple wizard, readable login button */
#wizardOverlay {
    background:
        radial-gradient(900px 520px at 14% 0%, rgba(168,85,247,0.62), transparent 56%),
        radial-gradient(820px 520px at 100% 100%, rgba(236,72,153,0.52), transparent 58%),
        radial-gradient(620px 460px at 78% 18%, rgba(6,182,212,0.23), transparent 60%),
        linear-gradient(145deg, #2e1065 0%, #4c1d95 42%, #6d28d9 100%) !important;
    overflow-y: auto !important;
    animation: wizardBgShiftPremium 12s ease-in-out infinite alternate !important;
}
#wizardOverlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(420px 420px at 18% 72%, rgba(255,255,255,0.12), transparent 62%),
        linear-gradient(115deg, transparent 20%, rgba(255,255,255,0.08) 42%, transparent 64%);
    background-size: 100% 100%, 220% 100%;
    animation: auroraSweep 9s linear infinite !important;
    pointer-events: none;
}
@keyframes wizardBgShiftPremium {
    0% { filter: hue-rotate(0deg) saturate(1); }
    100% { filter: hue-rotate(8deg) saturate(1.08); }
}
@keyframes auroraSweep {
    0% { background-position: 0 0, -180% 0; }
    100% { background-position: 0 0, 180% 0; }
}

.wizard-container {
    background: rgba(255,255,255,0.94) !important;
    border: 1px solid rgba(255,255,255,0.72) !important;
    border-radius: 24px !important;
    box-shadow: 0 30px 80px -24px rgba(17,12,46,0.65) !important;
    backdrop-filter: blur(18px) saturate(145%) !important;
    -webkit-backdrop-filter: blur(18px) saturate(145%) !important;
}
.wizard-progress-bar {
    background: var(--accent-grad) !important;
}
.wizard-title {
    color: #17112f !important;
}
.wizard-input-icon,
.wizard-icon-animated {
    background: var(--accent-grad) !important;
    color: #fff !important;
    box-shadow: 0 14px 34px rgba(124,58,237,0.35) !important;
}
.wizard-icon-animated i {
    color: #fff !important;
}
.wizard-icon-animated.done {
    background: var(--success-grad) !important;
}
.wizard-ripple {
    border: 2px solid rgba(124,58,237,0.36) !important;
}
.wizard-input,
.wizard-pin-input {
    background: rgba(255,255,255,0.92) !important;
    color: #151126 !important;
    border: 2px solid rgba(124,58,237,0.16) !important;
}
.wizard-input:focus,
.wizard-pin-input:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 4px rgba(124,58,237,0.16) !important;
}
.wizard-pin-label {
    color: #4d4667 !important;
}
.wizard-pin-input::placeholder {
    color: rgba(76,29,149,0.34) !important;
}
.wizard-login-link {
    background: rgba(255,255,255,0.94) !important;
    color: #111827 !important;
    border: 1px solid rgba(255,255,255,0.72) !important;
    border-radius: 30px !important;
    box-shadow: 0 12px 32px rgba(17,12,46,0.24) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
}
.wizard-login-link strong {
    color: #5b21b6 !important;
}
.wizard-category-card.selected {
    border-color: var(--accent) !important;
    background: rgba(109,40,217,0.1) !important;
}
.wizard-action-btn:hover,
.wizard-category-card:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 24px rgba(71,42,138,0.12) !important;
}

/* Premium lock/PIN screen with visible fields */
.lock-overlay {
    background:
        radial-gradient(1200px 700px at 20% -10%, #4c1d95 0%, transparent 55%),
        radial-gradient(1000px 600px at 110% 120%, #be185d 0%, transparent 55%),
        linear-gradient(140deg, #1e1b4b 0%, #2e1065 45%, #4a044e 100%) !important;
}
.lock-bg-orbs span {
    display: block !important;
}
.lock-card {
    background: rgba(255,255,255,0.12) !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
    border-radius: 28px !important;
    box-shadow: 0 30px 80px -20px rgba(0,0,0,0.58) !important;
    backdrop-filter: blur(22px) saturate(160%) !important;
    -webkit-backdrop-filter: blur(22px) saturate(160%) !important;
}
.lock-brand {
    background: var(--accent-grad) !important;
    color: #fff !important;
    box-shadow: 0 12px 30px rgba(168,85,247,0.5) !important;
    animation: glowPulse 2.4s ease-in-out infinite !important;
}
.lock-title {
    color: #fff !important;
}
.lock-sub,
.lock-switch {
    color: rgba(255,255,255,0.82) !important;
}
.lock-field {
    background: rgba(255,255,255,0.14) !important;
    border: 1px solid rgba(255,255,255,0.22) !important;
}
.lock-field i {
    color: rgba(255,255,255,0.7) !important;
}
.lock-input {
    color: #fff !important;
}
.lock-input::placeholder {
    color: rgba(255,255,255,0.58) !important;
}
.pin-dots span {
    background: rgba(255,255,255,0.16) !important;
    border-color: rgba(255,255,255,0.36) !important;
}
.pin-dots span.filled {
    background: linear-gradient(135deg, #a855f7, #ec4899) !important;
    border-color: transparent !important;
    box-shadow: 0 0 14px rgba(236,72,153,0.7) !important;
}
.pin-pad button {
    color: #fff !important;
    background: rgba(255,255,255,0.12) !important;
    border: 1px solid rgba(255,255,255,0.16) !important;
    border-radius: 18px !important;
}
.pin-pad button:active {
    background: rgba(255,255,255,0.26) !important;
}
.pin-pad button.pin-alt {
    background: rgba(255,255,255,0.06) !important;
    color: rgba(255,255,255,0.84) !important;
}

.total-input.is-overridden,
.temp-price-badge {
    border-color: rgba(124,58,237,0.24) !important;
    background: rgba(109,40,217,0.1) !important;
    color: var(--accent) !important;
}

/* ============================================================
   MOBILE TABLE SCROLL + BILL PRICE EDIT VISIBILITY
   ============================================================ */
.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.sidebar-logout {
    width: 100%;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--accent-grad);
    color: #fff;
    font-family: var(--font-body);
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--accent-glow);
    transition: transform 0.18s var(--ease-spring), box-shadow 0.25s;
}
.sidebar-logout:active {
    transform: scale(0.97);
}

.products-layout,
.history-layout,
#page-history > .card,
#page-products .card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}
.table-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: auto !important;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
    overscroll-behavior-x: contain;
    scrollbar-gutter: stable;
}
.table-wrapper::after {
    content: '';
    position: sticky;
    right: 0;
    display: block;
    width: 1px;
    height: 1px;
}
#billTable,
#productTable,
#historyTable {
    width: max-content;
    min-width: 100%;
    table-layout: auto;
}
#billTable { min-width: 860px; }
#productTable { min-width: 700px; }
#historyTable { min-width: 760px; }
#productTable th,
#productTable td,
#historyTable th,
#historyTable td {
    white-space: nowrap;
}
#productTable .name-cell,
#historyTable .name-cell,
#billTable .name-cell {
    white-space: normal;
}

.editable-money {
    padding: 2px;
    border-radius: 10px;
    background: rgba(109,40,217,0.06);
    border: 1px solid rgba(109,40,217,0.12);
}
.editable-money .money-input {
    border-color: transparent !important;
    background: rgba(255,255,255,0.86) !important;
}
.edit-hint {
    color: var(--accent);
    font-size: 0.78rem;
    padding-right: 4px;
}
.temp-price-editor {
    margin-top: 10px;
    padding: 10px;
    border: 1px solid rgba(109,40,217,0.14);
    border-radius: var(--radius-sm);
    background: rgba(109,40,217,0.07);
}
.temp-price-editor label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 700;
}
.temp-price-editor .money-edit {
    width: 100%;
    flex-wrap: wrap;
}
.temp-price-editor .quick-price-input {
    flex: 1 1 120px;
}

@media (max-width: 768px) {
    #page-products .card-header,
    #page-history .card-header {
        padding: 12px 14px;
        gap: 8px;
    }
    #page-products .card-header h2,
    #page-history .card-header h2 {
        font-size: 0.9rem;
    }
    #page-products .card-body,
    #page-history .card-body {
        padding: 12px;
    }
    #btnAddProduct {
        padding: 9px 12px;
        min-height: 38px;
        font-size: 0.82rem;
    }
    #productSearch {
        min-height: 40px;
    }
    .data-table th {
        padding: 8px 10px;
        font-size: 0.68rem;
        letter-spacing: 0.03em;
    }
    .data-table td {
        padding: 8px 10px;
        font-size: 0.78rem;
    }
    #billTable { min-width: 540px; }
    #productTable { min-width: 100% !important; table-layout: fixed !important; }
    #historyTable { min-width: 100% !important; table-layout: fixed !important; }
    #productTable .name-cell { max-width: 150px; }
    #billTable .name-cell { max-width: 120px; }
    .table-wrapper {
        border: 1px solid var(--border-light);
        border-radius: var(--radius-sm);
        background:
            linear-gradient(90deg, rgba(255,255,255,1), rgba(255,255,255,0)) left center / 18px 100% no-repeat,
            linear-gradient(270deg, rgba(109,40,217,0.16), rgba(109,40,217,0)) right center / 24px 100% no-repeat,
            #fff;
    }
    .money-input {
        width: 78px;
        min-width: 78px;
        padding: 7px 8px;
    }
    .edit-hint {
        display: inline-block;
    }
}

@media (max-width: 420px) {
    #billTable { min-width: 420px; }
    #billTable th:nth-child(2),
    #billTable td:nth-child(2) { display: none; }
    #billTable th:nth-child(8),
    #billTable td:nth-child(8) { display: none; }
    .data-table th,
    .data-table td {
        padding-left: 6px;
        padding-right: 6px;
    }
    .products-layout .input-group {
        margin-bottom: 10px !important;
    }
    .temp-price-editor .apply-temp-price {
        flex: 1 1 100%;
        justify-content: center;
    }
    .money-input { width: 58px; min-width: 58px; padding: 5px 3px; font-size: 0.75rem; }
    .qty-cell button { width: 22px; height: 22px; font-size: 0.65rem; }
    .qty-cell span { min-width: 20px; font-size: 0.78rem; }
    .billing-actions { gap: 6px; }
    .billing-actions .btn-lg { padding: 10px 12px; font-size: 0.85rem; }
    .billing-wa-btn { flex: 0 0 42px; font-size: 1rem; }
}

@media (max-width: 360px) {
    .page { padding: 8px; }
    #billTable { min-width: 340px; }
    #billTable th:nth-child(6),
    #billTable td:nth-child(6) { display: none; }
    .money-input { width: 50px; min-width: 50px; padding: 4px 2px; font-size: 0.7rem; }
    .calc-row { font-size: 0.85rem; }
    .total-row { font-size: 1.1rem; }
    .payment-methods { grid-template-columns: repeat(2, 1fr); gap: 6px; }
    .billing-actions .btn-lg { padding: 10px 8px; font-size: 0.8rem; }
    .billing-wa-btn { flex: 0 0 38px; font-size: 0.9rem; }
}

/* ============================================================
   BARCODE GENERATOR
   ============================================================ */
.product-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.barcode-modal {
    width: min(96vw, 980px);
    max-width: 980px;
}
.barcode-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 4px;
    margin-bottom: 16px;
    border-radius: 14px;
    background: rgba(109,40,217,0.08);
    border: 1px solid rgba(109,40,217,0.12);
}
.barcode-tab {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 11px;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.18s var(--ease-spring), background 0.2s, color 0.2s, box-shadow 0.2s;
}
.barcode-tab.active {
    background: var(--accent-grad);
    color: #fff;
    box-shadow: var(--accent-glow);
}
.barcode-tab:active {
    transform: scale(0.98);
}
.barcode-panel {
    display: none;
}
.barcode-panel.active {
    display: block;
}
.barcode-preview-wrap {
    margin-top: 14px;
    padding: 14px;
    border: 1px solid rgba(109,40,217,0.14);
    border-radius: 16px;
    background:
        radial-gradient(380px 160px at 20% 0%, rgba(124,58,237,0.12), transparent 60%),
        #fff;
    overflow: auto;
    text-align: center;
    -webkit-overflow-scrolling: touch;
}
.barcode-preview-wrap canvas {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(46,16,101,0.12);
}
.bulk-barcode-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.bulk-barcode-table-wrap {
    max-height: 320px;
    overflow: auto;
    border: 1px solid rgba(109,40,217,0.14);
    border-radius: 14px;
    background: #fff;
    -webkit-overflow-scrolling: touch;
}
.bulk-barcode-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
}
.bulk-barcode-table th,
.bulk-barcode-table td {
    padding: 8px;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.8rem;
    white-space: nowrap;
}
.bulk-barcode-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f8f5ff;
    color: var(--text-secondary);
    text-align: left;
    font-weight: 800;
}
.bulk-barcode-table td:first-child,
.bulk-barcode-table th:first-child {
    text-align: center;
    min-width: 42px;
}
.bulk-barcode-table .text-input {
    width: 150px;
    min-height: 38px;
    padding: 8px 10px;
    font-size: 0.82rem;
}
.bulk-barcode-table .bulk-price {
    width: 94px;
}
.bulk-barcode-table .bulk-code {
    width: 150px;
    font-family: var(--font-display);
    font-weight: 700;
}
.bulk-preview {
    max-height: 420px;
}
.bulk-preview canvas {
    width: min(100%, 620px);
}

@media (max-width: 768px) {
    .product-header-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
    .product-header-actions .btn {
        width: 100%;
        justify-content: center;
        padding-left: 10px;
        padding-right: 10px;
        font-size: 0.78rem;
    }
    .barcode-modal {
        width: 100%;
    }
    .barcode-tabs {
        grid-template-columns: 1fr;
    }
    .bulk-barcode-table {
        min-width: 710px;
    }
}

@media (max-width: 420px) {
    .product-header-actions {
        gap: 8px;
    }
    .barcode-preview-wrap {
        padding: 10px;
    }
    .bulk-preview canvas {
        width: 520px;
        max-width: none;
    }
}

/* Compact product list: tap row to edit, delete always visible */
#productTable {
    width: 100% !important;
    min-width: 100% !important;
    table-layout: fixed !important;
}
#productTable th:nth-child(2),
#productTable td:nth-child(2) {
    width: 96px;
    text-align: right;
}
#productTable th:nth-child(3),
#productTable td:nth-child(3) {
    width: 64px;
    text-align: center;
}
.product-row-click {
    cursor: pointer;
}
.product-name-cell {
    min-width: 0;
}
.product-name-cell strong {
    display: block;
    color: var(--text-primary);
    line-height: 1.25;
}
.product-row-meta {
    display: block;
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.product-rate-cell {
    color: var(--accent);
    font-family: var(--font-display);
    font-weight: 800;
    white-space: nowrap;
}
#productTable .product-delete-cell .btn {
    width: 38px;
    min-width: 38px;
    height: 36px;
    padding: 0;
    justify-content: center;
}

@media (max-width: 768px) {
    #productTable th,
    #productTable td {
        padding-top: 9px;
        padding-bottom: 9px;
    }
    #productTable th:nth-child(2),
    #productTable td:nth-child(2) {
        width: 88px;
    }
    #productTable th:nth-child(3),
    #productTable td:nth-child(3) {
        width: 56px;
    }
    .product-row-meta {
        display: none;
    }
}

/* ============================================================
   BILL HISTORY & SALES OVERVIEW — full-page layout on mobile
   Matching Add Product pattern: stacked sections, edge borders,
   internal scrolling in every section
   ============================================================ */
#page-history.active,
#page-sales.active {
    max-height: calc(100dvh - var(--topbar-height) - 24px);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

#page-history .card,
#page-sales .card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    background: var(--bg-card);
    overflow: hidden;
}

/* Edge border clarification — each section card gets a visible left accent */
#page-history .card {
    border-left: 3px solid var(--accent);
}

#page-sales .sales-period-bar {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    padding: 8px;
    box-shadow: var(--shadow);
}

#page-sales .card {
    border-left: 3px solid var(--accent);
}

#page-sales .sales-stats-grid {
    border: none;
    background: transparent;
    box-shadow: none;
}

/* History table: compact with internal scroll */
#page-history .table-wrapper {
    max-height: calc(100dvh - 220px);
    overflow: auto !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
    overscroll-behavior: contain;
}

#historyTable {
    width: 100% !important;
    min-width: 480px !important;
    table-layout: fixed;
    border-collapse: collapse;
}

#historyTable thead th {
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 2;
    font-size: 0.78rem;
    padding: 8px 6px;
    white-space: nowrap;
    border-bottom: 2px solid var(--border);
}

/* Column widths */
#historyTable th:nth-child(1),
#historyTable td:nth-child(1) { width: 60px; text-align: center; } /* Bill # */
#historyTable th:nth-child(2),
#historyTable td:nth-child(2) { width: 80px; } /* Date */
#historyTable th:nth-child(3),
#historyTable td:nth-child(3) { width: auto; } /* Customer */
#historyTable th:nth-child(4),
#historyTable td:nth-child(4) { width: 40px; text-align: center; } /* Items */
#historyTable th:nth-child(5),
#historyTable td:nth-child(5) { width: 80px; text-align: right; } /* Total */
#historyTable th:nth-child(6),
#historyTable td:nth-child(6) { width: 50px; text-align: center; } /* Pay */
#historyTable th:nth-child(7),
#historyTable td:nth-child(7) { width: 40px; text-align: center; } /* Actions */

#historyTable td {
    padding: 8px 6px;
    vertical-align: middle;
    word-break: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.82rem;
    border-bottom: 1px solid var(--border);
}

/* Bill # cell */
.bill-no-cell {
    vertical-align: middle;
    text-align: center;
}
.bill-no-cell strong {
    display: block;
    font-size: 0.88rem;
}

/* Action cell */
.action-cell {
    text-align: center;
    vertical-align: middle;
}

.reprint-btn {
    padding: 4px 8px;
    font-size: 0.72rem;
    min-height: auto;
    border-radius: 6px;
    white-space: nowrap;
    line-height: 1;
}
.btn-xs {
    padding: 4px 8px;
    font-size: 0.72rem;
    min-height: auto;
}

.muted-text {
    color: var(--muted);
    font-size: 0.72rem;
}

.badge-sm {
    font-size: 0.68rem;
    padding: 2px 6px;
    border-radius: 4px;
}

/* Sales cards: compact fixed shape */
.sales-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}
.sales-stat-card {
    padding: 14px;
    min-height: 76px;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
}

/* Sales profit grid: fixed */
.sales-profit-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.profit-card {
    padding: 14px 8px;
    min-height: 64px;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

/* Payment breakdown: fixed */
.payment-breakdown-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

/* Profit breakdown: scrollable internally */
.profit-breakdown {
    max-height: 180px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 12px;
}

/* Sales period bar: in card header */
.sales-period-bar {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-left: auto;
}
.sales-period-bar::-webkit-scrollbar { display: none; }
.sales-period-bar .btn {
    flex: 0 0 auto;
    white-space: nowrap;
    min-height: 32px;
    font-size: 0.78rem;
    padding: 6px 12px;
}

/* Sales card header: title + period bar side by side */
#page-sales .card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Breakdown table: scrollable */
#page-sales .table-wrapper {
    max-height: 260px;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
}

/* ============================================================
   MOBILE: Bill History & Sales full-page stacked layout
   ============================================================ */
@media (max-width: 768px) {
    #page-history.active,
    #page-sales.active {
        max-height: none;
        overflow-x: hidden;
        overflow-y: auto;
        padding: 12px;
        gap: 12px;
        -webkit-overflow-scrolling: touch;
    }

    #page-history .card,
    #page-sales .card {
        border-left: 3px solid var(--accent);
        border-radius: var(--radius-sm);
    }

    #page-history .card-header {
        padding: 10px 14px;
        flex-wrap: wrap;
        gap: 8px;
    }
    #page-history .card-header h2 {
        font-size: 0.88rem;
    }
    #page-history .card-body {
        padding: 8px;
    }

    /* History table: internal scroll within fixed height */
    #page-history .table-wrapper {
        max-height: calc(100dvh - 200px);
        overflow: auto !important;
        border: 1px solid var(--border-light);
        border-radius: var(--radius-sm);
    }

    #historyTable {
        width: 100% !important;
        min-width: 460px !important;
        table-layout: fixed;
    }

    #historyTable th,
    #historyTable td {
        padding: 6px 4px;
        font-size: 0.74rem;
    }

    /* Sales: stack all sections vertically, each card scrollable */
    #page-sales .settings-layout {
        display: flex;
        flex-direction: column;
        gap: 14px;
        max-height: none;
        overflow: visible;
    }

    #page-sales .sales-period-bar {
        margin-left: 0;
        margin-top: 8px;
        width: 100%;
    }

    #page-sales .sales-stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    #page-sales .sales-stat-card {
        padding: 14px 12px;
        min-height: 76px;
        display: flex;
        align-items: center;
        gap: 10px;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        background: var(--bg-secondary);
        overflow: visible;
    }

    #page-sales .sales-stat-card .stat-icon {
        width: 38px;
        height: 38px;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.9rem;
        flex-shrink: 0;
    }

    #page-sales .sales-stat-card .stat-info {
        min-width: 0;
        overflow: hidden;
    }

    #page-sales .sales-stat-card .stat-label {
        font-size: 0.68rem;
        display: block;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.3px;
    }

    #page-sales .sales-stat-card .stat-value {
        font-size: 1.05rem;
        font-weight: 700;
        display: block;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    #page-sales .card {
        border-radius: var(--radius-sm);
    }
    #page-sales .card-header {
        padding: 10px 14px;
        flex-wrap: wrap;
        gap: 8px;
    }
    #page-sales .card-header h2 {
        font-size: 0.88rem;
    }
    #page-sales .card-body {
        padding: 12px;
    }

    /* Profit grid: 3-col on mobile */
    #page-sales .sales-profit-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    #page-sales .payment-breakdown-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    #page-sales .profit-input-row {
        flex-direction: column;
        gap: 10px;
    }

    #page-sales .profit-margin-display {
        font-size: 1.4rem;
        min-width: auto;
    }

    /* Breakdown table: scrollable with fixed height */
    #page-sales .table-wrapper {
        max-height: 240px;
        overflow: auto !important;
        -webkit-overflow-scrolling: touch;
        border: 1px solid var(--border-light);
        border-radius: var(--radius-sm);
    }
    #page-sales .data-table {
        min-width: 480px;
        table-layout: fixed;
    }

    #page-sales .data-table th,
    #page-sales .data-table td {
        padding: 8px 6px;
        font-size: 0.78rem;
        white-space: nowrap;
    }

    /* Header actions stack vertically on mobile */
    #page-history .header-actions {
        flex-wrap: wrap;
        gap: 6px;
        width: 100%;
    }
    #page-history .header-actions .text-input,
    #page-history .header-actions input[type="text"] {
        width: 100%;
        min-height: 38px;
    }
    #page-history .header-actions .btn {
        width: 100%;
        justify-content: center;
        min-height: 38px;
        font-size: 0.8rem;
    }
}

@media (max-width: 420px) {
    #page-history .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    #page-sales .sales-stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    #page-sales .payment-breakdown-grid {
        grid-template-columns: 1fr 1fr;
    }
    #page-sales .sales-period-bar .btn {
        padding: 5px 8px;
        font-size: 0.72rem;
    }
}

/* ============================================================
   FULL-SIZE MODAL PAGES — replace bottom sheets on mobile
   All modals open as full overlay with internal scrolling
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px;
    background: rgba(17,24,39,0.42);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    max-height: calc(100dvh - 32px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(17,24,39,0.25);
    animation: popIn 0.3s var(--ease-spring) both;
}

.modal-header {
    flex: 0 0 auto;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    position: sticky;
    top: 0;
    z-index: 2;
}

.modal-body {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px;
    min-height: 0;
}

.modal-footer {
    flex: 0 0 auto;
    padding: 14px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
    position: sticky;
    bottom: 0;
    z-index: 2;
}

/* Barcode generator modal: wider */
.barcode-modal {
    max-width: 700px;
}

.barcode-modal .modal-body {
    padding: 16px;
}

/* ============================================================
   MOBILE: Full-screen modals (no bottom sheets)
   All dialogs open as full-size scrollable pages
   ============================================================ */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 0 !important;
        align-items: stretch !important;
        justify-content: stretch !important;
    }

    .modal {
        max-width: 100% !important;
        max-height: 100dvh !important;
        width: 100% !important;
        height: 100% !important;
        border-radius: 0 !important;
        border: none !important;
        animation: modalSlideUp 0.3s var(--ease-out) both;
    }

    @keyframes modalSlideUp {
        from { transform: translateY(30px); opacity: 0; }
        to { transform: translateY(0); opacity: 1; }
    }

    .modal-header {
        border-radius: 0;
        padding: 14px 16px;
    }

    .modal-body {
        padding: 16px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .modal-footer {
        border-radius: 0;
        padding: 12px 16px;
        gap: 8px;
    }

    .modal-footer .btn {
        flex: 1;
        justify-content: center;
        min-height: 44px;
        font-size: 0.9rem;
    }

    .barcode-modal {
        max-width: 100% !important;
    }
}

/* Very small phones */
@media (max-width: 420px) {
    .modal-body {
        padding: 14px;
    }

    .modal-header h2 {
        font-size: 0.95rem;
    }

    .form-group label {
        font-size: 0.8rem;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* ============================================================
   SCROLLABLE CARD CONTENT — all cards get internal scroll
   ============================================================ */
#page-products .card {
    max-height: calc(100dvh - var(--topbar-height) - 24px);
    display: flex;
    flex-direction: column;
}

#page-products .card-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#page-settings .settings-layout {
    max-height: calc(100dvh - var(--topbar-height) - 24px);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 24px;
}

#page-sales .settings-layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 1200px;
}

#page-livesync .livesync-layout {
    max-height: calc(100dvh - var(--topbar-height) - 24px);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 24px;
}

/* Scanner page: internal scroll for sidebar */
.scanner-sidebar {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    max-height: calc(100dvh - var(--topbar-height) - 48px);
}

/* Billing page: scrollable on mobile */
@media (max-width: 768px) {
    #page-billing {
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .billing-search-bar {
        padding: 0 0 8px 0;
        position: sticky;
        top: 0;
        z-index: 10;
        background: var(--bg);
    }

    .billing-layout {
        display: flex;
        flex-direction: column;
        gap: 16px;
        height: auto;
        max-height: none;
    }

    .billing-table-card {
        max-height: none;
        overflow: hidden;
    }

    .billing-table-card .table-wrapper {
        flex: none;
        max-height: 42vh;
        overflow-y: auto;
        overflow-x: auto;
    }

    .billing-calc-panel {
        flex: none;
        overflow: hidden;
    }

    .billing-calc-panel .card-body {
        overflow-y: auto;
        overflow-x: hidden;
        max-height: 58vh;
        -webkit-overflow-scrolling: touch;
    }

    .scanner-layout {
        display: flex;
        flex-direction: column;
        gap: 12px;
        height: auto;
    }

    .scanner-sidebar {
        max-height: none;
    }
}

/* ========== LICENSING OVERLAY ========== */
.lic-overlay-active {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: linear-gradient(160deg, #1a1040 0%, #2d1b69 40%, #1a1040 100%);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 24px 16px;
    animation: licFadeIn 0.4s ease;
}
body.lic-locked {
    overflow: hidden;
}
body.lic-locked .sidebar,
body.lic-locked .main-content,
body.lic-locked .lock-overlay {
    display: none !important;
}
@keyframes licFadeIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}
.lic-lock-screen {
    width: 100%;
    max-width: 480px;
    position: relative;
}
.lic-close-btn {
    position: absolute;
    top: -8px;
    right: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.6);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}
.lic-close-btn:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border-color: rgba(255,255,255,0.3);
}
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding-bottom: 40px;
}
.lic-hero {
    text-align: center;
    color: #fff;
}
.lic-hero h1 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 8px;
}
.lic-subtitle {
    font-size: 1rem;
    color: rgba(255,255,255,0.75);
    margin-bottom: 4px;
}
.lic-subtitle strong {
    color: #c4b5fd;
}
.lic-date {
    font-size: 0.82rem;
    color: rgba(255,255,255,0.5);
    margin-top: 6px;
}
.lic-icon-wrap {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #c4b5fd;
    margin-bottom: 16px;
    border: 2px solid rgba(255,255,255,0.15);
}
.lic-hero.locked .lic-icon-wrap {
    color: #fca5a5;
    border-color: rgba(252,165,165,0.3);
    background: rgba(252,165,165,0.1);
}
.lic-hero.pending .lic-icon-wrap {
    color: #fde68a;
    border-color: rgba(253,230,138,0.3);
}
.lic-hero.payment .lic-icon-wrap {
    color: #86efac;
    border-color: rgba(134,239,172,0.3);
}
/* Trial progress */
.lic-progress-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.lic-progress-track {
    height: 6px;
    background: rgba(255,255,255,0.12);
    border-radius: 3px;
    overflow: hidden;
}
.lic-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #c4b5fd, #a78bfa);
    border-radius: 3px;
    transition: width 0.6s ease;
}
.lic-progress-label {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.5);
    text-align: center;
}
/* Spinner */
.lic-spinner {
    margin-top: 16px;
    color: rgba(255,255,255,0.6);
    font-size: 0.9rem;
}
.lic-spinner i {
    margin-right: 6px;
    color: #fde68a;
}
/* Buttons */
.lic-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    box-shadow: 0 4px 16px rgba(109,40,217,0.4);
}
.lic-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(109,40,217,0.5);
}
.lic-btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.7);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 12px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}
.lic-btn-secondary:hover {
    background: rgba(255,255,255,0.14);
    color: #fff;
}
.lic-btn-whatsapp {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    background: #25D366;
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    box-shadow: 0 4px 16px rgba(37,211,102,0.3);
}
.lic-btn-whatsapp:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(37,211,102,0.4);
}
.lic-btn-whatsapp.lg {
    font-size: 1.05rem;
    padding: 16px 32px;
}
.lic-cta {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
/* Plans */
.lic-plans {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.lic-plan-card {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 18px;
    padding: 24px 20px;
    color: #fff;
    text-align: center;
    position: relative;
    transition: all 0.25s;
}
.lic-plan-card.featured {
    border-color: #a78bfa;
    background: rgba(109,40,217,0.15);
}
.lic-plan-badge {
    position: absolute;
    top: -10px;
    right: 16px;
    background: #a78bfa;
    color: #1a1040;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.lic-plan-card.featured .lic-plan-badge {
    background: #c4b5fd;
}
.lic-plan-card h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    margin-bottom: 8px;
}
.lic-plan-price {
    font-size: 2rem;
    font-weight: 700;
    font-family: var(--font-display);
    margin-bottom: 4px;
}
.lic-plan-price span {
    font-size: 0.85rem;
    font-weight: 400;
    color: rgba(255,255,255,0.5);
}
.lic-plan-savings {
    font-size: 0.82rem;
    color: #86efac;
    margin-bottom: 12px;
}
.lic-plan-features {
    list-style: none;
    text-align: left;
    margin: 16px 0;
    padding: 0;
}
.lic-plan-features li {
    padding: 6px 0;
    font-size: 0.88rem;
    color: rgba(255,255,255,0.75);
    display: flex;
    align-items: center;
    gap: 8px;
}
.lic-plan-features li i {
    color: #86efac;
    font-size: 0.8rem;
}
/* UPI info */
.lic-upi-info {
    text-align: center;
    color: rgba(255,255,255,0.6);
    font-size: 0.88rem;
}
.lic-upi-box {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    padding: 10px 18px;
    margin-top: 8px;
    cursor: pointer;
    transition: all 0.2s;
}
.lic-upi-box:hover {
    background: rgba(255,255,255,0.14);
}
.lic-upi-box span {
    font-weight: 600;
    color: #c4b5fd;
    font-size: 1rem;
}
.lic-upi-box i {
    color: rgba(255,255,255,0.4);
}
/* Payment steps */
.lic-payment-steps {
    display: flex;
    flex-direction: column;
    gap: 20px;
    color: #fff;
}
.lic-step {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    background: rgba(255,255,255,0.04);
    border-radius: 14px;
    padding: 16px;
}
.lic-step-num {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #c4b5fd;
}
.lic-step strong {
    display: block;
    margin-bottom: 4px;
}
.lic-step p {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.6);
    margin: 0;
}
.lic-step code {
    background: rgba(255,255,255,0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #c4b5fd;
}
.lic-footer-note {
    text-align: center;
    color: rgba(255,255,255,0.4);
    font-size: 0.82rem;
}
.lic-footer-note p { margin: 0; }
.lic-icon-wrap.congrats {
    color: #fbbf24;
    border-color: rgba(251,191,36,0.3);
    background: rgba(251,191,36,0.1);
    font-size: 2.2rem;
    animation: licPop 0.5s ease;
}
.lic-active-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, rgba(251,191,36,0.15), rgba(245,158,11,0.1));
    border: 1px solid rgba(251,191,36,0.3);
    border-radius: 14px;
    padding: 14px 20px;
    color: #fbbf24;
    font-weight: 700;
    font-size: 1.1rem;
    font-family: var(--font-display);
}
@keyframes licPop {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

/* ===== License card in Settings ===== */
.lic-card-status {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 14px;
    margin-bottom: 8px;
}
.lic-card-status.trial {
    background: linear-gradient(135deg, rgba(124,58,237,0.08), rgba(167,139,250,0.08));
    border: 1px solid rgba(167,139,250,0.2);
}
.lic-card-status.active {
    background: linear-gradient(135deg, rgba(5,150,105,0.08), rgba(134,239,172,0.08));
    border: 1px solid rgba(134,239,172,0.2);
}
.lic-card-status.pending {
    background: linear-gradient(135deg, rgba(234,179,8,0.08), rgba(253,230,138,0.08));
    border: 1px solid rgba(253,230,138,0.2);
}
.lic-card-status.expired {
    background: linear-gradient(135deg, rgba(220,38,38,0.08), rgba(252,165,165,0.08));
    border: 1px solid rgba(252,165,165,0.2);
}
.lic-card-icon {
    font-size: 1.4rem;
}
.lic-card-status.trial .lic-card-icon { color: #7c3aed; }
.lic-card-status.active .lic-card-icon { color: #059669; }
.lic-card-status.pending .lic-card-icon { color: #ca8a04; }
.lic-card-status.expired .lic-card-icon { color: #dc2626; }
.lic-card-status strong { display: block; margin-bottom: 2px; }
.lic-card-status p { margin: 0; font-size: 0.85rem; color: var(--text-muted); }
.lic-card-shop {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

@media (max-width: 480px) {
    .lic-overlay-active {
        padding: 16px 12px;
    }
    .lic-hero h1 {
        font-size: 1.3rem;
    }
    .lic-plan-card {
        padding: 20px 16px;
    }
}

/* ========== ADMIN PANEL ========== */
.admin-panel .admin-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
}
.admin-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}
.admin-tab:hover { background: var(--bg-hover); }
.admin-tab.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.admin-action-cell {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
}
.btn-sm { padding: 6px 10px; font-size: 0.78rem; border-radius: 8px; }
.lic-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.lic-badge.active { background: rgba(5,150,105,0.1); color: #059669; }
.lic-badge.pending { background: rgba(234,179,8,0.1); color: #ca8a04; }
.lic-badge.trial { background: rgba(124,58,237,0.1); color: #7c3aed; }
.lic-badge.expired { background: rgba(220,38,38,0.1); color: #dc2626; }
.admin-cat-row {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 8px;
    background: var(--bg-secondary);
}
.admin-cat-info strong { display: block; margin-bottom: 2px; }
.admin-cat-info code { font-size: 0.75rem; color: var(--text-muted); word-break: break-all; }
#page-admin .table-wrapper { max-height: 60vh; overflow: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 768px) {
    .admin-tab { padding: 7px 10px; font-size: 0.75rem; }
    .admin-action-cell { flex-direction: column; }
}

