:root {
  --ink: #1d2433;
  --muted: #687082;
  --line: #dcd8cf;
  --paper: #faf8f4;
  --card: #ffffff;
  --seal: #8c1d2b;
  --seal-soft: #f6e9ea;
  --ok: #1f6f4a;
  --warn: #9a5b00;
  --radius: 10px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 var(--sans); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; }
small { display: block; color: var(--muted); font-size: 13px; font-weight: 400; }
.muted { color: var(--muted); }
.opt { color: var(--muted); font-weight: 400; font-size: 13px; }
.err { color: var(--seal); }
.warn { color: var(--warn); font-size: 14px; }
[hidden] { display: none !important; }

.masthead { border-bottom: 1px solid var(--line); background: var(--card); padding: 28px 0 22px; margin-bottom: 28px; }
.brand { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--seal); font-weight: 600; }
.masthead h1 { font-size: 34px; margin: 6px 0 8px; }
.lede { margin: 0; max-width: 680px; color: var(--muted); }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; padding-bottom: 60px; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }

.welcome { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 18px; }
.linkish { background: none; border: 0; color: var(--seal); text-decoration: underline; cursor: pointer; font: inherit; padding: 0 0 0 6px; }

.step { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 18px; }
.step h2 { font-size: 22px; margin: 0 0 6px; display: flex; align-items: center; gap: 10px; }
.step h3 { font-size: 17px; margin: 20px 0 10px; }
.stepnum { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--seal); color: #fff; font: 600 14px var(--sans); }
.hint { color: var(--muted); margin: 0 0 14px; font-size: 14px; }

label { display: block; font-weight: 600; font-size: 14px; }
input[type=text], input:not([type]), input[type=email], input[type=tel], input[type=number], select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 9px 11px; font: 15px var(--sans); color: var(--ink);
  border: 1px solid #c9c4b9; border-radius: 7px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--seal); outline-offset: 0; border-color: var(--seal); }
textarea { resize: vertical; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.grid .span2, .doc-fields .span2 { grid-column: span 2; }
@media (max-width: 600px) { .grid, .doc-fields { grid-template-columns: 1fr !important; } .grid .span2, .doc-fields .span2 { grid-column: auto; } }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; margin-top: 16px; }

