/* ===== Professional Shop Management System — Emerald theme ===== */
:root {
  --em-50: #ecfdf5; --em-100: #d1fae5; --em-200: #a7f3d0; --em-400: #34d399; --em-500: #10b981; --em-600: #059669; --em-700: #047857; --em-800: #065f46; --em-900: #064e3b;
  --side-bg: #0f1a17; --side-bg2: #13231f; --side-text: #a7b8b2; --side-active: #10b981;
  --ink: #0f172a; --muted: #64748b; --line: #e7ecea; --bg: #f4f7f6; --card: #ffffff;
  --radius: 14px; --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .05);
  --bs-primary: #059669; --bs-primary-rgb: 5, 150, 105; --bs-success: #059669; --bs-success-rgb: 5, 150, 105;
  --bs-link-color: #047857; --bs-link-hover-color: #065f46; --bs-body-font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --sidebar-w: 260px;
}
html, body { background: var(--bg); color: var(--ink); }
body { font-size: .9rem; -webkit-font-smoothing: antialiased; }
a { color: var(--em-700); }
.btn-success { --bs-btn-bg: var(--em-600); --bs-btn-border-color: var(--em-600); --bs-btn-hover-bg: var(--em-700); --bs-btn-hover-border-color: var(--em-700); --bs-btn-active-bg: var(--em-800); --bs-btn-disabled-bg: var(--em-400); --bs-btn-disabled-border-color: var(--em-400); }
.btn-outline-success { --bs-btn-color: var(--em-700); --bs-btn-border-color: var(--em-500); --bs-btn-hover-bg: var(--em-600); --bs-btn-hover-border-color: var(--em-600); --bs-btn-active-bg: var(--em-700); }
.btn-primary { --bs-btn-bg: var(--em-600); --bs-btn-border-color: var(--em-600); --bs-btn-hover-bg: var(--em-700); --bs-btn-hover-border-color: var(--em-700); }
.text-bg-success, .bg-success { background-color: var(--em-600) !important; }
.text-success { color: var(--em-700) !important; }
.form-control:focus, .form-select:focus { border-color: var(--em-400); box-shadow: 0 0 0 .2rem rgba(16, 185, 129, .18); }
.form-check-input:checked { background-color: var(--em-600); border-color: var(--em-600); }
.page-link { color: var(--em-700); } .active > .page-link { background: var(--em-600); border-color: var(--em-600); }
.nav-pills .nav-link.active { background: var(--em-600); }
.nav-tabs .nav-link.active { color: var(--em-700); font-weight: 600; }
.form-label { font-weight: 500; color: #334155; margin-bottom: .3rem; font-size: .85rem; }

/* ===== Layout ===== */
.app-wrap { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: linear-gradient(180deg, var(--side-bg), var(--side-bg2)); color: var(--side-text); position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 1040; transition: transform .25s ease; }
.sidebar-brand { display: flex; align-items: center; gap: .7rem; padding: 1.1rem 1.1rem; border-bottom: 1px solid rgba(255,255,255,.06); }
.brand-logo { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; background: #fff; }
.brand-name { color: #fff; font-weight: 700; line-height: 1.1; font-size: .98rem; }
.brand-sub { font-size: .72rem; color: var(--em-400); letter-spacing: .04em; text-transform: uppercase; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: .6rem .6rem 1rem; scrollbar-width: thin; scrollbar-color: #2a3b36 transparent; }
.sidebar-nav .nav-group { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #5f7770; padding: 1rem .75rem .35rem; font-weight: 600; }
.sidebar-nav .nav-link { display: flex; align-items: center; gap: .7rem; padding: .52rem .75rem; color: var(--side-text); border-radius: 9px; font-size: .86rem; margin-bottom: 1px; }
.sidebar-nav .nav-link i { font-size: 1.05rem; width: 1.2rem; text-align: center; opacity: .9; }
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,.05); color: #fff; }
.sidebar-nav .nav-link.active { background: linear-gradient(90deg, rgba(16,185,129,.22), rgba(16,185,129,.08)); color: #fff; box-shadow: inset 3px 0 0 var(--side-active); }
.sidebar-nav .nav-link.active i { color: var(--em-400); }
.sidebar-foot { padding: .7rem 1.1rem; border-top: 1px solid rgba(255,255,255,.06); color: #5f7770; }
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 1020; height: 62px; display: flex; align-items: center; gap: .8rem; padding: 0 1.25rem; background: rgba(255,255,255,.9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar-title { font-weight: 600; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-search { position: relative; align-items: center; margin-left: 1rem; }
.topbar-search i { position: absolute; left: .7rem; color: var(--muted); }
.topbar-search input { padding-left: 2rem; width: 280px; border-radius: 20px; background: var(--bg); border-color: transparent; }
.btn-icon { border: 0; background: transparent; padding: .35rem .5rem; border-radius: 8px; color: var(--ink); }
.btn-icon:hover { background: var(--bg); }
.btn-user { border: 0; background: transparent; display: flex; align-items: center; gap: .5rem; font-weight: 500; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--em-500), var(--em-700)); color: #fff; font-weight: 700; font-size: .9rem; }
.content { padding: 1.25rem; flex: 1; }
.sidebar-backdrop { display: none; }
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  body.sidebar-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.35); }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 1035; }
  .main { margin-left: 0; }
  .content { padding: .9rem .75rem; }
  .topbar { padding: 0 .6rem; }
}

/* ===== Page head & cards ===== */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.page-title { font-size: 1.35rem; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.page-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header { background: #fff; border-bottom: 1px solid var(--line); font-weight: 600; padding: .85rem 1rem; border-radius: var(--radius) var(--radius) 0 0 !important; }
.card-header .card-title { margin: 0; font-size: .98rem; }
.stat-card { position: relative; padding: 1rem 1.1rem; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); height: 100%; overflow: hidden; }
.stat-card .stat-label { color: var(--muted); font-size: .78rem; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.stat-card .stat-value { font-size: 1.45rem; font-weight: 700; margin-top: .2rem; letter-spacing: -.02em; }
.stat-card .stat-sub { font-size: .78rem; color: var(--muted); }
.stat-card .stat-icon { position: absolute; right: 1rem; top: 1rem; width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; }
.stat-card.hero { background: linear-gradient(135deg, var(--em-600), var(--em-800)); color: #fff; border: 0; }
.stat-card.hero .stat-label, .stat-card.hero .stat-sub { color: rgba(255,255,255,.8); }
.stat-card.hero .stat-icon { background: rgba(255,255,255,.18); color: #fff; }
.ic-green { background: var(--em-50); color: var(--em-700); } .ic-blue { background: #eff6ff; color: #1d4ed8; } .ic-amber { background: #fffbeb; color: #b45309; }
.ic-red { background: #fef2f2; color: #b91c1c; } .ic-violet { background: #f5f3ff; color: #6d28d9; } .ic-slate { background: #f1f5f9; color: #334155; } .ic-teal { background: #f0fdfa; color: #0f766e; }

/* ===== Tables ===== */
.table { --bs-table-hover-bg: #f6faf8; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .6rem .75rem; border-color: var(--line); vertical-align: middle; }
.table thead th { background: #f8faf9; color: #475569; font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; border-bottom-width: 1px; }
.table-card { overflow: hidden; }
.table-responsive { border-radius: 0 0 var(--radius) var(--radius); }
.table tfoot td, .table tfoot th { background: #f8faf9; font-weight: 700; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; }
.filter-bar { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem; margin-bottom: 1rem; }
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty-state i { font-size: 2.4rem; display: block; margin-bottom: .5rem; opacity: .5; }
.prod-thumb { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; background: var(--bg); border: 1px solid var(--line); }
.prod-thumb-ph { width: 42px; height: 42px; border-radius: 8px; background: var(--em-50); color: var(--em-600); display: inline-flex; align-items: center; justify-content: center; }
.badge { font-weight: 600; }
.dropdown-menu { border-radius: 12px; border-color: var(--line); }
.modal-content { border-radius: 16px; border: 0; }
.modal-header { border-bottom-color: var(--line); }
.modal-footer { border-top-color: var(--line); }

/* ===== POS / document entry ===== */
.pos-head .form-control, .pos-head .form-select { font-size: .88rem; }
.pos-grid { border: 1px solid var(--line); border-radius: 12px; overflow: auto; background: #fff; max-height: 52vh; min-height: 220px; }
.pos-grid table { min-width: 860px; }
.pos-grid thead th { position: sticky; top: 0; z-index: 2; }
.pos-grid td input { min-width: 70px; text-align: right; padding: .25rem .4rem; font-size: .88rem; }
.pos-grid td.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8rem; }
.pos-grid tr.flash td { animation: flashRow 1s ease; }
@keyframes flashRow { from { background: var(--em-100); } to { background: transparent; } }
.pos-search { position: relative; }
.pos-search .form-control { padding-left: 2.6rem; height: 48px; font-size: 1rem; border-radius: 12px; border: 2px solid var(--em-200); }
.pos-search .form-control:focus { border-color: var(--em-500); }
.pos-search > i { position: absolute; left: .95rem; top: 50%; transform: translateY(-50%); font-size: 1.15rem; color: var(--em-600); z-index: 3; }
.ac-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(15,23,42,.14); z-index: 1060; max-height: 380px; overflow-y: auto; display: none; }
.ac-list.show { display: block; }
.ac-item { padding: .55rem .8rem; cursor: pointer; display: flex; justify-content: space-between; gap: .75rem; border-bottom: 1px solid #f1f5f4; }
.ac-item:last-child { border-bottom: 0; }
.ac-item.active, .ac-item:hover { background: var(--em-50); }
.ac-item .ac-main { min-width: 0; }
.ac-item .ac-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-item .ac-meta { font-size: .76rem; color: var(--muted); }
.ac-item .ac-price { text-align: right; white-space: nowrap; font-weight: 600; }
.summary-box { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.summary-row { display: flex; justify-content: space-between; align-items: center; padding: .32rem 0; font-size: .92rem; }
.summary-row .v { font-variant-numeric: tabular-nums; font-weight: 600; }
.summary-row.total { border-top: 2px dashed var(--line); margin-top: .35rem; padding-top: .6rem; font-size: 1.25rem; font-weight: 700; color: var(--em-800); }
.balance-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.balance-strip > div { background: var(--bg); border-radius: 10px; padding: .55rem .7rem; }
.balance-strip .lbl { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.balance-strip .val { font-weight: 700; font-variant-numeric: tabular-nums; }
.last-price { font-size: .72rem; color: #b45309; display: block; }
.cust-card { background: var(--em-50); border: 1px solid var(--em-100); border-radius: 12px; padding: .6rem .8rem; font-size: .83rem; }
.kbd-hint { font-size: .72rem; color: var(--muted); }
.kbd-hint kbd { background: #e2e8f0; color: #334155; padding: .05rem .35rem; font-size: .7rem; }

/* ===== Login ===== */
.login-page { background: #fff; }
.login-shell { display: flex; min-height: 100vh; }
.login-art { flex: 1.1; background: radial-gradient(circle at 20% 20%, #10b98155, transparent 40%), linear-gradient(135deg, #064e3b, #0f1a17); color: #fff; align-items: center; justify-content: center; padding: 3rem; }
.login-art > div { max-width: 460px; }
.login-logo { width: 72px; height: 72px; border-radius: 18px; background: #fff; object-fit: cover; }
.login-form-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem; }
.login-card { width: 100%; max-width: 400px; }

/* ===== Misc ===== */
.ledger-dr { color: #b91c1c; } .ledger-cr { color: var(--em-700); }
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .6rem; border-radius: 20px; background: var(--bg); font-size: .78rem; }
.perm-group { border: 1px solid var(--line); border-radius: 12px; padding: .75rem 1rem; height: 100%; }
.perm-group h6 { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--em-700); }
.list-recent .item { display: flex; justify-content: space-between; align-items: center; padding: .6rem 1rem; border-bottom: 1px solid var(--line); }
.list-recent .item:last-child { border-bottom: 0; }
.img-preview { max-width: 160px; max-height: 160px; border-radius: 12px; border: 1px solid var(--line); object-fit: cover; }
.settings-nav .nav-link { color: #334155; border-radius: 8px; }
.settings-nav .nav-link.active { background: var(--em-50); color: var(--em-800); font-weight: 600; }
.cursor-pointer { cursor: pointer; }
.w-qty { width: 90px; } .w-money { width: 120px; }
@media print {
  .sidebar, .topbar, .page-actions, .filter-bar, .no-print, .btn, .pagination, .toast-container { display: none !important; }
  .main { margin: 0 !important; } .content { padding: 0 !important; }
  .card { box-shadow: none !important; border: 0 !important; }
  body { background: #fff !important; font-size: 11px; }
  .print-only { display: block !important; }
  a { color: inherit !important; text-decoration: none !important; }
}
.print-only { display: none; }

/* client-side PDF export: same visibility as printing */
.pdf-exporting #reportDoc .no-print, .pdf-exporting #statement .no-print, .pdf-exporting [id] .no-print { display: none !important; }
.pdf-exporting .print-only { display: block !important; }

/* ===== Sales Entry (POS): classic desktop form, like the shop's old software ===== */
:root { --pc-bg1: #e3f8ee; --pc-bg2: #7fd8b0; --pc-line: #7b8a84; --pc-ink: #111; }
/* the menu slides in from the hamburger on this screen so the form gets the full width */
body.pos-page .sidebar { transform: translateX(-100%); }
body.pos-page.sidebar-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.35); }
body.pos-page.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 1035; }
body.pos-page .main { margin-left: 0; }
body.pos-page .topbar [data-toggle-sidebar] { display: inline-flex !important; }
body.pos-page .content { padding: .5rem .6rem; }
body.pos-page .topbar { height: 46px; }
@media (min-width: 992px) { .pos-classic .pc-window { height: calc(100vh - 62px); min-height: 590px; } }
.pos-classic { font-family: Tahoma, "Segoe UI", Verdana, Arial, sans-serif; color: var(--pc-ink); font-size: 12.5px; }
.pos-classic .pc-window { border: 1px solid #5d7a6e; box-shadow: 0 3px 14px rgba(0,0,0,.18); background: linear-gradient(180deg, var(--pc-bg1) 0%, #bfeedb 55%, var(--pc-bg2) 100%); display: flex; flex-direction: column; }
.pc-title { display: flex; align-items: center; gap: 10px; height: 26px; padding: 0 0 0 6px; background: linear-gradient(180deg, #ffffff 0%, #d9f2e6 100%); border-bottom: 1px solid #9db8ad; font-size: 12.5px; }
.pc-title .pc-ttl { display: flex; align-items: center; gap: 6px; font-weight: 400; }
.pc-title .pc-ttl i { color: #047857; }
.pc-title .kbd-hint { margin-left: auto; margin-right: -2px; color: #4b635a; font-size: 11px; }
.pc-title .pc-x { margin-left: auto; width: 44px; height: 20px; display: flex; align-items: center; justify-content: center; background: linear-gradient(180deg, #e8806f, #c4392b); color: #fff; border: 1px solid #8f2a20; border-radius: 3px; margin-right: 4px; font-size: 12px; }
.pc-title .pc-x:hover { background: #d9301e; color: #fff; }
.pc-body { display: flex; flex: 1 1 auto; min-height: 0; }
.pc-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; padding: 8px 10px 8px 10px; }
.pos-classic label { font-weight: 700; font-size: 12.5px; margin: 0; white-space: nowrap; color: var(--pc-ink); }
/* plain bordered boxes */
.pc-box { background: #fff; border: 1px solid var(--pc-line); border-radius: 0; min-height: 26px; }
.pc-in { font: inherit; font-size: 12.5px; color: var(--pc-ink); padding: 2px 5px; outline: none; width: 100%; min-width: 0; }
.pc-in.pc-box:focus, .pc-box .pc-in:focus { box-shadow: inset 0 0 0 1px #059669; }
.pc-box > .pc-in { border: 0; background: transparent; }
.pc-sel { appearance: auto; padding: 1px 2px; height: 26px; }
.pc-r { text-align: right; }
.pc-out { display: flex; align-items: center; justify-content: flex-start; padding: 2px 4px; font-variant-numeric: tabular-nums; overflow: hidden; white-space: nowrap; }
.pc-in[readonly] { background: #fff; }
/* header: three columns like the old screen */
.pc-head { display: grid; grid-template-columns: minmax(0, 44%) minmax(0, 25%) minmax(0, 1fr); gap: 0 26px; }
.pc-f { display: flex; align-items: center; gap: 6px; margin-bottom: 7px; }
.pc-left .pc-f > label { flex: 0 0 82px; }
.pc-mid .pc-f > label { flex: 0 0 108px; }
.pc-right .pc-f > label { flex: 0 0 auto; margin-left: auto; }
.pc-right .pc-f > .pc-box { flex: 0 0 52%; }
.pc-cust { display: flex; flex: 1 1 auto; align-items: stretch; }
.pc-cust .pc-in { flex: 1 1 auto; text-transform: none; }
.pc-mini { border: 0; border-left: 1px solid #d6dfdb; background: #f4f8f6; padding: 0 7px; color: #047857; }
.pc-mini:hover { background: #dff5ea; }
.pc-f-addr { align-items: flex-start; }
.pc-addr { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 46px; }
.pc-addr .pc-in { height: 22px; }
.pc-contact { display: flex; gap: 22px; padding: 1px 5px 3px; font-weight: 700; font-size: 12px; }
.pc-contact b { font-weight: 400; margin-left: 3px; }
.pc-f-two .pc-box { flex: 1 1 0; }
.pc-f-two .pc-l2 { margin: 0 6px 0 22px; }
.pc-f > .pc-box, .pc-f > .pc-in { flex: 1 1 auto; }
.pc-mid .pc-billno { flex: 0 0 96px; text-align: center; }
.pc-mid .pc-date { flex: 0 0 140px; }
.pc-mid .pc-billtype { flex: 0 0 96px; font-weight: 700; }
.pc-rowbtns { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; margin-top: 8px; }
/* buttons with round icons */
.pc-btn { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 96px; height: 42px; padding: 0 6px 0 9px; background: linear-gradient(180deg, #ffffff 0%, #f1f4f3 100%); border: 1px solid #8a9690; border-radius: 2px; color: #1b1b1b; font-weight: 700; font-size: 13px; text-decoration: none; box-shadow: 1px 1px 0 rgba(0,0,0,.12); }
.pc-btn:hover { background: #fff; border-color: #059669; color: #111; }
.pc-btn:active { box-shadow: inset 1px 1px 2px rgba(0,0,0,.2); }
.pc-btn.pc-sm { width: 100px; height: 36px; }
/* round glossy icons (drawn with CSS, no images) */
.pc-ic { position: relative; width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; color: #fff; border: 1px solid rgba(0,0,0,.35); box-shadow: 0 1px 2px rgba(0,0,0,.35), inset 0 -3px 5px rgba(0,0,0,.18); overflow: hidden; }
.pc-ic::before { content: ""; position: absolute; left: 14%; right: 14%; top: 4%; height: 44%; border-radius: 50%; background: linear-gradient(180deg, rgba(255,255,255,.9), rgba(255,255,255,0)); pointer-events: none; }
.pc-ic i { position: relative; z-index: 1; text-shadow: 0 1px 1px rgba(0,0,0,.35); line-height: 1; }
.pc-ic-white { background: radial-gradient(circle at 50% 70%, #ffffff 0%, #e4e4e4 55%, #a9a9a9 100%); border-color: #8c8c8c; }
.pc-ic-green { background: radial-gradient(circle at 50% 75%, #b8f27a 0%, #5cc22a 50%, #2b7a0b 100%); border-color: #2b6b10; }
.pc-ic-blue { background: radial-gradient(circle at 50% 75%, #9fdcff 0%, #2f8fe0 50%, #134f8f 100%); border-color: #134f8f; }
.pc-ic-red, .pc-ic-redfill { background: radial-gradient(circle at 50% 75%, #ff9f8a 0%, #e8442b 50%, #9c1a0b 100%); border-color: #8a1809; }
.pc-ic-redfill i { font-weight: 700; -webkit-text-stroke: 1px #fff; }
/* disabled button: red "no entry" sign like the old software */
.pc-btn:disabled { color: #8d8d8d; cursor: default; background: linear-gradient(180deg, #fbfbfb, #f0f0f0); border-color: #b5b5b5; box-shadow: none; }
.pc-btn:disabled .pc-ic { background: #fff; border: 3px solid #e3241b; box-shadow: none; }
.pc-btn:disabled .pc-ic::before { left: 50%; right: auto; top: -10%; width: 3px; height: 120%; margin-left: -1.5px; border-radius: 0; background: #e3241b; transform: rotate(45deg); }
.pc-btn:disabled .pc-ic i { display: none; }
/* right button column */
.pc-actions { flex: 0 0 122px; display: flex; flex-direction: column; align-items: center; gap: 0; justify-content: space-between; padding: 14px 10px 14px; border-left: 3px double #5d7a6e; }
.pc-actions .pc-btn { width: 100px; height: 46px; }
/* entry row: column titles above the boxes, same widths as the grid */
.pc-entry { --g: 181px minmax(120px, 1fr) 70px 80px 82px 56px 64px 92px; display: grid; grid-template-columns: var(--g); gap: 0; align-items: end; margin-top: 2px; padding-right: 17px; }
.pc-entry .pe-h { text-align: center; padding: 0 2px 1px; line-height: 1.1; }
.pc-entry .pe-h label { white-space: normal; }
.pc-entry .pe-code { text-align: left; } .pc-entry .pe-h.pe-code { padding-left: 50px; }
.pc-entry .pe-qty { text-align: right; }
.pc-entry .pe-price { position: relative; }
.pc-entry .pe-last { height: 24px; min-height: 24px; margin: 0 0 2px; padding: 1px 3px; font-weight: 400; font-size: 10.5px; line-height: 20px; white-space: nowrap; overflow: hidden; text-align: left; }
.pc-entry .pe-last .last-price { color: #b45309; }
.pc-entry > .pc-box, .pc-entry .pe-wrap { height: 28px; margin-left: -1px; }
.pc-entry .pe-wrap { position: relative; } .pc-entry .pe-wrap .pc-in { height: 28px; }
.pc-entry #itemSearch { margin-left: 0; }
/* item grid */
.pc-grid { flex: 1 1 0; min-height: 130px; margin-top: 8px; background: #fff; border: 1px solid #6b7280; overflow-x: auto; overflow-y: scroll; }
.pc-grid table { width: 100%; min-width: 760px; table-layout: fixed; border-collapse: collapse; font-size: 12px; }
.pc-grid col.g-no { width: 46px; } .pc-grid col.g-code { width: 135px; } .pc-grid col.g-qty { width: 70px; } .pc-grid col.g-price { width: 80px; }
.pc-grid col.g-disc { width: 66px; } .pc-grid col.g-net { width: 82px; } .pc-grid col.g-vatp { width: 56px; } .pc-grid col.g-vat { width: 64px; } .pc-grid col.g-tot { width: 92px; }
.pc-grid:not(.has-disc) .g-disc { display: none; }
.pc-grid thead th { position: sticky; top: 0; z-index: 1; height: 17px; padding: 0 3px; background: linear-gradient(180deg, #f6f6f6, #dcdcdc); border: 1px solid #b9b9b9; font-size: 10px; font-weight: 400; color: #555; }
.pc-grid tbody td { height: 18px; padding: 0 4px; border-right: 1px solid #d4d4d4; border-bottom: 1px solid #ececec; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; vertical-align: middle; }
.pc-grid td.g-r { text-align: right; font-variant-numeric: tabular-nums; }
.pc-grid td input { width: 100%; border: 0; background: transparent; font: inherit; font-weight: 700; text-align: right; padding: 0; height: 17px; outline: none; }
.pc-grid td input:focus { background: #fffbe6; box-shadow: inset 0 0 0 1px #059669; }
.pc-grid td input[type=number]::-webkit-inner-spin-button { display: none; }
.pc-grid tbody tr[data-i] { cursor: default; }
.pc-grid tbody tr.selected td { background: #c9f0dd; }
.pc-grid tbody tr.flash td { animation: flashRow 1s ease; }
.pc-grid .badge { font-size: 9px; padding: 1px 4px; }
/* footer */
.pc-foot { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; gap: 6px 20px; margin-top: 8px; align-items: start; }
.pc-foot .pf-rl { grid-area: 1 / 1; align-self: start; padding-top: 2px; }
.pc-foot { grid-template-areas: "rem tot" "bal tot"; }
.pc-foot .pf-rl, .pc-foot .pf-rem, .pc-foot .pf-qty { grid-area: rem; }
.pc-foot .pf-rl { margin-left: 8px; } .pc-foot .pf-rem { margin-left: 72px; width: calc(100% - 72px - 92px); height: 38px; resize: none; } .pc-foot .pf-qty { justify-self: end; width: 58px; height: 26px; margin-right: 0; }
.pf-bal { grid-area: bal; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; align-self: end; }
.pf-bal > label { margin-left: 8px; } .pf-bal > label:not(:first-child) { margin-left: 30px; }
.pf-bal > .pc-box { width: 74px; height: 26px; } .pf-bal > #oldBal, .pf-bal > #curBal { width: 74px; }
.pf-bal > .pf-method { width: 96px; font-size: 11px; }
.pf-change { color: #065f46; font-weight: 700; }
.pf-tot { grid-area: tot; display: grid; grid-template-columns: 62px 92px 64px 92px; gap: 6px 6px; align-items: center; }
.pf-tot > .pc-box { height: 26px; align-items: flex-start; }
.pf-tot .pf-disc-l { display: flex; flex-direction: column; gap: 1px; font-size: 12px; }
.pf-tot .pc-tiny { font-size: 10px; border: 1px solid #9aa; padding: 0; width: 44px; }
.pf-tot .pc-net { font-weight: 700; }
.pf-tot .pc-dim { color: #555; }
.pc-foot input.pc-box { height: 26px; }
/* tablets and phones: stack the form */
@media (max-width: 991.98px) {
  .pos-classic .pc-window { min-height: 0; }
  .pc-body { flex-direction: column; }
  .pc-head { grid-template-columns: 1fr 1fr; gap: 0 18px; }
  .pc-head .pc-left { grid-column: 1 / -1; }
  .pc-right .pc-f > label { margin-left: 0; flex: 0 0 108px; } .pc-right .pc-f > .pc-box { flex: 1 1 auto; }
  .pc-rowbtns { flex-direction: row; justify-content: flex-end; }
  /* label + box pairs */
  .pc-entry { grid-template-columns: 108px 1fr 108px 1fr; gap: 5px 8px; padding-right: 0; align-items: center; }
  .pc-entry > :nth-child(1) { order: 1; } .pc-entry > :nth-child(9) { order: 2; } .pc-entry > :nth-child(2) { order: 3; } .pc-entry > :nth-child(10) { order: 4; } .pc-entry > :nth-child(3) { order: 5; } .pc-entry > :nth-child(11) { order: 6; } .pc-entry > :nth-child(4) { order: 7; } .pc-entry > :nth-child(12) { order: 8; } .pc-entry > :nth-child(5) { order: 9; } .pc-entry > :nth-child(13) { order: 10; } .pc-entry > :nth-child(6) { order: 11; } .pc-entry > :nth-child(14) { order: 12; } .pc-entry > :nth-child(7) { order: 13; } .pc-entry > :nth-child(15) { order: 14; } .pc-entry > :nth-child(8) { order: 15; } .pc-entry > :nth-child(16) { order: 16; }
  .pc-entry .pe-h { text-align: left !important; padding: 0 !important; display: flex; align-items: center; gap: 4px; }
  .pc-entry .pe-h label br { display: none; }
  .pc-entry .pe-h .pe-last { display: none; }
  .pc-entry > .pc-box, .pc-entry .pe-wrap { margin-left: 0; }
  .pc-entry .pe-wrap { grid-column: 2 / -1; }
  .pc-entry .pe-h.pe-name { grid-column: 1; }
  .pc-entry .pe-h .pe-last { display: none; }
  .pc-grid { flex: none; min-height: 190px; max-height: 50vh; }
  .pc-foot { grid-template-columns: 1fr; grid-template-areas: "rem" "tot" "bal"; }
  .pf-tot { justify-self: stretch; grid-template-columns: 62px 1fr 1fr 1fr; }
  .pc-actions { flex: none; flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 6px; border-left: 0; border-top: 3px double #5d7a6e; position: sticky; bottom: 0; z-index: 5; padding: 6px; background: #c6eedc; }
  .pc-actions .pc-btn { width: calc(33.33% - 6px); height: 40px; }
}
@media (max-width: 575.98px) {
  .pc-main { padding: 6px; }
  .pc-head { grid-template-columns: 1fr; }
  .pc-left .pc-f > label, .pc-mid .pc-f > label, .pc-right .pc-f > label { flex-basis: 84px; }
  .pc-f-two { flex-wrap: wrap; } .pc-f-two .pc-l2 { margin-left: 0; flex: 0 0 84px; } .pc-f-two .pc-box { flex: 1 1 calc(100% - 92px); }
  .pc-contact { gap: 10px; flex-wrap: wrap; }
  .pc-entry { grid-template-columns: 84px 1fr; }
  .pc-entry .pe-wrap { grid-column: 2; }
  .pc-foot .pf-rem { width: calc(100% - 72px); } .pc-foot .pf-qty { display: none; }
  .pf-bal > label:not(:first-child) { margin-left: 8px; }
  .pf-bal { display: grid; grid-template-columns: 90px 1fr 1fr; }
  .pf-bal > label { margin-left: 0 !important; } .pf-bal > .pc-box { width: auto !important; }
  .pf-bal > #oldBal, .pf-bal > #curBal { grid-column: 2 / -1; }
  .pc-actions .pc-btn { height: 36px; font-size: 12px; } .pc-ic { width: 24px; height: 24px; flex-basis: 24px; font-size: 11px; }
  .pc-actions #btnClose { display: none; }
}
