.table-value {
  display: inline-block;
  min-width: 52px;
  font-weight: 700;
}

.scanner-submit-stack {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.scan-qty-block {
  width: 110px;
}

.scan-qty-input {
  width: 110px;
}

.minus-btn {
  width: 38px;
  height: 38px;
  border: 1px solid #d0d5dd;
  border-radius: 12px;
  background: #fff;
  color: #101828;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    box-shadow 0.22s ease,
    background-color 0.22s ease,
    border-color 0.22s ease;
}

.minus-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
  border-color: #98a2b3;
}

.minus-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.dark-mode .table-value {
  color: #f8fafc;
}

.dark-mode .minus-btn {
  background: #0f172a;
  border-color: #334155;
  color: #f8fafc;
}

@media (max-width: 768px) {
  .scanner-submit-stack {
    width: 100%;
  }

  .scan-qty-block {
    width: 100%;
  }

  .scan-qty-input {
    width: 100%;
  }
}

.scan-items-page {
  padding: 24px;
}

.scan-items-container {
  max-width: 1200px;
  margin: 0 auto;
}

.page-header {
  margin-bottom: 20px;
}

.page-header h1 {
  margin: 0 0 8px;
  font-size: 30px;
  font-weight: 800;
  color: #101828;
}

.page-header p {
  margin: 0;
  color: #667085;
  font-size: 15px;
}

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.92));
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 22px;
  padding: 24px;
  margin-bottom: 22px;
  box-shadow:
    0 20px 40px rgba(15, 23, 42, 0.08),
    0 4px 14px rgba(15, 23, 42, 0.04);
}

.section-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 18px;
  color: #101828;
}

.order-search-row {
  display: flex;
  gap: 16px;
  align-items: end;
  flex-wrap: wrap;
}

.order-id-group {
  flex: 1;
  min-width: 260px;
}

.field-group label,
.method-label,
.scanner-main-label {
  display: block;
  margin-bottom: 10px;
  font-weight: 700;
  font-size: 15px;
  color: #101828;
}

.input {
  width: 100%;
  height: 46px;
  border: 1px solid #d0d5dd;
  border-radius: 14px;
  padding: 0 14px;
  font-size: 14px;
  background: #fff;
  color: #101828;
  outline: none;
  transition:
    border-color 0.22s ease,
    box-shadow 0.22s ease,
    background-color 0.22s ease,
    transform 0.18s ease;
}

.input:focus {
  border-color: rgba(37, 99, 235, 0.5);
  box-shadow:
    0 0 0 4px rgba(37, 99, 235, 0.08),
    0 6px 16px rgba(37, 99, 235, 0.08);
}

.input:disabled {
  background: #f2f4f7;
  color: #667085;
  cursor: not-allowed;
}

.search-loader {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #344054;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 3px solid #d0d5dd;
  border-top-color: #1d4ed8;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.search-message {
  margin-top: 12px;
  font-size: 14px;
}

.hidden {
  display: none !important;
}

.order-summary {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  color: #344054;
  font-size: 14px;
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
  margin-bottom: 22px;
}

.items-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 18px;
}

