/* =========================================================
   DeepestTrack design tokens
   Palette drawn from a wholesale cosmetics counter: deep
   berry-plum for authority, warm gold for value, a blush
   swatch strip as the recurring signature motif.
   ========================================================= */
:root{
  --bg: #FBF6F4;
  --surface: #FFFFFF;
  --ink: #2A1E27;
  --muted: #8C7A86;
  --border: #ECE1E4;

  --plum: #5C2748;
  --plum-dark: #3C1830;
  --plum-light: #7A3A63;
  --gold: #C6963F;
  --gold-light: #F1DCB0;
  --blush: #F2D9E1;
  --blush-deep: #E3AFC4;

  --success: #3E8F5F;
  --success-bg: #E7F5EC;
  --danger: #C0453B;
  --danger-bg: #FBEAE8;
  --warning: #C7862B;
  --warning-bg: #FCF0DF;
  --info: #396C9E;
  --info-bg: #E7F0FA;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 2px 10px rgba(60,24,48,0.06), 0 1px 2px rgba(60,24,48,0.05);
  --shadow-lg: 0 12px 32px rgba(60,24,48,0.14);
  --font-display: 'Fraunces', serif;
  --font-body: 'Inter', system-ui, sans-serif;
}

/* Disable double-tap-to-zoom on the POS and Calculator POS pages only —
   cashiers tapping product tiles/buttons quickly during a sale can
   accidentally trigger the browser's double-tap zoom gesture. This does
   NOT disable pinch-to-zoom (still available if genuinely needed), only
   the accidental double-tap kind. Scoped via the page-specific body
   class set in includes/header.php, so other pages are unaffected. */
body.page-pos, body.page-calculator_pos{
  touch-action: manipulation;
}

*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
body{
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.5;
}
h1,h2,h3,.display{ font-family: var(--font-display); letter-spacing:-0.01em; }
a{ color: var(--plum); text-decoration:none; }
.muted{ color: var(--muted); }

/* ---------- Swatch strip signature motif ---------- */
.swatch-strip{ display:flex; gap:4px; }
.swatch-strip span{ width:8px; height:8px; border-radius:50%; display:inline-block; }
.swatch-strip span:nth-child(1){ background: var(--blush-deep); }
.swatch-strip span:nth-child(2){ background: var(--gold); }
.swatch-strip span:nth-child(3){ background: var(--plum-light); }

