/* ========================================
   TəhlükəSİZ POS - Ana Stil Faylı
   Müasir, sürətli, animasiyasız dizayn
======================================== */

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

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #475569;
    --success: #059669;
    --success-light: #d1fae5;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --info: #0891b2;
    --info-light: #cffafe;

    --bg: #f1f5f9;
    --bg-card: #ffffff;
    --bg-sidebar: #0f172a;
    --bg-sidebar-hover: #1e293b;
    --bg-sidebar-active: #2563eb;
    --bg-topbar: #ffffff;
    --bg-input: #ffffff;

    --text: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --text-sidebar: #cbd5e1;
    --text-sidebar-active: #ffffff;
    --text-on-primary: #ffffff;

    --border: #e2e8f0;
    --border-focus: #2563eb;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);

    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    --sidebar-width: 260px;
    --topbar-height: 60px;

    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

html {
    font-size: 14px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    overflow-x: hidden;
}

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

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

/* ============ LOGIN ============ */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 40px 32px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    margin-bottom: 16px;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    color: var(--text-light);
}

/* ============ LAYOUT ============ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 16px;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius);
    color: var(--text-sidebar);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.nav-item:hover {
    background: var(--bg-sidebar-hover);
    color: #fff;
}

.nav-item.active {
    background: var(--bg-sidebar-active);
    color: var(--text-sidebar-active);
}

.sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin-bottom: 4px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.user-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-light);
}

.logout-btn {
    color: #f87171 !important;
}
.logout-btn:hover {
    background: rgba(248,113,113,0.1) !important;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

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

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 4px;
}

.page-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
}

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Content Area */
.content-area {
    flex: 1;
    padding: 24px;
}

/* ============ COMPONENTS ============ */

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

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

.card-header h3 {
    font-size: 1rem;
    font-weight: 700;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    background: #f8fafc;
}

/* Stat Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

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

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-icon.yellow { background: var(--warning-light); color: var(--warning); }
.stat-icon.cyan { background: var(--info-light); color: var(--info); }

.stat-info h4 {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
}

.stat-sub {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 2px;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 9px 12px;
    font-size: 0.9rem;
    font-family: var(--font);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-input);
    color: var(--text);
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-group input:disabled,
.form-group select:disabled {
    background: #f1f5f9;
    cursor: not-allowed;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

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

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

.form-inline {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.form-inline .form-group {
    flex: 1;
    margin-bottom: 0;
}

.form-hint {
    font-size: 0.78rem;
    color: var(--text-light);
    margin-top: 4px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: var(--font);
    border: 1.5px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
    line-height: 1.4;
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: var(--text-on-primary);
    border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }

.btn-success {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
}
.btn-success:hover { background: #047857; border-color: #047857; color: #fff; }

.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }

.btn-warning {
    background: var(--warning);
    color: #fff;
    border-color: var(--warning);
}

.btn-secondary {
    background: #f1f5f9;
    color: var(--text);
    border-color: var(--border);
}
.btn-secondary:hover { background: #e2e8f0; }

.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}
.btn-outline:hover { background: var(--primary-light); }

.btn-sm {
    padding: 5px 12px;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
    display: flex;
}

.btn-group {
    display: flex;
    gap: 8px;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 16px;
    border: 1px solid transparent;
}

.alert-success {
    background: var(--success-light);
    color: #065f46;
    border-color: #a7f3d0;
}

.alert-error {
    background: var(--danger-light);
    color: #991b1b;
    border-color: #fecaca;
}

.alert-warning {
    background: var(--warning-light);
    color: #92400e;
    border-color: #fde68a;
}

.alert-info {
    background: var(--info-light);
    color: #155e75;
    border-color: #a5f3fc;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

thead {
    background: #f8fafc;
}

thead th {
    padding: 10px 14px;
    text-align: left;
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tbody tr:hover {
    background: #f8fafc;
}

.table-actions {
    display: flex;
    gap: 6px;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 99px;
    white-space: nowrap;
}

.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-secondary { background: #f1f5f9; color: var(--secondary); }

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.5);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

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

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    margin: 20px;
}

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

.modal-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
}

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

.modal-body {
    padding: 24px;
}

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

/* Search */
.search-box {
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 9px 12px 9px 38px;
    font-size: 0.9rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-input);
    color: var(--text);
    outline: none;
}

.search-box input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.search-box svg {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

/* Toolbar */
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.toolbar .search-box {
    flex: 1;
    min-width: 200px;
    max-width: 360px;
}

.toolbar-right {
    margin-left: auto;
    display: flex;
    gap: 8px;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 20px;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    background: var(--bg-card);
}

.pagination a:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.pagination .active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.pagination .disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* ============ POS INTERFACE ============ */
.pos-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 20px;
    height: calc(100vh - var(--topbar-height) - 48px);
}

