/* Appeal letter generator styles. System fonts only: this page loads nothing from another host. */
:root {
  --ink: #0f172a; --body: #334155; --muted: #64748b; --line: #e2e8f0; --blue: #2563eb; --blue-dark: #1d4ed8;
  --wash: #dbeafe; --wash-line: #bfdbfe; --soft: #f8fafc; --warn-bg: #fffbeb; --warn-line: #f59e0b; --err: #b91c1c; --err-bg: #fef2f2;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: #fff; color: var(--ink);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; line-height: 1.55; }
a { color: var(--blue); }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 4px; }

.site-header { background: var(--wash); border-bottom: 1px solid var(--wash-line); padding: 12px 24px; }
.site-header .in { max-width: 760px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.brand img { width: 57px; height: 57px; }
.brand .t1 { font-size: 17px; font-weight: 700; color: var(--ink); line-height: 1.25; }
.brand .t2 { font-size: 13px; color: #475569; line-height: 1.25; }

main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 32px 24px 64px; }
h1 { font-size: clamp(26px, 5vw, 34px); line-height: 1.2; margin: 0 0 14px; }
h2 { font-size: 22px; line-height: 1.3; margin: 0 0 10px; }
.lead { font-size: 18px; color: var(--body); margin: 0 0 28px; }
.info { margin: 0 0 20px; }
.info h2 { font-size: 17px; margin: 0 0 4px; }
.info p { margin: 0; color: var(--body); }
[tabindex='-1']:focus { outline: none; }

.steps { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 24px; padding: 0; font-size: 13px; color: var(--muted); }
.steps li { display: flex; align-items: center; gap: 6px; }
.steps .num { width: 22px; height: 22px; border-radius: 999px; background: var(--line); color: var(--body); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; }
.steps .current { color: var(--ink); font-weight: 700; }
.steps .current .num { background: var(--blue); color: #fff; }
.steps .done .num { background: var(--wash-line); color: var(--ink); }

.help { color: var(--muted); font-size: 14px; margin: 2px 0 8px; }
.lead-help { font-size: 16px; margin: 0 0 20px; }
.notice { background: var(--soft); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin: 0 0 20px; font-size: 15px; }
.summary { background: var(--err-bg); border: 1px solid #fecaca; color: var(--err); border-radius: 8px; padding: 10px 14px; margin: 0 0 16px; font-weight: 600; }
.err { color: var(--err); font-size: 14px; margin: 4px 0 0; font-weight: 600; }

.field { margin: 0 0 18px; border: 0; padding: 0; min-width: 0; }
.field > label { display: block; font-weight: 600; margin: 0 0 4px; }
.field.check > label, .opt > label { display: flex; align-items: flex-start; gap: 10px; font-weight: 400; cursor: pointer; padding: 6px 0; }
.opt > label span, .field.check > label span { flex: 1; }
input[type='radio'], input[type='checkbox'] { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--blue); }
input[type='text'], input[type='date'], textarea { width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1px solid #94a3b8; border-radius: 8px; padding: 10px 12px; }
.invalid input, .invalid textarea { border-color: var(--err); }
fieldset { border: 0; padding: 0; margin: 0 0 18px; min-width: 0; }
legend { font-weight: 600; padding: 0; margin: 0 0 6px; }
.group { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px 6px; margin-bottom: 20px; }
.group .field { margin-left: 0; }
.group .field:not(.check) { margin-left: 30px; }
.radio .opt { margin: 0; }

.warning { background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 8px; padding: 12px 14px; margin: 0 0 18px; }
.warning p { margin: 0 0 6px; }
.gate { background: var(--soft); border: 1px solid var(--line); border-radius: 12px; padding: 24px; }

.btn { display: inline-block; font: inherit; font-weight: 600; font-size: 15px; padding: 12px 22px; border-radius: 8px; text-decoration: none; cursor: pointer; border: 2px solid var(--blue); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn-secondary { background: #fff; color: var(--blue); }
.btn-secondary:hover { background: var(--wash); }
.btn:disabled { background: #cbd5e1; border-color: #cbd5e1; color: #475569; cursor: not-allowed; }
.btn.busy { cursor: progress; }
.spin { display: inline-block; width: 1ch; margin-left: 0.6em; text-align: center; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Courier New', monospace; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.links { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 24px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 6px; }
.status { color: var(--body); font-size: 15px; margin: 8px 0; min-height: 1.4em; }

.letter-wrap { position: relative; border: 1px solid #94a3b8; border-radius: 8px; background: #fff; }
.letter-ta, .letter-mirror { font-family: ui-monospace, 'Cascadia Mono', Consolas, 'Liberation Mono', monospace; font-size: 14px; line-height: 20px; padding: 14px; white-space: pre-wrap; overflow-wrap: break-word; word-wrap: break-word; margin: 0; }
.letter-ta { position: relative; width: 100%; height: 560px; border: 0; background: transparent; resize: vertical; color: var(--ink); z-index: 1; }
.letter-mirror { position: absolute; inset: 0; overflow: hidden; color: transparent; pointer-events: none; z-index: 0; }
.letter-mirror mark { background: #fde68a; color: transparent; border-radius: 3px; }
.output { margin-top: 28px; background: var(--soft); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }
.output p { margin: 0 0 8px; }

.site-footer { border-top: 1px solid #cbd5e1; background: var(--soft); padding: 28px 24px; }
.site-footer .in { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.site-footer p { margin: 0; font-size: 12px; color: #475569; }
.site-footer .name { font-size: 13px; font-weight: 600; color: var(--ink); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.site-footer nav a { font-size: 12px; color: #475569; text-decoration: none; }
.site-footer a { color: #475569; }

/* Step 1: documents */
.drop { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; border: 2px dashed #94a3b8; border-radius: 12px; padding: 20px; margin: 0 0 16px; background: var(--soft); }
.drop.over { border-color: var(--blue); background: var(--wash); }
.drop-text { color: var(--body); }
.drop .help { flex: 1 1 100%; margin: 0; }
.docs { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; }
.doc { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.doc.error .doc-status { color: var(--err); font-weight: 600; }
.doc-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.doc-name { font-weight: 600; overflow-wrap: anywhere; }
.doc-status { font-size: 14px; color: var(--body); }
.doc progress { width: 100%; max-width: 320px; height: 8px; accent-color: var(--blue); }
.btn-small { font-size: 14px; padding: 6px 14px; flex: none; }

/* Step 2: one page of questions */
.block { margin: 0 0 30px; }
.block > h3 { font-size: 18px; margin: 0 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.from { color: #1e3a8a; background: var(--wash); border-radius: 6px; padding: 4px 10px; font-size: 13px; margin: 2px 0 6px; overflow-wrap: anywhere; }
.gate.inline { padding: 16px 18px; margin: 4px 0 8px; }
.gate.inline h3 { font-size: 17px; margin: 0 0 6px; }
.gate.inline p { margin: 0 0 8px; }

@media (max-width: 520px) {
  main { padding: 24px 16px 48px; }
  .btn { width: 100%; text-align: center; }
  .actions .btn, .nav .btn { flex: 1 1 100%; }
  .btn-small { width: auto; flex: none; }
  .group .field:not(.check) { margin-left: 0; }
}
@media print { .site-header, .site-footer, .nav, .actions, .steps { display: none; } }
