:root {
  --bg: #f3f4f6;
  --panel: #ffffff;
  --primary: #0f172a;
  --primary-contrast: #ffffff;
  --secondary: #e2e8f0;
  --accent: #22c55e;
  --danger: #dc2626;
  --warn: #f59e0b;
  --text: #1f2937;
  --muted: #6b7280;
  --shadow: rgba(15, 23, 42, 0.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; font-family: Arial, sans-serif; background: var(--bg); color: var(--text); }
body { min-height: 100vh; }
button, input { font: inherit; }
button { border: none; border-radius: 12px; cursor: pointer; }

.shell { max-width: 900px; margin: 0 auto; padding: 16px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.topbar h1 { margin: 0; font-size: 1.8rem; }
.status-wrap { display: flex; align-items: center; gap: 8px; }
.badge { padding: 6px 12px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; }
.badge.ok { background: rgba(34, 197, 94, 0.15); color: #166534; }
.badge.warn { background: rgba(245, 158, 11, 0.15); color: #92400e; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin: 14px 0; }
.card, .panel { background: var(--panel); border-radius: 18px; box-shadow: 0 8px 22px var(--shadow); padding: 14px; }
.card strong { display: block; margin-bottom: 6px; }

.panel { margin-top: 14px; }
.field-row { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.field-box { display: flex; flex-direction: column; flex: 1; min-width: 100px; }
.field-box input { padding: 12px; border-radius: 10px; border: 1px solid #dbe1eb; font-size: 1rem; }
label { font-size: 0.92rem; color: var(--muted); }
label input { margin-top: 6px; }
.expand { flex: 2; }
.primary { background: var(--primary); color: var(--primary-contrast); padding: 12px 18px; }
.secondary { background: var(--secondary); color: var(--text); padding: 12px 14px; }
.small { padding: 8px 10px; font-size: 0.85rem; }
.danger { background: #fee2e2; color: var(--danger); }

.inventory-item { border: 1px solid #e5e7eb; border-radius: 12px; padding: 12px; margin-top: 10px; }
.row-between { display: flex; justify-content: space-between; align-items: center; }
.meta { color: var(--muted); font-size: 0.86rem; }
.quantity-controls { display: flex; align-items: center; gap: 8px; margin: 10px 0; }
.quantity-controls input { width: 72px; text-align: center; padding: 8px; }

.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.6); display: grid; place-items: center; padding: 12px; }
.modal-card { background: white; border-radius: 20px; width: min(92vw, 520px); padding: 18px; }
.camera-frame { position: relative; overflow: hidden; border-radius: 16px; background: #111827; width: 100%; aspect-ratio: 4 / 3; }
#camera-video { width: 100%; height: 100%; object-fit: cover; }
.camera-frame.scan-success { outline: 5px solid #16a34a; box-shadow: 0 0 22px rgba(22, 163, 74, 0.7); }
.camera-frame.scan-error { outline: 5px solid #dc2626; box-shadow: 0 0 22px rgba(220, 38, 38, 0.7); }
.scan-feedback {
  position: absolute;
  z-index: 2;
  left: 12px;
  right: 12px;
  bottom: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  color: white;
  font-weight: 700;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  background: rgba(22, 101, 52, 0.94);
}
.scan-feedback.error { background: rgba(185, 28, 28, 0.96); }
.scan-feedback[hidden] { display: none; }
.scan-line {
  position: absolute;
  left: 8%;
  width: 84%;
  height: 2px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.8);
  top: 50%;
}

.user-list { list-style: none; margin: 0; padding: 0; }
.user-list li { border: 1px solid #e5e7eb; border-radius: 10px; padding: 10px; margin-top: 8px; }
.inline-actions { display: flex; gap: 8px; margin-top: 8px; }

@media (max-width: 640px) {
  .field-row { flex-direction: column; align-items: stretch; }
  .field-box, .expand { width: 100%; }
  .topbar { align-items: flex-start; flex-direction: column; }
}
