:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-soft: #f8f9fa;
    --surface-tint: #eef2ff;
    --text: #1f2937;
    --muted: #6c757d;
    --line: #e5e9f2;
    --line-strong: #ced4da;
    --primary: #3b7ddd;
    --primary-dark: #2f64b1;
    --primary-soft: #e8f1ff;
    --danger: #dc3545;
    --success: #1cbb8c;
    --warning: #fcb92c;
    --sidebar: #222e3c;
    --sidebar-hover: #2b3949;
    --sidebar-active: #3b7ddd;
    --sidebar-text: #ced4da;
    --shadow: 0 0 2rem 0 rgba(33, 37, 41, .08);
    --shadow-soft: 0 .125rem .25rem rgba(0, 0, 0, .045);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
}
a { color: inherit; text-decoration: none; }
input, select, textarea, button { font: inherit; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 264px;
    background: var(--sidebar);
    color: var(--sidebar-text);
    padding: 18px 14px;
    z-index: 20;
    overflow-y: auto;
}
.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 4px 10px 20px;
    margin-bottom: 8px;
    overflow: hidden;
}
.brand-logo {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    max-width: 40px;
    max-height: 40px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    display: block;
}
.brand strong { display: block; color: #fff; font-size: 18px; letter-spacing: .02em; }
.brand small { display: block; color: #adb5bd; margin-top: 2px; text-transform: capitalize; }
nav { display: grid; gap: 3px; }
nav a, .nav-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 42px;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--sidebar-text);
    font-weight: 600;
    line-height: 1.2;
    text-align: left;
    cursor: pointer;
}
nav a:hover, .nav-group-toggle:hover { background: var(--sidebar-hover); color: #fff; }
nav a.active {
    background: var(--sidebar-active);
    color: #fff;
    box-shadow: 0 .25rem .875rem rgba(59, 125, 221, .24);
}
.nav-group { display: grid; gap: 3px; }
.nav-group-toggle span {
    transition: transform .16s ease;
    color: #adb5bd;
}
.nav-group.open .nav-group-toggle span { transform: rotate(180deg); }
.nav-submenu {
    display: none;
    gap: 3px;
    padding-left: 10px;
    margin: 0 0 4px 6px;
    border-left: 1px solid rgba(206, 212, 218, .18);
}
.nav-group.open .nav-submenu { display: grid; }
.nav-submenu a {
    min-height: 36px;
    padding: 8px 10px;
    font-size: 13px;
    color: #adb5bd;
}
.nav-submenu a.active {
    background: rgba(59, 125, 221, .18);
    color: #fff;
    box-shadow: none;
}

.shell {
    min-height: 100vh;
    margin-left: 264px;
    padding: 0;
}
.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 72px;
    padding: 16px 28px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-soft);
}
.content-wrap { padding: 28px; }
.topbar h1 { margin: 0; font-size: 24px; letter-spacing: 0; line-height: 1.15; font-weight: 700; }
.eyebrow {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.user-chip {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 12px;
    white-space: nowrap;
    color: #495057;
    font-weight: 700;
}
.icon-btn { display: none; }
.help-btn {
    display: inline-grid !important;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: #fff;
    color: var(--primary);
    font-weight: 800;
    font-size: 15px;
    text-decoration: none;
    flex-shrink: 0;
    transition: background .15s, color .15s;
}
.help-btn:hover { background: var(--primary); color: #fff; }

.card, .auth-card {
    background: var(--surface);
    border: 0;
    border-radius: 8px;
    box-shadow: var(--shadow);
}
.card { padding: 20px; margin-bottom: 20px; }
.card h2 { margin: 0 0 16px; font-size: 18px; letter-spacing: 0; font-weight: 700; }
.auth-card { width: min(430px, 100%); padding: 30px; }
.auth-card h1 { margin-top: 0; font-size: 28px; }

.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px; margin-bottom: 20px; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-6 { grid-column: span 6; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: span 12; }
.metric {
    position: relative;
    overflow: hidden;
    background: var(--surface);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
}
.metric::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--primary);
}
.metric:nth-child(2)::before { background: var(--success); }
.metric:nth-child(3)::before { background: #6f42c1; }
.metric:nth-child(4)::before { background: var(--warning); }
.metric:nth-child(5)::before { background: var(--danger); }
.metric small {
    color: var(--muted);
    display: block;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.metric strong { font-size: 24px; line-height: 1.1; font-weight: 800; }
.metric-info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    font-size: 13px;
    padding: 0 0 0 3px;
    vertical-align: middle;
    line-height: 1;
    opacity: .7;
    transition: opacity .15s;
}
.metric-info-btn:hover { opacity: 1; color: var(--primary); }
.metric-tooltip {
    display: none;
    position: fixed;
    z-index: 999;
    max-width: 280px;
    background: #1e293b;
    color: #f1f5f9;
    font-size: 13px;
    line-height: 1.5;
    padding: 10px 14px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,.25);
    pointer-events: none;
}
.metric-tooltip.visible { display: block; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-section {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
    background: #fbfcfe;
}
.form-section h3 {
    margin: 0 0 14px;
    font-size: 15px;
    color: #253044;
}
.field { display: grid; gap: 7px; }
.field label { font-size: 13px; color: #495057; font-weight: 700; }
.field.full { grid-column: 1 / -1; }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    padding: 10px 12px;
    background: #fff;
    color: var(--text);
    min-height: 40px;
    outline: none;
    transition: border-color .16s ease, box-shadow .16s ease;
}
input:focus, select:focus, textarea:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 .2rem rgba(59, 125, 221, .16);
}
textarea { min-height: 90px; resize: vertical; }
.price-stack { display: grid; gap: 4px; min-width: 260px; }
.price-stack span:first-child { color: #6c757d; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.btn {
    border: 1px solid transparent;
    background: var(--primary);
    color: #fff;
    border-radius: 6px;
    padding: 9px 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    font-weight: 700;
    transition: background .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.btn:hover { background: var(--primary-dark); box-shadow: 0 .25rem .875rem rgba(59, 125, 221, .2); }
.btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn.secondary { background: #fff; color: #495057; border-color: var(--line-strong); box-shadow: none; }
.btn.secondary:hover { background: var(--surface-soft); color: var(--primary); }
.btn.danger { background: var(--danger); }
.btn.success { background: var(--success); }
.btn.warning { background: var(--warning); color: #212529; }

/* Filter tabs (pill style, inline in forms) */
.filter-tabs { display:inline-flex; border:1px solid var(--line-strong); border-radius:6px; overflow:hidden; flex-shrink:0; }
.filter-tab { padding:6px 14px; font-size:13px; font-weight:500; text-decoration:none; color:var(--muted); background:#fff; transition:background .15s,color .15s; }
.filter-tab:hover { background:var(--surface-soft); color:var(--text); }
.filter-tab.active { background:var(--primary); color:#fff; }
.filter-tab + .filter-tab { border-left:1px solid var(--line-strong); }

/* Active toggle switch */
.active-toggle { display:inline-flex; align-items:center; gap:6px; cursor:pointer; user-select:none; text-decoration:none; color:inherit; }
.active-toggle input { display:none; }
.active-toggle-track {
    position:relative; width:36px; height:20px;
    background:var(--danger); border-radius:10px;
    transition:background .2s;
    flex-shrink:0;
}
.active-toggle-track::after {
    content:''; position:absolute; top:3px; left:3px;
    width:14px; height:14px; border-radius:50%; background:#fff;
    transition:transform .2s;
}
.active-toggle input:checked ~ .active-toggle-track { background:var(--success); }
.active-toggle input:checked ~ .active-toggle-track::after { transform:translateX(16px); }
.active-toggle-label { font-size:12px; color:var(--muted); min-width:52px; }

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}
table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 760px; }
th, td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}
th {
    position: sticky;
    top: 0;
    background: #f8f9fa;
    font-size: 12px;
    color: #6c757d;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}
tbody tr:hover td { background: #f8fbff; }
tr:last-child td { border-bottom: 0; }
.muted { color: var(--muted); }
.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 999px;
    padding: 3px 9px;
    font-size: 12px;
    font-weight: 800;
    background: var(--primary-soft);
    color: var(--primary-dark);
}
.badge.danger { background: #f8d7da; color: #842029; }
.badge.success { background: #d1e7dd; color: #0f5132; }

.alert {
    margin: 0 28px 18px;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid #b6d4fe;
    background: #e7f1ff;
    color: #084298;
    box-shadow: var(--shadow-soft);
}
.alert.error { background: #f8d7da; color: #842029; border-color: #f5c2c7; }
.alert.success { background: #d1e7dd; color: #0f5132; border-color: #badbcc; }
.alert.info { background: #cff4fc; color: #055160; border-color: #b6effb; }

/* Tabs */
.tabs { display: flex; gap: 2px; margin-bottom: 16px; border-bottom: 2px solid var(--line); }
.tab { padding: 10px 20px; text-decoration: none; color: var(--muted); font-weight: 500; border-radius: 6px 6px 0 0; transition: background .15s, color .15s; }
.tab:hover { background: var(--bg); color: var(--text); }
.tab.active { background: #fff; color: var(--accent); border: 2px solid var(--line); border-bottom: 2px solid #fff; margin-bottom: -2px; }

.pagination { display: flex; gap: 4px; margin-top: 14px; flex-wrap: wrap; align-items: center; }
.pagination a,
.pagination span {
    display: grid;
    place-items: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: #fff;
    color: #495057;
    font-weight: 700;
    font-size: 13px;
    white-space: nowrap;
}
.pagination span.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination span.pgn-disabled { color: #bbb; background: var(--surface-soft); cursor: default; }
.pagination span.pgn-ellipsis { border: 0; background: transparent; min-width: 20px; letter-spacing: .05em; }

/* ── POS v2 layout ── */
.pos2-wrap { display: block; }

.pos2-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 16px;
    align-items: start;
}
.pos2-left { display: flex; flex-direction: column; gap: 12px; }

/* Search bar */
.pos2-search-form {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 12px 16px;
}
.pos2-search-input {
    flex: 1;
    font-size: 16px !important;
    padding: 10px 14px !important;
    border-radius: 8px;
    border: 2px solid var(--primary);
    outline: none;
    background: #fff;
}
.pos2-search-input:focus { box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.pos2-search-btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s;
}
.pos2-search-btn:hover { background: var(--primary-dark, #4f46e5); }

/* Hasil produk */
.pos2-product-results { padding: 0; }
.pos2-product-results .pos-product-card { padding: 14px 16px; }
.pos2-product-results .pagination { padding: 0 16px 14px; margin-top: 8px; }

/* Keranjang */
.pos2-cart-card { padding: 0; overflow: hidden; }
.pos2-cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-soft);
}
.pos2-cart-title { font-size: 15px; font-weight: 700; color: var(--text); }
.pos2-faktur-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #dc2626;
    color: #fff;
    border-radius: 6px;
    padding: 4px 12px;
}
.pos2-faktur-label { font-size: 10px; font-weight: 700; letter-spacing: .07em; opacity: .85; text-transform: uppercase; }
.pos2-faktur-no { font-size: 14px; font-weight: 800; letter-spacing: .03em; }
.pos2-cart-empty { text-align: center; padding: 28px; color: var(--muted); font-size: 14px; }

.pos2-cart-table { width: 100%; border-collapse: collapse; }
.pos2-cart-table thead tr { background: #1e3a5f; }
.pos2-cart-table thead th { color: #fff !important; background: #1e3a5f !important; font-weight: 700; padding: 9px 12px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.pos2-cart-row td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.pos2-cart-row:last-child td { border-bottom: 0; }
.pos2-cart-name { font-size: 14px; font-weight: 700; }
.pos2-cart-meta { display: flex; align-items: center; gap: 8px; margin-top: 3px; flex-wrap: wrap; }
.pos2-cart-stock { font-size: 11px; color: var(--success, #16a34a); font-weight: 600; }
.pos2-cart-stock-low { color: var(--danger, #dc2626); }
.pos2-cart-barcode { font-size: 11px; color: var(--muted); }
.pos2-cart-price { font-size: 11px; color: var(--muted); margin-top: 2px; }
.pos2-qty-form { display: flex; justify-content: center; }
.pos2-qty-input { width: 60px !important; text-align: center; font-size: 15px !important; padding: 4px 6px !important; }
.pos2-remove-btn { font-size: 20px; font-weight: 900; color: var(--danger); line-height: 1; text-decoration: none; display: block; text-align: center; }
.pos2-cart-total-row td { padding: 10px 12px; background: #f0f4ff; border-top: 2px solid #c7d2fe; }

/* Panel bayar kanan */
.pos2-pay-panel {
    position: sticky;
    top: 80px;
    background: #1e293b;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 6px 32px rgba(0,0,0,.18);
}
.pos2-total-banner {
    background: linear-gradient(135deg, #1d4ed8, #4f46e5);
    color: #fff;
    padding: 20px 20px 16px;
    text-align: center;
}
.pos2-total-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    opacity: .75;
    margin-bottom: 4px;
}
.pos2-total-amount {
    font-size: 32px;
    font-weight: 900;
    letter-spacing: .01em;
    line-height: 1.1;
}
.pos2-pay-form { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.pos2-pay-field { display: flex; flex-direction: column; gap: 4px; }
.pos2-pay-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #94a3b8;
}
.pos2-pay-optional { font-weight: 400; text-transform: none; letter-spacing: 0; }
.pos2-pay-input {
    width: 100%;
    font-size: 18px !important;
    padding: 8px 12px !important;
    border-radius: 8px;
    border: 1.5px solid #334155;
    background: #0f172a;
    color: #f1f5f9;
    box-sizing: border-box;
    transition: border-color .15s;
}
.pos2-pay-input::placeholder { color: #475569; }
.pos2-pay-input:focus { outline: none; border-color: #6366f1; background: #1e293b; }
.pos2-change-input { color: #4ade80 !important; font-weight: 700; }
.pos2-pay-select {
    width: 100%;
    font-size: 15px !important;
    padding: 8px 12px !important;
    border-radius: 8px;
    border: 1.5px solid #334155;
    background: #0f172a;
    color: #f1f5f9;
    box-sizing: border-box;
}
.pos2-pay-select option { background: #1e293b; }
.pos2-save-btn {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 14px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    background: #16a34a;
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background .15s, transform .1s;
}
.pos2-save-btn:hover:not(:disabled) { background: #15803d; transform: translateY(-1px); }
.pos2-save-btn:active:not(:disabled) { transform: translateY(0); }
.pos2-save-btn:disabled { background: #334155; color: #64748b; cursor: not-allowed; }
.pos2-clear-btn {
    display: block;
    text-align: center;
    margin: 0 16px 16px;
    padding: 10px;
    color: #f87171;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    border: 1.5px solid #7f1d1d55;
    border-radius: 8px;
    background: rgba(239,68,68,.08);
    transition: background .15s, color .15s;
}
.pos2-clear-btn:hover { background: rgba(239,68,68,.18); color: #fca5a5; }

.pos-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 20px;
    align-items: start;
}
.cart-panel {
    position: sticky;
    top: 92px;
    border-top: 4px solid var(--primary);
}
.cart-panel h2 { margin-bottom: 6px; }
.cart-line {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid var(--line);
}
.cart-line:last-of-type {
    margin-top: 4px;
    padding: 13px 0;
    color: var(--primary);
}
.cart-panel form > .cart-line strong:last-child { font-size: 22px; }
.cart-qty-form {
    display: flex;
    align-items: center;
    margin: 5px 0 3px;
}
.cart-qty-input {
    width: 60px !important;
    min-height: 28px !important;
    padding: 3px 6px !important;
    font-size: 13px;
    text-align: center;
}

/* POS product card list */
.pos-product-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.pos-product-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 4px;
    border-bottom: 1px solid var(--line);
}
.pos-product-card:last-child { border-bottom: 0; }
.pos-product-info {
    flex: 1;
    min-width: 0;
}
.pos-product-name {
    font-weight: 700;
    font-size: 14px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pos-product-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 3px 0 5px;
    font-size: 12px;
    flex-wrap: wrap;
}
.pos-product-prices {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.pos-price-chip {
    font-size: 12px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: 2px 7px;
    white-space: nowrap;
}
.pos-price-chip strong { font-size: 12px; }
.pos-price-chip { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; white-space: normal; }
.pos-barcode-tag {
    font-size: 10px;
    color: var(--muted);
    font-family: monospace;
    letter-spacing: .03em;
}
.pos-product-action {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
    width: 180px;
}
.pos-product-action select {
    width: 100%;
    font-size: 13px;
}
.pos-qty-row {
    display: flex;
    gap: 6px;
}
.pos-qty-row input[type=number] {
    width: 56px;
    flex-shrink: 0;
    font-size: 13px;
}
.pos-qty-row .btn {
    flex: 1;
    font-size: 13px;
    padding: 7px 8px;
    white-space: nowrap;
}
.receipt {
    width: 280px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 13px;
    line-height: 1.5;
    color: #111;
    background: #fff;
    padding: 14px 14px 32px;
}
.receipt h3 { font-size: 15px; }
.receipt table { min-width: 0; font-size: 13px; width: 100%; }
.receipt th, .receipt td { padding: 4px 0; border: 0; }

input.barcode-check[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--primary);
}
.barcode-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.barcode-label {
    border: 1px dashed #94a3b8;
    background: #fff;
    padding: 10px;
    text-align: center;
    break-inside: avoid;
}
.barcode-label svg { width: 100%; height: 70px; display: block; }

@media (max-width: 980px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
    body.menu-open .sidebar { transform: translateX(0); }
    .shell { margin-left: 0; }
    .content-wrap { padding: 16px; }
    .topbar { padding: 14px 16px; align-items: flex-start; }
    .icon-btn {
        display: inline-grid;
        place-items: center;
        width: 40px;
        height: 40px;
        border: 1px solid var(--line);
        border-radius: 6px;
        background: #fff;
        color: var(--text);
    }
    .grid, .form-grid, .pos-layout, .pos2-layout { grid-template-columns: 1fr; }
    .pos2-pay-panel { position: static; }
    .span-3, .span-4, .span-6, .span-8, .span-12 { grid-column: span 1; }
    .cart-panel { position: static; }
    .user-chip { display: none; }
    .topbar h1 { font-size: 22px; }
    .alert { margin: 0 16px 16px; }

    body[data-page="pos"] .pos-layout { gap: 12px; }
}

@media (max-width: 640px) {
    .content-wrap { padding: 12px; }
    .card { padding: 14px; margin-bottom: 12px; }
    .actions .btn { width: 100%; }
    table { min-width: 650px; }
    .metric strong { font-size: 20px; }

    .pos-product-card { flex-wrap: wrap; }
    .pos-product-action { width: 100%; }
    .pos-qty-row .btn { min-height: 42px; }

    body[data-page="pos"] .cart-line { align-items: flex-start; gap: 10px; }
    body[data-page="pos"] .cart-line a { color: var(--danger); font-weight: 800; white-space: nowrap; }
    body[data-page="pos"] .cart-panel form { display: grid; gap: 10px; }
    body[data-page="pos"] .cart-panel .actions { display: grid; grid-template-columns: 1fr; gap: 8px; }
}

/* ── Category combobox ─────────────────────────────────────────────────── */
.cat-combo { position: relative; }
.cat-combo input[type="text"] { padding-right: 32px; }
.cat-combo::after {
    content: '▾';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--muted);
    font-size: 13px;
}
.cat-list {
    display: none;
    position: absolute;
    z-index: 200;
    left: 0; right: 0;
    top: calc(100% + 4px);
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,.10);
    max-height: 220px;
    overflow-y: auto;
    margin: 0;
    padding: 4px 0;
    list-style: none;
}
.cat-list li {
    padding: 9px 14px;
    cursor: pointer;
    font-size: 14px;
    border-radius: 4px;
    transition: background .1s;
}
.cat-list li:hover,
.cat-list li.active { background: var(--surface-tint); color: var(--primary); }

@page {
    size: 58mm auto;
    margin: 0 0 8mm 0;
}

@media print {
    body { background: #fff; }
    .sidebar, .topbar, .no-print, .alert { display: none !important; }
    .shell { margin: 0; padding: 0; }
    .content-wrap { padding: 0; }
    .card { box-shadow: none; border: 0; padding: 0; margin: 0; }
    .print-only { display: block !important; }
    .receipt {
        width: 100%;
        font-size: 13px;
        padding-bottom: 10mm;
    }
}
