:root {
  --bg:#f8fafc;
  --surface:#fff;
  --primary:#4338ca;
  --primary-hover:#312e81;
  --primary-soft:#eef2ff;
  --primary-border:#c7d2fe;
  --danger:#dc2626;
  --text:#0f172a;
  --muted:#64748b;
  --border:#e2e8f0;
}
* { box-sizing:border-box; margin:0; font-family:system-ui,-apple-system,sans-serif; }
body { background:var(--bg); color:var(--text); min-height:100vh; display:flex; flex-direction:column; }
header { background:var(--surface); border-bottom:1px solid var(--border); padding:12px 20px; display:flex; justify-content:space-between; align-items:center; }
.brand { color:var(--primary); font-weight:800; display:flex; align-items:center; gap:9px; }
.brand-logo { width:42px; height:42px; object-fit:contain; }
.meta { color:var(--muted); display:flex; gap:12px; font-size:.875rem; }
.pos-container { flex:1 0 auto; display:grid; grid-template-columns:1fr 400px; overflow:visible; }
.catalog-panel { padding:16px 20px; display:flex; flex-direction:column; gap:14px; }
.catalog-controls { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; align-items:start; }
.search-bar input { width:100%; padding:10px 14px; border:1px solid var(--border); border-radius:8px; }
.scan-bar { display:flex; flex-direction:column; gap:5px; }
.scan-bar input { width:100%; padding:10px 14px; border:1px solid var(--border); border-radius:8px; }
.search-bar input:focus,.scan-bar input:focus,select:focus,input:focus { outline:none; border-color:var(--primary); box-shadow:0 0 0 3px var(--primary-soft); }
.scan-status { min-height:1.2em; color:var(--muted); font-size:.8rem; }
.categories { display:flex; gap:8px; flex-wrap:wrap; }
.cat-btn { padding:6px 14px; border:1px solid var(--border); background:var(--surface); border-radius:999px; cursor:pointer; }
.cat-btn:hover:not(.active) { background:var(--primary-soft); border-color:var(--primary-border); color:var(--primary); }
.cat-btn.active { background:var(--primary); color:#fff; border-color:var(--primary); }
.catalog-toolbar,.catalog-page-size,.catalog-pagination { display:flex; align-items:center; gap:10px; }
.catalog-toolbar,.catalog-pagination { justify-content:space-between; flex-wrap:wrap; }
.catalog-toolbar { color:var(--muted); font-size:.88rem; }
.catalog-page-size select { width:auto; min-width:76px; }
.catalog-table-wrap { overflow:auto; border:1px solid var(--border); border-radius:8px; background:var(--surface); }
.catalog-table { border-collapse:collapse; width:100%; min-width:590px; font-size:.88rem; }
.catalog-table th,.catalog-table td { padding:9px 10px; border-bottom:1px solid var(--border); text-align:left; }
.catalog-table th { color:var(--muted); font-weight:650; background:#f8fafc; }
.catalog-table tr:last-child td { border-bottom:0; }
.stock-badge { display:inline-block; padding:3px 8px; border-radius:999px; background:#dcfce7; color:#166534; font-size:.8rem; font-weight:650; white-space:nowrap; }
.stock-badge.stock-low { background:#fef3c7; color:#92400e; }
.stock-badge.stock-empty { background:#fee2e2; color:#b91c1c; }
.quick-add-btn { width:32px; height:32px; border:0; border-radius:6px; background:var(--primary); color:#fff; font-size:1.15rem; font-weight:700; cursor:pointer; }
.quick-add-btn:hover:not(:disabled),.btn-pay:hover { background:var(--primary-hover); }
.quick-add-btn:disabled { background:#cbd5e1; cursor:not-allowed; }
.catalog-pagination { color:var(--muted); font-size:.85rem; }
#productPagination > div { justify-content:center; }
.catalog-pagination button { padding:6px 10px; border:1px solid var(--border); border-radius:6px; background:var(--surface); cursor:pointer; }
.catalog-pagination button:hover:not(:disabled) { border-color:var(--primary-border); background:var(--primary-soft); color:var(--primary); }
.catalog-pagination button:disabled { opacity:.5; cursor:not-allowed; }
.cart-panel { position:sticky; top:12px; align-self:start; height:calc(100vh - 112px); min-height:400px; background:var(--surface); border-left:1px solid var(--border); display:flex; flex-direction:column; padding:16px; }
.cart-header { font-weight:800; padding-bottom:10px; border-bottom:1px solid var(--border); }
.cart-items { flex:1; min-height:0; overflow-y:auto; padding:10px 0; display:flex; flex-direction:column; gap:10px; }
.cart-row { display:flex; justify-content:space-between; align-items:center; border-bottom:1px dashed var(--border); padding-bottom:8px; }
.qty-controls { display:flex; align-items:center; gap:6px; }
.qty-btn { width:24px;height:24px;border:1px solid var(--border);background:var(--bg);border-radius:4px;cursor:pointer; }
.qty-btn:hover { border-color:var(--primary-border); color:var(--primary); }
.summary { border-top:1px solid var(--border); padding-top:12px; display:flex; flex-direction:column; gap:8px; }
.summary-row { display:flex; justify-content:space-between; }
.summary-total { font-size:1.15rem; font-weight:800; }
.checkout-fields { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
select,input { width:100%; padding:8px; border:1px solid var(--border); border-radius:6px; }
.actions { display:grid; grid-template-columns:1fr 2fr; gap:8px; }
.btn { padding:11px; border:none; border-radius:8px; font-weight:700; cursor:pointer; }
.btn-clear { background:#fee2e2; color:var(--danger); }
.btn-pay { background:var(--primary); color:#fff; }
.btn-secondary { background:#e2e8f0; color:var(--text); }
.hidden { display:none !important; }
.module-nav { display:flex; gap:8px; padding:10px 20px; overflow-x:auto; background:#fff; border-bottom:1px solid var(--border); }
.module-nav button { white-space:nowrap; border:1px solid var(--border); background:#fff; padding:8px 12px; border-radius:7px; cursor:pointer; }
.module-nav button:hover:not(.active) { border-color:var(--primary-border); background:var(--primary-soft); color:var(--primary); }
.module-nav button.active { background:var(--primary); color:#fff; border-color:var(--primary); }
.module-panel { flex:1 0 auto; min-height:0; padding:20px; }
.module-panel.hidden,.pos-container.hidden { display:none; }
.module-panel h2 { margin-bottom:16px; }
.module-card { background:#fff; border:1px solid var(--border); border-radius:10px; padding:16px; margin-bottom:16px; }
.brand-logo-setting { grid-column:1/-1; display:flex; align-items:center; gap:14px; }
.brand-logo-preview { width:96px; height:96px; object-fit:contain; border:1px solid var(--border); border-radius:8px; background:#fff; }
.brand-logo-controls { flex:1; min-width:0; display:grid; gap:8px; }
.brand-logo-actions { display:flex; flex-wrap:wrap; gap:8px; }
.module-card h3 { margin-bottom:12px; font-size:1rem; }
.module-form { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:10px; align-items:end; }
.module-form label { display:grid; gap:5px; font-size:.83rem; color:var(--muted); }
.module-form button { min-height:36px; }
.table-wrap { overflow:auto; }
table { border-collapse:collapse; width:100%; min-width:520px; font-size:.88rem; }
th,td { padding:9px 10px; border-bottom:1px solid var(--border); text-align:left; }
th { color:var(--muted); font-weight:650; }
.table-actions { display:flex; gap:6px; }
.table-actions button { padding:5px 8px; border:1px solid var(--border); border-radius:5px; background:white; cursor:pointer; }
.module-message { margin:8px 0; color:var(--muted); }
.form-row { display:flex; gap:8px; align-items:end; flex-wrap:wrap; margin-top:10px; }
.form-row label { display:grid; gap:4px; font-size:.83rem; color:var(--muted); }
.summary-cards { display:grid; grid-template-columns:repeat(auto-fit,minmax(170px,1fr)); gap:12px; margin-bottom:16px; }
.summary-card { background:#fff; border:1px solid var(--border); border-radius:10px; padding:15px; }
.summary-card span { display:block; font-size:.82rem; color:var(--muted); }
.summary-card strong { display:block; margin-top:7px; font-size:1.15rem; }
.low-stock { color:var(--danger); font-weight:700; }
.inline-item { display:flex; gap:8px; align-items:center; padding:7px 0; border-bottom:1px solid var(--border); }
.inline-item span { flex:1; }
.modal { position:fixed; inset:0; background:rgba(15,23,42,.55); display:grid; place-items:center; z-index:10; }
.modal.hidden { display:none; }
.login-card { width:min(360px,calc(100vw - 32px)); background:#fff; border-radius:12px; padding:24px; display:flex; flex-direction:column; gap:12px; }
.receipt-card { width:min(420px,calc(100vw - 32px)); max-height:90vh; overflow:auto; background:#fff; border-radius:12px; padding:20px; }
.receipt-paper { color:#111; font-size:.9rem; }
.receipt-header { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px; padding:0; border:0; color:#111; text-align:center; }
.receipt-logo { max-width:64mm; max-height:24mm; object-fit:contain; margin-bottom:4px; }
.receipt-header strong { font-size:1.15rem; }
.receipt-line { display:flex; justify-content:space-between; gap:12px; padding:3px 0; }
.receipt-total { font-weight:800; font-size:1rem; }
.receipt-paper p,.receipt-paper footer { margin:5px 0; overflow-wrap:anywhere; }
.receipt-paper hr { border:0; border-top:1px dashed #64748b; margin:9px 0; }
.receipt-actions { display:flex; gap:8px; margin-top:14px; }
.error { color:var(--danger); min-height:20px; font-size:.85rem; }
@media (max-width:800px) { .pos-container { grid-template-columns:1fr; overflow:visible; } .cart-panel { position:static; height:auto; border-left:0; border-top:1px solid var(--border); min-height:450px; } }
@media (max-width:480px) { .brand-logo-setting { align-items:flex-start; flex-direction:column; } }
@media (max-width:500px) { .catalog-controls { grid-template-columns:1fr; } }
@media print {
  body * { visibility:hidden !important; }
  #receiptModal,#receiptModal * { visibility:visible !important; }
  #receiptModal { position:absolute; inset:0; display:block !important; padding:0; background:#fff; }
  .receipt-card { width:80mm; max-height:none; overflow:visible; margin:0 auto; padding:4mm; border-radius:0; }
  .receipt-actions { display:none !important; }
}