.pos-products {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pos-search {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    align-items: center;
}

.pos-search .search-box {
    flex: 1;
}

.pos-search select {
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    background: var(--bg-input);
    color: var(--text);
    min-width: 140px;
    height: 40px;
}

.pos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 12px;
    overflow-y: auto;
    padding: 4px 2px;
    flex: 1;
    align-items: start;
}

.pos-product-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.pos-product-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.pos-product-card:active {
    transform: scale(0.97);
}

.pos-product-card.out-of-stock {
    opacity: 0.4;
    pointer-events: none;
}

.pos-product-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pos-product-barcode {
    font-size: 0.78rem;
    color: var(--text-light);
    font-family: 'Courier New', monospace;
}

.pos-product-price {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary);
    margin-top: 2px;
}

.pos-product-stock {
    font-size: 0.78rem;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.pos-product-stock::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--success);
}

.pos-product-card.low-stock .pos-product-stock::before {
    background: var(--warning);
}

.pos-product-card.out-of-stock .pos-product-stock::before {
    background: var(--danger);
}

/* POS Cart */
.pos-cart {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pos-cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.pos-cart-header h3 {
    font-size: 0.95rem;
    font-weight: 700;
}

.pos-cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

.pos-cart-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    gap: 10px;
    border-bottom: 1px solid #f1f5f9;
}

.pos-cart-item:hover {
    background: #fafbfc;
}

.pos-cart-item-info {
    flex: 1;
    min-width: 0;
}