/* ================= AUTH PAGE ================= */
.auth-body{ background: linear-gradient(135deg, var(--plum-dark), var(--plum) 60%, var(--plum-light)); min-height:100vh; }
.auth-wrap{ display:grid; grid-template-columns: 1.1fr 1fr; max-width:960px; margin:0 auto; min-height:100vh; align-items:center; gap:0; }
.auth-brand{ color:#fff; padding:40px; }
.auth-brand-mark{ width:56px;height:56px;border-radius:14px; object-fit:cover; display:block; margin-bottom:22px;}
.auth-brand h1{ font-size:38px; margin:0 0 10px; }
.auth-brand p{ color: var(--blush); margin:0 0 20px; max-width:320px; }
.auth-points{ list-style:none; padding:0; margin:0; display:flex; flex-direction:column; gap:10px; }
.auth-points li{ padding-left:22px; position:relative; color:#EFDFE8; font-size:13.5px; }
.auth-points li::before{ content:'✓'; position:absolute; left:0; color:var(--gold); font-weight:700; }
.auth-card{ background:var(--surface); border-radius:18px; padding:40px 36px; box-shadow: var(--shadow-lg); margin:24px; }
.auth-card h2{ margin:0 0 4px; font-size:26px; }
.auth-card form{ margin-top:20px; display:flex; flex-direction:column; gap:12px; }
.auth-card label{ font-size:12.5px; font-weight:600; color:var(--muted); text-transform:uppercase; letter-spacing:.04em; }
.password-field{ display:flex; align-items:center; border:1px solid var(--border); border-radius:var(--radius-sm); background:#fff; }
.password-field input{ border:none; background:transparent; flex:1; width:auto; min-width:0; }
.password-field input:focus{ outline:none; }
.password-field:focus-within{ outline:2px solid var(--plum-light); outline-offset:1px; }
.password-toggle{ background:none; border:none; cursor:pointer; font-size:16px; padding:6px 12px 6px 4px; color:var(--muted); line-height:1; flex:none; }
.password-toggle:hover{ color:var(--ink); }
.hint{ font-size:12px; color:var(--muted); margin-top:16px; }
@media (max-width: 760px){ .auth-wrap{ grid-template-columns:1fr; } .auth-brand{ text-align:center; display:flex; flex-direction:column; align-items:center;} }

/* ================= FORM CONTROLS ================= */
input, select, textarea{
  font-family: var(--font-body);
  font-size: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  width: 100%;
}
input[type="checkbox"], input[type="radio"]{
  width: 16px;
  height: 16px;
  padding: 0;
  flex: none;
  cursor: pointer;
}
input:focus, select:focus, textarea:focus{
  outline: 2px solid var(--plum-light);
  outline-offset: 1px;
  border-color: var(--plum-light);
}
label{ display:block; font-size:12.5px; font-weight:600; color:var(--muted); margin-bottom:4px; }
.field{ margin-bottom:14px; }
.form-row{ display:flex; gap:14px; flex-wrap:wrap; }
.form-row > *{ flex:1; min-width:160px; }

/* ================= BUTTONS ================= */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  padding: 10px 18px; border-radius: var(--radius-sm); border:1px solid transparent;
  font-weight:600; font-size:13.5px; cursor:pointer; transition:.15s ease;
}
.btn-primary{ background: var(--plum); color:#fff; }
.btn-primary:hover{ background: var(--plum-dark); }
.btn-gold{ background: var(--gold); color: var(--plum-dark); }
.btn-gold:hover{ background:#B98630; }
.btn-outline{ background:transparent; border-color: var(--border); color: var(--ink); }
.btn-outline:hover{ border-color: var(--plum); color:var(--plum); }
.btn-icon-only{ padding:6px 10px; font-size:1.05em; line-height:1; }
.btn-ghost{ background:transparent; color: var(--muted); }
.btn-ghost:hover{ color: var(--ink); }
.btn-danger{ background: var(--danger); color:#fff; }
.btn-danger:hover{ background:#A23A31; }
.btn-sm{ padding:6px 12px; font-size:12.5px; }
.btn-block{ width:100%; }
.btn:disabled{ opacity:.5; cursor:not-allowed; }
.icon-btn{ background:none; border:none; font-size:20px; cursor:pointer; color:var(--ink); padding:4px 8px; border-radius:6px; }
.icon-btn:hover{ background: var(--blush); }

/* ================= APP SHELL ================= */
.app-shell{ display:flex; min-height:100vh; }
.sidebar{
  width: 236px; background: var(--plum-dark); color:#EADFE4; flex-shrink:0;
  display:flex; flex-direction:column; padding: 20px 14px; position:sticky; top:0; height:100vh; overflow-y:auto;
}
.sidebar-brand{ display:flex; align-items:center; gap:10px; padding: 4px 10px 22px; }
.sidebar-brand .mark{ width:34px;height:34px;border-radius:9px; object-fit:cover; display:block; }
.sidebar-brand .name{ font-family: var(--font-display); font-size:19px; color:#fff; }
.nav-label{ font-size:11px; text-transform:uppercase; letter-spacing:.08em; color:#B291A5; margin: 18px 10px 6px; }
.nav-item{ display:flex; align-items:center; gap:10px; padding:9px 10px; border-radius:8px; color:#EADFE4; font-size:13.5px; font-weight:500; }
.nav-item:hover{ background: rgba(255,255,255,0.06); }
.nav-item.active{ background: var(--gold); color: var(--plum-dark); font-weight:600; }
.nav-item-row{ display:flex; align-items:center; border-radius:8px; }
.nav-item-row.active .nav-item{ background: var(--gold); color: var(--plum-dark); font-weight:600; }
.nav-star{ cursor:pointer; opacity:.35; padding:6px 10px; font-size:14px; color:#EADFE4; user-select:none; }
.nav-star:hover{ opacity:.9; }
.nav-star[data-starred="1"]{ opacity:1; color: var(--gold); }
.nav-ic{ width:18px; text-align:center; }

.main-col{ flex:1; min-width:0; display:flex; flex-direction:column; }
.topbar{ display:flex; align-items:center; gap:14px; padding: 16px 26px; background: var(--surface); border-bottom:1px solid var(--border); position:sticky; top:0; z-index:5;}
.page-title{ font-size:21px; margin:0; flex:1; }
.topbar-right{ display:flex; align-items:center; gap:14px; }
.role-badge{ font-size:11px; text-transform:uppercase; letter-spacing:.04em; font-weight:700; padding:4px 10px; border-radius:20px; background:var(--blush); color:var(--plum);}
.user-menu{ display:flex; align-items:center; gap:10px; }
.user-name{ font-weight:600; font-size:13.5px; }
.content{ padding: 24px 26px 60px; }
#menuToggle{ display:none; }

/* Collapses the sidebar to the ☰ icon on any screen ≤1080px wide, in
   EITHER orientation — matches the app's own "mobile view" threshold
   used elsewhere (isMobileProductView() in pos.js). This single rule
   covers phones, and tablets in both portrait (e.g. iPad Pro 12.9" at
   1024px) and landscape — a tablet doesn't have room for the full
   sidebar AND an 8-column product grid at the same time. */
@media (max-width: 1080px){
  .sidebar{ position:fixed; z-index:20; transform:translateX(-100%); transition:.2s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open{ transform:translateX(0); }
  #menuToggle{ display:inline-block; }
}

/* ================= CARDS / TABLES ================= */
.card{ background:var(--surface); border:1px solid var(--border); border-radius: var(--radius); padding:20px; box-shadow: var(--shadow); }
.card + .card{ margin-top:18px; }
.card-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; gap:10px; flex-wrap:wrap; }
.card-head h3{ margin:0; font-size:16px; }

.grid{ display:grid; gap:18px; }
.grid-4{ grid-template-columns: repeat(4, 1fr); }
.grid-3{ grid-template-columns: repeat(3, 1fr); }
.grid-2{ grid-template-columns: repeat(2, 1fr); }
@media (max-width: 920px){ .grid-4{grid-template-columns:repeat(2,1fr);} .grid-3{grid-template-columns:repeat(2,1fr);} }
@media (max-width: 600px){ .grid-4,.grid-3,.grid-2{grid-template-columns:1fr;} }

.stat-card{ background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:18px; box-shadow: var(--shadow); position:relative; overflow:hidden;}
.stat-card .label{ font-size:12px; color:var(--muted); text-transform:uppercase; letter-spacing:.05em; font-weight:600; }
.stat-card .value{ font-family: var(--font-display); font-size:28px; margin-top:6px; }
.stat-card .delta{ font-size:12px; margin-top:6px; font-weight:600; }
.stat-card .delta.up{ color:var(--success); }
.stat-card .delta.down{ color:var(--danger); }
.stat-card .bar{ position:absolute; left:0; top:0; bottom:0; width:4px; }
.stat-card.c-plum .bar{ background:var(--plum); }
.stat-card.c-gold .bar{ background:var(--gold); }
.stat-card.c-success .bar{ background:var(--success); }
.stat-card.c-danger .bar{ background:var(--danger); }

table{ width:100%; border-collapse:collapse; font-size:13.5px; }
th{ text-align:left; font-size:11.5px; text-transform:uppercase; letter-spacing:.04em; color:var(--muted); padding:10px 12px; border-bottom:2px solid var(--border); font-weight:700;}
td{ padding:11px 12px; border-bottom:1px solid var(--border); vertical-align:middle; }
tbody tr:hover{ background: #FCF7F9; }
.table-wrap{ overflow-x:auto; }

.badge{ display:inline-flex; align-items:center; gap:4px; font-size:11px; font-weight:700; padding:3px 9px; border-radius:20px; text-transform:uppercase; letter-spacing:.03em;}
.badge-success{ background:var(--success-bg); color:var(--success); }
.badge-danger{ background:var(--danger-bg); color:var(--danger); }
.badge-warning{ background:var(--warning-bg); color:var(--warning); }
.badge-info{ background:var(--info-bg); color:var(--info); }
.badge-plum{ background: var(--blush); color:var(--plum); }

.alert{ padding:12px 16px; border-radius:var(--radius-sm); font-size:13.5px; margin-bottom:14px; }
.alert-error{ background:var(--danger-bg); color:var(--danger); }
.alert-success{ background:var(--success-bg); color:var(--success); }
.alert-warning{ background:var(--warning-bg); color:var(--warning); }

.empty-state{ text-align:center; padding:50px 20px; color:var(--muted); }
.empty-state .ico{ font-size:38px; margin-bottom:10px; }

.pager{ display:flex; gap:6px; margin-top:14px; justify-content:flex-end; }
.pager a, .pager span{ padding:6px 11px; border-radius:6px; border:1px solid var(--border); font-size:12.5px; }
.pager a:hover{ border-color:var(--plum); }
.pager .current{ background:var(--plum); color:#fff; border-color:var(--plum); }

/* ================= MODAL ================= */
.modal-backdrop{ position:fixed; inset:0; background:rgba(42,30,39,0.5); display:none; align-items:center; justify-content:center; z-index:50; padding:20px;}
.modal-backdrop.open{ display:flex; }
.modal{ background:#fff; border-radius:14px; width:100%; max-width:560px; max-height:90vh; overflow-y:auto; padding:26px; box-shadow:var(--shadow-lg); }
.modal-head{ display:flex; justify-content:space-between; align-items:center; margin-bottom:16px; }
.modal-head h3{ margin:0; }
.modal-close{ background:none; border:none; font-size:22px; cursor:pointer; color:var(--muted); }
.modal-actions{ display:flex; justify-content:flex-end; gap:10px; margin-top:20px; }

/* ================= POS SCREEN ================= */
.pos-grid{ display:grid; grid-template-columns: 1fr 380px; gap:18px; align-items:start; }
@media (max-width: 1080px){ .pos-grid{ grid-template-columns:1fr; } }

/* While the camera scanner is running, on mobile-view screens (the same
   ≤1080px breakpoint pos.js already treats as "mobile" via
   isMobileProductView()), hide the browsable product grid so the cart
   panel sits right below the scan box instead of requiring a scroll past
   the product tiles. Desktop keeps both visible side by side as before.
   Toggled via the 'camera-active' class in scanner.js. */
@media (max-width: 1080px){
  .pos-grid.camera-active #productGrid,
  .pos-grid.camera-active #productToggle{ display:none !important; }
}

/* Tablet landscape (~601–1080px wide, landscape): keep the product grid
   and cart side-by-side like desktop, each independently scrollable and
   sized to fit the screen, so the cart stays in view without scrolling
   the whole page. */
@media (min-width: 601px) and (max-width: 1080px) and (orientation: landscape){
  .pos-grid{ grid-template-columns: 1fr 340px; }
  .pos-grid .product-grid{ grid-template-columns: repeat(8, 1fr); max-height: 64vh; overflow-y: auto; }
  .cart-panel{ max-height: 84vh; overflow-y: auto; }
  .cart-items{ max-height: 46vh; }
}

/* Tablet portrait (~601–1080px wide, portrait): stacked layout, with
   about 6 product tiles and 6 cart lines visible before scrolling. */
@media (min-width: 601px) and (max-width: 1080px) and (orientation: portrait){
  .pos-grid .product-grid{ grid-template-columns: repeat(4, 1fr); max-height: 430px; overflow-y: auto; }
  .cart-items{ max-height: 290px; }
}
.scan-box{ display:flex; gap:10px; margin-bottom:16px; }
.scan-box input{ font-size:16px; padding:13px 14px; flex:1; }
#scannerToggleBtn{ white-space:nowrap; }
#scannerToggleBtn.active{ background:var(--gold,#e0b13a); border-color:var(--gold,#e0b13a); color:#fff; }
#productListScannerToggleBtn.active{ background:var(--gold,#e0b13a); border-color:var(--gold,#e0b13a); color:#fff; }
.scanner-box{ position:relative; width:100%; max-width:320px; margin-bottom:8px; border-radius:8px; overflow:hidden; border:2px solid var(--border); transition:border-color .15s, box-shadow .15s; }
.scanner-box video{ display:block; width:100%; aspect-ratio:16/9; height:auto; object-fit:cover; background:#000; }
.scanner-box.flash-ok{ border-color:#2e9e5b; box-shadow:0 0 0 3px rgba(46,158,91,.25); }
.scanner-box.flash-err{ border-color:#c0392b; box-shadow:0 0 0 3px rgba(192,57,43,.25); }
@keyframes scanner-flash-fade { from{ opacity:1; } to{ opacity:0; } }
/* "Shutter" cue on a successful scan: the live camera preview briefly dims
   to black and back, like a camera closing and reopening. This runs on top
   of the still-live video feed (scanning never actually pauses) — it's a
   strong visual signal for noisy environments where the beep alone might
   not be heard. Triggered by adding/removing this class in JS. */
.scanner-box video.shutter-blink{ animation: shutter-blink .35s ease; }
@keyframes shutter-blink{
  0%   { opacity:1; }
  35%  { opacity:0; }
  65%  { opacity:0; }
  100% { opacity:1; }
}
.scanner-status.muted{ opacity:.7; }
.scan-status-ok{ color:#2e9e5b; font-weight:600; }
.product-grid{ display:grid; grid-template-columns: repeat(4, 1fr); gap:8px; max-height:560px; overflow-y:auto; padding-right:4px;}
.product-tile{ background:#fff; border:1px solid var(--border); border-radius:8px; padding:8px; cursor:pointer; text-align:left; transition:.12s; }
.ptile-img{ width:100%; aspect-ratio:1/1; object-fit:cover; border-radius:6px; margin-bottom:6px; background:var(--blush); display:block; }
.ptile-img-placeholder{ display:flex; align-items:center; justify-content:center; font-size:20px; }
.product-tile:hover{ border-color:var(--plum-light); box-shadow: var(--shadow); transform:translateY(-1px); }
.product-tile .pname{ font-weight:600; font-size:11px; margin-bottom:2px; line-height:1.25; min-height:28px; }
.product-tile .pprice{ color:var(--plum); font-weight:700; font-size:12px; }
.product-tile .pstock{ font-size:9.5px; color:var(--muted); margin-top:1px; }
.product-tile.low .pstock{ color:var(--danger); font-weight:600; }

.cart-panel{ background:#fff; border:1px solid var(--border); border-radius:var(--radius); padding:18px; position:sticky; top:82px; }
.cart-items{ max-height:320px; overflow-y:auto; margin: 12px -4px; }
.cart-line{ display:flex; align-items:center; gap:8px; padding:8px 4px; border-bottom:1px solid var(--border); }
.cart-line .ci-name{ flex:1; font-size:12.5px; font-weight:600; }
.cart-line .ci-sub{ font-size:11px; color:var(--muted); }
.cart-line input.qty{ width:52px; padding:5px; text-align:center; }
.cart-line .ci-remove{ background:none;border:none;color:var(--danger);cursor:pointer;font-size:15px; }
.cart-totals div{ display:flex; justify-content:space-between; padding:4px 0; font-size:13.5px; }
.cart-totals .grand{ font-size:19px; font-family:var(--font-display); font-weight:700; border-top:1px dashed var(--border); margin-top:8px; padding-top:10px;}

/* ================= RECEIPT PRINT ================= */
.receipt{ width:300px; margin:0 auto; font-family: 'Inter', monospace; font-size:12.5px; }
.receipt h2{ text-align:center; margin:0 0 2px; font-size:16px; }
.receipt .center{ text-align:center; }
.receipt table{ width:100%; font-size:11.5px; }
.receipt hr{ border:none; border-top:1px dashed #999; margin:8px 0; }
@media print{
  .no-print{ display:none !important; }
  body{ background:#fff; }
  .receipt{ width:100%; }
}

/* ================= MISC ================= */
.tag-list{ display:flex; gap:6px; flex-wrap:wrap; }
.kbd{ background:var(--blush); border-radius:4px; padding:1px 6px; font-size:11px; font-weight:700; color:var(--plum); }
.flex-between{ display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; }
.text-right{ text-align:right; }
.mt-0{ margin-top:0; }
.w-full{ width:100%; }

@media (max-width: 700px){
  table{ display:block; overflow-x:auto; white-space:nowrap; -webkit-overflow-scrolling:touch; }
  table thead, table tbody{ display:table-row-group; }
  table tr{ display:table-row; }
  table th, table td{ display:table-cell; }
}

/* ================= MOBILE OVERFLOW FIXES ================= */
html, body{ overflow-x: hidden; max-width: 100%; }
img, svg, table{ max-width: 100%; }
.card, .stat-card, .product-tile, .modal{ max-width: 100%; box-sizing: border-box; }

@media (max-width: 600px){
  .content{ padding: 16px 14px 50px; }
  .topbar{ padding: 12px 14px; flex-wrap: wrap; gap: 8px; }
  .page-title{ font-size: 17px; flex-basis: 100%; order: 2; }
  .topbar-right{ flex-wrap: wrap; gap: 8px; font-size: 12px; }
  .user-name{ display: none; } /* saves space on small phones; role badge still shows who's active */
  .stat-card .value{ font-size: 21px; word-break: break-word; }
  .form-row > *{ min-width: 0; flex-basis: 100%; }
  .cart-line{ flex-wrap: wrap; }
  .cart-line > div[style*="flex:1"]{ flex-basis: 100%; }
  .cart-line input.qty{ width: 46px; }
  .scan-box{ flex-wrap: wrap; }
  .scan-box input{ flex-basis: 100%; }
  .pos-grid .product-grid{ grid-template-columns: repeat(4, 1fr); gap:6px; max-height: 470px; overflow-y: auto; }
  .pos-grid .product-tile{ padding:5px; border-radius:6px; }
  .pos-grid .product-tile .pname{ font-size:9.5px; min-height:22px; margin-bottom:1px; }
  .pos-grid .product-tile .pprice{ font-size:10.5px; }
  .pos-grid .product-tile .pstock{ font-size:8px; }
  .pos-grid .ptile-img, .pos-grid .ptile-img-placeholder{ margin-bottom:3px; }
  .pos-grid .ptile-img-placeholder{ font-size:15px; }
}

/* =========================================================
   Calculator POS
   Was entirely unstyled (no .calc-* rules existed at all) —
   this was almost certainly why item name/qty/price could look
   "missing": unconstrained images and unstyled stacked divs
   pushed the text out of the visible area rather than laying
   out as a proper line item.
   ========================================================= */
.calc-page{ max-width:920px; margin:0 auto; display:flex; flex-direction:column; gap:14px; }

.calc-branchbar{ display:flex; align-items:center; justify-content:space-between; background:var(--surface); border:1px solid var(--border); border-radius:10px; padding:10px 14px; font-size:13px; }
.calc-branchbar select{ width:auto; }

.calc-topbar{ display:flex; justify-content:flex-end; }
.calc-mode-select{ width:auto; }

/* Picture picker — hidden until JS adds .open when multiple products share a price */
.calc-picker{ display:none; background:var(--surface); border:1px solid var(--border); border-radius:10px; padding:14px; }
.calc-picker.open{ display:block; }
.calc-picker-label{ font-size:13px; margin-bottom:10px; color:var(--muted); }
.calc-picker-row{ display:flex; flex-wrap:wrap; gap:10px; }
.calc-pic-tile{ display:flex; flex-direction:column; align-items:center; gap:4px; width:76px; padding:6px; border:1px solid var(--border); border-radius:8px; background:var(--bg); cursor:pointer; }
.calc-pic-tile:hover{ border-color:var(--plum-light); }
.calc-pic-tile img{ width:56px; height:56px; object-fit:cover; border-radius:6px; }
.calc-pic-placeholder{ width:56px; height:56px; display:flex; align-items:center; justify-content:center; font-size:22px; background:var(--blush); border-radius:6px; }
.calc-pic-price{ font-size:11px; font-weight:700; color:var(--plum); }

/* Dead/unused markup (never toggled by JS) — keep it out of the way rather than an empty box always on screen */
.calc-selected{ display:none; }

.calc-sale-panel{ background:var(--surface); border:1px solid var(--border); border-radius:10px; padding:14px; }
.calc-sale-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:8px; }
.calc-sale-head h3{ margin:0; font-size:14px; }
.calc-icon-btn{ background:none; border:none; font-size:16px; cursor:pointer; padding:4px 8px; border-radius:6px; }
.calc-icon-btn:hover{ background:var(--blush); }

.calc-sale-items{ max-height:220px; overflow-y:auto; display:flex; flex-direction:column; gap:6px; }
.calc-empty{ color:var(--muted); font-size:13px; padding:16px 0; text-align:center; }

/* One row per item — this is the piece that was rendering unstyled: an
   <img> with no size constraint plus several divs with no flex layout,
   which stacked vertically and pushed name/qty/price out of the visible
   scroll area. Now a proper single-line layout. */
.calc-sale-line{ display:flex; align-items:center; gap:10px; padding:6px 4px; border-bottom:1px solid var(--border); }
.calc-sale-line img{ width:34px; height:34px; object-fit:cover; border-radius:6px; flex-shrink:0; }
.calc-sale-placeholder{ width:34px; height:34px; flex-shrink:0; display:flex; align-items:center; justify-content:center; font-size:15px; background:var(--blush); border-radius:6px; }
.calc-sale-name{ flex:1; min-width:0; font-size:13px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.calc-sale-qty{ font-size:12.5px; color:var(--muted); flex-shrink:0; }
.calc-sale-sub{ font-weight:700; font-size:13px; flex-shrink:0; min-width:60px; text-align:right; }
.calc-sale-del{ background:none; border:none; color:var(--danger); font-size:16px; cursor:pointer; flex-shrink:0; padding:2px 6px; }

.calc-sale-total{ display:flex; justify-content:space-between; align-items:center; margin-top:10px; padding-top:10px; border-top:2px solid var(--ink); font-weight:800; font-size:16px; }
.calc-sale-total #calcSaleTotal.calc-pop{ animation:calc-pop .25s ease; }
@keyframes calc-pop{ 0%{ transform:scale(1.15); color:var(--gold); } 100%{ transform:scale(1); } }

.calc-unit{ background:var(--surface); border:1px solid var(--border); border-radius:10px; padding:14px; }
.calc-display-panel{ text-align:right; padding:10px 6px 16px; border-bottom:1px solid var(--border); margin-bottom:12px; position:relative; }
.calc-selected-preview{ display:none; align-items:center; gap:8px; float:left; text-align:left; }
.calc-selected-preview.show{ display:flex; }
.calc-selected-preview img{ width:32px; height:32px; object-fit:cover; border-radius:6px; }
.calc-selected-placeholder{ width:32px; height:32px; display:none; align-items:center; justify-content:center; font-size:15px; background:var(--blush); border-radius:6px; }
.calc-selected-label{ font-size:12px; color:var(--muted); }
.calc-expression{ font-size:14px; color:var(--muted); min-height:18px; }
.calc-display{ font-size:36px; font-weight:800; color:var(--ink); line-height:1.2; }
.calc-hint{ font-size:12px; color:var(--muted); margin-top:4px; }

.calc-keypad{ display:grid; grid-template-columns:repeat(4, 1fr); gap:8px; }
.calc-key{ padding:16px 0; font-size:18px; font-weight:600; border:1px solid var(--border); border-radius:8px; background:var(--bg); cursor:pointer; }
.calc-key:active{ background:var(--blush); }
.calc-key-fn{ background:var(--blush); color:var(--plum-dark); }
.calc-key-op{ background:var(--gold-light); color:var(--plum-dark); font-weight:800; }
.calc-key-equals{ background:var(--gold); color:#fff; }
.calc-key-pay{ background:var(--plum); color:#fff; grid-row:span 1; }
.calc-key-zero{ grid-column:span 2; }

.calc-pay-summary > div{ display:flex; justify-content:space-between; padding:4px 0; font-size:13px; }
.calc-pay-summary .grand{ font-weight:800; font-size:15px; border-top:1px solid var(--border); margin-top:4px; padding-top:8px; }

@media (min-width: 700px){
  .calc-page{ flex-direction:row; align-items:flex-start; max-width:820px; }
  .calc-page .calc-sale-panel{ flex:1; order:2; }
  .calc-page .calc-unit{ flex:1; order:1; }
  .calc-page .calc-branchbar, .calc-page .calc-topbar, .calc-page .calc-picker, .calc-page .calc-selected, .calc-page #calcError{ order:0; width:100%; }
}
