/* Ink & Glo POS — black & gold theme */
:root {
  --bg: #0a0a0b; --panel: #131315; --panel2: #1a1a1d; --panel3: #222226;
  --line: #2b2822; --line2: #3a352b;
  --gold: #d4af37; --gold2: #f1d27a; --gold3: #9c7a22;
  --grad: linear-gradient(135deg, #f7e294 0%, #d8b14a 45%, #a07a24 100%);
  --text: #eee8d8; --muted: #8e897b; --dim: #5f5b51;
  --ok: #5cc28c; --warn: #e8b04d; --err: #ef6b6b; --info: #6fb0e8;
  --r: 12px; --shadow: 0 10px 40px rgba(0,0,0,.45);
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--gold2); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
code { background: var(--panel3); padding: 1px 6px; border-radius: 5px; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
::selection { background: var(--gold); color: #000; }
::-webkit-scrollbar { width: 10px; height: 10px; } ::-webkit-scrollbar-thumb { background: #2c2a25; border-radius: 10px; border: 2px solid var(--bg); }
.muted { color: var(--muted); } .small { font-size: 12px; } .center { text-align: center; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.gold-t { color: var(--gold2); } .ok-t { color: var(--ok); } .err-t { color: var(--err); } .warn-t { color: var(--warn); }
.mono { font-variant-numeric: tabular-nums; }

/* ---------- Auth ---------- */
.auth-body { display: grid; place-items: center; min-height: 100vh; padding: 16px;
  background: radial-gradient(ellipse at 50% 0%, rgba(212,175,55,.14), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line2); border-radius: 18px; padding: 26px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.auth-card.wide { max-width: 620px; }
.auth-logo { width: 170px; height: 170px; object-fit: cover; border-radius: 14px; margin: -4px auto 0; display: block; }
.auth-title { font-family: var(--serif); font-size: 30px; text-align: center; color: var(--gold2); }

/* ---------- Forms ---------- */
label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 500; letter-spacing: .2px; }
input, select, textarea { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line2); border-radius: 9px; padding: 9px 11px; outline: none; width: 100%; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212,175,55,.15); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--gold); }
textarea { min-height: 70px; resize: vertical; }
select option { background: var(--panel2); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--gold); margin-top: 6px; }
.span2 { grid-column: span 2; } .span3 { grid-column: span 3; }
.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 13px; }
.form-grid.g3 { grid-template-columns: repeat(3, 1fr); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: 600 13px var(--sans); border-radius: 9px; padding: 9px 15px; border: 1px solid var(--line2); background: var(--panel2); color: var(--text); cursor: pointer; transition: transform .06s, filter .15s, background .15s; white-space: nowrap; }
.btn:hover { background: var(--panel3); } .btn:active { transform: translateY(1px); }
.btn.gold { background: var(--grad); color: #1a1405; border-color: #c9a13b; box-shadow: 0 4px 18px rgba(212,175,55,.22); }
.btn.gold:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; } .btn.danger { color: var(--err); border-color: #5a2a2a; } .btn.ok { color: var(--ok); border-color: #275a3f; }
.btn.sm { padding: 6px 11px; font-size: 12px; } .btn.lg { padding: 13px 18px; font-size: 15px; } .btn.block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--panel3); color: var(--gold2); }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.side { position: fixed; inset: 0 auto 0 0; width: 236px; background: linear-gradient(180deg, #0f0f10, #0b0b0c); border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 40; transition: transform .2s; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 14px; border-bottom: 1px solid var(--line); }
.side-brand img { width: 46px; height: 46px; border-radius: 10px; }
.side-brand b { display: block; font-family: var(--serif); font-size: 22px; color: var(--gold2); line-height: 1; }
.side-brand span { font-size: 10px; letter-spacing: 2.2px; text-transform: uppercase; color: var(--muted); }
#nav { flex: 1; overflow: auto; padding: 10px 10px; }
#nav .grp { font-size: 10px; letter-spacing: 1.8px; text-transform: uppercase; color: var(--dim); padding: 12px 10px 5px; }
#nav a { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 9px; color: #bdb6a3; font-weight: 500; margin-bottom: 1px; }
#nav a:hover { background: var(--panel2); color: var(--text); }
#nav a.on { background: linear-gradient(90deg, rgba(212,175,55,.18), rgba(212,175,55,.03)); color: var(--gold2); box-shadow: inset 2px 0 0 var(--gold); }
#nav a .badge { margin-left: auto; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--grad); color: #1a1405; display: grid; place-items: center; font-weight: 700; }
.who { flex: 1; min-width: 0; } .who b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .who span { font-size: 11px; color: var(--muted); }
.main { flex: 1; margin-left: 236px; min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 22px; background: rgba(10,10,11,.86); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top h2 { font-family: var(--serif); font-size: 26px; color: var(--gold2); font-weight: 600; }
.top-r { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.top .menu { display: none; }
.view { padding: 20px 22px 40px; flex: 1; }
.scrim { display: none; }

/* ---------- Cards / grid ---------- */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0,1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g-2-1 { grid-template-columns: minmax(0,2fr) minmax(0,1fr); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; min-width: 0; }
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-h h3 { font-size: 15px; font-weight: 600; }
.card-h .r { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.kpi { position: relative; overflow: hidden; }
.kpi .l { font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); }
.kpi .v { font-size: 26px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.kpi .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi::after { content: ''; position: absolute; right: -30px; top: -30px; width: 100px; height: 100px; border-radius: 50%; background: radial-gradient(circle, rgba(212,175,55,.16), transparent 70%); }
.kpi.hl { border-color: #4a3f22; background: linear-gradient(160deg, #1d1a12, var(--panel) 60%); }
.kpi.hl .v { color: var(--gold2); }
.toolbar { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .grow { flex: 1; min-width: 200px; }
.toolbar label { min-width: 140px; }
.tabs { display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--line); padding: 4px; border-radius: 11px; margin-bottom: 16px; overflow-x: auto; }
.tabs button { background: none; border: 0; color: var(--muted); font: 600 13px var(--sans); padding: 8px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.tabs button.on { background: var(--panel3); color: var(--gold2); }

/* ---------- Tables ---------- */
.tbl-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { position: sticky; top: 0; background: #17171a; text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line2); white-space: nowrap; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: rgba(255,255,255,.02); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tfoot td { font-weight: 700; background: #17171a; border-top: 1px solid var(--line2); }
.tbl .act { text-align: right; white-space: nowrap; }
.tbl tr.click { cursor: pointer; }
.empty { padding: 40px; text-align: center; color: var(--muted); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; background: var(--panel3); color: var(--muted); white-space: nowrap; }
.badge.ok { background: rgba(92,194,140,.13); color: var(--ok); } .badge.err { background: rgba(239,107,107,.13); color: var(--err); }
.badge.warn { background: rgba(232,176,77,.14); color: var(--warn); } .badge.gold { background: rgba(212,175,55,.15); color: var(--gold2); } .badge.info { background: rgba(111,176,232,.14); color: var(--info); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: #c9c0a6; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.bar-mini { height: 6px; background: var(--panel3); border-radius: 4px; overflow: hidden; } .bar-mini i { display: block; height: 100%; background: var(--grad); }

/* ---------- POS ---------- */
.pos { display: grid; grid-template-columns: minmax(0,1fr) 400px; gap: 16px; height: calc(100vh - 100px); }
.pos-left { display: flex; flex-direction: column; min-height: 0; gap: 12px; }
.scan { position: relative; }
.scan input { padding: 14px 16px 14px 46px; font-size: 16px; border-radius: 12px; background: var(--panel); border-color: #4a3f22; }
.scan svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--gold); width: 20px; height: 20px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; flex: none; }
.chip { flex: none; border: 1px solid var(--line2); background: var(--panel); color: var(--muted); border-radius: 20px; padding: 6px 13px; font: 600 12px var(--sans); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.chip.on { background: rgba(212,175,55,.14); color: var(--gold2); border-color: var(--gold3); }
.tiles { flex: 1; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; align-content: start; padding-right: 4px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 11px; padding: 11px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; min-height: 108px; position: relative; transition: border-color .12s, transform .06s; text-align: left; color: var(--text); font: inherit; }
.tile:hover { border-color: var(--gold3); } .tile:active { transform: scale(.98); }
.tile .nm { font-weight: 600; font-size: 13px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .sk { font-size: 11px; color: var(--dim); font-family: ui-monospace, monospace; }
.tile .pr { margin-top: auto; display: flex; justify-content: space-between; align-items: end; }
.tile .pr b { color: var(--gold2); font-size: 15px; }
.tile .st { font-size: 11px; color: var(--muted); } .tile .st.low { color: var(--warn); } .tile .st.out { color: var(--err); }
.tile .stripe { position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; }
.tile.svc { background: linear-gradient(160deg, #1b1810, var(--panel) 70%); }
.tile.disabled { opacity: .45; }
.cart { background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.cart-h { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }
.cust-pick { flex: 1; display: flex; align-items: center; gap: 8px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 9px; padding: 7px 10px; cursor: pointer; min-width: 0; }
.cust-pick span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cart-items { flex: 1; overflow: auto; }
.ci { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.ci .n { font-weight: 600; font-size: 13px; } .ci .m { font-size: 11px; color: var(--muted); }
.ci .t { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.ci .ctl { grid-column: span 2; display: flex; align-items: center; gap: 6px; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line2); border-radius: 8px; overflow: hidden; }
.qty button { width: 28px; height: 28px; background: var(--panel2); border: 0; color: var(--gold2); font-size: 16px; cursor: pointer; }
.qty input { width: 52px; text-align: center; border: 0; border-radius: 0; padding: 4px; background: var(--panel); }
.ci .ctl .sm-in { width: 86px; padding: 4px 8px; font-size: 12px; }
.ci .ctl .x { margin-left: auto; }
.cart-f { border-top: 1px solid var(--line2); padding: 12px 14px; background: #111113; }
.sumline { display: flex; justify-content: space-between; padding: 3px 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.sumline.big { color: var(--text); font-size: 24px; font-weight: 700; padding-top: 8px; }
.sumline.big b { color: var(--gold2); }
.pay-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.kbd { font-size: 10px; background: var(--panel3); border: 1px solid var(--line2); border-radius: 4px; padding: 0 5px; color: var(--muted); }
.methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.methods button { background: var(--panel2); border: 1px solid var(--line2); color: var(--text); border-radius: 10px; padding: 12px 6px; font: 600 13px var(--sans); cursor: pointer; }
.methods button.on { border-color: var(--gold); background: rgba(212,175,55,.12); color: var(--gold2); }
.cash-quick { display: flex; gap: 6px; flex-wrap: wrap; }
.cash-quick button { flex: 1; min-width: 70px; }
.pay-total { text-align: center; padding: 14px; border-radius: 12px; background: linear-gradient(160deg, #1d1a12, #131315); border: 1px solid #4a3f22; }
.pay-total .v { font-size: 34px; font-weight: 700; color: var(--gold2); font-variant-numeric: tabular-nums; }
.change-box { text-align: center; font-size: 18px; padding: 10px; border-radius: 10px; background: var(--panel2); }
.success { text-align: center; padding: 10px 0; }
.success .ring { width: 74px; height: 74px; border-radius: 50%; background: var(--grad); display: grid; place-items: center; margin: 0 auto 12px; color: #1a1405; }
.success .ring svg { width: 36px; height: 36px; stroke-width: 2.6; }

/* ---------- Modal / toast ---------- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.66); backdrop-filter: blur(3px); z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-card { width: 100%; max-width: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line2); border-radius: 16px; box-shadow: var(--shadow); animation: pop .16s ease-out; }
.modal-card.wide { max-width: 860px; } .modal-card.narrow { max-width: 420px; }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
.modal-head { display: flex; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-family: var(--serif); font-size: 23px; color: var(--gold2); flex: 1; }
.modal-body { padding: 18px; overflow: auto; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--panel2); border: 1px solid var(--line2); border-left: 3px solid var(--gold); padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow); min-width: 240px; max-width: 360px; animation: pop .2s; }
.toast.err { border-left-color: var(--err); } .toast.ok { border-left-color: var(--ok); }
.alert { padding: 10px 13px; border-radius: 9px; font-size: 13px; }
.alert.err { background: rgba(239,107,107,.1); color: #ffb0b0; border: 1px solid #5a2a2a; }
.alert.ok { background: rgba(92,194,140,.1); color: #a8ecc6; border: 1px solid #275a3f; }
.alert.info { background: rgba(212,175,55,.08); color: var(--gold2); border: 1px solid #4a3f22; }
.barcode-prev { background: #fff; border-radius: 8px; padding: 8px; display: inline-block; }
.barcode-prev svg { width: auto; height: auto; stroke: none; }
.chart-box { position: relative; height: 260px; }
.status-steps { display: flex; gap: 4px; }
.pill-sel { display: inline-flex; gap: 4px; flex-wrap: wrap; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) { .pos { grid-template-columns: minmax(0,1fr) 340px; } .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 900px) {
  .side { transform: translateX(-100%); } .nav-open .side { transform: none; }
  .nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 35; }
  .main { margin-left: 0; } .top .menu { display: inline-grid; } .top { padding: 0 14px; } .view { padding: 14px 16px 30px; }
  #clock { display: none; }
  .pos { grid-template-columns: 1fr; height: auto; } .tiles { max-height: 46vh; } .cart { min-height: 420px; }
  .g2, .g3, .g-2-1 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) { .g4 { grid-template-columns: 1fr 1fr; } .form-grid, .form-grid.g3 { grid-template-columns: 1fr; } .span2, .span3 { grid-column: auto; } .kpi .v { font-size: 21px; } .top h2 { font-size: 21px; } }
@media print { .side, .top, .toolbar, .scrim, #toasts, .btn { display: none !important; } .main { margin: 0; } body { background: #fff; color: #000; } .card { break-inside: avoid; } }
[hidden] { display: none !important; }
.qty { flex: none; }
.ci .ctl { flex-wrap: wrap; }
#recallBtn { position: relative; }
@media (max-width: 900px) { .pos { grid-template-columns: minmax(0,1fr); } .tiles { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); } }

/* ---------- v1.1 fast POS ---------- */
.scan-row { display: flex; gap: 8px; align-items: stretch; }
.scan-row .scan { flex: 1; min-width: 0; }
.scan input { padding-left: 46px; }
.cam-btn { flex: none; border-color: #4a3f22; color: var(--gold2); }
.cam-btn svg { width: 20px; height: 20px; }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 25; background: var(--panel2); border: 1px solid var(--gold3); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.sg { display: flex; justify-content: space-between; gap: 12px; padding: 9px 14px; cursor: pointer; border-bottom: 1px solid var(--line); }
.sg:last-child { border: 0; }
.sg.on, .sg:hover { background: rgba(212,175,55,.12); }
.sg-n { min-width: 0; font-weight: 600; } .sg-n small, .sg-p small { display: block; font-weight: 400; font-size: 11px; color: var(--muted); }
.sg-p { text-align: right; color: var(--gold2); font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cust-pick { cursor: default; padding: 0 0 0 10px; }
.cust-pick input { border: 0; background: transparent; padding: 8px 8px 8px 0; box-shadow: none !important; }
.dot-badge { position: absolute; top: -2px; right: -4px; padding: 0 5px; }
.last-bill { display: flex; align-items: center; gap: 6px; padding: 8px 14px; font-size: 12px; background: rgba(92,194,140,.08); border-bottom: 1px solid var(--line); color: var(--muted); flex-wrap: wrap; }
.last-bill > span { flex: 1; min-width: 160px; }
.date-line { align-items: center; }
.date-line input { width: auto; padding: 4px 8px; font-size: 12px; }
.date-line input.past { border-color: var(--warn); color: var(--warn); }
.pay-btns.three { grid-template-columns: .8fr 1.1fr 1.1fr; }
.pay-btns .btn.lg { padding: 13px 8px; }
.btn.ok.lg { background: rgba(92,194,140,.12); }
.kbd.dark { background: rgba(0,0,0,.15); color: #1a1405; border-color: rgba(0,0,0,.2); }
.methods.four { grid-template-columns: repeat(2, 1fr); }
.qty-pad { display: flex; flex-direction: column; gap: 12px; }
.qty-pad #qpN { font-size: 34px; text-align: center; font-weight: 700; padding: 12px; color: var(--gold2); }
.qp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.qp-grid .btn { padding: 13px 4px; font-size: 16px; }
.qp-total { text-align: center; color: var(--muted); } .qp-total b { color: var(--text); font-size: 18px; }
.cam-box { width: 100%; min-height: 220px; background: #000; border-radius: 12px; overflow: hidden; }
.cam-box video { width: 100% !important; border-radius: 12px; }
.cam-log { max-height: 140px; overflow: auto; margin-top: 8px; }
.cam-inline { border: 1px solid var(--gold3); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
@media (max-width: 900px) {
  body[data-view=pos] .view { padding-bottom: 210px; }
  body[data-view=pos] .cart-f { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; border-top: 1px solid var(--gold3); box-shadow: 0 -10px 30px rgba(0,0,0,.6); padding: 8px 14px calc(10px + env(safe-area-inset-bottom)); }
  body[data-view=pos] .cart-f .sub-line { display: none; }
  body[data-view=pos] .sumline.big { font-size: 20px; padding-top: 2px; }
  .cart { min-height: 0; }
  .cam-btn span { display: none; }
  .tiles { max-height: 44vh; }
  .demo-ribbon { display: none; }
}
.cam-box { max-width: 460px; margin: 0 auto; max-height: 52vh; }
.cam-inline .cam-box { max-width: 380px; min-height: 180px; }
#qpN::-webkit-inner-spin-button, #qpN::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
#qpN { -moz-appearance: textfield; }
.sumline.big small { font-size: 12px; color: var(--muted); font-weight: 500; }
@media (max-width: 900px) { #toasts { bottom: auto; top: 68px; left: 16px; right: 16px; } .toast { max-width: none; } }

/* ---------- v1.2 responsive: phones & tablets ---------- */
.td-cv, .cv { min-width: 0; }
.bottom-nav { display: none; }
@media (max-width: 900px) {
  /* bottom tab bar */
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; height: calc(60px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: rgba(12,12,13,.96); backdrop-filter: blur(10px); border-top: 1px solid var(--line2); }
  .bottom-nav a, .bottom-nav button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font: 600 10.5px var(--sans); background: none; border: 0; cursor: pointer; }
  .bottom-nav svg { width: 21px; height: 21px; }
  .bottom-nav a.on { color: var(--gold2); }
  .bottom-nav a.on svg { filter: drop-shadow(0 0 6px rgba(212,175,55,.5)); }
  .view { padding-bottom: 90px; }
  .side { z-index: 50; } .nav-open .scrim { z-index: 48; }
  #toasts { z-index: 60; }

  /* POS: totals bar sits above the tab bar */
  body[data-view=pos] .cart-f { bottom: calc(60px + env(safe-area-inset-bottom)); padding-bottom: 10px; }
  body[data-view=pos] .view { padding-bottom: 250px; }
  body[data-view=pos] .top-r .btn.gold { display: none; }

  /* header */
  .top { height: 54px; gap: 8px; }
  .top h2 { font-size: 21px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
  .top-r { margin-left: 0; }

  /* touch-friendly controls; 16px inputs stop iOS from zooming */
  input, select, textarea { font-size: 16px; }
  .icon-btn { width: 40px; height: 40px; }
  .btn { padding: 10px 14px; }
  .btn.sm { padding: 8px 12px; }
  .toolbar { gap: 8px; }
  .toolbar label { min-width: 0; flex: 1 1 140px; }
  .toolbar > .btn, .toolbar > a.btn { flex: 1 1 auto; }
  .toolbar .grow { min-width: 100%; }
  .scan-row .scan { min-width: 0; }
  .pill-sel { width: 100%; } .pill-sel .btn { flex: 1 1 auto; }
  .card { padding: 14px; }
  .card-h .r { margin-left: 0; width: 100%; }

  /* modals become bottom sheets */
  .modal { padding: 0; align-items: end; }
  .modal-card, .modal-card.wide, .modal-card.narrow { max-width: none; width: 100%; max-height: 94vh; border-radius: 18px 18px 0 0; border-bottom: 0; animation: sheet .2s ease-out; }
  .modal-body { padding: 16px 16px calc(18px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1 1 auto; }
  .form-grid.g3 { grid-template-columns: 1fr 1fr; } .form-grid.g3 .span3 { grid-column: span 2; }
}
@keyframes sheet { from { transform: translateY(40px); opacity: .4; } }

@media (max-width: 700px) {
  /* KPI cards */
  .grid.g4 { gap: 10px; }
  .kpi { padding: 12px; }
  .kpi .l { font-size: 10px; letter-spacing: 1px; }
  .kpi .v { font-size: min(19px, 4.8vw); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .kpi .s { font-size: 11px; }
  .chart-box { height: 220px; }

  /* tables → stacked cards */
  .tbl-wrap { border: 0; overflow: visible; max-height: none !important; }
  table.tbl, .tbl tbody, .tbl tfoot, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl thead { display: none; }
  .tbl tbody tr { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
  .card .tbl tbody tr { background: var(--panel2); }
  .tbl tbody tr:hover td { background: none; }
  .tbl td { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; padding: 4px 0; border: 0; text-align: right; }
  .tbl td::before { content: attr(data-label); flex: none; color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px; text-align: left; padding-top: 2px; }
  .tbl td[data-label=""]::before { display: none; }
  .tbl td > .cv { min-width: 0; text-align: right; overflow-wrap: anywhere; }
  .tbl td input:not([type=checkbox]), .tbl td select { max-width: 60%; }
  .tbl td .cv input, .tbl td .cv select { max-width: 100%; }
  /* first cell = card title */
  .tbl tbody td:first-child { justify-content: flex-start; text-align: left; font-size: 14.5px; padding-bottom: 6px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
  .tbl tbody td:first-child::before { display: none; }
  .tbl tbody td:first-child > .cv { text-align: left; }
  .tbl td[colspan] { display: block; border: 0 !important; margin: 0 !important; }
  .tbl tbody tr:has(td[colspan]) { background: none; border: 0; padding: 0; }
  /* checkbox-first tables (inventory): checkbox + title on one line */
  .tbl tbody td:first-child:has(input[type=checkbox]) { border: 0; margin: 0; padding: 0; float: left; width: auto; margin-right: 10px; }
  .tbl .act { justify-content: flex-end; flex-wrap: wrap; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 8px; }
  .tbl .act::before { display: none; }
  .tbl .act > .cv { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
  .tbl .num { text-align: right; }
  .tbl tfoot tr { background: #17171a; border: 1px solid var(--line2); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; }
  .tbl tfoot td { background: none !important; border: 0; }
  .tbl tfoot td:empty, .tbl tfoot td[data-label=""]:has(.cv:empty) { display: none; }
  .tbl tr.click { cursor: pointer; }
  .list-row { gap: 8px; }
}
@media (max-width: 700px) {
  .tbl tfoot tr { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; }
  .tbl tfoot td { width: auto; display: block; padding: 2px 0; }
  .tbl tfoot td:last-child { margin-left: auto; text-align: right; }
}
@media (max-width: 560px) {
  .form-grid.g3 { grid-template-columns: 1fr; } .form-grid.g3 .span3, .form-grid .span2 { grid-column: auto; }
}
@media (max-width: 900px) { body[data-view=pos] .sumline.big { cursor: pointer; } }
/* WhatsApp */
.btn.wa { color: #4fd18b; border-color: #1f5a3c; }
.btn.wa:hover { background: rgba(37,211,102,.1); }
.cust-pick.phone { flex: .8; }
.cust-pick svg { flex: none; color: var(--muted); }
.wa-row { display: flex; gap: 10px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.wa-row .check { flex: 1 1 auto; } .wa-row .check svg { color: #4fd18b; }
.wa-row input:not([type=checkbox]) { flex: 1 1 150px; width: auto; }
@media (max-width: 900px) { .cart-h { flex-wrap: wrap; } .cust-pick { flex: 1 1 45%; } }
