:root {
  --navy:#1A3C5E; --navy-2:#0F2540; --navy-3:#08182B; --navy-l:#EBF0F6; --navy-m:#B8CAD9; --navy-h:#2A557D;
  --orange:#E8622A; --orange-d:#C44B16; --orange-l:#FDF1EB; --orange-m:#F8C9B2;
  --green:#1D7A50; --green-l:#E6F5EE; --green-m:#A6D5BD;
  --red:#B83232;   --red-l:#FDECEC;   --red-m:#E8A8A8;
  --amber:#A0620A; --amber-l:#FEF4E3; --amber-m:#F0CE85;
  --purple:#5C3FA0;--purple-l:#EEE9F8;
  --teal:#167D8E;  --teal-l:#E5F4F6;
  --text:#0D1117; --text-2:#2F3744; --muted:#5C6474; --muted-2:#6B7280;
  --border:#E2E6ED; --border-2:#CDD3DD;
  --bg:#F4F6FA; --bg-2:#EDF0F5; --white:#FFFFFF;
  --shadow-sm: 0 1px 2px rgba(13,17,23,0.04), 0 1px 3px rgba(13,17,23,0.04);
  --shadow:    0 2px 6px rgba(13,17,23,0.05), 0 4px 14px rgba(13,17,23,0.06);
  --shadow-lg: 0 8px 24px rgba(13,17,23,0.10), 0 2px 8px rgba(13,17,23,0.06);
  --shadow-pop:0 16px 48px rgba(15,37,64,0.22);
  --r-sm:5px; --r:8px; --r-lg:12px; --r-xl:16px;
  --sans:'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --mono:'IBM Plex Mono', ui-monospace, Menlo, monospace;

  /* Layout chrome heights — kept as variables so layouts can subtract them. */
  --topbar-h: 52px;
  --tabbar-h: 64px;  /* mobile bottom tab bar */
  --sidebar-w: 232px;
  --aside-w: 460px;  /* desktop cart-panel width */
  /* Min recommended touch target. */
  --touch: 44px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; max-width: 100vw; overflow-x: hidden; }
body {
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  font-size: 14px;            /* mobile base ≥ 14px */
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-size-adjust: 100%;
}
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; min-height: var(--touch); padding: 0 10px; }
input, select, textarea { font: inherit; color: inherit; font-size: 16px; }   /* 16px to prevent iOS zoom */
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--orange); outline-offset: 1px; }
a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }

/* Accessibility — keyboard focus ring */
*:focus { outline: none; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; border-radius: 4px; }

/* Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* Print clean-up — hide chrome */
@media print {
  .topbar, .sidebar, .tabbar, .pos-mobile-bar, .flash-wrap { display: none !important; }
  .app { display: block; height: auto; }
  .main, .scrollarea { overflow: visible; height: auto; }
}
.mono { font-family: var(--mono); font-feature-settings: 'tnum' 1; }
.num  { font-family: var(--mono); font-feature-settings: 'tnum' 1; font-weight: 500; }
.ttu  { text-transform: uppercase; letter-spacing: 0.10em; }
.muted{ color: var(--muted); }

/* Responsive helpers — use to hide/show at breakpoints */
.mobile-only { display: block; }
.desktop-only { display: none !important; }
.desktop-only.inline { display: none !important; }
/* The `hidden` HTML attribute MUST win over `.mobile-only { display: block }`,
   otherwise mobile-scoped overlays (sheet backdrops etc.) stay mounted and
   swallow every tap/scroll on the page even when "closed". */
.mobile-only[hidden], .desktop-only[hidden], [hidden] { display: none !important; }

/* ============================================================
   App shell — mobile first
   - mobile: stacked, sidebar replaced by bottom tab bar
   - md (≥768): sidebar reappears, layout becomes grid
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: var(--topbar-h) 1fr var(--tabbar-h);
  height: 100vh;
  background: var(--bg);
}
.topbar {
  background: var(--navy-2); color: #fff;
  display: flex; align-items: center;
  padding: 0 12px;
  gap: 8px;
  position: relative; z-index: 30;
  min-height: var(--topbar-h);
}

.sidebar { display: none; }                    /* hidden on mobile */
.tabbar  { display: flex; }                    /* shown on mobile  */

