/* ============================================================
   G SHOPS — design system (base layout)
   Themes live in themes.css
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0,0,0,.3);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI Variable', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', 'SF Mono', Consolas, 'Courier New', monospace;
}
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.55; font-weight: 550;
  letter-spacing: .002em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background-image: var(--page-grad, none);
  background-attachment: fixed;
}
a { color: var(--accent); text-decoration: none; }
::selection { background: var(--accent); color: #fff; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ============ LOGIN (standard) ============ */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: var(--bg);
}
.login-card {
  width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 36px 32px 26px; box-shadow: var(--shadow);
  border-top: 4px solid var(--accent);
}
.login-head { text-align: center; margin-bottom: 24px; }
.login-head .brand-logo { width: 52px; height: 52px; margin-bottom: 10px; }
.login-head h1 { font-size: 24px; letter-spacing: -.02em; color: var(--ink); }
.login-head p { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.login-foot { text-align: center; font-size: 11.5px; color: var(--muted); margin-top: 20px; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.brand-logo { width: 42px; height: 42px; flex: 0 0 42px; }
.brand h1 { font-size: 21px; letter-spacing: -.02em; }
.brand p { color: var(--muted); font-size: 12.5px; }
.login-sub { color: var(--muted); font-size: 13px; margin: 14px 0 20px; }
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 6px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.input, .select, textarea.input {
  width: 100%; background: var(--input-bg); border: 1px solid var(--line); color: var(--ink);
  border-radius: 10px; padding: 10.5px 14px; font-size: 14.5px; font-weight: 550; font-family: inherit; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, textarea.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring, var(--accent-soft)); }
.input::placeholder { color: var(--placeholder); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2393a0ba' stroke-width='2.4'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; cursor: pointer; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: var(--accent-ink); border: none; border-radius: 10px;
  padding: 10.5px 20px; font-size: 14.5px; font-weight: 700; font-family: inherit; cursor: pointer;
  transition: filter .15s, transform .05s, box-shadow .15s; white-space: nowrap;
  background-image: var(--btn-grad, none);
}
.btn:hover { filter: brightness(1.07); box-shadow: var(--glow, none); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn.btn-ghost { background-image: none; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--hover); filter: none; }
.btn-danger { background: var(--danger); }
.btn-warn { background: var(--warn); color: #1a1204; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-xs { padding: 4px 9px; font-size: 11.5px; border-radius: 7px; }
.btn-icon { padding: 7px; border-radius: 9px; line-height: 0; }
.feature-strip { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.f-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; color: var(--accent);
  background: var(--accent-soft); border: 1px solid var(--accent-line); padding: 4px 9px; border-radius: 999px; }
.demo-box { margin-top: 18px; border: 1px dashed var(--line); border-radius: 12px; padding: 12px 14px; background: var(--bg2); font-size: 12.5px; color: var(--muted); }
.demo-box b { color: var(--ink); }
.demo-box code { background: var(--hover); padding: 1px 6px; border-radius: 5px; color: var(--accent); font-size: 11.5px; }
.login-err { background: var(--danger-soft); border: 1px solid var(--danger-line); color: var(--danger-text); padding: 10px 13px; border-radius: 10px; font-size: 13px; margin-bottom: 13px; display: none; }

/* ============ SHELL (left sidebar navigation) ============ */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px; flex: 0 0 236px; background: var(--bg2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { padding: 18px 18px 14px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { width: 42px; height: 42px; flex: 0 0 42px; }
.sidebar .brand h1 { font-size: 19px; font-weight: 900; letter-spacing: -.02em; line-height: 1.15; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar .brand p { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.nav { flex: 1; padding: 10px; overflow-y: auto; }
.nav-group { font-size: 10px; text-transform: uppercase; letter-spacing: .12em; color: var(--nav-group); padding: 14px 10px 6px; font-weight: 800; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px;
  color: var(--muted); font-weight: 700; margin-bottom: 2px; font-size: 14px;
  transition: background .13s, color .13s;
}
.nav a:hover { background: var(--hover); color: var(--ink); }
.nav a.active { background: var(--active-grad, var(--accent-soft)); color: var(--accent); font-weight: 700; }
.nav a.active::before { content: ""; width: 3px; height: 16px; border-radius: 3px; background: var(--accent); margin-left: -11px; }
.nav-badge { margin-left: auto; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; border-radius: 20px; padding: 1px 7px; }
.sidebar-foot { padding: 13px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.plan-chip { background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.plan-chip b { color: var(--accent); display: block; font-size: 12.5px; }
.plan-chip span { color: var(--muted); font-size: 11.5px; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; display: flex; align-items: center; gap: 14px; padding: 0 22px;
  border-bottom: 1px solid var(--line); background: var(--topbar); backdrop-filter: blur(10px) saturate(140%);
  position: sticky; top: 0; z-index: 20;
}
.topbar h2 { font-size: 17.5px; font-weight: 900; letter-spacing: -.01em; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 5px 6px 5px 5px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-weight: 700; font-size: 12.5px; flex: 0 0 32px;
  box-shadow: 0 2px 6px -1px var(--accent-soft);
}
.user-chip .meta { line-height: 1.15; padding-right: 4px; }
.user-chip .meta b { font-size: 12.5px; display: block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .meta span { font-size: 11px; color: var(--muted); text-transform: capitalize; }
.role-pill { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.role-pill.plan-pill { background: var(--warn-soft); color: var(--warn-text); }
.view { padding: 24px 26px 60px; max-width: 1400px; width: 100%; margin: 0 auto; }

/* ============ DASHBOARD HEADER (standard) ============ */
.dash-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  margin-bottom: 18px; padding: 18px 22px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line);
  background-image: linear-gradient(120deg, var(--accent-soft), transparent 55%), var(--panel-gradient, none);
}
.dash-head h2 { font-size: 24px; font-weight: 900; letter-spacing: -.02em; line-height: 1.15; }
.dash-head p { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 600; margin-top: 5px; }
.dash-head .actions { display: flex; gap: 9px; flex-wrap: wrap; }
.dash-head .actions .btn { min-height: 42px; }
@media (max-width: 700px) {
  .dash-head { align-items: stretch; padding: 16px; }
  .dash-head h2 { font-size: 20px; }
  .dash-head .actions { width: 100%; }
  .dash-head .actions .btn { flex: 1; }
}

/* ============ CARDS / STATS ============ */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: 0 4px 18px var(--shadow-soft);
  background-image: var(--panel-gradient, none);
  transition: box-shadow .18s, transform .18s, border-color .18s;
}
.card:hover { box-shadow: var(--card-hover, var(--shadow-soft)); }
.card-title { font-size: 15.5px; font-weight: 900; margin-bottom: 13px; display: flex; align-items: center; gap: 9px; }
.card-title .sub { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: auto; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 15px; margin-bottom: 20px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; gap: 14px; align-items: flex-start; position: relative; overflow: hidden; background-image: var(--panel-gradient, none); transition: box-shadow .18s, transform .18s; }
.stat:hover { box-shadow: var(--card-hover, var(--shadow-soft)); transform: translateY(-1px); }
.stat::after { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--accent); opacity: .85; }
.stat .ic { width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); flex: 0 0 40px; background-image: var(--icon-grad, none); }
.stat .val { font-size: 24px; font-weight: 900; letter-spacing: -.025em; line-height: 1.1; }
.stat .lbl { font-size: 12px; color: var(--muted); margin-top: 3px; }
.stat .foot { font-size: 11.5px; margin-top: 6px; color: var(--muted); }
.stat.tone-danger::after { background: var(--danger); } .stat.tone-danger .ic { background: var(--danger-soft); color: var(--danger); }
.stat.tone-warn::after { background: var(--warn); } .stat.tone-warn .ic { background: var(--warn-soft); color: var(--warn); }
.stat.tone-info::after { background: var(--info); } .stat.tone-info .ic { background: var(--info-soft); color: var(--info); }
.stat.tone-muted::after { background: var(--muted2); } .stat.tone-muted .ic { background: var(--muted-soft); color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-bottom: 20px; }
.grid-2.even { grid-template-columns: 1fr 1fr; }
@media (max-width: 1000px) { .grid-2, .grid-2.even { grid-template-columns: 1fr; } }

/* ============ TABLES ============ */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.75px; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; font-weight: 800; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; font-weight: 650; }
.tbl tbody tr:hover { background: var(--hover); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl th.num { text-align: right; }
.tbl-actions { display: flex; gap: 5px; justify-content: flex-end; flex-wrap: wrap; }
.row-actions { display: flex; gap: 4px; }
.empty-row td { text-align: center; color: var(--muted); padding: 26px 12px; }

/* ============ BADGES ============ */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 999px; white-space: nowrap; text-transform: capitalize; }
.badge.ok { background: var(--ok-soft); color: var(--ok-text); }
.badge.warn { background: var(--warn-soft); color: var(--warn-text); }
.badge.danger { background: var(--danger-soft); color: var(--danger-text); }
.badge.info { background: var(--info-soft); color: var(--info-text); }
.badge.muted { background: var(--muted-soft); color: var(--muted); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.plain { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }

/* ============ TOASTS / MODALS ============ */
#toasts { position: fixed; bottom: 22px; right: 22px; z-index: 300; display: flex; flex-direction: column; gap: 9px; max-width: 360px; }
.toast { background: var(--panel2); border: 1px solid var(--line); border-left: 4px solid var(--accent); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start; animation: slideIn .22s ease; }
.toast.err { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.overlay { position: fixed; inset: 0; background: var(--overlay); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 22px; z-index: 200; animation: fadeIn .16s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; box-shadow: var(--shadow); animation: pop .18s ease; }
.modal.wide { max-width: 780px; }
@keyframes pop { from { transform: scale(.96) translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 17px 22px 13px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 2; }
.modal-head h3 { font-size: 16px; }
.modal-x { margin-left: auto; background: none; border: none; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 8px; line-height: 0; }
.modal-x:hover { color: var(--ink); background: var(--hover); }
.modal-body { padding: 19px 22px; }
.modal-foot { padding: 13px 22px 19px; display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--panel); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid .half { grid-column: span 1; }
.hint { font-size: 12px; color: var(--muted); margin-top: 5px; }

/* ============ TABS / TOOLBARS ============ */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { background: none; border: none; color: var(--muted); font-family: inherit; font-size: 13.5px; font-weight: 700; padding: 10px 14px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.toolbar { display: flex; gap: 10px; margin-bottom: 15px; flex-wrap: wrap; align-items: center; }
.searchbox { position: relative; flex: 1; min-width: 190px; max-width: 330px; }
.searchbox input { padding-left: 35px; }
.searchbox svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.pos-cat-filter { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: auto; max-width: 150px; font-size: 12px; padding: 5px 24px 5px 10px; border: none; background: transparent; color: var(--accent); font-weight: 600; }
.searchbox:has(.pos-cat-filter) input { padding-right: 160px; }
.kpis { display: flex; gap: 8px; flex-wrap: wrap; }
.kpi { background: var(--bg2); border: 1px solid var(--line); padding: 6px 13px; border-radius: 999px; font-size: 13px; font-weight: 650; color: var(--muted); }
.kpi b { color: var(--ink); }
.page-head { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { font-size: 22px; font-weight: 900; letter-spacing: -.02em; }
.page-head p { color: var(--muted); font-size: 13.5px; margin-top: 3px; max-width: 760px; line-height: 1.55; }
.page-head .actions { margin-left: auto; display: flex; gap: 9px; flex-wrap: wrap; }

/* ============ QUICK ACCESS (Retailman-style module tiles) ============ */
.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 12px; margin-bottom: 20px; }
.quick-tile {
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 18px 10px; color: var(--ink); font-weight: 700; font-size: 13px; text-decoration: none;
  transition: border-color .15s, transform .1s, box-shadow .15s;
}
.quick-tile:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); box-shadow: var(--card-hover, 0 6px 16px var(--shadow-soft)); }
.quick-tile .qi { width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); background-image: var(--icon-grad, none); }

/* ============ BARS ============ */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; height: 100%; justify-content: flex-end; }
.bar { width: 100%; max-width: 44px; border-radius: 7px 7px 3px 3px; background: var(--accent); min-height: 4px; transition: filter .2s; }
.bar:hover { filter: brightness(1.25); }
.bar-val { font-size: 10.5px; color: var(--muted); }
.bar-lbl { font-size: 11px; color: var(--muted); white-space: nowrap; }
.hbar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; font-size: 12.5px; }
.hbar-row .lbl { width: 145px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 0 0 145px; }
.hbar { height: 10px; border-radius: 6px; background: var(--accent-soft); flex: 1; overflow: hidden; }
.hbar > div { height: 100%; border-radius: 6px; background: var(--accent); }
.hbar-row .val { width: 105px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ============ ALERTS / LISTS ============ */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-radius: 12px; margin-bottom: 16px; border: 1px solid; font-size: 13.5px; }
.alert.warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn-text); }
.alert.danger { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger-text); }
.alert.info { background: var(--info-soft); border-color: var(--info-line); color: var(--info-text); }
.list-stack { display: flex; flex-direction: column; gap: 8px; }
.list-item { display: flex; align-items: center; gap: 12px; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 13px; font-size: 13px; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item b { display: block; font-size: 13px; font-weight: 800; }
.list-item span { color: var(--muted); font-size: 12px; }
.pack-rows { display: flex; flex-direction: column; gap: 7px; margin: 8px 0 4px; }
.pack-row { display: flex; gap: 8px; align-items: center; }
.pack-row .input { flex: 1; min-width: 0; }
.pack-row .input.pack-qty { flex: 0 0 80px; text-align: center; }
.pack-row .input.pack-price { flex: 0 0 110px; text-align: right; }
.pack-row button { flex: 0 0 auto; }

/* ============ POS ============ */
.pos-wrap { display: grid; grid-template-columns: 1fr 370px; gap: 16px; align-items: start; }
@media (max-width: 1050px) { .pos-wrap { grid-template-columns: 1fr; } }

/* ---- TOUCH SCREEN MODE (categories = flat row on top, items = big buttons below) ---- */
.pos-touch { display: block; }
.pos-cats {
  display: flex; flex-direction: row; flex-wrap: wrap; gap: 8px; width: 100%; margin-bottom: 14px;
  max-height: none; overflow: visible; padding: 0;
}
.pos-cats button {
  text-align: center; padding: 13px 18px; border-radius: 10px; cursor: pointer; font-weight: 700; font-size: 14px;
  background: var(--panel); border: 1px solid var(--line); color: var(--ink); font-family: inherit; white-space: nowrap;
  transition: background .12s, color .12s, border-color .12s;
}
.pos-cats button:hover { border-color: var(--accent); }
.pos-cats button.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pos-touch-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.pos-touch-grid .prod-card { padding: 16px 12px; }
.pos-touch-grid .prod-card .nm { font-size: 14.5px; }
.pos-touch-grid .price-btn { font-size: 13px; padding: 10px 10px; }
@media (max-width: 860px) {
  .pos-cats { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .pos-cats button { white-space: nowrap; }
}
.pos-toolbar { display: flex; gap: 10px; margin-bottom: 13px; flex-wrap: wrap; align-items: center; }
.scan-box { position: relative; flex: 1; min-width: 220px; max-width: 360px; }
.scan-box input { padding-left: 35px; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); font-weight: 600; }
.scan-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--accent); pointer-events: none; }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 11px; }
.prod-card { background: var(--panel); border: 1px solid var(--line); border-radius: 13px; padding: 13px; cursor: pointer; transition: border-color .14s, transform .1s, box-shadow .14s; position: relative; background-image: var(--panel-gradient, none); }
.prod-card:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--card-hover, none); }
.prod-card .nm { font-weight: 800; font-size: 13.5px; margin-bottom: 3px; }
.prod-card .cat { font-size: 10.5px; color: var(--muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.prod-card .prices { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.price-btn { display: flex; justify-content: space-between; align-items: center; background: var(--bg2); border: 1px solid var(--line); border-radius: 9px; padding: 6px 9px; font-size: 12px; cursor: pointer; transition: border-color .12s, background .12s; font-family: inherit; color: var(--ink); }
.price-btn:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.price-btn b { color: var(--accent); font-weight: 900; }
.stock-chip { position: absolute; top: 10px; right: 10px; font-size: 15px; line-height: 1.2; min-width: 34px; text-align: center; font-weight: 900; padding: 5px 11px; border-radius: 999px; }
.stock-chip.low { background: var(--danger-soft); color: var(--danger-text); }
.stock-chip.ok { background: var(--ok-soft); color: var(--ok-text); }
.stock-chip.service { background: var(--info-soft); color: var(--info-text); }
.type-chip { display: inline-block; font-size: 9.5px; font-weight: 800; letter-spacing: .05em; padding: 2px 7px; border-radius: 999px; vertical-align: 1px; }
.type-chip.stk { background: var(--muted-soft); color: var(--muted); }
.type-chip.svc { background: var(--info-soft); color: var(--info-text); }
.type-chip.pkg { background: var(--warn-soft); color: var(--warn-text); }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { flex: 1; min-width: 130px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 10px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--bg2); color: var(--muted); font-family: inherit; font-size: 13px; font-weight: 700; cursor: pointer; transition: all .13s; }
.seg button:hover { border-color: var(--accent); color: var(--accent); }
.seg button.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); background-image: var(--btn-grad, none); }
.cart-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; position: sticky; top: 76px; }
.cart-panel h3 { font-size: 14.5px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.cart-empty { text-align: center; color: var(--muted); padding: 30px 10px; font-size: 13px; }
.cart-line { display: flex; align-items: center; gap: 9px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.cart-line .nm { flex: 1; min-width: 0; }
.cart-line .nm b { display: block; font-size: 13px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-line .nm span { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.qty-ctl { display: flex; align-items: center; gap: 3px; }
.qty-ctl button { width: 23px; height: 23px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg2); color: var(--ink); cursor: pointer; font-size: 13px; line-height: 1; font-family: inherit; }
.qty-ctl button:hover { border-color: var(--accent); color: var(--accent); }
.qty-ctl .q { min-width: 26px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 12.5px; }
.qty-ctl .q-in {
  width: 54px; text-align: center; background: var(--bg2); border: 1px solid var(--line); color: var(--ink);
  border-radius: 6px; padding: 3px 4px; font-size: 12.5px; font-weight: 700; font-family: inherit; outline: none;
}
.qty-ctl .q-in:focus { border-color: var(--accent); }
.cart-total { display: flex; justify-content: space-between; align-items: center; margin: 13px 0; font-size: 14px; font-weight: 800; }
.cart-total span:last-child { font-size: 19px; color: var(--accent); }
.cart-bill { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin-bottom: 8px; }
.bill-row { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 2px 0; }
.bill-row span:last-child { color: var(--ink); font-weight: 700; }
.pos-loyalty { background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 10px; padding: 9px 12px; margin-bottom: 10px; }
.pos-loyalty .loy-line { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; font-weight: 700; padding: 2px 0; color: var(--ink); }
.pos-loyalty .loy-line b { color: var(--accent); font-weight: 900; }
.pos-loyalty .toggle-row { margin: 4px 0 0 !important; }
.split-pay { background: var(--bg2); border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; margin-bottom: 12px; }
.split-title { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.pay-row { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; }
.pay-row:last-of-type { margin-bottom: 0; }
.pay-lbl { width: 100px; flex: 0 0 100px; display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.pay-in { text-align: right; }
.pay-bank-row { display: none; align-items: center; gap: 9px; margin: 4px 0 8px 109px; }
.pay-bank-row .select { flex: 1; min-width: 0; font-size: 12.5px; padding: 7px 30px 7px 10px; }
.pay-sum { display: flex; flex-wrap: wrap; gap: 5px 14px; align-items: center; margin-top: 9px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 12px; color: var(--muted); }
.pay-sum b { color: var(--ink); }
.pay-note { font-weight: 700; }
.pay-note.ok { color: var(--ok); }
.pay-note.err { color: var(--danger); }
.pos-cust { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.pos-cust .select { flex: 1; min-width: 150px; }
.toggle-row { display: flex; gap: 14px; align-items: center; font-size: 12.5px; color: var(--muted); margin: 4px 0 10px; }
.switch { position: relative; width: 36px; height: 20px; flex: 0 0 36px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: var(--line-strong); border-radius: 20px; cursor: pointer; transition: .2s; }
.slider:before { content: ""; position: absolute; height: 14px; width: 14px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider:before { transform: translateX(16px); }

/* ============ RECEIPTS (thermal — standard Retailman-style, BOLD) ============ */
.receipt { font-family: 'Courier New', ui-monospace, monospace; background: #fff; color: #000; margin: 0 auto; padding: 12px 10px; border-radius: 6px; font-weight: 800; }
.receipt-80 { max-width: 320px; font-size: 13px; }
.receipt-58 { max-width: 218px; font-size: 10.5px; }
.receipt .r-head { text-align: center; margin-bottom: 8px; }
.receipt .r-head .r-logo { display: block; max-width: 140px; max-height: 64px; margin: 0 auto 5px; object-fit: contain; }
.receipt .r-void { margin-top: 6px; font-size: 15px; font-weight: 900; letter-spacing: .1em; color: #b91c1c; border: 2px solid #b91c1c; padding: 3px 8px; display: inline-block; }
.receipt .r-void span { font-size: 9.5px; letter-spacing: .03em; font-weight: 700; }
.receipt-58 .r-head .r-logo { max-width: 100px; max-height: 46px; }
.receipt .r-head .r-biz { font-size: 17px; font-weight: 900; display: block; letter-spacing: .02em; }
.receipt .r-head .r-loc { font-size: 11px; font-weight: 600; opacity: .9; display: block; line-height: 1.45; }
.receipt .r-head .r-tag { font-size: 10.5px; font-weight: 700; opacity: .85; display: block; letter-spacing: .06em; text-transform: uppercase; }
.receipt .r-rule { border-top: 1px dashed #333; margin: 6px 0; }
.receipt .r-rule.solid { border-top: 2px solid #111; }
.receipt table { width: 100%; border-collapse: collapse; }
.receipt th { text-align: left; font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; padding: 2px 0 4px; border-bottom: 2px solid #111; }
.receipt th.n { text-align: right; }
.receipt th.r-qty { text-align: center; }
.receipt td { padding: 2px 0; vertical-align: top; font-weight: 800; }
.receipt td.n { text-align: right; white-space: nowrap; font-weight: 800; font-variant-numeric: tabular-nums; }
.receipt .r-item { word-break: break-word; padding-right: 5px; }
.receipt .r-item .r-subline { font-weight: 700; opacity: .85; font-size: .92em; }
.receipt .r-qty { white-space: nowrap; text-align: center; width: 30px; font-weight: 800; font-variant-numeric: tabular-nums; }
.receipt .r-total { border-top: 2px solid #111; margin-top: 6px; padding-top: 6px; font-weight: 900; display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.receipt .r-total b { font-size: 16px; font-weight: 900; }
.receipt .r-lines { display: flex; justify-content: space-between; font-size: 12px; font-weight: 800; padding: 1px 0; }
.receipt .r-lines.r-sub { font-weight: 800; }
.receipt .r-meta { display: flex; justify-content: space-between; font-size: 11px; font-weight: 800; padding: 1px 0; }
.receipt .r-meta b { font-weight: 900; }
.receipt .r-foot { text-align: center; margin-top: 9px; font-size: 11px; font-weight: 800; line-height: 1.5; }
.receipt .r-foot b { font-weight: 900; }
.receipt-58 .r-head .r-biz { font-size: 14px; }
.receipt-58 .r-total b { font-size: 13.5px; }
.receipt-58 .r-lines { font-size: 10.5px; }
.receipt-58 td, .receipt-58 th { font-size: 10px; }
.print-area { background: #fff; }
@media print {
  body * { visibility: hidden !important; }
  .print-area, .print-area * { visibility: visible !important; }
  .print-area { position: fixed; left: 0; top: 0; width: 100%; box-shadow: none; }
  .receipt-multi-printing .overlay .print-area, .receipt-multi-printing .overlay .print-area * { visibility: hidden !important; }
  #receipt-multi-print { visibility: visible !important; position: absolute; left: 0; top: 0; width: 100%; background: #fff; }
  #receipt-multi-print, #receipt-multi-print * { visibility: visible !important; }
  #receipt-multi-print .print-area { position: relative; left: auto; top: auto; width: 100%; box-shadow: none; page-break-after: always; break-after: page; }
  #receipt-multi-print .print-area:last-child { page-break-after: auto; break-after: auto; }
  .no-print { display: none !important; }
}

/* ============ BARCODE LABELS (A4 sticker sheets) ============ */
#label-print-area { position: fixed; inset: 0; overflow: auto; background: #fff; z-index: 400; padding: 12px; }
.label-toolbar { display: flex; gap: 10px; align-items: center; padding: 10px 4px 14px; border-bottom: 1px solid #e5e7eb; margin-bottom: 12px; background: #fff; position: sticky; top: 0; }
.label-sheet { display: flex; flex-wrap: wrap; gap: 3mm; background: #fff; padding: 2mm; }
.label-card { border: 1px dashed #9ca3af; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2mm 3mm; text-align: center; overflow: hidden; }
.label-sheet.lb-sm .label-card { width: 58mm; min-height: 30mm; }
.label-sheet.lb-md .label-card { width: 78mm; min-height: 38mm; }
.label-sheet.lb-lg .label-card { width: 98mm; min-height: 48mm; }
.label-card .nm { font-size: 9px; font-weight: 700; color: #000; font-family: Arial, Helvetica, sans-serif; line-height: 1.15; margin-bottom: 1mm; }
.label-card .pr { font-size: 9px; color: #000; font-family: Arial, sans-serif; margin-top: 1mm; font-weight: 700; }
.label-bc svg { max-width: 100%; height: auto; }
@media print {
  #label-print-area { position: static; inset: auto; overflow: visible; background: #fff; padding: 0; }
  #label-print-area .label-toolbar { display: none; }
  .label-sheet { gap: 2mm; padding: 0; }
  .label-card { border: 1px dashed #cbd5e1; break-inside: avoid; }
}

/* ============ MISC ============ */
.empty-state { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty-state svg { opacity: .45; margin-bottom: 10px; }
.empty-state b { display: block; color: var(--ink); font-size: 14px; margin-bottom: 3px; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 64px 0; color: var(--muted); font-size: 13.5px; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid var(--line-strong); border-top-color: var(--accent); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: .95em; }
.muted { color: var(--muted); }
.small { font-size: 12px; font-weight: 600; }
.mt { margin-top: 14px; } .mb { margin-bottom: 14px; }
.flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.cat-chip { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--bg2); border: 1px solid var(--line); padding: 2px 8px; border-radius: 999px; }
.expiry-progress { height: 6px; border-radius: 5px; background: var(--bg2); overflow: hidden; margin-top: 8px; }
.expiry-progress > div { height: 100%; border-radius: 5px; }
.expiry-progress .ok { background: var(--ok); } .expiry-progress .warn { background: var(--warn); } .expiry-progress .danger { background: var(--danger); }
.table-chip { display: inline-block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.big-num { font-size: 21px; font-weight: 800; }
.qty-in { color: var(--ok); font-weight: 700; }
.qty-out { color: var(--danger); font-weight: 700; }

/* ============ MOBILE (bottom nav, responsive everything) ============ */
.mobile-nav { display: none; }
@media (max-width: 860px) {
  .sidebar { display: none; }
  .topbar { height: 54px; padding: 0 12px; gap: 8px; }
  .topbar h2 { font-size: 15px; }
  .mobile-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 120;
    background: var(--panel); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .mobile-nav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 9px 4px 8px; color: var(--muted); font-size: 10.5px; font-weight: 600; text-decoration: none;
  }
  .mobile-nav a.active { color: var(--accent); }
  .mobile-nav a .mi { line-height: 0; }
  .main { padding-bottom: 60px; }
  .top-actions .role-pill { display: none; }
  .top-actions .kpi { display: none; }
  .user-chip .meta b { max-width: 110px; }
  .view { padding: 14px 10px 30px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat .val { font-size: 18px; }
  .stat .ic { width: 34px; height: 34px; flex: 0 0 34px; }
  .grid-2, .grid-2.even { grid-template-columns: 1fr; gap: 12px; }
  .quick-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .quick-tile { padding: 12px 6px; font-size: 11.5px; }
  .quick-tile .qi { width: 34px; height: 34px; }
  .card { padding: 14px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .page-head .actions { margin-left: 0; width: 100%; }
  .page-head .actions .btn { flex: 1; }
  .toolbar { gap: 8px; }
  .searchbox { max-width: 100%; min-width: 0; }
  .modal { max-height: 92vh; }
  .form-grid { grid-template-columns: 1fr; }
  .login-card { padding: 28px 22px 20px; }
  .bars { height: 120px; }
  /* POS: products on top, cart below */
  .pos-wrap { grid-template-columns: 1fr; }
  .pos-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
  .cart-panel { position: static; margin-top: 4px; }
  .pos-toolbar { flex-direction: column; align-items: stretch; }
  .scan-box, .searchbox { max-width: 100%; }
  .searchbox { width: 100%; }
  .pos-cat-filter { position: static; transform: none; max-width: 100%; width: 100%; margin-top: 6px; padding: 7px 12px; background: var(--input-bg); border: 1px solid var(--line); border-radius: 9px; }
  .searchbox:has(.pos-cat-filter) input { padding-right: 13px; }
  .tbl th, .tbl td { padding: 8px 9px; }
  .pos-cust { flex-direction: column; }
}
@media (max-width: 420px) {
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .user-chip .meta span { display: none; }
  .user-chip .meta b { font-size: 11.5px; }
  .pos-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   RESPONSIVE — adaptive screens for phones, tablets, laptops
   ============================================================ */

/* ---- Tablets / small laptops: slimmer sidebar, tighter density ---- */
@media (min-width: 861px) and (max-width: 1180px) {
  .sidebar { width: 205px; flex-basis: 205px; }
  .nav a { font-size: 13px; padding: 7.5px 10px; gap: 9px; }
  .sidebar .brand h1 { font-size: 17px; }
  .view { padding: 20px 20px 50px; }
  .topbar { padding: 0 16px; }
  .page-head h2 { font-size: 19px; }
  .stat .val { font-size: 20px; }
  .pos-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .stats-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
}

/* ---- Phones & small screens: everything touch-friendly ---- */
@media (max-width: 860px) {
  /* bigger touch targets */
  .btn { min-height: 42px; }
  .btn-sm { min-height: 34px; }
  .input, .select { font-size: 16px; }          /* prevents iOS zoom */
  .nav a { font-size: 14.5px; }
  /* modal becomes a bottom sheet on phones */
  .overlay { padding: 0; align-items: flex-end; }
  .modal { max-width: 100%; max-height: 94vh; border-radius: 18px 18px 0 0; }
  .modal.wide { max-width: 100%; }
  /* mobile nav with pill highlight */
  .mobile-nav a { padding: 10px 4px 9px; font-size: 11px; gap: 4px; }
  .mobile-nav a.active { color: var(--accent); }
  .mobile-nav a.active .mi { background: var(--accent-soft); border-radius: 10px; padding: 3px 10px; }
  .mobile-nav a .mi { line-height: 0; }
  /* page header stacks, actions full width */
  .page-head { align-items: stretch; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1; min-height: 44px; }
  .toolbar .btn { min-height: 40px; }
  .toolbar .select, .toolbar .input { width: 100%; }
  /* topbar compact */
  .topbar { padding: 0 10px; gap: 8px; }
  .user-chip { padding: 3px; }
  .user-chip .avatar { width: 30px; height: 30px; font-size: 11px; flex-basis: 30px; }
  /* stats */
  .stats-grid { gap: 9px; }
  .stat { padding: 12px 13px; gap: 10px; }
  .stat .ic { width: 36px; height: 36px; flex-basis: 36px; border-radius: 10px; }
  .stat .lbl { font-size: 11px; }
  /* tables scroll horizontally when wide */
  .tbl-wrap { -webkit-overflow-scrolling: touch; }
  /* quick tiles */
  .quick-tile { min-height: 92px; justify-content: center; }
  .quick-tile .qi { width: 40px; height: 40px; }
  /* POS product cards on phones */
  .prod-card { padding: 12px 10px; }
  .prod-card .nm { font-size: 13px; }
  .price-btn { padding: 9px 8px; font-size: 12px; min-height: 40px; }
  .cart-panel { border-radius: 14px; }
  .pay-lbl { width: 88px; flex-basis: 88px; font-size: 12px; }
  .pay-row .input { font-size: 15px; }
  /* login full-bleed */
  .login-wrap { padding: 12px; }
  .login-card { padding: 30px 22px 22px; }
  .toasts { right: 12px; left: 12px; bottom: 74px; max-width: none; }
  .toast { font-size: 13px; }
}
@media (max-width: 480px) {
  .pos-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .page-head h2 { font-size: 18px; }
  .seg button { min-width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .card { padding: 15px; }
  .avatar { width: 30px; height: 30px; flex-basis: 30px; font-size: 11px; }
  .bars { height: 110px; }
  .bar-val { display: none; }
  .hbar-row .lbl { width: 96px; flex-basis: 96px; font-size: 11.5px; }
}
/* ---- Big desktop screens: breathe ---- */
@media (min-width: 1600px) {
  .view { max-width: 1600px; }
  body { font-size: 15.5px; }
}

/* POS searchable product picker */
.pos-product-search { max-width: none; }
.pos-product-suggestions {
  position: absolute; z-index: 80; top: calc(100% + 5px); left: 0; right: 0;
  max-height: min(420px, 65vh); overflow-y: auto; background: var(--panel, var(--surface));
  border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,.18);
}
.pos-product-suggestions[hidden] { display: none !important; }
.pos-product-option { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--text); cursor: pointer; }
.pos-product-option:last-child { border-bottom: 0; }
.pos-product-option:hover, .pos-product-option:focus-visible { background: var(--hover, rgba(127,127,127,.12)); outline: none; }
.pos-product-option[aria-disabled="true"] { opacity: .48; cursor: not-allowed; }
.pos-product-option-main, .pos-product-option-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pos-product-option-main b { overflow-wrap: anywhere; }
.pos-product-option-main small, .pos-product-option-meta small { color: var(--muted); font-size: 11px; }
.pos-product-option-meta { flex-shrink: 0; text-align: right; }
.pos-product-no-results { padding: 16px; color: var(--muted); font-size: 13px; }


/* RetailMan-inspired POS and purchasing presentation (scoped; no workflow changes) */
.retailman-pos { display:grid; grid-template-columns:minmax(0,1fr) minmax(330px,390px); gap:12px; align-items:start; }
.retailman-pos > div:first-child { min-width:0; background:#f3f5f8; border:1px solid #b9c4d2; padding:10px; border-radius:4px; }
.retailman-pos .pos-toolbar { gap:8px; align-items:stretch; }
.retailman-pos .scan-box, .retailman-pos .searchbox { background:#fff; border:1px solid #9eacbd; border-radius:3px; min-height:44px; }
.retailman-pos .scan-box .input, .retailman-pos .searchbox .input { min-height:42px; font-size:15px; }
.retailman-pos .pos-count, .retailman-pos #pos-count { display:block; padding:7px 9px; background:#dfe7f1; color:#203c5d; border:1px solid #bdcadd; font-weight:700; }
.retailman-pos .pos-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(135px,1fr)); gap:7px; }
.retailman-pos .pos-grid > * { border-radius:3px!important; }
.retailman-pos .pos-grid .product-card, .retailman-pos .pos-grid .pos-product, .retailman-pos .pos-grid .product-tile { border:1px solid #9eacbd; background:#fff; box-shadow:0 1px 0 #d4dce6; }
.retailman-pos .pos-touch-grid { grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:9px; }
.retailman-pos .pos-cats { display:flex; flex-wrap:wrap; gap:6px; margin:8px 0; padding:8px; background:#dfe7f1; border:1px solid #b9c4d2; }
.retailman-pos .pos-cats button { min-height:42px; padding:8px 14px; border:1px solid #879bb2; border-radius:3px; background:linear-gradient(#fff,#e5ebf2); color:#243b55; font-weight:700; }
.retailman-pos .pos-cats button.active { background:linear-gradient(#357bd0,#1858a7); color:#fff; border-color:#154a8b; }
.retailman-pos .cart-panel { position:sticky; top:10px; border:1px solid #9eacbd; border-radius:4px; background:#fff; box-shadow:0 2px 5px #243b551a; padding:12px; }
.retailman-pos .cart-panel h3 { margin:-12px -12px 12px; padding:12px; background:linear-gradient(#e9eff7,#d4dfed); border-bottom:1px solid #a9b8ca; color:#203c5d; }
.retailman-pos #pos-customer { min-height:43px; border-radius:3px; border-color:#9eacbd; }
.retailman-pos .cart-total { background:#e6edf6; border:1px solid #c1ccda; padding:12px; border-radius:3px; font-size:18px; font-weight:800; }
.retailman-pos #checkout { min-height:50px; border-radius:3px; font-size:16px; font-weight:800; background:linear-gradient(#357bd0,#1858a7); }
.retailman-purchase-view .tabs { background:#e4ebf4; padding:5px; border:1px solid #bcc9d8; gap:5px; }
.retailman-purchase-view .tabs button { min-height:42px; border-radius:3px; font-weight:700; }
.retailman-purchase-view .page-head { padding:14px 16px; background:#f0f4f8; border:1px solid #c0ccda; margin-bottom:12px; }
.retailman-purchase-view .card { border-radius:4px; border-color:#c0ccda; }
.retailman-purchase-view .tbl th { background:#e3eaf3; color:#304967; }
.retailman-purchase-line { align-items:center; border-radius:3px!important; background:#edf2f7!important; border-color:#bac7d6!important; }
.retailman-purchase-line .input, .retailman-purchase-line .select { min-height:42px; border-radius:3px; border-color:#9eacbd; }
@media(max-width:900px) { .retailman-pos { grid-template-columns:1fr; } .retailman-pos .cart-panel { position:static; } }
@media(max-width:600px) { .retailman-pos .pos-grid, .retailman-pos .pos-touch-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } .retailman-pos .pos-toolbar { flex-wrap:wrap; } .retailman-purchase-line { flex-wrap:wrap; } .retailman-purchase-line .select { flex:1 1 100%!important; } }


/* ===== G Shops responsive navigation refinement (2026-10) ===== */
.mobile-menu-toggle { display: none; flex: 0 0 auto; }
.topbar-title { min-width: 0; }
.topbar-title h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-chip [data-plan-chip-name] { overflow-wrap: anywhere; }
@media (max-width: 860px) {
  .mobile-menu-toggle { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; min-height: 38px; padding: 0; }
  .topbar { height: 54px; min-height: 54px; padding: 0 9px; gap: 8px; }
  .topbar-title { flex: 1 1 auto; }
  .topbar h2 { max-width: 42vw; font-size: 14px; }
  .top-actions { gap: 5px; min-width: 0; }
  .top-actions .plan-pill { display: none; }
  .user-chip { max-width: 42vw; border: 0; background: transparent; }
  .user-chip .meta { display: none; }
  .user-chip .avatar { width: 30px; height: 30px; flex-basis: 30px; }
  .view { padding: 12px 10px 26px; }
  .card { padding: 13px; border-radius: 12px; }
  .card-title { font-size: 14px; margin-bottom: 10px; }
  .dash-head { padding: 14px; margin-bottom: 12px; }
  .dash-head h2 { font-size: 19px; }
  .stats-grid { gap: 8px; }
  .stat { padding: 10px; gap: 8px; border-radius: 12px; }
  .stat .val { font-size: clamp(15px, 4.5vw, 19px); overflow-wrap: anywhere; }
  .stat .ic { width: 30px; height: 30px; flex-basis: 30px; }
  .grid-2, .grid-2.even { gap: 10px; }
  .main { min-width: 0; width: 100%; }
  body.mobile-menu-open { overflow: hidden; }
  body.mobile-menu-open::before { content: ""; position: fixed; inset: 0; background: rgba(15,23,42,.48); z-index: 190; }
  body.mobile-menu-open .sidebar {
    display: flex; position: fixed; inset: 0 auto 0 0; width: min(84vw, 300px);
    height: 100dvh; max-height: 100dvh; z-index: 200; flex: none;
    box-shadow: 14px 0 36px rgba(15,23,42,.22); overflow: hidden;
  }
  body.mobile-menu-open .sidebar .brand { padding: 14px; }
  body.mobile-menu-open .sidebar .nav { overflow-y: auto; padding: 8px; }
  body.mobile-menu-open .sidebar .nav a { min-height: 42px; font-size: 14px; padding: 9px 11px; }
  body.mobile-menu-open .sidebar .nav-group { padding-top: 11px; }
  body.mobile-menu-open .sidebar .sidebar-foot { padding: 10px 12px; }
  .mobile-nav { min-height: 56px; }
  .mobile-nav a { padding: 7px 2px 6px; font-size: 10px; }
  .mobile-nav a .mi svg { width: 18px; height: 18px; }
  .main { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
  .tbl-wrap { max-width: 100%; overflow-x: auto; }
  .page-head { gap: 8px; margin-bottom: 12px; }
  .page-head .actions { gap: 6px; flex-wrap: wrap; }
  .page-head .actions .btn { min-width: 0; }
  .form-grid { gap: 10px; }
  .field { min-width: 0; }
  input, select, textarea, .input, .select { max-width: 100%; }
}
@media (max-width: 420px) {
  .view { padding: 10px 8px 22px; }
  .stats-grid { gap: 7px; }
  .stat { padding: 9px; }
  .stat .lbl { font-size: 10.5px; }
  .mobile-nav a { font-size: 9.5px; }
  .topbar h2 { max-width: 38vw; }
}


/* G Shops responsive usability refinements (subscription header + mobile navigation) */
.topbar { min-width: 0; }
.topbar-title { min-width: 0; flex: 1 1 auto; }
.topbar-title h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { min-width: 0; }
.plan-pill { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.plan-chip b, .plan-chip span { overflow-wrap: anywhere; }
@media (max-width: 860px) {
  .topbar { height: auto; min-height: 54px; padding: 7px 10px; flex-wrap: nowrap; }
  .topbar-title { flex: 1 1 0; }
  .topbar-title h2 { font-size: 14px; }
  .top-actions { gap: 6px; flex: 0 1 auto; }
  .top-actions .plan-pill { display: none; }
  .top-actions .theme-select, .top-actions select { max-width: 112px; }
  .user-chip .meta { display: none; }
  .user-chip { border: 0; background: transparent; }
  .view { min-width: 0; overflow-x: clip; }
  .card, .dash-head, .stat { min-width: 0; }
  .tbl-wrap { max-width: 100%; }
}
@media (max-width: 420px) {
  .topbar-title h2 { max-width: 118px; }
  .top-actions { gap: 4px; }
  .top-actions .theme-select, .top-actions select { max-width: 88px; }
  .view { padding-left: 9px; padding-right: 9px; }
}


/* G Shops mobile hardening: prevent report/filter/forms from overlapping on phones */
html, body { max-width: 100%; overflow-x: hidden; }
#app, .app, .layout, .main, .view, #view { min-width: 0; max-width: 100%; }
.view > *, #view > *, .card, .page-head, .grid-2, .grid-3, .stats-grid,
.form-grid, .filters, .filter-row, .report-filters, .actions { min-width: 0; }
.tbl-wrap, .table-wrap, .table-responsive { display: block; width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl-wrap table, .table-wrap table, .table-responsive table { min-width: 640px; }
.tabs { max-width: 100%; overscroll-behavior-x: contain; scrollbar-width: thin; }
input, select, textarea, button, .input, .select, .btn { min-width: 0; }
img, canvas, svg { max-width: 100%; }
@media (max-width: 600px) {
  .page-head { display: flex; flex-direction: column; align-items: stretch; width: 100%; }
  .page-head > div, .page-head .actions { width: 100%; min-width: 0; }
  .page-head .actions { display: flex; flex-wrap: wrap; }
  .page-head .actions .btn { flex: 1 1 auto; white-space: normal; }
  .form-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .form-grid .field, .form-grid .field.full { grid-column: 1 / -1; width: 100%; }
  .grid-2, .grid-2.even, .grid-3 { grid-template-columns: minmax(0, 1fr) !important; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .tabs { gap: 2px; }
  .tabs button { flex: 0 0 auto; padding: 9px 11px; font-size: 12px; }
  .field input, .field select, .field textarea, .input, .select { width: 100%; max-width: 100%; }
  .list-item { flex-wrap: wrap; gap: 8px; }
  .list-item .grow { flex: 1 1 100%; min-width: 0; }
  .modal, .modal-box, .modal-content { max-width: calc(100vw - 16px); }
  .modal-body, .modal .body { max-height: calc(100dvh - 170px); overflow-y: auto; }
  .report-filters, .filters, .filter-row { display: grid !important; grid-template-columns: minmax(0, 1fr) !important; gap: 9px; }
  .report-filters > *, .filters > *, .filter-row > * { width: 100%; min-width: 0; }
  .stat .val, .card-title, td, th { overflow-wrap: anywhere; }
}
@media (max-width: 380px) {
  .stats-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .topbar-title h2 { max-width: 34vw; }
  .top-actions .theme-select, .top-actions select { max-width: 76px; }
  .view { padding-left: 7px; padding-right: 7px; }
}


/* POS product card: keep stock quantity immediately after product name.
   The shared posApp is used by both owner and staff POS screens. */
.prod-card {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
}

.prod-card > .nm {
  order: 1;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.prod-card > .stock-chip {
  order: 2;
  position: static;
  flex: 0 0 auto;
  align-self: flex-start;
  margin: 0 0 3px 4px;
  white-space: nowrap;
}

.prod-card > .cat {
  order: 3;
  flex: 0 0 100%;
  min-width: 0;
}

.prod-card > .prices {
  order: 4;
  flex: 0 0 100%;
  min-width: 0;
}