.items-table th,
.items-table td {
  border: 1px solid #eaecf0;
  padding: 14px 12px;
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

.items-table th {
  background: #f9fafb;
  color: #344054;
  font-weight: 700;
}

.items-table td {
  color: #101828;
  background: rgba(255, 255, 255, 0.82);
}

.mini-input {
  width: 72px;
  height: 38px;
  border: 1px solid #d0d5dd;
  border-radius: 12px;
  padding: 0 10px;
  font-size: 14px;
  background: #fff;
  color: #101828;
  outline: none;
  transition:
    border-color 0.22s ease,
    box-shadow 0.22s ease,
    background-color 0.22s ease,
    transform 0.18s ease;
}

.mini-input:focus {
  border-color: rgba(37, 99, 235, 0.5);
  box-shadow:
    0 0 0 4px rgba(37, 99, 235, 0.08),
    0 6px 16px rgba(37, 99, 235, 0.08);
}

/* Barcode method block */
.barcode-method-block {
  margin-top: 8px;
  margin-bottom: 18px;
}

/* Modern centered toggle */
.scanner-mode-switch {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  margin: 0 auto 10px;
  padding: 6px;
  gap: 0;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 18px;
  box-shadow:
    0 10px 30px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  overflow: hidden;
}

.scanner-mode-switch::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 6px;
  width: calc(50% - 6px);
  height: calc(100% - 12px);
  border-radius: 14px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8 55%, #1e40af);
  box-shadow:
    0 8px 18px rgba(37, 99, 235, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition:
    transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.scanner-mode-switch.manual-active::before {
  transform: translateX(100%);
}

.mode-btn {
  position: relative;
  z-index: 2;
  min-width: 170px;
  height: 50px;
  padding: 0 24px;
  border: none;
  border-radius: 14px;
  background: transparent;
  color: #344054;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.1px;
  cursor: pointer;
  transition:
    color 0.28s ease,
    transform 0.2s ease,
    opacity 0.25s ease;
}

.mode-btn:hover {
  color: #1d4ed8;
}

.mode-btn:active {
  transform: scale(0.985);
}

.mode-btn.active {
  color: #ffffff;
}

.scanner-mode-panel {
  width: 100%;
}

/* Scanner section */
.scanner-submit-row {
  margin-top: 20px;
  display: flex;
  gap: 16px;
  align-items: end;
  flex-wrap: wrap;
}

.scanner-box {
  flex: 1;
  min-width: 320px;
}

.scanner-camera {
  position: relative;
  width: 100%;
  height: 290px;
  border-radius: 22px;
  overflow: hidden;
  background: linear-gradient(180deg, #101828, #0f172a);
  border: 1px solid rgba(15, 23, 42, 0.08);
  margin-bottom: 14px;
  box-shadow:
    0 18px 45px rgba(15, 23, 42, 0.12),
    0 3px 10px rgba(15, 23, 42, 0.06);
}

.scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #000;
  transform: scale(1.01);
}

.scanner-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.barcode-finder {
  position: relative;
  width: min(74%, 520px);
  height: 112px;
  border-radius: 18px;
  box-shadow:
    0 0 0 9999px rgba(0, 0, 0, 0.28),
    inset 0 0 0 1px rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(1.5px);
}

.finder-corner {
  position: absolute;
  width: 26px;
  height: 26px;
  border-color: #ffffff;
  border-style: solid;
  border-width: 0;
  filter: drop-shadow(0 2px 6px rgba(255, 255, 255, 0.25));
}

.finder-corner.tl {
  top: -1px;
  left: -1px;
  border-top-width: 4px;
  border-left-width: 4px;
  border-top-left-radius: 10px;
}

.finder-corner.tr {
  top: -1px;
  right: -1px;
  border-top-width: 4px;
  border-right-width: 4px;
  border-top-right-radius: 10px;
}

.finder-corner.bl {
  bottom: -1px;
  left: -1px;
  border-bottom-width: 4px;
  border-left-width: 4px;
  border-bottom-left-radius: 10px;
}

.finder-corner.br {
  bottom: -1px;
  right: -1px;
  border-bottom-width: 4px;
  border-right-width: 4px;
  border-bottom-right-radius: 10px;
}

.scan-line {
  position: absolute;
  left: 7%;
  right: 7%;
  top: 50%;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg,
      rgba(255, 255, 255, 0.15),
      rgba(255, 255, 255, 0.98),
      rgba(255, 255, 255, 0.15));
  box-shadow:
    0 0 10px rgba(255, 255, 255, 0.8),
    0 0 22px rgba(255, 255, 255, 0.35);
  animation: scanMove 2.2s linear infinite;
}

@keyframes scanMove {
  0% {
    top: 22%;
  }

  50% {
    top: 77%;
  }

  100% {
    top: 22%;
  }
}

.scanner-hint {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(17, 24, 39, 0.42);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 11px 18px;
  border-radius: 12px;
  white-space: nowrap;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

.scanner-submit-btn {
  display: flex;
  align-items: end;
}

/* Buttons */
.btn {
  position: relative;
  height: 46px;
  padding: 0 22px;
  border: none;
  border-radius: 14px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.1px;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    box-shadow 0.25s ease,
    background 0.25s ease,
    filter 0.2s ease;
  box-shadow:
    0 10px 24px rgba(15, 23, 42, 0.10),
    0 2px 6px rgba(15, 23, 42, 0.06);
}

.btn::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  background: linear-gradient(180deg,
      rgba(255, 255, 255, 0.18),
      rgba(255, 255, 255, 0.02));
  pointer-events: none;
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

.btn:active {
  transform: translateY(0) scale(0.985);
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #2a68ec, #2251dc);
}

.btn-secondary {
  min-width: 92px;
  background: linear-gradient(135deg, #f59e0b, #ea9808);
  color: #fff;
}

.btn-secondary:hover {
  background: linear-gradient(135deg, #f7a61e, #ef9f13);
}

.btn-success {
  min-width: 140px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
}

.btn-success:hover {
  background: linear-gradient(135deg, #28cc65, #19ab4e);
}

/* Finish center */
.finish-row {
  margin-top: 28px;
  display: flex;
  justify-content: center;
}

/* Dark mode */
.dark-mode .page-header h1,
.dark-mode .section-title,
.dark-mode .field-group label,
.dark-mode .method-label,
.dark-mode .scanner-main-label {
  color: #f8fafc;
}

.dark-mode .page-header p,
.dark-mode .order-summary,
.dark-mode .search-loader,
.dark-mode .search-message {
  color: #cbd5e1;
}

.dark-mode .card {
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.94));
  border-color: rgba(255, 255, 255, 0.06);
}

.dark-mode .items-table th,
.dark-mode .items-table td {
  border-color: #334155;
}

.dark-mode .items-table th {
  background: #1e293b;
  color: #e2e8f0;
}

.dark-mode .items-table td {
  background: rgba(15, 23, 42, 0.85);
  color: #f8fafc;
}

.dark-mode .input,
.dark-mode .mini-input {
  background: #0f172a;
  border-color: #334155;
  color: #f8fafc;
}

.dark-mode .input:disabled {
  background: #1e293b;
  color: #94a3b8;
}

.dark-mode .scanner-mode-switch {
  background: rgba(30, 41, 59, 0.72);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 12px 26px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.dark-mode .mode-btn {
  color: #cbd5e1;
}

.dark-mode .mode-btn:hover {
  color: #ffffff;
}

.dark-mode .scanner-camera {
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 22px 42px rgba(0, 0, 0, 0.32),
    0 4px 14px rgba(0, 0, 0, 0.18);
}

.dark-mode .scanner-hint {
  background: rgba(15, 23, 42, 0.52);
}

/* Responsive */
@media (max-width: 768px) {
  .scan-items-page {
    padding: 14px;
  }

  .card {
    padding: 18px;
    border-radius: 18px;
  }

  .order-search-row,
  .scanner-submit-row {
    flex-direction: column;
    align-items: stretch;
  }

  .scanner-submit-btn {
    width: 100%;
  }

  .scanner-submit-btn .btn {
    width: 100%;
  }

  .mode-btn {
    min-width: 140px;
    font-size: 14px;
  }

  .scanner-camera {
    height: 240px;
  }

  .barcode-finder {
    width: 82%;
    height: 96px;
  }

  .scanner-hint {
    font-size: 13px;
    padding: 9px 14px;
  }
}

.search-btn-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-light {
  min-width: 92px;
  background: linear-gradient(135deg, #f8fafc, #eef2f6);
  color: #344054;
  border: 1px solid #d0d5dd;
  box-shadow:
    0 10px 24px rgba(15, 23, 42, 0.06),
    0 2px 6px rgba(15, 23, 42, 0.04);
}

.btn-light:hover {
  background: linear-gradient(135deg, #ffffff, #f3f6fa);
  color: #101828;
}

.dark-mode .btn-light {
  background: linear-gradient(135deg, #334155, #263445);
  color: #e2e8f0;
  border-color: #475569;
}

.dark-mode .btn-light:hover {
  background: linear-gradient(135deg, #3b4c61, #2d3c4d);
  color: #ffffff;
}