:root{
	--sidebar-w: 230px;
	--topbar-h: 56px;
	--brand: #2563eb;
	--brand-dark: #1e40af;
	--surface: #ffffff;
	--bg: #f1f5f9;
	--border: #e2e8f0;
	--text-muted: #64748b;
}

body{
	background: var(--bg);
	font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 14px;
	color: #0f172a;
}

/* ---------- Shell layout ---------- */
.app-shell{
	display: grid;
	grid-template-columns: var(--sidebar-w) 1fr;
	grid-template-rows: var(--topbar-h) 1fr;
	grid-template-areas: "topbar topbar" "sidebar content";
	min-height: 100vh;
}
.topbar{
	grid-area: topbar;
	display:flex; align-items:center; gap:.75rem;
	background: var(--surface);
	border-bottom: 1px solid var(--border);
	padding: 0 1rem;
	position: sticky; top:0; z-index: 1030;
}
.topbar-brand{font-weight:700; color:#0f172a; text-decoration:none; margin-right:.5rem; white-space:nowrap;}
.topbar-brand span{color:var(--brand);}
.topbar-search{position:relative; flex:1; max-width:420px;}
.topbar-search i{position:absolute; left:10px; top:50%; transform:translateY(-50%); color:var(--text-muted);}
.topbar-search input{padding-left:30px;}
.topbar-btn{white-space:nowrap;}
.btn-icon{border:0; background:transparent; font-size:1.2rem;}

.sidebar{
	grid-area: sidebar;
	background: #0f172a;
	color:#cbd5e1;
	padding: .75rem .5rem;
	overflow-y:auto;
}
.sidebar-nav .nav-link{
	color:#cbd5e1;
	border-radius:8px;
	padding:.5rem .75rem;
	font-size:.875rem;
	margin-bottom:2px;
}
.sidebar-nav .nav-link i{width:20px; display:inline-block; text-align:center; margin-right:6px;}
.sidebar-nav .nav-link:hover{background:#1e293b; color:#fff;}
.sidebar-nav .nav-link.active{background:var(--brand); color:#fff;}
.sidebar-heading{
	text-transform:uppercase; font-size:.7rem; letter-spacing:.05em;
	color:#64748b; margin:.9rem .75rem .35rem;
}
.sidebar-backdrop{display:none;}

.app-content{
	grid-area: content;
	padding: 1.25rem;
	display:flex;
	flex-direction:column;
	min-width:0;
}
.app-footer{ margin-top:auto; padding-top:1.5rem; }

/* ---------- Shared components ---------- */
.page-header{display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:.75rem; margin-bottom:1rem;}
.page-header h1{font-size:1.25rem; font-weight:700; margin:0;}

.card{border:1px solid var(--border); border-radius:12px;}
.kpi-card{background:var(--surface); border-radius:12px; padding:1rem 1.1rem; border:1px solid var(--border);}
.kpi-card .kpi-label{font-size:.78rem; color:var(--text-muted); text-transform:uppercase; letter-spacing:.03em;}
.kpi-card .kpi-value{font-size:1.5rem; font-weight:700; margin-top:.15rem;}
.kpi-card .kpi-icon{width:38px; height:38px; border-radius:10px; display:flex; align-items:center; justify-content:center; font-size:1.1rem;}

table.dataTable thead th{white-space:nowrap; font-size:.78rem; text-transform:uppercase; letter-spacing:.02em; color:var(--text-muted);}
table.dataTable tbody td{vertical-align:middle; font-size:.875rem;}

.badge-status{font-weight:600; font-size:.72rem; padding:.35em .6em;}

.form-section-title{font-weight:700; font-size:.95rem; margin-bottom:.75rem; padding-bottom:.5rem; border-bottom:1px solid var(--border);}

/* ---------- POS (advanced full-screen layout) ---------- */
/* Full-width working screen: a top strip (sale type/tax/template/customer/
   quick-access to Holds & Quotations/Last Invoice), then a 2-column body —
   left = search box + a PERSISTENT inventory results table (always on
   screen, not a dropdown that vanishes) stacked over the cart ticket;
   right = a sticky sidebar with live stats, split-tender payment, Recent
   Bills, and the action buttons. Replaces the earlier narrow single-column
   search-first layout, which read as too sparse/empty on a full monitor. */
.pos-wrap{display:grid; grid-template-columns: 1fr 350px; grid-template-rows: auto 1fr; gap:.65rem; height: calc(100vh - var(--topbar-h) - 2.2rem); max-width:none;}
.pos-topbar{grid-column: 1 / -1; background:var(--surface); border:1px solid var(--border); border-radius:10px; padding:.6rem .75rem; display:flex; flex-wrap:wrap; align-items:center; gap:.6rem;}
.pos-topbar .divider{width:1px; align-self:stretch; background:var(--border);}
.pos-last-invoice{background:#eef2ff; border:1px solid #c7d2fe; border-radius:8px; padding:.35rem .65rem; font-size:.78rem; white-space:nowrap; cursor:pointer;}
.pos-last-invoice strong{color:var(--brand-dark);}

.pos-main{display:flex; flex-direction:column; gap:.6rem; min-width:0; min-height:0;}
.pos-scan{font-size:1.05rem; padding:.6rem .9rem;}
.pos-search-bar{flex-shrink:0;}

/* Persistent inventory table: fixed max-height, always rendered (empty-state
   row when nothing has been searched yet) — this is the "keep full screen
   ... item inventory data" panel, always visible instead of a floating list. */
.pos-inventory{background:var(--surface); border:1px solid var(--border); border-radius:10px; overflow:hidden; flex-shrink:0;}
.pos-inventory-head{background:#0f172a; color:#e2e8f0; font-size:.72rem; text-transform:uppercase; letter-spacing:.03em; padding:.45rem .75rem; display:flex; justify-content:space-between; align-items:center;}
.pos-inventory-body{max-height:230px; overflow-y:auto;}
.pos-inventory-table{font-size:.8rem; margin-bottom:0; white-space:nowrap;}
.pos-inventory-table th{font-size:.68rem; text-transform:uppercase; color:var(--text-muted); font-weight:700; background:#f8fafc; position:sticky; top:0;}
.pos-inventory-table tbody tr{cursor:pointer;}
.pos-inventory-table tbody tr:hover{background:#eff6ff;}
.pos-inventory-table td{vertical-align:middle;}
.pos-stock-pill{font-size:.68rem; font-weight:700; padding:.15em .5em; border-radius:20px;}

.pos-cart{background:var(--surface); border:1px solid var(--border); border-radius:10px; display:flex; flex-direction:column; overflow:hidden; flex:1; min-height:0;}
.pos-cart-head{background:#1e293b; color:#e2e8f0; font-size:.72rem; text-transform:uppercase; letter-spacing:.03em; padding:.45rem .75rem;}
.pos-cart-items{flex:1; overflow-y:auto; overflow-x:auto;}
.pos-cart-item{display:flex; align-items:center; gap:.5rem; padding:.55rem .75rem; border-bottom:1px solid var(--border);}
.pos-cart-item .name{font-weight:600; font-size:.85rem;}
.pos-cart-item .qty-input{width:56px;}
.pos-cart-table{font-size:.78rem; white-space:nowrap; margin-bottom:0;}
.pos-cart-table th{font-size:.68rem; text-transform:uppercase; color:var(--text-muted); font-weight:700; white-space:nowrap; position:sticky; top:0; background:#f8fafc;}
.pos-cart-table td{vertical-align:middle;}
.pos-cart-table .qty-input{width:56px;}

/* Sidebar: stats / tender / recent bills / actions, all sticky in the right column */
.pos-sidebar{display:flex; flex-direction:column; gap:.6rem; min-height:0; overflow-y:auto;}
.pos-side-card{background:var(--surface); border:1px solid var(--border); border-radius:10px; padding:.75rem;}
.pos-side-card .card-title{font-size:.72rem; text-transform:uppercase; letter-spacing:.03em; color:var(--text-muted); font-weight:700; margin-bottom:.5rem;}
.pos-stat-row{display:flex; justify-content:space-between; font-size:.82rem; padding:.15rem 0;}
.pos-net-sale{background:#0f172a; color:#fff; border-radius:8px; padding:.6rem .75rem; text-align:center; margin-top:.4rem;}
.pos-net-sale .label{font-size:.68rem; text-transform:uppercase; letter-spacing:.05em; color:#94a3b8;}
.pos-net-sale .value{font-size:1.55rem; font-weight:800; line-height:1.2;}
.pos-tender-row{display:flex; gap:.35rem; align-items:center; margin-bottom:.4rem;}
.pos-tender-row select{flex:0 0 40%;}
.pos-tender-row input{flex:1;}
.pos-balance{font-size:.85rem; font-weight:700; text-align:right; padding:.3rem .1rem;}
.pos-recent-list{max-height:150px; overflow-y:auto;}
.pos-recent-item{display:flex; justify-content:space-between; font-size:.78rem; padding:.3rem 0; border-bottom:1px dashed var(--border);}
.pos-recent-item:last-child{border-bottom:0;}
.pos-quick-list .dropdown-menu{max-height:320px; overflow-y:auto;}
#buyerFieldsPanel{background:#fffbeb; border-radius:8px;}

/* ---------- Print / Invoice ---------- */
.invoice-box{max-width:800px; margin:0 auto; background:#fff; padding:2rem;}
@media print{
	.no-print{display:none !important;}
	body{background:#fff;}
	.invoice-box{padding:0; max-width:100%;}
}
.label-sheet{display:flex; flex-wrap:wrap; gap:4mm;}
.label-item{border:1px dashed #999; padding:2mm; text-align:center; width:38mm;}

/* ---------- Responsive ---------- */
@media (max-width: 991.98px){
	.app-shell{grid-template-columns: 1fr; grid-template-areas: "topbar" "content";}
	.sidebar{
		position:fixed; top:var(--topbar-h); left:0; bottom:0; width:var(--sidebar-w);
		transform:translateX(-100%); transition:transform .2s ease; z-index:1040;
	}
	.sidebar.show{transform:translateX(0);}
	.sidebar-backdrop.show{display:block; position:fixed; inset:var(--topbar-h) 0 0 0; background:rgba(0,0,0,.4); z-index:1035;}
	.pos-wrap{height:auto; grid-template-columns: 1fr;}
	.pos-sidebar{overflow-y:visible;}
	.topbar-search{display:none;}
}
