:root{
  --bg:#0b1220;
  --surface:#111b2e;
  --surface-2:#182544;
  --surface-3:#1e2b4d;
  --border:#283757;
  --text:#eef2fb;
  --text-dim:#9aabc9;
  --text-faint:#6b7ba0;
  --accent:#14b8a6;
  --accent-dim:#0d9488;
  --accent-soft:rgba(20,184,166,.15);
  --warn:#f97316;
  --warn-soft:rgba(249,115,22,.15);
  --danger:#ef4444;
  --danger-soft:rgba(239,68,68,.15);
  --success:#22c55e;
  --success-soft:rgba(34,197,94,.15);
  --radius:18px;
  --radius-sm:12px;
  --shadow:0 10px 30px -10px rgba(0,0,0,.5);
  font-size:16px;
}

*{box-sizing:border-box;}
html,body{height:100%;}
body{
  margin:0;
  background:#05070d;
  color:var(--text);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  -webkit-font-smoothing:antialiased;
  overflow:hidden;
}

/* phone frame: fills viewport on mobile, centered mock-phone on desktop */
.phone{
  position:relative;
  width:100%;
  height:100vh;
  height:100dvh;
  max-width:480px;
  margin:0 auto;
  background:var(--bg);
  display:flex;
  flex-direction:column;
  overflow:hidden;
  box-shadow:var(--shadow);
}
@media (min-width:560px){
  body{
    display:flex;
    align-items:center;
    justify-content:center;
    background:
      radial-gradient(circle at 20% 20%, #0d1730 0, transparent 50%),
      radial-gradient(circle at 80% 80%, #10243a 0, transparent 50%),
      #05070d;
  }
  .phone{
    height:92vh;
    max-height:900px;
    border-radius:36px;
    border:8px solid #000;
    box-shadow:0 30px 60px -20px rgba(0,0,0,.7), 0 0 0 2px #1a1a1a;
  }
}

/* topbar */
.topbar{
  flex:0 0 auto;
  display:flex;
  align-items:center;
  gap:10px;
  padding:14px 16px calc(14px + env(safe-area-inset-top,0px));
  padding-top:max(14px, env(safe-area-inset-top));
  background:linear-gradient(180deg, var(--surface) 0%, rgba(17,27,46,.95) 100%);
  border-bottom:1px solid var(--border);
  z-index:5;
}
.topbar-title{flex:1; font-weight:700; font-size:1.08rem; letter-spacing:.2px;}
.topbar-left, .topbar-right{display:flex; align-items:center; gap:8px; min-width:28px;}
.icon-btn{
  background:var(--surface-2);
  border:1px solid var(--border);
  color:var(--text);
  width:38px;height:38px;border-radius:12px;
  display:flex;align-items:center;justify-content:center;
  cursor:pointer;
}
.icon-btn svg{width:19px;height:19px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;}
.avatar{
  width:34px;height:34px;border-radius:50%;
  background:linear-gradient(135deg, var(--accent), #0ea5e9);
  display:flex;align-items:center;justify-content:center;
  font-weight:700;font-size:.82rem;color:#06241f;
  flex-shrink:0;
}

/* app view = scroll container */
.app-view{
  flex:1 1 auto;
  overflow-y:auto;
  -webkit-overflow-scrolling:touch;
  padding:16px 16px 24px;
  display:flex;
  flex-direction:column;
  gap:14px;
}
.app-view.no-pad{padding:0;}
.app-view.center{align-items:center; justify-content:center;}

/* bottom nav */
.bottomnav{
  flex:0 0 auto;
  display:flex;
  background:rgba(17,27,46,.97);
  border-top:1px solid var(--border);
  padding:8px 6px calc(8px + env(safe-area-inset-bottom,0px));
  backdrop-filter:blur(8px);
  z-index:5;
}
.nav-btn{
  flex:1;
  background:none;border:none;color:var(--text-faint);
  display:flex;flex-direction:column;align-items:center;gap:3px;
  padding:6px 2px;border-radius:12px;font-size:.68rem;font-weight:600;
  cursor:pointer;
  transition:color .15s;
}
.nav-btn svg{width:22px;height:22px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;}
.nav-btn.active{color:var(--accent);}
.nav-btn.active svg{filter:drop-shadow(0 0 6px rgba(20,184,166,.5));}

/* generic components */
.card{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:16px;
}
.card.pressable{cursor:pointer; transition:transform .1s, border-color .15s;}
.card.pressable:active{transform:scale(.98);}
.card.pressable:hover{border-color:#36507f;}

.section-title{
  font-size:.74rem; font-weight:700; letter-spacing:.08em; text-transform:uppercase;
  color:var(--text-faint); margin:4px 2px 0;
}

.btn{
  appearance:none; border:none; cursor:pointer;
  font-family:inherit; font-weight:700; font-size:.95rem;
  padding:14px 18px; border-radius:14px;
  display:flex; align-items:center; justify-content:center; gap:8px;
  transition:transform .08s, filter .15s, opacity .15s;
}
.btn:active{transform:scale(.97);}
.btn-primary{background:linear-gradient(135deg, var(--accent), #0d9488); color:#04241f; box-shadow:0 8px 20px -6px rgba(20,184,166,.5);}
.btn-warn{background:linear-gradient(135deg, var(--warn), #ea580c); color:#2a1000; box-shadow:0 8px 20px -6px rgba(249,115,22,.5);}
.btn-danger{background:var(--danger-soft); color:#ff9a9a; border:1px solid rgba(239,68,68,.4);}
.btn-ghost{background:var(--surface-2); color:var(--text); border:1px solid var(--border);}
.btn-block{width:100%;}
.btn:disabled{opacity:.4; cursor:not-allowed; transform:none;}
.btn svg{width:18px;height:18px;stroke:currentColor;fill:none;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round;}

.badge{
  display:inline-flex; align-items:center; gap:5px;
  font-size:.68rem; font-weight:700; padding:4px 9px; border-radius:999px;
  letter-spacing:.02em;
}
.badge-dot{width:6px;height:6px;border-radius:50%;background:currentColor;}
.badge-open{background:var(--surface-3); color:#a9bbe0;}
.badge-progress{background:var(--warn-soft); color:var(--warn);}
.badge-done{background:var(--success-soft); color:var(--success);}
.badge-problem{background:var(--danger-soft); color:#ff8a8a;}
.badge-high{background:var(--danger-soft); color:#ff8a8a;}
.badge-normal{background:var(--accent-soft); color:var(--accent);}
.badge-low{background:var(--surface-3); color:var(--text-dim);}

.input{
  width:100%; background:var(--surface-2); border:1px solid var(--border);
  color:var(--text); padding:13px 14px; border-radius:12px; font-size:1rem;
  font-family:inherit;
}
.input:focus{outline:none; border-color:var(--accent);}

.search-wrap{position:relative;}
.search-wrap svg{position:absolute; left:13px; top:50%; transform:translateY(-50%); width:17px;height:17px; stroke:var(--text-faint); fill:none; stroke-width:2;}
.search-wrap .input{padding-left:38px;}

.progress-track{
  height:8px; background:var(--surface-3); border-radius:99px; overflow:hidden;
}
.progress-fill{
  height:100%; background:linear-gradient(90deg, var(--accent), #22d3ee);
  border-radius:99px; transition:width .35s ease;
}

.empty-state{
  display:flex; flex-direction:column; align-items:center; text-align:center;
  gap:10px; padding:40px 20px; color:var(--text-faint);
}
.empty-state svg{width:46px;height:46px; stroke:var(--text-faint); fill:none; stroke-width:1.5;}

/* order list item */
.order-card{display:flex; flex-direction:column; gap:10px;}
.order-top{display:flex; justify-content:space-between; align-items:flex-start; gap:10px;}
.order-id{font-weight:700; font-size:1rem;}
.order-customer{color:var(--text-dim); font-size:.86rem; margin-top:2px;}
.order-meta{display:flex; gap:14px; font-size:.78rem; color:var(--text-faint); align-items:center;}
.order-meta b{color:var(--text-dim); font-weight:600;}

/* login */
.login-wrap{width:100%; display:flex; flex-direction:column; gap:22px; padding:10px 4px;}
.login-logo{display:flex; flex-direction:column; align-items:center; gap:10px; margin-bottom:6px;}
.login-logo img, .login-logo svg{width:64px; height:64px;}
.login-logo h1{margin:0; font-size:1.4rem;}
.login-logo p{margin:0; color:var(--text-faint); font-size:.85rem; text-align:center;}
.user-pick{
  display:flex; align-items:center; gap:12px;
  background:var(--surface); border:1px solid var(--border); border-radius:16px;
  padding:14px; cursor:pointer; transition:border-color .15s, transform .1s;
}
.user-pick:active{transform:scale(.98);}
.user-pick:hover{border-color:var(--accent);}
.user-pick .avatar{width:44px;height:44px;font-size:1rem;}
.user-pick .u-name{font-weight:700;}
.user-pick .u-role{font-size:.78rem; color:var(--text-faint);}
.user-pick .chev{margin-left:auto; width:18px; height:18px; stroke:var(--text-faint); fill:none; stroke-width:2;}

/* detail position list */
.pos-item{
  display:flex; gap:12px; align-items:center;
  background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:13px;
}
.pos-item.done{opacity:.55;}
.pos-item.problem{border-color:rgba(239,68,68,.5); background:rgba(239,68,68,.06);}
.pos-icon{
  width:42px;height:42px;border-radius:12px;background:var(--surface-2);
  display:flex;align-items:center;justify-content:center; flex-shrink:0;
  font-size:1.1rem;
}
.pos-icon.done{background:var(--success-soft); color:var(--success);}
.pos-icon.problem{background:var(--danger-soft); color:#ff8a8a;}
.pos-main{flex:1; min-width:0;}
.pos-name{font-weight:700; font-size:.92rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.pos-sub{font-size:.78rem; color:var(--text-faint); display:flex; gap:10px; margin-top:2px; flex-wrap:wrap;}
.pos-sub code{background:var(--surface-3); padding:1px 6px; border-radius:6px; font-family:inherit;}
.pos-qty{text-align:right; font-weight:700; font-size:.95rem; flex-shrink:0;}
.pos-qty small{display:block; font-weight:500; font-size:.68rem; color:var(--text-faint);}
.pos-chev{width:18px;height:18px; stroke:var(--text-faint); fill:none; stroke-width:2; flex-shrink:0;}

/* scanner */
.scan-view{position:relative; flex:1; display:flex; flex-direction:column; background:#000;}
.scan-camera-wrap{position:relative; flex:1; min-height:220px; background:#000; overflow:hidden; display:flex; align-items:center; justify-content:center;}
.scan-camera-wrap video{width:100%; height:100%; object-fit:cover;}
.scan-overlay{position:absolute; inset:0; display:flex; align-items:center; justify-content:center; pointer-events:none;}
.scan-frame{
  width:72%; aspect-ratio:1.6/1; border-radius:18px;
  border:3px solid rgba(20,184,166,.9);
  box-shadow:0 0 0 2000px rgba(0,0,0,.45);
  position:relative;
}
.scan-frame::before{
  content:""; position:absolute; left:0; right:0; top:0; height:2px;
  background:linear-gradient(90deg, transparent, #14b8a6, transparent);
  animation:scanline 1.8s ease-in-out infinite;
}
@keyframes scanline{0%{top:4%;}50%{top:94%;}100%{top:4%;}}
.scan-nocamera{
  display:flex; flex-direction:column; align-items:center; gap:10px; color:var(--text-faint);
  padding:30px; text-align:center;
}
.scan-nocamera svg{width:40px;height:40px; stroke:var(--text-faint); fill:none; stroke-width:1.5;}

.scan-panel{
  background:var(--surface); border-top:1px solid var(--border);
  padding:16px 16px calc(16px + env(safe-area-inset-bottom,0px));
  display:flex; flex-direction:column; gap:12px;
  border-radius:22px 22px 0 0;
  margin-top:-18px; position:relative; z-index:2;
}
.scan-steps{display:flex; gap:6px;}
.scan-step{flex:1; height:4px; border-radius:99px; background:var(--surface-3);}
.scan-step.active{background:var(--accent);}
.scan-step.complete{background:var(--success);}
.scan-expect{
  display:flex; align-items:center; gap:10px;
  background:var(--surface-2); border:1px solid var(--border); border-radius:14px; padding:12px 14px;
}
.scan-expect .label{font-size:.72rem; color:var(--text-faint); text-transform:uppercase; letter-spacing:.06em;}
.scan-expect .value{font-weight:700; font-size:1.05rem;}
.scan-row{display:flex; gap:10px;}
.scan-row .input{flex:1;}

.qty-stepper{display:flex; align-items:center; justify-content:center; gap:18px; padding:8px 0;}
.qty-btn{
  width:48px;height:48px;border-radius:14px; border:1px solid var(--border);
  background:var(--surface-2); color:var(--text); font-size:1.4rem; font-weight:700;
  display:flex;align-items:center;justify-content:center; cursor:pointer;
}
.qty-btn:active{transform:scale(.94);}
.qty-value{font-size:2rem; font-weight:800; min-width:64px; text-align:center;}
.qty-hint{text-align:center; color:var(--text-faint); font-size:.78rem;}

.shake{animation:shake .4s;}
@keyframes shake{
  10%,90%{transform:translateX(-2px);}
  20%,80%{transform:translateX(4px);}
  30%,50%,70%{transform:translateX(-8px);}
  40%,60%{transform:translateX(8px);}
}

/* label / barcode visual */
.label-card{
  background:#f4f6f8; color:#111; border-radius:14px; padding:16px; display:flex; flex-direction:column; gap:8px;
}
.label-card .l-title{font-weight:800; font-size:.95rem;}
.label-card .l-sku{font-size:.78rem; color:#555;}
.barcode{display:flex; align-items:flex-end; height:52px; gap:1.5px; margin-top:4px;}
.barcode div{background:#111; width:2px;}
.label-card .num{font-family:"Courier New",monospace; font-size:.8rem; letter-spacing:.15em; color:#111; margin-top:2px; text-align:center;}

/* inventory */
.inv-item{display:flex; align-items:center; gap:12px; background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:13px; cursor:pointer;}
.inv-icon{width:40px;height:40px;border-radius:10px;background:var(--surface-2); display:flex;align-items:center;justify-content:center; font-size:1.1rem; flex-shrink:0;}
.inv-main{flex:1; min-width:0;}
.inv-name{font-weight:700; font-size:.9rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.inv-sub{font-size:.76rem; color:var(--text-faint);}
.inv-stock{text-align:right; font-weight:800;}
.inv-stock small{display:block; font-weight:500; font-size:.68rem; color:var(--text-faint);}
.inv-stock.low{color:var(--warn);}

/* sheet / modal */
.sheet-backdrop{
  position:fixed; inset:0; background:rgba(0,0,0,.55); z-index:20;
  display:flex; align-items:flex-end; justify-content:center;
  animation:fadeIn .15s ease;
}
@keyframes fadeIn{from{opacity:0;}to{opacity:1;}}
.sheet{
  width:100%; max-width:480px; background:var(--surface);
  border-radius:22px 22px 0 0; padding:18px 18px calc(18px + env(safe-area-inset-bottom,0px));
  display:flex; flex-direction:column; gap:14px;
  animation:slideUp .22s cubic-bezier(.2,.8,.2,1);
  max-height:86vh; overflow-y:auto;
}
@keyframes slideUp{from{transform:translateY(30px); opacity:.4;}to{transform:translateY(0); opacity:1;}}
.sheet-handle{width:40px; height:4px; background:var(--border); border-radius:99px; margin:0 auto;}
.sheet-head{display:flex; justify-content:space-between; align-items:center;}
.sheet-head h3{margin:0; font-size:1.05rem;}

/* toast */
.toast-host{
  position:fixed; left:50%; bottom:100px; transform:translateX(-50%);
  z-index:50; display:flex; flex-direction:column; gap:8px; align-items:center;
  width:calc(100% - 32px); max-width:420px; pointer-events:none;
}
.toast{
  pointer-events:auto;
  display:flex; align-items:center; gap:10px;
  background:#1c2944; border:1px solid var(--border); color:var(--text);
  padding:12px 16px; border-radius:14px; box-shadow:0 10px 24px -8px rgba(0,0,0,.5);
  font-size:.88rem; font-weight:600;
  animation:toastIn .2s ease;
  max-width:100%;
}
@keyframes toastIn{from{opacity:0; transform:translateY(10px);} to{opacity:1; transform:translateY(0);}}
.toast.success{border-color:rgba(34,197,94,.4);}
.toast.error{border-color:rgba(239,68,68,.4);}
.toast svg{width:18px;height:18px; flex-shrink:0;}
.toast.success svg{stroke:var(--success);}
.toast.error svg{stroke:var(--danger);}
.toast.info svg{stroke:var(--accent);}

/* completion */
.complete-wrap{display:flex; flex-direction:column; align-items:center; text-align:center; gap:16px; padding:30px 10px;}
.complete-check{
  width:84px; height:84px; border-radius:50%; background:var(--success-soft);
  display:flex; align-items:center; justify-content:center;
  animation:pop .4s cubic-bezier(.3,1.5,.5,1);
}
.complete-check svg{width:42px;height:42px; stroke:var(--success); fill:none; stroke-width:2.6;}
@keyframes pop{from{transform:scale(.4); opacity:0;}to{transform:scale(1); opacity:1;}}

/* scanhub quick actions */
.quick-grid{display:grid; grid-template-columns:1fr 1fr; gap:12px;}
.quick-card{
  background:var(--surface); border:1px solid var(--border); border-radius:18px; padding:16px;
  display:flex; flex-direction:column; gap:10px; cursor:pointer;
}
.quick-card svg{width:26px;height:26px; stroke:var(--accent); fill:none; stroke-width:2;}
.quick-card .q-title{font-weight:700; font-size:.9rem;}
.quick-card .q-sub{font-size:.76rem; color:var(--text-faint);}

.stat-row{display:flex; gap:10px;}
.stat-box{flex:1; background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:14px; text-align:center;}
.stat-box .n{font-size:1.5rem; font-weight:800;}
.stat-box .l{font-size:.7rem; color:var(--text-faint); text-transform:uppercase; letter-spacing:.05em; margin-top:2px;}

.divider{height:1px; background:var(--border); margin:2px 0;}

a{color:inherit;}
::-webkit-scrollbar{width:0;height:0;}
