/* Shop POS v2 — styles */
:root {
  color-scheme: light dark;
  --bg: #f3f5f8; --surface: #fff; --surface-2: #f8fafc; --hover: #eef2f6;
  --text: #0f172a; --text-2: #334155; --muted: #64748b;
  --border: #e2e8f0; --border-2: #cbd5e1;
  --primary: #0f766e; --primary-2: #115e59; --primary-soft: #ccfbf1;
  --accent: #1d4ed8; --accent-soft: #dbeafe;
  --good: #15803d; --good-soft: #dcfce7; --bad: #dc2626; --bad-soft: #fee2e2; --warn: #b45309; --warn-soft: #fef3c7;
  --r: 12px; --r-sm: 8px;
  --sh-1: 0 1px 2px rgba(15,23,42,.06); --sh-2: 0 8px 24px rgba(15,23,42,.08); --sh-3: 0 24px 60px rgba(15,23,42,.22);
  --side: 220px; --top: 56px;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-size: 14px; line-height: 1.45; }
body.has-modal { overflow: hidden; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; } h4 { font-size: .95rem; }
p { margin: 0 0 .6em; }
small, .small { font-size: .8rem; }
.muted { color: var(--muted); } .center { text-align: center; } .right { text-align: right; }
.good { color: var(--good); } .bad { color: var(--bad); } .warn-t { color: var(--warn); }
.grow { flex: 1; min-width: 0; } .nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.ico { flex-shrink: 0; vertical-align: middle; }
a { color: var(--accent); }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: .85em; }

/* ---------- buttons & inputs ---------- */
button { font: inherit; color: inherit; cursor: pointer; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: var(--r-sm);
  border: 1px solid var(--border-2); background: var(--surface); font-weight: 600; font-size: .88rem; min-height: 38px;
  transition: background .12s, border-color .12s, transform .05s; white-space: nowrap; text-decoration: none; color: var(--text); }
.btn:hover { background: var(--hover); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-2); }
.btn.danger { color: var(--bad); border-color: #fecaca; background: var(--bad-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { padding: 4px 10px; min-height: 30px; font-size: .8rem; }
.btn.lg { padding: 12px 18px; min-height: 48px; font-size: 1rem; }
.btn.block { width: 100%; }
.icon-btn { border: 0; background: transparent; width: 34px; height: 34px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: 1rem; }
.icon-btn:hover { background: var(--hover); }
.link { background: none; border: 0; color: var(--accent); font-weight: 600; padding: 6px; display: inline-flex; align-items: center; gap: 5px; }
.link.center { margin: 8px auto 0; display: flex; }

input, select, textarea { font: inherit; color: var(--text); width: 100%; padding: 9px 11px; border: 1px solid var(--border-2);
  border-radius: var(--r-sm); background: var(--surface); min-height: 40px; }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15,118,110,.15); }