/* Bottom tab bar (mobile) */
.tabbar {
  background: var(--white);
  border-top: 1px solid var(--border);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  z-index: 30;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.tab-item {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px; padding: 8px 4px; min-height: var(--touch);
  color: var(--muted); font-size: 10.5px; font-weight: 500;
  text-decoration: none; text-align: center;
  position: relative;
}
.tab-item .ico { opacity: 0.9; }
.tab-item.active { color: var(--navy); }
.tab-item.active::before {
  content: ''; position: absolute; top: 0; left: 20%; right: 20%;
  height: 3px; background: var(--orange); border-radius: 0 0 2px 2px;
}
.tab-item .badge {
  position: absolute; top: 4px; right: calc(50% - 18px);
  background: var(--orange); color: #fff; font-size: 9.5px; font-weight: 600;
  font-family: var(--mono); padding: 1px 5px; border-radius: 8px;
  min-width: 14px; height: 14px; line-height: 12px; text-align: center;
}

/* Top brand area */
.brand { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.brand-mark { width: 28px; height: 28px; background: var(--orange); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; color: var(--navy-2); letter-spacing: -0.04em; }
.brand-text { display: none; font-weight: 600; font-size: 14px; letter-spacing: -0.005em; }
@media (min-width: 768px) { .brand-text { display: block; } }
.brand-text small { display: block; font-weight: 400; font-size: 9.5px; color: rgba(255,255,255,0.5); letter-spacing: 0.14em; text-transform: uppercase; margin-top: -1px; }
/* Hide the explicit date/time on mobile — the OS clock is enough */
.topbar-clock { display: none; }
@media (min-width: 768px) { .topbar-clock { display: inline-flex; align-items: center; gap: 6px; color: rgba(255,255,255,0.65); font-size: 11.5px; } }

.branch-pill { display: inline-flex; align-items: center; gap: 7px; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12); padding: 4px 10px 4px 8px; border-radius: 6px; font-size: 12px; color: rgba(255,255,255,0.85); cursor: pointer; min-height: 32px; }
.branch-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: #2EE07E; }
.top-spacer { flex: 1; }
.sync-chip { display: none; align-items: center; gap: 8px; font-size: 11.5px; color: rgba(255,255,255,0.78); background: rgba(255,255,255,0.06); padding: 5px 11px 5px 9px; border-radius: 20px; border: 1px solid rgba(255,255,255,0.10); }
.sync-chip .pulse { width: 7px; height: 7px; border-radius: 50%; background: #2EE07E; box-shadow: 0 0 0 0 rgba(46,224,126,0.7); animation: pulse 2.2s infinite; }
.sync-chip.warn .pulse { background: #FFC04A; animation: none; }
.sync-chip.err  .pulse { background: #FF6B6B; animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(46,224,126,0.55); } 60% { box-shadow: 0 0 0 7px rgba(46,224,126,0); } 100% { box-shadow: 0 0 0 0 rgba(46,224,126,0); } }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 4px 10px 4px 4px; border-radius: 22px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.10); cursor: pointer; min-height: 36px; }
.user-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--orange); color: #fff; font-weight: 600; font-size: 11px; display: flex; align-items: center; justify-content: center; }
.user-info { display: none; }
.user-info .nm { font-size: 12px; font-weight: 500; color: #fff; line-height: 1.1; }
.user-info .rl { font-size: 10px; color: rgba(255,255,255,0.55); text-transform: capitalize; }

/* Main / scroll area */
.main { overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.scrollarea { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; }
.page-head { background: var(--white); border-bottom: 1px solid var(--border); padding: 12px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head h1 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.page-head .crumb { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; }
.page-head .actions { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* Controls — base mobile sizes (44px touch min) */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 10px 14px; border-radius: 8px; font-size: 14px; font-weight: 500; background: var(--white); border: 1px solid var(--border-2); color: var(--text-2); text-decoration: none; min-height: var(--touch); }
.btn:hover { background: var(--bg); }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); }
.btn-accent { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn-accent:hover { background: var(--orange-d); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { color: var(--red); }
.btn-sm { padding: 6px 10px; font-size: 13px; min-height: 36px; }
.btn-lg { padding: 13px 18px; font-size: 15px; min-height: 52px; }
.btn-block { width: 100%; }
.btn[disabled], .btn:disabled { opacity: 0.5; cursor: not-allowed; }

.input { width: 100%; padding: 11px 13px; background: var(--white); border: 1px solid var(--border-2); border-radius: 8px; font-size: 16px; color: var(--text); min-height: var(--touch); }
.input:focus { border-color: var(--navy); outline: 0; box-shadow: 0 0 0 3px rgba(26,60,94,0.10); }
.input.lg { padding: 13px 16px; font-size: 16px; min-height: 52px; }
.input.sm { padding: 7px 10px; font-size: 14px; min-height: 36px; }
.label { display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.08em; }

.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 11px; font-size: 11px; font-weight: 600; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.04em; }
.chip.navy{background:var(--navy-l);color:var(--navy);} .chip.orange{background:var(--orange-l);color:var(--orange-d);}
.chip.green{background:var(--green-l);color:var(--green);} .chip.red{background:var(--red-l);color:var(--red);}
.chip.amber{background:var(--amber-l);color:var(--amber);} .chip.purple{background:var(--purple-l);color:var(--purple);}
.chip.teal{background:var(--teal-l);color:var(--teal);}   .chip.gray{background:var(--bg-2);color:var(--muted);}
.chip .dot{width:6px;height:6px;border-radius:50%;background:currentColor;}

.card { background: var(--white); border: 1px solid var(--border); border-radius: var(--r-lg); overflow-x: auto; -webkit-overflow-scrolling: touch; }
.card-h { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.card-h h3 { font-size: 14px; font-weight: 600; }
.card-b { padding: 14px 16px; }

.kbd { display: inline-flex; align-items: center; padding: 1px 5px; background: var(--bg-2); border: 1px solid var(--border-2); border-bottom-width: 2px; border-radius: 4px; font-family: var(--mono); font-size: 10.5px; color: var(--muted); line-height: 1.4; }

/* Tables — horizontally scrollable on mobile */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 100%; }
table.t th, table.t td { text-align: left; padding: 10px 12px; vertical-align: middle; }
table.t thead th { background: var(--bg); color: var(--muted); font-size: 10.5px; font-weight: 600; letter-spacing: 0.10em; text-transform: uppercase; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.t tbody tr { border-bottom: 1px solid var(--border); }
table.t tbody tr:last-child { border-bottom: 0; }
table.t tbody tr:hover { background: var(--bg); }
table.t td.r { text-align: right; }
table.t td.c { text-align: center; }

.hr { height: 1px; background: var(--border); border: 0; }
.pad { padding: 16px; }

/* Responsive KPI grid — 2-up phones, 4-up tablet+ */
.kpi-grid, .kpi-grid-3 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
.kpi-grid .card-b, .kpi-grid-3 .card-b { padding: 12px 14px; }
.kpi-grid .label, .kpi-grid-3 .label { font-size: 10.5px; }
/* Auto-shrink the big number so long UGX values don't overflow at 320px */
.kpi-grid .card-b > div[style*="font-size:22px"],
.kpi-grid-3 .card-b > div[style*="font-size:22px"] {
  font-size: 17px !important;
  word-break: break-all;
  line-height: 1.15;
}
@media (min-width: 640px) {
  .kpi-grid    { grid-template-columns: repeat(4, 1fr); gap: 14px; }
  .kpi-grid-3  { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .kpi-grid .card-b > div[style*="font-size:22px"],
  .kpi-grid-3 .card-b > div[style*="font-size:22px"] {
    font-size: 22px !important;
    word-break: normal;
  }
}
@media (min-width: 1024px) {
  .kpi-grid .card-b, .kpi-grid-3 .card-b { padding: 16px 18px; }
}

/* Responsive 2-pane content grid — stacks on phone, splits on tablet+ */
.split-2 { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 768px) { .split-2 { grid-template-columns: 2fr 1fr; gap: 18px; } }

/* EOD reconciliation — stacked on mobile, 2-then-4-up on tablet+ */
.eod-recon { grid-template-columns: 1fr 1fr; }
@media (min-width: 768px) { .eod-recon { grid-template-columns: repeat(4, 1fr); } }

/* Settings shell — sub-nav becomes a select on mobile */
.settings-shell { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
.settings-nav { display: none; }
@media (min-width: 768px) {
  .settings-shell { display: grid; grid-template-columns: 236px 1fr; }
  .settings-nav { display: block; background: var(--white); border-right: 1px solid var(--border); overflow: auto; }
  .settings-shell .scrollarea { padding: 22px 24px !important; }
}
@media (min-width: 1024px) {
  .settings-shell .scrollarea { padding: 22px 28px !important; }
}

/* Sticky table headers on scrollable lists */
.t-sticky thead th { position: sticky; top: 0; z-index: 1; }

/* Two-column form layout — stacks on phones, side-by-side on tablet+ */
.form-2col { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 640px) { .form-2col { grid-template-columns: 1fr 1fr; } }

/* Lazy-image hover */
img[loading="lazy"] { background: var(--bg-2); }

/* Toast / flash */
.flash-wrap { position: fixed; left: 12px; right: 12px; top: calc(var(--topbar-h) + 8px); display: flex; flex-direction: column; gap: 8px; z-index: 60; pointer-events: none; }
.flash { background: var(--white); border: 1px solid var(--border); border-left: 3px solid var(--green); border-radius: 8px; box-shadow: var(--shadow-lg); padding: 11px 16px 11px 14px; font-size: 13px; pointer-events: auto; animation: toast-in 240ms cubic-bezier(.16,1,.3,1); }
.flash.err { border-left-color: var(--red); }
.flash.info{ border-left-color: var(--navy); }
.flash .tt { font-weight: 600; font-size: 13px; }
.flash .ts { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
@keyframes toast-in { from { opacity: 0; transform: translate(8px,-6px); } to { opacity: 1; transform: translate(0,0); } }

/* Payment method buttons (cart panel + checkout page) */
.pm-btn { width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 12px 6px; border-radius: 8px; border: 1px solid var(--border-2); background: var(--white); color: var(--text-2); font-size: 12px; font-weight: 500; cursor: pointer; min-height: 64px; }
.pm-btn:hover { background: var(--bg); }
.pm-btn.act { background: var(--navy); border-color: var(--navy); color: #fff; }
.pm-btn.act svg { stroke: #fff; }
.pm-btn[disabled] { cursor: not-allowed; }

/* Item cards (POS grid) */
.cat-pill { padding: 7px 12px; border-radius: 16px; font-size: 13px; color: var(--text-2); background: var(--white); border: 1px solid var(--border); min-height: 36px; line-height: 1.2; }
.cat-pill.act { background: var(--navy); border-color: var(--navy); color: #fff; }
.tier-pill { padding: 6px 14px; border-radius: 16px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.06em; color: var(--text-2); background: var(--white); border: 1px solid var(--border-2); cursor: pointer; min-height: 36px; }
.tier-pill:hover { border-color: var(--border-2); background: var(--bg); }
.tier-pill.act { background: var(--orange-l); border-color: var(--orange-d); color: var(--orange-d); }

.item-card { background: var(--white); border: 1px solid var(--border); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 6px; text-align: left; cursor: pointer; position: relative; transition: border-color 120ms, transform 120ms; width: 100%; min-height: var(--touch); }
.item-card:hover { border-color: var(--navy-m); transform: translateY(-1px); }
.item-card[disabled] { opacity: 0.55; cursor: not-allowed; }
.item-card[disabled]:hover { border-color: var(--border); transform: none; }
.item-card .thumb-wrap { position: relative; margin-bottom: 2px; }
.item-card .stock-bdg { position: absolute; top: 6px; right: 6px; font-family: var(--mono); font-weight: 600; font-size: 10.5px; background: rgba(255,255,255,0.85); padding: 1px 6px; border-radius: 10px; color: var(--text-2); }
.item-card .cat { font-size: 10px; font-weight: 600; color: var(--orange-d); text-transform: uppercase; letter-spacing: 0.10em; }
.item-card .name { font-size: 13.5px; font-weight: 500; line-height: 1.25; min-height: 2.5em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item-card .price { font-family: var(--mono); font-weight: 600; font-size: 14px; color: var(--navy); margin-top: auto; }
.item-card .meta { font-size: 11px; color: var(--muted); font-family: var(--mono); line-height: 1.35; }

/* Tile placeholder for item images */
.tile { display:flex; flex-direction:column; align-items:center; justify-content:center; border-radius:8px; font-weight:700; letter-spacing:-0.02em; position:relative; overflow:hidden; flex-shrink:0; color:var(--muted); background:var(--bg-2); }
.tile.Oils         { background:linear-gradient(135deg,#FBE4C6 0%,#F5D198 100%); color:#7A4A0F; }
.tile.Sugar        { background:linear-gradient(135deg,#F8D7E0 0%,#EFB8C6 100%); color:#7E2D44; }
.tile.Grains       { background:linear-gradient(135deg,#F0E1B2 0%,#E2CC83 100%); color:#6A5612; }
.tile.Soap         { background:linear-gradient(135deg,#CFE0F2 0%,#A8C7E6 100%); color:#1B466F; }
.tile.Spreads      { background:linear-gradient(135deg,#FBE8A4 0%,#F2D670 100%); color:#7A5810; }
.tile.Spices       { background:linear-gradient(135deg,#F2BFA5 0%,#E89E7D 100%); color:#7B361A; }
.tile.Beverages    { background:linear-gradient(135deg,#BFE0DC 0%,#92CCC4 100%); color:#0F4B4A; }
.tile.Personal     { background:linear-gradient(135deg,#DCC9F0 0%,#BFA1E2 100%); color:#3D1F75; }
.tile.Dairy        { background:linear-gradient(135deg,#F0E8D2 0%,#DCCFA8 100%); color:#5C4923; }
.tile.Household    { background:linear-gradient(135deg,#D6D9E0 0%,#B5BCC8 100%); color:#3A4250; }

/* Modal — full-screen on mobile, centered card on desktop */
.modal-bd { position: fixed; inset: 0; background: rgba(15,37,64,0.45); z-index: 50; display: flex; align-items: stretch; justify-content: stretch; }
.modal { background: var(--white); width: 100%; height: 100%; display: flex; flex-direction: column; overflow: hidden; }
.modal-h { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; min-height: 56px; }
.modal-h h2 { font-size: 16px; font-weight: 600; }
.modal-h .close { margin-left: auto; padding: 8px; border-radius: 6px; color: var(--muted); min-height: var(--touch); min-width: var(--touch); display: inline-flex; align-items: center; justify-content: center; }
.modal-h .close:hover { background: var(--bg); }
.modal-b { padding: 16px; overflow: auto; flex: 1; }
.modal-f { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0)); }

/* Pop-overs (branch / user dropdowns) */
.pop { position: absolute; top: calc(100% + 6px); background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-pop); min-width: 240px; padding: 6px; z-index: 40; }
.pop-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 6px; color: var(--text-2); text-align: left; font-size: 14px; min-height: var(--touch); }
.pop-item:hover { background: var(--bg); }
.pop-item.act { background: var(--navy-l); color: var(--navy); }
.pop-title { padding: 8px 12px; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.10em; }
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
details[open] .pop-toggle { background: rgba(255,255,255,0.13); }

/* ============================================================
   sm — 480px+ (large phones)
   ============================================================ */
@media (min-width: 480px) {
  .flash-wrap { left: auto; right: 16px; width: min(360px, calc(100vw - 32px)); }
}

/* ============================================================
   md — 768px+ (tablets)
   ============================================================ */
@media (min-width: 768px) {
  .app {
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: var(--topbar-h) 1fr;
  }
  .topbar { grid-column: 1 / -1; padding: 0 16px 0 20px; gap: 14px; }
  .sidebar { display: flex; flex-direction: column; background: var(--white); border-right: 1px solid var(--border); overflow: hidden; }
  .tabbar { display: none; }                  /* hide bottom tab bar */
  .user-info { display: block; }
  .sync-chip { display: inline-flex; }
  .page-head { padding: 14px 24px; }
  .page-head h1 { font-size: 19px; }
  .pad { padding: 22px 24px; }
  body { font-size: 13.5px; }
  .btn { padding: 7px 13px; font-size: 13px; min-height: 38px; }
  .btn-sm { padding: 5px 10px; font-size: 12px; min-height: 32px; }
  .btn-lg { padding: 11px 18px; font-size: 14px; min-height: 46px; }
  .input { padding: 8px 11px; font-size: 13px; min-height: 38px; }
  .input.lg { padding: 10px 13px; font-size: 14px; min-height: 44px; }
  .modal-bd { align-items: center; justify-content: center; padding: 16px; }
  .modal { width: min(680px, calc(100vw - 32px)); height: auto; max-height: calc(100vh - 32px); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); animation: modal-in 220ms cubic-bezier(.16,1,.3,1); }
  @keyframes modal-in { from { opacity: 0; transform: scale(0.97) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
}

/* Sidebar nav (md+) */
.nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 1px; }
.nav-section { font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted-2); padding: 14px 12px 6px; font-weight: 600; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: 6px; color: var(--text-2); font-size: 13.5px; font-weight: 500; width: 100%; text-align: left; position: relative; min-height: 42px; }
.nav-item:hover { background: var(--bg); }
.nav-item.active { background: var(--navy-l); color: var(--navy); }
.nav-item.active::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; background: var(--orange); border-radius: 0 2px 2px 0; }
.nav-item .ico { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; display: inline-flex; align-items: center; justify-content: center; }
.nav-item .badge { margin-left: auto; font-size: 10px; font-weight: 600; background: var(--orange); color: #fff; padding: 1px 6px; border-radius: 9px; font-family: var(--mono); }
.nav-item .badge.gray { background: var(--bg-2); color: var(--muted); }
.nav-item .badge.red  { background: var(--red); }
.sidebar-foot { margin-top: auto; padding: 14px; border-top: 1px solid var(--border); font-size: 11px; color: var(--muted); }
.sidebar-foot .row { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.sidebar-foot .row + .row { margin-top: 6px; }
.sidebar-foot .v { color: var(--text-2); font-family: var(--mono); font-size: 11px; }

/* ============================================================
   lg — 1024px+ (desktop)
   ============================================================ */
@media (min-width: 1024px) {
  body { font-size: 13.5px; }
  .page-head { padding: 14px 28px; }
  .pad { padding: 22px 28px; }
}

/* ============================================================
   POS Shell layout — single column mobile, 60/40 split on tablet+
   ============================================================ */
.pos-shell { display: flex; flex-direction: column; height: 100%; overflow: auto; padding-bottom: 84px; }  /* room for mobile sticky bar */
.pos-items { padding: 12px; background: var(--bg); }
.pos-cart  { display: none; }  /* mobile + tablet portrait: cart panel hidden — see /pos/checkout */
.pos-stacked { display: block; }      /* mobile + tablet portrait stacked controls */
@media (min-width: 1024px) { .pos-stacked { display: none; } }

.pos-mobile-bar { position: fixed; left: 0; right: 0; bottom: var(--tabbar-h); background: var(--white); border-top: 1px solid var(--border); padding: 10px 12px; display: flex; align-items: center; gap: 10px; z-index: 25; }
@media (min-width: 768px) { .pos-mobile-bar { bottom: 0; left: var(--sidebar-w); } }
.pos-mobile-bar .summary { flex: 1; min-width: 0; }
.pos-mobile-bar .summary .lbl { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.pos-mobile-bar .summary .total { font-family: var(--mono); font-weight: 700; font-size: 18px; color: var(--navy); line-height: 1.15; }

/* 60/40 split only kicks in at landscape-tablet+ (≥1024px). Portrait tablets
   use the mobile single-column layout for usability. */
@media (min-width: 1024px) {
  .pos-shell {
    display: grid;
    grid-template-columns: 1fr 460px;
    grid-template-rows: 1fr;
    overflow: hidden;
    height: 100%;
    padding-bottom: 0;
  }
  .pos-items { padding: 16px 16px 16px 28px; overflow: auto; border-right: 1px solid var(--border); border-bottom: 0; }
  .pos-cart  { display: flex; flex-direction: column; min-width: 0; overflow: hidden; background: var(--white); }
  .pos-mobile-bar { display: none; }
}

/* ============================================================
   POS mobile layout refinements (phone-first)
   ============================================================ */
/* Product grid: 2-up on phones, denser auto-fill on larger screens. */
.pos-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 480px) { .pos-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; } }
@media (min-width: 1024px) { .pos-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); } }
/* Items-page tier switcher is only useful on phones (where the list collapses to
   one price column); desktop shows all three tier columns, so hide it there. */
@media (min-width: 768px) { .tier-switch-m { display: none !important; } }

/* Trim card chrome on phones for clean, tappable tiles. */
@media (max-width: 767px) {
  /* Sticky bottom tab bar on mobile. The grid layout already reserves a
     --tabbar-h row for it, but Mobile Safari's collapsing URL bar moves the
     "true" viewport, so the tabbar drifts off-screen when the user scrolls.
     Pinning it via position:fixed keeps it docked regardless of browser chrome. */
  .tabbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 30;
    box-shadow: 0 -1px 6px rgba(15, 37, 64, 0.06);
  }
  /* Scrollarea needs bottom clearance so content isn't hidden under the fixed
     tab bar. iOS safe-area inset is already baked into --tabbar-h's padding. */
  .scrollarea { padding-bottom: calc(var(--tabbar-h) + 12px); }
  /* When the POS mobile cart bar is shown it sits ABOVE the tabbar, so the
     scrollarea needs even more clearance — bar height + tabbar height. */
  body:has(.pos-mobile-bar.is-active) .scrollarea { padding-bottom: calc(var(--tabbar-h) + 72px); }

  .item-card { padding: 8px; gap: 4px; border-radius: 9px; }
  .item-card .cat, .item-card .meta { display: none; }
  .item-card .name { font-size: 12.5px; min-height: 2.4em; }
  .item-card .price { font-size: 13.5px; }
  .item-card .thumb-wrap img, .item-card .thumb-wrap > div { aspect-ratio: 1.4 / 1 !important; }

  /* Phones only: slim the Sales + Items LIST tables to Item · selected-tier
     price · stock. Desktop keeps the full table untouched. */
  .t-pos .col-img, .t-pos .col-sku, .t-pos .item-sub, .t-pos .col-tier:not(.tier-on),
  .t-items .col-img, .t-items .col-sku, .t-items .col-cat, .t-items .item-sub, .t-items .col-tier:not(.tier-on) {
    display: none;
  }

  /* Phones: drop the category filter strip (search covers it) ... */
  #pos-cats { display: none !important; }
  /* ... and slim the search bar (still 16px text so iOS doesn't zoom). */
  #pos-search { min-height: 42px; padding-top: 9px; padding-bottom: 9px; }

  /* §4 — Tier picker: THREE separate rounded pills with 10px gaps. Each pill
     sits on its own white background with a 1px border; the active one fills
     with the tier's colour (navy / purple / orange). Sized to match the
     search row beneath it so the two rows form a clean vertical rhythm. */
  .pos-tiers {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 10px !important;
    background: transparent !important;
    border: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    margin-bottom: 14px !important;
    flex-wrap: nowrap !important;
    justify-content: stretch !important;
  }
  .pos-tiers form { display: block !important; width: 100% !important; margin: 0; }
  .pos-tiers .tier-pill {
    width: 100% !important;
    height: 50px !important;
    min-height: 50px !important;
    padding: 0 !important;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--text-2);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: background-color 140ms, color 140ms, border-color 140ms, box-shadow 140ms;
  }
  .pos-tiers .tier-pill:not(.act):hover { border-color: var(--border-2); background: var(--bg); }
  .pos-tiers .tier-pill.act { color: #fff; border-color: transparent; }
  .pos-tiers .tier-pill.act[data-tier="retail"]    { background: var(--navy);   box-shadow: 0 4px 10px rgba(15,37,64,0.22); }
  .pos-tiers .tier-pill.act[data-tier="agent"]     { background: var(--purple); box-shadow: 0 4px 10px rgba(92,63,160,0.28); }
  .pos-tiers .tier-pill.act[data-tier="wholesale"] { background: var(--orange); box-shadow: 0 4px 10px rgba(232,98,42,0.28); }

  /* §5 — Search row + view toggle: matching height (50px) so the row aligns
     with the tier pills. Search field has a 14px corner radius, 15px text,
     and a 18px search icon at 14px from the left edge. The view toggle is a
     2-button segmented control with internal 7px corners on the active fill. */
  /* §5 — Search bar + view toggle. Both rows are EXACTLY 50px tall so they
     line up; the toggle's inner buttons are each 44×44 with 9px inner radius,
     icons centred at 18px. The active button fills navy with white icon. */
  .pos-search-row { gap: 10px !important; margin-bottom: 14px !important; align-items: stretch !important; }
  .pos-search-wrap { display: flex; align-items: center; }
  .pos-search-input {
    height: 50px !important;
    min-height: 50px !important;
    padding: 0 14px 0 42px !important;
    font-size: 15px !important;
    line-height: 50px !important;
    border-radius: 14px !important;
    border: 1px solid var(--border) !important;
    background: var(--white);
    box-sizing: border-box;
    width: 100%;
  }
  .pos-search-input::placeholder { color: var(--muted-2); font-weight: 400; }
  .pos-search-icon { left: 14px !important; pointer-events: none; }

  .pos-view-toggle {
    display: inline-flex !important;
    align-items: center;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 3px;
    height: 50px;
    flex-shrink: 0;
    gap: 0;
    box-sizing: border-box;
  }
  .pos-view-btn {
    width: 44px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: transparent;
    color: var(--muted-2);
    text-decoration: none;
    transition: background-color 120ms, color 120ms;
    border: 0;
    padding: 0;
  }
  .pos-view-btn svg { width: 18px; height: 18px; display: block; }
  .pos-view-btn.active {
    background: var(--navy);
    color: #fff;
    box-shadow: 0 1px 3px rgba(15,37,64,0.20);
  }
  .pos-view-btn:not(.active):hover { background: var(--bg); color: var(--text-2); }

  /* §8 — Empty cart bar = frosted-glass info pill.
     §9 — Filled cart bar = floating navy pill with cart-square, meta+total,
          orange Checkout CTA with shadow. Sits above the tab bar. */
  .pos-mobile-bar {
    left: 12px !important;
    right: 12px !important;
    bottom: calc(var(--tabbar-h) + 12px) !important;
    border-radius: 16px !important;
    padding: 12px 14px !important;
    gap: 12px !important;
  }
  /* ── Empty state ── */
  .pos-mobile-bar.is-empty {
    background: rgba(255,255,255,0.88) !important;
    border: 1px solid var(--border) !important;
    box-shadow: var(--shadow-lg) !important;
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    color: var(--text-2);
  }
  .pos-mobile-bar.is-empty .pmb-icon { color: var(--muted-2); flex-shrink: 0; display: inline-flex; }
  .pos-mobile-bar.is-empty .pmb-label { flex: 1; min-width: 0; font-size: 13px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pos-mobile-bar.is-empty .pmb-label strong { color: var(--text); font-weight: 600; }
  .pos-mobile-bar.is-empty .pmb-label span { color: var(--muted); }
  .pos-mobile-bar.is-empty .pmb-tier-pill {
    flex-shrink: 0;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    border: 1px solid var(--border-2);
    color: var(--text-2);
    background: var(--white);
  }
  .pos-mobile-bar.is-empty .pmb-tier-pill[data-tier="retail"]    { color: var(--navy);     border-color: var(--navy-m); }
  .pos-mobile-bar.is-empty .pmb-tier-pill[data-tier="agent"]     { color: var(--purple);   border-color: var(--purple); }
  .pos-mobile-bar.is-empty .pmb-tier-pill[data-tier="wholesale"] { color: var(--orange-d); border-color: var(--orange-m); }

  /* ── Active state ── */
  .pos-mobile-bar.is-active {
    background: var(--navy) !important;
    border: 0 !important;
    color: #fff;
    box-shadow: 0 14px 32px rgba(15,37,64,0.30) !important;
  }
  .pos-mobile-bar.is-active .pmb-cart-square {
    position: relative; flex-shrink: 0;
    width: 38px; height: 38px;
    background: rgba(255,255,255,0.10);
    border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
  }
  .pos-mobile-bar.is-active .pmb-count {
    position: absolute; top: -5px; right: -5px;
    min-width: 18px; height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--orange);
    color: #fff;
    font-family: var(--mono);
    font-size: 10.5px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--navy);
  }
  .pos-mobile-bar.is-active .pmb-meta {
    flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.1; gap: 1px;
  }
  .pos-mobile-bar.is-active .pmb-meta-top {
    font-size: 10.5px; font-weight: 600;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.70);
    text-transform: uppercase;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .pos-mobile-bar.is-active .pmb-total {
    font-family: var(--mono); font-feature-settings: 'tnum' 1;
    font-size: 18px; font-weight: 700;
    color: #fff;
    line-height: 1.15;
  }
  .pos-mobile-bar.is-active .pmb-total span {
    font-family: var(--sans);
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.55);
    margin-right: 4px;
    letter-spacing: 0.06em;
  }
  .pos-mobile-bar.is-active .pmb-checkout {
    flex-shrink: 0;
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--orange);
    color: #fff !important;
    font-size: 13.5px; font-weight: 600;
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(232,98,42,0.45);
    min-height: var(--touch);
    white-space: nowrap;
  }
  .pos-mobile-bar.is-active .pmb-checkout:hover { background: var(--orange-d); }

  /* §12 (partial) — Tab bar active state: orange 30×3 pill above the icon
     instead of just an underline; badge gets a white outline. */
  .tabbar .tab-item { position: relative; padding-top: 12px; }
  .tabbar .tab-item.active { color: var(--navy); }
  .tabbar .tab-item.active span:last-child { font-weight: 600; }
  .tabbar .tab-item.active::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 3px;
    border-radius: 2px;
    background: var(--orange);
  }
  .tabbar .tab-item .badge {
    box-shadow: 0 0 0 1.5px #fff;
    font-family: var(--mono);
    font-feature-settings: 'tnum' 1;
  }

  /* §12 — "More" tab opens a popover with the secondary destinations. Uses
     <details> so it's purely presentational (no JS state). */
  .tab-more { padding: 0; }
  .tab-more > summary { list-style: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 12px 0 8px; gap: 2px; width: 100%; color: inherit; }
  .tab-more > summary::-webkit-details-marker { display: none; }
  .tab-more > summary > span:last-child { font-size: 10.5px; }
  .tab-more[open] > summary { color: var(--navy); }
  .tab-more[open] > summary span:last-child { font-weight: 600; }
  .tab-more .tab-more-pop {
    position: absolute;
    right: 8px;
    bottom: calc(100% + 8px);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    padding: 6px;
    z-index: 200;
  }
  .tab-more .tab-more-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 8px;
    color: var(--text-2); text-decoration: none; font-size: 13.5px; font-weight: 500;
  }
  .tab-more .tab-more-item:hover { background: var(--bg); }
  /* Low-stock count chip on the Items entry inside the More popup. */
  .tab-more .tab-more-badge {
    margin-left: auto;
    background: var(--orange);
    color: #fff;
    font-family: var(--mono);
    font-size: 10.5px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 999px;
    min-width: 18px;
    text-align: center;
  }

  /* §3 — Customer chip avatar tinted by the active tier (navy / purple / orange). */
  .cust-avatar[data-tier="retail"]    { background: var(--navy-l);   color: var(--navy); }
  .cust-avatar[data-tier="agent"]     { background: var(--purple-l); color: var(--purple); }
  .cust-avatar[data-tier="wholesale"] { background: var(--orange-l); color: var(--orange-d); }
  /* Tier badge pill inside the customer chip. */
  .cust-tier-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 8px;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1.2;
    flex-shrink: 0;
  }
  .cust-tier-badge[data-tier="retail"]    { background: var(--navy-l);   color: var(--navy); }
  .cust-tier-badge[data-tier="agent"]     { background: var(--purple-l); color: var(--purple); }
  .cust-tier-badge[data-tier="wholesale"] { background: var(--orange-l); color: var(--orange-d); }

  /* §6 — Mobile list rows: collapse the table into a flex/grid layout
     (thumb · name+meta · price · orange-l plus tile). Desktop is untouched. */
  table.t.t-pos { display: block; width: 100%; background: var(--white); }
  table.t.t-pos thead { display: none; }
  table.t.t-pos tbody { display: block; }
  table.t.t-pos tr.pos-item {
    display: grid;
    /* Tighter grid so the name col gets more room. 40px thumb + 88px price
       cap + 36px add-tile leaves the name col ~165px on a 375px viewport. */
    grid-template-columns: 40px minmax(0, 1fr) auto 36px;
    column-gap: 10px;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
  }
  table.t.t-pos tr.pos-item > td:nth-of-type(2) { min-width: 0; overflow: hidden; }
  /* Hard-cap the price column to free maximum space for the name. */
  table.t.t-pos tr.pos-item > td.col-tier.tier-on { width: 68px; max-width: 68px; }
  /* Slim the product thumb on mobile list rows to match the reduced 40px col. */
  table.t.t-pos tr.pos-item .prod-thumb,
  table.t.t-pos tr.pos-item > td.col-img img { width: 40px !important; height: 40px !important; border-radius: 8px !important; }
  table.t.t-pos tr.pos-item .prod-thumb svg { width: 24px !important; height: 24px !important; }
  /* Smaller name (12.5px) + meta row without SKU — thumb already identifies
     the item visually, stock indicator carries the only critical meta. */
  table.t.t-pos tr.pos-item .item-name {
    font-size: 12.5px;
    line-height: 1.25;
    /* Allow a long product name to wrap to a 2nd line instead of ellipsis-clipping. */
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  table.t.t-pos tr.pos-item .item-meta-m > .mono { display: none; }
  /* Slightly smaller price + unit so the long names fit without truncation. */
  table.t.t-pos tr.pos-item > td.col-tier.tier-on { font-size: 13.5px !important; }
  table.t.t-pos tr.pos-item > td.col-tier.tier-on::after { font-size: 9px !important; }
  table.t.t-pos tr.pos-item > td { padding: 0; border: 0; background: transparent !important; display: block; }
  table.t.t-pos tr.pos-item > td.col-img { display: flex; }
  /* Hide the desktop-only cells on mobile (my display:block above re-shows them otherwise). */
  table.t.t-pos tr.pos-item > td.col-sku,
  table.t.t-pos tr.pos-item > td.col-tier:not(.tier-on),
  table.t.t-pos tr.pos-item > td.col-stock { display: none !important; }   /* stock now lives in the meta row */
  /* Active tier price cell: bigger, tier-coloured, mono, right-aligned. */
  table.t.t-pos tr.pos-item > td.col-tier.tier-on { font-family: var(--mono); font-feature-settings: 'tnum' 1; font-size: 14.5px; font-weight: 600; white-space: nowrap; text-align: right; }
  /* Item name + mobile meta row (sku + stock indicator). The .item-name rule
     above this block (line ~751) controls the actual layout — 2-line wrap. */
  .item-meta-m { display: flex; align-items: center; gap: 8px; margin-top: 2px; min-width: 0; }
  .item-meta-m .mono { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .stock-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 500; white-space: nowrap; }
  .stock-tag[data-state="ok"]  { color: var(--green); }
  .stock-tag[data-state="low"] { color: var(--amber); }
  .stock-tag[data-state="out"] { color: var(--red); }
  .stock-tag .stock-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
  /* The "+" tile: orange-l square with orange plus icon (replaces the dark navy button). */
  .pos-add-btn { background: var(--orange-l) !important; color: var(--orange-d) !important; border: 0 !important; box-shadow: none !important; width: 36px; height: 36px; padding: 0 !important; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; min-height: 36px !important; }
  .pos-add-btn[disabled] { background: var(--bg-2) !important; color: var(--muted-2) !important; }

  /* §6 — List row price column: tier-coloured number on top, mono "UGX · per {unit}" hint below. */
  table.t.t-pos tr.pos-item > td.col-tier.tier-on {
    display: flex !important;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 1px;
    line-height: 1.15;
    background: transparent !important;   /* drop the tinted block fill on mobile */
  }
  table.t.t-pos tr.pos-item > td.col-tier.tier-on::after {
    content: attr(data-unit);
    font-family: var(--mono);
    font-feature-settings: 'tnum' 1;
    font-size: 9.5px;
    color: var(--muted);
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
  }

  /* §7 — Grid card price: small "UGX" prefix + big bold tier-coloured number. */
  .item-card .price {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    font-family: var(--mono);
    font-feature-settings: 'tnum' 1;
  }
  .item-card .price .price-prefix {
    font-family: var(--sans);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--muted);
    text-transform: uppercase;
  }
  .item-card .price .price-num {
    font-size: 15px;
    font-weight: 700;
  }
  .item-card .price[data-tier="retail"]    .price-num { color: var(--navy); }
  .item-card .price[data-tier="agent"]     .price-num { color: var(--purple); }
  .item-card .price[data-tier="wholesale"] .price-num { color: var(--orange-d); }

  /* Items & Stock mobile: branch tabs (B1/B2 with on-hand totals + orange
     underline on active) sit between the KPI cards and the filter card. */
  /* Items page mobile 2×2 mini-stats — colored-icon tiles matching the
     customers page pattern (purple SKUs / Stock value, amber Low stock,
     red Out of stock). */
  .items-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
  .items-stat-tile { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 12px; min-width: 0; }
  .items-stat-icon { width: 26px; height: 26px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 8px; }
  .items-icon-purple { background: #EEE9F8; }
  .items-icon-amber  { background: #FEF4E3; }
  .items-icon-red    { background: #FDECEC; }
  .items-stat-lbl { font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .items-stat-num { font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-feature-settings: 'tnum' 1; font-size: 22px; font-weight: 700; color: #11202F; line-height: 1.05; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .items-stat-num.is-amber { color: #A0620A; }
  .items-stat-num.is-red   { color: #B83232; }
  .items-stat-ugx { font-size: 11.5px; color: var(--muted); font-weight: 500; margin-right: 2px; }
  .items-stat-sub { font-size: 10.5px; color: var(--muted); margin-top: 4px; }

  .items-branch-tabs {
    display: flex;
    align-items: stretch;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin: 4px 0 12px;
    padding: 0;
    background: transparent;
  }
  .items-branch-tab-form { margin: 0; flex: 1; display: flex; }
  .items-branch-tab {
    flex: 1;
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 12px 4px 14px;
    background: transparent;
    border: 0;
    border-bottom: 3px solid transparent;
    color: var(--muted-2);
    font-size: 13.5px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    margin-bottom: -1px;   /* overlap the strip's bottom border */
    transition: color 140ms, border-color 140ms;
  }
  .items-branch-tab .ibt-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--muted-2);
    flex-shrink: 0;
    align-self: center;
  }
  .items-branch-tab .ibt-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .items-branch-tab .ibt-count {
    margin-left: auto;
    font-family: var(--mono);
    font-feature-settings: 'tnum' 1;
    font-size: 12px;
    color: var(--muted-2);
    font-weight: 500;
  }
  .items-branch-tab.act {
    color: var(--text);
    border-bottom-color: var(--orange);
    font-weight: 600;
  }
  .items-branch-tab.act .ibt-dot { background: var(--green); }
  .items-branch-tab.act .ibt-count { color: var(--muted); }

  /* Items category pills with count badges ("All 8", "Beverages 3"). The
     parent .items-cat-pills is a horizontally-scrolling strip — the bar bleeds
     off-edge so the user can scroll without the strip looking clipped. */
  .items-cat-pills::-webkit-scrollbar { display: none; }
  .items-cat-pill {
    flex-shrink: 0;
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--white);
    border: 1px solid var(--border);
    color: var(--text-2);
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 120ms, color 120ms, border-color 120ms;
  }
  .items-cat-pill .icp-count {
    font-family: var(--mono);
    font-feature-settings: 'tnum' 1;
    font-size: 11px;
    color: var(--muted-2);
    background: var(--bg);
    padding: 1px 7px;
    border-radius: 999px;
    font-weight: 600;
  }
  .items-cat-pill.act { background: var(--navy); border-color: var(--navy); color: #fff; }
  .items-cat-pill.act .icp-count { color: rgba(255,255,255,0.85); background: rgba(255,255,255,0.18); }

  /* Compact KPI grid on phones: 2-column, tight cards. Numbers stay on one
     line (white-space:nowrap) so big values like "UGX 71.8M" don't break. */
  .scrollarea .kpi-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 8px !important; }
  .scrollarea .kpi-grid > .card { padding: 12px 14px !important; }
  .scrollarea .kpi-grid > .card .label { font-size: 10px; }
  .scrollarea .kpi-grid > .card .kpi-num {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .scrollarea .kpi-grid > .card .kpi-sub {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
  }

  /* Items grid on mobile: force 2 cards per row (the desktop minmax(220px) is
     too wide for a 375px viewport and collapses to 1-up). Trim padding + gap
     so two cards fit cleanly without overflow. */
  .items-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    padding: 12px !important;
    gap: 10px !important;
  }
  .items-grid > .card { padding: 10px !important; gap: 6px !important; }
  .items-grid > .card .name,
  .items-grid > .card > div > div[style*="font-size:13px"] { font-size: 12.5px !important; line-height: 1.25; }
  /* Slim the card body: hide the inline "category" label (replaced by the
     frosted sub-pill on the thumb), the 3-tier prices block, and the SKU +
     action-icons footer. The card focuses on: thumb · sub-pill · stock badge · name. */
  .items-grid > .card .item-card-titles .cat { display: none; }
  .items-grid > .card .item-card-tiers,
  .items-grid > .card .item-card-footer { display: none !important; }
  /* Frosted category sub-pill on the thumb — same look as the POS grid card. */
  .items-grid > .card > div:first-child { position: relative; }
  .items-grid > .card .cat-sub-pill {
    position: absolute;
    bottom: 6px;
    left: 6px;
    padding: 2px 7px;
    border-radius: 8px;
    background: rgba(255,255,255,0.78);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--orange-d);
    line-height: 1.4;
    max-width: calc(100% - 12px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  /* Floating white stock chip with subtle shadow on the thumb. */
  .items-grid > .card .stock-bdg {
    background: #fff !important;
    box-shadow: var(--shadow-sm);
    padding: 3px 8px !important;
    border-radius: 12px !important;
    font-size: 11px !important;
  }

  /* Items list row on mobile — flatten the wide desktop table into the same
     compact grid we use on the POS list: thumb · name · selected-tier price.
     Inventory-only columns (B1/B2 stock, reorder, status, Zoho, actions) are
     hidden here. Desktop is untouched. */
  table.t.t-items { display: block; }
  .t-items thead { display: none; }
  .t-items tbody { display: block; }
  .t-items tbody tr {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) auto;
    column-gap: 10px;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
  }
  /* Hide every cell by default; then opt-in show only thumb, name, and the
     active-tier price. This is robust against extra columns being added. */
  .t-items tbody tr > td { display: none !important; padding: 0 !important; border: 0 !important; background: transparent !important; }
  .t-items tbody tr > td.col-img { display: flex !important; }
  .t-items tbody tr > td:nth-of-type(2) { display: block !important; min-width: 0; overflow: hidden; }
  .t-items tbody tr > td.col-tier.tier-on { display: flex !important; flex-direction: column; align-items: flex-end; justify-content: center; line-height: 1.15; font-family: var(--mono); font-feature-settings: 'tnum' 1; font-size: 13.5px; font-weight: 600; }
  .t-items .prod-thumb,
  .t-items > tbody > tr > td.col-img img { width: 40px !important; height: 40px !important; border-radius: 8px !important; }
  .t-items .prod-thumb svg { width: 24px !important; height: 24px !important; }
  /* Hide the "per {unit}" subtitle on mobile (kept on desktop). */
  .t-items .item-sub { display: none !important; }

  /* §7 — Grid card chips: refine the floating white stock chip and add a
     bottom-left frosted category sub-pill on top of the thumbnail. */
  .item-card .thumb-wrap { position: relative; }
  .item-card .stock-bdg {
    background: #fff !important;
    box-shadow: var(--shadow-sm);
    padding: 3px 8px !important;
    border-radius: 12px !important;
    font-size: 11px !important;
  }
  .item-card .cat-sub-pill {
    position: absolute;
    bottom: 6px;
    left: 6px;
    padding: 2px 7px;
    border-radius: 8px;
    background: rgba(255,255,255,0.75);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--orange-d);
    line-height: 1.4;
    max-width: calc(100% - 12px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  /* Desktop hides the sub-pill (uses the .cat row underneath). */
}
@media (min-width: 768px) { .item-card .cat-sub-pill { display: none; } .item-meta-m { display: none !important; } }

/* Tier picker (mobile/tablet only — .pos-stacked): compact content-width pills. */
.pos-tiers { display: flex; flex-wrap: wrap; gap: 6px; }
.pos-tiers form { display: block; margin: 0; }
.pos-tiers .tier-pill { width: auto; }

/* Category pills: horizontal scroll strip on phones, wrap on tablet+. */
.pos-cats { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 2px; }
.pos-cats::-webkit-scrollbar { display: none; }
.pos-cats .cat-pill { flex: 0 0 auto; white-space: nowrap; }
@media (min-width: 768px) { .pos-cats { flex-wrap: wrap; overflow: visible; } }

/* Floating cart bar: lift it off the content + count badge. */
.pos-mobile-bar { box-shadow: 0 -4px 16px rgba(13, 17, 23, 0.08); }
.pos-mobile-bar .summary .lbl { display: inline-flex; align-items: center; gap: 6px; }
.pos-mobile-bar .cartcount { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--orange); color: #fff; font-size: 11px; font-weight: 700; font-family: var(--mono); }

/* ============================================================
   Cart as a slide-up sheet (<1024px). Desktop keeps the static panel.
   ============================================================ */
.cart-sheet-head { display: none; }   /* desktop: no grabber/close */
.cart-backdrop { display: none; }
@media (max-width: 1023px) {
  /* §11 — Bottom-sheet cart polish: deeper rounded top corners, branded handle,
     navy-tinted backdrop, refined payment chips, oversized orange Charge button. */
  .pos-cart {
    display: flex; flex-direction: column;
    position: fixed; left: 0; right: 0; bottom: 0;
    max-height: 90vh;
    background: var(--white);
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -12px 40px rgba(13, 17, 23, 0.28);
    transform: translateY(100%);
    transition: transform 300ms cubic-bezier(.16, 1, .3, 1);
    z-index: 1000;
    overflow: hidden;
  }
  .pos-cart.open { transform: translateY(0); }
  .pos-cart.no-transition { transition: none !important; }

  .cart-sheet-head { display: flex; align-items: center; gap: 10px; padding: 18px 16px 10px; border-bottom: 1px solid var(--border); position: relative; flex-shrink: 0; }
  .cart-sheet-head strong { font-size: 15px; font-weight: 600; }
  .cart-sheet-handle { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); width: 42px; height: 4px; border-radius: 2px; background: var(--border-2); }
  .cart-sheet-close { margin-left: auto; background: none; border: 0; color: var(--muted); padding: 4px; cursor: pointer; display: inline-flex; min-height: 0; }

  /* Navy-tinted backdrop per spec (vs. plain dark grey before). */
  .cart-backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 37, 64, 0.40); opacity: 0; visibility: hidden; transition: opacity 220ms; z-index: 999; }
  .cart-backdrop.open { opacity: 1; visibility: visible; }

  /* Payment method tiles: small cards, active filled navy with white. */
  .pos-cart .pm-btn { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; min-height: 60px; flex-direction: column; gap: 4px; padding: 8px 6px; font-size: 11.5px; font-weight: 600; color: var(--text-2); }
  .pos-cart .pm-btn:hover { border-color: var(--border-2); }
  .pos-cart .pm-btn.act { background: var(--navy); border-color: var(--navy); color: #fff; box-shadow: 0 1px 3px rgba(15,37,64,0.25); }

  /* Charge button: bigger orange CTA with a soft orange shadow. */
  .pos-cart .btn-accent.btn-lg { min-height: 52px; font-size: 14.5px; font-weight: 600; border-radius: 12px; box-shadow: 0 4px 14px rgba(232, 98, 42, 0.45); }
  body.cart-sheet-open { overflow: hidden; }

  /* Sheet-only tweaks: hide the cart discount, shrink the qty stepper. */
  .cart-discount-row { display: none !important; }
  .qty-stepper .qty-btn { width: 32px !important; height: 32px !important; }
  .qty-stepper .qty-num { width: 34px !important; height: 32px !important; }
  /* Let the item name wrap (show in full) while controls stay right-aligned. */
  .cart-line { gap: 8px !important; }
  .cart-line-name { white-space: normal !important; overflow: visible !important; text-overflow: clip !important; }
}

/* EOD petty-cash form: stack to one column on small phones so fields stay usable. */
@media (max-width: 480px) {
  .eod-expense-form { grid-template-columns: 1fr !important; }
  .eod-expense-form select { width: 100% !important; }
}

/* ============================================================
   Receivables mobile restyle — visual only.
   Scoped to <=767px; desktop markup/CSS untouched.
   ============================================================ */
@media (max-width: 767px) {
  /* Action row: two equal-width primary buttons. */
  .recv-m { display: block; }
  .recv-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 14px; }
  .recv-actions .recv-sync-form { margin: 0; display: block; }
  .recv-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 46px; padding: 0 12px; border-radius: 12px; font-family: 'IBM Plex Sans', system-ui, sans-serif; font-weight: 600; font-size: 14px; letter-spacing: -0.005em; white-space: nowrap; border: 0; cursor: pointer; line-height: 1; color: #fff; box-sizing: border-box; text-decoration: none; }
  .recv-btn-orange { background: #E8622A; box-shadow: 0 4px 14px rgba(232,98,42,0.32); }
  .recv-btn-orange:hover { background: #D4581F; color: #fff; }
  .recv-btn-navy   { background: #1A3C5E; box-shadow: 0 4px 14px rgba(26,60,94,0.28); }
  .recv-btn-navy:hover { background: #14304B; color: #fff; }

  /* Hero card — navy gradient with soft orange radial accent top-right. */
  .recv-hero { position: relative; overflow: hidden; border-radius: 14px; padding: 16px; margin-bottom: 14px;
    background: linear-gradient(135deg, #1A3C5E 0%, #0F2540 100%); color: #fff;
    box-shadow: 0 8px 22px rgba(15,37,64,0.18); }
  .recv-hero-accent { position: absolute; top: -40px; right: -30px; width: 160px; height: 160px; border-radius: 50%;
    background: radial-gradient(circle, rgba(232,98,42,0.28) 0%, rgba(232,98,42,0) 70%); pointer-events: none; }
  .recv-hero-label { position: relative; font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: rgba(255,255,255,0.7); font-weight: 600; margin-bottom: 4px; }
  .recv-hero-amount { position: relative; display: flex; align-items: baseline; gap: 6px; }
  .recv-hero-ugx { font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-size: 14px; color: rgba(255,255,255,0.75); font-weight: 500; }
  .recv-hero-num { font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-feature-settings: 'tnum' 1; font-size: 30px; line-height: 1.05; font-weight: 700; letter-spacing: -0.01em; }
  .recv-hero-meta { position: relative; display: flex; flex-wrap: nowrap; gap: 6px; margin-top: 10px; font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-size: 11px; color: rgba(255,255,255,0.78); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .recv-hero-dot { color: rgba(255,255,255,0.4); }
  .recv-hero-overdue { color: #FFB590; font-weight: 500; }

  /* 2-up mini-stats. */
  .recv-mini { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
  .recv-mini-tile { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: flex; align-items: center; gap: 10px; min-width: 0; }
  .recv-mini-icon { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
  .recv-icon-red   { background: #FDECEC; }
  .recv-icon-amber { background: #FEF4E3; }
  .recv-mini-body { min-width: 0; flex: 1; }
  .recv-mini-num { font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-feature-settings: 'tnum' 1; font-size: 13px; font-weight: 600; color: var(--ink, #11202F); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .recv-mini-lbl { font-size: 10.5px; color: var(--muted); margin-top: 2px; letter-spacing: 0.04em; }

  /* Search field above the toggle. */
  .recv-search-form { margin: 0 0 12px; }
  .recv-search-input { width: 100%; height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--border); background: #fff; font-size: 14px; box-sizing: border-box; outline: 0; }
  .recv-search-input:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(26,60,94,0.10); }

  /* By-invoice / by-customer toggle. */
  .recv-toggle { display: inline-flex; gap: 4px; padding: 4px; background: #EDF0F5; border-radius: 12px; margin-bottom: 14px; }
  .recv-toggle-btn { appearance: none; border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; font-family: 'IBM Plex Sans', system-ui, sans-serif; font-size: 12.5px; font-weight: 500; color: var(--muted); cursor: pointer; line-height: 1; }
  .recv-toggle-btn.is-on { background: #fff; color: var(--navy); font-weight: 600; box-shadow: 0 1px 3px rgba(15,37,64,0.10); }

  /* Card list. */
  .recv-list { display: flex; flex-direction: column; gap: 10px; }
  .recv-card { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 12px 12px 10px; position: relative; overflow: hidden; }
  .recv-card.is-overdue { box-shadow: inset 3px 0 0 #B83232; }
  .recv-card-row { display: flex; align-items: center; gap: 10px; }
  .recv-avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-family: 'IBM Plex Sans', system-ui, sans-serif; font-weight: 600; font-size: 12.5px; flex-shrink: 0; letter-spacing: 0.02em; }
  .recv-avatar-navy   { background: #EBF0F6; color: #1A3C5E; }
  .recv-avatar-purple { background: #EEE9F8; color: #5C3FA0; }
  .recv-avatar-orange { background: #FDF1EB; color: #C44B16; }
  .recv-card-id { flex: 1; min-width: 0; }
  .recv-cust { font-size: 14px; font-weight: 600; color: var(--ink, #11202F); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
  .recv-meta-line { display: flex; align-items: center; gap: 6px; margin-top: 3px; min-width: 0; }
  .recv-tier { display: inline-flex; align-items: center; height: 17px; padding: 0 6px; border-radius: 4px; font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600; line-height: 1; flex-shrink: 0; }
  .recv-tier-navy   { background: #EBF0F6; color: #1A3C5E; }
  .recv-tier-purple { background: #EEE9F8; color: #5C3FA0; }
  .recv-tier-orange { background: #FDF1EB; color: #C44B16; }
  .recv-inv-num { font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-feature-settings: 'tnum' 1; font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .recv-bal { text-align: right; flex-shrink: 0; padding-left: 6px; }
  .recv-bal-num { font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-feature-settings: 'tnum' 1; font-size: 16px; font-weight: 700; color: #11202F; line-height: 1.1; letter-spacing: -0.005em; white-space: nowrap; }
  .recv-card.is-overdue .recv-bal-num { color: #B83232; }
  .recv-bal-lbl { font-size: 9px; letter-spacing: 0.12em; color: var(--muted); margin-top: 2px; font-weight: 600; }

  .recv-meta-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--border); font-size: 11px; color: var(--muted); }
  .recv-meta-sep { color: rgba(0,0,0,0.18); }
  .recv-overdue-pill { margin-left: auto; background: #FDECEC; color: #B83232; font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 999px; letter-spacing: 0.02em; }

  .recv-progress { margin-top: 8px; height: 3px; background: #E9ECF2; border-radius: 999px; overflow: hidden; }
  .recv-progress-bar { height: 100%; background: #1D7A50; border-radius: 999px; }

  .recv-card-actions { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
  .recv-unsynced { background: #FEF4E3; color: #A0620A; font-size: 10px; font-weight: 600; padding: 3px 7px; border-radius: 999px; letter-spacing: 0.02em; }
  .recv-btn-sm { display: inline-flex; align-items: center; justify-content: center; height: 32px; padding: 0 12px; border-radius: 9px; font-family: 'IBM Plex Sans', system-ui, sans-serif; font-size: 12px; font-weight: 600; line-height: 1; border: 0; cursor: pointer; text-decoration: none; white-space: nowrap; }
  .recv-btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--navy); }
  .recv-btn-ghost:hover { background: #F4F6FA; color: var(--navy); }
  .recv-btn-fill { background: #E8622A; color: #fff; margin-left: auto; }
  .recv-btn-fill:hover { background: #D4581F; color: #fff; }
  /* When unsynced chip is present, push the Fill button right manually since
     the chip uses up the auto-margin spot. */
  .recv-card-actions .recv-unsynced + .recv-btn-ghost { margin-left: 0; }

  /* By-customer group cards: nested invoice list under the header. */
  .recv-group-list { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--border); display: flex; flex-direction: column; gap: 6px; }
  .recv-group-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; background: #F4F6FA; }
  .recv-group-row.is-overdue { box-shadow: inset 2px 0 0 #B83232; background: #FCEFEF; }
  .recv-group-id { flex: 1; min-width: 0; }
  .recv-group-meta { font-size: 10px; color: var(--muted); margin-top: 1px; }
  .recv-group-bal { font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-feature-settings: 'tnum' 1; font-size: 13px; font-weight: 600; color: #11202F; white-space: nowrap; }

  .recv-empty { padding: 32px 12px; text-align: center; color: var(--muted); font-size: 13px; background: #fff; border: 1px dashed var(--border); border-radius: 14px; }

  /* The page-head chips on receivables are redundant on mobile (hero shows
     the same totals). Hide them but keep desktop intact via .desktop-only. */

  /* ----- Receive payment screen (show.blade) ----- */
  .recv-pay-form { display: block; }
  .recv-sheet { background: #fff; border-radius: 18px 18px 14px 14px; padding: 8px 14px 18px; box-shadow: 0 -2px 12px rgba(15,37,64,0.06); margin: -4px -2px 14px; position: relative; }
  .recv-sheet-handle { width: 38px; height: 4px; border-radius: 2px; background: #D6DCE5; margin: 4px auto 12px; }
  .recv-sheet-hero { background: #F4F6FA; border-radius: 12px; padding: 12px; margin-bottom: 14px; }
  .recv-sheet-hero-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
  .recv-sheet-hero-id { flex: 1; min-width: 0; }
  .recv-sheet-hero-amt { display: flex; flex-direction: column; gap: 2px; }
  .recv-sheet-hero-lbl { font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
  .recv-sheet-hero-num { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
  .recv-sheet-hero-ugx { font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-size: 13px; color: var(--muted); font-weight: 500; }
  .recv-sheet-hero-num .mono { font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-feature-settings: 'tnum' 1; font-size: 26px; font-weight: 700; color: #11202F; letter-spacing: -0.01em; line-height: 1.05; }
  .recv-sheet-hero-over { margin-left: auto; background: #FDECEC; color: #B83232; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; }

  .recv-sheet-block { margin-bottom: 14px; }
  .recv-sheet-lbl { display: block; font-size: 11px; letter-spacing: 0.10em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
  .recv-sheet-lbl-sub { text-transform: none; letter-spacing: 0; color: var(--muted-2); font-weight: 400; font-size: 10.5px; }

  .recv-sheet-amount-wrap { position: relative; display: flex; align-items: center; height: 56px; padding: 0 14px; border-radius: 12px; background: #fff; border: 2px solid #E8622A; gap: 8px; }
  .recv-sheet-amount-prefix { font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-size: 13px; color: var(--muted); font-weight: 500; }
  .recv-sheet-amount { flex: 1; border: 0; outline: 0; background: transparent; font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-feature-settings: 'tnum' 1; font-size: 22px; font-weight: 700; text-align: right; color: #11202F; min-width: 0; }

  .recv-sheet-chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
  .recv-chip { appearance: none; border: 1px solid var(--border); background: #fff; height: 38px; border-radius: 10px; font-family: 'IBM Plex Sans', system-ui, sans-serif; font-size: 13px; font-weight: 600; color: var(--navy); cursor: pointer; line-height: 1; }
  .recv-chip.is-on { background: #FDF1EB; border-color: #E8622A; color: #C44B16; }

  .recv-method-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .recv-method-tile { appearance: none; border: 1px solid var(--border); background: #fff; border-radius: 12px; padding: 10px 6px; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; min-height: 64px; }
  .recv-method-icon { color: var(--muted); display: inline-flex; }
  .recv-method-name { font-size: 10.5px; font-weight: 600; color: var(--muted); letter-spacing: 0.02em; text-align: center; line-height: 1.1; word-break: break-word; }
  .recv-method-tile.is-on { background: #1A3C5E; border-color: #1A3C5E; }
  .recv-method-tile.is-on .recv-method-icon { color: #fff; }
  .recv-method-tile.is-on .recv-method-name { color: #fff; }

  .recv-sheet-ref { width: 100%; height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border); background: #fff; font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-size: 13px; box-sizing: border-box; outline: 0; }
  .recv-sheet-ref:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(26,60,94,0.10); }

  .recv-sheet-confirm { width: 100%; height: 54px; border-radius: 14px; border: 0; background: #E8622A; color: #fff; font-family: 'IBM Plex Sans', system-ui, sans-serif; font-size: 15px; font-weight: 700; letter-spacing: 0.01em; cursor: pointer; box-shadow: 0 6px 18px rgba(232,98,42,0.36); margin-top: 4px; }
  .recv-sheet-confirm:disabled { background: #D6DCE5; box-shadow: none; cursor: not-allowed; color: #fff; }
  .recv-sheet-confirm:hover:not(:disabled) { background: #D4581F; }

  .recv-sheet-details { margin-top: 14px; border-top: 1px dashed var(--border); padding-top: 12px; }
  .recv-sheet-details summary {
    font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: 0.04em;
    cursor: pointer; list-style: none;
    padding: 4px 0;
    display: flex; align-items: center; gap: 8px;
  }
  .recv-sheet-details summary::-webkit-details-marker { display: none; }
  .recv-sheet-details summary::after { content: '▾'; color: var(--muted-2); margin-left: 4px; }
  .recv-sheet-details[open] summary::after { content: '▴'; }
  .recv-sheet-selectall {
    margin-left: auto;
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 11.5px; font-weight: 500; color: var(--text-2);
    text-transform: none; letter-spacing: 0;
    cursor: pointer;
    padding: 4px 8px; border-radius: 6px;
    background: #fff; border: 1px solid var(--border);
  }
  .recv-sheet-selectall input { width: 14px; height: 14px; cursor: pointer; }

  .recv-sheet-alloc { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
  /* Interactive row — label so the whole card is one big tap target.
     Checkbox left · invoice info middle · amount input right. */
  .recv-sheet-alloc-row {
    display: grid;
    grid-template-columns: 20px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #F4F6FA;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: background 120ms, border-color 120ms;
  }
  .recv-sheet-alloc-row:has(input.alloc-check:not(:checked)) {
    background: #fff;
    border-color: var(--border);
    opacity: 0.55;
  }
  .recv-sheet-alloc-row.is-overdue { background: #FDECEC; }
  .recv-sheet-alloc-row .alloc-check { width: 18px; height: 18px; cursor: pointer; accent-color: #E8622A; }
  .recv-sheet-alloc-id { min-width: 0; }
  .recv-sheet-alloc-num { font-size: 12.5px; color: #11202F; font-weight: 700; letter-spacing: 0.01em; }
  .recv-sheet-alloc-bal { font-size: 11px; color: var(--muted); margin-top: 2px; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
  .recv-sheet-alloc-overdue { color: #B83232; font-weight: 700; font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; }

  /* Amount input on the right of each row */
  .recv-sheet-alloc-amt-wrap {
    display: inline-flex; align-items: center; gap: 4px;
    background: #fff; border: 1.5px solid #E8622A;
    border-radius: 8px; padding: 4px 8px;
    min-width: 116px;
  }
  .recv-sheet-alloc-prefix { font-size: 10px; color: var(--muted); font-weight: 500; }
  .recv-sheet-alloc-amt {
    border: 0; outline: 0; background: transparent;
    font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
    font-feature-settings: 'tnum' 1;
    font-size: 13px; font-weight: 700;
    text-align: right;
    color: #11202F;
    width: 100%; min-width: 0;
    appearance: textfield;
    -moz-appearance: textfield;
  }
  .recv-sheet-alloc-amt::-webkit-outer-spin-button,
  .recv-sheet-alloc-amt::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
  .recv-sheet-alloc-row:has(input.alloc-check:not(:checked)) .recv-sheet-alloc-amt-wrap { border-color: var(--border); }
  .recv-sheet-alloc-row:has(input.alloc-check:not(:checked)) .recv-sheet-alloc-amt { color: var(--muted); }

  .recv-sheet-alloc-empty {
    padding: 14px; text-align: center; color: var(--muted); font-size: 12px;
    background: #F4F6FA; border-radius: 10px;
  }
}

/* ============================================================
   Receipt paper — base styles used by /pos/receipt/{sale} and reused
   inside the mobile preview sheet (since the receipt page's inline
   <style> block isn't transferred when we lazy-load just .receipt-paper).
   ============================================================ */
.receipt-paper .row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 13px; }
.receipt-paper .row strong { font-weight: 600; }
.receipt-paper hr { border: 0; border-top: 1px dashed var(--border-2, var(--border)); margin: 10px 0; }
.receipt-paper .receipt-line { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; font-size: 12.5px; padding: 4px 0; border-bottom: 1px dotted var(--border); }
.receipt-paper .receipt-line .name { font-weight: 500; }
.receipt-paper .receipt-line .sub  { font-size: 11px; color: var(--muted); font-family: var(--mono); }
.receipt-paper .receipt-line .total { font-family: var(--mono); font-weight: 600; text-align: right; align-self: end; }

/* ============================================================
   Receipts (sales.index) mobile restyle — visual only.
   Scoped to <=767px; desktop table left untouched via .desktop-only.
   ============================================================ */
@media (max-width: 767px) {
  .recpt-m { display: block; }
  .recpt-head { margin-bottom: 12px; }
  .recpt-title { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; color: #11202F; line-height: 1.1; margin-top: 2px; }

  /* Action row */
  .recpt-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
  .recpt-actions .recpt-sync-form { margin: 0; display: block; }
  .recpt-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 46px; padding: 0 12px; border-radius: 12px; font-family: 'IBM Plex Sans', system-ui, sans-serif; font-weight: 600; font-size: 14px; white-space: nowrap; border: 0; cursor: pointer; line-height: 1; color: #fff; box-sizing: border-box; text-decoration: none; }
  .recpt-btn-orange { background: #E8622A; box-shadow: 0 4px 14px rgba(232,98,42,0.32); }
  .recpt-btn-orange:hover { background: #D4581F; color: #fff; }
  .recpt-btn-navy   { background: #1A3C5E; box-shadow: 0 4px 14px rgba(26,60,94,0.28); }
  .recpt-btn-navy:hover { background: #14304B; color: #fff; }

  /* Hero card */
  .recpt-hero { position: relative; overflow: hidden; border-radius: 14px; padding: 16px; margin-bottom: 14px;
    background: linear-gradient(135deg, #1A3C5E 0%, #0F2540 100%); color: #fff;
    box-shadow: 0 8px 22px rgba(15,37,64,0.18); }
  .recpt-hero-accent { position: absolute; top: -40px; right: -30px; width: 160px; height: 160px; border-radius: 50%;
    background: radial-gradient(circle, rgba(232,98,42,0.28) 0%, rgba(232,98,42,0) 70%); pointer-events: none; }
  .recpt-hero-grid { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: flex-start; }
  .recpt-hero-main { min-width: 0; }
  .recpt-hero-label { font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255,255,255,0.7); font-weight: 600; margin-bottom: 4px; }
  .recpt-hero-amount { display: flex; align-items: baseline; gap: 6px; }
  .recpt-hero-ugx { font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-size: 14px; color: rgba(255,255,255,0.75); font-weight: 500; }
  .recpt-hero-num { font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-feature-settings: 'tnum' 1; font-size: 30px; line-height: 1.05; font-weight: 700; letter-spacing: -0.01em; }
  .recpt-hero-meta { margin-top: 10px; font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-size: 11px; color: rgba(255,255,255,0.78); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  .recpt-hero-sync { text-align: right; min-width: 84px; }
  .recpt-hero-sync-lbl { font-size: 10px; letter-spacing: 0.14em; color: rgba(255,255,255,0.65); font-weight: 600; margin-bottom: 2px; }
  .recpt-hero-sync-num { font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-feature-settings: 'tnum' 1; font-size: 22px; font-weight: 700; color: #fff; line-height: 1; }
  .recpt-hero-sync-bar { margin-top: 6px; height: 3px; background: rgba(255,255,255,0.18); border-radius: 999px; overflow: hidden; }
  .recpt-hero-sync-fill { height: 100%; background: #E8622A; border-radius: 999px; }

  /* Search */
  .recpt-search-form { position: relative; margin-bottom: 12px; }
  .recpt-search-ico { position: absolute; top: 50%; left: 12px; transform: translateY(-50%); display: inline-flex; pointer-events: none; }
  .recpt-search-input { width: 100%; height: 44px; padding: 0 14px 0 36px; border-radius: 12px; border: 1px solid var(--border); background: #fff; font-size: 14px; box-sizing: border-box; outline: 0; }
  .recpt-search-input:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(26,60,94,0.10); }

  /* Filter chips */
  .recpt-filter { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; scrollbar-width: none; }
  .recpt-filter::-webkit-scrollbar { display: none; }
  .recpt-chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; background: #fff; border: 1px solid var(--border); font-family: 'IBM Plex Sans', system-ui, sans-serif; font-size: 12px; font-weight: 600; color: var(--muted); text-decoration: none; white-space: nowrap; flex-shrink: 0; }
  .recpt-chip-n { font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-size: 11px; font-weight: 600; opacity: 0.7; }
  .recpt-chip.is-on { background: #1A3C5E; border-color: #1A3C5E; color: #fff; }
  .recpt-chip.is-on .recpt-chip-n { opacity: 0.85; color: #fff; }
  .recpt-chip-green.is-on { background: #1D7A50; border-color: #1D7A50; }
  .recpt-chip-amber.is-on { background: #A0620A; border-color: #A0620A; }
  .recpt-chip-red.is-on   { background: #B83232; border-color: #B83232; }

  /* Toolbar (count + sort) */
  .recpt-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
  .recpt-toolbar-count { font-size: 12px; color: var(--muted); font-weight: 500; }
  .recpt-toolbar-sort { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 500; }

  /* Card list */
  .recpt-list { display: flex; flex-direction: column; gap: 10px; }
  .recpt-card { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 12px 12px 10px; }
  .recpt-card-row { display: flex; align-items: center; gap: 10px; }
  .recpt-avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 12.5px; flex-shrink: 0; letter-spacing: 0.02em; }
  .recpt-avatar-navy   { background: #EBF0F6; color: #1A3C5E; }
  .recpt-avatar-purple { background: #EEE9F8; color: #5C3FA0; }
  .recpt-avatar-orange { background: #FDF1EB; color: #C44B16; }
  .recpt-card-id { flex: 1; min-width: 0; }
  .recpt-cust { font-size: 14px; font-weight: 600; color: #11202F; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
  .recpt-meta-line { font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-feature-settings: 'tnum' 1; font-size: 11px; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .recpt-bal { text-align: right; flex-shrink: 0; padding-left: 6px; }
  .recpt-bal-num { font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-feature-settings: 'tnum' 1; font-size: 16px; font-weight: 700; color: #11202F; line-height: 1.1; white-space: nowrap; }
  .recpt-bal-lbl { font-size: 9px; letter-spacing: 0.12em; color: var(--muted); margin-top: 2px; font-weight: 600; }

  .recpt-meta-row { display: flex; align-items: center; gap: 6px; margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--border); font-size: 10.5px; color: var(--muted); flex-wrap: wrap; }
  .recpt-meta-method { display: inline-flex; align-items: center; gap: 4px; background: #F4F6FA; padding: 2px 7px; border-radius: 5px; font-size: 10px; font-weight: 600; color: #1A3C5E; letter-spacing: 0.04em; }
  .recpt-tier { display: inline-flex; align-items: center; height: 17px; padding: 0 6px; border-radius: 4px; font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600; line-height: 1; }
  .recpt-tier-navy   { background: #EBF0F6; color: #1A3C5E; }
  .recpt-tier-purple { background: #EEE9F8; color: #5C3FA0; }
  .recpt-tier-orange { background: #FDF1EB; color: #C44B16; }
  .recpt-meta-sep { color: rgba(0,0,0,0.18); }
  .recpt-meta-items, .recpt-meta-cashier { font-size: 11px; color: var(--muted); }
  .recpt-sync { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 999px; font-size: 9.5px; font-weight: 700; letter-spacing: 0.06em; }
  .recpt-sync .dot { width: 5px; height: 5px; border-radius: 50%; display: inline-block; }
  .recpt-sync-green { background: #E6F5EE; color: #1D7A50; } .recpt-sync-green .dot { background: #1D7A50; }
  .recpt-sync-amber { background: #FEF4E3; color: #A0620A; } .recpt-sync-amber .dot { background: #A0620A; }
  .recpt-sync-red   { background: #FDECEC; color: #B83232; } .recpt-sync-red .dot   { background: #B83232; }
  .recpt-sync-gray  { background: #EDF0F5; color: var(--muted); }

  .recpt-card-actions { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
  .recpt-btn-sm { display: inline-flex; align-items: center; justify-content: center; gap: 5px; height: 34px; padding: 0 12px; border-radius: 9px; font-family: 'IBM Plex Sans', system-ui, sans-serif; font-size: 12.5px; font-weight: 600; line-height: 1; border: 0; cursor: pointer; text-decoration: none; white-space: nowrap; }
  .recpt-btn-preview { background: #1A3C5E; color: #fff; flex: 1; }
  .recpt-btn-preview:hover { background: #14304B; color: #fff; }
  .recpt-btn-edit { background: transparent; border: 1px solid var(--border); color: var(--navy); }
  .recpt-btn-edit:hover { background: #F4F6FA; color: var(--navy); }
  .recpt-btn-del { background: transparent; border: 1px solid #F0C9C9; color: #B83232; width: 34px; padding: 0; }
  .recpt-btn-del:hover { background: #FDECEC; }
  /* Per-sale Zoho retry — amber-tinted ghost button so it stands apart from edit/delete. */
  .recpt-retry-form { margin: 0; display: inline-flex; }
  .recpt-btn-retry { background: #FEF4E3; border: 1px solid #F0CE85; color: #A0620A; }
  .recpt-btn-retry:hover { background: #FBE6BD; color: #A0620A; }

  /* Per-sale EFRIS fiscalise — navy ghost so it pairs with the existing Zoho buttons. */
  .recpt-fisc-form { margin: 0; display: inline-flex; }
  .recpt-btn-fisc  { background: #EBF0F6; border: 1px solid #B8CAD9; color: #1A3C5E; }
  .recpt-btn-fisc:hover { background: #DCE5EE; color: #1A3C5E; }
  /* FDN chip on the receipt card — small mono pill next to the sync status */
  .recpt-fdn { display: inline-flex; align-items: center; background: #EBF0F6; color: #1A3C5E; font-size: 9.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px; letter-spacing: 0.04em; margin-left: 4px; }

  /* Bulk pull fiscal numbers — wide outlined button under the action row. */
  .recpt-bulk-fiscalise { margin: 0 0 14px; display: block; }
  .recpt-btn-bulk-fisc {
    width: 100%; height: 38px; padding: 0 12px;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: 1px dashed var(--border); background: #F4F6FA;
    border-radius: 10px; font-family: 'IBM Plex Sans', system-ui, sans-serif;
    font-size: 12.5px; font-weight: 600; color: #1A3C5E; cursor: pointer;
  }
  .recpt-btn-bulk-fisc:hover { background: #EBF0F6; }
  .recpt-btn-fill { background: #1A3C5E; color: #fff; }
  .recpt-btn-fill:hover { background: #14304B; color: #fff; }

  .recpt-empty { padding: 32px 12px; text-align: center; color: var(--muted); font-size: 13px; background: #fff; border: 1px dashed var(--border); border-radius: 14px; }
  .recpt-pagination { margin-top: 14px; display: flex; justify-content: center; }

  /* ====== Bottom sheets ====== */
  .recpt-sheet-backdrop {
    position: fixed; inset: 0; background: rgba(15, 37, 64, 0.42);
    z-index: 80; opacity: 0; transition: opacity 220ms ease;
  }
  .recpt-sheet-backdrop.is-open { opacity: 1; }
  body.recpt-sheet-open { overflow: hidden; }

  .recpt-sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
    background: #fff; border-radius: 18px 18px 0 0;
    padding: 8px 16px 22px;
    max-height: 88vh; overflow-y: auto;
    transform: translateY(100%); transition: transform 240ms cubic-bezier(.2,.8,.2,1);
    box-shadow: 0 -8px 28px rgba(15, 37, 64, 0.18);
  }
  .recpt-sheet.is-open { transform: translateY(0); }
  .recpt-sheet-handle { width: 38px; height: 4px; border-radius: 2px; background: #D6DCE5; margin: 4px auto 14px; }

  .recpt-sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
  .recpt-sheet-head-text { flex: 1; min-width: 0; }
  .recpt-sheet-tag { font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
  .recpt-sheet-num { font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-size: 17px; font-weight: 700; color: #11202F; letter-spacing: -0.005em; }
  .recpt-sheet-sub { font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-size: 11px; color: var(--muted); margin-top: 3px; }

  .recpt-sheet-body { background: #FBFBFA; border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 14px; }
  .recpt-sheet-body .receipt-paper {
    /* Strip the dedicated receipt page's chrome so the body sits flush inside the sheet. */
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .recpt-loading { padding: 24px 8px; text-align: center; color: var(--muted); font-size: 12px; }

  .recpt-sheet-actions { display: flex; align-items: center; gap: 8px; }
  .recpt-sheet-actions > * { flex: 1; }
  .recpt-sheet-actions .recpt-btn-fill { flex: 1.4; }

  /* ====== Delete confirmation sheet ====== */
  .recpt-sheet-confirm { padding-bottom: 22px; text-align: center; }
  .recpt-del-icon {
    width: 64px; height: 64px; border-radius: 50%;
    background: #FDECEC;
    display: inline-flex; align-items: center; justify-content: center;
    margin: 6px auto 12px;
  }
  .recpt-del-title { font-size: 18px; font-weight: 700; color: #11202F; margin-bottom: 8px; }
  .recpt-del-body { font-size: 13px; color: var(--muted-2); line-height: 1.5; max-width: 300px; margin: 0 auto 18px; }
  .recpt-del-body strong { color: #11202F; font-weight: 600; }
  .recpt-del-actions { display: flex; gap: 10px; }
  .recpt-del-actions .recpt-btn-sm { flex: 1; height: 46px; font-size: 14px; }
  .recpt-btn-cancel { background: transparent; border: 1px solid var(--border); color: #11202F; }
  .recpt-btn-cancel:hover { background: #F4F6FA; }
  .recpt-btn-confirm-del { background: #B83232; color: #fff; border: 0; }
  .recpt-btn-confirm-del:hover { background: #9D2929; color: #fff; }
}

/* ============================================================
   Customers (customers.index) mobile restyle — visual only.
   Scoped to <=767px; desktop table left untouched via .desktop-only.
   Reuses .cust-avatar / .cust-tier-badge tier palette from earlier work.
   ============================================================ */
@media (max-width: 767px) {
  .cust-m {
    /* `.main` is a flex column that clips overflow — without flex:1 + overflow:auto
       on this element, the customers page can't scroll on mobile. Matches what
       `.scrollarea` does for the other pages, plus padding-bottom to clear the
       fixed tab bar. */
    display: block;
    flex: 1; min-height: 0;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding: 14px 16px calc(var(--tabbar-h) + 24px);
    background: var(--bg);
  }
  .cust-head { margin-bottom: 12px; }
  .cust-head .crumb { font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
  .cust-title { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; color: #11202F; line-height: 1.1; margin-top: 2px; }

  /* Primary action row (orange + navy) */
  .cust-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
  .cust-actions .cust-sync-form { margin: 0; display: block; }
  .cust-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 46px; padding: 0 12px; border-radius: 12px; font-family: 'IBM Plex Sans', system-ui, sans-serif; font-weight: 600; font-size: 14px; white-space: nowrap; border: 0; cursor: pointer; line-height: 1; color: #fff; box-sizing: border-box; text-decoration: none; }
  .cust-btn-orange { background: #E8622A; box-shadow: 0 4px 14px rgba(232,98,42,0.32); }
  .cust-btn-orange:hover { background: #D4581F; color: #fff; }
  .cust-btn-navy   { background: #1A3C5E; box-shadow: 0 4px 14px rgba(26,60,94,0.28); }
  .cust-btn-navy:hover { background: #14304B; color: #fff; }
  /* Secondary action row (outlined New customer + Export) */
  .cust-actions-secondary { margin-bottom: 14px; }
  .cust-btn-outline { background: #fff; color: #11202F; border: 1px solid var(--border); height: 42px; font-size: 13.5px; box-shadow: none; }
  .cust-btn-outline:hover { background: #F4F6FA; color: #11202F; }

  /* 2×2 mini-stats */
  .cust-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
  .cust-stat-tile { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 12px; min-width: 0; }
  .cust-stat-icon { width: 26px; height: 26px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 8px; }
  .cust-icon-purple { background: #EEE9F8; }
  .cust-icon-orange { background: #FDF1EB; }
  .cust-icon-amber  { background: #FEF4E3; }
  .cust-stat-lbl { font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
  .cust-stat-num { font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-feature-settings: 'tnum' 1; font-size: 22px; font-weight: 700; color: #11202F; line-height: 1.05; letter-spacing: -0.01em; }
  .cust-stat-ugx { font-size: 11.5px; color: var(--muted); font-weight: 500; margin-right: 2px; }
  .cust-stat-sub { font-size: 10.5px; color: var(--muted); margin-top: 4px; }

  /* Search */
  .cust-search-form { position: relative; margin-bottom: 10px; }
  .cust-search-ico { position: absolute; top: 50%; left: 12px; transform: translateY(-50%); display: inline-flex; pointer-events: none; }
  .cust-search-input { width: 100%; height: 44px; padding: 0 14px 0 36px; border-radius: 12px; border: 1px solid var(--border); background: #fff; font-size: 14px; box-sizing: border-box; outline: 0; }
  .cust-search-input:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(26,60,94,0.10); }

  /* Filter chips */
  .cust-filter { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; scrollbar-width: none; }
  .cust-filter::-webkit-scrollbar { display: none; }
  .cust-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 999px; background: #fff; border: 1px solid var(--border); font-family: 'IBM Plex Sans', system-ui, sans-serif; font-size: 12px; font-weight: 600; color: var(--muted); text-decoration: none; white-space: nowrap; flex-shrink: 0; }
  .cust-chip-n { font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-size: 11px; font-weight: 600; opacity: 0.7; }
  .cust-chip.is-on { background: #1A3C5E; border-color: #1A3C5E; color: #fff; }
  .cust-chip.is-on .cust-chip-n { opacity: 0.85; color: #fff; }

  /* Toolbar */
  .cust-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
  .cust-toolbar-count { font-size: 12px; color: var(--muted); font-weight: 500; }
  .cust-toolbar-sort { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 500; padding: 4px 9px; border: 1px solid var(--border); border-radius: 7px; background: #fff; }

  /* Card list */
  .cust-list { display: flex; flex-direction: column; gap: 10px; }
  .cust-card { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 14px; cursor: pointer; position: relative; overflow: hidden; }
  .cust-card.is-over { box-shadow: inset 3px 0 0 #B83232; }
  .cust-card-row { display: flex; align-items: center; gap: 12px; }
  /* Bigger version of the shared .cust-avatar (defined elsewhere) */
  .cust-card .cust-avatar { width: 40px; height: 40px; border-radius: 50%; font-weight: 700; font-size: 13px; letter-spacing: 0.02em; flex-shrink: 0; }
  .cust-avatar-lg { width: 48px !important; height: 48px !important; border-radius: 50%; font-size: 15px !important; }
  .cust-card-id { flex: 1; min-width: 0; }
  .cust-name { display: flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 700; color: #11202F; line-height: 1.2; min-width: 0; letter-spacing: -0.005em; }
  .cust-name-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cust-over-badge { background: #B83232; color: #fff; font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 4px; letter-spacing: 0.06em; flex-shrink: 0; }
  .cust-meta-line { display: flex; align-items: center; gap: 8px; margin-top: 4px; min-width: 0; flex-wrap: nowrap; }
  .cust-card .cust-tier-badge { font-size: 9.5px; padding: 0 7px; height: 18px; border-radius: 4px; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 700; line-height: 1; flex-shrink: 0; }
  .cust-phone { font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-feature-settings: 'tnum' 1; font-size: 11.5px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  /* Chevron at far right of the card row — must not shrink in tight space. */
  .cust-card-row > svg { flex-shrink: 0; margin-left: 2px; }

  .cust-credit-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border); }
  .cust-credit-main { flex: 1; min-width: 0; }
  .cust-credit-lbl { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
  .cust-credit-amount { font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-feature-settings: 'tnum' 1; font-size: 17px; font-weight: 700; color: #11202F; line-height: 1.1; margin-top: 3px; white-space: nowrap; letter-spacing: -0.005em; }
  .cust-card.is-over .cust-credit-amount { color: #B83232; }
  .cust-credit-pct { font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-size: 12.5px; font-weight: 600; color: var(--muted); flex-shrink: 0; }
  .cust-credit-pct.is-over { color: #B83232; }
  .cust-receive-btn { display: inline-flex; align-items: center; gap: 5px; background: #E8622A; color: #fff; border: 0; height: 32px; padding: 0 12px; border-radius: 9px; font-family: 'IBM Plex Sans', system-ui, sans-serif; font-size: 12px; font-weight: 600; text-decoration: none; white-space: nowrap; flex-shrink: 0; }
  .cust-receive-btn:hover { background: #D4581F; color: #fff; }

  .cust-empty { padding: 32px 12px; text-align: center; color: var(--muted); font-size: 13px; background: #fff; border: 1px dashed var(--border); border-radius: 14px; }

  /* ====== Bottom sheets ====== */
  .cust-sheet-backdrop {
    position: fixed; inset: 0; background: rgba(15, 37, 64, 0.42);
    z-index: 80; opacity: 0; transition: opacity 220ms ease;
  }
  .cust-sheet-backdrop.is-open { opacity: 1; }
  body.cust-sheet-open { overflow: hidden; }

  .cust-sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
    background: #fff; border-radius: 18px 18px 0 0;
    padding: 8px 16px 22px;
    max-height: 88vh; overflow-y: auto;
    transform: translateY(100%); transition: transform 240ms cubic-bezier(.2,.8,.2,1);
    box-shadow: 0 -8px 28px rgba(15, 37, 64, 0.18);
  }
  .cust-sheet.is-open { transform: translateY(0); }
  .cust-sheet-handle { width: 38px; height: 4px; border-radius: 2px; background: #D6DCE5; margin: 4px auto 14px; }

  .cust-sheet-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
  .cust-sheet-head-text { flex: 1; min-width: 0; }
  .cust-sheet-tag { font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
  .cust-sheet-name-row { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 700; color: #11202F; }
  .cust-sheet-name-row .cust-tier-badge { font-size: 9.5px; padding: 0 6px; height: 17px; border-radius: 4px; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600; line-height: 1; }
  .cust-sheet-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
  .cust-sheet-close { background: transparent; border: 0; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; padding: 4px 8px; }
  .cust-sheet-lbl { font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 10px 0 6px; }

  /* Credit box inside preview sheet */
  .cust-credit-box { background: #FCEFEF; border: 1px solid #F5D5D5; border-radius: 12px; padding: 14px; margin-bottom: 8px; }
  .cust-credit-box:not(.is-over) { background: #F4F6FA; border-color: var(--border); }
  .cust-credit-grid { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
  .cust-credit-limit { text-align: right; }
  .cust-credit-tag { font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
  .cust-credit-big   { font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-feature-settings: 'tnum' 1; font-size: 22px; font-weight: 700; color: #11202F; line-height: 1.05; }
  .cust-credit-box.is-over .cust-credit-big { color: #B83232; }
  .cust-credit-big-2 { font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-feature-settings: 'tnum' 1; font-size: 14px; font-weight: 600; color: #11202F; line-height: 1.1; }
  .cust-credit-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; font-size: 11.5px; color: var(--muted); font-weight: 500; }
  .cust-credit-over { color: #B83232; font-weight: 700; }

  /* Recent sales list */
  .cust-recent-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
  .cust-recent-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: #F4F6FA; border-radius: 8px; }
  .cust-recent-id { flex: 1; min-width: 0; }
  .cust-recent-num  { font-size: 12.5px; font-weight: 600; color: #11202F; }
  .cust-recent-meta { font-size: 10.5px; color: var(--muted); margin-top: 1px; }
  .cust-recent-total{ font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-size: 13px; font-weight: 600; color: #11202F; white-space: nowrap; }
  .cust-recent-empty { padding: 14px; text-align: center; color: var(--muted); font-size: 12px; background: #F4F6FA; border-radius: 10px; }

  /* Sheet action row */
  .cust-sheet-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .cust-btn-sm { display: inline-flex; align-items: center; justify-content: center; gap: 5px; height: 38px; padding: 0 14px; border-radius: 10px; font-family: 'IBM Plex Sans', system-ui, sans-serif; font-size: 12.5px; font-weight: 600; line-height: 1; border: 0; cursor: pointer; text-decoration: none; white-space: nowrap; }
  .cust-btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--navy); }
  .cust-btn-ghost:hover { background: #F4F6FA; color: var(--navy); }
  .cust-btn-fill { background: #E8622A; color: #fff; flex: 1; }
  .cust-btn-fill:hover { background: #D4581F; color: #fff; }
  .cust-btn-del { background: transparent; border: 1px solid #F0C9C9; color: #B83232; width: 38px; padding: 0; }
  .cust-btn-del:hover { background: #FDECEC; }

  /* Edit sheet form */
  .cust-edit-form { display: block; }
  .cust-edit-lbl { display: block; font-size: 11px; letter-spacing: 0.10em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 8px 0 6px; }
  .cust-edit-input { width: 100%; height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border); background: #fff; font-size: 14px; box-sizing: border-box; outline: 0; }
  .cust-edit-input:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(26,60,94,0.10); }
  .cust-edit-actions { margin-top: 16px; }
  .cust-edit-actions .cust-btn-fill { background: #1A3C5E; }
  .cust-edit-actions .cust-btn-fill:hover { background: #14304B; }

  /* Delete confirmation sheet */
  .cust-sheet-confirm { padding-bottom: 22px; text-align: center; }
  .cust-del-icon { width: 64px; height: 64px; border-radius: 50%; background: #FDECEC; display: inline-flex; align-items: center; justify-content: center; margin: 6px auto 12px; }
  .cust-del-title { font-size: 18px; font-weight: 700; color: #11202F; margin-bottom: 8px; }
  .cust-del-body { font-size: 13px; color: var(--muted-2); line-height: 1.5; max-width: 320px; margin: 0 auto 18px; }
  .cust-del-body strong { color: #11202F; font-weight: 600; }
  .cust-del-actions { display: flex; gap: 10px; }
  .cust-del-actions .cust-btn-sm { flex: 1; height: 46px; font-size: 14px; }
  .cust-btn-cancel { background: transparent; border: 1px solid var(--border); color: #11202F; }
  .cust-btn-cancel:hover { background: #F4F6FA; }
  .cust-btn-confirm-del { background: #B83232; color: #fff; border: 0; }
  .cust-btn-confirm-del:hover { background: #9D2929; color: #fff; }
}

/* ============================================================
   Reports (reports.index) mobile restyle — visual only.
   Scoped to <=767px; desktop tables left untouched via .desktop-only.
   ============================================================ */
@media (max-width: 767px) {
  .rep-m {
    display: block; flex: 1; min-height: 0;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding: 14px 16px calc(var(--tabbar-h) + 24px);
    background: var(--bg);
  }
  .rep-head { margin-bottom: 12px; }
  .rep-head .crumb { font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
  .rep-title { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; color: #11202F; line-height: 1.1; margin-top: 2px; }

  /* Action row */
  .rep-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
  .rep-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 46px; padding: 0 12px; border-radius: 12px; font-family: 'IBM Plex Sans', system-ui, sans-serif; font-weight: 600; font-size: 14px; white-space: nowrap; border: 0; cursor: pointer; line-height: 1; color: #fff; box-sizing: border-box; }
  .rep-btn-orange { background: #E8622A; box-shadow: 0 4px 14px rgba(232,98,42,0.32); }
  .rep-btn-orange:hover { background: #D4581F; }
  .rep-btn-navy   { background: #1A3C5E; box-shadow: 0 4px 14px rgba(26,60,94,0.28); }
  .rep-btn-navy:hover { background: #14304B; }

  /* Range tabs */
  .rep-range-tabs { display: inline-flex; gap: 4px; padding: 4px; background: #EDF0F5; border-radius: 12px; margin-bottom: 14px; width: 100%; box-sizing: border-box; }
  .rep-range-tab { flex: 1; appearance: none; border: 0; background: transparent; padding: 8px 12px; border-radius: 9px; font-family: 'IBM Plex Sans', system-ui, sans-serif; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; line-height: 1; text-decoration: none; text-align: center; display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
  .rep-range-tab.is-on { background: #fff; color: #1A3C5E; box-shadow: 0 1px 3px rgba(15,37,64,0.10); }

  /* Hero card */
  .rep-hero { position: relative; overflow: hidden; border-radius: 14px; padding: 16px; margin-bottom: 14px;
    background: linear-gradient(135deg, #1A3C5E 0%, #0F2540 100%); color: #fff;
    box-shadow: 0 8px 22px rgba(15,37,64,0.18); }
  .rep-hero-accent { position: absolute; top: -50px; right: -40px; width: 180px; height: 180px; border-radius: 50%;
    background: radial-gradient(circle, rgba(232,98,42,0.32) 0%, rgba(232,98,42,0) 70%); pointer-events: none; }
  .rep-hero-grid { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: flex-end; }
  .rep-hero-main { min-width: 0; }
  .rep-hero-label { font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255,255,255,0.7); font-weight: 600; margin-bottom: 4px; }
  .rep-hero-amount { display: flex; align-items: baseline; gap: 6px; }
  .rep-hero-ugx { font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-size: 14px; color: rgba(255,255,255,0.75); font-weight: 500; }
  .rep-hero-num { font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-feature-settings: 'tnum' 1; font-size: 30px; line-height: 1.05; font-weight: 700; letter-spacing: -0.01em; }
  .rep-hero-meta { margin-top: 8px; font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-size: 11px; color: rgba(255,255,255,0.78); display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
  .rep-hero-change { color: #7ADBA8; font-weight: 600; }
  .rep-hero-change.is-down { color: #FFB590; }
  .rep-hero-dot { color: rgba(255,255,255,0.35); }

  .rep-hero-chart { display: inline-flex; align-items: flex-end; gap: 4px; height: 60px; padding-bottom: 2px; }
  .rep-bar { display: inline-block; width: 9px; background: rgba(255,255,255,0.28); border-radius: 2px 2px 0 0; }
  .rep-bar.is-last { background: #E8622A; }

  .rep-hero-axis { position: relative; margin-top: 10px; display: flex; justify-content: space-between; font-size: 10px; color: rgba(255,255,255,0.55); }

  /* 2x2 mini-stats */
  .rep-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
  .rep-stat-tile { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 12px; min-width: 0; }
  .rep-stat-icon { width: 26px; height: 26px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 8px; }
  .rep-icon-purple { background: #EEE9F8; }
  .rep-icon-amber  { background: #FEF4E3; }
  .rep-icon-green  { background: #E6F5EE; }
  .rep-icon-orange { background: #FDF1EB; }
  .rep-stat-lbl { font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rep-stat-num { font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-feature-settings: 'tnum' 1; font-size: 18px; font-weight: 700; color: #11202F; line-height: 1.1; letter-spacing: -0.005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rep-stat-ugx { font-size: 11.5px; color: var(--muted); font-weight: 500; margin-right: 2px; }
  .rep-stat-sub { font-size: 10.5px; color: var(--muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* Section label */
  .rep-section-lbl { font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 4px 0 8px; display: block; }

  /* Breakdown tabs */
  .rep-bd-tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 10px; padding-bottom: 4px; scrollbar-width: none; }
  .rep-bd-tabs::-webkit-scrollbar { display: none; }
  .rep-bd-tab { appearance: none; border: 1px solid var(--border); background: #fff; padding: 8px 14px; border-radius: 999px; font-family: 'IBM Plex Sans', system-ui, sans-serif; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; line-height: 1; white-space: nowrap; flex-shrink: 0; }
  .rep-bd-tab.is-on { background: #1A3C5E; border-color: #1A3C5E; color: #fff; }

  /* Breakdown rows */
  .rep-list { display: flex; flex-direction: column; gap: 6px; }
  .rep-row { display: flex; align-items: center; gap: 10px; padding: 12px; background: #fff; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; text-align: left; font-family: inherit; appearance: none; width: 100%; box-sizing: border-box; }
  .rep-row-static { cursor: default; }
  .rep-row-ico { width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; font-family: 'IBM Plex Sans', system-ui, sans-serif; font-weight: 700; font-size: 12px; }
  .rep-ico-navy   { background: #EBF0F6; color: #1A3C5E; }
  .rep-ico-purple { background: #EEE9F8; color: #5C3FA0; }
  .rep-ico-amber  { background: #FEF4E3; color: #A0620A; }
  .rep-ico-red    { background: #FDECEC; color: #B83232; }
  .rep-ico-green  { background: #E6F5EE; color: #1D7A50; }
  .rep-ico-orange { background: #FDF1EB; color: #C44B16; }
  .rep-row-id { flex: 1; min-width: 0; }
  .rep-row-name { font-size: 13.5px; font-weight: 600; color: #11202F; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rep-row-meta { font-size: 10.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rep-row-amount { text-align: right; flex-shrink: 0; padding-left: 6px; }
  .rep-row-total { font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-feature-settings: 'tnum' 1; font-size: 14px; font-weight: 700; color: #11202F; line-height: 1.1; white-space: nowrap; }
  .rep-row-pct   { font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-size: 11px; color: var(--muted); margin-top: 2px; }
  .rep-empty { padding: 24px 12px; text-align: center; color: var(--muted); font-size: 12.5px; background: #fff; border: 1px dashed var(--border); border-radius: 12px; }

  /* ====== Sheets ====== */
  .rep-sheet-backdrop { position: fixed; inset: 0; background: rgba(15, 37, 64, 0.42); z-index: 80; opacity: 0; transition: opacity 220ms ease; }
  .rep-sheet-backdrop.is-open { opacity: 1; }
  body.rep-sheet-open { overflow: hidden; }

  .rep-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; background: #fff; border-radius: 18px 18px 0 0; padding: 8px 16px 22px; max-height: 88vh; overflow-y: auto; transform: translateY(100%); transition: transform 240ms cubic-bezier(.2,.8,.2,1); box-shadow: 0 -8px 28px rgba(15, 37, 64, 0.18); }
  .rep-sheet.is-open { transform: translateY(0); }
  .rep-sheet-handle { width: 38px; height: 4px; border-radius: 2px; background: #D6DCE5; margin: 4px auto 14px; }
  .rep-sheet-tag { font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
  .rep-sheet-title { font-size: 18px; font-weight: 700; color: #11202F; letter-spacing: -0.005em; }
  .rep-sheet-sub { font-size: 12px; color: var(--muted); margin-top: 4px; margin-bottom: 14px; }

  .rep-drill-body { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
  .rep-drill-body .rep-row { background: #F4F6FA; border: 0; }

  .rep-sheet-actions { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
  .rep-sheet-actions > * { flex: 1; }
  .rep-btn-sm { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 46px; padding: 0 14px; border-radius: 11px; font-family: 'IBM Plex Sans', system-ui, sans-serif; font-size: 13.5px; font-weight: 600; line-height: 1; border: 0; cursor: pointer; text-decoration: none; }
  .rep-btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--navy); }
  .rep-btn-ghost:hover { background: #F4F6FA; color: var(--navy); }
  .rep-btn-fill { background: #1A3C5E; color: #fff; }
  .rep-btn-fill:hover { background: #14304B; color: #fff; }
  .rep-btn-confirm { background: #E8622A; }
  .rep-btn-confirm:hover { background: #D4581F; }
  .rep-btn-cancel { background: transparent; border: 1px solid var(--border); color: #11202F; }
  .rep-btn-cancel:hover { background: #F4F6FA; }

  /* Export sheet — format grid + include switches */
  .rep-format-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 14px; }
  .rep-format-tile { appearance: none; border: 1px solid var(--border); background: #fff; border-radius: 12px; padding: 12px 6px; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; min-height: 70px; font-family: 'IBM Plex Sans', system-ui, sans-serif; font-size: 12.5px; font-weight: 600; color: var(--muted); }
  .rep-format-tile.is-on { background: #1A3C5E; border-color: #1A3C5E; color: #fff; }
  .rep-format-tile.is-on svg { color: #fff; }

  .rep-include-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
  .rep-include-row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: #F4F6FA; border-radius: 10px; font-size: 13.5px; color: #11202F; cursor: pointer; }
  .rep-include-row > span:first-child { flex: 1; }
  .rep-include-row .rep-switch { position: absolute; opacity: 0; pointer-events: none; }
  .rep-include-row .rep-switch-vis { width: 36px; height: 20px; border-radius: 999px; background: #D6DCE5; position: relative; transition: background 160ms; flex-shrink: 0; }
  .rep-include-row .rep-switch-vis::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.15); transition: left 160ms; }
  .rep-include-row .rep-switch:checked ~ .rep-switch-vis { background: #1D7A50; }
  .rep-include-row .rep-switch:checked ~ .rep-switch-vis::after { left: 18px; }

  .rep-email-input { width: 100%; height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border); background: #fff; font-size: 14px; box-sizing: border-box; outline: 0; margin-bottom: 14px; }
  .rep-email-input:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(26,60,94,0.10); }

  .rep-custom-form { display: block; }
}

/* ============================================================
   Visibility utility refinements
   ============================================================ */
@media (min-width: 768px) {
  .mobile-only { display: none !important; }
  .desktop-only { display: block !important; }
  .desktop-only.inline { display: inline-flex !important; }
}
