body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: #111827;
  color: #f9fafb;
}

.login-screen {
  position: fixed;
  inset: 0;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.login-screen.hidden {
  display: none;
}

.login-box {
  width: 100%;
  max-width: 320px;
  padding: 2rem;
  background: #1e293b;
  border-radius: 0.75rem;
  border: 1px solid #334155;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.login-box__title {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: #f8fafc;
}

.login-box__subtitle {
  margin: 0 0 1.5rem;
  font-size: 0.9375rem;
  color: #94a3b8;
}

.login-form label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #cbd5e1;
}

.login-form__input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.625rem 0.75rem;
  margin-bottom: 1rem;
  font-size: 1rem;
  border: 1px solid #475569;
  border-radius: 0.5rem;
  background: #0f172a;
  color: #f8fafc;
}

.login-form__input:focus {
  outline: none;
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25);
}

.login-form__error {
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
  color: #f87171;
}

.login-form__error.hidden {
  display: none;
}

.login-form__submit {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  background: #0ea5e9;
  color: #fff;
}

.login-form__submit:hover {
  background: #0284c7;
}

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-shell.hidden {
  display: none;
}

.scanner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: #020617;
  border-bottom: 1px solid #1f2937;
}

.scanner-header__list-name {
  font-weight: 600;
  font-size: 1rem;
}

.scanner-header__stats {
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: #9ca3af;
  display: flex;
  gap: 1rem;
}

.scanner-header__right button {
  margin-left: 0.5rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid #374151;
  background: #111827;
  color: #f9fafb;
  cursor: pointer;
  font-size: 0.875rem;
}

.scanner-header__right button:hover {
  background: #1f2937;
}

.main-area {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.camera-section {
  flex: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
}

.camera-section__wrap {
  position: relative;
  width: 100%;
  max-width: 960px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.btn-flash {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid #374151;
  background: #111827;
  color: #f9fafb;
  cursor: pointer;
  font-size: 0.875rem;
}

.btn-flash:hover {
  background: #1f2937;
}

.btn-flash.btn-flash--on {
  background: #1e3a5f;
  border-color: #3b82f6;
  color: #93c5fd;
}

.btn-flash.hidden {
  display: none;
}

.camera-scanner {
  position: relative;
  width: 100%;
  max-width: 960px;
  aspect-ratio: 16 / 9;
  background: #030712;
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid #1f2937;
}

.camera-scanner video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-scanner__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.camera-scanner__frame {
  width: 80%;
  max-width: 600px;
  height: 40%;
  border: 3px solid rgba(59, 130, 246, 0.9);
  border-radius: 0.75rem;
  box-shadow: 0 0 30px rgba(37, 99, 235, 0.5);
}

.camera-scanner__text {
  margin-top: 1rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid #1f2937;
  font-size: 0.9rem;
}

.status-section {
  flex: 1;
  padding: 0.5rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.scan-status__main {
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  background: #020617;
  border: 1px solid #1f2937;
  min-height: 3rem;
  display: flex;
  align-items: center;
  font-size: 0.95rem;
}

.scan-status--success {
  background: rgba(22, 163, 74, 0.1);
  border-color: #16a34a;
}

.scan-status--error {
  background: rgba(220, 38, 38, 0.1);
  border-color: #dc2626;
}

.scan-status__history {
  flex: 1;
  border-radius: 0.75rem;
  border: 1px solid #1f2937;
  background: #020617;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  overflow-y: auto;
}

.scan-status__history-item {
  display: grid;
  grid-template-columns: 80px 150px 1fr 80px;
  gap: 0.5rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid #111827;
}

.scan-status__history-item:last-child {
  border-bottom: none;
}

/* ——— Modal: donker thema, in lijn met scanner ——— */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1.5rem;
}

.modal-backdrop.hidden {
  display: none;
}

.modal {
  width: 100%;
  max-width: 420px;
  background: #020617;
  border-radius: 1rem;
  border: 1px solid #1f2937;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
}

.modal:has(.list-modal-content) {
  max-width: min(96vw, 56rem);
}

.modal-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid #1f2937;
}

.modal-footer {
  padding: 1.25rem 2rem;
  border-top: 1px solid #1f2937;
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.75rem;
  background: #020617;
  border-radius: 0 0 1rem 1rem;
}

.modal-body {
  padding: 1.5rem 2rem;
  max-height: 65vh;
  overflow: auto;
  background: #020617;
  color: #f9fafb;
}

.modal-body:has(.list-modal-content) {
  padding: 0;
  max-height: 60vh;
}

.modal h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #f9fafb;
}

