:root {
  --desk: #efece4;
  --ink: #14181f;
  --muted: #5b5f66;
  --line: #cfc9bb;
  --accent: #b5371a;
  --ok: #1d6b45;
  --sheet: #fffefb;
  --sans: "Avenir Next", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --doc: Arial, Helvetica, sans-serif;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--desk);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 16.5px; line-height: 1.5; }
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent); }
button, input, textarea, select { font: inherit; color: inherit; touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
[hidden] { display: none !important; }
.wrap { max-width: 1260px; margin: 0 auto; padding: 0 24px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 12px; background: var(--ink); color: #fff; padding: 8px 12px; z-index: 10; }

header.site .wrap, footer.site .wrap { display: flex; align-items: baseline; justify-content: space-between; gap: 10px 24px; flex-wrap: wrap; }
header.site .wrap { padding-top: 20px; padding-bottom: 16px; }
.brand { font-size: 25px; font-weight: 800; letter-spacing: -0.8px; text-decoration: none; }
.brand b { color: var(--accent); font-weight: 800; }
.site nav { display: flex; gap: 6px 20px; flex-wrap: wrap; }
.site nav a { text-decoration: none; color: var(--muted); font-size: 15px; font-weight: 600; padding: 4px 0; }
.site nav a[aria-current="page"] { color: var(--ink); box-shadow: 0 2px 0 var(--accent); }
footer.site { border-top: 1px solid var(--line); margin-top: 96px; }
footer.site .wrap { padding-top: 28px; padding-bottom: 40px; }
footer.site .brand { font-size: 20px; }

.start { padding: 30px 0 28px; max-width: 820px; }
h1 { font-size: clamp(32px, 5.2vw, 56px); line-height: 1.03; letter-spacing: -1.7px; margin: 0 0 14px; font-weight: 800; text-wrap: balance; }
.lead { font-size: 18px; color: var(--muted); margin: 0; max-width: 42em; }

.workspace { display: grid; grid-template-columns: minmax(0, 460px) minmax(0, 1fr); gap: 56px; align-items: start; border-top: 2px solid var(--ink); }
form section { padding: 22px 0 24px; border-bottom: 1px solid var(--line); counter-increment: part; }
form { counter-reset: part; }
form h2 { margin: 0 0 14px; font-size: 13px; letter-spacing: 1.4px; text-transform: uppercase; font-weight: 700; }
form h2::before { content: counter(part, decimal-leading-zero); color: var(--accent); margin-right: 10px; font-variant-numeric: tabular-nums; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field label, .choice legend { display: block; font-size: 14px; font-weight: 600; margin-bottom: 5px; padding: 0; }
input[type="text"], textarea, select { width: 100%; min-height: 46px; padding: 10px 12px; font-size: 16px; background: var(--sheet); border: 1px solid var(--line); border-radius: 4px; font-variant-numeric: tabular-nums; transition: border-color 0.15s ease; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%); background-position: calc(100% - 18px) 20px, calc(100% - 12px) 20px; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 34px; }
textarea { resize: vertical; line-height: 1.4; display: block; }
input[type="text"]:hover, textarea:hover, select:hover { border-color: var(--muted); }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
input::placeholder, textarea::placeholder { color: #93949a; }
#f-fin { text-transform: uppercase; letter-spacing: 0.6px; }
.hint { font-size: 13.5px; color: var(--muted); margin: 5px 0 0; }
.error { font-size: 13.5px; color: var(--accent); margin: 5px 0 0; font-weight: 600; }
.error:empty { display: none; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.choice + .grid, .grid + .choice, .choice + .choice, .grid + .field, .field + .grid { margin-top: 16px; }
.segments { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
.segments label { position: relative; margin: 0; cursor: pointer; }
.segments input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.segments span { display: flex; align-items: center; min-height: 46px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 4px; background: var(--sheet); font-size: 15px; font-weight: 600; transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease; }
.segments input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.segments input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.check { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; padding: 7px 0; font-size: 15.5px; cursor: pointer; }
input[type="checkbox"] { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--ink); cursor: pointer; }

button { cursor: pointer; border: 1.5px solid var(--accent); background: var(--accent); color: #fff; border-radius: 4px; padding: 10px 16px; min-height: 46px; font-size: 15.5px; font-weight: 700; transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease; }
button:hover:not(:disabled) { background: var(--ink); border-color: var(--ink); }
button.secondary { background: transparent; border-color: var(--ink); color: var(--ink); }
button.secondary:hover:not(:disabled) { color: #fff; }
button:disabled { opacity: 0.35; cursor: not-allowed; }
button.link, .analytics-settings { border: 0; background: none; color: var(--muted); padding: 0; min-height: 32px; font-weight: 400; font-size: inherit; text-decoration: underline; text-underline-offset: 3px; }
button.link:hover:not(:disabled), .analytics-settings:hover { background: none; color: var(--accent); }
#reset { margin-top: 14px; font-size: 15px; }

.pads { display: grid; grid-template-columns: 1fr; gap: 16px; }
.pad p { margin: 0 0 5px; font-size: 14px; font-weight: 600; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.pad canvas { display: block; width: 100%; aspect-ratio: 3 / 1; background: var(--sheet); border: 1px dashed var(--muted); border-radius: 4px; touch-action: none; cursor: crosshair; }
.pad.is-signed canvas { border-style: solid; border-color: var(--ink); }
.pad button { visibility: hidden; }
.pad.is-signed button { visibility: visible; }

.output { position: sticky; top: 0; align-self: start; container-type: inline-size; min-width: 0; }
.output-inner { padding-top: 18px; display: flex; flex-direction: column; max-height: 100vh; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; }
.sheet-label { margin: 0; font-size: 13px; letter-spacing: 1.4px; text-transform: uppercase; font-weight: 700; }
.exports { display: flex; gap: 8px; flex-wrap: wrap; }
.status { margin: 10px 0 0; font-size: 15px; font-weight: 600; color: var(--muted); }
.status[data-state="ready"] { color: var(--ok); }
.status[data-state="error"] { color: var(--accent); }
#export-note:empty { display: none; }
.sheet { margin: 14px 0 24px; background: var(--sheet); color: #111; font-family: var(--doc); font-size: max(12px, 1.62cqi); line-height: 1.4; padding: 7cqi 7.5cqi 8cqi 8.5cqi; box-shadow: 0 1px 0 rgba(20, 24, 31, 0.08), 0 18px 40px -18px rgba(20, 24, 31, 0.4); overflow-y: auto; min-height: 0; overflow-wrap: anywhere; animation: sheet-in 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.sheet > * { transition: opacity 0.25s ease; }
.sheet.is-example > * { opacity: 0.5; }
.sheet p { margin: 0 0 0.7em; }
.c-title { font-size: 1.5em; line-height: 1.15; margin: 0 0 0.2em; font-weight: 700; letter-spacing: 0; }
.c-sub { color: #444; margin-bottom: 1.4em !important; }
.sheet section { border-top: 1px solid #999; padding-top: 0.6em; margin-bottom: 0.9em; }
.sheet h3 { font-size: 1.08em; margin: 0 0 0.5em; }
.sheet h4 { font-size: 1em; margin: 0.6em 0 0.3em; }
.sheet dl { margin: 0 0 0.8em; }
.sheet dl div { display: grid; grid-template-columns: 42% 1fr; gap: 0 1em; padding: 0.12em 0; }
.sheet dt { color: #333; }
.sheet dd { margin: 0; font-weight: 700; }
.c-blank { display: block; border-bottom: 1px solid #777; height: 1.2em; }
li .c-blank { display: inline-block; width: 55%; vertical-align: bottom; }
.c-checks { list-style: none; margin: 0 0 0.8em; padding: 0; }
.c-checks li { position: relative; padding: 0.1em 0 0.25em 1.7em; }
.c-checks li:not(.c-line)::before { content: ""; position: absolute; left: 0; top: 0.2em; width: 0.85em; height: 0.85em; border: 1px solid #111; }
.c-checks li.on::after { content: "×"; position: absolute; left: 0.07em; top: -0.17em; font-size: 1.25em; line-height: 1; }
.c-line { border-bottom: 1px solid #777; height: 1.7em; margin: 0 0 0 1.7em !important; padding: 0 !important; }
p.c-line { margin-left: 0 !important; }
.c-place { margin-top: 1.6em !important; font-weight: 700; }
.c-sigs { display: grid; grid-template-columns: 1fr 1fr; gap: 6%; }
.c-sig { height: 5.2em; border-bottom: 1px solid #111; display: flex; align-items: flex-end; }
.c-sig svg { height: 100%; max-width: 100%; }
.c-sigs p { font-size: 0.82em; margin-top: 0.3em; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(14px); } }

.notice { color: var(--muted); border-left: 3px solid var(--line); padding-left: 14px; }
.next { margin-top: 72px; border-top: 2px solid var(--ink); padding-top: 26px; transition: border-color 0.4s ease; scroll-margin-top: 12px; }
.next.is-current { border-top-color: var(--accent); }
.next > h2 { font-size: clamp(26px, 3.4vw, 38px); letter-spacing: -0.9px; line-height: 1.1; margin: 0 0 26px; font-weight: 800; }
.next ol { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px; }
.next li { counter-increment: step; }
.next li::before { content: counter(step, decimal-leading-zero); display: block; font-size: 13px; font-weight: 700; letter-spacing: 1.4px; color: var(--accent); margin-bottom: 8px; font-variant-numeric: tabular-nums; }
.next h3 { margin: 0 0 8px; font-size: 19px; line-height: 1.25; letter-spacing: -0.2px; }
.next p { margin: 0 0 10px; color: var(--muted); font-size: 15.5px; }
details { border-top: 1px solid var(--line); padding: 10px 0; }
summary { cursor: pointer; font-weight: 600; font-size: 15.5px; min-height: 28px; }
summary:hover { color: var(--accent); }
details p { margin: 8px 0 2px; }

.article { max-width: 740px; margin-top: 80px; }
.article.page { margin-top: 40px; }
.article h1 { font-size: clamp(31px, 5vw, 46px); }
.article h2 { font-size: 27px; line-height: 1.15; letter-spacing: -0.6px; margin: 52px 0 12px; font-weight: 800; }
.article h3 { font-size: 18.5px; margin: 30px 0 8px; }
.article p, .article ul, .article ol, .article dl { margin: 0 0 14px; }
.article ul { padding-left: 20px; }
.article ol { padding-left: 22px; }
.article li { margin-bottom: 5px; }
table { border-collapse: collapse; width: 100%; margin: 18px 0; font-size: 15px; font-variant-numeric: tabular-nums; }
caption { text-align: left; color: var(--muted); font-size: 14px; padding-bottom: 8px; }
th, td { text-align: left; padding: 8px 14px 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: break-word; }
thead th { font-size: 12.5px; letter-spacing: 0.8px; text-transform: uppercase; color: var(--muted); border-bottom-color: var(--ink); }
td:last-child, th:last-child { padding-right: 0; }
.article table { display: block; overflow-x: auto; max-width: 100%; }
.article { overflow-x: clip; }
.article blockquote { margin: 0 0 14px; padding: 14px 18px; background: var(--sheet); border-left: 3px solid var(--ink); font-family: var(--doc); font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.guide .lead { margin-bottom: 26px; }
.crumbs { margin: 0 0 10px; font-size: 13px; letter-spacing: 1.4px; text-transform: uppercase; font-weight: 700; }
.crumbs a { text-decoration: none; color: var(--accent); }
.meta { font-size: 13.5px; color: var(--muted); margin: 0 0 22px; }
.guide-links { list-style: none; padding: 0 !important; border-top: 1px solid var(--line); }
.guide-links li { border-bottom: 1px solid var(--line); margin: 0; padding: 12px 0; }
.guide-links a { font-weight: 700; text-decoration: none; }
.guide-links span { display: block; color: var(--muted); font-size: 15px; }
.changes { list-style: none; padding: 0 !important; }
.changes time { font-weight: 700; margin-right: 8px; }
.sample { background: var(--sheet); font-family: var(--doc); font-size: 13.5px; line-height: 1.4; padding: 26px 28px; box-shadow: 0 1px 0 rgba(20, 24, 31, 0.08); overflow-wrap: anywhere; }
.sample h2 { margin: 0 0 4px !important; font-size: 20px !important; letter-spacing: 0 !important; }
.sample h3 { margin: 0 0 6px !important; font-size: 14.5px !important; }
.sample section { border-top: 1px solid #999; padding-top: 8px; margin-bottom: 12px; }
.sample dl div { display: grid; grid-template-columns: 42% 1fr; gap: 0 14px; }
.sample dd { margin: 0; font-weight: 700; }
.sample p { margin: 0 0 9px !important; }

.analytics-consent { position: fixed; left: 16px; right: 16px; bottom: 16px; max-width: 560px; margin: 0 auto; background: var(--ink); color: #fff; padding: 16px 18px; border-radius: 6px; z-index: 20; font-size: 15px; box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.5); }
.analytics-consent p { margin: 0 0 12px; }
.analytics-consent .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.analytics-consent button.secondary { border-color: #fff; color: #fff; }
footer .notice { flex-basis: 100%; margin: 0; }
footer .notice:empty { display: none; }

@media (max-width: 980px) {
  .workspace { grid-template-columns: 1fr; gap: 0; }
  .output { position: static; }
  .output-inner { max-height: none; }
  .sheet { max-height: 70vh; }
  .next ol { grid-template-columns: 1fr; gap: 26px; }
}
@media (max-width: 520px) {
  .wrap { padding: 0 16px; }
  .grid { grid-template-columns: 1fr; }
  .segments { grid-template-columns: 1fr 1fr; }
  .exports { width: 100%; }
  .exports button { flex: 1 1 auto; }
  .sheet dl div, .sample dl div { grid-template-columns: 1fr; }
  .article { margin-top: 56px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media print { header.site, footer.site, form, .toolbar, .status, .next, .article, .analytics-consent { display: none !important; } .workspace { display: block; border: 0; } .sheet { box-shadow: none; max-height: none; overflow: visible; } body { background: #fff; } }
