/* MagScan — Pontifexx-huisstijl (licht thema).
   Navy #1D2A50 voor structuur, oranje #F7A600 alleen voor de primaire actie. */
:root {
  --navy: #1D2A50;
  --navy-soft: #3A4568;
  --text-2: #5A6480;
  --text-3: #8A93AC;
  --page: #F6F7FA;
  --card: #FFFFFF;
  --tile: #F6F7FA;
  --seg: #E8EBF2;
  --border: #E8EBF2;
  --border-2: #E0E4EE;
  --input-border: #D6DBE8;
  --input-bg: #FBFCFE;
  --orange: #F7A600;
  --orange-shadow: rgba(247, 166, 0, 0.35);
  --green-bg: #E7F5EC; --green-fg: #1E7A43;
  --amber-bg: #FFF3DB; --amber-fg: #9A6700;
  --red-bg: #FDEEEC; --red-border: #F5CFC9; --red-fg: #93261B; --red-icon: #C0392B;
  --scanner: #101830;
  --radius: 16px;
  --radius-s: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }
body {
  font-family: 'Archivo', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--page);
  color: var(--navy);
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* ---------------------------------------------------------------- header */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { height: 20px; width: 100px; display: block; }
.brand-divider { width: 1px; height: 18px; background: var(--border-2); }
.brand h1 { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.header-actions { display: flex; gap: 8px; align-items: center; }
.lang-sel {
  background: var(--card);
  border: 1px solid var(--border-2);
  color: var(--text-2);
  height: 32px;
  border-radius: 8px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
}

/* ---------------------------------------------------------------- tabs */
.tabs {
  display: flex;
  background: var(--seg);
  border-radius: var(--radius-s);
  padding: 4px;
  gap: 4px;
  margin: 14px 14px 0;
  max-width: 612px;
  width: calc(100% - 28px);
}
.tabs-wrap { width: 100%; display: flex; justify-content: center; }
.tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 0;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.tab.active { background: var(--navy); color: #fff; font-weight: 700; }
.badge {
  background: var(--orange);
  color: var(--navy);
  border-radius: 99px;
  font-size: 11px;
  padding: 1px 7px;
  font-weight: 800;
}

main { flex: 1; padding: 14px; max-width: 640px; width: 100%; margin: 0 auto; }
main.wide { max-width: 1240px; }
footer { padding: 8px 16px; font-size: 11px; color: var(--text-3); text-align: center; }

.hidden { display: none !important; }
.view { display: flex; flex-direction: column; gap: 14px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.center-card { text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }

h2 { font-size: 17px; font-weight: 700; }
h3 {
  font-size: 12px;
  margin-bottom: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  font-weight: 700;
}
h3 small { color: var(--text-3); text-transform: none; letter-spacing: 0; font-weight: 600; }
.muted { color: var(--text-2); font-size: 13px; }
.error { color: var(--red-icon); font-size: 13px; margin-top: 8px; }

input[type="text"], input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-s);
  border: 1.5px solid var(--input-border);
  background: var(--input-bg);
  color: var(--navy);
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
}
label { font-size: 12px; font-weight: 700; letter-spacing: 0.10em; text-transform: uppercase; color: var(--text-3); display: block; margin-bottom: 8px; }
.row { display: flex; gap: 8px; }
.row input { flex: 1; }
.hint { font-size: 12px; color: var(--text-3); margin-top: 8px; }

.btn {
  border: none;
  border-radius: var(--radius-s);
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}
.btn.primary { background: var(--orange); color: var(--navy); box-shadow: 0 4px 14px var(--orange-shadow); }
.btn.primary:active { filter: brightness(0.95); }
.btn.ghost { background: var(--card); color: var(--text-2); border: 1px solid var(--border-2); font-weight: 600; }
.btn.danger { background: var(--card); color: var(--red-icon); border: 1px solid var(--border-2); font-weight: 600; }
.btn.big { padding: 16px; font-size: 16px; font-weight: 800; width: 100%; border-radius: 14px; }
.actions { display: flex; flex-direction: column; gap: 10px; padding-bottom: 24px; }
.cta-caption { text-align: center; font-size: 13px; color: var(--text-3); }
.kbd {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  border: 1px solid var(--border-2);
  border-radius: 6px;
  padding: 2px 6px;
  margin-left: 6px;
}
.btn.primary .kbd { color: var(--navy); border-color: rgba(29, 42, 80, 0.35); }

/* ---------------------------------------------------------------- scanner */
.scanner-wrap {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  background: var(--scanner);
  aspect-ratio: 3 / 4;
  max-height: 55dvh;
}
#video { width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; inset: 28px; pointer-events: none; }
.scan-frame i {
  position: absolute;
  width: 34px;
  height: 34px;
  border: 0 solid var(--orange);
}
.scan-frame i:nth-child(1) { top: 0; left: 0; border-top-width: 3px; border-left-width: 3px; border-top-left-radius: 14px; }
.scan-frame i:nth-child(2) { top: 0; right: 0; border-top-width: 3px; border-right-width: 3px; border-top-right-radius: 14px; }
.scan-frame i:nth-child(3) { bottom: 0; left: 0; border-bottom-width: 3px; border-left-width: 3px; border-bottom-left-radius: 14px; }
.scan-frame i:nth-child(4) { bottom: 0; right: 0; border-bottom-width: 3px; border-right-width: 3px; border-bottom-right-radius: 14px; }
.scan-hint {
  position: absolute;
  bottom: 14px;
  width: 100%;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}

/* in-app fotocamera met instructie-overlay */
.photo-wrap { max-height: 68dvh; }
.photo-overlay-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: 18px 20px 40px;
  background: linear-gradient(180deg, rgba(16, 24, 48, 0.85), rgba(16, 24, 48, 0));
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.photo-title { font-size: 16px; font-weight: 700; color: #fff; }
.photo-sub { font-size: 13px; font-weight: 500; color: rgba(255, 255, 255, 0.75); }
.photo-overlay-bottom {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 40px 28px 22px;
  background: linear-gradient(0deg, rgba(16, 24, 48, 0.85), rgba(16, 24, 48, 0));
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.capture-btn {
  width: 68px; height: 68px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.capture-btn span {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--orange);
  display: block;
}
.capture-btn:active span { transform: scale(0.9); }
.cam-side-btn {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: inherit;
}

/* ---------------------------------------------------------------- artikel */
.article-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.art-label { font-size: 12px; font-weight: 700; color: var(--text-3); letter-spacing: 0.08em; text-transform: uppercase; }
.art-desc { font-size: 17px; font-weight: 700; line-height: 1.3; margin-top: 4px; color: var(--navy); }
.stock-badge {
  background: var(--green-bg);
  color: var(--green-fg);
  padding: 6px 12px;
  border-radius: 99px;
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.detail-grid > div { background: var(--tile); border-radius: var(--radius-s); padding: 10px 12px; }
.detail-grid dt { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.detail-grid dd { font-size: 14px; font-weight: 600; margin-top: 2px; word-break: break-word; }

details.card > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-3);
}
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary .count { color: var(--text-2); font-weight: 600; text-transform: none; letter-spacing: 0; font-size: 13px; }
details.card[open] > summary { margin-bottom: 10px; }

.feature-list, .doc-list { display: flex; flex-direction: column; gap: 8px; }
.feature-list .item, .doc-list .item {
  background: var(--tile);
  border-radius: var(--radius-s);
  padding: 10px 12px;
  font-size: 13.5px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--navy-soft);
}
.feature-list .item b { color: var(--navy); font-weight: 700; }
.badge-ai { font-size: 10px; font-weight: 700; color: var(--amber-fg); background: var(--amber-bg); border-radius: 6px; padding: 2px 6px; align-self: center; }

/* ---------------------------------------------------------------- wachtrij */
.progress-card { display: flex; flex-direction: column; gap: 8px; }
.progress-head { display: flex; justify-content: space-between; align-items: baseline; }
.progress-head b { font-size: 14px; font-weight: 700; }
.progress-head span { font-size: 13px; color: var(--text-2); }
.progress-bar { height: 8px; background: var(--seg); border-radius: 99px; overflow: hidden; }
.progress-bar > div { height: 100%; background: var(--orange); border-radius: 99px; transition: width 0.4s; }

.queue-list { display: flex; flex-direction: column; gap: 10px; }
.queue-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.queue-item.busy { border-style: dashed; border-color: var(--input-border); opacity: 0.85; }
.queue-item img { width: 52px; height: 52px; object-fit: cover; border-radius: var(--radius-s); background: #F0F2F7; flex-shrink: 0; }
.queue-item .qi-main { flex: 1; min-width: 0; }
.queue-item .qi-title { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.queue-item .qi-sub { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 3px; }
.queue-item .qi-actions { display: flex; gap: 6px; flex-shrink: 0; }
.qi-btn {
  border: 1px solid var(--border-2);
  background: var(--card);
  color: var(--text-2);
  border-radius: 9px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.qi-btn.primary { background: var(--orange); color: var(--navy); border-color: var(--orange); font-weight: 700; }
.status-pill { font-size: 11px; border-radius: 99px; padding: 3px 9px; font-weight: 700; white-space: nowrap; }
.status-pill.pending, .status-pill.processing { background: #EDF0F6; color: var(--text-2); }
.status-pill.ready { background: var(--amber-bg); color: var(--amber-fg); }
.status-pill.failed { background: var(--red-bg); color: var(--red-fg); }
.status-pill.applied { background: var(--green-bg); color: var(--green-fg); }
.mini-spin {
  width: 11px; height: 11px;
  border: 2px solid var(--border-2);
  border-top-color: var(--orange);
  border-radius: 50%;
  display: inline-block;
  vertical-align: -2px;
  animation: spin 0.9s linear infinite;
  margin-right: 5px;
}

/* ---------------------------------------------------------------- review detail */
.review-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.review-nav .pos { font-size: 13px; color: var(--text-2); }
.review-nav .pos b { color: var(--navy); font-weight: 700; }
.nav-btns { display: flex; gap: 6px; }
.nav-btn {
  width: 32px; height: 32px;
  border: 1px solid var(--border-2);
  border-radius: 9px;
  background: var(--card);
  color: var(--text-2);
  font-size: 15px;
  cursor: pointer;
  font-family: inherit;
}

.review-grid { display: flex; flex-direction: column; gap: 14px; }
@media (min-width: 900px) {
  .review-grid { display: grid; grid-template-columns: 400px 1fr; align-items: start; }
  .review-col { display: flex; flex-direction: column; gap: 14px; }
}
.review-col { display: flex; flex-direction: column; gap: 14px; }

.photo-card { padding: 0; overflow: hidden; }
.photo-card img { width: 100%; max-height: 300px; object-fit: contain; background: #F0F2F7; display: block; }
.photo-card .photo-caption { padding: 14px 16px; border-top: 1px solid var(--border); }
.photo-card .photo-caption .cap-label { font-size: 12px; font-weight: 700; color: var(--text-3); letter-spacing: 0.08em; }
.photo-card .photo-caption .cap-desc { font-size: 14px; font-weight: 600; color: var(--text-2); margin-top: 4px; }

.ai-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.conf-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 99px;
  padding: 4px 10px;
  white-space: nowrap;
}
.conf-pill i { width: 8px; height: 8px; border-radius: 99px; display: inline-block; }
.conf-pill.high { background: var(--green-bg); color: var(--green-fg); } .conf-pill.high i { background: var(--green-fg); }
.conf-pill.medium { background: var(--amber-bg); color: var(--amber-fg); } .conf-pill.medium i { background: var(--orange); }
.conf-pill.low { background: var(--red-bg); color: var(--red-fg); } .conf-pill.low i { background: var(--red-icon); }

.mismatch {
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  border-radius: var(--radius-s);
  padding: 10px 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--red-fg);
  line-height: 1.4;
  margin-bottom: 10px;
}
.mismatch::before { content: '⚠'; color: var(--red-icon); font-size: 15px; line-height: 1.3; }
.ai-summary { font-size: 13.5px; color: var(--navy-soft); line-height: 1.5; }

/* review checklists */
.check-list { display: flex; flex-direction: column; gap: 8px; }
.check-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--tile);
  border-radius: var(--radius-s);
  padding: 11px 14px;
  font-size: 14px;
  color: var(--navy);
  cursor: pointer;
}
.check-item input {
  margin-top: 2px;
  accent-color: var(--navy);
  width: 18px; height: 18px;
  flex-shrink: 0;
}
.check-item .sub { display: block; font-size: 12.5px; color: var(--text-3); margin-top: 3px; word-break: break-all; }
.check-item .tag { font-size: 11px; font-weight: 700; border-radius: 99px; padding: 3px 9px; margin-left: 6px; vertical-align: middle; white-space: nowrap; }
.tag { background: var(--seg); color: var(--text-2); font-size: 11px; font-weight: 700; border-radius: 99px; padding: 3px 9px; }
.tag.sds { background: var(--red-bg); color: var(--red-fg); }
.tag.spec { background: var(--seg); color: var(--navy); }
.tag.matched { background: var(--seg); color: var(--navy); }
.tag.new { background: var(--green-bg); color: var(--green-fg); }
.check-item.extra { border: 1px dashed var(--input-border); background: transparent; }

.source-list { padding-left: 18px; font-size: 12px; color: var(--text-3); display: flex; flex-direction: column; gap: 4px; }
.source-list a { color: var(--navy-soft); word-break: break-all; text-decoration: underline; }

/* actiebalk onder review */
.review-bar {
  position: sticky;
  bottom: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  box-shadow: 0 -6px 24px rgba(29, 42, 80, 0.08);
}
.review-bar .left { display: flex; gap: 8px; }
.review-bar .right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.review-bar .sel-count { font-size: 13px; color: var(--text-3); }

.result-list { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.result-list li { background: var(--tile); border-radius: var(--radius-s); padding: 10px 12px; font-size: 13.5px; color: var(--navy-soft); }
.result-list li.ok::before { content: '✔ '; color: var(--green-fg); font-weight: 700; }
.result-list li.fail::before { content: '✖ '; color: var(--red-icon); font-weight: 700; }

.preview { max-width: 200px; border-radius: var(--radius-s); border: 1px solid var(--border-2); }

.spinner {
  width: 42px; height: 42px;
  border: 4px solid var(--seg);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  background: var(--navy);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  padding: 12px 18px;
  border-radius: var(--radius-s);
  box-shadow: 0 6px 24px rgba(29, 42, 80, 0.35);
  z-index: 50;
  max-width: 90vw;
  text-align: center;
}
