:root {
  --ink:#EDEAE0; --bg:#17181A; --surface:#212226; --surface2:#2A2B30; --line:#3A3B40;
  --yellow:#F2C438; --green:#4CAF7D; --red:#E8654F; --muted:#8B8D93;
}
* { box-sizing: border-box; }
html, body { margin:0; padding:0; background:var(--bg); }
body { font-family:'IBM Plex Sans',system-ui,sans-serif; color:var(--ink); }
.mono { font-family:'IBM Plex Mono', monospace; }
.display { font-family:'Archivo Expanded', sans-serif; letter-spacing:0.01em; }

#app-root { min-height:100vh; max-width:480px; margin:0 auto; position:relative; padding-bottom:84px; }
.boot { padding:60px 20px; text-align:center; color:var(--muted); }

/* ---- Login ---- */
.login-wrap { min-height:100vh; display:flex; flex-direction:column; justify-content:center; padding:28px; }
.login-tag { align-self:flex-start; background:var(--yellow); color:#17181A; font-weight:800; font-size:12px; padding:4px 9px; border-radius:3px; letter-spacing:0.08em; margin-bottom:10px; }
.login-title { font-family:'Archivo Expanded',sans-serif; font-size:28px; font-weight:800; margin:0 0 4px; }
.login-sub { color:var(--muted); font-size:13px; margin:0 0 28px; }
.login-field { margin-bottom:14px; }
.login-field label { display:block; font-size:11px; color:var(--muted); text-transform:uppercase; letter-spacing:0.06em; margin-bottom:6px; }
.login-field input { width:100%; background:var(--surface); border:1px solid var(--line); border-radius:10px; padding:13px 14px; color:var(--ink); font-size:14px; outline:none; }
.login-field input:focus { border-color:var(--yellow); }
.login-btn { width:100%; padding:14px; border:none; border-radius:10px; background:var(--yellow); color:#17181A; font-weight:700; font-size:14px; cursor:pointer; margin-top:6px; letter-spacing:0.02em; }
.login-btn[disabled] { opacity:0.5; cursor:default; }
.login-error { color:var(--red); font-size:12.5px; margin-top:10px; }

/* ---- Topbar ---- */
.topbar { position:sticky; top:0; z-index:20; background:var(--bg); border-bottom:2px dashed var(--line); padding:14px 16px 12px; }
.brandrow { display:flex; align-items:center; justify-content:space-between; }
.brand { display:flex; align-items:center; gap:8px; }
.brand-tag { background:var(--yellow); color:#17181A; font-weight:800; font-size:11px; padding:3px 7px; border-radius:3px; letter-spacing:0.08em; }
.brand-name { font-weight:700; font-size:17px; }
.role-pill { font-family:'IBM Plex Mono',monospace; font-size:11px; background:var(--surface2); border:1px solid var(--line); color:var(--muted); padding:4px 9px; border-radius:20px; cursor:pointer; }
.branch-row { margin-top:10px; display:flex; gap:6px; overflow-x:auto; padding-bottom:2px; }
.branch-chip { font-family:'IBM Plex Mono',monospace; font-size:12px; white-space:nowrap; padding:6px 12px; border-radius:20px; border:1px solid var(--line); color:var(--muted); background:transparent; cursor:pointer; }
.branch-chip.active { background:var(--yellow); color:#17181A; border-color:var(--yellow); font-weight:600; }

.screen { padding:16px; }
.screen[hidden] { display:none; }

/* ---- Stock screen ---- */
.stat-row { display:flex; gap:8px; margin-bottom:16px; }
.stat-card { flex:1; background:var(--surface); border:1px solid var(--line); border-radius:10px; padding:10px 12px; }
.stat-num { font-family:'Archivo Expanded',sans-serif; font-size:22px; font-weight:800; }
.stat-label { font-size:10px; color:var(--muted); text-transform:uppercase; letter-spacing:0.06em; margin-top:2px; }
.stat-card.alert .stat-num { color:var(--red); }

.search-box { display:flex; align-items:center; gap:8px; background:var(--surface); border:1px solid var(--line); border-radius:10px; padding:10px 12px; margin-bottom:14px; }
.search-box input { background:transparent; border:none; outline:none; color:var(--ink); flex:1; font-size:14px; font-family:'IBM Plex Sans',sans-serif; }

.tag-card { position:relative; background:var(--surface); border:1px solid var(--line); border-radius:10px; padding:14px; margin-bottom:10px; display:flex; gap:12px; align-items:center; }
.tag-punch { width:2px; align-self:stretch; background:repeating-linear-gradient(to bottom, var(--line) 0 4px, transparent 4px 9px); margin-right:2px; }
.tag-main { flex:1; min-width:0; }
.tag-sku { font-family:'IBM Plex Mono',monospace; font-size:11px; color:var(--muted); letter-spacing:0.04em; }
.tag-name { font-weight:600; font-size:14.5px; margin-top:1px; }
.tag-price { font-family:'IBM Plex Mono',monospace; font-size:12px; color:var(--muted); margin-top:3px; }
.tag-qty { text-align:right; }
.tag-qty-num { font-family:'Archivo Expanded',sans-serif; font-weight:800; font-size:20px; }
.tag-qty-num.low { color:var(--red); }
.tag-qty-label { font-size:9px; color:var(--muted); text-transform:uppercase; letter-spacing:0.06em; }
.low-badge { position:absolute; top:-7px; right:10px; background:var(--red); color:#fff; font-size:9px; font-weight:700; padding:2px 7px; border-radius:20px; letter-spacing:0.04em; }

/* ---- Scan screen ---- */
.scan-toggle { display:flex; background:var(--surface); border:1px solid var(--line); border-radius:12px; padding:4px; margin-bottom:16px; }
.scan-toggle button { flex:1; border:none; background:transparent; color:var(--muted); font-family:'IBM Plex Mono',monospace; font-weight:600; font-size:13px; padding:10px; border-radius:9px; cursor:pointer; letter-spacing:0.03em; }
.scan-toggle button.active.in { background:var(--green); color:#0F1710; }
.scan-toggle button.active.out { background:var(--red); color:#2A0B06; }

.scan-frame { background:var(--surface); border:2px dashed var(--line); border-radius:14px; aspect-ratio:4/3; display:flex; align-items:center; justify-content:center; position:relative; overflow:hidden; margin-bottom:14px; }
.scan-frame video { width:100%; height:100%; object-fit:cover; }
.scan-frame .placeholder { text-align:center; color:var(--muted); padding:20px; font-size:13px; }
.scan-frame .corner { position:absolute; width:26px; height:26px; border:3px solid var(--yellow); pointer-events:none; }
.c-tl{top:10px;left:10px;border-right:none;border-bottom:none;} .c-tr{top:10px;right:10px;border-left:none;border-bottom:none;}
.c-bl{bottom:10px;left:10px;border-right:none;border-top:none;} .c-br{bottom:10px;right:10px;border-left:none;border-top:none;}

.manual-row { display:flex; gap:8px; margin-bottom:14px; }
.manual-row input { flex:1; background:var(--surface); border:1px solid var(--line); border-radius:10px; padding:12px; color:var(--ink); font-family:'IBM Plex Mono',monospace; font-size:14px; outline:none; }
.manual-row button { background:var(--surface2); border:1px solid var(--line); color:var(--ink); border-radius:10px; padding:0 16px; font-weight:600; cursor:pointer; }

.found-card { background:var(--surface); border:1px solid var(--yellow); border-radius:12px; padding:14px; margin-bottom:14px; }
.found-name { font-weight:700; font-size:15px; }
.found-sku { font-family:'IBM Plex Mono',monospace; font-size:11px; color:var(--muted); margin-top:2px; }
.qty-stepper { display:flex; align-items:center; justify-content:center; gap:16px; margin:14px 0; }
.qty-stepper button { width:44px; height:44px; border-radius:50%; border:1px solid var(--line); background:var(--surface2); color:var(--ink); font-size:20px; cursor:pointer; }
.qty-stepper .qty-val { font-family:'Archivo Expanded',sans-serif; font-size:28px; font-weight:800; min-width:50px; text-align:center; }
.confirm-btn { width:100%; padding:14px; border:none; border-radius:10px; font-weight:700; font-size:14px; cursor:pointer; letter-spacing:0.03em; }
.confirm-btn[disabled] { opacity:0.5; cursor:default; }
.confirm-btn.in { background:var(--green); color:#0F1710; }
.confirm-btn.out { background:var(--red); color:#2A0B06; }
.not-found { text-align:center; color:var(--muted); font-size:13px; padding:14px; }

.toast { position:fixed; left:50%; bottom:96px; transform:translateX(-50%); background:var(--surface2); border:1px solid var(--line); padding:10px 16px; border-radius:24px; font-size:13px; font-weight:600; z-index:60; opacity:0; transition:opacity .25s; pointer-events:none; }
.toast.show { opacity:1; }
.toast.error { border-color:var(--red); color:var(--red); }

/* ---- History ---- */
.hist-row { display:flex; align-items:center; gap:10px; padding:11px 0; border-bottom:1px solid var(--line); }
.hist-dot { width:8px; height:8px; border-radius:50%; flex-shrink:0; }
.hist-dot.in { background:var(--green); } .hist-dot.out { background:var(--red); }
.hist-main { flex:1; min-width:0; }
.hist-sku { font-weight:600; font-size:13.5px; }
.hist-meta { font-family:'IBM Plex Mono',monospace; font-size:10.5px; color:var(--muted); margin-top:1px; }
.hist-qty { font-family:'IBM Plex Mono',monospace; font-weight:700; font-size:14px; }
.hist-qty.in { color:var(--green); } .hist-qty.out { color:var(--red); }
.empty-state { text-align:center; padding:40px 20px; color:var(--muted); font-size:13px; }

/* ---- Nav ---- */
.bottomnav { position:fixed; bottom:0; left:50%; transform:translateX(-50%); width:100%; max-width:480px; background:var(--surface); border-top:1px solid var(--line); display:flex; z-index:30; }
.navbtn { flex:1; background:none; border:none; color:var(--muted); padding:10px 0 8px; display:flex; flex-direction:column; align-items:center; gap:3px; cursor:pointer; font-size:10px; font-weight:600; letter-spacing:0.03em; }
.navbtn.active { color:var(--yellow); }
.navbtn svg { width:20px; height:20px; }

.role-modal-backdrop { position:fixed; inset:0; background:rgba(0,0,0,0.6); z-index:100; display:flex; align-items:flex-end; justify-content:center; }
.role-modal { background:var(--surface); border-radius:16px 16px 0 0; padding:20px; width:100%; max-width:480px; border-top:2px dashed var(--yellow); }
.role-modal h3 { margin:0 0 4px; font-family:'Archivo Expanded',sans-serif; }
.role-modal p { color:var(--muted); font-size:12px; margin:0 0 14px; }
.role-modal .signout { width:100%; padding:12px; background:var(--surface2); border:1px solid var(--line); border-radius:10px; color:var(--red); font-weight:600; cursor:pointer; margin-top:6px; }
