* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', system-ui, sans-serif; }
body { background: #12151a; color: #e8e6e1; min-height: 100vh; }
.hidden { display: none !important; }
.screen { min-height: 100vh; }

/* Login */
.login-box {
  max-width: 320px; margin: 20vh auto 0; text-align: center; padding: 24px;
}
.login-box h1 { font-size: 22px; margin-bottom: 4px; }
.login-box .sub { color: #8a8f98; font-size: 13px; margin-bottom: 20px; }
#pin-input {
  width: 100%; font-size: 28px; text-align: center; letter-spacing: 8px;
  padding: 12px; border-radius: 8px; border: 1px solid #2a2f38;
  background: #1a1e25; color: #e8e6e1; margin-bottom: 12px;
}
.error-text { color: #e2914d; font-size: 13px; margin-top: 8px; min-height: 18px; }

/* Buttons */
.primary-btn, .secondary-btn, #btn-login {
  border: none; border-radius: 8px; padding: 12px 16px; font-size: 15px;
  cursor: pointer; width: 100%;
}
#btn-login, .primary-btn { background: #e2914d; color: #1a1207; font-weight: 600; }
.primary-btn:disabled { background: #3a3226; color: #6b6255; cursor: not-allowed; }
.secondary-btn { background: #2a2f38; color: #e8e6e1; margin-top: 8px; }
.link-btn { background: none; border: none; color: #8a8f98; font-size: 13px; cursor: pointer; }

/* Topbar */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; border-bottom: 1px solid #2a2f38;
}

/* Scan main */
.scan-main { max-width: 480px; margin: 0 auto; padding: 24px 20px; }
.field-label {
  display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em;
  color: #8a8f98; margin-bottom: 6px; margin-top: 18px;
}
.po-select, .scan-input, #reason-new-input {
  width: 100%; padding: 12px; border-radius: 8px; border: 1px solid #2a2f38;
  background: #1a1e25; color: #e8e6e1; font-size: 15px;
}
.scan-input { font-family: monospace; font-size: 18px; letter-spacing: 1px; }

.scan-feedback { margin-top: 12px; padding: 10px 12px; border-radius: 8px; font-size: 14px; }
.scan-feedback.success { background: #1a2e1e; color: #7fd88a; }
.scan-feedback.error { background: #2e1a1a; color: #e88a8a; }
.scan-feedback.neutral { background: #1a1e25; color: #8a8f98; }

/* Reason form */
.reason-form { margin-top: 20px; border-top: 1px solid #2a2f38; padding-top: 16px; }
.reason-form h3 { font-size: 15px; margin-bottom: 10px; }
.reason-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.reason-chip {
  border: 1px solid #2a2f38; background: #161a20; color: #c4c8cf;
  border-radius: 20px; padding: 8px 14px; font-size: 14px; cursor: pointer;
}
.reason-chip.on { background: rgba(226,145,77,0.12); border-color: rgba(226,145,77,0.6); color: #e8e6e1; }
.reason-add-row { display: flex; gap: 8px; margin-bottom: 16px; }
.reason-add-row #reason-new-input { flex: 1; }
.reason-add-row button { width: auto; margin-top: 0; }
.hint-text { color: #5c626c; font-size: 13px; }

/* QR panel */
.qr-panel { margin-top: 20px; text-align: center; }
.qr-placeholder {
  border: 1px dashed #2a2f38; padding: 40px 12px; border-radius: 8px;
  color: #5c626c; font-size: 12px; word-break: break-all; margin: 12px 0;
}

/* Photo capture page */
.center-text { text-align: center; margin-top: 30vh; padding: 0 20px; color: #8a8f98; }
.success-text { color: #7fd88a; }
.photo-main { max-width: 480px; margin: 0 auto; padding: 20px; }
.photo-slot {
  border: 1px solid #2a2f38; border-radius: 10px; padding: 14px;
  margin-bottom: 12px; background: #161a20;
}
.slot-info { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.slot-label { font-size: 15px; font-weight: 600; }
.slot-status { font-size: 12px; }
.slot-status.done { color: #7fd88a; }
.slot-status.pending { color: #8a8f98; }
.slot-thumb { width: 100%; border-radius: 8px; margin-bottom: 10px; max-height: 220px; object-fit: cover; }
.slot-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.slot-capture-btn { width: auto; flex: 1; margin-top: 0; }
.slot-remove-btn { flex-shrink: 0; }
#slot-list.uploading { opacity: 0.5; pointer-events: none; }

/* Review Queue */
.queue-main { max-width: 560px; margin: 0 auto; padding: 20px; }
.group-card {
  border: 1px solid #2a2f38; border-radius: 12px; padding: 16px;
  margin-bottom: 14px; background: #161a20;
}
.group-header { display: flex; justify-content: space-between; align-items: flex-start; }
.group-count { font-size: 12px; color: #8a8f98; font-family: monospace; }
.tag-repair {
  display: inline-block; margin-top: 8px; font-size: 12px;
  background: rgba(226,145,77,0.15); color: #e2914d; padding: 3px 10px; border-radius: 12px;
}
.sample-photos { display: flex; gap: 8px; margin: 12px 0; }
.sample-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; }
.verdict-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.verdict-btn {
  border: none; border-radius: 8px; padding: 11px; font-size: 14px; cursor: pointer; font-weight: 500;
}
.verdict-btn.sell { background: rgba(127,216,138,0.15); color: #7fd88a; }
.verdict-btn.claim { background: rgba(232,138,138,0.15); color: #e88a8a; }
.verdict-btn.repair { background: rgba(138,180,232,0.15); color: #8ab4e8; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal-box { background: #1a1e25; border-radius: 12px; padding: 24px; width: 280px; text-align: center; }
.grade-options { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.grade-btn {
  border: 1px solid #2a2f38; background: #161a20; color: #e8e6e1;
  border-radius: 8px; padding: 12px; font-size: 14px; cursor: pointer;
}

/* Auto-rule suggestion */
.rule-suggest-card {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  border: 1px solid rgba(226,145,77,0.4); background: rgba(226,145,77,0.08);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 10px;
}
.rule-suggest-card .secondary-btn { width: auto; margin-top: 0; flex-shrink: 0; }

/* Handover tasks */
.task-card {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  border: 1px solid #2a2f38; border-radius: 10px; padding: 14px;
  margin-bottom: 10px; background: #161a20;
}
.task-card.aging { border-color: rgba(232,138,138,0.5); background: rgba(232,138,138,0.06); }
.task-card .primary-btn { width: auto; flex-shrink: 0; padding: 10px 14px; font-size: 13px; }
.aging-warn { color: #e88a8a; font-size: 12px; margin-top: 4px; }

/* QR panel — real QR image */
.qr-image { width: 220px; height: 220px; border-radius: 8px; background: #fff; padding: 8px; }
.qr-link-fallback { font-size: 12px; color: #8a8f98; margin-top: 12px; word-break: break-all; }
.qr-link-fallback a { color: #e2914d; }

/* Camera scan view */
.camera-scan-view { margin-top: 12px; border-radius: 8px; overflow: hidden; }
