/* ── Scanner Styles ──────────────────────────────────────────────────────────── */
.scan-page { display: flex; flex-direction: column; gap: 18px; }

.scan-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 4px;
}

.scan-header h2 { font-size: 17px; font-weight: 700; }
.scan-header p { color: var(--t2); font-size: 12px; margin-top: 2px; }

/* Mode Selector */
.scan-modes { display: flex; gap: 8px; margin-bottom: 4px; }
.scan-mode {
  flex: 1; padding: 12px 16px; border-radius: 10px; border: 2px solid var(--bd);
  background: var(--bg2); color: var(--t2); cursor: pointer; text-align: center;
  transition: .2s; font-family: inherit; font-size: 13px; font-weight: 500;
}
.scan-mode:hover { border-color: var(--bd2); color: var(--t1); }
.scan-mode.active-in { border-color: var(--g); color: var(--g); background: var(--gd); }
.scan-mode.active-out { border-color: var(--b); color: var(--b); background: var(--bdb); }
.scan-mode .sm-icon { font-size: 24px; display: block; margin-bottom: 6px; }
.scan-mode .sm-label { font-weight: 600; display: block; }
.scan-mode .sm-desc { font-size: 11px; opacity: .7; margin-top: 3px; display: block; }

/* Camera Area */
.scan-camera-wrap {
  position: relative; width: 100%; max-width: 480px; margin: 0 auto;
  border-radius: 16px; overflow: hidden; border: 2px solid var(--bd);
  background: #000; aspect-ratio: 4/3;
}
.scan-camera-wrap video { width: 100%; height: 100%; object-fit: cover; }
#scanner-box {
  width: 100%; height: 100%; border-radius: 14px;
}
#scanner-box video { border-radius: 14px; }

/* Scanner overlay hint */
.scan-hint {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 14px 18px; background: linear-gradient(transparent, rgba(0,0,0,.85));
  color: #fff; font-size: 13px; text-align: center; pointer-events: none;
  border-radius: 0 0 14px 14px;
}

/* Manual Input */
.scan-manual {
  display: flex; gap: 8px; margin-top: 4px;
}
.scan-manual input {
  flex: 1; background: var(--bg2); border: 1px solid var(--bd);
  border-radius: 8px; padding: 10px 14px; font-family: inherit;
  font-size: 13px; color: var(--t1); outline: none; transition: .2s;
}
.scan-manual input:focus { border-color: var(--a); box-shadow: 0 0 0 3px var(--ag); }
.scan-manual button {
  padding: 10px 20px; border-radius: 8px; border: none;
  background: var(--a); color: #000; font-weight: 600; cursor: pointer;
  font-family: inherit; font-size: 13px; transition: .2s; white-space: nowrap;
}
.scan-manual button:hover { background: #ffb820; }

/* Scan Result Card */
.scan-result {
  background: var(--bg2); border: 1px solid var(--bd); border-radius: 12px;
  padding: 18px; animation: slideUp .3s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.scan-result-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
  padding-bottom: 12px; border-bottom: 1px solid var(--bd);
}
.scan-result-icon {
  width: 40px; height: 40px; border-radius: 10px; display: flex;
  align-items: center; justify-content: center; font-size: 18px;
}
.scan-result-icon.found { background: var(--gd); }
.scan-result-icon.not-found { background: var(--rd); }
.scan-result-title { font-weight: 600; font-size: 14px; }
.scan-result-sub { font-size: 11.5px; color: var(--t2); margin-top: 2px; }

.scan-result-info {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px;
}
.scan-info-item label { font-size: 11px; color: var(--t3); display: block; margin-bottom: 2px; }
.scan-info-item span { font-size: 13px; font-weight: 500; }
.scan-info-item .mono { font-family: 'JetBrains Mono', monospace; }

/* Quantity Control */
.scan-qty {
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
  padding: 12px 14px; background: var(--bg3); border-radius: 10px;
}
.scan-qty label { font-size: 12px; color: var(--t2); font-weight: 600; min-width: 60px; }
.scan-qty-ctrl { display: flex; align-items: center; gap: 0; }
.qty-btn {
  width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--bd);
  background: var(--bg2); color: var(--t1); font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: .15s;
  font-family: inherit;
}
.qty-btn:hover { background: var(--bg4); }
.qty-btn:disabled { opacity: .3; cursor: not-allowed; }
.qty-input {
  width: 70px; height: 36px; text-align: center; border-radius: 0;
  border: 1px solid var(--bd) none; border-top: 1px solid var(--bd);
  border-bottom: 1px solid var(--bd); background: var(--bg1);
  color: var(--t1); font-size: 16px; font-weight: 700; outline: none;
  font-family: 'JetBrains Mono', monospace; -moz-appearance: textfield;
}
.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.scan-qty select {
  flex: 1; background: var(--bg2); border: 1px solid var(--bd); border-radius: 8px;
  padding: 8px 12px; font-family: inherit; font-size: 12.5px; color: var(--t1);
  outline: none; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%234a5572' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px;
}