input[type=checkbox] { width: 18px; height: 18px; min-height: 0; accent-color: var(--primary); }
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: .76rem; font-weight: 700; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .03em; }
.check { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-weight: 500; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 12px; }
.stack > * + * { margin-top: 2px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.notice { padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--border); margin: 8px 0; }
.notice.error { background: var(--bad-soft); border-color: #fecaca; color: #991b1b; }
.notice.success { background: var(--good-soft); border-color: #bbf7d0; color: #166534; }
.notice.warn { background: var(--warn-soft); border-color: #fde68a; color: #92400e; }

.chip { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700;
  border: 1px solid var(--border); background: var(--surface); }
.chip b { background: var(--warn); color: #fff; border-radius: 999px; padding: 0 6px; font-size: .72rem; }
.chip.ok { color: var(--good); background: var(--good-soft); border-color: #bbf7d0; }
.chip.warn { color: var(--warn); background: var(--warn-soft); border-color: #fde68a; }
.chip.pending { color: var(--accent); background: var(--accent-soft); border-color: #bfdbfe; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .72rem; font-weight: 700; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.pill.good { background: var(--good-soft); color: var(--good); border-color: #bbf7d0; }
.pill.bad { background: var(--bad-soft); color: var(--bad); border-color: #fecaca; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: #fde68a; }
.pill.blue { background: var(--accent-soft); color: var(--accent); border-color: #bfdbfe; }

.seg { display: flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 3px; margin: 14px 0; }
.seg button { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 7px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--sh-1); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; }
.tabs a, .tabs button { padding: 10px 14px; border: 0; background: none; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; text-decoration: none; white-space: nowrap; }
.tabs .on { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- splash & gates ---------- */
.splash, .loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 60vh; color: var(--muted); }
.splash { min-height: 100vh; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.gate { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: radial-gradient(1200px 600px at 10% -10%, #ccfbf1 0, transparent 60%), radial-gradient(900px 500px at 110% 110%, #dbeafe 0, transparent 55%), var(--bg); }
.gate-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 26px; box-shadow: var(--sh-2); }
.gate-card.wide { width: min(560px, 100%); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--primary); }
.brand span { color: var(--text); }
.brand.big { justify-content: center; font-size: 1.4rem; margin-bottom: 6px; }
.shop-list { margin: 16px 0; display: grid; gap: 8px; }
.shop-row { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); text-align: left; }
.shop-row:hover { border-color: var(--primary); background: var(--surface-2); }
.shop-row small { display: block; color: var(--muted); }
.shop-ico { width: 40px; height: 40px; border-radius: 10px; background: var(--primary-soft); color: var(--primary-2); display: grid; place-items: center; font-weight: 800; }
.chev { color: var(--muted); font-size: 1.4rem; }
.create-shop { border: 1px dashed var(--border-2); border-radius: 12px; padding: 10px 14px; }
.create-shop summary { cursor: pointer; font-weight: 700; color: var(--primary); padding: 4px 0; }
.create-shop form { margin-top: 10px; }
.empty { color: var(--muted); text-align: center; padding: 14px; }

/* lock / PIN */
.lock-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.staff-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin: 16px 0; }
.staff-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 8px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.staff-tile:hover { border-color: var(--primary); background: var(--surface-2); }
.staff-tile small { color: var(--muted); }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), #14b8a6); color: #fff; display: inline-grid; place-items: center; font-weight: 800; flex-shrink: 0; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.2rem; }
.avatar.sm { width: 28px; height: 28px; font-size: .72rem; }
.pin-who { display: flex; align-items: center; gap: 12px; justify-content: center; margin: 6px 0 14px; }
.pin-who small { display: block; color: var(--muted); }
.pin-dots { display: flex; justify-content: center; gap: 12px; margin: 10px 0; }
.pin-dots span { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border-2); }
.pin-dots span.opt { border-style: dashed; }
.pin-dots span.on { background: var(--primary); border-color: var(--primary); border-style: solid; }
.pin-msg { text-align: center; min-height: 22px; color: var(--muted); font-weight: 600; }
.pin-msg.error { color: var(--bad); }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 300px; margin: 8px auto 0; }
.pinpad button { height: 60px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); font-size: 1.4rem; font-weight: 700; }
.pinpad button:hover { background: var(--hover); }
.pinpad button.primary { background: var(--primary); color: #fff; border-color: var(--primary); font-size: 1rem; }
.pinpad button.ghost { font-size: .9rem; color: var(--muted); }
.lock-foot { display: flex; justify-content: center; gap: 16px; margin-top: 18px; flex-wrap: wrap; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.side { width: var(--side); background: #0b1324; color: #cbd5e1; display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 20; }
.side .brand { padding: 16px; color: #5eead4; border-bottom: 1px solid #1e293b; }
.side .brand span { color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side nav { padding: 10px; display: grid; gap: 2px; }
.side nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px; color: #cbd5e1; text-decoration: none; font-weight: 600; }
.side nav a:hover { background: #1e293b; color: #fff; }
.side nav a.on { background: var(--primary); color: #fff; }
.side-foot { margin-top: auto; padding: 14px 16px; color: #64748b; }
.main { flex: 1; margin-left: var(--side); min-width: 0; display: flex; flex-direction: column; }
.top { height: var(--top); background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 16px; position: sticky; top: 0; z-index: 15; gap: 8px; }
.top h1 { font-size: 1.1rem; }
.top-right { display: flex; align-items: center; gap: 8px; }
.user-chip { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 3px 10px 3px 3px; font-weight: 600; }
.user-chip:hover { background: var(--hover); }
#view { padding: 16px; flex: 1; min-height: 0; outline: none; }
.bottom { display: none; }
.menu-list { display: grid; gap: 4px; }
.menu-list button { display: flex; align-items: center; gap: 10px; padding: 12px; border: 0; background: var(--surface-2); border-radius: 10px; text-align: left; font-weight: 600; }
.menu-list button:hover { background: var(--hover); }
.menu-list button.danger { color: var(--bad); }
.more-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.more-item { display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: 12px; background: var(--surface-2); color: var(--text); text-decoration: none; font-weight: 700; }

/* ---------- cards, tables ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--sh-1); }
.card-pad { padding: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); gap: 8px; flex-wrap: wrap; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .search { flex: 1; min-width: 180px; max-width: 420px; position: relative; }
.toolbar input[type=date] { flex: 1 1 140px; }
.toolbar .search input { padding-left: 34px; }
.toolbar .search .ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .86rem; }
.tbl th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: var(--surface-2); }
.tbl td.num, .tbl th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl tfoot td { font-weight: 700; background: var(--surface-2); }
.tbl input { min-height: 34px; padding: 5px 8px; }
.empty-state { text-align: center; padding: 40px 16px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 14px; box-shadow: var(--sh-1); }
.kpi .l { font-size: .74rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.kpi .v { font-size: 1.45rem; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.bar-chart { display: flex; align-items: flex-end; gap: 3px; height: 160px; padding: 10px 4px 0; }
.bar-chart .b { flex: 1; background: linear-gradient(180deg, #14b8a6, var(--primary)); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.bar-chart .b:hover { opacity: .8; }
.bar-labels { display: flex; gap: 3px; padding: 4px; font-size: .66rem; color: var(--muted); }
.bar-labels span { flex: 1; text-align: center; overflow: hidden; white-space: nowrap; }
.hbar { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; margin-bottom: 8px; }
.hbar .track { grid-column: 1 / -1; height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.hbar .fill { height: 100%; background: var(--primary); border-radius: 99px; }

/* ---------- modal ---------- */
.modal-wrap { position: fixed; inset: 0; background: rgba(15,23,42,.5); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 14px; animation: fade .12s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: 16px; width: min(480px, 100%); max-height: calc(100vh - 28px); display: flex; flex-direction: column; box-shadow: var(--sh-3); animation: pop .15s; }
.modal.wide { width: min(820px, 100%); }
.modal.xwide { width: min(1080px, 100%); }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 16px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }

#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: 92vw; }
.toast { background: #0f172a; color: #fff; padding: 10px 16px; border-radius: 12px; font-weight: 600; box-shadow: var(--sh-2); transition: opacity .3s, transform .3s; font-size: .88rem; }
.toast.success { background: var(--good); } .toast.error { background: var(--bad); } .toast.warn { background: var(--warn); }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---------- SELL screen ---------- */
.view-sell { padding: 0 !important; }
.sell { display: grid; grid-template-columns: minmax(0, 1fr) 400px; height: calc(100vh - var(--top)); }
.sell-left { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.scanbar { display: flex; gap: 8px; padding: 12px; background: var(--surface); border-bottom: 1px solid var(--border); }
.scanbar .search { flex: 1; position: relative; }
.scanbar .search input { padding-left: 38px; font-size: 1rem; min-height: 46px; border: 2px solid var(--primary); }
.scanbar .search .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--primary); }
.cat-strip { display: flex; gap: 6px; padding: 8px 12px; overflow-x: auto; background: var(--surface); border-bottom: 1px solid var(--border); scrollbar-width: thin; }
.cat-strip button { white-space: nowrap; border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-weight: 600; font-size: .82rem; }
.cat-strip button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.prod-grid { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); grid-auto-rows: max-content; gap: 10px; align-content: start; }
.prod-card { border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 0; text-align: left; display: flex; flex-direction: column; overflow: hidden; min-height: min-content; flex-shrink: 0; transition: border-color .1s, box-shadow .1s, transform .05s; }
.prod-card:hover { border-color: var(--primary); box-shadow: var(--sh-2); }
.prod-card:active { transform: scale(.98); }
.prod-card .img { aspect-ratio: 4/3; background: var(--surface-2) center/cover no-repeat; display: grid; place-items: center; color: var(--border-2); font-weight: 800; font-size: 1.6rem; }
.prod-card .info { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.prod-card .nm { font-weight: 650; font-size: .86rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.prod-card .ft { display: flex; justify-content: space-between; align-items: center; margin-top: auto; gap: 4px; }
.prod-card .pr { font-weight: 800; color: var(--primary); }
.stk { font-size: .7rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); }
.stk.low { background: var(--warn-soft); color: var(--warn); } .stk.out { background: var(--bad-soft); color: var(--bad); }
.grid-compact .prod-card .img { display: none; }
.cart { background: var(--surface); border-left: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.cart-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--border); gap: 6px; }
.cart-lines { flex: 1; overflow-y: auto; }
.cart-line { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.cart-line.sel { background: var(--primary-soft); }
.cart-line .nm { font-weight: 650; }
.cart-line .sub { font-size: .76rem; color: var(--muted); }
.cart-line .sub button { border: 0; background: none; color: var(--accent); font-weight: 600; padding: 0; font-size: .76rem; text-decoration: underline dotted; }
.cart-line .lt { font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.qty { display: flex; align-items: center; gap: 4px; }
.qty button { width: 32px; height: 32px; border: 1px solid var(--border); background: var(--surface-2); border-radius: 8px; display: grid; place-items: center; }
.qty input { width: 56px; text-align: center; min-height: 32px; padding: 4px; font-weight: 700; }
.cart-empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.totals { padding: 12px; border-top: 1px solid var(--border); background: var(--surface-2); }
.totals .ln { display: flex; justify-content: space-between; padding: 2px 0; font-variant-numeric: tabular-nums; }
.totals .grand { font-size: 1.6rem; font-weight: 800; padding-top: 6px; }
.cart-actions { display: grid; grid-template-columns: auto auto auto 1fr; gap: 8px; padding: 0 12px 12px; background: var(--surface-2); }
.pay-btn { font-size: 1.1rem; min-height: 54px; }
.cart-toggle { display: none; }
/* payment modal */
.pay-total { text-align: center; padding: 8px 0 14px; }
.pay-total .v { font-size: 2.2rem; font-weight: 800; }
.methods { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.methods button { padding: 12px 6px; border: 2px solid var(--border); border-radius: 12px; background: var(--surface); font-weight: 700; }
.methods button.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-2); }
.quick-cash { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 12px; }
.quick-cash button { flex: 1 1 28%; min-width: 0; padding: 10px 4px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); font-weight: 700; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pay-lines { margin-bottom: 10px; }
.pay-lines .pl { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; background: var(--surface-2); border-radius: 8px; margin-bottom: 4px; }
.change-box { text-align: center; padding: 12px; border-radius: 12px; background: var(--good-soft); color: var(--good); font-weight: 800; font-size: 1.3rem; }
.change-box.due { background: var(--warn-soft); color: var(--warn); }

/* receipt preview */
.receipt { font-family: "Courier New", ui-monospace, monospace; font-size: 12px; background: #fff; color: #000; padding: 10px; width: 300px; margin: 0 auto; border: 1px dashed var(--border-2); }
.receipt.w58 { width: 220px; font-size: 11px; }
.receipt .c { text-align: center; } .receipt .b { font-weight: 700; }
.receipt .l { display: flex; justify-content: space-between; gap: 6px; }
.receipt hr { border: 0; border-top: 1px dashed #000; margin: 6px 0; }
.receipt .big { font-size: 15px; font-weight: 700; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .sell { grid-template-columns: minmax(0, 1fr) 340px; } }
@media (max-width: 860px) {
  :root { --top: 52px; }
  .side { display: none; }
  .main { margin-left: 0; padding-bottom: 64px; }
  .bottom { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: 62px; background: var(--surface); border-top: 1px solid var(--border); z-index: 30; padding-bottom: env(safe-area-inset-bottom); }
  .bottom a, .bottom button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); text-decoration: none; font-size: .7rem; font-weight: 700; border: 0; background: none; }
  .bottom a.on { color: var(--primary); }
  .hide-sm { display: none; }
  #view { padding: 12px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .sell { grid-template-columns: 1fr; height: calc(100vh - var(--top) - 62px); position: relative; }
  .cart { position: fixed; left: 0; right: 0; bottom: 62px; top: var(--top); z-index: 25; transform: translateY(100%); transition: transform .2s; border-left: 0; }
  .cart.open { transform: none; }
  .cart-toggle { display: flex; position: fixed; left: 12px; right: 12px; bottom: 74px; z-index: 24; justify-content: space-between; align-items: center; padding: 14px 18px;
    background: var(--primary); color: #fff; border: 0; border-radius: 14px; font-weight: 800; font-size: 1rem; box-shadow: var(--sh-2); }
  .cart-toggle.empty { display: none; }
  .prod-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); padding-bottom: 90px; }
  .methods { grid-template-columns: repeat(2, 1fr); }
  .modal { max-height: calc(100vh - 16px); }
  .modal-wrap { padding: 8px; align-items: flex-end; }
  #toasts { top: 60px; bottom: auto; }
}
#print-area { display: none; }
@media print {
  body.printing-slip * { visibility: hidden; }
  body.printing-slip #print-area { display: block; }
  body.printing-slip #print-area, body.printing-slip #print-area * { visibility: visible; }
  body.printing-slip #print-area { position: absolute; left: 0; top: 0; }
  body:not(.printing-slip) .side, body:not(.printing-slip) .top, body:not(.printing-slip) .bottom, body:not(.printing-slip) .toolbar, body:not(.printing-slip) .tabs { display: none !important; }
  body:not(.printing-slip) .main { margin: 0; }
  .card, .kpi { break-inside: avoid; box-shadow: none; }
}

/* ---------- update banner ---------- */
#update-banner { position: fixed; left: 50%; transform: translateX(-50%); top: 10px; z-index: 300; display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--sh-2); padding: 8px 10px 8px 14px; border-radius: 12px; font-weight: 600; }

/* ---------- touch screens: bigger tap targets (Android guideline: 48dp) ---------- */
@media (pointer: coarse) {
  .btn, .btn.sm { min-height: 44px; }
  .btn.lg, .pay-btn { min-height: 52px; }
  .icon-btn { width: 44px; height: 44px; }
  .qty button { width: 44px; height: 44px; }
  .qty input { min-height: 44px; }
  input, select { min-height: 46px; }
  .cat-strip button { min-height: 40px; }
  .link { min-height: 44px; }
  .menu-list button, .more-item { min-height: 48px; }
  .tbl input { min-height: 44px; }
}

/* ---------- dark theme (follows the phone / computer setting) ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220; --surface: #121a2b; --surface-2: #0f1726; --hover: #1a2436;
    --text: #e5e9f0; --text-2: #c7cfdb; --muted: #94a3b8;
    --border: #243045; --border-2: #33415a;
    --primary: #14b8a6; --primary-2: #0d9488; --primary-soft: #0f3b38;
    --accent: #60a5fa; --accent-soft: #172b4a;
    --good: #4ade80; --good-soft: #0f2e1d; --bad: #f87171; --bad-soft: #3a1618; --warn: #fbbf24; --warn-soft: #3a2a0c;
    --sh-1: 0 1px 2px rgba(0,0,0,.4); --sh-2: 0 8px 24px rgba(0,0,0,.45); --sh-3: 0 24px 60px rgba(0,0,0,.6);
  }
  .btn.primary, .pinpad button.primary, .cart-toggle, .side nav a.on, .cat-strip button.on { color: #04221f; }
  .btn.danger { border-color: #5b2226; }
  .chip.ok, .pill.good { border-color: #1f4d33; } .chip.warn, .pill.warn { border-color: #5a4313; }
  .chip.pending, .pill.blue { border-color: #24406b; } .pill.bad, .notice.error { border-color: #5b2226; }
  .notice.error { color: #fecaca; } .notice.success { color: #bbf7d0; border-color: #1f4d33; } .notice.warn { color: #fde68a; border-color: #5a4313; }
  .gate { background: radial-gradient(1200px 600px at 10% -10%, #0f3b38 0, transparent 60%), radial-gradient(900px 500px at 110% 110%, #172b4a 0, transparent 55%), var(--bg); }
  .side { background: #070c16; }
  .toast { background: #1e293b; }
  .modal-wrap { background: rgba(0,0,0,.65); }
  .prod-card .img { color: var(--border-2); }
  .receipt { border-color: var(--border-2); }   /* receipts stay black on white, like paper */
  input[type=date]::-webkit-calendar-picker-indicator { filter: invert(1); }
}
