:root{
    --teal:#1A73E8; --teal-d:#1967D2; --teal-dd:#185ABC;
    --ink:#0F172A; --muted:#64748B; --line:#E2E8F0; --bg:#F1F5F9;
    --red:#DC2626; --red-bg:#FEF2F2; --amber:#D97706; --amber-bg:#FFFBEB; --green:#16A34A;
}
*{box-sizing:border-box;}
html,body{margin:0;padding:0;font-family:'Segoe UI',Roboto,-apple-system,sans-serif;background:var(--bg);color:var(--ink);}
/* No stray sideways scroll: nothing should push the page wider than the screen.
   (In-card tables keep their own horizontal scroll via .content table.) */
/* overflow-x:clip on the ROOT also clips fixed-position descendants (the
   off-canvas slide-out drawer), which overflow-x:hidden does NOT — that was
   letting the page scroll sideways and push the nav out of view. */
/* Both use overflow-x:clip (NOT hidden): clip stops sideways scroll and clips
   fixed off-canvas panels, without turning body into a scroll container - which
   `hidden` does, and that breaks the sticky top bar (it scrolls away). */
html{max-width:100%;overflow-x:clip;}
body{max-width:100%;overflow-x:clip;}
a{color:var(--teal-dd);}

/* PWA opening loader — a branded splash with a pulsing logo + turning spinner so
   the launch never looks frozen. Covers the blank moment after the OS splash
   while styles/scripts finish; removed by an inline script once the page is ready. */