/* Scan Actions */
.scan-actions { display: flex; gap: 8px; }
.scan-actions .ba { flex: 1; justify-content: center; padding: 10px 16px; }

/* Scanned List */
.scan-list { margin-top: 4px; }
.scan-list-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.scan-list-header h3 { font-size: 13.5px; font-weight: 600; }
.scan-list-badge {
  background: var(--ad); color: var(--a); padding: 2px 8px;
  border-radius: 10px; font-size: 11px; font-weight: 700;
}

.scan-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--bg3); border: 1px solid var(--bd); border-radius: 8px;
  margin-bottom: 6px; animation: slideUp .25s ease;
}
.scan-item-icon { font-size: 16px; flex-shrink: 0; }
.scan-item-info { flex: 1; min-width: 0; }
.scan-item-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scan-item-detail { font-size: 11px; color: var(--t3); margin-top: 1px; }
.scan-item-qty {
  font-family: 'JetBrains Mono', monospace; font-size: 14px; font-weight: 700;
  min-width: 60px; text-align: center;
}
.scan-item-remove {
  width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--bd);
  background: transparent; color: var(--t3); cursor: pointer; font-size: 12px;
  display: flex; align-items: center; justify-content: center; transition: .15s;
}
.scan-item-remove:hover { background: var(--rd); color: var(--r); border-color: var(--r); }

/* Empty State */
.scan-empty {
  text-align: center; padding: 40px 20px; color: var(--t3);
}
.scan-empty .se-icon { font-size: 48px; margin-bottom: 12px; opacity: .5; }
.scan-empty p { font-size: 13px; }

/* Mobile Responsive */
@media (max-width: 768px) {
  .scan-camera-wrap { max-width: 100%; border-radius: 12px; }
  .scan-modes { flex-direction: column; }
  .scan-result-info { grid-template-columns: 1fr; }
  .page { padding: 14px; }
  .scan-qty { flex-wrap: wrap; }
  .scan-qty label { min-width: 100%; }
  .scan-actions { flex-direction: column; }
  .scan-actions .ba { width: 100%; }
}

/* Scanner status */
.scan-status {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  background: var(--bg3); border-radius: 8px; margin-bottom: 10px;
  font-size: 12px; color: var(--t2);
}
.scan-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.scan-dot.active { background: var(--g); animation: pulse 1.5s infinite; }
.scan-dot.inactive { background: var(--t3); }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}

/* Sound toggle */
.scan-sound-toggle {
  display: flex; align-items: center; gap: 6px; font-size: 12px;
  color: var(--t2); cursor: pointer; padding: 4px 8px;
  border-radius: 6px; border: 1px solid var(--bd); background: transparent;
  transition: .15s;
}
.scan-sound-toggle:hover { background: var(--bg2); }
