:root {
  color-scheme: dark;
  --bg: #000000;
  --bg-2: #1a1c21;
  --card: #0c0d10;
  --card-2: #131519;
  --input: #0a0b0d;
  --line: #24272e;
  --line-2: #1a1c21;
  --text: #eceef2;
  --text-2: #c9ccd4;
  --muted: #8a909c;
  --brand: #38bdf8;
  --brand-strong: #38bdf8;
  --brand-deep: #7dd3fc;
  --brand-hover: #7dd3fc;
  --on-brand: #021019;
  --brand-soft: rgba(56, 189, 248, .14);
  --brand-softer: rgba(56, 189, 248, .07);
  --side: #050506;
  --side-2: #15171b;
  --side-text: #a3a8b3;
  --red: #f87171;
  --red-soft: rgba(248, 113, 113, .13);
  --green: #4ade80;
  --green-soft: rgba(74, 222, 128, .12);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, .12);
  --blue: #2f6fed;
  --orange: #f08c1a;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .5);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14.5px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button, a, input, select, label { touch-action: manipulation; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-strong); text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 650; }
h1 { font-size: 21px; letter-spacing: -.2px; }
h2 { font-size: 16px; display: flex; align-items: center; gap: 7px; }
h2 svg { width: 17px; height: 17px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.red { color: var(--red); }
.green { color: var(--green); }
.amber-t { color: var(--amber); }
.hidden { display: none !important; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.side {
  width: 230px; flex: none; background: var(--side); color: var(--side-text);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 40;
}
.side-brand { display: flex; align-items: center; gap: 11px; padding: 18px 16px 16px; }
.side-brand .name { font-weight: 700; font-size: 15.5px; color: #fff; letter-spacing: -.1px; white-space: nowrap; }
.side-brand .tag { font-size: 11.5px; color: var(--side-text); white-space: nowrap; }
.side nav { display: flex; flex-direction: column; gap: 3px; padding: 6px 10px; overflow-y: auto; }
.side nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 9px;
  color: var(--side-text); font-weight: 500; text-decoration: none; white-space: nowrap;
}
.side nav a:hover { background: var(--side-2); color: #fff; }
.side nav a.active { background: var(--brand); color: var(--on-brand); font-weight: 600; box-shadow: 0 4px 14px rgba(56, 189, 248, .3); }
.side nav svg { width: 20px; height: 20px; flex: none; }
.side-foot { margin-top: auto; padding: 12px; border-top: 1px solid rgba(255, 255, 255, .07); }
.side-foot .shop { display: flex; align-items: center; gap: 10px; }
.side-foot .bt { flex: 1; min-width: 0; }
.side-foot .n { color: #fff; font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .r { font-size: 11.5px; }
.side-foot .icon-btn { color: var(--side-text); }
.side-foot .icon-btn:hover { background: var(--side-2); color: #fff; }
.online { display: flex; align-items: center; gap: 7px; font-size: 12px; margin-top: 10px; color: #7ee0a4; }
.online i { width: 8px; height: 8px; border-radius: 50%; background: #34d27b; box-shadow: 0 0 0 3px rgba(52, 210, 123, .18); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: var(--card); border-bottom: 1px solid var(--line); padding: 10px 24px; height: 62px;
  display: flex; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 30;
}
.m-logo { display: none; }
.clock { display: flex; gap: 12px; font-size: 13.5px; white-space: nowrap; }
.clock b { font-weight: 600; }
.clock span { color: var(--muted); }
.top-search { flex: 1; max-width: 460px; margin-left: auto; }
.top-search .input { background: var(--bg); border-color: transparent; border-radius: 10px; }
.top-btn { position: relative; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: var(--text); }
.top-btn:hover { background: var(--bg); }
.top-btn svg { width: 21px; height: 21px; }
.top-btn .dot { position: absolute; top: 9px; right: 10px; width: 9px; height: 9px; border-radius: 50%; background: var(--red); border: 2px solid var(--card); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-deep); display: grid; place-items: center; font-weight: 700; font-size: 13.5px; text-decoration: none; }
.page { width: 100%; max-width: 1440px; margin: 0 auto; padding: 22px 24px 48px; }
.page.wide { max-width: none; padding: 16px; }
.tabbar { display: none; }

/* icon-only sidebar on narrower tablets */
@media (max-width: 1180px) {
  .side { width: 76px; }
  .side-brand { justify-content: center; padding: 16px 0; }
  .side-brand .bt, .side nav span, .side-foot .bt, .online span { display: none; }
  .side nav a { justify-content: center; padding: 13px 0; }
  .side-foot .shop { flex-direction: column; }
  .side-foot .shop > .logo { display: none; }
  .online { justify-content: center; }
}
@media (max-width: 860px) {
  .side { display: none; }
  .topbar { padding: 8px 12px; gap: 10px; height: 58px; }
  .m-logo { display: block; }
  .clock span { display: none; }
  .clock { font-size: 12.5px; }
  .page { padding: 14px 14px 92px; }
  .page.wide { padding: 10px 10px 150px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--card); border-top: 1px solid var(--line); z-index: 30; padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 9px; font-size: 11px; color: var(--muted); font-weight: 500; text-decoration: none; }
  .tabbar a.active { color: var(--brand-strong); }
  .tabbar svg { width: 22px; height: 22px; }
}
@media (max-width: 560px) { .clock { display: none; } .top-search { margin-left: 0; } }

/* ---------- logo ---------- */
.logo {
  width: 36px; height: 36px; border-radius: 10px; background: var(--brand); color: var(--on-brand);
  display: flex; align-items: center; justify-content: center; flex: none; white-space: nowrap;
  font-weight: 800; font-size: 13px; letter-spacing: -.3px;
}
.logo .amp { opacity: .75; margin: 0 1px; font-weight: 600; }
.logo.sm { width: 32px; height: 32px; font-size: 12px; border-radius: 9px; }
.logo.lg { width: 68px; height: 68px; border-radius: 16px; font-size: 24px; }

/* ---------- common ---------- */
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.head .sub { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.crumb a { color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin: -2px 0 12px; gap: 8px; flex-wrap: wrap; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-head { padding: 14px 16px 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: 1fr 1fr; }
.g21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1000px) { .g4 { grid-template-columns: 1fr 1fr; } .g21 { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .g2 { grid-template-columns: 1fr; } }
.mt { margin-top: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  padding: 8px 15px; border-radius: 9px; font-weight: 550; cursor: pointer; min-height: 44px; white-space: nowrap;
  text-decoration: none !important; user-select: none;
}
.btn:hover { background: var(--bg-2); border-color: #363a44; }
.btn:active { transform: scale(.98); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.primary { background: var(--brand-strong); border-color: var(--brand-strong); color: var(--on-brand); }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn.danger { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn.danger-ghost { color: var(--red); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--bg); }
.btn.block { width: 100%; }
.btn.lg { min-height: 52px; font-size: 15.5px; font-weight: 650; }
.btn.sm { min-height: 36px; padding: 4px 11px; font-size: 13.5px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.icon-btn { border: 0; background: transparent; padding: 8px; border-radius: 8px; cursor: pointer; color: var(--muted); display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--bg); color: var(--red); }
.icon-btn svg { width: 18px; height: 18px; }

.input, select.input, textarea.input {
  width: 100%; border: 1px solid var(--line); background: var(--input); border-radius: 9px;
  padding: 9px 12px; min-height: 44px; outline: none;
}
.input.lg { min-height: 52px; font-size: 16px; }
.input.xl { min-height: 58px; font-size: 24px; font-weight: 650; font-variant-numeric: tabular-nums; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(56, 189, 248, .2); }
label.f { display: block; margin-bottom: 13px; }
label.f > span { display: block; font-size: 12.5px; font-weight: 550; color: var(--muted); margin-bottom: 5px; }
.f-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.search { position: relative; }
.search > svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.search .input { padding-left: 38px; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--card); }
.seg a, .seg span {
  padding: 10px 14px; font-size: 13.5px; font-weight: 550; color: var(--muted); cursor: pointer; border-right: 1px solid var(--line);
  text-decoration: none; white-space: nowrap;
}
.seg > :last-child { border-right: 0; }
.seg .on { background: var(--brand-soft); color: var(--brand-deep); }
.badge { display: inline-block; font-size: 11.5px; font-weight: 650; padding: 2px 8px; border-radius: 20px; background: var(--bg-2); color: var(--muted); white-space: nowrap; }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.brand { background: var(--brand-soft); color: var(--brand-deep); }

/* chips (categories) */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid var(--line); background: var(--card); border-radius: 22px; padding: 8px 18px; min-height: 40px;
  font-weight: 550; cursor: pointer; white-space: nowrap; color: var(--text-2);
}
.chip.on { background: var(--brand-strong); border-color: var(--brand-strong); color: var(--on-brand); }
.chips.sm .chip { min-height: 34px; padding: 5px 13px; font-size: 13px; }

/* ---------- KPI row ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.kpi {
  display: flex; gap: 14px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; color: inherit; text-decoration: none;
}
.kpi:hover { border-color: var(--brand); }
.ki { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; flex: none; color: #fff; }
.ki svg { width: 22px; height: 22px; }
.ki.blue, .ai.blue { background: var(--blue); }
.ki.purple, .ai.purple { background: var(--brand); color: var(--on-brand); }
.ki.orange, .ai.orange { background: var(--orange); }
.ki.green, .ai.green { background: #1f9d55; }
.ai.red { background: #dc2626; }
.ai.slate { background: #3a3f4a; }
.kl { font-size: 13px; font-weight: 600; color: var(--muted); }
.kv { font-size: 23px; font-weight: 750; letter-spacing: -.4px; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kh { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
@media (max-width: 1100px) { .kpis { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .kpis { gap: 10px; } .kpi { padding: 12px; gap: 10px; } .ki { width: 38px; height: 38px; } .kv { font-size: 18px; } }

/* ---------- home layout ---------- */
.dash { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.dash-side .card + .card { margin-top: 16px; }
@media (max-width: 1100px) { .dash { grid-template-columns: minmax(0, 1fr); } }
.qa { display: grid; gap: 9px; }
.qbtn {
  display: flex; align-items: center; gap: 10px; border: 0; border-radius: 10px; padding: 0 16px; min-height: 50px;
  color: #fff; font-weight: 650; cursor: pointer; text-decoration: none; text-align: left;
}
.qbtn:active { transform: scale(.98); }
.qbtn svg { width: 20px; height: 20px; flex: none; }
.qbtn.brand { background: var(--brand-strong); color: var(--on-brand); }
.qbtn.green { background: #1f9d55; }
.qbtn.blue { background: var(--blue); }
.qbtn.orange { background: var(--orange); }
.qbtn.violet { background: #0284c7; }
.qbtn.slate { background: #2a2e37; }
.alerts .al { display: flex; align-items: center; gap: 10px; padding: 9px 2px; color: inherit; text-decoration: none; border-bottom: 1px solid var(--line-2); }
.alerts .al:last-child { border-bottom: 0; }
.alerts i { width: 9px; height: 9px; border-radius: 50%; background: var(--bg-2); flex: none; }
.alerts i.red { background: #dc2626; } .alerts i.amber { background: #f0a020; } .alerts i.brand { background: var(--brand); }
.alerts span { flex: 1; }
.alerts b.amber { color: var(--amber); } .alerts b.brand { color: var(--brand-deep); }
.acts .act { display: flex; align-items: center; gap: 10px; padding: 8px 0; color: inherit; text-decoration: none; border-bottom: 1px solid var(--line-2); }
.acts .act:last-child { border-bottom: 0; }
.ai { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: #fff; flex: none; }
.ai svg { width: 17px; height: 17px; }
.act .at { flex: 1; min-width: 0; }
.act .t { font-weight: 600; font-size: 13.5px; }
.act .s { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act .aw { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

/* ---------- product tiles ---------- */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); grid-auto-rows: max-content; gap: 12px; }
.tile > * { flex-shrink: 0; }
.tile {
  position: relative; display: flex; flex-direction: column; align-items: stretch; text-align: left; gap: 2px;
  border: 1px solid; border-radius: 12px; padding: 10px; cursor: pointer; min-height: 150px; user-select: none;
  transition: transform .08s, box-shadow .12s;
}
.tile:active { transform: scale(.97); }
.tile:hover { box-shadow: 0 4px 14px rgba(56, 189, 248, .12); }
.tile.s-ok { background: #07160d; border-color: #14361f; }
.tile.s-low { background: #1a1405; border-color: #3d300b; }
.tile.s-out { background: #1c0808; border-color: #421515; }
.tile.sel { box-shadow: 0 0 0 2px var(--brand-strong); }
.timg { position: relative; height: 92px; border-radius: 9px; background: var(--card-2); overflow: hidden; margin-bottom: 7px; }
.timg img, .cl-img img, .thumb img, .ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.pinit {
  width: 100%; height: 100%; display: grid; place-items: center; font-weight: 750; font-size: 26px; letter-spacing: -.5px;
  background: hsl(var(--h) 35% 16%); color: hsl(var(--h) 70% 72%);
}
.tname { font-weight: 650; font-size: 14px; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tprice { font-weight: 750; font-size: 16.5px; color: var(--brand-deep); font-variant-numeric: tabular-nums; }
.tstock { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.tstock i { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.s-ok .tstock i { background: #1f9d55; } .s-low .tstock i { background: #f0a020; } .s-out .tstock i { background: var(--red); }
.s-out .tstock { color: var(--red); font-weight: 600; }
.tmeta { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tmeta span { color: var(--line); margin: 0 3px; }
.tbadge { position: absolute; top: 8px; right: 8px; background: #dc2626; color: #fff; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 20px; }
.tile .q {
  position: absolute; top: -7px; right: -7px; z-index: 2; background: var(--brand-strong); color: var(--on-brand); font-size: 13px; font-weight: 750;
  min-width: 28px; height: 28px; border-radius: 14px; display: grid; place-items: center; padding: 0 7px; box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
}
@media (max-width: 520px) { .pgrid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 9px; } .timg { height: 76px; } }

/* ---------- POS register ---------- */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; height: calc(100dvh - 62px - 32px); }
.pos-left { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.pos-bar { display: flex; gap: 10px; }
.pos-grid { flex: 1; overflow-y: auto; align-content: start; padding: 8px 8px 16px 2px; margin-right: -8px; overscroll-behavior: contain; }
.pos-cart {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
.cust-pick {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 0; border-bottom: 1px solid var(--line);
  background: var(--brand-softer); text-align: left; cursor: pointer; width: 100%; min-height: 70px;
}
.cust-pick.has { background: var(--brand-soft); }
.cust-pick .main-t { flex: 1; min-width: 0; }
.cust-pick .t { font-weight: 650; }
.cust-pick .s { font-size: 12.5px; color: var(--muted); }
.cust-pick .chev svg { width: 20px; height: 20px; color: var(--muted); }
.cav {
  width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; font-weight: 700; font-size: 13.5px;
  background: hsl(var(--h) 35% 16%); color: hsl(var(--h) 70% 72%); vertical-align: middle; margin-right: 10px;
}
.cust-pick .cav, .pc-row .cav { margin-right: 0; }
td .cav { width: 32px; height: 32px; font-size: 12px; }
.cav.lg { width: 54px; height: 54px; font-size: 18px; margin: 0; }
.cav svg { width: 20px; height: 20px; }
.cart-lines { flex: 1; overflow-y: auto; padding: 4px 12px; overscroll-behavior: contain; }
.cart-empty { height: 100%; min-height: 160px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--muted); }
.cart-empty svg { width: 36px; height: 36px; opacity: .5; }
.cl { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; grid-template-rows: auto auto; gap: 4px 10px; align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--line-2); border-radius: 8px; }
.cl.flash { animation: flash .6s ease; }
@keyframes flash { from { background: var(--brand-soft); } to { background: transparent; } }
.cl-img { grid-row: span 2; width: 44px; height: 44px; border-radius: 8px; overflow: hidden; background: var(--card-2); border: 1px solid var(--line-2); display: grid; place-items: center; position: relative; }
.cl-img .pinit { font-size: 15px; }
.cl-main { cursor: pointer; min-width: 0; }
.cl-main .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-main .s { font-size: 12.5px; color: var(--muted); }
.cl-tot { grid-column: 2; font-weight: 700; font-variant-numeric: tabular-nums; }
.cl .stp, .cl > .icon-btn { grid-column: 3; grid-row: 1 / span 2; }
.stp { display: flex; align-items: center; background: var(--bg); border-radius: 10px; }
.stp button { width: 42px; height: 42px; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; border-radius: 10px; color: var(--text); }
.stp button:active { background: var(--bg-2); }
.stp button svg { width: 18px; height: 18px; }
.stp b { min-width: 30px; text-align: center; font-size: 16px; cursor: pointer; font-variant-numeric: tabular-nums; }
.cart-foot { border-top: 1px solid var(--line); padding: 10px 16px 16px; background: var(--card-2); }
.tot-row { display: flex; justify-content: space-between; align-items: baseline; color: var(--muted); padding: 2px 0; }
.tot-row.grand { color: var(--text); font-size: 26px; font-weight: 800; letter-spacing: -.5px; font-variant-numeric: tabular-nums; padding: 2px 0 8px; }
.tot-row.grand span:first-child { font-size: 17px; font-weight: 650; letter-spacing: 0; }
.paygrid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.pay {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 68px;
  border: 0; border-radius: 12px; color: #fff; font-weight: 700; font-size: 15px; cursor: pointer;
}
.pay svg { width: 22px; height: 22px; }
.pay:active { transform: scale(.97); }
.pay:disabled { opacity: .35; cursor: not-allowed; transform: none; }
.pay.cash { background: #1f9d55; }
.pay.mpesa { background: #0f8a3c; }
.pay.card { background: var(--blue); }
.pay.wallet { background: var(--brand-strong); color: var(--on-brand); }
.pos-mbar { display: none; }
@media (max-width: 1000px) { .pos { grid-template-columns: minmax(0, 1fr) 330px; } }
@media (max-width: 860px) {
  .pos { display: block; height: auto; }
  .pos-grid { overflow: visible; margin: 0; padding: 8px 2px; }
  .pos-cart { margin-top: 14px; }
  .cart-lines { max-height: none; }
  .pos-mbar { display: block; position: fixed; left: 0; right: 0; bottom: 58px; padding: 8px 10px; background: rgba(0, 0, 0, .92); z-index: 25; }
  .pos-mbar:empty { display: none; }
}

/* checkout */
.due { display: flex; justify-content: space-between; align-items: baseline; background: var(--brand-soft); color: var(--brand-deep); border-radius: 10px; padding: 12px 16px; margin-bottom: 14px; }
.due b { font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; }
.quick-amts { margin-bottom: 12px; }
.quick-amts .btn { flex: 1; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.keypad button { min-height: 56px; border: 1px solid var(--line); background: var(--card-2); border-radius: 10px; font-size: 22px; font-weight: 650; cursor: pointer; }
.keypad button:active { background: var(--brand-soft); }
.change { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px dashed var(--line); padding: 10px 2px 4px; }
.change b { font-size: 26px; font-weight: 800; color: var(--green); font-variant-numeric: tabular-nums; }
.change b.red { color: var(--red); }
.wal-flow { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.wal-flow > div { background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.wal-flow > div > span { display: block; font-size: 12px; color: var(--muted); }
.wal-flow b { font-size: 19px; }
.checkout .mf .btn { flex: 1; min-height: 56px; font-size: 16px; }
.mchips { display: flex; gap: 8px; flex-wrap: wrap; }
.mchip input { position: absolute; opacity: 0; pointer-events: none; }
.mchip span { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border: 1px solid var(--line); border-radius: 22px; cursor: pointer; font-weight: 600; background: var(--card); }
.mchip input:checked + span { background: var(--brand-strong); border-color: var(--brand-strong); color: var(--on-brand); }
.done { text-align: center; padding: 28px 24px 22px; max-width: 400px; }
.done-ic { width: 68px; height: 68px; border-radius: 50%; background: var(--green-soft); color: var(--green); display: grid; place-items: center; margin: 0 auto 12px; }
.done-ic svg { width: 36px; height: 36px; stroke-width: 2.6; }
.done h2 { justify-content: center; font-size: 19px; }
.done-amt { font-size: 32px; font-weight: 800; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.done-ch { display: flex; justify-content: space-between; align-items: baseline; background: var(--bg); border-radius: 10px; padding: 12px 16px; margin: 16px 0 0; }
.done-ch b { font-size: 26px; font-weight: 800; }
.done .btn { margin-top: 18px; }

/* customer chooser */
.pc-list { max-height: 55vh; overflow-y: auto; }
.pc-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 8px; min-height: 64px; border: 0; border-bottom: 1px solid var(--line-2); background: transparent; text-align: left; cursor: pointer; border-radius: 8px; }
.pc-row:hover, .pc-row:active { background: var(--brand-softer); }
.pc-row .main-t { flex: 1; min-width: 0; }
.pc-row .t { font-weight: 600; }
.pc-row .s { font-size: 12.5px; color: var(--muted); }
.pc-row .amt { text-align: right; font-weight: 650; }

/* product photo */
.photo-pick { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.ph { width: 96px; height: 96px; border-radius: 12px; background: var(--bg); border: 1px dashed #3a3e48; display: grid; place-items: center; overflow: hidden; flex: none; position: relative; }
.ph-empty svg { width: 30px; height: 30px; color: var(--muted); }
.ph-btns { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.thumb { width: 40px; height: 40px; border-radius: 8px; overflow: hidden; background: var(--card-2); border: 1px solid var(--line-2); display: inline-grid; place-items: center; flex: none; position: relative; }
.thumb .pinit { font-size: 13px; }
.thumb.lg { width: 64px; height: 64px; border-radius: 12px; }
.thumb.lg .pinit { font-size: 20px; }
.prow { display: flex; align-items: center; gap: 10px; }

/* ---------- KPI (older pages) ---------- */
.stat { padding: 14px 16px; }
.stat .label { font-size: 12.5px; font-weight: 550; color: var(--muted); }
.stat .value { font-size: 22px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.stat .hint { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
a.stat { display: block; color: inherit; text-decoration: none; }
a.stat:hover { border-color: var(--brand); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }

/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--line-2); color: inherit; text-decoration: none !important; }
.li:last-child { border-bottom: 0; }
a.li:hover { background: var(--brand-softer); }
.li .main-t { flex: 1; min-width: 0; }
.li .t { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .s { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .amt { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 28px 10px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th {
  text-align: left; font-size: 12px; color: var(--muted); font-weight: 550; padding: 9px 14px;
  border-bottom: 1px solid var(--line); background: var(--card-2); white-space: nowrap;
}
table.t td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: var(--brand-softer); }
table.t .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t .nw { white-space: nowrap; }
table.t .sub { font-size: 12px; color: var(--muted); }
table.t tfoot td { font-weight: 600; background: var(--card-2); border-top: 1px solid var(--line); }
@media (max-width: 760px) { .hide-sm { display: none; } table.t th, table.t td { padding: 9px 9px; } }

/* ---------- receive-stock picker ---------- */
.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 9px; }
.ptile {
  border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 11px 12px; text-align: left; cursor: pointer;
  display: flex; flex-direction: column; gap: 1px; min-height: 72px; position: relative;
}
.ptile:hover { border-color: var(--brand); }
.ptile .pn { font-weight: 600; font-size: 14px; line-height: 1.3; padding-right: 22px; }
.ptile .pp { font-size: 13px; color: var(--brand-deep); font-weight: 600; }
.ptile .ps { font-size: 12px; color: var(--muted); }
.ptile.out { opacity: .55; }
.ptile.sel { border-color: var(--brand); background: var(--brand-softer); box-shadow: inset 0 0 0 1px var(--brand); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 16px; align-items: start; }
.split .sticky { position: sticky; top: 78px; }
@media (max-width: 980px) { .split { grid-template-columns: 1fr; } .split .sticky { position: static; } }

.line { border-bottom: 1px solid var(--line-2); padding: 10px 0; }
.line:first-of-type { padding-top: 0; }
.line .top { display: flex; align-items: center; gap: 8px; }
.line .top .n { flex: 1; font-weight: 600; }
.line .fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.line .fields.two { grid-template-columns: 2fr 1fr; }
.line .fields label span { font-size: 11.5px; color: var(--muted); display: block; margin-bottom: 2px; }
.line .fields .input { min-height: 40px; padding: 6px 9px; }
.total-row { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 0; border-top: 1px solid var(--line); margin-top: 4px; }
.total-row .big { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.notice { border-radius: 9px; padding: 10px 12px; font-size: 13.5px; margin: 8px 0; }
.notice.red { background: var(--red-soft); color: var(--red); }
.notice.amber { background: var(--amber-soft); color: var(--amber); }
.notice.brand { background: var(--brand-soft); color: var(--brand-deep); }

/* ---------- record summary ---------- */
.summary { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); border-top: 4px solid var(--brand); overflow: hidden; }
.summary .top { display: flex; gap: 16px; align-items: center; justify-content: space-between; padding: 16px; flex-wrap: wrap; }
.summary .title { font-size: 20px; font-weight: 700; }
.summary .meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.summary .figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border-top: 1px solid var(--line-2); }
.summary .fig { padding: 12px 16px; border-right: 1px solid var(--line-2); }
.summary .fig:last-child { border-right: 0; }
.summary .fig .l { font-size: 12px; color: var(--muted); }
.summary .fig .v { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.summary .actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--line-2); background: var(--card-2); }

/* ---------- modal / toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .72); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--card); border: 1px solid var(--line); border-radius: 14px; width: 100%; max-width: 470px; max-height: 94vh; overflow: auto; box-shadow: 0 18px 44px rgba(0, 0, 0, .22); }
.modal.wide { max-width: 620px; }
.modal .mh { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line-2); position: sticky; top: 0; background: var(--card); z-index: 1; }
.modal .mb { padding: 16px 18px 6px; }
.modal .mf { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line-2); background: var(--card-2); position: sticky; bottom: 0; }
@media (max-width: 560px) {
  .overlay { align-items: flex-end; padding: 0; }
  .modal { border-radius: 16px 16px 0 0; max-height: 94vh; }
  .modal .mf .btn { flex: 1; }
  .f-row { grid-template-columns: 1fr; gap: 0; }
}
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #1e2128; color: var(--text); border: 1px solid var(--line); padding: 12px 18px; border-radius: 10px; font-weight: 550; z-index: 200; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); max-width: calc(100% - 32px); }
.toast.err { background: #7f1d1d; border-color: #b91c1c; color: #fff; }
@media (max-width: 860px) { .toast { bottom: 84px; } }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--bg); }
.login { width: 100%; max-width: 360px; padding: 30px 26px 24px; }
.login .logo { margin: 0 auto 24px; }
@media (max-width: 760px) { table.t td:nth-child(2) { min-width: 120px; } }

/* units */
.tprice small { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 1px; }
.stp b small { font-size: 11px; font-weight: 600; color: var(--muted); }

/* restock counter */
.rs-count { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.rs-count .input { width: 110px; text-align: center; }
.rs-count .btn { min-width: 56px; justify-content: center; }
.rs-lbl { font-weight: 650; color: var(--brand-deep); margin-left: 4px; }

/* ---------- returns, employees, expenses ---------- */
.side nav { min-height: 0; }
.qbtn.red { background: #b91c1c; }
a.card.stat { color: inherit; display: block; }
.chk { display: flex; align-items: center; gap: 9px; min-height: 44px; cursor: pointer; }
.chk input { width: 20px; height: 20px; accent-color: var(--brand); }
.ret-lines { display: grid; gap: 8px; }
.ret-line { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card-2); }
.ret-line .rl-n { flex: 1; min-width: 0; }
.ret-line .stp { flex: none; }
.tk-res { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; max-height: 220px; overflow-y: auto; margin-bottom: 10px; }
.tk-lines { margin-bottom: 8px; overflow-x: auto; }
.tk-lines .input { min-height: 38px; padding: 6px 8px; }
@media (max-width: 560px) { .ret-line { flex-wrap: wrap; } .ret-line .rl-n { flex-basis: 100%; } }

/* printed receipt (80 mm / 58 mm till printers and A4) */
#print-area { display: none; }
@media print {
  @page { margin: 4mm; }
  html, body { background: #fff !important; color: #000 !important; }
  body > :not(#print-area) { display: none !important; }
  #print-area { display: block; }
  .pr { width: 72mm; max-width: 100%; font: 12px/1.35 "Courier New", ui-monospace, monospace; color: #000; }
  .pr-shop { text-align: center; font-size: 16px; font-weight: 700; margin-bottom: 2px; }
  .pr-c { text-align: center; }
  .pr-hr { border-top: 1px dashed #000; margin: 6px 0; }
  .pr-item { margin-top: 3px; }
  .pr-row { display: flex; justify-content: space-between; gap: 8px; }
  .pr-ret { font-style: italic; }
}