.drop { display: grid; place-items: center; text-align: center; padding: 26px; border: 2px dashed #c9c4b9; border-radius: var(--radius); cursor: pointer; background: #fdfcfa; }
.drop.over, .drop:hover { border-color: var(--seal); background: var(--seal-soft); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-title { font-weight: 600; font-size: 16px; }
.drop-sub { color: var(--muted); font-weight: 400; font-size: 13px; }

.doc-list { display: grid; gap: 14px; margin-top: 16px; }
.doc { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; background: #fff; }
.doc-head { display: flex; gap: 12px; align-items: center; }
.doc-thumb { border: 1px solid var(--line); background: #f3f1ec; flex: none; }
.doc-title { flex: 1; min-width: 0; }
.doc-title strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-title .muted { font-size: 13px; }
.remove { border: 0; background: none; font-size: 24px; line-height: 1; color: var(--muted); cursor: pointer; padding: 4px 8px; }
.remove:hover { color: var(--seal); }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; font-size: 14px; padding: 0; margin-bottom: 6px; }
.pages { margin-top: 14px; padding: 12px 14px; border-radius: 8px; background: #f8f6f1; }
.pages.needs { background: var(--seal-soft); outline: 1px solid #e2c3c7; }
.radio { display: flex; gap: 8px; align-items: baseline; font-weight: 400; margin: 4px 0; }
.radio small { display: inline; margin-left: 4px; }
.pages-manual { margin-top: 12px; }
.thumbs { margin-top: 10px; }
.thumb-grid { display: flex; flex-wrap: wrap; gap: 10px; max-height: 420px; overflow-y: auto; padding: 2px; }
.thumb { border: 2px solid var(--line); border-radius: 6px; background: #fff; padding: 4px; cursor: pointer; display: grid; gap: 4px; justify-items: center; font: 12px var(--sans); color: var(--muted); }
.thumb canvas { display: block; background: #f3f1ec; width: 110px; min-height: 100px; }
.thumb.on { border-color: var(--seal); box-shadow: 0 0 0 2px var(--seal-soft); color: var(--seal); font-weight: 600; }
.doc-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin-top: 14px; }

.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .choice-row { grid-template-columns: 1fr; } }
.choice { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; cursor: pointer; font-weight: 400; }
.choice:has(input:checked) { border-color: var(--seal); background: var(--seal-soft); }
.choice input { margin-top: 4px; }

.rates-bar { display: flex; gap: 12px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.rates { display: grid; gap: 8px; margin-top: 10px; }
.rate { display: grid; grid-template-columns: auto 1fr auto auto; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; font-weight: 400; cursor: pointer; }
.rate:has(input:checked) { border-color: var(--seal); background: var(--seal-soft); }
.rate-days { color: var(--muted); font-size: 13px; }
.rate-price { font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 600px) { .rate { grid-template-columns: auto 1fr auto; } .rate-days { grid-column: 2; grid-row: 2; } }

.btn { display: inline-block; border-radius: 8px; padding: 10px 18px; font: 600 15px var(--sans); cursor: pointer; border: 1px solid transparent; text-decoration: none; }
.btn.primary { background: var(--seal); color: #fff; width: 100%; padding: 13px; font-size: 16px; }
.btn.primary:disabled { background: #b9b3a8; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--seal); border-color: var(--seal); }
.btn.secondary:disabled { opacity: .5; }

.summary { position: sticky; top: 20px; }
.summary-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.summary-card h2 { margin: 0 0 12px; font-size: 20px; }
.line { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dotted var(--line); font-size: 14px; }
.line span:first-child { min-width: 0; overflow-wrap: anywhere; }
.line span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.line.minor { color: var(--muted); padding-left: 10px; }
.total-row { display: flex; justify-content: space-between; font: 700 20px var(--serif); padding: 14px 0 6px; }
.fine { font-size: 12.5px; color: var(--muted); margin: 8px 0 14px; }
.pricing-note { margin: 14px 0 0; }
.errors { background: var(--seal-soft); border: 1px solid #e2c3c7; color: var(--seal); border-radius: 8px; padding: 8px 12px; font-size: 14px; margin-bottom: 12px; }
.errors ul { margin: 0; padding-left: 18px; }
.progress { margin-top: 12px; height: 26px; border-radius: 6px; background: #eee9df; position: relative; overflow: hidden; }
.progress .bar { position: absolute; inset: 0 auto 0 0; background: var(--seal); width: 0; transition: width .2s; }
.progress span { position: relative; display: block; text-align: center; font: 600 12px/26px var(--sans); color: #fff; mix-blend-mode: difference; }

/* status page */
.status-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; max-width: 760px; margin: 0 auto 60px; }
.badge { display: inline-block; white-space: nowrap; padding: 3px 10px; border-radius: 99px; font-size: 13px; font-weight: 600; background: #eee9df; }
.badge.new { background: #e8eefc; color: #23408e; }
.badge.processing { background: #fff1d6; color: var(--warn); }
.badge.completed { background: #e3f3ea; color: var(--ok); }
.badge.cancelled { background: #eee; color: #666; }
table.simple { width: 100%; border-collapse: collapse; font-size: 14px; }
table.simple th, table.simple td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.simple td.num, table.simple th.num { text-align: right; font-variant-numeric: tabular-nums; }
.notice { background: #e3f3ea; border: 1px solid #bfe0cc; color: var(--ok); padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; }
.badge.awaiting_docs { background: #f3e6ff; color: #5b2a86; }
.mail-address { white-space: pre-line; font: 600 15px/1.45 var(--sans); background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin: 8px 0; }
.mail-box { background: #faf5ff; border: 1px solid #e3d0f5; border-radius: var(--radius); padding: 14px 16px; margin-top: 14px; }
.mail-box h3 { margin: 0 0 4px; font-size: 16px; }
.add-row { display: flex; gap: 10px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.doc.mailed { border-left: 4px solid #8a5cc2; }
.doc-icon { width: 60px; height: 78px; display: grid; place-items: center; background: #f3e6ff; color: #5b2a86; border-radius: 4px; font-size: 26px; flex: none; }
