/* ---------- Library + letter page hero ---------- */
.page-hero { background: var(--sun); border-bottom: 3px solid var(--navy); padding: 64px 0 56px; }
.page-hero.small { padding: 40px 0 36px; }
.page-hero h1 { font-size: clamp(34px, 5vw, 56px); margin-bottom: 12px; }
.page-hero.small h1 { font-size: clamp(30px, 4.2vw, 46px); max-width: 860px; }
.page-hero p { font-size: 20px; font-weight: 600; max-width: 620px; }
.crumb { display: inline-block; font-weight: 800; text-decoration: none; margin-bottom: 14px; padding: 6px 14px; border-radius: 999px; background: rgba(255,255,255,.6); }
.crumb:hover { background: #fff; }
.facts { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.facts div { background: #fff; border: 2px solid var(--navy); border-radius: 14px; padding: 10px 16px; font-weight: 700; font-size: 17px; }
.facts span { display: block; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #1B5E8C; }

/* ---------- Library ---------- */
.search { display: block; margin-top: 28px; max-width: 560px; position: relative; }
.search input { width: 100%; font: 700 18px "Nunito"; padding: 16px 20px 16px 52px; border-radius: 16px; border: 3px solid var(--navy); box-shadow: 0 5px 0 var(--navy); background: #fff; color: var(--navy); }
.search input:focus { outline: 4px solid var(--sky); outline-offset: 2px; }
.search span { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); font-size: 20px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.chip { background: #fff; border: 2px solid var(--navy); border-radius: 999px; padding: 8px 16px; font-weight: 800; font-size: 16px; text-decoration: none; }
.chip:hover { background: var(--sky-soft); }
.stage { padding: 56px 0 0; scroll-margin-top: 80px; }
.stage:last-of-type { padding-bottom: 88px; }
.stage-head { display: flex; gap: 18px; align-items: center; margin-bottom: 24px; }
.stage-num { flex: none; width: 56px; height: 56px; border-radius: 50%; background: var(--navy); color: var(--sun); display: grid; place-items: center; font: 700 26px "Fredoka"; }
.stage-head h2 { font-size: clamp(28px, 3.5vw, 36px); }
.stage-head p { color: var(--muted); }
.lgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.lcard { background: #fff; border: 3px solid var(--navy); border-radius: 18px; padding: 22px 24px; box-shadow: 0 5px 0 var(--navy); display: flex; flex-direction: column; gap: 14px; text-decoration: none; transition: transform .12s ease, box-shadow .12s ease; }
.lcard:hover { transform: translateY(-3px); box-shadow: 0 8px 0 var(--navy); }
.lcard h3 { font-size: 21px; }
.lcard dl { display: grid; gap: 8px; flex: 1; }
.lcard dt { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: #1B5E8C; }
.lcard dd { font-size: 16px; }
.lcard .go { font-weight: 800; }
.empty { display: none; text-align: center; padding: 48px 0; font-size: 20px; font-weight: 700; color: var(--muted); }
[hidden] { display: none !important; }

/* ---------- Letter page ---------- */
.letter-layout { padding: 48px 20px 88px; display: grid; gap: 40px; }
.guide { background: var(--sky-soft); border-radius: 22px; padding: 30px 32px; border: 2px solid #BFE0F8; }
.guide h2, .tpl-bar h2 { font-size: 28px; margin-bottom: 14px; }
.guide p { margin-bottom: 14px; }
.guide ul { list-style: none; display: grid; gap: 10px; margin: 18px 0; }
.guide li { background: #fff; border-radius: 14px; padding: 14px 18px 14px 50px; position: relative; }
.guide li::before { content: "✓"; position: absolute; left: 16px; top: 13px; width: 24px; height: 24px; border-radius: 50%; background: var(--mint); color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 14px; }
.guide blockquote { background: #fff; border-left: 6px solid var(--sun); border-radius: 12px; padding: 14px 18px; margin: 10px 0 14px; font-style: italic; }
.guide table, .paper table { border-collapse: collapse; width: 100%; margin: 12px 0 18px; font-size: 16px; }
.guide th, .guide td, .paper th, .paper td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.guide th, .paper th { background: #F0F6FC; }
.guide td { background: #fff; }
.guide a, .paper a { color: #1B5E8C; font-weight: 800; }

.tpl-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 14px; }
.tpl-bar h2 { margin-bottom: 0; }
.tpl-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.btn.small { font-size: 16px; padding: 11px 18px; border-radius: 12px; cursor: pointer; }
.tpl-hint { color: var(--muted); margin: 10px 0 18px; }
.ph { background: var(--sun-soft); color: #7A5500; border-radius: 6px; padding: 0 3px; font-weight: 700; }

.paper { background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 12px 30px rgba(19,41,75,.10); padding: 56px 64px; font-family: Georgia, "Times New Roman", serif; font-size: 16.5px; line-height: 1.55; color: #1c2430; }
.paper p { margin-bottom: 14px; }
.paper ol, .paper ul { margin: 0 0 14px 24px; }
.paper li { margin-bottom: 6px; }
.paper li ul { margin-top: 6px; }
.paper strong { color: #0e1a2b; }
.paper table { font-family: Georgia, serif; overflow-x: auto; display: block; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pager a { background: #fff; border: 3px solid var(--navy); border-radius: 16px; padding: 16px 20px; text-decoration: none; font-weight: 800; box-shadow: 0 4px 0 var(--navy); }
.pager a:hover { background: var(--sky-soft); }
.pager small { display: block; font-size: 13px; color: #1B5E8C; text-transform: uppercase; letter-spacing: .05em; }
.pager .next { text-align: right; }

@media (max-width: 720px) {
  .guide { padding: 22px 18px; }
  .paper { padding: 28px 20px; font-size: 15.5px; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { text-align: left; }
  .letter-layout { padding: 32px 16px 64px; }
}

@media print {
  header, footer, .page-hero, .guide, .tpl-bar, .tpl-hint, .pager { display: none !important; }
  body { background: #fff; }
  .letter-layout { padding: 0; }
  .paper { box-shadow: none; border: 0; padding: 0; }
  .ph { background: none; color: inherit; }
}

/* ---------- Letter builder: fill-in form + coverages ---------- */
.builder { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 28px; align-items: start; }
.fill { position: sticky; top: 88px; max-height: calc(100vh - 110px); overflow-y: auto; background: #fff; border: 3px solid var(--navy); border-radius: 18px; box-shadow: 0 5px 0 var(--navy); padding: 20px; display: grid; gap: 18px; }
.fill h3 { font-size: 19px; }
.fill-head { display: grid; gap: 6px; }
.fill-status { font-weight: 800; font-size: 15px; color: #1B5E8C; }
.fill-status.done { color: #13805B; }
.fill-sec { display: grid; gap: 12px; border-top: 2px dashed var(--line); padding-top: 16px; }
.fill-help { color: var(--muted); font-size: 15px; }
.field { display: grid; gap: 5px; }
.field label { font-weight: 800; font-size: 14px; }
.field input, .field select, .field textarea, .cov-row input { font: 600 16px "Nunito", system-ui, sans-serif; color: var(--navy); width: 100%; padding: 10px 12px; border: 2px solid var(--line); border-radius: 10px; background: #fff; }
.field input:focus, .field select:focus, .field textarea:focus, .cov-row input:focus { outline: 3px solid var(--sky); outline-offset: 1px; border-color: var(--sky); }
.money-in, .cov-row { display: flex; align-items: center; gap: 6px; }
.money-in span, .cov-row .dollar { font-weight: 800; }
.field output.auto { display: block; padding: 10px 12px; border-radius: 10px; background: #E7F8F1; font-weight: 800; color: #13805B; }
.cov-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cov-chip { font: 700 14px "Nunito", system-ui, sans-serif; color: var(--navy); background: var(--sky-soft); border: 2px solid #BFE0F8; border-radius: 999px; padding: 7px 12px; cursor: pointer; }
.cov-chip[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.cov-chip[aria-pressed="true"]::before { content: "✓ "; }
.cov-rows { display: grid; gap: 8px; }
.cov-rows:empty { display: none; }
.cov-row { background: var(--sun-soft); border-radius: 12px; padding: 8px 10px; }
.cov-row .cov-name { flex: 1 1 45%; font-weight: 800; font-size: 15px; min-width: 0; }
.cov-row input.amt { flex: 0 1 120px; }
.cov-rm { flex: none; border: 0; background: none; font-size: 16px; cursor: pointer; color: var(--muted); padding: 4px 6px; border-radius: 8px; }
.cov-rm:hover { background: #fff; color: var(--navy); }
.cov-add { justify-self: start; font: 800 15px "Nunito", system-ui, sans-serif; color: #1B5E8C; background: none; border: 0; cursor: pointer; padding: 4px 0; }
.cov-totals { display: grid; gap: 6px; }
.cov-totals div { display: flex; justify-content: space-between; gap: 10px; background: #E7F8F1; border-radius: 10px; padding: 8px 12px; font-weight: 700; }
.fill-foot { border-top: 2px dashed var(--line); padding-top: 14px; }
.fill-foot .btn { font-family: inherit; }
.paper .ph.filled { background: none; color: inherit; font-weight: inherit; padding: 0; }
.paper table.cov-table { display: table; max-width: 460px; }
.paper .cov-table td:last-child, .paper .cov-table th:last-child { text-align: right; white-space: nowrap; }
.paper .cov-table tr.sum td { border-top: 2px solid #1c2430; }

@media (max-width: 960px) {
  .builder { grid-template-columns: minmax(0, 1fr); }
  .fill { position: static; max-height: none; }
}
@media print {
  .fill { display: none !important; }
  .builder { display: block; }
}
#loss-state { font: 700 16px "Nunito", system-ui, sans-serif; color: var(--navy); width: 100%; padding: 10px 12px; border: 2px solid var(--navy); border-radius: 10px; background: #fff; }
.state-info { display: grid; gap: 8px; font-size: 15px; }
.state-info a { color: #1B5E8C; font-weight: 800; }
.state-warn { background: var(--sun-soft); border: 2px solid var(--sun); border-radius: 10px; padding: 10px 12px; font-weight: 700; }

/* ---------- Free-copy watermark (print only) ---------- */
.print-wm { display: none; }
@media print {
  .print-wm { display: block; position: fixed; inset: 0; pointer-events: none; z-index: 10; }
  .print-wm img { position: fixed; top: 50%; left: 50%; width: 6in; height: 6in; transform: translate(-50%, -50%); }
  .print-wm span { position: fixed; bottom: 0; left: 0; right: 0; text-align: center; font: 600 9px "Nunito", sans-serif; color: #1B5E8C; }
}

/* ---------- RE: details in two columns ---------- */
.paper p.re-line { margin-bottom: 4px; }
.paper table.re-split { display: table; width: 100%; margin: 0 0 14px; font-size: inherit; }
.paper table.re-split td { border: 0; padding: 0 16px 0 0; width: 50%; vertical-align: top; background: none; }
@media (max-width: 520px) {
  .paper table.re-split, .paper table.re-split tr, .paper table.re-split td { display: block; width: 100%; }
}