.modal label {
  display: block;
  font-size: 0.9375rem;
  font-weight: 500;
  color: #e5e7eb;
  margin-bottom: 0.375rem;
}

.modal input,
.modal textarea {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid #374151;
  background: #020617;
  color: #f9fafb;
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.modal input::placeholder,
.modal textarea::placeholder {
  color: #6b7280;
}

.modal input:focus,
.modal textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35);
}

.modal button {
  padding: 0.625rem 1.25rem;
  border-radius: 999px;
  border: 1px solid #374151;
  background: #020617;
  color: #e5e7eb;
  cursor: pointer;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.modal button:hover {
  background: #111827;
  border-color: #4b5563;
}

.modal button:active {
  transform: scale(0.97);
}

.modal button.primary {
  background: #22c55e;
  border-color: #16a34a;
  color: #022c22;
}

.modal button.primary:hover {
  background: #16a34a;
  border-color: #15803d;
  color: #ecfdf5;
}

.modal button.danger {
  background: rgba(220, 38, 38, 0.2);
  border-color: #ef4444;
  color: #fecaca;
}

.modal button.danger:hover {
  background: rgba(248, 113, 113, 0.22);
  border-color: #f97373;
  color: #fee2e2;
}

/* ——— Lijst-modal: tabel in donker thema ——— */
.list-modal-content {
  overflow: auto;
  padding: 1.5rem 2rem;
}

.list-modal__empty {
  margin: 0;
  padding: 3rem 2rem;
  text-align: center;
  color: #9ca3af;
  font-size: 1rem;
}

.list-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
  font-size: 0.9375rem;
}

.list-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #020617;
}

.list-table th {
  padding: 1rem 1.25rem;
  text-align: left;
  font-weight: 600;
  color: #9ca3af;
  border-bottom: 1px solid #1f2937;
  white-space: nowrap;
}

.list-table__th--ean {
  width: 8rem;
}

.list-table__th--name {
  min-width: 12rem;
}

.list-table__th--num {
  width: 5.5rem;
  text-align: right;
}

.list-table__th--actions {
  width: 7rem;
  text-align: right;
  padding-right: 1rem;
}

.list-table__row {
  transition: background 0.1s ease;
}

.list-table__row:nth-child(even) {
  background: #020617;
}

.list-table__row:nth-child(odd) {
  background: #030712;
}

.list-table__row:hover {
  background: #020617;
}

.list-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #111827;
  color: #e5e7eb;
  vertical-align: middle;
}

.list-table__cell--ean {
  font-variant-numeric: tabular-nums;
  color: #9ca3af;
  font-size: 0.875rem;
}

.list-table__cell--name {
  word-break: break-word;
  overflow-wrap: break-word;
  line-height: 1.45;
  min-width: 0;
  max-width: none;
}

.list-table__cell--num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #e5e7eb;
}

.list-table__cell--actions {
  text-align: right;
  padding-right: 1rem;
}

.list-table__btn-remove {
  padding: 0.5rem 0.875rem;
  font-size: 0.8125rem;
  border-radius: 999px;
  border: 1px solid rgba(248, 113, 113, 0.7);
  background: rgba(127, 29, 29, 0.8);
  color: #fee2e2;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.list-table__btn-remove:hover {
  background: rgba(185, 28, 28, 0.9);
  border-color: #fca5a5;
  transform: translateY(-1px);
}

.list-card-wrap {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
}