.lp-splash{position:fixed;inset:0;z-index:100000;display:flex;flex-direction:column;
    align-items:center;justify-content:center;gap:16px;background:#fff;transition:opacity .4s ease;}
.lp-splash-gone{opacity:0;pointer-events:none;}
.lp-splash-logo{width:84px;height:84px;object-fit:contain;border-radius:20px;
    animation:lp-splash-pulse 1.1s ease-in-out infinite;}
.lp-splash-name{font-size:1.5rem;font-weight:800;color:var(--ink);letter-spacing:.3px;}
.lp-splash-name span{color:var(--teal);}
.lp-splash-spin{width:34px;height:34px;border:4px solid #E2E8F0;border-top-color:var(--teal);
    border-radius:50%;animation:lp-splash-spin .8s linear infinite;}
@keyframes lp-splash-pulse{0%,100%{transform:scale(.9);opacity:.72;}50%{transform:scale(1);opacity:1;}}
@keyframes lp-splash-spin{to{transform:rotate(360deg);}}

/* Top gradient header — mirrors the mobile app's topbar */
.topbar{background:linear-gradient(135deg,var(--teal),var(--teal-dd));color:#fff;
    display:flex;align-items:center;gap:14px;padding:14px 20px;position:sticky;top:0;z-index:20;}
.side-toggle{background:rgba(255,255,255,.18);border:none;color:#fff;cursor:pointer;
    width:38px;height:38px;border-radius:9px;font-size:1.2rem;display:flex;align-items:center;justify-content:center;}
.side-toggle:hover{background:rgba(255,255,255,.3);}
/* Toggle icon reflects state: on desktop a left chevron when the sidebar is open
   (click to collapse) and a right chevron when collapsed (click to expand); on a
   phone it's the hamburger that opens the drawer. */
.side-toggle .st-mobile,.side-toggle .st-collapsed{display:none;}
.side-toggle .st-expanded{display:inline-flex;}
body.side-collapsed .side-toggle .st-expanded{display:none;}
body.side-collapsed .side-toggle .st-collapsed{display:inline-flex;}
.brand{font-weight:800;font-size:1.12rem;display:flex;align-items:center;gap:8px;}
.brand .online{color:rgba(255,255,255,.75);font-weight:600;font-size:.82rem;}
/* Live connection pill in the top bar. */
.netpill{display:inline-flex;align-items:center;gap:5px;font-weight:700;font-size:.72rem;
    padding:3px 9px;border-radius:999px;white-space:nowrap;}
.netpill-on{background:rgba(255,255,255,.22);color:#fff;}
.netpill-off{background:#FEE2E2;color:#B91C1C;}
.netpill i{font-size:.85rem;}
.topbar .spacer{flex:1;}
.userbox{display:flex;align-items:center;gap:12px;font-size:.9rem;}
.userbox .shop{font-weight:700;}
.btn-install{display:inline-flex;align-items:center;gap:6px;background:#fff;border:none;color:var(--teal-dd,#185ABC);font-weight:700;font-size:.85rem;padding:7px 14px;border-radius:20px;cursor:pointer;box-shadow:0 1px 4px rgba(0,0,0,.12);}
.btn-install:hover{background:#EAF1FE;}
#lp-offline-bar{position:fixed;left:0;right:0;bottom:0;z-index:9997;background:#92400e;color:#fff;font-size:.82rem;font-weight:600;padding:10px 14px;text-align:center;display:flex;align-items:center;justify-content:center;gap:8px;}
.shop-switch{background:rgba(255,255,255,.18);color:#fff;border:1px solid rgba(255,255,255,.35);
    border-radius:9px;padding:7px 12px;font:inherit;font-weight:700;cursor:pointer;max-width:200px;white-space:nowrap;}
.userbox{flex-wrap:nowrap;}
.shop-switch option{color:var(--ink);}
.btn-link{background:rgba(255,255,255,.18);border:none;color:#fff;cursor:pointer;font:inherit;
    font-weight:600;padding:7px 12px;border-radius:9px;white-space:nowrap;display:inline-flex;align-items:center;gap:6px;}
.btn-link:hover{background:rgba(255,255,255,.3);}
.inline{display:inline;}

/* Shell: sidebar + content */
.shell{display:flex;align-items:flex-start;min-height:calc(100vh - 52px);}
.side{flex:0 0 208px;background:#fff;border-right:1px solid var(--line);padding:16px 12px 40px;min-height:calc(100vh - 52px);}
.side .grp{font-size:.7rem;font-weight:800;letter-spacing:.05em;text-transform:uppercase;color:var(--teal-dd);
    margin:16px 10px 6px;}
.side a{display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:10px;text-decoration:none;
    color:var(--ink);font-weight:600;font-size:.92rem;margin-bottom:2px;white-space:nowrap;}
.side a i{font-size:1.1rem;color:var(--muted);width:20px;text-align:center;}
.side a:hover{background:var(--bg);}
.side a.active{background:#EAF1FE;color:var(--teal-dd);}
.side a.active i{color:var(--teal-dd);}
.side .side-link{display:flex;align-items:center;gap:10px;width:100%;padding:10px 12px;border-radius:10px;border:none;background:none;cursor:pointer;color:var(--teal-dd);font-weight:600;font-size:.92rem;font-family:inherit;text-align:left;margin-bottom:2px;white-space:nowrap;}
.side .side-link i{font-size:1.1rem;color:var(--teal-dd);width:20px;text-align:center;}
.side .side-link:hover{background:#EAF1FE;}
.content{flex:1;min-width:0;padding:24px 16px;width:100%;}

/* Collapsed sidebar — icons only (like the mobile rail) */
body.side-collapsed .side{flex-basis:64px;overflow:hidden;}
body.side-collapsed .side a,
body.side-collapsed .side .side-link{justify-content:center;padding:11px 0;}
body.side-collapsed .side a span,
body.side-collapsed .side .side-link span,
body.side-collapsed .side a,
body.side-collapsed .side .side-link{font-size:0;}
body.side-collapsed .side a i,
body.side-collapsed .side .side-link i{font-size:1.2rem;}
body.side-collapsed .side .grp{font-size:0;margin:10px 0 2px;border-top:1px solid var(--line);}

h1{font-size:1.5rem;margin:0 0 4px;}
.sub{color:var(--muted);margin:0 0 20px;}

/* Cards (match mobile .pos-card) */
.card{background:#fff;border:1px solid var(--line);border-radius:14px;padding:18px;margin-bottom:16px;
    box-shadow:0 1px 3px rgba(0,0,0,.04);}
.card-head{display:flex;align-items:center;gap:8px;font-weight:700;margin-bottom:14px;color:var(--ink);}
.card-head i{color:var(--teal);}
.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:14px;margin-bottom:16px;}
.stat{background:#fff;border:1px solid var(--line);border-radius:14px;padding:16px;box-shadow:0 1px 3px rgba(0,0,0,.04);}
.stat .n{font-size:1.55rem;font-weight:800;}
.stat .l{color:var(--muted);font-size:.82rem;}

/* Forms (match mobile .pos-input / .pos-btn) */
label{display:block;font-size:.8rem;font-weight:700;color:var(--teal-dd);margin:12px 0 6px;}
input,select{width:100%;padding:11px 14px;border:1.5px solid var(--line);border-radius:12px;font:inherit;background:#fff;color:var(--ink);}
input:focus,select:focus{outline:none;border-color:var(--teal);box-shadow:0 0 0 3px rgba(26,115,232,.12);}
/* Give the native select a consistent chevron so it matches the app's look. */
select{-webkit-appearance:none;appearance:none;padding-right:40px;cursor:pointer;
    background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='4 6 8 10 12 6'/></svg>");
    background-repeat:no-repeat;background-position:right 13px center;}
.row{display:flex;gap:12px;flex-wrap:wrap;}
.row > *{flex:1;min-width:160px;}

/* Custom autocomplete (replaces the browser's unstylable <datalist> popup so
   name suggestions match the app's look, like the native inventory form). */
.lp-ac{position:absolute;z-index:40;left:0;right:0;top:calc(100% + 4px);background:#fff;
    border:1.5px solid var(--line);border-radius:12px;box-shadow:0 8px 24px rgba(0,0,0,.12);
    max-height:220px;overflow-y:auto;display:none;padding:4px;}
.lp-ac.open{display:block;}
.lp-ac-item{padding:10px 12px;border-radius:8px;cursor:pointer;font-size:.92rem;color:var(--ink);
    white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.lp-ac-item:hover,.lp-ac-item.active{background:rgba(26,115,232,.1);color:var(--teal-dd);}

/* Custom select — a themed dropdown that replaces the OS picker (the dark,
   radio-button list) on EVERY <select> so the look is consistent everywhere.
   The real <select> stays in the DOM (hidden) to carry the value on submit. */
select.lp-sel-native{display:none !important;}
.lp-sel{position:relative;width:100%;}
.lp-sel-btn{width:100%;display:flex;align-items:center;justify-content:space-between;gap:10px;
    padding:11px 14px;border:1.5px solid var(--line);border-radius:12px;background:#fff;color:var(--ink);
    font:inherit;text-align:left;cursor:pointer;}
.lp-sel-btn:focus{outline:none;border-color:var(--teal);box-shadow:0 0 0 3px rgba(26,115,232,.12);}
.lp-sel-val{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.lp-sel-cv{flex:0 0 auto;color:#64748B;font-size:.8rem;transition:transform .15s ease;}
.lp-sel.open .lp-sel-cv{transform:rotate(180deg);}
.lp-sel-menu{position:absolute;z-index:50;left:0;right:0;top:calc(100% + 4px);background:#fff;
    border:1.5px solid var(--line);border-radius:12px;box-shadow:0 10px 28px rgba(0,0,0,.14);
    max-height:260px;overflow-y:auto;display:none;padding:4px;}
.lp-sel.open .lp-sel-menu{display:block;}
.lp-sel-opt{padding:10px 12px;border-radius:8px;cursor:pointer;font-size:.92rem;color:var(--ink);
    white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.lp-sel-opt:hover,.lp-sel-opt.active{background:rgba(26,115,232,.1);color:var(--teal-dd);}
.lp-sel-opt.sel{font-weight:700;}
/* Inside a floating-label .field the trigger must fill the box like an input. */
.field > .lp-sel .lp-sel-btn{padding:14px;}
/* In the table toolbar keep the page-size picker compact. */
.lp-tbar .lp-sel{width:auto;min-width:120px;}

/* Floating-label field — saves vertical space, used across all forms */
/* Matches the mobile app's .float-field: label rests inside, floats up to sit on
   the border (a white "notch") when focused/filled. */
.field{position:relative;margin-top:16px;}
.field > input,.field > select,.field > textarea{width:100%;padding:14px;border:1.5px solid var(--line);
    border-radius:12px;font:inherit;background:#fff;color:var(--ink);}
/* The shorthand background:#fff above wipes the global select chevron, leaving a
   bare box (appearance:none removes the native arrow). Restore the chevron here. */
.field > select{padding-right:40px;
    background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='4 6 8 10 12 6'/></svg>");
    background-repeat:no-repeat;background-position:right 13px center;}
.field > input::placeholder,.field > textarea::placeholder{color:transparent;}
.field > input:focus::placeholder,.field > textarea:focus::placeholder{color:#94A3B8;}
.field > input:focus,.field > select:focus,.field > textarea:focus{outline:none;border-color:var(--teal);box-shadow:0 0 0 3px rgba(26,115,232,.12);}
.field > label{position:absolute;left:10px;top:13px;margin:0;color:var(--muted);font-size:.95rem;font-weight:500;
    pointer-events:none;transition:top .14s ease,font-size .14s ease,color .14s ease;
    padding:0 5px;background:#fff;border-radius:5px;max-width:calc(100% - 20px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.field > input:focus ~ label,
.field > input:not(:placeholder-shown) ~ label,
.field > input:-webkit-autofill ~ label,
.field > textarea:focus ~ label,
.field > textarea:not(:placeholder-shown) ~ label,
.field > select ~ label{top:-8px;font-size:.7rem;color:var(--teal-dd);font-weight:700;}
.field.check{display:flex;align-items:center;gap:10px;margin-top:14px;}
.field.check input{width:auto;}
.field.check label{position:static;font-size:.9rem;color:var(--ink);font-weight:500;pointer-events:auto;background:none;padding:0;}
.field .pw-eye{position:absolute;right:8px;top:50%;transform:translateY(-50%);background:none;border:none;
    color:var(--muted);cursor:pointer;width:auto;padding:6px;font-size:1.05rem;}
.field .pw-eye:hover{color:var(--teal);}

/* Modal */
/* Above the mobile sidebar (60), its backdrop (55) and the fixed offline bar (9997)
   so a modal and its buttons are always tappable on a phone; below SweetAlert (99999). */
.modal-back{position:fixed;inset:0;background:rgba(15,23,42,.45);display:none;align-items:flex-start;
    justify-content:center;padding:40px 16px;z-index:10000;overflow-y:auto;}
.modal-back.open{display:flex;}
.modal{background:#fff;border-radius:16px;padding:22px;width:100%;max-width:640px;box-shadow:0 20px 50px rgba(0,0,0,.25);}
.modal .m-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px;}
.modal .m-head h3{margin:0;font-size:1.15rem;display:flex;align-items:center;gap:8px;}
.modal .m-x{background:none;border:none;font-size:1.3rem;color:var(--muted);cursor:pointer;width:auto;padding:4px;}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;border:none;padding:9px 16px;border-radius:11px;
    font:inherit;font-weight:700;font-size:.9rem;cursor:pointer;text-decoration:none;
    background:linear-gradient(135deg,var(--teal),var(--teal-d));color:#fff;box-shadow:0 3px 10px rgba(26,115,232,.25);transition:background .12s,filter .12s;}
.btn:hover{filter:brightness(1.05);}
/* Flat, borderless secondary button: a soft brand tint instead of an outline. */
.btn-ghost{background:rgba(26,115,232,.09);color:var(--teal-dd);border:none;box-shadow:none;}
.btn-ghost:hover{background:rgba(26,115,232,.17);filter:none;}
.btn-danger{background:var(--red);box-shadow:none;}
.btn-sm{padding:7px 12px;font-size:.84rem;border-radius:9px;}

/* Tables */
table{width:100%;border-collapse:collapse;}
th,td{text-align:left;padding:11px 12px;border-bottom:1px solid var(--line);font-size:.9rem;}
th{color:var(--muted);font-size:.74rem;text-transform:uppercase;letter-spacing:.03em;}
td.num,th.num{text-align:right;}
/* DataTables' own stylesheet forces headers left; keep numeric headers aligned
   with their (right-aligned) values. Higher specificity than table.dataTable thead th. */
table.dataTable thead th.num{text-align:right;}
table.dataTable thead th.nosort{text-align:right;}
/* Responsive table toolbar + pager (our DataTables replacement). */
.lp-tbar{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-bottom:12px;}
.lp-tsearch{flex:1 1 160px;min-width:0;padding:10px 12px;border:1.5px solid var(--line);border-radius:10px;font:inherit;background:#fff;}
.lp-tsearch:focus{outline:none;border-color:var(--teal);box-shadow:0 0 0 3px rgba(26,115,232,.12);}
.lp-tsize{flex:0 0 auto;width:auto;max-width:150px;}
.lp-tpager{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;margin-top:12px;}
.lp-tinfo{font-size:.82rem;color:var(--muted);}
.lp-tnav{display:flex;align-items:center;gap:8px;}
.lp-tnav button{min-width:38px;height:34px;border:1.5px solid var(--line);background:#fff;border-radius:9px;font-size:1.2rem;line-height:1;color:var(--teal-dd);cursor:pointer;}
.lp-tnav button:disabled{opacity:.4;cursor:default;}
.lp-tpage{font-size:.85rem;color:var(--ink);font-weight:700;min-width:54px;text-align:center;}
/* A compact two-line cell: bold primary with a muted secondary line beneath
   (e.g. product name over its barcode) so columns can be combined. */
.cell-stack{display:flex;flex-direction:column;gap:1px;}
.sub2{font-size:.85em;color:var(--muted);font-weight:400;}
.sale-prod{padding:1px 0;}
/* Tight icon-only action buttons for table rows. */
.btn-icon{padding:7px 9px;max-width:none;}
.row-actions{display:flex;gap:6px;justify-content:flex-end;flex-wrap:wrap;}
/* Compact labelled action button (icon + short word) for table rows. */
.btn-act{padding:5px 9px;font-size:.74rem;gap:5px;max-width:none;white-space:nowrap;}
.btn-act i{font-size:.95rem;}
/* Segmented control (e.g. Sell category: All / Stock / Services) */
.seg{display:inline-flex;gap:4px;background:#EEF2F7;border:1px solid var(--line);border-radius:10px;padding:4px;flex-wrap:wrap;}
.seg-btn{border:none;background:transparent;color:var(--muted);font:inherit;font-weight:700;font-size:.84rem;
    padding:7px 14px;border-radius:7px;cursor:pointer;display:inline-flex;align-items:center;gap:6px;}
.seg-btn.active{background:#fff;color:var(--ink);box-shadow:0 1px 3px rgba(8,28,66,.12);}

.badge{display:inline-block;font-size:.72rem;font-weight:700;padding:2px 9px;border-radius:999px;background:#F1F5F9;color:var(--muted);}
.badge-red{background:var(--red-bg);color:var(--red);}
.badge-amber{background:var(--amber-bg);color:var(--amber);}
.badge-green{background:#DCFCE7;color:var(--green);}
.badge-section{background:#EAF1FE;color:var(--teal-dd);font-weight:600;}
.badge-section i{font-size:.68rem;}
/* Tiny "section" tag on Sell product tiles - compact, doesn't crowd the tile. */
.pn-sec{display:inline-block;font-size:.62rem;font-weight:600;color:var(--teal-dd);background:#EAF1FE;border-radius:6px;padding:0 6px;margin-left:6px;vertical-align:middle;white-space:nowrap;}
.pn-sec i{font-size:.58rem;}

/* Messages */
.msg{padding:11px 14px;border-radius:12px;margin-bottom:14px;font-size:.9rem;}
.msg-err{background:var(--red-bg);border:1px solid #FECACA;color:#991B1B;}
.msg-ok{background:#F0FDF4;border:1px solid #BBF7D0;color:#166534;}
/* Persistent inline info banner (NOT turned into a toast like .msg is). */
.info-note{display:flex;gap:10px;align-items:flex-start;background:#EFF6FF;border:1px solid #BFDBFE;
    color:#1E3A8A;border-radius:12px;padding:12px 14px;margin-bottom:14px;font-size:.88rem;line-height:1.4;}
.info-note i{margin-top:2px;}
.info-note a{color:#1D4ED8;font-weight:600;}
.empty{text-align:center;color:var(--muted);padding:34px;}
code{background:#F1F5F9;padding:2px 8px;border-radius:7px;font-weight:700;}

/* Sell (point of sale) */
.prod-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:10px;}
.prod{text-align:left;background:#fff;border:1px solid var(--line);border-radius:14px;padding:13px 14px;cursor:pointer;
    display:flex;flex-direction:column;gap:7px;font:inherit;box-shadow:0 1px 2px rgba(8,28,66,.05);
    transition:border-color .14s,box-shadow .14s;}
/* Hover highlight only on devices that truly hover (mouse) - so a tap on a phone
   doesn't leave tiles stuck in a shifted "hover" state. No transform = no jump. */
@media (hover:hover){ .prod:hover{border-color:var(--teal);box-shadow:0 5px 14px rgba(26,115,232,.15);} }
.prod:active{border-color:var(--teal);}
.prod .pn{font-weight:700;color:var(--ink);line-height:1.25;}
.prod .pp{display:flex;align-items:baseline;justify-content:space-between;gap:8px;margin-top:auto;}
.prod .pp-price{font-weight:800;font-size:.95rem;color:var(--teal-dd);white-space:nowrap;}
.prod .pp-stock{font-size:.72rem;color:var(--muted);white-space:nowrap;}
.cart-line{display:flex;align-items:center;gap:8px;padding:8px 0;border-bottom:1px solid var(--line);font-size:.9rem;}
.qbtn{width:30px;height:30px;border:1px solid var(--line);background:#fff;border-radius:8px;cursor:pointer;
    font-weight:700;color:var(--ink);display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;}
.qbtn:hover{border-color:var(--teal);color:var(--teal);}
.qv{min-width:42px;text-align:center;font-weight:700;}
/* Current-sale cart as a compact table (rows, like the rest of the app). */
.cart-table{width:100%;border-collapse:collapse;font-size:.88rem;}
.cart-table td{padding:8px 6px;border-bottom:1px solid var(--line);vertical-align:middle;}
.cart-table td:first-child{padding-left:0;width:100%;}
.cart-table td:last-child{padding-right:0;}
.cart-table td.num{text-align:right;white-space:nowrap;}
.cart-table .cart-qty{text-align:center;}
.qstep{display:inline-flex;align-items:center;gap:4px;}
.qstep .qv{min-width:28px;}
.cart-total{display:flex;justify-content:space-between;font-weight:800;font-size:1.1rem;padding:12px 0 2px;border-top:2px solid var(--line);margin-top:4px;}
/* Service-sale cart rows (Services page). The Sell page styles its own cart. */
.cart-row{display:flex;align-items:center;gap:10px;padding:10px 0;border-bottom:1px solid var(--line);}
.cart-row:last-child{border-bottom:0;}
.cart-row .cr-main{flex:1;min-width:0;}
.cart-row .cr-name{font-weight:600;font-size:.9rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.cart-row .cr-sub{font-size:.76rem;color:var(--muted);}
.cart-row .cr-qty{display:inline-flex;align-items:center;gap:6px;flex:0 0 auto;}
.cart-row .cr-qty button{width:28px;height:28px;border:1px solid var(--line);background:#fff;border-radius:8px;cursor:pointer;font-size:1rem;line-height:1;display:flex;align-items:center;justify-content:center;color:var(--ink);padding:0;}
.cart-row .cr-qty button:hover{background:#f1f5f9;}
.cart-row .cr-qty span{min-width:18px;text-align:center;font-weight:600;font-size:.85rem;}
.cart-row .cr-tot{flex:0 0 auto;font-weight:700;font-size:.85rem;min-width:60px;text-align:right;}
.cart-row .cr-x{flex:0 0 auto;border:0;background:transparent;color:#b91c1c;cursor:pointer;font-size:1.05rem;line-height:1;padding:4px 6px;border-radius:7px;}
.cart-row .cr-x:hover{background:#fee2e2;}
/* Cart line: name (grows + shrinks), qty, line total, and the discount/remove
   actions — all on one row when the card is wide enough. Because the name column
   can shrink (flex min-width:0), the row never overflows the card, so the action
   buttons can't be pushed past the edge. When the cart card is too narrow for
   everything to sit comfortably on one line, the actions drop to their own
   right-aligned row beneath (container query on the card). */
.current-sale{padding:14px;container-type:inline-size;}
.cart-lines{display:flex;flex-direction:column;}
.cl{padding:8px 0;border-bottom:1px solid var(--line);}
.cl:last-child{border-bottom:none;}
.cl-top{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px;}
.cl-name{flex:1 1 auto;min-width:0;}
.cl-name .sub2{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.cl-qty{flex:0 0 auto;}
.cl-net{flex:0 0 auto;font-weight:700;white-space:nowrap;}
.cl-acts{flex:0 0 auto;display:flex;gap:6px;}
.cl-acts .btn-icon{padding:5px 9px;}
/* Keep the qty stepper snug in the narrow cart column. */
.cl-qty .qstep{gap:3px;}
.cl-qty .qbtn{width:28px;height:28px;}
.cl-qty .qstep .qv{min-width:22px;}
/* Only when the cart card itself is narrow: put the actions on their own line. */
@container (max-width:300px){
    .cl-acts{flex-basis:100%;justify-content:flex-end;margin-top:2px;}
}

/* Restock option rows (radio + label). */
.rs-opt{display:flex;align-items:flex-start;gap:9px;cursor:pointer;font-weight:500;color:var(--ink);}
.rs-opt input{width:auto;margin-top:3px;flex:0 0 auto;}

/* Collapsible "get the app" fold on the signup page (closed by default). */
.apps-fold{border:1px solid var(--line);border-radius:12px;padding:0 12px;background:#fff;}
.apps-fold > summary{list-style:none;cursor:pointer;padding:11px 0;font-weight:600;font-size:.86rem;
    color:var(--teal-dd);display:flex;align-items:center;gap:8px;}
.apps-fold > summary::-webkit-details-marker{display:none;}
.apps-fold > summary::after{content:"\F282";font-family:"bootstrap-icons";margin-left:auto;transition:transform .15s;}
.apps-fold[open] > summary::after{transform:rotate(180deg);}
.apps-fold[open]{padding-bottom:12px;}

/* Grouped permission picker (role editor) */
.perm-grp{margin-top:12px;}
.perm-grp-h{font-size:.72rem;font-weight:800;letter-spacing:.05em;text-transform:uppercase;color:var(--teal-dd);
    margin:0 0 8px;padding-bottom:4px;border-bottom:1px solid var(--line);}
.perm-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px 16px;}
.perm-item{display:flex;gap:9px;align-items:flex-start;margin:0;font-weight:500;color:var(--ink);cursor:pointer;}
.perm-item input{width:auto;margin-top:3px;flex:0 0 auto;}
.perm-text{display:flex;flex-direction:column;line-height:1.3;}
.perm-hint{font-size:.72rem;font-weight:400;color:var(--muted);margin-top:2px;}
@media (max-width:620px){ .perm-grid{grid-template-columns:1fr;} }

/* Roles as cards with the actions at the bottom (reads well on mobile). */
.rolelist{display:flex;flex-direction:column;gap:10px;}
.rolecard{border:1px solid var(--line);border-radius:12px;padding:12px 14px;background:#fff;}
.rolecard-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:6px;}
.rolecard-perms{font-size:.82rem;color:var(--muted);line-height:1.5;margin-bottom:12px;}
.rolecard-acts{display:flex;gap:8px;}
.rolecard-acts>.btn,.rolecard-acts>form{flex:1;}
.rolecard-acts>form{display:flex;margin:0;}
.rolecard-acts>form>.btn{width:100%;}

/* Themed feedback toast (lpToast via SweetAlert2) - a floating card that matches
   the app, not a plain box hanging off the top bar. */
.swal2-container{z-index:99999;}
.swal2-container.swal2-top-end{padding:16px 16px 0 0;}
/* Small white card with a coloured border (no big SweetAlert icon). Success/info
   get a blue border - compact and friendly, not a big green success splash. */
.swal2-toast.lp-toast{
    font-family:'Segoe UI',Roboto,-apple-system,sans-serif;
    border-radius:12px;background:#fff;padding:11px 15px;border:1.5px solid var(--teal);
    box-shadow:0 8px 24px rgba(15,23,42,.16);max-width:300px;
}
.swal2-toast.lp-toast .swal2-title{font-size:.85rem;font-weight:600;color:var(--ink);margin:0;padding:0;line-height:1.35;}
.swal2-toast.lp-toast .swal2-icon{display:none!important;}   /* keep it small - no big tick/cross */
.swal2-toast.lp-toast.lp-ok,.swal2-toast.lp-toast.lp-info{border-color:var(--teal);}
.swal2-toast.lp-toast.lp-err{border-color:var(--red);}
.swal2-toast.lp-toast.lp-warn{border-color:var(--amber);}
.swal2-toast.lp-toast.lp-ok .swal2-timer-progress-bar,
.swal2-toast.lp-toast.lp-info .swal2-timer-progress-bar{background:var(--teal);}
.swal2-toast.lp-toast.lp-err .swal2-timer-progress-bar{background:var(--red);}
.swal2-toast.lp-toast.lp-warn .swal2-timer-progress-bar{background:var(--amber);}

/* Sales "details" view: each product is its own row; the first row of a sale
   gets a heavier top border so the sale groups visually, and the repeated
   date/time/seller on continuation rows are muted to cut the noise. */
tr.sale-start > td{border-top:2px solid var(--line);}
tr.sale-cont > td:nth-child(-n+3){color:var(--muted);font-weight:400;}

/* Login (centered, no sidebar) */
.auth{max-width:390px;margin:60px auto;padding:0 16px;}

/* Full-screen branded auth background — fixed to the viewport, card centered */
.auth-bg{position:fixed;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:safe center;
    padding:30px 16px;overflow-x:hidden;overflow-x:clip;overflow-y:auto;-webkit-overflow-scrolling:touch;
    background:linear-gradient(135deg,#1A73E8 0%,#185ABC 55%,#0F3E86 100%);}
/* Soft decorative bubbles */
.auth-bg::before,.auth-bg::after{content:"";position:absolute;border-radius:50%;
    background:rgba(255,255,255,.07);pointer-events:none;}
.auth-bg::before{width:420px;height:420px;top:-120px;left:-100px;}
.auth-bg::after{width:320px;height:320px;bottom:-110px;right:-80px;}
.auth-hero{position:relative;text-align:center;color:#fff;margin-bottom:22px;z-index:1;}
.auth-hero .logo{width:76px;height:76px;border-radius:50%;background:#fff;overflow:hidden;
    display:inline-flex;align-items:center;justify-content:center;margin-bottom:12px;
    box-shadow:0 6px 18px rgba(0,0,0,.18);}
.auth-hero .logo img{width:100%;height:100%;object-fit:cover;border-radius:50%;}
.auth-hero h1{margin:0;font-size:1.7rem;font-weight:800;letter-spacing:-.01em;}
.auth-hero h1 span{color:#8ec5ff;}
.auth-hero p{margin:4px 0 0;color:rgba(255,255,255,.82);font-size:.92rem;}
.auth-card{position:relative;z-index:1;width:100%;max-width:400px;background:#fff;border-radius:18px;
    padding:26px 24px;box-shadow:0 24px 60px rgba(8,28,66,.35);}
.auth-card .card-head{font-size:1.05rem;}
.auth-card .btn{box-shadow:none;}
.auth-foot{text-align:center;color:rgba(255,255,255,.75);font-size:.78rem;margin-top:18px;position:relative;z-index:1;}

/* Partial-navigation progress bar (top of the window) */
#pjax-bar{position:fixed;top:0;left:0;height:3px;width:0;background:var(--teal,#1A73E8);z-index:9999;opacity:0;pointer-events:none;}
#pjax-bar.run{width:92%;opacity:1;transition:width 8s cubic-bezier(.1,.7,.1,1);}
#pjax-bar.done{width:100%;opacity:0;transition:width .2s ease, opacity .35s ease .2s;}

/* Center loader shown during page navigation (not just the thin top bar). */
#pjax-loader{position:fixed;inset:0;z-index:9998;display:flex;align-items:center;justify-content:center;background:rgba(15,23,42,.18);opacity:0;visibility:hidden;transition:opacity .15s ease;}
#pjax-loader.show{opacity:1;visibility:visible;}
#pjax-loader .box{background:#fff;border-radius:16px;padding:20px 22px;box-shadow:0 12px 34px rgba(0,0,0,.2);display:flex;flex-direction:column;align-items:center;gap:10px;}
#pjax-loader .pjax-spinner{width:42px;height:42px;border:4px solid #E2E8F0;border-top-color:var(--teal,#1A73E8);border-radius:50%;animation:pjax-spin .7s linear infinite;}
#pjax-loader .box span{font-size:.8rem;color:#64748b;font-weight:600;}
@keyframes pjax-spin{to{transform:rotate(360deg);}}

/* Button loading spinner */
.spin{display:inline-block;width:15px;height:15px;border:2px solid rgba(255,255,255,.45);border-top-color:#fff;
    border-radius:50%;animation:spin .7s linear infinite;vertical-align:-2px;margin-right:4px;}
@keyframes spin{to{transform:rotate(360deg);}}

/* Generic "working…" state for any action button during a form post. The spinner
   inherits the button's text colour so it shows on both filled and ghost buttons. */
.lp-busy{pointer-events:none;opacity:.9;}
.lp-spin{display:inline-block;width:15px;height:15px;border:2px solid currentColor;border-top-color:transparent;
    border-radius:50%;animation:spin .7s linear infinite;vertical-align:-2px;}

/* Desktop: header + sidebar stay put; only the content area scrolls */
@media (min-width:761px){
    body.app{height:100vh;overflow:hidden;display:flex;flex-direction:column;}
    body.app .topbar{position:static;flex:0 0 auto;}
    body.app .shell{flex:1 1 auto;min-height:0;overflow:hidden;align-items:stretch;}
    body.app .side{overflow-y:auto;min-height:0;}
    body.app .content{overflow-y:auto;min-height:0;}
}

/* Mobile: the sidebar becomes an off-canvas slide-out drawer (like the app) */
.drawer-backdrop{display:none;}
@media (max-width:760px){
    html{overflow-x:clip;}
    body{overflow-x:clip;}
    .shell{flex-direction:column;}
    .content{padding:18px 16px;width:100%;}
    /* Keep real table ROWS on phones, just compact: smaller text, tight padding,
       headers on one line. Design tables with a combined first column (e.g. name
       over barcode) so the key columns fit; if a table is still too wide it
       scrolls sideways within its card rather than crushing. */
    .content table{font-size:.78rem;display:block;overflow-x:auto;-webkit-overflow-scrolling:touch;}
    .content th,.content td,.card th,.card td{padding:7px 8px;}
    .content table th{white-space:nowrap;font-size:.66rem;}
    .content table .btn{max-width:none;padding:6px 8px;font-size:.74rem;}
    /* Opt-in card layout for management tables (e.g. Assistants) — each row
       becomes a labelled card on a phone, which reads better than a wide table.
       Needs lpLabelAllTables() to have set data-label on each cell. */
    table.cards-mobile{display:block;overflow:visible;font-size:.9rem;}
    table.cards-mobile thead{display:none;}
    table.cards-mobile tbody{display:block;}
    table.cards-mobile tr{display:block;border:1px solid var(--line);border-radius:12px;
        padding:6px 12px;margin-bottom:10px;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.04);}
    table.cards-mobile td{display:flex;justify-content:space-between;align-items:center;gap:12px;
        padding:8px 0;border:none;border-bottom:1px solid var(--line);text-align:right;}
    table.cards-mobile tr td:last-child{border-bottom:none;}
    table.cards-mobile td::before{content:attr(data-label);font-weight:700;color:var(--muted);
        text-align:left;flex:0 0 auto;font-size:.8rem;}
    table.cards-mobile td:last-child{justify-content:flex-end;flex-wrap:wrap;}
    table.cards-mobile td:last-child::before{display:none;}
    /* Let any inline form/input in a card cell shrink to fit (no clipping). */
    table.cards-mobile td form{flex:1 1 auto;min-width:0;justify-content:flex-end;margin:0;}
    table.cards-mobile td input{min-width:0 !important;}
    /* A cell with a form (e.g. the assistant's email + save) stacks: label on
       its own line, the field full-width beneath so it's not squeezed. */
    table.cards-mobile td:has(form){flex-direction:column;align-items:stretch;gap:6px;}
    table.cards-mobile td:has(form)::before{text-align:left;}
    table.cards-mobile td:has(form) form{width:100%;justify-content:flex-start;}
    table.cards-mobile td:has(form) form input{flex:1;}
    /* A stacked cell: a bold primary line with a muted secondary line beneath. */
    .cell-stack{display:flex;flex-direction:column;gap:1px;}
    .cell-stack .sub2{font-size:.9em;color:var(--muted);font-weight:400;}
    /* Segmented controls fill the width and sit in a row instead of a cramped box. */
    .seg{display:flex;width:100%;}
    .seg-btn{flex:1 1 auto;text-align:center;}
    /* On a phone the toggle opens the drawer — always show the hamburger. */
    .side-toggle .st-expanded,.side-toggle .st-collapsed{display:none !important;}
    .side-toggle .st-mobile{display:inline-flex !important;}
    /* Fixed-height scrolling drawer. The big bottom padding (and the shorthand
       here, applied last, is the one that wins) lets the last item — My account —
       scroll clear of the phone's bottom edge / gesture bar. */
    .side{position:fixed;top:0;left:0;height:100vh;width:264px;z-index:60;background:#fff;flex:none;
        transform:translateX(-100%);transition:transform .22s ease;overflow-y:auto;-webkit-overflow-scrolling:touch;
        border-right:1px solid var(--line);box-shadow:0 10px 50px rgba(8,28,66,.28);padding:16px 12px 72px;}
    body.drawer-open .side{transform:translateX(0);}
    body.drawer-open .drawer-backdrop{display:block;position:fixed;inset:0;background:rgba(15,23,42,.45);z-index:55;}
    /* Always show full labels in the mobile drawer, even if desktop was collapsed */
    body.side-collapsed .side{overflow:visible;}
    body.side-collapsed .side a,
    body.side-collapsed .side .side-link{font-size:.95rem;justify-content:flex-start;padding:10px 12px;}
    body.side-collapsed .side a span,
    body.side-collapsed .side .side-link span{font-size:.95rem;}
    body.side-collapsed .side a i,
    body.side-collapsed .side .side-link i{font-size:1.1rem;}
    body.side-collapsed .side .grp{font-size:.7rem;border-top:none;}
    /* Free up header room on a phone so the store name shows in full AND the
       sign-out button stays fully on-screen (it was getting clipped at the edge). */
    .hide-mobile{display:none;}
    .brand .online{display:none;}
    .brand{font-size:1rem;}
    /* Online/offline pill → icon only on a phone (keeps the indicator, saves width). */
    .topbar .netpill .netpill-txt{display:none;}
    .topbar .netpill{padding:3px 7px;}
    .shop-switch{max-width:34vw;}
    /* A long store name must not push the header controls (incl. sign-out) off the
       edge - cap it and ellipsize on a phone. */
    .userbox .shop{display:inline-block;max-width:40vw;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:middle;}
    /* Tighter header on a phone so nothing pushes past the screen edge. */
    .topbar{padding-left:12px;padding-right:12px;gap:8px;}
    .userbox{gap:8px;min-width:0;flex:0 0 auto;}
    .userbox .lp-sel{max-width:34vw;}
    .userbox .lp-sel-btn{min-width:0;padding-left:10px;padding-right:10px;}
    /* Make the sign-out clearly tappable, not a cramped icon jammed in the corner. */
    .btn-link{flex:0 0 auto;padding:7px 10px;background:rgba(255,255,255,.22);}
}

/* ── Quotations & invoices: pill tabs, status badges, info banner ─────────── */
.tabs{display:flex;gap:6px;flex-wrap:wrap;}
.tabs .tab{display:inline-block;padding:7px 14px;border-radius:999px;background:#F1F5F9;color:var(--muted);font-weight:600;font-size:.88rem;text-decoration:none;}
.tabs .tab:hover{background:#E2E8F0;}
.tabs .tab.active{background:var(--teal);color:#fff;}
.badge-ok{background:#DCFCE7;color:var(--green);}
.badge-info{background:#EAF1FE;color:var(--teal-dd);}
.badge-muted{background:#F1F5F9;color:var(--muted);}
.msg-info{background:#EAF1FE;border:1px solid #C6DAFC;color:#185ABC;padding:11px 14px;border-radius:12px;margin-bottom:14px;font-size:.9rem;}

/* Two fields side-by-side on desktop, stacked on narrow screens. */
.form-2{display:grid;grid-template-columns:1fr 1fr;gap:10px;}
@media (max-width:560px){.form-2{grid-template-columns:1fr;}}
