/* ============================================================
   GST Billing Suite — shared design system
   Palette: ink #16211E, teal #0F5C5C, teal-deep #0A3F3F,
            amber #E8A33D, paper #F7F5F0, line #DCD6C8, brick #B23A2E
   Type: Space Grotesk (display) / Inter (body) / JetBrains Mono (numbers)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500;600;700&display=swap');

:root{
  --ink:#16211E;
  --teal:#0F5C5C;
  --teal-deep:#0A3F3F;
  --teal-soft:#E4EFEE;
  --amber:#E8A33D;
  --amber-deep:#C9821F;
  --paper:#F7F5F0;
  --card:#FFFFFF;
  --line:#DCD6C8;
  --brick:#B23A2E;
  --brick-soft:#FBEAE7;
  --green:#2E7D4F;
  --green-soft:#E7F3EC;
  --radius:10px;
  --shadow:0 1px 2px rgba(22,33,30,.06), 0 4px 14px rgba(22,33,30,.06);
}

*{box-sizing:border-box;}
html,body{height:100%;}
body{
  margin:0;
  background:var(--paper);
  color:var(--ink);
  font-family:'Inter',system-ui,sans-serif;
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3,.display{
  font-family:'Space Grotesk',sans-serif;
  font-weight:600;
  letter-spacing:-.01em;
  margin:0;
}
.mono{font-family:'JetBrains Mono',monospace;font-variant-numeric:tabular-nums;}
a{color:var(--teal);}
button{font-family:inherit;cursor:pointer;}
:focus-visible{outline:2px solid var(--amber-deep);outline-offset:2px;}

/* ---------- App shell ---------- */
.app-shell{display:flex;min-height:100vh;}
.sidebar{
  width:220px;flex-shrink:0;
  background:var(--teal-deep);
  color:#EAF3F1;
  display:flex;flex-direction:column;
  padding:20px 14px;
}
.sidebar .brand{
  font-family:'Space Grotesk',sans-serif;font-weight:700;font-size:17px;
  color:#fff;padding:6px 10px 22px;letter-spacing:-.01em;
}
.sidebar .brand span{color:var(--amber);}
.sidebar nav{display:flex;flex-direction:column;gap:2px;flex:1;}
.sidebar nav a{
  display:flex;align-items:center;gap:10px;
  padding:10px 12px;border-radius:8px;
  color:#BFE0DB;text-decoration:none;font-size:14px;font-weight:500;
  transition:background .12s ease, color .12s ease;
}
.sidebar nav a:hover{background:rgba(255,255,255,.06);color:#fff;}
.sidebar nav a.active{background:var(--amber);color:var(--teal-deep);font-weight:600;}
.sidebar .foot{border-top:1px solid rgba(255,255,255,.12);padding-top:12px;font-size:12px;color:#8FBDB6;}
.sidebar .foot b{color:#EAF3F1;display:block;font-size:13px;margin-bottom:2px;}
.signout{
  background:#fff;border:1px solid var(--brick);color:var(--brick);
  padding:7px 14px;border-radius:8px;font-size:13px;font-weight:600;cursor:pointer;
}
.signout:hover{background:var(--brick-soft);}
.sidebar .signout{
  margin-top:8px;background:none;border:1px solid rgba(255,255,255,.18);
  color:#EAF3F1;padding:8px 10px;border-radius:8px;font-size:13px;width:100%;text-align:left;
}
.sidebar .signout:hover{background:rgba(255,255,255,.08);}

/* ---------- "Billing counter" — a real button, not a plain link, with a subtle
   gradient off the sidebar's own background so it reads as the primary action ---------- */
.sidebar nav a.billing-counter-link{
  background:linear-gradient(135deg, rgba(255,255,255,.14), rgba(255,255,255,.02));
  border:1px solid rgba(255,255,255,.16);
  font-weight:600;
}
.sidebar nav a.billing-counter-link:hover{
  background:linear-gradient(135deg, rgba(255,255,255,.22), rgba(255,255,255,.05));
}
.sidebar nav a.billing-counter-link.active{
  background:var(--amber);color:var(--teal-deep);border-color:var(--amber);
}

/* ---------- Page-load spinner — shown until requireAuth's callback fires,
   covering everything except the sidebar (see JS in firebase-init.js) ---------- */
@keyframes pageLoadSpin{to{transform:rotate(360deg);}}
#pageLoadSpinner .spin{width:36px;height:36px;border:3px solid #DDE3E0;border-top-color:var(--teal-deep);border-radius:50%;animation:pageLoadSpin .8s linear infinite;}

/* ---------- Mobile/tablet: hamburger-toggled sidebar, injected automatically
   (see firebase-init.js) on every page using the .app-shell layout — this does
   NOT apply to pos.html/ca-pos.html/estimate.html/ca-estimate.html, which use
   the separate .pos-shell layout with its own dedicated mobile handling. ---------- */
.mobile-topbar{display:none;}
.mobile-only-inline{display:none;}
@media(max-width:1024px){ .mobile-only-inline{display:inline-flex;} }
.app-shell-backdrop{display:none;}
@media (max-width:1024px){
  .app-shell{display:block;}
  .sidebar{
    position:fixed;top:0;left:0;height:100vh;z-index:160;
    transform:translateX(-100%);transition:transform .25s ease;
    box-shadow:4px 0 16px rgba(0,0,0,.2);
  }
  body.app-sidebar-open .sidebar{transform:translateX(0);}
  /* Full-width fixed bar (hamburger + shop name + staff/role) rather than a
     lone corner button — a floating button alone had no reliable clearance
     from each page's own heading text and ended up sitting on top of it.
     White background + dark green text (matching the sidebar's own color)
     rather than a solid dark bar, per design preference. */
  .mobile-topbar{
    display:flex;align-items:center;gap:12px;
    position:fixed;top:0;left:0;right:0;z-index:150;
    background:#fff;padding:10px 14px;
    box-shadow:0 2px 8px rgba(0,0,0,.12);
    border-bottom:1px solid var(--line);
  }
  .mobile-hamburger-btn{
    display:flex;align-items:center;justify-content:center;flex-shrink:0;
    width:38px;height:38px;border-radius:10px;border:none;
    background:var(--teal-deep);color:#fff;font-size:19px;cursor:pointer;
  }
  /* Shop name left, staff name + role right, sharing one row — both truncate
     with an ellipsis rather than wrapping or overflowing if too long. */
  .mobile-topbar-text{min-width:0;overflow:hidden;display:flex;justify-content:space-between;align-items:baseline;gap:8px;flex:1;}
  .mobile-topbar-heading{font-size:15px;font-weight:700;color:var(--teal-deep);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0;flex-shrink:1;}
  .mobile-topbar-who{font-size:11px;color:var(--teal-deep);opacity:.75;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0;max-width:42%;flex-shrink:1;}
  body.app-sidebar-open .app-shell-backdrop{
    display:block;position:fixed;inset:0;background:rgba(15,26,24,.45);z-index:155;
  }
  /* !important here is deliberate, not decorative: a later, equal-specificity
     base .main rule (further down this file, for desktop) was silently
     winning over this one regardless of the media query, since @media adds
     no specificity of its own — only source order decided the winner. That
     let the heading/content render right underneath the fixed bar above
     with no real clearance. Forcing it here removes the dependency on
     staying below that base rule in the file. */
  .main{padding:74px 3px 40px !important;width:100%;box-sizing:border-box;}
  /* The heading/subtitle now live in the fixed bar above instead — showing
     both would just repeat the same text twice. Any action buttons in the
     topbar (not part of this selector) stay visible as normal. */
  .topbar h1, .topbar .sub{display:none;}
  .grid-4, .grid-2, .grid-3{grid-template-columns:1fr !important;}
  /* Opt-in: stat/action button rows that should stay 2-per-row on mobile
     instead of stacking to a single column (e.g. dashboard/inventory top
     stats) — add alongside grid-4/grid-3 wherever this is wanted. */
  .grid-2col-mobile{grid-template-columns:1fr 1fr !important;}
  .stack-tablet{grid-template-columns:1fr !important;}
  /* Opt-in: tables that stay as a real horizontal table with horizontal
     scroll on mobile/tablet, instead of the default stacked-card layout
     below — add class="table-wrap scroll-x" wherever a table has too many
     columns to read comfortably once stacked vertically. */
  .table-wrap.scroll-x{overflow-x:auto;-webkit-overflow-scrolling:touch;}
  .table-wrap.scroll-x table{display:table !important;width:auto !important;min-width:100% !important;}
  .table-wrap.scroll-x thead{position:static !important;left:auto !important;top:auto !important;display:table-header-group !important;}
  .table-wrap.scroll-x tbody{display:table-row-group !important;}
  .table-wrap.scroll-x tr{display:table-row !important;border:none !important;margin:0 !important;padding:0 !important;}
  .table-wrap.scroll-x td, .table-wrap.scroll-x th{display:table-cell !important;text-align:left !important;justify-content:normal !important;border-bottom:1px solid var(--line);padding:10px 12px !important;white-space:nowrap;}
  .table-wrap.scroll-x td[data-label]::before{content:none !important;}
  .table-wrap.scroll-x tr td:last-child{border-bottom:1px solid var(--line) !important;}
  .table-wrap table, .table-wrap thead, .table-wrap tbody, .table-wrap tr, .table-wrap td{display:block;width:100%;}
  .table-wrap thead{position:absolute;left:-9999px;top:-9999px;}
  .table-wrap tr{border:1px solid var(--line);border-radius:10px;margin-bottom:12px;padding:4px 0;}
  .table-wrap td{display:flex;justify-content:space-between;align-items:center;gap:10px;text-align:right;border-bottom:1px solid var(--line);padding:8px 12px;}
  .table-wrap tr td:last-child{border-bottom:none;}
  .table-wrap td[data-label]:not([data-label=""])::before{content:attr(data-label);font-size:11.5px;font-weight:600;text-transform:uppercase;letter-spacing:.03em;color:#6B7A75;text-align:left;flex-shrink:0;}
  .table-wrap td[data-label=""]{justify-content:flex-end;}
  .modal{width:94vw !important;max-width:94vw !important;}
  .row{flex-direction:column;}
}

.main{flex:1;min-width:0;padding:26px 32px 60px;}
.topbar{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:22px;gap:16px;flex-wrap:wrap;}
/* pos.html/estimate.html (and CA equivalents) only: shop name + staff name/role
   share one row, buttons sit on their own full-width row below — at every
   screen size, not just mobile, since squeezing 6+ buttons beside the heading
   on desktop left very little room for either. */
.pos-topbar{flex-direction:column;align-items:stretch;}
.topbar-heading{display:flex;justify-content:space-between;align-items:baseline;gap:10px;width:100%;}
.topbar-heading h1{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.topbar-heading .sub{margin:0;flex-shrink:0;white-space:nowrap;}
.topbar-btn-group{width:100%;}
.topbar-btn-group{display:flex;gap:8px;}
.topbar h1{font-size:22px;}
.topbar .sub{color:#6B7A75;font-size:13.5px;margin-top:4px;}

/* ---------- Cards / layout ---------- */
.card{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);}
.card-pad{padding:18px 20px;}
.grid{display:grid;gap:16px;}
.grid > *{min-width:0;}
.grid-2{grid-template-columns:1fr 1fr;}
.grid-3{grid-template-columns:repeat(3,1fr);}
.grid-4{grid-template-columns:repeat(4,1fr);}
@media (max-width:980px){.grid-2,.grid-3,.grid-4{grid-template-columns:1fr;}}

.stat{padding:16px 18px;}
.stat .label{font-size:12px;color:#6B7A75;text-transform:uppercase;letter-spacing:.05em;font-weight:600;}
.stat .value{font-family:'JetBrains Mono',monospace;font-size:26px;font-weight:700;margin-top:6px;color:var(--teal-deep);}

/* ---------- Forms ---------- */
label{display:block;font-size:12.5px;font-weight:600;color:#3E4A46;margin-bottom:5px;}
input,select,textarea{
  width:100%;padding:9px 11px;border:1px solid var(--line);border-radius:8px;
  font-size:14px;font-family:inherit;background:#fff;color:var(--ink);
  box-sizing:border-box;
}
input:focus,select:focus,textarea:focus{border-color:var(--teal);}
.field{margin-bottom:14px;min-width:0;}
.row{display:flex;gap:12px;}
.row > *{flex:1;min-width:0;}

.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:6px;
  padding:9px 16px;border-radius:8px;border:1px solid transparent;
  font-size:13.5px;font-weight:600;background:var(--teal);color:#fff;
  transition:filter .12s ease, transform .05s ease;
}
.btn:hover{filter:brightness(1.08);}
.btn:active{transform:translateY(1px);}
.btn-amber{background:var(--amber);color:var(--teal-deep);}
.btn-outline{background:#fff;color:var(--teal-deep);border-color:var(--line);}
.btn-outline:hover{background:var(--teal-soft);}
.btn-danger{background:var(--brick);color:#fff;}
.btn-ghost{background:transparent;color:var(--teal-deep);}
.btn-block{width:100%;}
.btn-lg{padding:13px 18px;font-size:15px;}
.btn:disabled{opacity:.5;cursor:not-allowed;}

/* ---------- Table ---------- */
table{width:100%;border-collapse:collapse;font-size:13.5px;}
th{text-align:left;font-size:11.5px;text-transform:uppercase;letter-spacing:.04em;color:#6B7A75;
   padding:9px 12px;border-bottom:2px solid var(--line);}
td{padding:10px 12px;border-bottom:1px solid var(--line);}
tr:last-child td{border-bottom:none;}
.table-wrap{overflow-x:auto;}

/* ---------- Badges ---------- */
.badge{display:inline-block;padding:3px 9px;border-radius:99px;font-size:11.5px;font-weight:600;}
.badge-green{background:var(--green-soft);color:var(--green);}
.badge-amber{background:#FCF1DE;color:var(--amber-deep);}
.badge-brick{background:var(--brick-soft);color:var(--brick);}
.badge-teal{background:var(--teal-soft);color:var(--teal-deep);}

/* ---------- Login ---------- */
.login-wrap{min-height:100vh;display:flex;align-items:center;justify-content:center;background:var(--teal-deep);
  background-image:radial-gradient(circle at 15% 20%, rgba(232,163,61,.14), transparent 45%),
                    radial-gradient(circle at 85% 80%, rgba(255,255,255,.06), transparent 45%);}
.login-card{width:360px;background:var(--card);border-radius:14px;padding:32px 28px;box-shadow:0 20px 60px rgba(0,0,0,.35);}
.login-brand{text-align:center;margin-bottom:22px;}
.login-brand .display{font-size:22px;}
.login-brand .display span{color:var(--amber-deep);}
.login-brand p{color:#6B7A75;font-size:13px;margin-top:4px;}
.msg{font-size:13px;padding:9px 11px;border-radius:8px;margin-bottom:12px;}
.msg-error{background:var(--brick-soft);color:var(--brick);}
.msg-ok{background:var(--green-soft);color:var(--green);}

/* ---------- Modal ---------- */
.modal-backdrop{position:fixed;inset:0;background:rgba(15,26,24,.5);display:flex;align-items:center;justify-content:center;z-index:150;}
.modal{width:420px;max-width:92vw;background:#fff;border-radius:12px;padding:22px;box-shadow:0 20px 60px rgba(0,0,0,.3);max-height:88vh;overflow-y:auto;}
.modal h3{margin-bottom:16px;}
.modal-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:18px;}
.hidden{display:none !important;}

/* ---------- POS screen ---------- */
.pos-shell{display:grid;grid-template-columns:1fr 138px 420px;gap:0;height:100vh;}
.pos-left{padding:18px 22px;overflow-y:auto;background:var(--paper);}
.pos-mid{background:#fff;border-left:1px solid var(--line);border-right:1px solid var(--line);display:flex;flex-direction:column;gap:6px;height:100vh;overflow-y:auto;padding:14px 8px;}
.pos-right{background:#fff;display:flex;flex-direction:column;height:100vh;}
.scan-weigh-row{display:flex;gap:10px;margin-bottom:14px;align-items:stretch;}
.scan-bar{display:flex;align-items:center;gap:10px;flex:65;min-width:0;height:56px;}
.scan-bar input{font-size:16px;padding:0 14px;flex:1;min-width:0;height:100%;}
.scan-bar button{flex-shrink:0;}
.weigh-box{display:flex;align-items:center;gap:8px;background:var(--teal-deep);color:#fff;border-radius:10px;padding:6px 10px;flex:35;min-width:0;height:56px;}
.weigh-box .w-info{min-width:0;flex:1;}
.weigh-box .w-label{font-size:9.5px;text-transform:uppercase;letter-spacing:.02em;color:#9FCFC7;white-space:nowrap;}
.weigh-box .w-value{font-family:'JetBrains Mono',monospace;font-size:16px;font-weight:700;white-space:nowrap;}
.weigh-box .w-connect-btn{white-space:nowrap;text-align:center;font-size:11px;padding:4px 8px;flex-shrink:0;width:auto;}
.weigh-box .w-status{font-size:9.5px;color:#BFE0DB;line-height:1.2;text-align:center;white-space:normal;flex-shrink:0;width:48px;display:flex;flex-direction:column;align-items:center;gap:2px;}

/* ---------- POS / Estimate: mobile & tablet layout ---------- */
/* Below 1024px the fixed 3-column grid (which assumes a wide desktop screen)
   just crams every column into a narrow viewport and overlaps. Instead, the
   category rail + quick pick grid become an 80%-wide slide-over panel that's
   opened via a toggle button — the cart and totals/checkout stay in the main
   page at all times, never inside the overlay.
   NOTE: this block must stay AFTER the base .pos-mid/.pos-right/etc rules
   above — CSS gives equal-specificity rules to whichever is declared LAST,
   regardless of media query, so if this block were moved earlier again the
   base rules would silently win back and undo it. */
.qp-mobile-toggle{display:none;}
#qpBackdrop, #qpOverlayHeader{display:none;}
@media (max-width: 1024px){
  .pos-shell{grid-template-columns:1fr;height:auto;min-height:100vh;}
  .pos-left{height:auto;padding:14px 3px;}
  .pos-mid{display:none;}
  #quickPickSection{display:none !important;}
  .pos-right{height:auto;}
  .qp-mobile-toggle{display:flex;width:100%;justify-content:center;margin:10px 0;}

  /* No physical weighing scale on a phone/tablet — the scan field takes the
     freed-up space instead, split 60:40 with the camera-scan button. */
  .weigh-box{display:none;}
  .scan-bar{flex:1;}
  .scan-bar input{flex:none;width:calc(60% - 5px);}
  .scan-bar .camera-scan-btn{flex:none;width:calc(40% - 5px);padding:0 !important;}

  /* The cart card lost its old viewport-height anchor once .pos-left switched
     to height:auto for stacking — give it back a real, scrollable height
     relative to the actual screen instead of looking collapsed/shrunk. */
  /* Vertical: cart card lost its old viewport-height anchor once .pos-left
     switched to height:auto for stacking — give it back a real, scrollable
     height relative to the actual screen instead of looking collapsed/shrunk.
     Horizontal: the cart columns (Qty/Price/Disc/Tax/GST/Amount) were
     compressing down to near-0 width on narrow screens and overlapping each
     other — keep every column at a readable minimum width and let the row
     scroll sideways instead of squeezing. */
  .cart-items{max-height:55vh !important;overflow-y:auto;overflow-x:auto;-webkit-overflow-scrolling:touch;}
  #cartHeader, .cart-row{min-width:650px;}

  body.qp-mobile-open #qpBackdrop{display:block;position:fixed;inset:0;background:rgba(15,26,24,.45);z-index:97;}
  body.qp-mobile-open #qpOverlayHeader{
    display:flex;align-items:center;gap:10px;position:fixed;top:0;right:0;width:80%;height:48px;
    background:var(--teal-deep);color:#fff;z-index:99;padding:0 14px;box-shadow:0 2px 6px rgba(0,0,0,.2);
  }
  #qpOverlayHeader button{background:none;border:none;color:#fff;font-size:20px;cursor:pointer;padding:4px 8px;line-height:1;}
  #qpOverlayHeader span{font-weight:600;font-size:14px;}

  body.qp-mobile-open .pos-mid, body.qp-mobile-open #quickPickSection{
    position:fixed;top:48px;bottom:0;z-index:98;background:#fff;overflow-y:auto;box-shadow:-4px 0 16px rgba(0,0,0,.15);
  }
}
/* Tablet (601–1024px): categories as a single column + quick pick grid together, side by side, filling the 80% panel */
@media (min-width:601px) and (max-width:1024px){
  body.qp-mobile-open .pos-mid{right:50%;width:30%;display:flex !important;flex-direction:column;}
  body.qp-mobile-open #quickPickSection{right:0;width:50%;display:block !important;}
}
/* Mobile (<=600px): categories fill the panel first; tapping one swaps to the quick pick grid, also filling the panel */
@media (max-width:600px){
  body.qp-mobile-open .pos-mid{right:0;width:80%;display:flex !important;flex-direction:column;}
  body.qp-mobile-open #quickPickSection{right:0;width:80%;display:none;}
  body.qp-mobile-open.qp-showing-items .pos-mid{display:none !important;}
  body.qp-mobile-open.qp-showing-items #quickPickSection{display:block !important;}

  /* Buttons wrap into a 2-column grid on phones, instead of every button in
     a row being squeezed into one flex line — with up to 4 buttons per row
     (info, DC, Estimates, Load estimate), flex:1 was giving each one only a
     sliver of width, which is what was clipping "Load estimate" down to
     nothing readable. A 2-column grid gives each button roughly half the
     screen and wraps extras onto their own row automatically. On
     desktop/tablet .topbar-btn-group/.topbar-btn-row stay as a single flex
     row (see the base rule), so nothing changes there. */
  .topbar-btn-group{flex-direction:column;}
  .topbar-btn-row{display:grid;grid-template-columns:1fr 1fr;gap:8px;width:100%;}
  .topbar-btn-row .btn, .topbar-btn-row select, .topbar-btn-row a, .topbar-btn-row .signout{width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0;display:inline-block;text-align:center;}
  .topbar-btn-row .help-info-btn{justify-self:start;}

  /* Shop name left, logged-in user + role right — base layout now lives in
     the always-on .topbar-heading rule; this just tightens truncation for
     narrow screens. */
  .topbar-heading h1{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0;flex-shrink:1;}
  .topbar-heading .sub{margin:0;text-align:right;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0;max-width:45%;flex-shrink:1;}
}
.dot{width:8px;height:8px;border-radius:99px;display:inline-block;margin-right:5px;}
.btn .dot{margin-right:0;}
.w-status .dot{margin-right:0;}
.dot-live{background:#4CD787;}
.dot-off{background:#8A9E97;}

.cart-items{flex:1;overflow-y:auto;padding:14px 18px;}
.cart-row{display:grid;grid-template-columns:minmax(90px,180px) minmax(0,58px) minmax(0,62px) minmax(0,62px) minmax(0,66px) minmax(0,64px) minmax(0,1fr) minmax(0,74px) minmax(0,50px);align-items:center;gap:5px;padding:7px 0;border-bottom:1px solid var(--line);}
.cart-row > *:not(:last-child){border-right:1px solid var(--line);padding-right:6px;}
.cart-row .cart-spacer{border-right:none !important;padding-right:0 !important;}
.cart-row .cart-taxable{font-family:'JetBrains Mono',monospace;font-size:11.5px;color:#6B7A75;text-align:right;white-space:nowrap;}
.cart-row .cart-gstpct{font-size:11px;color:#6B7A75;text-align:right;white-space:nowrap;}
.cart-row > *{min-width:0;overflow:hidden;}
#cartHeader > *{min-width:0;overflow:hidden;white-space:nowrap;}
#cartHeader > *:not(:last-child){border-right:1px solid var(--line);padding-right:6px;}
.cart-row .cart-disc-input{width:100%;padding:4px 4px;text-align:right;font-size:12px;}
.cart-row .cart-disc-readonly{font-size:12px;color:#6B7A75;text-align:right;white-space:nowrap;}
.cart-row .cart-name{font-weight:600;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.cart-row .cart-qty-input{width:100%;padding:4px 4px;text-align:center;font-size:12.5px;}
.cart-row .cart-qty-readonly{font-size:11.5px;color:#6B7A75;text-align:center;white-space:nowrap;}
.cart-row .cart-price{font-family:'JetBrains Mono',monospace;font-size:11.5px;color:#6B7A75;text-align:right;white-space:nowrap;}
.cart-row .cart-total{font-family:'JetBrains Mono',monospace;font-weight:700;font-size:13.5px;text-align:right;white-space:nowrap;}
.cart-row .rm{background:none;border:none;color:var(--brick);font-size:11.5px;padding:0;justify-self:end;}

.totals{padding:14px 18px;border-top:1px solid var(--line);background:var(--teal-soft);}
.input-soft{background:var(--teal-soft);border-color:var(--teal-soft);}
.input-soft:focus{background:#fff;border-color:var(--teal);}
.totals .line{display:flex;justify-content:space-between;font-size:13.5px;padding:3px 0;color:#3E4A46;}
.totals .grand{display:flex;justify-content:space-between;align-items:baseline;padding-top:10px;margin-top:6px;border-top:1px dashed #B9CEC9;}
.totals .grand .lbl{font-family:'Space Grotesk',sans-serif;font-weight:600;font-size:14px;}
.totals .grand .val{font-family:'JetBrains Mono',monospace;font-weight:700;font-size:28px;color:var(--teal-deep);}
.pos-actions{padding:14px 18px;display:flex;gap:10px;}

/* ---------- Print receipt ---------- */
.receipt{width:100%;font-family:'JetBrains Mono',monospace;font-size:12px;color:#000;}
.receipt .center{text-align:center;}
.receipt hr{border:none;border-top:1px dashed #000;margin:6px 0;}
.receipt table{width:100%;font-size:11.5px;table-layout:fixed;}
.receipt td{border:none;padding:2px 0;}
/* The item/commodity name is always the first column across every receipt template
   (POS, estimates, invoices, purchase bills) — cap it at 35% and let long names
   wrap onto two or three lines instead of squeezing every other column. */
.receipt td:first-child, .receipt th:first-child{width:35%;word-break:break-word;overflow-wrap:break-word;vertical-align:top;}
#printArea{display:none;}
@media print{
  body > *:not(#printArea){display:none !important;}
  #printArea{display:block !important;}
  @page{margin:0.4cm;size:auto;}
}

/* ---------------- A4 tax invoice (B2B print option) ---------------- */
/* Rendered and printed via a separate window (see printA4Invoice() in each
   page's script) rather than sharing #printArea, so its page size/margins
   never conflict with the thermal-receipt print rules above. */
.a4-invoice{width:100%;font-family:'Inter',system-ui,sans-serif;color:#000;font-size:12.5px;}
.a4-invoice .a4-head{text-align:center;margin-bottom:10px;}
.a4-invoice .a4-head .biz-name{font-size:18px;font-weight:700;}
.a4-invoice .a4-title{text-align:center;font-weight:700;font-size:14px;margin:8px 0;text-decoration:underline;}
.a4-invoice .a4-parties{display:flex;justify-content:space-between;gap:20px;border:1px solid #000;padding:8px 10px;margin-bottom:10px;}
.a4-invoice .a4-parties > div{flex:1;}
.a4-invoice .a4-parties b{display:block;margin-bottom:3px;}
.a4-invoice table{width:100%;border-collapse:collapse;font-size:11.5px;table-layout:fixed;border:1px solid #000;}
.a4-invoice th,.a4-invoice td{border:1px solid #000;padding:5px 6px;}
.a4-invoice tbody tr:last-child td{border-bottom:1px solid #000;}
.a4-invoice th{background:#EFEFEF;font-weight:700;}
.a4-invoice td.a4-item-name{width:26%;word-break:break-word;text-align:left;}
.a4-invoice td.num,.a4-invoice th.num{text-align:right;}
.a4-invoice .a4-totals{width:320px;margin-left:auto;margin-top:10px;}
.a4-invoice .a4-totals div{display:flex;justify-content:space-between;padding:2px 0;}
.a4-invoice .a4-totals .grand{font-weight:700;font-size:13.5px;border-top:1px solid #000;margin-top:4px;padding-top:4px;}
.a4-invoice .a4-footer{margin-top:30px;display:flex;justify-content:space-between;font-size:11px;}
@page a4{margin:1.2cm;size:A4;}

/* Small format-choice popup for B2B print (receipt vs A4) */
.print-choice-backdrop{position:fixed;inset:0;background:rgba(15,26,24,.5);display:flex;align-items:center;justify-content:center;z-index:60;}
.print-choice-box{width:340px;background:#fff;border-radius:12px;padding:20px;box-shadow:0 20px 60px rgba(0,0,0,.3);}
.print-choice-box h4{margin-bottom:6px;font-family:'Space Grotesk',sans-serif;}
.print-choice-box p{font-size:12.5px;color:#6B7A75;margin-bottom:14px;}
.print-choice-box .btn{width:100%;margin-bottom:8px;}

/* ---------- Toggle switch (e.g. B2B/B2C) — referenced in markup but never styled before ---------- */
.switch{position:relative;display:inline-block;width:38px;height:20px;flex-shrink:0;}
.switch input{opacity:0;width:0;height:0;}
.switch-slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:var(--teal);transition:.2s;border-radius:20px;}
.switch-slider:before{position:absolute;content:"";height:16px;width:16px;left:2px;bottom:2px;background-color:#fff;transition:.2s;border-radius:50%;box-shadow:0 1px 2px rgba(0,0,0,.25);}
.switch input:checked + .switch-slider{background-color:var(--brick);}
.switch input:checked + .switch-slider:before{transform:translateX(18px);}
.switch input:focus-visible + .switch-slider{outline:2px solid var(--amber-deep);outline-offset:2px;}

/* ---------- Help & Support "i" info buttons ---------- */
.help-info-btn{width:28px;height:28px;border-radius:50%;border:none;background:var(--teal);color:#fff;font-weight:700;font-size:15px;font-style:italic;font-family:Georgia,'Times New Roman',serif;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;line-height:1;padding:0;box-shadow:0 1px 3px rgba(0,0,0,.25);transition:transform .1s ease, filter .1s ease;}
.help-info-btn:hover{filter:brightness(1.1);transform:scale(1.08);}
.help-info-btn:active{transform:scale(0.96);}

/* ---------- Misc ---------- */
.empty-state{text-align:center;padding:50px 20px;color:#8A9C97;}
.pill-tabs{display:flex;gap:6px;background:var(--teal-soft);padding:4px;border-radius:10px;width:fit-content;}
.pill-tabs button{background:none;border:none;padding:7px 14px;border-radius:7px;font-size:13px;font-weight:600;color:#3E4A46;}
.pill-tabs button.active{background:#fff;color:var(--teal-deep);box-shadow:0 1px 3px rgba(0,0,0,.1);}
