/* Mobile-first, clean terminal-like UI */
:root{
  --bg:#0b1220;
  --panel:#101a2e;
  --panel2:#0f172a;
  --text:#e5e7eb;
  --muted:#9ca3af;
  --line:#26324d;
  --brand:#60a5fa;
  --brand2:#22c55e;
  --danger:#ef4444;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --r:16px;
}
*{ box-sizing:border-box; }
html,body{ height:100%; }
/* Ensure HTML 'hidden' attribute always wins over component styles (fixes overlay/login stacking on some browsers/webviews) */
[hidden]{ display:none !important; }

body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background: radial-gradient(1000px 500px at 20% 0%, rgba(96,165,250,.18), transparent 60%),
              radial-gradient(900px 450px at 80% 10%, rgba(34,197,94,.14), transparent 60%),
              var(--bg);
  color:var(--text);
}

.topbar{
  position:sticky; top:0; z-index:10;
  backdrop-filter: blur(10px);
  background: rgba(11,18,32,.75);
  border-bottom:1px solid rgba(255,255,255,.06);
  padding:14px 14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.brand{ display:flex; flex-direction:column; }
.logo{
  font-weight:800;
  letter-spacing:.2em;
  font-size:18px;
}
.subtitle{ color:var(--muted); font-size:12px; margin-top:4px; }

.status{ display:flex; gap:8px; align-items:center; flex-wrap:wrap; justify-content:flex-end; }
.pill{
  font-size:11px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.05);
  color:var(--text);
}
.pill.ok{ border-color: rgba(34,197,94,.45); }
.pill.bad{ border-color: rgba(239,68,68,.45); }
.pill.ghost{ opacity:.7; }

.container{
  max-width:1100px;
  margin:18px auto 40px;
  padding:0 14px;
  display:flex;
  flex-direction:column;
  gap:14px;
}

.card{
  background: rgba(16,26,46,.78);
  border:1px solid rgba(255,255,255,.08);
  box-shadow: var(--shadow);
  border-radius: var(--r);
  padding:14px;
}
.card.inner{ box-shadow:none; background: rgba(15,23,42,.55); }
.cardTitle{
  font-size:14px;
  font-weight:700;
  display:flex;
  align-items:center;
  gap:10px;
  margin-bottom:10px;
}
.cardTitleSmall{
  font-size:13px;
  font-weight:700;
  margin-bottom:10px;
  color:#f3f4f6;
}
.spacer{ flex:1; }

.grid2{ display:grid; grid-template-columns:1fr; gap:12px; }
.gap{ gap:14px; }
@media(min-width: 920px){
  .grid2{ grid-template-columns: 1.1fr .9fr; }
}

.field label{
  display:block;
  font-size:12px;
  color:var(--muted);
  margin-bottom:6px;
}
input, select{
  width:100%;
  border-radius: 12px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.06);
  padding:11px 12px;
  color:var(--text);
  outline:none;
}
input:focus, select:focus{
  border-color: rgba(96,165,250,.55);
  box-shadow: 0 0 0 3px rgba(96,165,250,.14);
}
.row{ display:flex; gap:10px; align-items:center; }
.row.wrap{ flex-wrap:wrap; }
.help{ margin-top:8px; color:var(--muted); font-size:12px; }
.tiny{ font-size:11px; }
.muted{ color:var(--muted); }

.btn{
  border-radius: 12px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.06);
  color:var(--text);
  padding:10px 12px;
  cursor:pointer;
  transition: transform .06s ease, background .12s ease, border-color .12s ease;
  user-select:none;
}
.btn:hover{ border-color: rgba(255,255,255,.20); }
.btn:active{ transform: translateY(1px); }
.btn[disabled]{ opacity:.45; cursor:not-allowed; }

.btn.primary{
  background: rgba(96,165,250,.22);
  border-color: rgba(96,165,250,.45);
}
.btn.big{
  padding:16px 14px;
  font-size:14px;
  justify-content:center;
  width:100%;
}

.btn.ghost{
  background: transparent;
}

.menuGrid{
  display:grid;
  grid-template-columns:1fr;
  gap:12px;
}
@media(min-width: 680px){
  .menuGrid{ grid-template-columns: 1fr 1fr; }
}

.empty{
  padding:14px;
  border-radius: 12px;
  border:1px dashed rgba(255,255,255,.14);
  color: var(--muted);
  background: rgba(0,0,0,.12);
}

.productCard{
  display:grid;
  grid-template-columns: 92px 1fr;
  gap:12px;
  align-items:start;
}
.productImg{
  width:92px; height:92px;
  border-radius:14px;
  object-fit:cover;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.2);
}
.productName{ font-weight:700; font-size:14px; line-height:1.2; margin-bottom:6px; }
.kv{ display:flex; gap:10px; flex-wrap:wrap; font-size:12px; color:var(--muted); }
.kv b{ color:var(--text); font-weight:700; }

.cartItem{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.cartItem:last-child{ border-bottom:none; }
.cartLeft{ display:flex; flex-direction:column; gap:4px; }
.cartRight{ display:flex; align-items:center; gap:8px; }
.qtyBtn{
  width:34px; height:34px;
  display:inline-flex; align-items:center; justify-content:center;
}

.cartFooter{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:12px;
  margin-top:12px;
}
.total .big{ font-size:20px; font-weight:800; letter-spacing:.02em; }

/* Log */
.log{
  margin:0;
  max-height: 190px;
  overflow:auto;
  font-size:11px;
  color:#cbd5e1;
  background: rgba(0,0,0,.20);
  border-radius: 12px;
  border:1px solid rgba(255,255,255,.08);
  padding:10px;
}

/* Error */
.error{
  margin-top:10px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(239,68,68,.45);
  background: rgba(239,68,68,.10);
  color:#fecaca;
  font-size:12px;
}

/* Overlay camera */
.overlay{
  position:fixed;
  inset:0;
  z-index:50;
  background: rgba(0,0,0,.68);
  display:flex;
  flex-direction:column;
}
.overlayTop{
  padding:14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.overlayTitle{ font-weight:800; }
.overlayBody{
  padding: 0 14px 14px;
  flex:1;
  display:flex;
  flex-direction:column;
  gap:10px;
}

.videoWrap{
  position:relative;
  width:100%;
  max-width: 520px;
  margin:0 auto;
  border-radius: 18px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.25);
}
video{
  width:100%;
  height:auto;
  display:block;
}

.scanFrame{
  position:absolute;
  inset: 18% 10%;
  border:2px solid rgba(255,255,255,.16);
  border-radius: 14px;
  box-shadow: inset 0 0 0 9999px rgba(0,0,0,.08);
  pointer-events:none;
}
.scanLine{
  position:absolute;
  left:10%;
  right:10%;
  height:2px;
  background: rgba(255,60,60,.95);
  box-shadow: 0 0 14px rgba(255,60,60,.55);
  border-radius:999px;
  opacity:0;
  pointer-events:none;
}
.videoWrap.scanning .scanLine{
  opacity:1;
  animation: scanMove 1.15s linear infinite;
}
@keyframes scanMove{
  0% { top: 20%; }
  100% { top: 78%; }
}
