:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1d2433;
  --muted: #5b6475;
  --border: #d9dde5;
  /* Blue from the City of Riverview seal. */
  --brand: #2a5dad;
  --brand-hover: #214a8c;
  --brand-dark: #1b3c72;
  --brand-soft: #e9f0fa;
  --danger: #b3261e;
  --danger-soft: #fdecea;
  --notice-soft: #fff4e5;
  --notice-border: #f0b35e;
  --radius: 10px;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.wrap.narrow { max-width: 520px; }

.site-header { background: var(--brand-dark); color: #fff; }
.site-header .wrap { display: flex; align-items: center; gap: 14px; padding-top: 12px; padding-bottom: 12px; }
.seal { flex: none; width: 56px; height: 56px; border-radius: 50%; display: block; }
.brand-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.it-logo { flex: none; height: 56px; width: auto; display: block; }
.brand { color: #fff; font-weight: 700; font-size: 1.3rem; line-height: 1.2; text-decoration: none; }
.library { opacity: 0.9; font-size: 0.95rem; }

main { padding-top: 24px; padding-bottom: 24px; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 8px; }
h2 { font-size: 1.15rem; margin: 0 0 14px; display: flex; align-items: center; gap: 10px; }
.intro { margin-bottom: 20px; }
.intro p { margin: 0; color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }

.step-num {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: 0.9rem;
}

.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 28px 16px; cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.dragging, .dropzone:focus-within { border-color: var(--brand); background: var(--brand-soft); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone-title { font-weight: 600; color: var(--brand); font-size: 1.05rem; }
.dropzone-hint { color: var(--muted); font-size: 0.9rem; }

.file-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 12px; }
.file { display: flex; gap: 14px; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.file.error { border-color: var(--danger); background: var(--danger-soft); }
.file-thumb { flex: none; width: 64px; height: 84px; border: 1px solid var(--border); background: #fafafa; display: grid; place-items: center; overflow: hidden; }
.file-thumb canvas { max-width: 100%; max-height: 100%; }
.file-main { flex: 1; min-width: 0; }
.file-head { display: flex; justify-content: space-between; gap: 8px; }
.file-name { font-weight: 600; overflow-wrap: anywhere; }
.file-status { margin: 2px 0 8px; color: var(--muted); font-size: 0.9rem; }
.file.error .file-status { color: var(--danger); }
.progress { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin-bottom: 8px; }
.progress-bar { height: 100%; width: 0; background: var(--brand); transition: width 0.2s; }
.file-options { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; }
.opt { display: flex; flex-direction: column; font-size: 0.85rem; color: var(--muted); gap: 2px; }
.opt input, .opt select { font: inherit; font-size: 1rem; color: var(--text); padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
.opt input { width: 80px; }
.opt.small input { width: 70px; }
.range-inputs { display: flex; gap: 10px; }
.file-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.file-price { font-weight: 600; text-align: right; }
.file-price.error-text { color: var(--danger); font-weight: 400; }
.bw-note { margin: 14px 0 0; color: var(--muted); font-size: 0.9rem; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 0.95rem; margin-bottom: 14px; }
.field input { font: inherit; font-weight: 400; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; }
.field input:focus, .opt input:focus, .opt select:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.field-hint { font-weight: 400; color: var(--muted); font-size: 0.85rem; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 0.95rem; }
.check input { width: 20px; height: 20px; margin-top: 2px; flex: none; }

.summary-line { display: flex; justify-content: space-between; align-items: baseline; font-size: 1.2rem; }
.summary-line strong { font-size: 1.6rem; }
.summary-sub { margin: 4px 0 14px; color: var(--muted); }
#turnstile { margin-bottom: 12px; }

.btn {
  font: inherit; font-weight: 600; padding: 10px 18px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: #fff; color: var(--text);
}
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-hover); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.big { width: 100%; padding: 14px; font-size: 1.1rem; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.link { background: none; border: none; padding: 0; font: inherit; color: var(--brand); text-decoration: underline; cursor: pointer; }
.link.remove { color: var(--muted); font-size: 0.9rem; }

.error { color: var(--danger); background: var(--danger-soft); padding: 10px 12px; border-radius: 8px; }
.notice { background: var(--notice-soft); border: 1px solid var(--notice-border); padding: 10px 12px; border-radius: 8px; }
.muted { color: var(--muted); }

.review-list { list-style: none; padding: 0; margin: 16px 0; border-top: 1px solid var(--border); }
.review-list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.review-list .meta { color: var(--muted); font-size: 0.9rem; }
.review-details { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 0 0 16px; }
.review-details dt { color: var(--muted); }
.review-details dd { margin: 0; overflow-wrap: anywhere; }
.actions { display: grid; grid-template-columns: 1fr 2fr; gap: 12px; margin-top: 16px; }

.done { text-align: center; }
.done-kicker { margin: 0; color: var(--muted); }
.code { font-size: 3rem; font-weight: 800; letter-spacing: 0.15em; margin: 0 0 12px; color: var(--brand); }

.site-footer { color: var(--muted); font-size: 0.9rem; padding-bottom: 32px; }

dialog { width: min(900px, 100vw - 32px); max-height: 90vh; padding: 0; border: none; border-radius: var(--radius); }
dialog::backdrop { background: rgba(0, 0, 0, 0.5); }
.preview-head { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; background: #fff; border-bottom: 1px solid var(--border); }
.preview-head h2 { margin: 0; font-size: 1rem; overflow-wrap: anywhere; }
.preview-pages { padding: 16px; background: var(--bg); display: grid; gap: 16px; justify-items: center; }
.preview-page { background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); max-width: 100%; }
.preview-page canvas { display: block; max-width: 100%; height: auto; }
.preview-label { font-size: 0.85rem; color: var(--muted); text-align: center; padding: 4px; }
.preview-page.skipped { opacity: 0.35; }

@media (max-width: 520px) {
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .actions { grid-template-columns: 1fr; }
  .file-thumb { width: 48px; height: 64px; }
  .seal { width: 44px; height: 44px; }
  .it-logo { height: 44px; }
  .brand { font-size: 1.15rem; }
  .library { font-size: 0.85rem; }
  h1 { font-size: 1.35rem; }
}