.pos-cart-item-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pos-cart-item-price {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.pos-cart-item-qty {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pos-cart-item-qty button {
    width: 26px;
    height: 26px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
}
.pos-cart-item-qty button:hover { background: #f1f5f9; }

.pos-cart-item-qty span {
    min-width: 28px;
    text-align: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.pos-cart-item-total {
    font-size: 0.85rem;
    font-weight: 700;
    min-width: 65px;
    text-align: right;
}

.pos-cart-item-remove {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 4px;
    font-size: 1.1rem;
}

.pos-cart-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    color: var(--text-light);
    font-size: 0.9rem;
    padding: 40px;
}

.pos-cart-summary {
    padding: 16px;
    border-top: 2px solid var(--border);
    background: #f8fafc;
}

.pos-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.pos-summary-row.total {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--primary);
    margin-top: 10px;
    padding-top: 10px;
    border-top: 2px solid var(--border);
}

.pos-payment {
    padding: 12px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pos-payment-methods {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

.pos-pay-method {
    padding: 8px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    cursor: pointer;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
}

.pos-pay-method.active {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

.pos-complete-btn {
    padding: 14px;
    font-size: 1rem;
}

/* ============ WAREHOUSE ============ */
.warehouse-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.quick-receive-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

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

    .pos-cart {
        min-height: 400px;
    }

    .pos-complete-btn {
        position: sticky;
        bottom: 0;
        z-index: 5;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .content-area {
        padding: 16px;
    }

    .form-row,
    .form-row-3 {
        grid-template-columns: 1fr;
    }

    .form-inline {
        flex-direction: column;
        align-items: stretch;
    }

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

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar .search-box {
        max-width: none;
    }

    .toolbar-right {
        margin-left: 0;
    }

    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    .tab-btn {
        flex: 0 0 auto;
    }

    .quick-receive-actions {
        position: sticky;
        bottom: -20px;
        margin: 12px -20px -20px;
        padding: 10px 16px;
        border-top: 1px solid var(--border);
        background: rgba(255,255,255,0.96);
        z-index: 5;
    }

    .quick-receive-actions .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .pos-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.tab-btn:hover { color: var(--text); }

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

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-state svg {
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state h4 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.85rem;
}

/* Barcode Display */
.barcode-display {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 2px;
    background: #f8fafc;
    padding: 8px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    text-align: center;
}

/* Invoice */
.invoice {
    background: #fff;
    max-width: 700px;
    margin: 0 auto;
    padding: 20px;
    font-family: Arial, sans-serif;
    font-size: 0.85rem;
    color: #000;
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.invoice-logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.invoice-logo-icon {
    width: 44px;
    height: 44px;
    background: #1a1a2e;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 22px;
    border-radius: 4px;
}

.invoice-company-name {
    font-weight: bold;
    font-size: 17px;
    line-height: 1.15;
    text-transform: uppercase;
}

.invoice-meta {
    text-align: left;
}

.invoice-meta-row {
    margin-bottom: 3px;
    font-size: 0.85rem;
}

.invoice-meta-label {
    font-weight: bold;
    margin-right: 8px;
}

.invoice-meta-value {
    font-weight: bold;
}

.invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
}

.invoice-table th,
.invoice-table td {
    border: 1px solid #000;
    padding: 6px 10px;
    font-size: 0.82rem;
}

.invoice-table th {
    background: #e8e8e8;
    font-weight: bold;
    text-align: center;
}

.invoice-table td.center {
    text-align: center;
}

.invoice-table td.right {
    text-align: right;
}

.invoice-totals {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin: 8px 0 16px;
}

.invoice-total-row {
    display: flex;
    width: 260px;
    border: 1px solid #000;
    border-top: none;
}

.invoice-total-row:first-child {
    border-top: 1px solid #000;
}

.invoice-total-row span:first-child {
    flex: 1;
    padding: 4px 10px;
    border-right: 1px solid #000;
    font-weight: bold;
}

.invoice-total-row span:last-child {
    width: 100px;
    text-align: right;
    padding: 4px 10px;
}

.invoice-total-row.total span {
    font-weight: bold;
    font-size: 0.9rem;
}

.invoice-footer {
    margin-top: 20px;
}

.invoice-company-info {
    margin-bottom: 24px;
    line-height: 1.6;
    font-size: 0.82rem;
}

.invoice-signatures {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
}

.invoice-sign-block {
    width: 45%;
    font-size: 0.82rem;
}

.invoice-sign-line {
    border-bottom: 1px solid #000;
    margin-bottom: 8px;
    height: 30px;
}

/* Print */
@media print {
    .sidebar, .topbar, .toolbar, .btn { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .content-area { padding: 0 !important; }
    .invoice { border: none; max-width: none; padding: 0; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Filters */
.filter-row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.filter-row select {
    padding: 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    background: var(--bg-input);
    color: var(--text);
    min-width: 140px;
}

/* Low stock indicator */
.low-stock {
    color: var(--danger);
    font-weight: 700;
}

/* Grid utility */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.fw-bold { font-weight: 700; }
.text-muted { color: var(--text-secondary); }

/* QR generator */
.qr-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    height: 42px;
}

.qr-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

.qr-item {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.qr-canvas {
    width: 100%;
    min-height: 170px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: #fff;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-canvas canvas,
.qr-canvas img {
    max-width: 100%;
    height: auto;
}

.qr-label {
    font-size: 0.86rem;
    font-weight: 700;
    text-align: center;
    word-break: break-word;
}

.qr-value {
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-align: center;
    word-break: break-all;
}

.qr-actions {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.qr-print-select {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
}

.qr-print-select input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.qr-print-qty {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    font-weight: 500;
}

.print-qty-input {
    width: 48px;
    padding: 2px 4px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.78rem;
    text-align: center;
    background: var(--bg-input);
    color: var(--text);
}

.code-options[hidden] {
    display: none !important;
}

.barcode-canvas {
    min-height: 120px;
}

.barcode-canvas canvas {
    width: 100% !important;
    height: auto !important;
}

.barcode-meta {
    width: 100%;
    border-top: 1px dashed var(--border);
    padding-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.barcode-meta-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.76rem;
}

.barcode-meta-key {
    color: var(--text-secondary);
    font-weight: 600;
}

.barcode-meta-value {
    text-align: right;
    word-break: break-word;
}

/* Product Search */
.product-search-card {
    position: relative;
    z-index: 10;
    overflow: visible;
}

.product-search-card .card-body {
    overflow: visible;
}

.product-search-wrap {
    position: relative;
}

.product-search-wrap .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    pointer-events: none;
    font-size: 1rem;
}

#productSearchInput {
    padding-left: 40px !important;
    font-size: 0.92rem;
    height: 46px;
    border-radius: var(--radius-lg);
    border: 2px solid var(--border);
    background: var(--bg-card);
}

#productSearchInput:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
    outline: none;
}

.product-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--bg-card);
    border: 2px solid var(--primary);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    max-height: 300px;
    overflow-y: auto;
    display: none;
    box-shadow: var(--shadow-lg);
}

.search-item {
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

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

.search-item:hover {
    background: var(--primary-light);
}

.search-item-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
}

.search-item-extra {
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 400;
}

.search-item-code {
    font-family: 'Courier New', monospace;
    font-size: 0.78rem;
    color: var(--primary);
    white-space: nowrap;
    background: var(--primary-light);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.search-empty {
    padding: 14px 16px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: center;
}

.selected-chips {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 0;
}

.selected-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    border: 1px solid rgba(37, 99, 235, 0.2);
}

.selected-chip .chip-remove {
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    font-weight: bold;
    color: var(--primary);
    opacity: 0.6;
    margin-left: 2px;
}

.selected-chip .chip-remove:hover {
    opacity: 1;
    color: var(--danger);
}

.search-notice {
    padding: 8px 14px;
    background: var(--warning-light);
    color: var(--warning);
    border-radius: var(--radius);
    font-size: 0.82rem;
    font-weight: 500;
    margin-top: 8px;
    border: 1px solid rgba(217, 119, 6, 0.2);
}

.product-search-card .card-body {
    padding: 16px 20px;
}

.product-search-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
}

.product-search-label .label-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.product-search-count {
    margin-left: auto;
    font-size: 0.76rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg);
    padding: 2px 10px;
    border-radius: 12px;
}

@media print {
    .qr-item {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .qr-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
