:root {
  --ink: #1c2b29; --muted: #57645f; --bg: #f7f2e9; --card: #fffdf9; --line: #e2d9c8;
  --brand: #1f4d47; --brand-dark: #153833; --accent: #b4532a; --gold: #e2a25a;
  --ok: #2c6e49; --ok-bg: #e4f1e7; --warn-bg: #fbeed5; --err: #9b2c1f; --err-bg: #fbe6e1; --lock: #8a8f8c;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r: 14px;
}
* { box-sizing: border-box; }
html { font-size: 112.5%; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--sans); color: var(--ink); background: var(--bg); line-height: 1.55; }
.wrap { width: 100%; max-width: 60rem; margin: 0 auto; padding: 0 1rem; }
main.wrap { padding-top: 1.5rem; padding-bottom: 3rem; min-height: 70vh; }
.is-family main.wrap { max-width: 46rem; }
h1, h2, h3, .h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: clamp(1.7rem, 5vw, 2.3rem); }
h2 { font-size: 1.3rem; margin-top: 1.75rem; }
.card > h2:first-child, .card h2:first-of-type, .stage-top h2, .overall-top h2 { margin-top: 0; }
h3, .h3 { font-size: 1.15rem; }
p { margin: 0 0 .9rem; }
a { color: var(--brand); text-underline-offset: .15em; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 1rem; top: 1rem; background: #fff; padding: .5rem 1rem; z-index: 10; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.muted { color: var(--muted); } .small { font-size: .86rem; } .right { text-align: right; } .center { text-align: center; } .grow { flex: 1; min-width: 0; }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 40rem; }
.center .lead { margin-inline: auto; }
.eyebrow { text-transform: uppercase; letter-spacing: .09em; font-size: .74rem; font-weight: 700; color: var(--accent); margin: 0 0 .35rem; }

.top { background: var(--brand); color: #f6efe2; }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-top: .7rem; padding-bottom: .7rem; }
.brand { display: flex; align-items: center; gap: .55rem; color: #f6efe2; text-decoration: none; font-family: var(--serif); font-size: 1.3rem; }
.brand b { color: var(--gold); font-weight: 600; }
.brand-mark { width: 1.7rem; height: 1.7rem; border-radius: 8px; background: #f6efe2 url(/static/favicon.svg) center/cover; }
.top nav { display: flex; align-items: center; gap: .25rem 1.1rem; flex-wrap: wrap; font-size: .95rem; }
.top nav a, .linkish { color: #f6efe2; text-decoration: none; padding: .35rem 0; }
.top nav a:hover, .linkish:hover { color: var(--gold); text-decoration: underline; }
.linkish { background: none; border: 0; font: inherit; cursor: pointer; }
.count { background: var(--gold); color: var(--brand-dark); border-radius: 99px; padding: 0 .45rem; font-size: .8rem; font-weight: 700; }
.foot { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-top: 1.2rem; padding-bottom: 2rem; border-top: 1px solid var(--line); font-size: .86rem; color: var(--muted); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1.25rem; margin: 0 0 1rem; box-shadow: 0 1px 0 rgba(31, 77, 71, .04); }
.narrow { max-width: 30rem; margin: 2rem auto; padding: 1.75rem; }
.list { list-style: none; padding: 0; margin: 0; }
.row { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.head-row { display: flex; gap: 1rem; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; margin-bottom: 1rem; }
.unread { border-left: 5px solid var(--gold); }
.prose p { max-width: 42rem; }

.flash { padding: .8rem 1rem; border-radius: 10px; margin: 0 0 1rem; border: 1px solid transparent; font-weight: 500; }
.flash-ok { background: var(--ok-bg); border-color: #b9d8c1; color: #1d4a31; }
.flash-error { background: var(--err-bg); border-color: #efc0b7; color: var(--err); }
.flash-info { background: var(--warn-bg); border-color: #ecd49f; color: #5f4310; font-weight: 400; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  padding: .6rem 1.1rem; min-height: 2.75rem; border-radius: 10px; border: 2px solid var(--brand); background: transparent; color: var(--brand); }
.btn:hover { background: #e9efe9; color: var(--brand-dark); }
.btn-primary { background: var(--brand); color: #fff; } .btn-primary:hover { background: var(--brand-dark); color: #fff; }
.btn-big { font-size: 1.08rem; padding: .8rem 1.5rem; min-height: 3.2rem; }
.btn-small { padding: .3rem .8rem; min-height: 2.2rem; font-size: .9rem; }
.btn-quiet { border-color: var(--line); color: var(--ink); font-weight: 500; }
.btn-row, .actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-start; }
.actions { margin-top: 1rem; }
.pad-top { padding-top: .9rem; }
details > summary { cursor: pointer; color: var(--brand); font-weight: 600; padding: .5rem 0; }

.field { margin: 0 0 1.15rem; border: 0; padding: 0; min-width: 0; }
label, legend { display: block; font-weight: 600; margin-bottom: .3rem; padding: 0; }
.opt { font-weight: 400; color: var(--muted); font-size: .88rem; }
.help { margin: -.1rem 0 .4rem; color: var(--muted); font-size: .92rem; }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=number], input[type=password], input:not([type]), select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff; border: 2px solid #b9b3a4; border-radius: 10px; padding: .65rem .8rem; min-height: 3rem; }
input.short, input[type=date] { max-width: 14rem; }
textarea { min-height: 5.5rem; resize: vertical; }
textarea.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8rem; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--gold); outline-offset: 1px; border-color: var(--brand); }
.check { display: flex; gap: .7rem; align-items: flex-start; font-weight: 500; padding: .55rem .7rem; border: 2px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; margin: 0 0 .45rem; }
.check input { width: 1.4rem; height: 1.4rem; margin: .1rem 0 0; flex: none; accent-color: var(--brand); }
.check:has(input:checked) { border-color: var(--brand); background: #f0f5f1; }
.confirm { margin: 1rem 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 0 1.25rem; }
.picks { display: grid; gap: .1rem; }

.bar { height: .6rem; background: #e9e1d1; border-radius: 99px; overflow: hidden; margin: .4rem 0 .3rem; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), #3d8a6e); border-radius: 99px; transition: width .4s ease; min-width: 0; }
.bar-big { height: 1rem; }
.overall-top { display: flex; justify-content: space-between; align-items: baseline; }
.pct { font-family: var(--serif); font-size: 1.8rem; color: var(--brand); font-variant-numeric: tabular-nums; }
.done-line { color: var(--ok); font-weight: 600; }
.stage-progress { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: 1rem; }
.stage-progress .bar { flex: 1 1 10rem; margin: 0; }
.saved { color: var(--ok); font-weight: 600; }

.pill, .todo { display: inline-block; font-size: .8rem; font-weight: 700; padding: .15rem .65rem; border-radius: 99px; background: #ece6d8; color: #4c4a40; white-space: nowrap; }
.pill-complete { background: var(--ok-bg); color: #1d4a31; }
.pill-active, .pill-open { background: #dfeaf0; color: #1e4a5e; }
.pill-submitted { background: var(--warn-bg); color: #6b4a0c; }
.pill-locked, .pill-draft { background: #ebe9e4; color: #5f625f; }
.todo { background: var(--accent); color: #fff; }

.formcard-top, .stage-top { display: flex; justify-content: space-between; gap: .8rem; align-items: flex-start; flex-wrap: wrap; }
.formcard-top h3, .formcard-top .h3 { margin-bottom: .15rem; }
.formcard-top p { margin: 0; }
.formcard-act { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.state { font-weight: 600; }
.state-open { color: #1e4a5e; } .state-submitted { color: #7a560f; } .state-complete { color: var(--ok); } .state-locked { color: var(--lock); }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: .6rem 0 0; }
.chip { font-size: .85rem; padding: .25rem .7rem .25rem .3rem; border-radius: 99px; border: 1.5px solid var(--line); background: #fff; display: flex; align-items: center; gap: .4rem; }
.chip em { font-style: normal; font-weight: 700; font-size: .75rem; color: var(--muted); }
.chip-n { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--brand); color: #fff; font: 700 .8rem var(--sans); flex: none; }
h2 .chip-n { width: 1.9rem; height: 1.9rem; font-size: .95rem; vertical-align: .15em; margin-right: .2rem; }
.chip-complete { border-color: #b9d8c1; background: var(--ok-bg); } .chip-complete .chip-n { background: var(--ok); }
.chip-submitted { border-color: #ecd49f; background: var(--warn-bg); } .chip-submitted .chip-n { background: #a8761a; }
.chip-locked { color: var(--lock); border-style: dashed; } .chip-locked .chip-n { background: #b5b8b4; }
.stage-locked { background: #f3efe6; border-style: dashed; }
.stage-locked h2 { color: var(--lock); } .stage-locked .chip-n { background: #b5b8b4; }
.locked-note { color: var(--muted); margin: 0; }
.stage-open { border-color: var(--brand); border-width: 2px; }

.answers { margin: 0; display: grid; gap: 0; }
.answers > div { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 1rem; padding: .55rem 0; border-top: 1px solid var(--line); }
.answers dt { color: var(--muted); font-size: .92rem; }
.answers dd { margin: 0; font-weight: 500; white-space: pre-wrap; overflow-wrap: anywhere; }
.answers dd.empty { color: var(--lock); font-weight: 400; font-style: italic; }
.qs { margin: 0; padding-left: 1.2rem; } .qs li { margin-bottom: .3rem; }

.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.table td { padding: .85rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.w-bar { min-width: 9rem; }
.strong { font-weight: 700; font-size: 1.05rem; }
.people { list-style: none; margin: 0 0 .5rem; padding: 0; }
.people li { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; flex-wrap: wrap; padding: .75rem 0; border-bottom: 1px solid var(--line); }
.file { display: block; width: 100%; padding: .7rem; border: 2px dashed #b9b3a4; border-radius: 10px; background: #fff; font: inherit; }
.people li.off { opacity: .6; }
.copybox { margin-top: .4rem; display: grid; gap: .2rem; } .copybox input { font-size: .8rem; min-height: 2.3rem; padding: .3rem .6rem; min-width: min(30rem, 70vw); }
.audit { list-style: none; margin: 0; padding: 0; font-size: .9rem; max-height: 26rem; overflow: auto; }
.audit li { display: grid; grid-template-columns: 10.5rem 1fr; gap: .8rem; padding: .4rem 0; border-bottom: 1px solid var(--line); }
.audit time { color: var(--muted); font-variant-numeric: tabular-nums; }

.sigpad { display: block; width: 100%; max-width: 640px; height: auto; aspect-ratio: 16 / 5; background: #fff; border: 2px dashed #b9b3a4; border-radius: 10px; touch-action: none; cursor: crosshair; margin-bottom: .5rem; }
.signed { padding: .8rem 0; border-top: 1px solid var(--line); }
.signed img { display: block; max-width: 16rem; max-height: 5rem; margin-bottom: .3rem; }

@media (max-width: 640px) {
  .answers > div { grid-template-columns: 1fr; gap: .1rem; }
  .audit li { grid-template-columns: 1fr; gap: 0; }
  .sticky-actions .btn { width: 100%; }
  .card { padding: 1rem; }
  .table th:nth-child(2), .table td:nth-child(2) { display: none; }
}
@media (prefers-reduced-motion: reduce) { .bar span { transition: none; } }
@media print { .top, .foot, .btn, nav { display: none !important; } body { background: #fff; } .card { border: 0; box-shadow: none; padding: 0; } }
