:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: #242a27;
  background: #f6f4ef;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --green: #275c4a;
  --green-dark: #1f493b;
  --muted: #777d77;
  --line: #e7e5df;
  --paper: #fffefa;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: #f6f4ef; }
button { font: inherit; }
.app-shell { width: min(100% - 36px, 720px); margin: 0 auto; padding: max(22px, env(safe-area-inset-top)) 0 max(24px, env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 4px 2px 30px; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 13px; color: white; background: var(--green); font-size: 23px; font-weight: 700; }
.brand-copy { display: grid; gap: 2px; font-size: 13px; }
.brand-copy strong { font-size: 14px; }
.brand-copy span { color: var(--muted); }
.language-button { border: 1px solid var(--line); background: transparent; color: #454b47; border-radius: 999px; padding: 9px 13px; font-size: 12px; font-weight: 600; }
.intro { padding: 14px 2px 26px; }
.eyebrow, .step-label { color: var(--green); letter-spacing: .12em; font-size: 10px; font-weight: 800; }
h1 { max-width: 570px; margin: 13px 0 10px; font-size: clamp(29px, 7vw, 43px); letter-spacing: -.045em; line-height: 1.1; }
.intro-copy { max-width: 550px; margin: 0; color: #68706b; font-size: 15px; line-height: 1.65; }
.upload-card { padding: clamp(18px, 4vw, 30px); border: 1px solid #eae8e1; border-radius: 22px; background: var(--paper); box-shadow: 0 12px 40px #25392f0a; }
.review-card { padding: clamp(18px, 4vw, 30px); border: 1px solid #eae8e1; border-radius: 22px; background: var(--paper); box-shadow: 0 12px 40px #25392f0a; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-heading h2 { margin: 7px 0 0; font-size: 20px; letter-spacing: -.025em; }
.review-total { display: grid; place-items: center; min-width: 45px; height: 45px; padding: 0 10px; border-radius: 50px; color: white; background: var(--green); font-size: 17px; font-weight: 800; }
.review-intro { margin: -5px 0 14px; color: #68706b; font-size: 13px; line-height: 1.55; }
.manual-notice { margin-bottom: 16px; padding: 12px 14px; border: 1px solid #eadfb9; border-radius: 12px; color: #6c5c2d; background: #fbf7e9; font-size: 12px; line-height: 1.5; }
.review-forms { display: grid; gap: 14px; }
.form-panel { padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.form-panel-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 13px; }
.form-panel-heading h3 { margin: 0; font-size: 14px; }
.form-thumbnail { width: 42px; height: 42px; border-radius: 9px; object-fit: cover; background: #f0efea; }
.recognition-panel { display: grid; gap: 9px; margin-bottom: 13px; padding: 11px; border-radius: 11px; background: #f5f7f3; }
.recognition-hint { margin: 0; color: #68706b; font-size: 11px; line-height: 1.5; }
.grid-start-button { justify-self: start; min-height: 39px; }
.grid-calibration, .column-labels-editor { margin: 12px 0; padding: 11px; border: 1px solid #e8e7e1; border-radius: 11px; background: #fff; }
.grid-calibration > summary, .column-labels-editor > summary { color: #33443a; cursor: pointer; font-size: 12px; font-weight: 700; }
.grid-instructions { margin: 9px 0; color: #707770; font-size: 11px; line-height: 1.55; }
.grid-calibration-canvas { display: block; width: 100%; height: auto; max-height: 68vh; object-fit: contain; border: 1px solid #e3e1da; border-radius: 8px; background: #f2f1ed; touch-action: none; cursor: crosshair; }
.grid-status { min-height: 17px; margin: 8px 0; color: #68706b; font-size: 11px; line-height: 1.45; }
.grid-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.grid-actions .button { min-height: 39px; padding: 0 11px; font-size: 11px; }
.grid-actions .button:disabled { opacity: .5; cursor: not-allowed; }
.column-label-list { display: grid; gap: 9px; }
.column-label-field input { height: 40px; }
.entry-list { display: grid; gap: 10px; }
.empty-rows { margin: 2px 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.entry-row { position: relative; display: grid; grid-template-columns: 1fr 140px; align-items: end; gap: 9px; padding: 12px; border: 1px solid #eeece6; border-radius: 12px; background: #fcfcfa; }
.entry-row.crossed-out { opacity: .58; background: #f4f2ef; }
.entry-row.crossed-out .item-field input { text-decoration: line-through; }
.entry-category { grid-column: 1 / -1; justify-self: start; padding: 4px 8px; border-radius: 7px; color: var(--green); background: #edf3ef; font-size: 10px; font-weight: 700; }
.field-label { display: grid; gap: 5px; min-width: 0; color: #777d77; font-size: 10px; font-weight: 600; }
.field-label input { width: 100%; height: 43px; min-width: 0; border: 1px solid #dddcd5; border-radius: 9px; padding: 0 10px; color: #242a27; background: #fff; font: inherit; font-size: 13px; }
.field-label input:focus { outline: 2px solid #91b59e; border-color: transparent; }
.field-label input::placeholder { color: #a2a59f; font-size: 11px; }
.exclude-field { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; min-height: 35px; color: #6e746e; font-size: 11px; cursor: pointer; }
.exclude-field input { width: 18px; height: 18px; accent-color: var(--green); }
.remove-entry { position: absolute; top: 9px; right: 9px; display: grid; place-items: center; width: 29px; height: 29px; border: 0; border-radius: 8px; color: #7d4741; background: #fff; cursor: pointer; font-size: 18px; }
html[dir="rtl"] .remove-entry { right: auto; left: 9px; }
.add-row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 11px; }
.add-row-button { min-height: 39px; padding: 0 11px; font-size: 11px; }
.form-total { margin-top: 13px; padding-top: 11px; border-top: 1px solid var(--line); color: #4b514c; font-size: 12px; font-weight: 700; }
.grand-summary { margin-top: 16px; padding: 16px; border-radius: 14px; background: #edf3ef; }
.grand-summary-title { color: var(--green-dark); font-size: 14px; }
.grand-summary ul { display: grid; gap: 7px; margin: 11px 0 0; padding-inline-start: 19px; color: #4a524d; font-size: 13px; }
.review-actions { display: flex; gap: 9px; margin-top: 15px; }
.review-actions .button { flex: 1; }
.page-count { display: grid; place-items: center; min-width: 35px; height: 35px; padding: 0 9px; border-radius: 50px; background: #edf3ef; color: var(--green); font-weight: 700; font-size: 13px; }
.dropzone { display: flex; flex-direction: column; align-items: center; padding: 28px 16px 22px; border: 1.5px dashed #cbd7cf; border-radius: 16px; background: #fbfcfa; text-align: center; }
.camera-icon { display: grid; place-items: center; width: 53px; height: 53px; margin-bottom: 13px; border-radius: 17px; background: #eaf2ed; color: var(--green); }
.camera-icon svg { width: 30px; height: 30px; }
.drop-title { margin: 0; font-size: 15px; font-weight: 700; }
.drop-hint { margin: 6px 0 18px; color: var(--muted); font-size: 12px; }
.upload-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; }
.button { min-height: 45px; border: 0; border-radius: 11px; padding: 0 16px; cursor: pointer; font-size: 13px; font-weight: 700; transition: background .15s ease, transform .15s ease, opacity .15s ease; }
.button:active { transform: scale(.98); }
.button:focus-visible, .language-button:focus-visible { outline: 3px solid #a6cdb6; outline-offset: 2px; }
.button-primary { color: #fff; background: var(--green); }
.button-primary:hover { background: var(--green-dark); }
.button-secondary { color: #31483c; background: #edf2ed; }
.button-secondary:hover { background: #e2ebe4; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; clip-path: inset(50%); }
.pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; margin-top: 16px; }
.page-card { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: #f5f4f0; }
.page-card img { display: block; width: 100%; height: 155px; object-fit: cover; }
.page-meta { display: flex; align-items: center; justify-content: space-between; gap: 5px; padding: 9px 10px; font-size: 11px; }
.page-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.remove-page { display: grid; flex: 0 0 27px; place-items: center; width: 27px; height: 27px; border: 0; border-radius: 8px; background: #fff; color: #7d4741; cursor: pointer; font-size: 17px; }
.privacy-note { display: flex; align-items: center; gap: 8px; margin: 17px 2px 18px; color: #747a75; font-size: 11px; line-height: 1.4; }
.privacy-dot { flex: 0 0 7px; height: 7px; border-radius: 50%; background: #77a388; }
.button-next { display: flex; align-items: center; justify-content: space-between; width: 100%; color: white; background: #bec7c0; }
.button-next:not(:disabled) { background: var(--green); cursor: pointer; }
.button-next:disabled { cursor: not-allowed; }
.app-footer { display: flex; justify-content: space-between; gap: 10px; padding: 20px 2px; color: #8a8e89; font-size: 10px; }
.app-footer span:last-child { font-family: Arial, sans-serif; }
.toast { position: fixed; right: 18px; bottom: max(18px, env(safe-area-inset-bottom)); left: 18px; z-index: 5; width: fit-content; max-width: min(520px, calc(100% - 36px)); margin: auto; padding: 12px 16px; border-radius: 12px; color: #fff; background: #253b31; box-shadow: 0 8px 28px #0002; font-size: 13px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity .2s ease, transform .2s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }
html[dir="rtl"] .app-shell { text-align: right; }
html[dir="rtl"] .intro-copy { margin-left: 0; margin-right: auto; }
html[dir="rtl"] .button-next span:last-child { transform: rotate(180deg); }

@media (max-width: 520px) {
  .app-shell { width: min(100% - 26px, 720px); }
  .topbar { padding-bottom: 20px; }
  .intro { padding-top: 10px; padding-bottom: 20px; }
  .intro-copy { font-size: 14px; }
  .upload-card { border-radius: 18px; }
  .review-card { border-radius: 18px; }
  .entry-row { grid-template-columns: 1fr 112px; gap: 7px; padding: 10px; }
  .review-actions .button { padding: 0 11px; font-size: 11px; }
  .dropzone { padding: 23px 10px 19px; }
  .upload-actions { width: 100%; }
  .upload-actions .button { flex: 1 1 145px; }
  .app-footer { flex-direction: column; }
  .app-footer span:last-child { align-self: flex-end; }
}

