:root {
  --primary: #0f4c81; --primary-2: #1565c0; --accent: #f59e0b; --bg: #f4f6fa; --card: #fff;
  --text: #1f2937; --muted: #6b7280; --border: #e3e8ef; --ok: #15803d; --warn: #b45309; --err: #b91c1c;
  --radius: 10px; --nav-w: 210px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; }
a { color: var(--primary-2); }
h1, h2, h3 { margin: 0 0 .6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }

/* Layout */
.topbar { position: sticky; top: 0; z-index: 20; height: 54px; display: flex; align-items: center; gap: .6rem; padding: 0 1rem; background: var(--primary); color: #fff; }
.brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.15rem; display: flex; align-items: center; gap: .5rem; }
.brand img { width: 30px; height: 30px; } .brand span { color: var(--accent); }
.spacer { flex: 1; }
.icon-btn { background: none; border: 0; color: inherit; font-size: 1.4rem; cursor: pointer; display: none; }
.sidebar { position: fixed; top: 54px; left: 0; bottom: 0; width: var(--nav-w); background: #fff; border-right: 1px solid var(--border); padding: .6rem; display: flex; flex-direction: column; gap: 2px; z-index: 15; }
.sidebar a { display: flex; align-items: center; gap: .55rem; padding: .44rem .7rem; border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 500; font-size: .92rem; line-height: 1.25; min-height: 34px; }
.sidebar a > span { flex: 1; min-width: 0; }
.sidebar a i { font-style: normal; flex: 0 0 1.4rem; width: 1.4rem; text-align: center; font-size: 1rem; line-height: 1; }
.sidebar a kbd { margin-left: auto; font-size: .7rem; color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; }
.sidebar a:hover { background: #eef3fa; } .sidebar a.active { background: var(--primary); color: #fff; }
.sidebar a.active kbd { color: #dbe7f5; border-color: #5d86b0; }
.nav-foot { margin-top: auto; font-size: .78rem; color: var(--muted); padding: .6rem; }

/* App version — left sidebar + topbar (always visible, muted) */
.app-ver { font-size: .75rem; font-weight: 600; color: var(--muted); letter-spacing: .02em; margin-bottom: .25rem; font-variant-numeric: tabular-nums; }
.app-ver-top { font-size: .72rem; font-weight: 600; margin-left: .15rem; white-space: nowrap; color: rgba(255,255,255,.78); font-variant-numeric: tabular-nums; }
.nav-foot .nav-foot-note { display: block; }
body.rail .nav-foot { text-align: center; padding: .35rem .15rem; }
body.rail .nav-foot .nav-foot-note { display: none; }
body.rail .app-ver { font-size: .62rem; margin: 0; }
@media (max-width: 1100px) {
  .app-ver-top { font-size: .68rem; }
}
.nav-shade { display: none; }
/* Every page uses the full width beside the sidebar, same as New Purchase. */
main { margin-left: var(--nav-w); padding: 1.2rem; max-width: none; }

/* Components */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1rem; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card.error { border-color: #fecaca; background: #fef2f2; color: var(--err); }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: .8rem; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid > *, .card, #view { min-width: 0; }
input, select, textarea { min-width: 0; max-width: 100%; }
.table-wrap { max-width: 100%; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.stat { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem; }
.stat .label { color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; }
.stat .value { font-size: 1.5rem; font-weight: 700; margin-top: .25rem; }
.stat.primary { background: var(--primary); color: #fff; border-color: var(--primary); } .stat.primary .label { color: #cfe0f3; }
.stat.warn .value { color: var(--warn); }
label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: .2rem; font-weight: 500; }
input, select, textarea { width: 100%; padding: .55rem .65rem; border: 1px solid #cfd6e0; border-radius: 8px; font: inherit; background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid #9cc3ee; border-color: var(--primary-2); }
input[type=checkbox], input[type=radio] { width: auto; }
.check { display: flex; gap: .45rem; align-items: center; color: var(--text); font-size: .9rem; cursor: pointer; }
.btn { display: inline-flex; align-items: center; gap: .35rem; padding: .55rem .95rem; border-radius: 8px; border: 1px solid var(--primary); background: var(--primary); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { filter: brightness(1.08); } .btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.light { background: #fff; color: var(--primary); } .btn.ghost { background: transparent; color: var(--primary); border-color: var(--border); }
.btn.danger { background: var(--err); border-color: var(--err); } .btn.ok { background: var(--ok); border-color: var(--ok); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #111; }
.btn.small { padding: .3rem .6rem; font-size: .85rem; } .btn.big { padding: .8rem 1.2rem; font-size: 1.05rem; }
.link-btn { background: none; border: 0; color: var(--primary-2); cursor: pointer; padding: .15rem .3rem; font: inherit; font-size: .88rem; }
.link-btn.danger { color: var(--err); }
.badge { display: inline-block; padding: .12rem .5rem; border-radius: 99px; font-size: .75rem; font-weight: 600; background: #e5e7eb; color: #374151; }
.badge.ok { background: #dcfce7; color: var(--ok); } .badge.warn { background: #fef3c7; color: var(--warn); } .badge.err { background: #fee2e2; color: var(--err); }
.badge.sample { background: #ede9fe; color: #6d28d9; } .badge.info { background: #dbeafe; color: #1e40af; }
.topbar .badge { background: rgba(255,255,255,.15); color: #fff; } .topbar .badge.off { background: var(--accent); color: #111; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .right { text-align: right; } .center { text-align: center; }
.nowrap { white-space: nowrap; } .mono { font-family: ui-monospace, Consolas, monospace; }
.banner { background: #f5f3ff; border: 1px solid #ddd6fe; color: #4c1d95; padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; }
.banner.warn { background: #fffbeb; border-color: #fde68a; color: #78350f; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: .5rem .55rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th { background: #f8fafc; color: #475569; font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; }
.table td.num, .table th.num { text-align: right; white-space: nowrap; }
.table tr.low td { background: #fffbeb; } .table tr.cancelled td { color: #9ca3af; text-decoration: line-through; }
.table tfoot td { font-weight: 700; background: #f8fafc; }
.table input { padding: .35rem .45rem; min-width: 60px; }
.empty { text-align: center; color: var(--muted); padding: 1.4rem !important; }

/* Search dropdown */
.search-wrap { position: relative; }
.results { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,.12); max-height: 360px; overflow: auto; display: none; }
.results.show { display: block; }
.results .r { padding: .55rem .75rem; cursor: pointer; display: flex; justify-content: space-between; gap: .6rem; border-bottom: 1px solid #f1f5f9; }
.results .r.active, .results .r:hover { background: #eef3fa; }
.results .r .meta { font-size: .78rem; color: var(--muted); }
.results .r.out { opacity: .55; }

/* Editable form lists use the same full-width menu on desktop and phone. */
.form-options { position: fixed; z-index: 80; width: max-content; min-width: 12rem; max-width: min(28rem, calc(100vw - 16px)); max-height: min(320px, 45vh); margin: 0; overflow-y: auto; overscroll-behavior: contain; background: #fff; border: 1px solid #c5d4e4; border-radius: 8px; box-shadow: 0 12px 28px rgba(15, 35, 65, .22); padding: .2rem; }
.form-option { display: flex; flex-direction: column; gap: .1rem; padding: .55rem .7rem; border-radius: 6px; cursor: pointer; overflow-wrap: anywhere; }
#form-options .form-option { white-space: nowrap; }
.form-option:hover, .form-option.active { background: #eaf2fb; }
.form-option small { color: var(--muted); font-size: .78rem; }

/* POS */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1rem; align-items: start; }
.pos-side { position: sticky; top: 70px; }
#posSearch { font-size: 1.05rem; padding: .75rem .85rem; }
.totals { width: 100%; border-collapse: collapse; margin: .6rem 0; }
.totals td { padding: .28rem 0; } .totals td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.totals tr.grand td { font-size: 1.45rem; font-weight: 800; color: var(--primary); border-top: 2px solid var(--border); padding-top: .5rem; }
.pay-modes { display: grid; grid-template-columns: repeat(4, 1fr); gap: .35rem; }
.pay-modes label { margin: 0; }
.pay-modes input { display: none; }
.pay-modes span { display: block; text-align: center; padding: .5rem .2rem; border: 1px solid #cfd6e0; border-radius: 8px; cursor: pointer; color: var(--text); font-weight: 600; font-size: .88rem; }
.pay-modes input:checked + span { background: var(--primary); color: #fff; border-color: var(--primary); }
.hint { font-size: .78rem; color: var(--muted); }

/* Dialog */
dialog { border: 0; border-radius: 12px; padding: 0; width: min(720px, 95vw); box-shadow: 0 25px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(15, 23, 42, .45); }
#modalBody { padding: 1.2rem; max-height: 85vh; overflow: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }

/* Toast */
.toast { pointer-events: none; position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%) translateY(200%); opacity: 0; visibility: hidden; background: #111827; color: #fff; padding: .7rem 1.1rem; border-radius: 10px; z-index: 100; transition: transform .25s, opacity .25s, visibility .25s; max-width: 90vw; }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; visibility: visible; } .toast.err { background: var(--err); } .toast.ok { background: #14532d; }

/* Invoice (screen preview + print) */
.inv-toolbar { position: sticky; top: 54px; z-index: 5; background: var(--bg); padding: .5rem 0; }
.inv-preview { background: #e5e7eb; padding: 1rem; border-radius: var(--radius); overflow: auto; }
.inv { background: #fff; color: #000; margin: 0 auto; box-shadow: 0 2px 10px rgba(0,0,0,.12); position: relative; }
.inv.a4 { width: 210mm; min-height: 280mm; padding: 10mm; font-size: 12px; }
.inv.a4 .inv-head { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 2px solid #0f4c81; padding-bottom: 8px; }
.inv.a4 .inv-head h1 { font-size: 24px; color: #0f4c81; margin: 0 0 4px; }
.inv.a4 .inv-title { text-align: right; } .inv.a4 .inv-title h2 { font-size: 18px; letter-spacing: .08em; margin: 0 0 6px; }
.inv.a4 .kv td { padding: 1px 0 1px 10px; } .inv.a4 .kv td:first-child { color: #555; }
.inv.a4 .inv-party { display: flex; justify-content: space-between; gap: 1rem; padding: 8px 0; border-bottom: 1px solid #ccc; }
.inv table.items { width: 100%; border-collapse: collapse; margin-top: 8px; }
.inv.a4 table.items th { background: #0f4c81; color: #fff; padding: 5px; font-size: 11px; text-align: left; }
.inv.a4 table.items td { padding: 5px; border-bottom: 1px solid #ddd; vertical-align: top; }
.inv .n { text-align: right; white-space: nowrap; }
.inv.a4 .inv-bottom { display: flex; justify-content: space-between; gap: 1rem; margin-top: 10px; }
.inv.a4 table.tax { border-collapse: collapse; font-size: 11px; } .inv.a4 table.tax th, .inv.a4 table.tax td { border: 1px solid #bbb; padding: 3px 6px; }
.inv.a4 table.tax th { background: #f1f5f9; }
.inv.a4 table.tot { border-collapse: collapse; min-width: 250px; } .inv.a4 table.tot td { padding: 3px 4px; }
.inv.a4 table.tot tr.grand td { font-size: 16px; font-weight: 800; border-top: 2px solid #0f4c81; color: #0f4c81; }
.inv.a4 .words { margin-top: 10px; padding: 6px 8px; background: #f8fafc; border: 1px solid #e2e8f0; }
.inv.a4 .inv-foot { display: flex; justify-content: space-between; gap: 1rem; margin-top: 18px; font-size: 11px; }
.inv.a4 .sign { text-align: right; min-width: 200px; } .inv.a4 .sign .line { margin-top: 40px; border-top: 1px solid #333; padding-top: 3px; }
.inv .stamp { position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%) rotate(-20deg); font-size: 60px; font-weight: 900; color: rgba(185, 28, 28, .25); border: 6px solid rgba(185, 28, 28, .25); padding: 4px 20px; pointer-events: none; }
.inv.a4 .bank { margin-bottom: 6px; } .inv.a4 .kv0 { border-collapse: collapse; } .inv.a4 .kv0 td { padding: 0 8px 0 0; } .inv.a4 .kv0 td:first-child { color: #555; }
.inv.a4.a5 { width: 148mm; min-height: 200mm; padding: 6mm; font-size: 9.5px; }
.inv.a4.a5 .inv-head h1 { font-size: 17px; } .inv.a4.a5 .inv-title h2 { font-size: 13px; }
.inv.a4.a5 table.items th { font-size: 8.5px; padding: 3px; } .inv.a4.a5 table.items td { padding: 3px; }
.inv.a4.a5 table.tax { font-size: 8.5px; } .inv.a4.a5 table.tax th, .inv.a4.a5 table.tax td { padding: 2px 3px; }
.inv.a4.a5 table.tot { min-width: 170px; } .inv.a4.a5 table.tot tr.grand td { font-size: 12px; }
.inv.a4.a5 .inv-foot { font-size: 8.5px; margin-top: 10px; } .inv.a4.a5 .sign { min-width: 130px; } .inv.a4.a5 .sign .line { margin-top: 26px; }
.inv.a4.a5 .inv-bottom { flex-wrap: wrap; }
.inv.thermal .bank-t { font-size: 10.5px; text-align: center; }
.inv.thermal { width: 80mm; padding: 3mm; font-family: ui-monospace, "Courier New", monospace; font-size: 11.5px; line-height: 1.35; }
.inv.thermal .c { text-align: center; } .inv.thermal .big { font-size: 16px; font-weight: 800; }
.inv.thermal hr { border: 0; border-top: 1px dashed #000; margin: 4px 0; }
.inv.thermal table { width: 100%; border-collapse: collapse; } .inv.thermal td, .inv.thermal th { padding: 1px 0; vertical-align: top; }
.inv.thermal th { text-align: left; border-bottom: 1px dashed #000; font-weight: 700; }
.inv.thermal td.n, .inv.thermal th.n { text-align: right; padding-left: 4px; }
.inv.thermal .grand td { font-size: 14px; font-weight: 800; }
.inv.thermal .stamp { font-size: 28px; border-width: 3px; }


/* ---- v2 additions ---- */
.sidebar { overflow-y: auto; overscroll-behavior: contain; padding-bottom: 1rem; scrollbar-width: thin; }
.nav-group { display: flex; flex-direction: column; gap: 2px; margin-top: .25rem; padding-top: .25rem; border-top: 1px solid #f1f5f9; }
.nav-h { all: unset; box-sizing: border-box; display: flex; align-items: center; justify-content: space-between; width: 100%; cursor: pointer; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: .45rem .7rem .25rem; font-weight: 700; border-radius: 6px; }
.nav-h::after { content: '▾'; font-size: .8rem; transition: transform .15s; }
.nav-h:hover { color: var(--primary); } .nav-h:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.nav-group.collapsed .nav-h::after { transform: rotate(-90deg); }
.nav-group.collapsed a:not(.active) { display: none; }
.pay-list-wrap { max-height: 28rem; overflow: auto; margin-top: .55rem; }
.pay-list tbody tr { cursor: pointer; }
.pay-list tbody tr.on { background: #e8f2ea; }
.pay-alloc { margin: .45rem 0 0; padding-left: 1.1rem; }
.sidebar [hidden] { display: none !important; } /* role-hidden entries/sections (the display:flex rules above would otherwise win) */
.sidebar a:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.user-chip { display: flex; align-items: center; gap: .35rem; font-size: .88rem; white-space: nowrap; }
.user-chip .badge { background: rgba(255,255,255,.2); color: #fff; }
.topbanner { margin: 0 0 0 var(--nav-w); padding: .55rem 1.2rem; background: #fffbeb; border-bottom: 1px solid #fde68a; color: #78350f; display: flex; gap: .8rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.topbanner[hidden] { display: none; }
.tabs { display: flex; gap: .3rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tab { border: 0; background: none; padding: .55rem .9rem; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.badge.combo { background: #ffedd5; color: #9a3412; }
.danger-t, .err-t { color: var(--err); } .warn-t { color: var(--warn); } .ok-t { color: var(--ok); }
.btn.warn-btn { background: #fef3c7; color: var(--warn); border-color: #fcd34d; }
.btn.block { width: 100%; justify-content: center; }
.btn.ghost.danger-t { color: var(--err); }
.cost { color: #7c3aed; }
.owner-only td { color: #7c3aed; font-weight: 600; }
.big-total { font-size: 1.6rem; font-weight: 800; color: var(--primary); }
.small-v { font-size: .8rem; color: var(--muted); }
.ask-msg { line-height: 1.5; }
dialog.ask { width: min(460px, 94vw); }
dialog.ask form { padding: 1.2rem; }
dialog.wide { width: min(1000px, 96vw); }
.layout-sel { display: inline-grid; width: auto; }
.layout-sel span { padding: .35rem .7rem; }
.search-box { position: relative; }
.sn-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .3rem; max-height: 300px; overflow: auto; padding: .4rem; border: 1px solid var(--border); border-radius: 8px; margin: .5rem 0; }
.sn-list .sn { padding: .25rem .4rem; border-radius: 6px; } .sn-list .sn:hover { background: #f1f5f9; }
.sn-inline { font-size: .8rem; color: var(--muted); }
.sn-card { border: 1px solid var(--border); border-radius: 8px; padding: .8rem; margin-top: .7rem; background: #f8fafc; }
.cart-table td { vertical-align: top; }
.cart-table tr.combo-head td { background: #fff7ed; border-bottom: 0; }
.cart-table tr.combo-comp td { background: #fffbf5; padding-top: .3rem; padding-bottom: .3rem; }
.cart-table tr.combo-comp td:nth-child(2) { padding-left: 1.4rem; }
.batch-sel { width: auto; padding: .2rem .4rem; font-size: .8rem; }
.table tr.combo-head td { background: #fff7ed; }
.recovery { font-family: ui-monospace, Consolas, monospace; font-size: 1.6rem; font-weight: 800; letter-spacing: .08em; text-align: center; padding: .8rem; background: #f1f5f9; border: 2px dashed #94a3b8; border-radius: 10px; margin: .8rem 0; }
/* auth */
.auth-screen[hidden] { display: none; }
.auth-screen { position: fixed; inset: 0; z-index: 50; background: linear-gradient(135deg, #0f4c81, #1565c0); display: flex; align-items: center; justify-content: center; padding: 1rem; overflow: auto; }
.auth-card { background: #fff; border-radius: 14px; padding: 1.6rem; width: min(420px, 100%); box-shadow: 0 25px 60px rgba(0,0,0,.3); }
.auth-card h2 { margin-top: 1rem; }
.auth-card label { margin-top: .6rem; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: .5rem; font-weight: 800; font-size: 1.3rem; color: var(--primary); }
.auth-brand img { width: 36px; height: 36px; } .auth-brand span { color: var(--accent); }
#pinInput { font-size: 1.6rem; text-align: center; letter-spacing: .4em; }
.user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; margin-top: .6rem; }
.user-btn { border: 1px solid var(--border); background: #f8fafc; border-radius: 10px; padding: 1rem .6rem; cursor: pointer; font: inherit; display: flex; flex-direction: column; gap: .2rem; align-items: center; }
.user-btn:hover { border-color: var(--primary); background: #eef3fa; } .user-btn span { font-size: .8rem; color: var(--muted); }
body.locked .topbar, body.locked .sidebar, body.locked main, body.locked .topbanner { visibility: hidden; }
/* invoice extras */
.inv .sub { font-size: .85em; color: #444; margin-top: 1px; }
.inv .muted-p { color: #555; font-size: .9em; }
.inv tr.combo-row td { background: #f1f5f9; border-bottom: 1px solid #cbd5e1; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.inv .combo-price { display: block; font-size: .88em; color: #333; font-weight: 400; }
.inv tr.comp td:nth-child(2) { padding-left: 14px; }
.inv.a4 .tax-wrap { min-width: 0; flex: 1; overflow: hidden; }
.inv.a4 .foot-left { flex: 1; min-width: 0; }
.inv.a4 table.items td:nth-child(2) { word-break: break-word; }
.inv.thermal .small-t { font-size: 10px; color: #222; }
.inv.thermal tr.combo-row td { padding-top: 3px; }
.inv.a4.a5 table.items th, .inv.a4.a5 table.items td { word-break: normal; }
.inv.a4.a5 table.items td:nth-child(2) { word-break: break-word; }
.dayend-doc { min-height: 0 !important; max-width: 150mm; }
.de-table { width: 100%; border-collapse: collapse; }
.de-table th { text-align: left; padding: 6px 0 2px; border-bottom: 1px solid #999; }
.de-table td { padding: 2px 0; } .de-table td.n { text-align: right; } .de-table tr.b td { font-weight: 800; border-top: 1px solid #ccc; }
.inv.thermal .de-table th { border-bottom: 1px dashed #000; }
/* v2.15.0 labels: fixed mm boxes (CSS grid), sized by --lw/--lh/--cols/--gx on #lblSheet — no browser flex rounding */

/* Keep wide thermal preview from expanding the page (mobile 390px); print still uses #lblSheet size */
.label-preview-wrap {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0.5rem 0 1rem;
}
@media print {
  /* Unwrap so 107×25 @page pagination is one row per page (browser fallback) */
  .label-preview-wrap { display: contents; }
}

.label-sheet { --lw:35mm; --lh:25mm; --cols:3; --gx:2mm; --gy:2mm; --ml:0mm; --mr:0mm; --mt:0mm; --mb:0mm;
  background: #e5e7eb; padding: 1rem; border-radius: var(--radius); overflow: auto; margin: 0 auto; }
.label-row { display: grid; grid-template-columns: repeat(var(--cols), var(--lw)); column-gap: var(--gx); row-gap: 0;
  width: calc(var(--cols) * var(--lw) + (var(--cols) - 1) * var(--gx));
  height: var(--lh); margin: 0 auto var(--gy); padding: 0; box-sizing: content-box; }
.label-sheet .label { width: var(--lw); height: var(--lh); max-width: var(--lw); max-height: var(--lh);
  box-sizing: border-box; background: #fff; color: #000; padding: .8mm 1mm; overflow: hidden;
  display: flex; flex-direction: column; font-family: Arial, Helvetica, sans-serif; border-radius: 1.5mm;
  flex: none; min-width: 0; min-height: 0; }
.label-sheet .label.blank { background: transparent; border: 1px dashed #9ca3af; }
.l-shop { font-size: 4.5pt; font-weight: 700; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.1; }
.l-name { font-size: 5pt; line-height: 1.1; max-height: 2.2em; overflow: hidden; text-align: center; }
.l-model { font-size: 4.5pt; max-height: 1.1em; }
.l-bar { flex: 1 1 auto; min-height: 8mm; display: flex; align-items: stretch; padding: .2mm 0; overflow: hidden; }
.l-bar svg { width: 100%; height: 100%; display: block; }
.l-code-line { font: 700 5.5pt/1 Arial, Helvetica, sans-serif; text-align: center; white-space: nowrap; overflow: hidden; }
.l-cost-code { font: 700 5pt/1 Arial, Helvetica, sans-serif; text-align: center; white-space: nowrap; overflow: hidden; letter-spacing: .15mm; }
.l-price-line { font: 4.5pt/1 Arial, Helvetica, sans-serif; text-align: center; white-space: nowrap; overflow: hidden; }
.l-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 1mm; font-size: 5pt; line-height: 1.1; }
.l-code { font-family: ui-monospace, Consolas, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.l-foot b { font-size: 5.5pt; white-space: nowrap; }
.label-tips { margin-top: .6rem; padding: .6rem .75rem; background: #f8fafc; border: 1px solid var(--border); border-radius: var(--radius); }
.label-tips li { margin: .2rem 0; font-size: .82rem; color: var(--muted); }
.label-size-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; margin-top: .5rem; }
@media (max-width: 860px) { .topbanner { margin-left: 0; } .user-chip .user-name { display: none; } .label-size-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .user-chip { display: none; } }
@media print {
  .grid { display: block !important; }
  .label-sheet { background: none !important; padding: 0 !important; border-radius: 0; overflow: visible; margin: 0; width: calc(var(--cols) * var(--lw) + (var(--cols) - 1) * var(--gx)) !important; }
  .label-sheet .label { border-radius: 0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .label-sheet.roll .label-row { margin: 0 !important; padding: 0 !important; height: var(--lh); width: calc(var(--cols) * var(--lw) + (var(--cols) - 1) * var(--gx));
    break-after: page; page-break-after: always; break-inside: avoid; page-break-inside: avoid; }
  .label-sheet.roll .label-row:last-child { break-after: auto; page-break-after: auto; }
  .label-sheet.sheet .label-row { break-inside: avoid; page-break-inside: avoid; margin: 0 0 var(--gy) 0; height: auto; min-height: var(--lh); }
  .label-sheet .label.blank { border: 0; }
  .topbanner, #authScreen, .label-tips { display: none !important; }
}

/* Responsive */
/* v2.9.1: one column only when there is really no room (icon rail gives New Sale ~150px more) */
@media (max-width: 1100px) { body:not(.rail) .pos { grid-template-columns: minmax(0, 1fr); } body:not(.rail) .pos-side { position: static; max-height: none !important; } }
@media (max-width: 900px) { .pos { grid-template-columns: minmax(0, 1fr); } .pos-side { position: static; max-height: none !important; } }
@media (max-width: 860px) {
  .icon-btn { display: block; }
  .sidebar { transform: translateX(-100%); transition: transform .2s; box-shadow: 4px 0 20px rgba(0,0,0,.15); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .nav-shade { display: block; position: fixed; inset: 54px 0 0 0; background: rgba(0,0,0,.3); z-index: 14; }
  main { margin-left: 0; padding: .8rem; }
  .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hide-sm { display: none; }
  .inv-preview { padding: .4rem; }
}
@media (max-width: 520px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; } .stat { padding: .7rem; } .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: minmax(0, 1fr); } .stat .value { font-size: 1.25rem; } #installBtn { display: none; } }

/* Print: only the invoice */
@media print {
  body { background: #fff; }
  .no-print, .topbar, .sidebar, .nav-shade, .toast, .inv-toolbar { display: none !important; }
  main { margin: 0; padding: 0; max-width: none; }
  .inv-preview { background: none; padding: 0; overflow: visible; }
  .inv { box-shadow: none; margin: 0; }
  .inv.a4 { width: auto; min-height: 0; padding: 0; }
  .inv.thermal { width: 100%; padding: 0; }
  .inv.a4 table.items th, .inv.a4 table.items th * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  /* multi-page bills: repeat the column header, never split a row or the totals / bank / signature blocks */
  .inv table.items thead { display: table-header-group; }
  .inv table.items tr, .inv .inv-bottom, .inv .words, .inv .inv-foot, .inv table.tax, .inv table.tot { break-inside: avoid; page-break-inside: avoid; }
  .inv.a4 table.items td { padding: 3px 5px; }
  .inv.a4 table.items tr.comp td { padding-top: 2px; padding-bottom: 2px; }
  .inv.a4 .inv-foot { margin-top: 10px; } .inv.a4 .sign .line { margin-top: 30px; }
}
.grid > *, .pos > * { min-width: 0; }
/* quick "New Item" in purchase entry */
.results .r.create { background: #f0fdf4; color: var(--ok); border-top: 1px dashed #bbf7d0; }
.results .r.create.active, .results .r.create:hover { background: #dcfce7; }
.dup-box { margin-top: .7rem; border: 1px solid #fcd34d; background: #fffbeb; border-radius: 8px; padding: .55rem .7rem; }
.dup-box.strong { border-width: 2px; border-color: var(--warn); }
.dup-box .dup-title { font-weight: 600; color: var(--warn); margin-bottom: .35rem; font-size: .9rem; }
.dup-box .dup-row { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .3rem 0; border-top: 1px solid #fde68a; }
.dup-box .dup-row:first-of-type { border-top: 0; }
.si-search-row { display: flex; gap: .5rem; align-items: stretch; margin-top: .8rem; }
.si-search-row .search-wrap { flex: 1; min-width: 0; }
.si-search-row .btn { white-space: nowrap; }
/* ---- online sync (v2.3.0) */
.sync-chip { display: inline-flex; align-items: center; gap: .3rem; font-size: .75rem; font-weight: 600; padding: .18rem .55rem; border-radius: 999px; text-decoration: none; white-space: nowrap; background: rgba(255,255,255,.15); color: #fff; border: 1px solid rgba(255,255,255,.35); }
.sync-chip.ok { background: #dcfce7; color: #166534; border-color: #86efac; }
.sync-chip.warn { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.sync-chip.err { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.sync-chip.off { background: #e5e7eb; color: #374151; border-color: #d1d5db; }
.sync-chip.busy { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }
.sync-chip[hidden] { display: none; }
.sync-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .8rem; margin-bottom: .6rem; }
.sync-stats .label { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: .15rem; }
.sync-dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; background: #9ca3af; vertical-align: middle; }
.sync-dot.ok { background: #16a34a; } .sync-dot.warn { background: #d97706; } .sync-dot.err { background: #dc2626; } .sync-dot.off { background: #6b7280; }
@media (max-width: 700px) { .sync-chip { font-size: .68rem; padding: .12rem .4rem; max-width: 9.5rem; overflow: hidden; text-overflow: ellipsis; } }
#netStatus { white-space: nowrap; }
@media (max-width: 700px) { body.sync-on #netStatus { display: none; } }

/* ---- item photos (v2.4.0) */
.thumb { width: 2.6rem; height: 2.6rem; border-radius: .4rem; object-fit: cover; background: #f1f5f9; border: 1px solid #e2e8f0; flex: none; display: inline-block; vertical-align: middle; }
.thumb.sm { width: 2.2rem; height: 2.2rem; }
.thumb.ph { background: #f1f5f9 center/55% no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='1.6'%3E%3Crect x='3' y='5' width='18' height='14' rx='2'/%3E%3Ccircle cx='9' cy='10' r='2'/%3E%3Cpath d='m21 16-5-5-8 8'/%3E%3C/svg%3E"); }
img.thumb.missing { opacity: .4; }
img.thumb[data-state=loading] { background: #e2e8f0; }
.results .r { align-items: center; }
.results .r .grow { flex: 1; min-width: 0; }
.item-cell { display: flex; align-items: center; gap: .55rem; }
.item-cell img.thumb { cursor: zoom-in; }
.img-grid { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .3rem; }
.img-tile { position: relative; }
.img-tile .thumb { width: 4.5rem; height: 4.5rem; }
.img-tile .x { position: absolute; top: -.4rem; right: -.4rem; width: 1.4rem; height: 1.4rem; border-radius: 50%; border: 0; background: #dc2626; color: #fff; font-size: .8rem; line-height: 1.4rem; padding: 0; cursor: pointer; }
.img-tile .tag { position: absolute; left: .2rem; bottom: .2rem; font-size: .6rem; background: rgba(15,23,42,.7); color: #fff; border-radius: .25rem; padding: 0 .25rem; }
.img-add { display: inline-flex; gap: .4rem; flex-wrap: wrap; }
.img-add label.btn { margin: 0; cursor: pointer; }
.img-add input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
dialog.img-viewer { border: 0; border-radius: .8rem; padding: .8rem; max-width: min(96vw, 1100px); width: 100%; }
dialog.img-viewer::backdrop { background: rgba(15,23,42,.75); }
.iv-head { display: flex; gap: .6rem; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.iv-body { display: flex; align-items: center; justify-content: center; gap: .4rem; min-height: 40vh; }
.iv-body img { max-width: 100%; max-height: 72vh; object-fit: contain; border-radius: .5rem; }
.iv-nav { font-size: 1.6rem; padding: .2rem .7rem; }
.iv-strip { display: flex; gap: .4rem; justify-content: center; margin-top: .5rem; flex-wrap: wrap; }
.iv-strip .thumb { cursor: pointer; }
.iv-strip .thumb.sel { outline: 2px solid var(--primary, #1d4ed8); }
.iv-missing { padding: 2rem; text-align: center; }
/* sync checklist + join from first run */
.checklist { list-style: none; padding: 0; margin: .4rem 0; }
.checklist li { display: flex; align-items: center; gap: .6rem; padding: .45rem 0; border-bottom: 1px solid #f1f5f9; flex-wrap: wrap; }
.checklist li .ck { width: 1.4rem; height: 1.4rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; flex: none; border: 2px solid #cbd5e1; }
.checklist li.done .ck { background: #16a34a; border-color: #16a34a; color: #fff; }
.checklist li .grow { flex: 1; min-width: 10rem; }
.auth-alt { margin-top: 1rem; padding-top: .9rem; border-top: 1px solid #e2e8f0; text-align: center; }
.auth-steps { display: flex; gap: .3rem; justify-content: center; margin: .4rem 0 .8rem; }
.auth-steps span { font-size: .72rem; padding: .1rem .5rem; border-radius: 1rem; background: #f1f5f9; color: #64748b; }
.auth-steps span.on { background: var(--primary); color: #fff; }
.img-add label.disabled { opacity: .45; pointer-events: none; }

/* v2.4.1 purchase entry: incl/excl GST toggles, next-item row */
.si-modes { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .7rem; margin-top: .7rem; }
.pay-modes.seg { grid-template-columns: repeat(2, auto); gap: .25rem; }
.pay-modes.seg span { padding: .3rem .7rem; font-size: .82rem; }
.mode-btn { font-size: .75rem; padding: 0 .15rem; border: 1px dashed #b9c3d0; border-radius: 4px; }
.si-newrow { margin-top: .35rem; padding: .35rem; border: 1px dashed #b9c3d0; border-radius: 8px; background: #fafcff; }
.si-newrow input { width: 100%; }
.price-other { display: block; margin-top: .15rem; }
/* v2.5 import + service jobs */
.progress { height: 12px; background: #e5e7eb; border-radius: 6px; overflow: hidden; margin: .4rem 0; }
.progress-bar { height: 100%; background: var(--ok, #16a34a); transition: width .2s; }
.imp-stats .stat .value { font-size: 1.3rem; }
.imp-table tr.imp-error td { background: #fef2f2; }
.imp-table tr.imp-skip td { color: var(--muted); }
.job-status { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: #e5e7eb; color: #374151; white-space: nowrap; }
.job-status.received { background: #dbeafe; color: #1e40af; } .job-status.diagnosing { background: #ede9fe; color: #5b21b6; }
.job-status.waiting_parts { background: #fef3c7; color: #92400e; } .job-status.ready { background: #dcfce7; color: #166534; }
.job-status.delivered { background: #f3f4f6; color: #374151; } .job-status.returned { background: #fee2e2; color: #991b1b; }
.job-steps { display: flex; gap: .3rem; flex-wrap: wrap; margin: .4rem 0; }
.warranty-box { padding: .5rem .7rem; border-radius: var(--radius); border: 1px solid var(--border); margin-top: .4rem; font-size: .9rem; }
.warranty-box.in { background: #f0fdf4; border-color: #bbf7d0; } .warranty-box.out { background: #fffbeb; border-color: #fde68a; }
.inv.jobcard h2 { margin: 0; }
.inv.jobcard .jc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin: 8px 0; }
.inv.jobcard .jc-box { border: 1px solid #999; padding: 6px 8px; margin: 6px 0; }
.inv.jobcard .jc-terms { font-size: 9.5px; color: #333; margin-top: 8px; }
.inv.jobcard .jc-sign { display: flex; justify-content: space-between; margin-top: 26px; font-size: 10.5px; }
.inv.jobcard .jc-sign div { border-top: 1px solid #555; padding-top: 3px; min-width: 40%; text-align: center; }
.inv.jobcard .jc-cut { border-top: 1px dashed #777; margin: 10px 0 6px; text-align: center; font-size: 9px; color: #666; }
a.stat { color: inherit; text-decoration: none; display: block; } a.stat:hover { border-color: var(--primary); }
/* ---------- AMC contracts (v2.6) ---------- */
.amc-status { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: #e5e7eb; color: #374151; white-space: nowrap; }
.amc-status.active { background: #dcfce7; color: #166534; } .amc-status.upcoming { background: #dbeafe; color: #1e40af; }
.amc-status.expiring { background: #fef3c7; color: #92400e; } .amc-status.expiring.d7 { background: #fee2e2; color: #991b1b; }
.amc-status.expired { background: #fee2e2; color: #991b1b; } .amc-status.renewed { background: #ede9fe; color: #5b21b6; } .amc-status.cancelled { background: #e5e7eb; color: #6b7280; text-decoration: line-through; }
.amc-buckets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; margin-top: .4rem; }
.amc-bucket { display: flex; flex-direction: column; align-items: center; padding: .5rem .3rem; border-radius: var(--radius); border: 1px solid #e5e7eb; text-decoration: none; color: inherit; background: #fff; }
.amc-bucket b { font-size: 1.4rem; line-height: 1.1; } .amc-bucket span { font-size: .75rem; color: #6b7280; text-align: center; }
.amc-bucket.d7 { border-color: #fca5a5; background: #fef2f2; } .amc-bucket.d15 { border-color: #fdba74; background: #fff7ed; } .amc-bucket.d30 { border-color: #fde68a; background: #fffbeb; } .amc-bucket.exp { border-color: #d1d5db; background: #f9fafb; }
.inv .amc-period { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .4rem 1rem; margin: 8px 0; padding: 6px 8px; background: #f0f9ff; border: 1px solid #bae6fd; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.inv .amc-h { font-size: 1.05em; margin: 10px 0 0; }
.inv.amc-cert .jc-terms { margin-top: 10px; padding: 6px 8px; border: 1px solid #ddd; white-space: normal; }
.inv.a4.a5.amc-cert .amc-period { font-size: 9.5px; }
/* ---------- e-way bill export ---------- */
.ewb-doc { border-left: 4px solid #0f4c81; }
.ewb-err, .ewb-warn { margin: .4rem 0 0; padding-left: 1.1rem; font-size: .85rem; } .ewb-err { color: #b91c1c; } .ewb-warn { color: #92400e; }
.ewb-ok { color: #166534; font-weight: 600; margin-top: .4rem; font-size: .9rem; }
.sel-col { width: 2rem; text-align: center; }
@media (max-width: 520px) { .amc-buckets { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media print { .ewb-doc { display: none; } }
/* WhatsApp (v2.7) */
.wa-preview { background: #e7f8ee; border: 1px solid #b7e4c7; border-radius: 10px; padding: .6rem .8rem; margin: .5rem 0; white-space: pre-wrap; font-size: .92rem; }

/* WhatsApp Settings — businessman UI (phone preview) */
.wa-simple .wa-hero { display:flex; flex-wrap:wrap; gap:.75rem 1.2rem; align-items:center; margin-bottom:.8rem; }
.wa-simple .wa-toggle { display:flex; align-items:center; gap:.5rem; font-weight:600; font-size:1.05rem; }
.wa-phone {
  max-width: 340px; margin: .5rem 0 0; background: #0b141a; border-radius: 18px; padding: 10px 10px 14px;
  box-shadow: 0 8px 24px rgba(15,76,129,.18); border: 1px solid #1f2c34;
}
.wa-phone-bar { color: #8696a0; font-size: .68rem; text-align: center; margin-bottom: 8px; letter-spacing: .02em; }
.wa-bubble {
  background: #005c4b; color: #e9edef; border-radius: 8px 8px 2px 8px; padding: .65rem .75rem;
  white-space: pre-wrap; font-size: .84rem; line-height: 1.45; word-break: break-word;
  box-shadow: 0 1px 1px rgba(0,0,0,.2);
}
.wa-bubble-meta { display:flex; justify-content:flex-end; gap:.35rem; margin-top: .35rem; font-size: .65rem; color: #8696a0; }
.wa-bubble-doc { display:flex; align-items:center; gap:.45rem; background: rgba(0,0,0,.2); border-radius: 6px; padding: .4rem .5rem; margin-bottom: .45rem; font-size: .78rem; }
.wa-bubble-doc span { opacity: .9; }
.wa-purpose-card { border: 1px solid var(--border); border-radius: 12px; padding: .85rem 1rem; margin: .7rem 0; background: #fff; }
.wa-purpose-card h4 { margin: 0 0 .35rem; font-size: 1rem; }
.wa-status-pill { display:inline-block; font-size: .75rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; }
.wa-status-pill.ready { background: #dcfce7; color: #166534; }
.wa-status-pill.wait { background: #fef3c7; color: #92400e; }
.wa-status-pill.old { background: #fee2e2; color: #991b1b; }
.wa-status-pill.off { background: #f1f5f9; color: #64748b; }
.wa-adv { border: 1px dashed var(--border); border-radius: 10px; padding: .6rem .8rem; margin-top: 1rem; background: #fafbfc; }
.wa-adv summary { cursor: pointer; font-weight: 600; color: var(--muted); list-style: none; }
.wa-adv summary::-webkit-details-marker { display: none; }
.wa-adv summary::before { content: "▸ "; }
.wa-adv[open] summary::before { content: "▾ "; }
.wa-adv .table-wrap { margin-top: .5rem; }
@media (max-width: 1100px) {
  .wa-phone { max-width: 100%; }
}
.wa-purpose { border-top: 1px solid var(--border); padding: .6rem 0; }
.wa-purpose .table input:not([type=checkbox]) { padding: .25rem .4rem; font-size: .85rem; }
.table.compact td, .table.compact th { padding: .25rem .4rem; }
.wa-btn { white-space: nowrap; }
.cust-code { font-family: ui-monospace, monospace; }
.wa-purpose select { width: auto; display: inline-block; padding: .2rem .4rem; }
.wa-purpose .table input:not([type=checkbox]) { line-height: 1.5; min-height: 1.9rem; }

/* v2.8 smart type-ahead */
.results .r.rich { align-items: flex-start; }
.results .r.rich .units { color: #334155; margin-top: .1rem; }
.results .r.rich .then { color: var(--muted); }
.results .r.rich .right { text-align: right; white-space: nowrap; }
.results .r .lvl { font-size: .7rem; padding: 0 .35rem; border-radius: 4px; background: #e0f2fe; color: #075985; vertical-align: middle; }
.results .r .lvl.dealer { background: #fef3c7; color: #92400e; }
.results .r .stock { font-size: .8rem; font-weight: 600; }
.stock.ok { color: var(--ok, #15803d); } .stock.low { color: #b45309; } .stock.out { color: var(--err, #b91c1c); }
.warn-text { color: #b45309; font-weight: 600; }
.ok-text { color: #15803d; font-weight: 600; }
.badge.fifo { background: #dcfce7; color: #166534; font-size: .68rem; }
.cost-line { font-size: .78rem; color: #6b21a8; margin-top: .1rem; }
.search-wrap .eye { position: absolute; right: .4rem; top: 50%; transform: translateY(-50%); border: 0; background: transparent; cursor: pointer; font-size: 1.05rem; opacity: .75; padding: .2rem .35rem; }
.search-wrap .eye.off { opacity: .35; text-decoration: line-through; }
.line-readout { font-size: .76rem; color: var(--muted); margin-top: .15rem; }
.line-readout .c, .np-net, .np-pf { color: #6b21a8; }
.np-pf.neg { color: var(--err, #b91c1c); font-weight: 600; }
.line-readout .neg { color: var(--err, #b91c1c); font-weight: 600; }
.fifo-note { font-size: .76rem; color: #166534; margin-top: .15rem; }
.draft-note { font-size: .75rem; color: var(--muted); }

/* v2.9 */
.grid.cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid.cols-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.si-charges { margin-top: .6rem; border: 1px dashed var(--border); border-radius: 8px; padding: .4rem .6rem; }
.si-charges summary { cursor: pointer; }
.itc-line, .gst-ready { color: var(--muted); }
.gst-ready { margin-top: .4rem; }
.level-row .seg label span { padding: .25rem .7rem; }
/* v2.9 New Purchase fits 1024px (sidebar open): batch / expiry stacked, narrower inputs and cells */
@media (max-width: 1280px) {
  #siTable th, #siTable td { padding-left: .3rem; padding-right: .3rem; }
  #siTable td .row:has(input[data-f=batchNo]) { flex-wrap: wrap !important; }
  #siTable input[data-f=batchNo], #siTable input[data-f=expiry] { width: 132px !important; }
  #siTable input[data-f=cost], #siTable input[data-f=sellingPrice] { width: 80px !important; }
  #siTable input[data-f=qty] { width: 56px !important; }
  #siTable .item-cell { min-width: 0; }
  #siTable td.num .small { max-width: 104px; margin-left: auto; white-space: normal; line-height: 1.25; }
}
#siPayState { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#siPayState label span { padding-left: .3rem; padding-right: .3rem; }
.pay-modes:has(input[name=pay]) { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.pay-modes:has(input[name=pay]) label span { padding-left: .2rem; padding-right: .2rem; }
/* v2.9.1 scan not found: brief red flash on the search box */
input.scan-miss { animation: scanMiss .9s ease-out; }
/* v2.17.3 unknown scanned code → "Link to an existing item" (owner / manager) */
.scan-link { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: .35rem; padding: .35rem .6rem; border: 1px dashed var(--warn, #d97706); border-radius: 8px; background: var(--warn-bg, #fff7ed); font-size: .9rem; }
.scan-link[hidden] { display: none; }
.scan-link > span { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
@keyframes scanMiss { 0%, 40% { border-color: var(--err, #c62828); box-shadow: 0 0 0 3px rgba(198, 40, 40, .25); } 100% { box-shadow: none; } }

/* ===== v2.9.1 compact POS (1024×576 and up) ===== */
/* icon rail sidebar (desktop; ☰ toggles, remembered) */
@media (min-width: 861px) {
  .icon-btn { display: block; font-size: 1.25rem; padding: 0 .2rem; }
  body.rail { --nav-w: 58px; }
  body.rail .sidebar { padding: .45rem .3rem; }
  body.rail .sidebar a { justify-content: center; padding: .42rem 0; gap: 0; }
  body.rail .sidebar a > span, body.rail .sidebar a kbd { display: none; }
  body.rail .nav-h { font-size: 0; padding: .15rem 0; min-height: 6px; } body.rail .nav-h::after { display: none; }
  body.rail .nav-group.collapsed a:not(.active) { display: flex; }
}
/* slim daily-backup banner */
.topbanner { padding: .2rem 1rem; font-size: .82rem; gap: .5rem; }
.topbanner .btn { padding: .12rem .55rem; font-size: .78rem; min-height: 0; }
/* New Sale keeps tighter padding; width comes from main. */
body[data-route=billing] main { padding: .7rem .8rem; }
.pos { grid-template-columns: minmax(0, 1fr) 340px; gap: .7rem; }
@media (max-width: 1280px) { .pos { grid-template-columns: minmax(0, 1fr) 300px; } }
.pos > .card { padding: .75rem .85rem; }
.pos h2 { font-size: 1.15rem; }
.pos #posSearch { padding-top: .5rem; padding-bottom: .5rem; }
/* cart rows: name ≤ 2 lines, one meta line, one owner readout line */
.cart-table th, .cart-table td { padding: .38rem .32rem; }
.cart-table td.item-td { min-width: 180px; }
.cart-name { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.cart-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .45rem; margin-top: .1rem; }
.cart-meta .btn.small { padding: .05rem .45rem; font-size: .74rem; min-height: 0; }
.cart-meta .batch-sel { width: auto; max-width: 190px; padding: .1rem .3rem; font-size: .78rem; }
.cart-meta .fifo-note { margin-top: 0; }
.cart-meta .sn-chosen { font-family: ui-monospace, monospace; font-size: .74rem; }
.cart-table .line-readout { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: .1rem; max-width: 100%; }
.cart-table input[data-f=price] { width: 86px !important; }
.cart-table input[data-f=qty] { width: 56px !important; }
.cart-table input[data-f=discount] { width: 66px !important; }
.cart-table input { padding: .3rem .4rem; }
@media (max-width: 1280px) { .cart-table input[data-f=price] { width: 78px !important; } .cart-table input[data-f=discount] { width: 56px !important; } .cart-table th, .cart-table td { padding-left: .22rem; padding-right: .22rem; } }
/* side panel: sticky, its form scrolls, totals + Save always in view */
.pos-side { position: sticky; top: 62px; display: flex; flex-direction: column; padding: .7rem .8rem; }
.pos-side h3 { margin: 0 0 .3rem; font-size: 1rem; }
.pos-side .side-scroll { flex: 1 1 auto; min-height: 60px; overflow-y: auto; overscroll-behavior: contain; margin-right: -.45rem; padding-right: .45rem; }
.pos-side .side-foot { flex: 0 0 auto; border-top: 1px solid var(--border); margin-top: .35rem; padding-top: .15rem; background: var(--card, #fff); }
.pos-side .side-foot { position: relative; transition: box-shadow .15s; }
.pos-side .side-foot.more { box-shadow: 0 -9px 10px -8px rgba(15, 30, 60, .28); }
.pos-side label { margin-bottom: .1rem; font-size: .8rem; }
.pos-side input, .pos-side select { padding: .32rem .5rem; }
.pos-side .grid { gap: .4rem; }
.pos-side .row { margin: .35rem 0 !important; }
.pos-side .pay-modes span { padding: .3rem .15rem; font-size: .82rem; }
.pos-side .totals { margin: .2rem 0; font-size: .86rem; }
.pos-side .totals td { padding: .08rem 0; }
.pos-side .totals tr.grand td { font-size: 1.25rem; padding-top: .2rem; }
.pos-side .gst-ready { margin-top: .1rem; font-size: .74rem; }
.pos-side .btn.big { padding: .55rem .8rem; font-size: 1rem; }
.pos-side .side-foot > .row { margin: .3rem 0 !important; }
.cust-more { margin-top: .4rem; }
.cust-more > summary { cursor: pointer; font-size: .82rem; color: var(--primary); font-weight: 600; }
/* serial picker: one line per unit — serial · batch · purchase date · cost */
.sn-list { grid-template-columns: repeat(auto-fill, minmax(min(100%, 430px), 1fr)); }
.sn-list .sn { display: flex; align-items: center; gap: .5rem; white-space: nowrap; min-width: 0; }
.sn-list .sn .sn-no { flex: 0 0 auto; }
.sn-list .sn .sn-info { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cart-table .line-readout { contain: inline-size; }
.pos-side .row .check { font-size: .82rem; }
/* short screens: totals in two columns (Total full width) so the form keeps room */
@media (max-height: 820px) and (min-width: 901px) {
  .pos-side .totals tbody { display: grid; grid-template-columns: 1fr 1fr; column-gap: .9rem; }
  .pos-side .totals tr { display: flex; justify-content: space-between; gap: .3rem; min-width: 0; }
  .pos-side .totals tr.grand { grid-column: 1 / -1; }
  .pos-side .totals td { white-space: nowrap; }
  .pos-side .totals .lbl-x { display: none; }
  .pos-side .totals tr.owner-only { grid-column: 1 / -1; } /* "Net cost (incl GST)" / "Profit (after GST)" in full */
}
/* v2.9.2: the readout is one short line; on narrow screens it may run on under the (empty) space below the price / qty inputs */
.cart-table .line-readout { white-space: nowrap; overflow: visible; position: relative; z-index: 1; }
.pos-side .row:has(#interState) { flex-wrap: nowrap; gap: .5rem; margin: .3rem 0 !important; }
.pos-side .row:has(#interState) .check { font-size: .78rem; white-space: nowrap; }
.pos-side .level-row { margin: .2rem 0 .3rem !important; }
.pos-side .side-foot > .row:last-child { margin: .15rem 0 0 !important; font-size: .82rem; }
.pos-side > .row:first-child { margin: 0 !important; }

/* v2.10 manager role: refused owner-only attempts in the server activity list */
.audit-denied td { color: var(--err, #b91c1c); }
/* v2.12.0 owner recovery */
.owner-recovery > summary { cursor: pointer; list-style: revert; padding: .1rem 0; }
.owner-recovery[open] > summary { margin-bottom: .6rem; }
.rec-body .banner { margin: .2rem 0 .6rem; }
.rec-body .span-3 { grid-column: 1 / -1; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.rec-series { border: 1px solid var(--border); border-radius: 8px; padding: .5rem .7rem; margin: .6rem 0; }
.rec-series .check { display: flex; gap: .5rem; align-items: flex-start; margin: .35rem 0; font-weight: normal; }
.otp-input { font-size: 1.5rem; letter-spacing: .4em; max-width: 12rem; font-family: ui-monospace, monospace; }
.auth-card .owner-recovery { margin-top: .9rem; border-top: 1px solid var(--border); padding-top: .6rem; text-align: left; }
.auth-card .owner-recovery .grid { grid-template-columns: 1fr; }
.rec-body .banner { display: block; }
.ok-card { border-left: 4px solid var(--ok); }

/* ===================================================================== v2.13.0 phone layout (≤600px)
   Tables marked .m-cards become one card per row on a phone: the first cell (or td.m-main) on its own line, the
   other cells as "LABEL value" pairs that wrap. Labels come from the table's own header (ui.labelTables). Desktop unchanged. */
@media (max-width: 600px) {
  .topbar { gap: .35rem; padding: 0 .55rem; }
  .brand { font-size: 1rem; gap: .35rem; min-width: 0; white-space: nowrap; }
  .brand img { width: 24px; height: 24px; }
  .topbar .icon-btn, #lockBtn, #netStatus, #syncChip { flex-shrink: 0; }
  #lockBtn { padding: .25rem .5rem; }
  main { padding: .6rem; }
  #view > .row.between:first-child, #view > .banner + .row.between, #view > .banner + .banner + .row.between { flex-wrap: wrap; gap: .4rem; }
  #view > .row.between:first-child > .row, #view > .banner ~ .row.between > .row { gap: .35rem; flex-wrap: wrap; }
  #view > .row.between .btn { padding: .4rem .65rem; font-size: .88rem; }
  .card { padding: .75rem; }
  .card .row.between h3 { font-size: 1rem; }
  .stats { gap: .45rem; }
  .stat { padding: .6rem .65rem; min-width: 0; }
  .stat .label { font-size: .7rem; line-height: 1.25; }
  .stat .value { font-size: clamp(1rem, 5.2vw, 1.25rem); white-space: nowrap; letter-spacing: -.01em; }
  .stat .small { font-size: .74rem; line-height: 1.3; }
  .banner { padding: .55rem .7rem; font-size: .88rem; }

  .table.m-cards, .table.m-cards tbody { display: block; width: 100%; }
  .table.m-cards thead { display: none; }
  .table.m-cards tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .85rem; padding: .55rem .15rem; border-bottom: 1px solid var(--border); }
  .table.m-cards td { display: block; border: 0; padding: 0; text-align: left; min-width: 0; }
  .table.m-cards td:first-child, .table.m-cards td.m-main { flex: 1 0 100%; }
  .table.m-cards.m2 td:first-child { flex: 0 1 auto; order: 2; }
  .table.m-cards.m2 td:nth-child(2) { flex: 1 0 100%; order: 0; }
  .table.m-cards.m2 td:nth-child(n+3) { order: 1; }
  .table.m-cards td[data-l]:not(:first-child):not(.m-main)::before { content: attr(data-l); color: #64748b; font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; margin-right: .3rem; }
  .table.m-cards td.m-act { margin-left: auto; }
  .table.m-cards.m2 td:nth-child(2)::before { content: none !important; }
  .grid.m-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem; }
  .grid.m-filters > :first-child { grid-column: 1 / -1; }
  .table.m-cards td:empty, .table.m-cards td.hide-sm { display: none; }
  .table.m-cards td.empty, .table.m-cards td[colspan] { flex-basis: 100%; text-align: center; }
  .table.m-cards tr.low { background: #fffbeb; } .table.m-cards tr.low td { background: transparent; }
  .table.m-cards tr.cancelled { color: #9ca3af; }
  .table.m-cards .item-cell { align-items: flex-start; }
  .table-wrap:has(> .table.m-cards) { overflow-x: hidden; overflow-y: auto; }

  /* New Sale cart: name on top, price / qty / disc / amount in one labelled row, ✕ top right */
  .cart-table, .cart-table tbody { display: block; width: 100%; }
  .cart-table thead { display: none; }
  .cart-table tr { display: grid; grid-template-columns: 1.1rem minmax(0, 1.45fr) minmax(0, .8fr) minmax(0, .9fr) minmax(4.6rem, auto); gap: .2rem .4rem; padding: .5rem 0; border-bottom: 1px solid var(--border); align-items: end; }
  .cart-table tr.combo-comp { padding: .3rem 0; }
  .cart-table td { border: 0; padding: 0 !important; min-width: 0 !important; }
  .cart-table td:nth-child(1) { grid-row: 1; grid-column: 1; align-self: start; color: #64748b; font-size: .8rem; }
  .cart-table td:nth-child(2) { grid-row: 1; grid-column: 2 / 5; }
  .cart-table td:nth-child(8) { grid-row: 1; grid-column: 5; justify-self: end; align-self: start; }
  .cart-table td:nth-child(3) { grid-column: 2; } .cart-table td:nth-child(4) { grid-column: 3; } .cart-table td:nth-child(5) { grid-column: 4; }
  .cart-table td:nth-child(6) { display: none; }
  .cart-table td:nth-child(7) { grid-column: 5; text-align: right; font-weight: 700; white-space: nowrap; }
  .cart-table td[data-l]:nth-child(n+3):nth-child(-n+7)::before { content: attr(data-l); display: block; text-align: left; color: #64748b; font-size: .66rem; font-weight: 600; text-transform: uppercase; margin-bottom: .1rem; }
  .cart-table td:nth-child(7)[data-l]::before { text-align: right; }
  .cart-table input[data-f] { width: 100% !important; min-width: 0; }
  .cart-table .line-readout { white-space: normal; }
  .cart-table .cart-meta .batch-sel { max-width: 100%; }
  .cart-table tr.combo-comp td:nth-child(2) { padding-left: 0 !important; }
  .cart-table tr:has(> td.empty) { display: block; }
  .cart-table tr > td.empty { display: block; width: 100%; padding: 1.1rem .5rem !important; text-align: center; white-space: normal; }
  .pos #posSearch { padding-right: 2.2rem; }
  .pos .hint { font-size: .74rem; }
}

/* v2.13.0 Items → Bulk price update */
.bp-filters .span-2 { grid-column: span 2; }
.bp-checks { gap: .4rem 1.2rem; margin-top: .55rem; }
.bp-actions .row { gap: .45rem; align-items: center; }
.bp-actions select, .bp-actions input { width: auto; }
.bp-actions #bpKind { max-width: 15rem; } .bp-actions #bpRound { max-width: 11rem; }
.bp-filters select { min-width: 0; }
.bp-io { margin-top: .55rem; gap: .45rem; align-items: center; }
.bp-sum { margin-bottom: .45rem; gap: .5rem; }
.bp-wrap { max-height: calc(100vh - 220px); overflow: auto; }
.bp-table thead th { position: sticky; top: 0; z-index: 2; }
.bp-table td { vertical-align: top; }
.bp-table .bp-c { width: 1.6rem; text-align: center; }
.bp-table .bp-c input { min-width: 0; width: auto; }
.bp-name { font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.bp-table td.bp-item { min-width: 170px; max-width: 260px; }
.bp-table th { white-space: normal; line-height: 1.15; }
.bp-table .bp-in { width: 92px; min-width: 0; text-align: right; padding: .3rem .4rem; }
.bp-table .bp-dealer { width: 84px; }
.bp-table tr.bp-chg td { background: #eff6ff; }
.bp-table tr.bp-chg .bp-in[data-np] { border-color: var(--primary); font-weight: 700; }
.table tr.bp-below td, .bp-table tr.bp-below td { background: #fef2f2; }
.bp-table tr.bp-below .bp-in[data-np] { border-color: var(--err); color: var(--err); }
.bp-table tr.bp-mrp td { background: #fff7ed; }
.warn-t { color: #b45309; }
@media (max-width: 1280px) { .bp-table td, .bp-table th { padding-left: .28rem; padding-right: .28rem; } .bp-table td.bp-item { min-width: 140px; max-width: 220px; } .bp-table .bp-in { width: 80px; } .bp-table .bp-dealer { width: 70px; } .bp-table td .small { font-size: .74rem; } }
@media (max-width: 600px) {
  .bp-filters .span-2 { grid-column: 1 / -1; }
  .bp-actions .row > * { flex: 1 1 auto; }
  .bp-actions #bpX { width: 5.5rem !important; flex: 0 0 5.5rem; }
  .bp-wrap { max-height: none; overflow: visible; }
  .bp-table tr { position: relative; padding-left: 1.9rem !important; }
  .bp-table td.bp-c { position: absolute; left: .1rem; top: .6rem; }
  .bp-table td.bp-item { max-width: none; min-width: 0; }
  .bp-table .bp-in { width: 6.2rem; }
  .bp-table td.num > div.small { display: inline; margin-left: .3rem; }
  .bp-table td.bp-cost { flex: 1 0 100%; white-space: normal; }
  .bp-table td.bp-cost > div.small + div.small::before { content: '· '; }
  .bp-table tr.bp-chg, .bp-table tr.bp-chg td { background: #eff6ff; } .bp-table tr.bp-below, .bp-table tr.bp-below td { background: #fef2f2; }
  .bp-sum { flex-wrap: wrap; } .bp-sum .btn { width: 100%; }
}
.banner.error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }

/* v2.16 purchase labels */
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--hover, #f8fafc); }
#plPrintHost.print-only { display: none; }
body.printing-labels .topbar,
body.printing-labels #nav,
body.printing-labels #view,
body.printing-labels .no-print,
body.printing-labels dialog { display: none !important; }
body.printing-labels #plPrintHost.print-only { display: block !important; }
@media print {
  body.printing-labels #plPrintHost.print-only { display: block !important; }
  body.printing-labels .topbar,
  body.printing-labels #nav,
  body.printing-labels #view,
  body.printing-labels dialog { display: none !important; }
}

/* v2.17.0 AI calls (Sarvam): call log, transcript, follow-ups */
.calls-stats b { font-size: 1.25rem; }
.calls-table td { vertical-align: top; }
.calls-table td:nth-child(6) { min-width: 9rem; max-width: 15rem; }
.calls-table td:nth-child(1) { min-width: 5.5rem; }
.call-acts { display: flex; flex-direction: column; align-items: flex-start; gap: .25rem; }
.call-acts .btn { white-space: nowrap; }
.calls-table td:nth-child(4) { max-width: 13rem; }
.call-transcript { max-height: 45vh; overflow-y: auto; display: flex; flex-direction: column; gap: .35rem; padding: .5rem; background: var(--bg, #f8fafc); border-radius: var(--radius); }
.ct-line { max-width: 85%; padding: .35rem .6rem; border-radius: 10px; font-size: .9rem; background: #fff; border: 1px solid #e2e8f0; align-self: flex-start; overflow-wrap: anywhere; }
.ct-line.user { align-self: flex-end; background: #ecfdf5; border-color: #a7f3d0; }
.ct-who { display: block; font-size: .72rem; color: #64748b; font-weight: 600; }
#appPer[hidden], #appSingle[hidden] { display: none; }

/* Purchase entry and history: full sidebar fits 1024px; the summary stays reachable. Width is the shared full-page width. */
body[data-route=stockin] main, body[data-route=purchase-edit] main, body[data-route=purchases] main, body[data-route=purchase] main { min-width: 0; }
.purchase-page-heading { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: .5rem; margin-bottom: .8rem; }
.purchase-page-heading h2 { margin-bottom: .2rem; }
.purchase-page-heading p { margin: 0; }
.purchase-tabs { display: flex; gap: .35rem; flex-wrap: wrap; }
.purchase-workspace .card { padding: .85rem; margin-bottom: .65rem; }
.purchase-workspace .grid > div { min-width: 0; }
.purchase-workspace h3 { font-size: 1rem; margin-bottom: .6rem; }
.purchase-workspace .row.between h3 { margin-bottom: 0; }
.purchase-workspace .si-search-row { margin-top: .65rem; }
.purchase-workspace .si-modes { gap: .35rem .55rem; font-size: .8rem; }
.purchase-workspace .si-modes .seg span { padding: .25rem .45rem; }
.purchase-workspace .purchase-sheet-header { margin-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; border-bottom: 0; box-shadow: none; }
.purchase-workspace .purchase-sheet-items { border-radius: 0 0 var(--radius) var(--radius); border-top-color: #d7e1ed; }
.purchase-sheet-wrap { margin-top: .65rem; border: 1px solid var(--border); border-radius: 8px; }
.purchase-entry-table { table-layout: fixed; }
.purchase-entry-table col.purchase-col-item { width: 29%; }
.purchase-entry-table col.purchase-col-stock { width: 7%; }
.purchase-entry-table col.purchase-col-qty { width: 8%; }
.purchase-entry-table col.purchase-col-cost { width: 13%; }
.purchase-entry-table col.purchase-col-gst { width: 6%; }
.purchase-entry-table col.purchase-col-amount { width: 12%; }
.purchase-entry-table col.purchase-col-selling { width: 19%; }
.purchase-entry-table col.purchase-col-remove { width: 6%; }
.purchase-entry-table th { font-size: .7rem; white-space: normal; background: #edf3f9; color: #354960; }
.purchase-entry-table td { vertical-align: top; }
.purchase-entry-table tbody tr[data-i]:nth-child(even) { background: #f9fbfe; }
.purchase-entry-table tbody tr[data-i]:focus-within { background: #edf5ff; }
.purchase-entry-table tbody tr[data-i] > td { border-right: 1px solid #edf1f6; }
.purchase-entry-table tbody tr[data-i] > td:last-child { border-right: 0; text-align: center; }
.purchase-entry-table .item-cell { min-width: 0; max-width: none; align-items: flex-start; overflow-wrap: anywhere; font-size: .85rem; }
.purchase-entry-table .purchase-row-num { flex: 0 0 1.25rem; color: #64748b; font: 700 .72rem ui-monospace, Consolas, monospace; padding-top: .15rem; text-align: right; }
.purchase-entry-table .purchase-item-name { min-width: 0; line-height: 1.35; }
.purchase-entry-table .purchase-item-name strong { font-weight: 650; }
.purchase-entry-table .item-cell .small { font-size: .72rem; }
.purchase-entry-table .small { font-size: .7rem; }
.purchase-entry-table input[data-f] { width: 100% !important; min-width: 0; padding: .36rem .4rem; font-variant-numeric: tabular-nums; }
#siTable input[data-f=qty], #siTable input[data-f=cost], #siTable input[data-f=sellingPrice], #siTable .purchase-batch-fields input[data-f] { width: 100% !important; }
.purchase-entry-table input[data-f]:focus-visible { outline: 2px solid var(--primary-2); outline-offset: 0; border-color: var(--primary-2); }
.purchase-entry-table td.num { white-space: normal; font-variant-numeric: tabular-nums; }
.purchase-entry-table .amt { font-weight: 700; color: #173b5d; }
.purchase-line-details { margin-top: .3rem; max-width: 100%; }
.purchase-line-details summary { color: var(--primary); cursor: pointer; font-size: .72rem; font-weight: 600; }
.purchase-line-details summary:focus-visible { outline: 2px solid var(--primary-2); outline-offset: 2px; }
.purchase-batch-fields { display: grid; grid-template-columns: 1fr; gap: .3rem; margin-top: .3rem; }
.purchase-batch-fields input { width: 100% !important; }
.purchase-line-details .last-cost { margin-top: .3rem; line-height: 1.3; }
.purchase-sheet-items .si-newrow { margin-top: 0; border: 1px solid var(--border); border-top: 0; border-radius: 0 0 8px 8px; background: #f5f9fd; }
.purchase-sheet-items .si-newrow input { border: 0; background: transparent; }
.purchase-sheet-items .si-newrow input:focus { background: #fff; }
.purchase-payment-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr); }
.purchase-cost-option { margin-top: .75rem; }
.purchase-round { max-width: 26rem; margin-top: .65rem; }
.purchase-save-bar { position: sticky; bottom: 0; z-index: 10; background: var(--card); border: 1px solid var(--border); border-top: 3px solid var(--primary); border-radius: var(--radius); padding: .6rem .85rem; box-shadow: 0 -3px 10px rgba(16,24,40,.08); }
.purchase-save-totals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .4rem; }
.purchase-save-totals > div { min-width: 0; }
.purchase-save-totals span, .purchase-save-totals b { display: block; }
.purchase-save-totals b { font-size: 1rem; overflow-wrap: anywhere; }
.purchase-save-totals .purchase-grand b { color: var(--primary); font-size: 1.2rem; }
.purchase-save-actions { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-top: .5rem; padding-top: .5rem; border-top: 1px solid var(--border); }
.purchase-save-actions .btn { flex-shrink: 0; min-width: 9rem; }
.purchase-validation { padding: .5rem .65rem; border: 1px solid #fecaca; border-radius: 8px; background: #fef2f2; }
.purchase-filters .grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.3fr); gap: .55rem; }
.purchase-filter-foot { margin-top: .65rem; }
.purchase-history-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6rem; }
.purchase-history-stats .stat { padding: .75rem; }
.purchase-history-stats .value { font-size: 1.15rem; overflow-wrap: anywhere; }
.purchase-list-actions { margin-bottom: .65rem; }
.purchase-history-table th, .purchase-history-table td { padding: .5rem .35rem; }
.purchase-history-table .pur-invoice { min-width: 135px; max-width: 200px; overflow-wrap: anywhere; }
.purchase-invoice-link { display: block; margin-top: .15rem; }
.purchase-history-table .pur-items { min-width: 130px; max-width: 210px; overflow-wrap: anywhere; }
.purchase-history-table .pur-actions { display: flex; flex-direction: column; align-items: flex-start; gap: .25rem; }
.purchase-pagination { border-top: 1px solid var(--border); padding-top: .65rem; margin-top: .65rem; }
.purchase-reconciliation { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem .8rem; background: var(--bg); padding: .65rem; border-radius: 8px; margin-top: .7rem; font-size: .85rem; }
.rma-form .card h3 { margin: 0 0 .8rem; }
.rma-form .rma-wide { grid-column: 1 / -1; }
.rma-hero { border-top: 3px solid var(--primary); }
.rma-hero .row { align-items: flex-start; }
.rma-hero h2 { margin: .1rem 0; overflow-wrap: anywhere; }
.rma-hero-item { font-size: 1.06rem; font-weight: 650; margin: .25rem 0 .9rem; overflow-wrap: anywhere; }
.rma-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem 1rem; padding: .8rem 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.rma-summary > div { display: grid; gap: .15rem; min-width: 0; overflow-wrap: anywhere; }
.rma-summary span, .rma-ship-card dt { color: var(--muted); font-size: .78rem; }
.rma-summary strong, .rma-ship-card dd { font-size: .94rem; overflow-wrap: anywhere; }
.rma-claim { padding-top: .9rem; }
.rma-claim p, .rma-outcome p { margin: .3rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.rma-journey { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.rma-ship-card { min-width: 0; position: relative; border-top: 3px solid #9bb8d7; }
.rma-ship-card h3 { margin: 0 0 .65rem; padding-right: 2rem; }
.rma-step { position: absolute; top: .8rem; right: .9rem; width: 1.7rem; height: 1.7rem; border-radius: 50%; display: grid; place-items: center; color: var(--primary); background: #eaf2fb; font-size: .8rem; font-weight: 700; }
.rma-ship-card dl { margin: 0; display: grid; gap: .5rem; }
.rma-ship-card dl > div { display: grid; grid-template-columns: minmax(6rem, .8fr) minmax(0, 1.2fr); gap: .5rem; border-top: 1px solid var(--border); padding-top: .5rem; }
.rma-ship-card dd { margin: 0; font-weight: 650; }
.rma-return-type { font-size: .82rem; color: var(--primary); font-weight: 650; margin: -.2rem 0 .6rem; }
.rma-outcome { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.rma-outcome h3 { margin: 0; }
.rma-history { list-style: none; padding: 0 0 0 .8rem; margin: 0; border-left: 2px solid #c9d8e8; }
.rma-history li { padding: .35rem 0 .35rem .6rem; overflow-wrap: anywhere; }
.rma-history time { display: inline-block; color: var(--muted); margin-right: .5rem; }
.rma-list-table td { overflow-wrap: anywhere; }
.job-notes-field { grid-column: span 3; }
@media (max-width: 1100px) { .job-notes-field { grid-column: 1 / -1; } }
@media (max-width: 760px) { .rma-journey, .rma-outcome { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .rma-summary { grid-template-columns: 1fr; } .rma-hero .row { gap: .45rem; } }
.purchase-detail-head { display: grid; gap: .8rem; }
.purchase-detail-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; }
.purchase-detail-table td:last-child { overflow-wrap: anywhere; }
@media (max-width: 800px) {
  .purchase-detail-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .purchase-detail-table tr { gap: .35rem .7rem; }
  .purchase-detail-table td:first-child { display: none; }
  .purchase-detail-table td:nth-child(2) { font-weight: 650; overflow-wrap: anywhere; }
  .purchase-detail-table td:last-child { flex-basis: 100%; white-space: normal; }
  .purchase-detail-table td:last-child::before { display: block; margin-bottom: .15rem; }
}
@media (min-width: 601px) and (max-width: 1100px) {
  body[data-route=stockin] main, body[data-route=purchases] main, body[data-route=purchase-edit] main { padding: .75rem; }
  .purchase-page-heading { margin-bottom: .6rem; }
  .purchase-header label, .purchase-filters label { margin-bottom: .15rem; font-size: .8rem; }
  .purchase-header .grid, .purchase-filters .grid { gap: .45rem .65rem; }
  .purchase-header input, .purchase-filters input, .purchase-filters select { padding: .35rem .5rem; }
  .purchase-filters { padding: .7rem; }
  .purchase-filter-foot { margin-top: .45rem; }
  .purchase-history-stats .stat { padding: .55rem .65rem; }
  .purchase-history-stats .label { font-size: .7rem; }
  .purchase-history-stats .value { font-size: 1rem; }
  .purchase-save-totals .purchase-grand b { font-size: 1.1rem; }
  .purchase-filters .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .purchase-filters .grid > :first-child { grid-column: span 2; }
  .purchase-entry-table input[data-f=qty] { width: 50px !important; }
  .purchase-entry-table input[data-f=cost], .purchase-entry-table input[data-f=sellingPrice], .purchase-entry-table input[data-f=dealerPrice] { width: 74px !important; }
  .purchase-entry-table .item-cell { min-width: 130px; max-width: 170px; }
}
@media (max-width: 600px) {
  .purchase-filters .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .purchase-filters .grid > :first-child { grid-column: 1 / -1; }
  .purchase-history-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .purchase-payment-grid { grid-template-columns: 1fr; }
  .purchase-save-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .purchase-save-bar { padding: .5rem .65rem; }
  .purchase-save-totals b { font-size: .95rem; }
  .purchase-save-actions > span { font-size: .72rem; }
  .purchase-entry-table, .purchase-entry-table tbody { display: block; width: 100%; }
  .purchase-entry-table thead { display: none; }
  .purchase-entry-table tr[data-i] { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem .65rem; position: relative; padding: .7rem; margin-bottom: .5rem; border: 1px solid var(--border); border-radius: 8px; }
  .purchase-entry-table tr[data-i] > td, .purchase-entry-table tbody tr[data-i] > td { padding: 0; border: 0; min-width: 0; text-align: left; }
  .purchase-entry-table tr[data-i] > td:first-child { grid-column: 1 / -1; padding-right: 1.5rem; }
  .purchase-entry-table .item-cell { max-width: none; min-width: 0; }
  .purchase-entry-table tr[data-i] > td:last-child { position: absolute; right: .45rem; top: .45rem; }
  .purchase-entry-table td[data-l]:not(:first-child):not(:last-child)::before { content: attr(data-l); display: block; color: var(--muted); font-size: .7rem; margin-bottom: .15rem; }
  .purchase-entry-table input[data-f=qty], .purchase-entry-table input[data-f=cost], .purchase-entry-table input[data-f=sellingPrice], .purchase-entry-table input[data-f=dealerPrice] { width: 100% !important; }
  .purchase-entry-table tfoot { display: none; }
  .purchase-entry-table .small { max-width: none !important; margin-left: 0 !important; }
  .purchase-entry-table label.check { justify-content: flex-start !important; }
  .purchase-sheet-wrap { border: 0; overflow: visible; }
  .purchase-history-table tr[data-pid] { position: relative; padding-left: 1.8rem; }
  .purchase-history-table .sel-col { position: absolute; left: 0; top: .6rem; }
  .purchase-history-table td:first-child { flex: 0 0 auto; }
  .purchase-history-table .pur-invoice { max-width: none; min-width: 0; }
  .purchase-history-table .pur-items { flex-basis: 100%; min-width: 0; max-width: none; }
  .purchase-history-table .pur-actions { flex-direction: row; }
  .purchase-reconciliation { grid-template-columns: 1fr; }
}
/* Shop settings: compact sections and a reachable save action at shop-PC widths. */
body[data-route=settings] main { min-width: 0; }
.settings-heading p { margin: 0 0 .75rem; }
.settings-toolbar { position: sticky; top: 54px; z-index: 10; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem .75rem; margin-bottom: .8rem; box-shadow: 0 2px 6px rgba(16,24,40,.08); }
.settings-nav { display: flex; flex-wrap: wrap; gap: .3rem; }
.settings-nav .btn { min-height: 32px; }
.settings-save { display: flex; align-items: center; justify-content: space-between; gap: .6rem; border-top: 1px solid var(--border); padding-top: .5rem; margin-top: .5rem; }
.settings-save .btn { flex-shrink: 0; }
.settings-section { scroll-margin-top: 190px; }
.settings-section:focus { outline: 2px solid var(--primary); outline-offset: 2px; }
.settings-form .grid > div { min-width: 0; }
.settings-form .row:has(> .check) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem 1rem; margin-top: .75rem; }
.settings-form label.check { align-items: flex-start; line-height: 1.4; }
.settings-form label.check input { flex-shrink: 0; margin-top: .2rem; }
.settings-data > summary { cursor: pointer; font-weight: 600; }
.settings-data[open] > summary { margin-bottom: .75rem; }
#numberCard .table-wrap { max-width: 100%; }
#numberCard .table { min-width: 640px; }
#numberCard .f-prev, #numberCard .num-prev { overflow-wrap: anywhere; white-space: normal; }
@media (min-width: 601px) and (max-width: 1100px) {
  .settings-form .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .settings-toolbar { padding: .5rem; }
  .settings-nav { gap: .2rem; }
  .settings-nav .btn { font-size: .78rem; padding: .3rem .45rem; }
  .settings-form .row:has(> .check) { grid-template-columns: 1fr; }
  .settings-section { scroll-margin-top: 230px; }
}

/* v2.18.1: shared responsive fit across sales, purchase and settings. */
@media (max-width: 1100px) {
  .grid.cols-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-5 > :nth-child(3) { grid-column: 1 / -1; }
}
@media (min-width: 601px) and (max-width: 1200px) {
  .sales-table .sales-counter, .sales-table .sales-mode, .sales-table .sales-gst, .sales-table .sales-due { display: none; }
  .sales-table th, .sales-table td { padding-left: .4rem; padding-right: .4rem; }
}
@media (max-width: 900px) {
  .purchase-save-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .6rem; padding: .55rem .7rem; }
  .purchase-save-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  .purchase-save-totals > :nth-child(-n+2) { display: none; }
  .purchase-save-actions { margin: 0; padding: 0; border: 0; }
  .purchase-save-actions > span { display: none; }
  .purchase-save-actions .btn { min-width: 7.5rem; justify-content: center; }
}
@media (max-width: 600px) {
  .job-list-table tr { gap: .35rem .65rem; }
  .job-list-table td:first-child { font-size: 1rem; }
  .job-list-table td:nth-child(2), .job-list-table td:nth-child(3), .job-list-table td:nth-child(4) { flex-basis: 100%; overflow-wrap: anywhere; }
  .job-list-table td:nth-child(8) { margin-left: auto; }
  .rma-list-table tr { gap: .35rem .65rem; }
  .rma-list-table td:nth-child(2), .rma-list-table td:nth-child(3) { flex-basis: 100%; }
  .rma-list-table td:last-child { margin-left: auto; }
  .grid.cols-5 { gap: .55rem; }
  .settings-nav { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-width: thin; padding-bottom: .15rem; }
  .settings-nav .btn { flex: 0 0 auto; }
  .settings-section { scroll-margin-top: 160px; }
  .table.m-cards.sales-table tr { position: relative; padding: .75rem 2rem .75rem .2rem; gap: .3rem .75rem; }
  .table.m-cards.sales-table td.sel-col { position: absolute; top: .75rem; right: .25rem; margin: 0; }
  .table.m-cards.sales-table td:nth-child(2) { font-size: 1.02rem; font-weight: 700; }
  .table.m-cards.sales-table td:last-child { flex-basis: 100%; margin: .2rem 0 0; }
  .purchase-save-bar { gap: .35rem; }
  .purchase-save-totals { gap: .3rem; }
  .purchase-save-totals span { font-size: .68rem; }
  .purchase-save-totals b, .purchase-save-totals .purchase-grand b { font-size: .92rem; }
  .purchase-save-actions .btn { min-width: 6.8rem; padding: .5rem .6rem; }
}

/* v2.18.17: New Purchase as one spreadsheet — blue title, green section bars, grid cells. */
.purchase-excel { background: #fff; border: 1px solid #d5e0ec; border-radius: 8px; }
.px-top { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; background: #0f4c81; color: #fff; padding: .55rem .8rem; border-radius: 8px 8px 0 0; }
.px-top h2 { margin: 0; color: #fff; font-size: 1.15rem; font-weight: 750; }
.px-top h2 span { font-weight: 650; }
.px-top .purchase-tabs { margin: 0; }
.px-top a.btn { background: transparent; color: #fff; border-color: rgba(255,255,255,.45); }
.px-top a.btn.px-on { background: #fff; color: #0f4c81; border-color: #fff; }
.px-sub { margin: 0; padding: .45rem .8rem .15rem; color: #64748b; font-size: .9rem; }
.purchase-excel .banner { margin: .45rem .8rem 0; }
.purchase-excel .px-sec { background: transparent; border: 0; box-shadow: none; border-radius: 0; padding: 0; margin: 0; }
.px-sec-h { display: flex; justify-content: space-between; align-items: center; gap: .5rem; background: #e7f6ea; border-top: 1px solid #cfe8d4; border-bottom: 1px solid #cfe8d4; padding: .38rem .7rem; margin-top: .45rem; }
.px-sec-h h3 { margin: 0; font-size: .95rem; color: #14532d; font-weight: 750; }
.px-supplier { display: grid; grid-template-columns: minmax(132px, .9fr) minmax(0, 1.5fr) minmax(128px, .85fr) minmax(0, 1.3fr) minmax(108px, .7fr) minmax(0, 1.1fr); }
.px-supplier > * { min-width: 0; border-right: 1px solid #e4ecf4; border-bottom: 1px solid #e4ecf4; padding: .28rem .5rem; display: flex; align-items: center; }
.px-lab { background: #f6f8fb; color: #3e5168; font-size: .78rem; font-weight: 650; margin: 0; line-height: 1.25; }
.px-lab-note { display: block; font-weight: 500; font-size: .7rem; }
.px-val { background: #fff; }
.px-val input { border: 0; background: transparent; border-radius: 0; padding: .28rem .15rem; box-shadow: none; }
.px-val input:focus { outline: 2px solid #93c5fd; background: #fff; }
.px-itc { grid-column: span 2; background: #fff; color: #334155; font-size: .78rem; }
.purchase-excel .si-search-row, .purchase-excel .si-modes, .purchase-excel .px-hint, .purchase-excel .purchase-round, .purchase-excel .px-pay, .purchase-excel .purchase-cost-option, .purchase-excel .px-note { padding-left: .7rem; padding-right: .7rem; }
.purchase-excel .si-search-row { display: flex; gap: .5rem; align-items: center; margin: .45rem 0 .25rem; }
.purchase-excel .si-search-row .search-wrap { flex: 1; }
.purchase-excel .si-modes { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; margin-bottom: .35rem; }
.purchase-excel .si-modes .seg { display: inline-flex; width: auto; }
.purchase-excel .si-modes .seg span { padding: .22rem .45rem; font-size: .75rem; }
.purchase-excel .purchase-sheet-wrap { margin: 0; border: 0; border-radius: 0; overflow-x: auto; }
.purchase-excel .purchase-entry-table { table-layout: fixed; min-width: 0; }
.purchase-excel .purchase-col-num { width: 4%; }
.purchase-excel .purchase-col-item { width: 16%; }
.purchase-excel .purchase-col-hsn { width: 8%; }
.purchase-excel .purchase-col-batch { width: 16%; }
.purchase-excel .purchase-col-stock { width: 6%; }
.purchase-excel .purchase-col-qty { width: 6%; }
.purchase-excel .purchase-col-cost { width: 10%; }
.purchase-excel .purchase-col-gst { width: 5%; }
.purchase-excel .purchase-col-amount { width: 9%; }
.purchase-excel .purchase-col-selling { width: 12%; }
.purchase-excel .purchase-col-update { width: 8%; }
.purchase-excel .purchase-entry-table th { text-transform: none; letter-spacing: 0; background: #d9e7f6; color: #1e3a5f; font-size: .72rem; font-weight: 750; border: 1px solid #c5d6ea; white-space: normal; padding: .4rem .3rem; }
.purchase-excel .purchase-entry-table td { border: 1px solid #e3ebf3; padding: .28rem .32rem; vertical-align: middle; background: transparent; }
.purchase-excel .purchase-entry-table tbody tr[data-i]:nth-child(odd) { background: #fff; }
.purchase-excel .purchase-entry-table tbody tr[data-i]:nth-child(even) { background: #f4f8fc; }
.purchase-excel .purchase-entry-table tbody tr[data-i]:focus-within { background: #eaf3ff; }
.purchase-excel .purchase-entry-table input[data-f] { border: 1px solid transparent; background: transparent; border-radius: 4px; padding: .22rem .28rem; }
.purchase-excel .purchase-entry-table input[type=number] { text-align: right; -moz-appearance: textfield; appearance: textfield; }
.purchase-excel .purchase-entry-table input[type=number]::-webkit-outer-spin-button,
.purchase-excel .purchase-entry-table input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.purchase-excel .purchase-entry-table input[data-f]:focus { background: #fff; border-color: #93c5fd; }
.purchase-excel .purchase-entry-table .amt, .purchase-excel #siTotal { color: #1d4ed8; font-weight: 750; }
.purchase-excel .ps-num { text-align: center; white-space: nowrap; color: #64748b; font-weight: 750; }
.purchase-excel .ps-x { padding: 0 .15rem; font-size: .75rem; }
.purchase-excel .ps-item strong { display: block; font-weight: 650; line-height: 1.25; }
.purchase-excel .ps-item .btn { margin-top: .2rem; }
.purchase-excel .ps-hsn { font-variant-numeric: tabular-nums; }
.purchase-excel .ps-batch-fields { display: grid; gap: .15rem; }
.purchase-excel .ps-batch-fields input[data-f=expiry] { width: 100% !important; }
.purchase-excel .mode-btn, .purchase-excel .cost-other, .purchase-excel .sell-other, .purchase-excel .ps-now, .purchase-excel .batch-hint, .purchase-excel .last-cost { display: none; }
.purchase-excel .landed:empty { display: none; }
.purchase-excel .ps-upd { text-align: center; }
.purchase-excel .ps-upd input { width: auto; }
.purchase-excel .si-charges { margin: 0; }
.purchase-excel .si-charges summary { padding: .45rem .7rem; cursor: pointer; font-weight: 600; }
.purchase-excel .px-charges { padding: .45rem .7rem .6rem; }
.purchase-excel .purchase-round { max-width: none; margin: .35rem 0 .5rem; }
.purchase-excel .px-pay { padding-top: .55rem; padding-bottom: .2rem; }
.purchase-excel .purchase-cost-option { margin: .35rem 0 .7rem; }
.purchase-excel .purchase-save-bar { position: static; margin: .15rem .7rem .7rem; border: 2px solid #0f4c81; border-radius: 6px; box-shadow: none; }
.purchase-excel tfoot td { background: #f8fbfe; }
@media (max-width: 1100px) {
  .px-supplier { grid-template-columns: minmax(120px, 34%) minmax(0, 1fr) minmax(120px, 34%) minmax(0, 1fr); }
  .px-itc { grid-column: 1 / -1; }
  .purchase-excel .purchase-entry-table input[data-f=qty],
  .purchase-excel .purchase-entry-table input[data-f=cost],
  .purchase-excel .purchase-entry-table input[data-f=sellingPrice],
  .purchase-excel .purchase-entry-table input[data-f=dealerPrice] { width: 100% !important; }
}
.px-sec-tools { gap: .35rem; }
.col-menu { position: relative; }
.col-menu-btn { min-width: 2rem; padding: .15rem .4rem; font-size: 1.15rem; line-height: 1; background: #fff; }
.px-sec-h .col-menu-btn { border-color: #b7d7c0; color: #14532d; }
.col-menu-panel { position: absolute; right: 0; top: calc(100% + 4px); z-index: 40; width: max-content; min-width: 12.5rem; max-width: min(18rem, calc(100vw - 16px)); max-height: min(70vh, 28rem); overflow: auto; background: #fff; border: 1px solid #d7e3ef; border-radius: 8px; box-shadow: 0 12px 28px rgba(15, 35, 65, .18); padding: .35rem; }
.col-menu-panel[hidden] { display: none; }
.col-menu-title { font-size: .72rem; font-weight: 750; color: #3e5168; padding: .15rem .4rem .3rem; }
.col-menu-panel .check { margin: 0; font-size: .84rem; padding: .32rem .4rem; border-radius: 6px; }
.col-menu-panel .check:hover { background: #f4f8fc; }
.col-menu-panel .check input { width: auto; min-width: 0; margin-right: .4rem; }
.col-menu-note { margin: .25rem .4rem .15rem; font-size: .72rem; }
.bp-sheet { background: #fff; border: 1px solid #d5e0ec; border-radius: 8px; }
.bp-sheet .bp-filters, .bp-sheet .bp-actions, .bp-sheet .bp-sum, .bp-sheet #bpBatches { padding-left: .7rem; padding-right: .7rem; }
.bp-sheet .bp-filters { padding-top: .6rem; }
.bp-sheet .bp-actions { padding-top: .15rem; }
.bp-sheet .bp-sum { margin: 0; padding-top: .35rem; padding-bottom: .35rem; }
.bp-sheet #bpBatches { padding-bottom: .85rem; }
.bp-sheet .bp-wrap { margin: 0; border-radius: 0; border-left: 0; border-right: 0; }
.bp-sheet .bp-table thead th { background: #d9e7f6; color: #1e3a5f; text-transform: none; letter-spacing: 0; font-size: .72rem; }
.bp-sheet .bp-table tbody tr:nth-child(even):not(.bp-chg):not(.bp-below):not(.bp-mrp) td { background: #f4f8fc; }
.bp-table[data-hide~="cost"] [data-col="cost"],
.bp-table[data-hide~="price"] [data-col="price"],
.bp-table[data-hide~="margin"] [data-col="margin"],
.bp-table[data-hide~="newPrice"] [data-col="newPrice"],
.bp-table[data-hide~="newMargin"] [data-col="newMargin"],
.bp-table[data-hide~="wholesale"] [data-col="wholesale"],
.bp-table[data-hide~="mrp"] [data-col="mrp"] { display: none; }
@media (max-width: 600px) {
  .px-top { border-radius: 0; }
  .col-menu-panel { right: 0; left: auto; }
  .px-supplier { grid-template-columns: 1fr; }
  .px-lab { padding-bottom: .05rem; }
  .purchase-excel .purchase-entry-table tr[data-i] > td:first-child { grid-column: auto; position: static; padding-right: 0; }
  .purchase-excel .purchase-entry-table tr[data-i] > td:nth-child(2) { grid-column: 1 / -1; }
  .purchase-excel .purchase-entry-table tr[data-i] > td:last-child { position: static; }
  .purchase-excel .purchase-entry-table { width: 100%; min-width: 0 !important; table-layout: auto; }
  .purchase-excel .purchase-entry-table colgroup { display: none; }
  .purchase-excel .purchase-entry-table tr[data-i] { width: 100%; min-width: 0; }
  .purchase-excel .purchase-entry-table input[data-f]:not([type=checkbox]) { min-height: 36px; padding: .4rem .5rem; border-color: #cbd5e1; background: #fff; }
  .purchase-excel .purchase-entry-table td[data-col="updateWholesale"]::before { content: attr(data-l); display: block; color: var(--muted); font-size: .7rem; margin-bottom: .15rem; }
  .purchase-excel .purchase-entry-table .ps-upd input { min-width: 20px; min-height: 20px; }
}

@media (max-width: 360px) {
  .topbar .brand span, .topbar .app-ver-top { display: none; }
  .topbar .brand { flex: 0 1 auto; overflow: hidden; }
  .pos-side .row:has(#interState) { flex-wrap: wrap; gap: .35rem .65rem; }
  .pos-side .row:has(#interState) .check { white-space: normal; }
}
@media (max-width: 600px) {
  .warranty-filters { width: 100%; gap: .4rem; }
  .warranty-filters #wShow { flex: 1 0 100%; width: 100% !important; }
  .warranty-filters #wDays { width: 4.5rem !important; }
  .warranty-filters #wCsv { margin-left: auto; }
}

/* Desktop workspace: keep dense data views wide and make forms easy to scan. */
@media (min-width: 1101px) {
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stat { min-width: 0; }
  .stat .value { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
  .settings-toolbar { display: flex; align-items: center; gap: 1rem; }
  .settings-nav { flex: 1 1 auto; min-width: 0; }
  .settings-save { flex: 0 0 auto; border-top: 0; border-left: 1px solid var(--border); padding: 0 0 0 1rem; margin: 0; }
  .settings-form { max-width: 1440px; }
  .pos { grid-template-columns: minmax(0, 1fr) clamp(340px, 25vw, 410px); }
}
@media (min-width: 1320px) {
  .job-editor-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: 'customer device' 'estimate device'; gap: 1rem; align-items: start; }
  .job-editor-form > .card { margin-bottom: 0; }
  .job-editor-form .job-customer-card { grid-area: customer; }
  .job-editor-form .job-device-card { grid-area: device; }
  .job-editor-form .job-estimate-card { grid-area: estimate; }
  .job-editor-form .job-device-card .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .job-editor-form .job-estimate-card .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .job-editor-form .job-notes-field { grid-column: 1 / -1; }
}
@media (min-width: 601px) {
  table.table tbody tr:not(.low):not(.cancelled):hover td,
  table.table tbody tr:not(.low):not(.cancelled):focus-within td { background: #f4f8fc; }
}

/* v2.20 shop modules: fields of a module that is off for this shop (body.mod-off-<key>, set from the shop profile) */
body.mod-off-quotes .mod-quotes, body.mod-off-serials .mod-serials, body.mod-off-jobs .mod-jobs, body.mod-off-rma .mod-rma,
body.mod-off-amc .mod-amc, body.mod-off-labels .mod-labels, body.mod-off-combos .mod-combos, body.mod-off-eway .mod-eway,
body.mod-off-bulkprice .mod-bulkprice, body.mod-off-images .mod-images, body.mod-off-whatsapp .mod-whatsapp, body.mod-off-sarvam .mod-sarvam { display: none !important; }
.mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .35rem .8rem; }
