:root {
  color-scheme: light;
  --navy: #183a47;
  --green: #275c50;
  --green-light: #e3f5f1;
  --orange: #bf7736;
  --line: #d5e0ef;
  --muted: #657994;
  --bg: #f3f7fc;
  --card: #fff;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: #142b43; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.page-shell { min-height: 100vh; }
.topbar { height: 66px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(24px, calc((100vw - 1200px) / 2)); background: #fff; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--navy); text-decoration: none; font-weight: 800; letter-spacing: .08em; }
.brand b { color: #18aaa0; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; background: #245f53; color: #fff; font-family: Georgia, serif; font-size: 23px; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.test-tag { color: #176659; background: #e4f6f3; border: 1px solid #cde9e2; padding: 7px 11px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.lang-button { border: 1px solid var(--line); background: white; border-radius: 10px; padding: 8px 12px; color: var(--navy); font-weight: 700; }
main { max-width: 1120px; margin: 36px auto 60px; padding: 0 22px; }
.page-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 22px; }
.eyebrow { color: #6c849e; font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1 { margin: 8px 0; color: #142b43; font-size: clamp(30px, 4vw, 42px); letter-spacing: -.035em; }
h2 { margin: 0; color: #183347; font-size: 18px; }
p { margin: 7px 0 0; line-height: 1.5; }
.muted { color: var(--muted); }
.privacy-note { display: flex; gap: 13px; align-items: flex-start; background: var(--green-light); border: 1px solid #cce9e2; color: #20584e; border-radius: 14px; padding: 15px 18px; margin-bottom: 20px; }
.privacy-note p { color: #426d66; font-size: 14px; }
.privacy-icon { width: 28px; height: 28px; flex: none; display: grid; place-items: center; background: #c9eee6; border-radius: 9px; font-weight: 900; }
.workflow { display: grid; grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr); gap: 18px; align-items: start; }
.card, .login-card { background: var(--card); border: 1px solid var(--line); border-radius: 17px; box-shadow: 0 8px 24px rgba(26, 57, 85, .045); padding: 21px; }
.card-title { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 18px; }
.card-title p { margin-top: 5px; font-size: 13px; }
.step-number { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 10px; color: #2254d2; background: #eff4ff; font-weight: 800; }
.upload-zone { min-height: 158px; border: 1px dashed #aabedc; border-radius: 14px; background: #f8faff; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 8px; padding: 22px; color: #294968; cursor: pointer; }
.upload-zone:hover { border-color: #2d68ed; background: #f3f7ff; }
.upload-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-zone small { color: var(--muted); font-size: 12px; }
.upload-icon { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 11px; color: #2454ca; background: #e9f0ff; font-size: 24px; }
.preview-wrap { margin-top: 16px; }
#previewCanvas { display: block; width: 100%; max-height: 380px; object-fit: contain; border-radius: 11px; background: #edf2f7; }
.preview-actions { display: flex; gap: 8px; margin: 10px 0 14px; flex-wrap: wrap; }
.range-label { display: flex; justify-content: space-between; color: #39526b; font-size: 13px; font-weight: 700; }
.range { width: 100%; accent-color: #1db2a7; }
.hint { color: var(--muted); font-size: 12px; }
.scan-row { display: flex; align-items: center; gap: 14px; margin-top: 17px; }
.progress-wrap { flex: 1; min-width: 130px; }
.progress-label { color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.progress-track { height: 7px; background: #e8eef6; border-radius: 8px; overflow: hidden; }
.progress-track div { width: 0%; height: 100%; background: #17ada3; transition: width .2s ease; }
label { display: block; color: #243e58; font-size: 13px; font-weight: 700; }
.mrz-box { width: 100%; min-height: 82px; resize: vertical; margin-top: 7px; border: 1px solid var(--line); border-radius: 10px; padding: 10px; color: #203b55; font: 13px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; text-transform: uppercase; }
input, select { width: 100%; height: 42px; border: 1px solid #ccd9e9; border-radius: 10px; margin-top: 6px; padding: 0 11px; color: #203b55; background: #fff; outline: none; }
input:focus, select:focus, textarea:focus { border-color: #3d6ff3; box-shadow: 0 0 0 3px rgba(61, 111, 243, .12); }
.parse-button { margin-top: 9px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.field-grid label { color: #516980; }
.field-grid input, .field-grid select { font-weight: 600; }
.status-line { border-radius: 10px; padding: 10px 12px; margin: 0 0 14px; font-size: 13px; font-weight: 700; }
.status-line.good { background: #e5f5ef; color: #176b50; }
.status-line.review { background: #fff2df; color: #8a5516; }
.save-card { margin-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.compact-title { align-items: center; margin: 0; }
.compact-title h2 { font-size: 17px; }
.save-card .muted { font-size: 13px; margin-left: 42px; }
.button { min-height: 42px; display: inline-flex; justify-content: center; align-items: center; gap: 8px; border: 1px solid transparent; border-radius: 10px; padding: 0 15px; font-weight: 750; font-size: 13px; transition: background .15s ease, transform .15s ease; }
.button:not(:disabled):active { transform: translateY(1px); }
.button:disabled { cursor: not-allowed; opacity: .48; }
.button-primary { background: #285be2; color: #fff; }
.button-primary:not(:disabled):hover { background: #1e4ecb; }
.button-success { min-width: 190px; background: #087b70; color: #fff; }
.button-success:not(:disabled):hover { background: #06695f; }
.button-light { border-color: var(--line); background: #fff; color: #4c647e; }
.button-light:not(:disabled):hover { background: #f5f8fc; border-color: #b6c8e0; }
.button.compact { min-height: 36px; padding: 0 12px; }
.full-width { width: 100%; margin-top: 14px; }
.error-text { color: #b42318; font-size: 13px; min-height: 1em; }
.success-box { margin-top: 10px; background: #e3f6f2; color: #14695f; border-radius: 10px; padding: 11px 13px; font-size: 13px; }
.success-box a { color: #0e645d; font-weight: 800; }
.footer-note { text-align: center; margin: 17px 0 0; color: #8293a7; font-size: 12px; }
.login-card { max-width: 420px; margin: 8vh auto; padding: 30px; }
.login-card h1 { font-size: 30px; }
.login-card form { margin-top: 22px; }
.hidden { display: none !important; }

@media (max-width: 780px) {
  main { margin-top: 24px; padding: 0 14px; }
  .topbar { height: 58px; padding: 0 14px; }
  .test-tag { font-size: 11px; padding: 6px 8px; }
  .workflow { grid-template-columns: 1fr; }
  .card { padding: 17px; }
  .save-card { align-items: stretch; flex-direction: column; gap: 14px; }
  .button-success { width: 100%; }
  .field-grid { gap: 10px; }
  .page-heading { margin-bottom: 16px; }
}

@media (max-width: 430px) {
  .brand { font-size: 13px; gap: 7px; }
  .brand-mark { width: 30px; height: 30px; }
  .top-actions { gap: 7px; }
  .field-grid { grid-template-columns: 1fr; }
  .scan-row { align-items: stretch; flex-direction: column; }
}