.list-card__btn-delete {
  flex-shrink: 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  border-radius: 0.375rem;
  border: 1px solid rgba(248, 113, 113, 0.7);
  background: rgba(127, 29, 29, 0.8);
  color: #fee2e2;
  cursor: pointer;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.list-card__btn-delete:hover {
  background: rgba(185, 28, 28, 0.9);
  border-color: #fca5a5;
}

.product-popup__img {
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  border-radius: 0.5rem;
  background: #020617;
  margin-bottom: 1rem;
}

.product-popup__list {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.375rem 1.25rem;
  font-size: 0.9375rem;
}

.product-popup__list dt {
  color: #9ca3af;
  font-weight: 500;
}

.product-popup__list dd {
  margin: 0;
  word-break: break-word;
  color: #f9fafb;
}

/* ——— Mobile / responsive ——— */
@media (max-width: 640px) {
  .scanner-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
  }

  .scanner-header__left {
    min-width: 0;
  }

  .scanner-header__right {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-left: 0;
  }

  .scanner-header__right button {
    margin-left: 0;
    flex: 1 1 auto;
    min-height: 44px;
    padding: 0.6rem 0.75rem;
  }

  .modal {
    max-width: 100%;
    margin: 0.5rem;
    border-radius: 0.75rem;
    max-height: calc(100vh - 1rem);
    display: flex;
    flex-direction: column;
  }

  .modal:has(.list-modal-content) {
    max-width: calc(100vw - 1rem);
    max-height: calc(100dvh - 1rem);
  }

  .modal-backdrop {
    padding: max(0.5rem, env(safe-area-inset-top)) max(0.5rem, env(safe-area-inset-right)) max(0.5rem, env(safe-area-inset-bottom)) max(0.5rem, env(safe-area-inset-left));
  }

  .modal {
    max-height: calc(100dvh - 1rem);
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .modal-body {
    min-height: 0;
    flex: 1 1 auto;
  }

  .modal-header {
    padding: 1rem 1.25rem;
    flex-shrink: 0;
  }

  .modal h2 {
    font-size: 1rem;
  }

  .modal-body {
    max-height: 60vh;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .modal-body:has(.list-modal-content) {
    max-height: 50vh;
  }

  .list-modal-content {
    padding: 1rem 1.25rem;
  }

  .modal-footer {
    padding: 0.75rem 1rem;
    gap: 0.5rem;
    flex-shrink: 0;
    flex-direction: column;
  }

  .modal-footer button {
    min-height: 44px;
    width: 100%;
    justify-content: center;
  }

  /* Lijst-tabel als kaarten op mobiel */
  .list-table,
  .list-table thead,
  .list-table tbody,
  .list-table tr,
  .list-table th,
  .list-table td {
    display: block;
  }

  .list-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .list-table tr {
    border: 1px solid #1f2937;
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
    padding: 0;
    background: #020617;
  }

  .list-table tr:last-child {
    margin-bottom: 0;
  }

  .list-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #1f2937;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-height: 44px;
    color: #e5e7eb;
  }

  .list-table td:last-child {
    border-bottom: none;
    justify-content: flex-end;
    padding-top: 0.75rem;
  }

  .list-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #9ca3af;
    flex-shrink: 0;
    font-size: 0.8125rem;
  }

  .list-table td[data-label=""]::before {
    display: none;
  }

  .list-table__cell--name {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .list-table__cell--name::before {
    flex-basis: 100%;
    margin-bottom: 0.25rem;
  }

  .list-table__cell--num {
    text-align: right;
    justify-content: flex-end;
  }

  .list-table__btn-remove {
    min-height: 40px;
    padding: 0.5rem 0.85rem;
    font-size: 0.8125rem;
  }
}

@media (max-width: 380px) {
  .scanner-header__right button {
    min-width: 100%;
  }
}

@media (min-width: 900px) {
  .main-area {
    flex-direction: column;
  }
}

/* Toast notificatie (groen bij geslaagde scan) */
.toast-container {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  pointer-events: none;
  max-width: min(90vw, 420px);
}

.toast {
  padding: 0.875rem 1.25rem;
  border-radius: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 500;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast--success {
  background: #059669;
  color: #ecfdf5;
  border: 1px solid #10b981;
}

.toast--hide {
  opacity: 0;
  transform: translateY(-0.5rem);
}

