* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; overflow-x: hidden; }
body {
  background: #0e1116;
  color: #f1f3f5;
  font: 16px/1.3 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: contain;
}

#app { display: flex; flex-direction: column; min-height: 100dvh; }

/* ---------- header ---------- */
.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: #14181f;
  border-bottom: 1px solid #232a35;
}
.bar .who {
  flex: 1;
  font-weight: 700;
  font-size: 17px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bar .pill {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #1f2630;
  color: #b5bdc9;
}
.bar .pill.online { background: #143824; color: #5be584; }
.bar .pill.offline { background: #3a1f1f; color: #ff8585; }
.bar .pill.queued { background: #3a3015; color: #ffd56b; }
.bar .switch {
  appearance: none; border: 0;
  background: #232a35; color: #cdd5e0;
  padding: 8px 12px; border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

/* ---------- product grid ---------- */
.grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 10px;
  align-content: start;
}
@media (min-width: 480px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(4, 1fr); } }

.tile {
  position: relative;
  appearance: none;
  border: 0;
  border-radius: 16px;
  background: #1c2330;
  color: #f1f3f5;
  padding: 14px 12px 12px;
  min-height: 110px;
  display: flex; flex-direction: column; justify-content: space-between;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: transform 80ms ease, background 120ms ease;
  touch-action: manipulation;
}
.tile:active { transform: scale(0.97); background: #2a3344; }
.tile.flash { background: #1f5132; }
.tile.disabled { opacity: 0.45; }
.tile .name {
  font-size: 18px; font-weight: 700;
  line-height: 1.2;
  margin-bottom: 4px;
  word-break: break-word;
}
.tile .price {
  font-size: 22px; font-weight: 800;
  letter-spacing: -0.5px;
}
.tile .stock {
  position: absolute;
  top: 8px; right: 10px;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: #232a35;
  color: #b5bdc9;
}
.tile .stock.low { background: #3a3015; color: #ffd56b; }
.tile .stock.out { background: #3a1f1f; color: #ff8585; }

/* ---------- footer ---------- */
.foot {
  position: sticky; bottom: 0;
  display: flex; gap: 8px;
  padding: 10px;
  background: #14181f;
  border-top: 1px solid #232a35;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
}
.foot .last {
  flex: 1;
  font-size: 13px;
  color: #b5bdc9;
  overflow: hidden;
}
.foot .last b { color: #f1f3f5; font-weight: 700; }
.foot .undo {
  appearance: none; border: 0;
  background: #ff8585; color: #2a0e0e;
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
}
.foot .undo:disabled { opacity: 0.4; }

/* ---------- modal (seller picker) ---------- */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  z-index: 20;
}
.sheet {
  width: 100%; max-width: 420px;
  background: #14181f;
  border-radius: 18px;
  padding: 18px;
  max-height: 80dvh; overflow-y: auto;
}
.sheet h2 { margin: 0 0 12px; font-size: 18px; }
.sheet .row {
  display: block; width: 100%;
  appearance: none; border: 0;
  background: #1c2330; color: #f1f3f5;
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 8px;
  text-align: left;
  font: inherit; font-weight: 600; font-size: 16px;
  cursor: pointer;
}
.sheet .row:active { background: #2a3344; }
.sheet input {
  width: 100%; box-sizing: border-box;
  background: #1c2330; color: #f1f3f5;
  border: 1px solid #2a3344;
  padding: 12px 14px; border-radius: 12px;
  font: inherit; font-size: 16px;
  margin-bottom: 8px;
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  bottom: 84px; left: 50%;
  transform: translateX(-50%);
  background: #2a3344;
  color: #f1f3f5;
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  pointer-events: none;
  z-index: 30;
  opacity: 0;
  transition: opacity 150ms ease, transform 150ms ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
.toast.err { background: #5b2424; color: #ffd6d6; }
.toast.ok  { background: #1f5132; color: #d6ffe5; }

.empty {
  flex: 1; display: flex; align-items: center; justify-content: center;
  color: #6c7686; padding: 40px 20px; text-align: center;
}
