.doc-page {
  --ink: #1d1b18;
  --ink-2: #2e2b27;
  --ink-3: #5c564d;
  --muted: #6c665c;
  --line: #e4dfd6;
  --line-2: #cbc4b8;
  --display: 'Instrument Serif', 'Times New Roman', serif;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --side: 20mm;
  --top: 29mm;
  --bottom: 22mm;
  --rail: 40mm;
  --fs: 13px;
  --lh: 1.6;
  --sec-gap: 10mm;
  position: relative;
  width: var(--pw);
  height: var(--ph);
  background: #fff;
  color: var(--ink);
  font-family: var(--body);
  font-size: var(--fs);
  line-height: var(--lh);
  font-feature-settings: 'ss01', 'cv11';
  overflow: hidden;
  box-sizing: border-box;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
  text-rendering: optimizeLegibility;
}
.doc-page *, .doc-page *::before, .doc-page *::after { box-sizing: border-box; }

.doc--minimal {
  --display: var(--body);
  --lh: 1.55;
  --sec-gap: 8mm;
}

.pg-head, .pg-foot {
  position: absolute;
  left: var(--side);
  right: var(--side);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6mm;
  font-size: 9px;
  letter-spacing: 0.02em;
  color: var(--ink-3);
  white-space: nowrap;
}
.pg-head { top: 11mm; min-height: 8mm; border-bottom: 0.25mm solid var(--line); padding-bottom: 2mm; }
.pg-foot { bottom: 10mm; height: 6mm; border-top: 0.25mm solid var(--line); padding-top: 2mm; }
.pg-brand { display: flex; align-items: center; gap: 2.5mm; flex: 0 1 auto; min-width: 0; max-width: 48%; }
.pg-logo { height: calc(6.5mm * var(--ls, 1)); max-width: calc(30mm * var(--ls, 1)); object-fit: contain; border-radius: calc(var(--lr, 0) * 3.25mm); flex: none; }
.pg-logo.mono { width: calc(6.5mm * var(--ls, 1)); }
.pg-studio { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 600; color: var(--ink); font-size: 10px; letter-spacing: 0.01em; }
.pg-studio--solo { font-family: var(--display); font-weight: 400; font-size: 16px; letter-spacing: 0; }
.doc--minimal .pg-studio--solo { font-weight: 650; font-size: 12px; letter-spacing: -0.01em; }
.pg-doc { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; text-align: right; text-transform: uppercase; letter-spacing: 0.14em; font-size: 9px; }
.dot { margin: 0 1.6mm; color: var(--line-2); }
.pg-foot > div:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.pg-foot > div:last-child { flex: none; font-variant-numeric: tabular-nums; }

.pg-body {
  position: absolute;
  top: var(--top);
  bottom: var(--bottom);
  left: var(--side);
  right: var(--side);
  overflow: hidden;
}
.doc-page.measuring .pg-body { bottom: auto; }
.atom { display: flow-root; }
.doc-page:not(.doc-invoice) .pg-body > .atom { padding-left: var(--rail); }
.doc-page .pg-body > .atom:has(> .title-block), .doc-page .pg-body > .atom:has(> .sec), .doc-page .pg-body > .atom:has(> .tr-wide) { padding-left: 0; }

.title-block { padding: 3mm 0 0; }
.eyebrow { font-size: 10px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent-ink); }
.doc-title { margin: 4mm 0 0; max-width: 165mm; font-family: var(--display); font-weight: 400; font-size: 53px; line-height: 1.03; letter-spacing: -0.01em; color: var(--ink); }
.doc-title.is-long { font-size: 37px; line-height: 1.08; }
.doc--minimal .doc-title { font-size: 40px; font-weight: 650; letter-spacing: -0.03em; line-height: 1.08; }
.doc--minimal .doc-title.is-long { font-size: 29px; }
.doc-sub { margin-top: 4mm; max-width: 150mm; font-size: 14px; line-height: 1.45; color: var(--ink-3); }
.accent-rule { width: 12mm; height: 0.6mm; margin: 8mm 0 0; background: var(--accent); }
.meta-grid { margin-top: 6mm; border-bottom: 0.25mm solid var(--line); }
.meta-item { display: grid; grid-template-columns: var(--rail) 1fr; align-items: baseline; padding: 2.1mm 0; border-top: 0.25mm solid var(--line); }
.lbl { font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.val { font-size: 13px; font-weight: 500; color: var(--ink); }

.sec { display: flex; align-items: baseline; margin: 0; padding: var(--sec-gap) 0 3.2mm; font-family: var(--display); font-weight: 400; font-size: 25px; line-height: 1.15; color: var(--ink); }
.sec-num { flex: none; width: var(--rail); font-family: var(--display); font-size: 25px; font-weight: 400; font-variant-numeric: tabular-nums; color: var(--accent-ink); }
.doc--minimal .sec { font-size: 17px; font-weight: 650; letter-spacing: -0.005em; padding-bottom: 2.6mm; }
.doc--minimal .sec-num { font-size: 17px; font-weight: 650; }
.pg-body > .atom:first-child .sec { padding-top: 2mm; }

.pg-body p { margin: 0 0 3mm; color: var(--ink-2); }
.pg-body .atom-split p { margin-bottom: 0; }
.pg-body p strong { color: var(--ink); font-weight: 600; }
.pg-body p.lead { padding-top: 6mm; font-family: var(--display); font-size: 20px; line-height: 1.4; color: var(--ink); }
.doc--minimal p.lead { font-size: 15px; line-height: 1.55; }
.pg-body .note { padding-top: 1mm; font-size: 11px; color: var(--ink-3); }
.ph { color: var(--muted) !important; font-style: italic; }
.pg-body a { color: var(--accent-ink); text-decoration: none; border-bottom: 0.2mm solid var(--accent-soft); overflow-wrap: anywhere; }

.li { display: grid; grid-template-columns: 5.5mm 1fr; padding: 0.9mm 0; color: var(--ink-2); }
.li-mark::before { content: '–'; font-weight: 500; color: var(--accent-ink); }
.li--num .li-mark::before { content: none; }
.li--num .li-mark { padding-top: 0.12em; font-size: 10px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--accent-ink); }
.li--yes .li-mark::before { content: '+'; }
.li--no .li-mark::before { content: '×'; color: var(--muted); }
.li--no .li-text { color: var(--ink-3); }

.qa { padding-bottom: 2.5mm; }
.qa--plain { padding-bottom: 0; }
.answer-line { height: 8mm; margin-left: 5.5mm; border-bottom: 0.25mm solid var(--line-2); }

.tr { display: grid; gap: 4mm; padding: 2.1mm 0; border-bottom: 0.25mm solid var(--line); align-items: baseline; color: var(--ink-2); }
.th { padding: 0 0 1.8mm; border-bottom: 0.3mm solid var(--ink); font-size: 9px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.atom-cont .th { padding-top: 1mm; }
.td.r { text-align: right; font-variant-numeric: tabular-nums; }
.tr:not(.th) .td:first-child { color: var(--ink); }
.num-cell { font-size: 10px; font-weight: 600; color: var(--accent-ink); }
.doc--minimal .tr { padding: 1.9mm 0; }

.totals { margin-left: auto; width: 78mm; padding-top: 3mm; }
.tot-row { display: flex; justify-content: space-between; gap: 4mm; padding: 1.4mm 0; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tot-row.muted { color: var(--muted); }
.tot-row.grand { margin-top: 1.5mm; padding-top: 3mm; border-top: 0.4mm solid var(--ink); align-items: baseline; color: var(--ink); font-weight: 600; }
.tot-row.grand span:last-child { font-family: var(--display); font-weight: 400; font-size: 27px; letter-spacing: -0.01em; }
.doc--minimal .tot-row.grand span:last-child { font-size: 19px; font-weight: 650; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 8mm; }
.col-lbl { margin-bottom: 2mm; padding-bottom: 1.6mm; border-bottom: 0.25mm solid var(--line); font-size: 9px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.party-name { font-weight: 600; color: var(--ink); }
.party-line { color: var(--ink-2); overflow-wrap: anywhere; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1.15fr; gap: 8mm; }
.kv { display: grid; grid-template-columns: 16mm 1fr; gap: 3mm; color: var(--ink-2); }
.kv span:first-child { color: var(--muted); }
.kv span:last-child { color: var(--ink); }
.parties { padding: 0 0 8mm; }
.pay { padding-top: 9mm; }
.pre { font-size: 12px; color: var(--ink-2); }

.sig-wrap { padding-top: var(--sec-gap); }
.sig-cols { padding-top: 4mm; }
.sig-line { height: 13mm; border-bottom: 0.3mm solid var(--ink); }
.sig-line--date { height: 9mm; width: 50%; }
.sig-cap { padding-top: 1mm; font-size: 9px; letter-spacing: 0.06em; color: var(--muted); }
.sig-name { padding-top: 3mm; font-weight: 600; color: var(--ink); }
.approve { padding-top: 5mm; }
.approve .col-lbl { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
.approve .sig-line { height: 7mm; }

.phase { display: grid; grid-template-columns: 10mm 1fr; padding: 2.4mm 0; border-bottom: 0.25mm solid var(--line); }
.phase-num { font-family: var(--display); font-size: 19px; line-height: 1.1; color: var(--accent-ink); }
.doc--minimal .phase-num { padding-top: 0.2em; font-size: 11px; font-weight: 650; }
.phase-title { font-weight: 600; color: var(--ink); }
.phase-desc { color: var(--ink-2); }

.tl { display: grid; padding: 2mm 0; }
.tl-track { position: relative; height: 5mm; }
.tl-track::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 0.3mm; background: var(--line-2); }
.tl-step:last-child .tl-track::before { right: auto; width: 2mm; }
.tl-dot { position: absolute; left: 0; top: 50%; width: 2.6mm; height: 2.6mm; margin-top: -1.3mm; border-radius: 50%; background: #fff; border: 0.5mm solid var(--accent); }
.tl-dot--end { background: var(--accent); }
.tl-date { padding-top: 2mm; font-size: 9px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-ink); }
.tl-name { padding: 0.6mm 3mm 0 0; font-size: 12px; line-height: 1.35; color: var(--ink); }
.vtl-row { display: grid; grid-template-columns: 5mm 24mm 1fr; align-items: baseline; padding: 1.6mm 0; border-bottom: 0.25mm solid var(--line); }
.vtl-dot { width: 2mm; height: 2mm; border-radius: 50%; background: var(--accent); }
.vtl-date { font-size: 9px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-ink); }

.signoff { padding-top: 12mm; }
.signoff-name { font-family: var(--display); font-size: 24px; line-height: 1.1; color: var(--ink); }
.doc--minimal .signoff-name { font-size: 15px; font-weight: 650; }
.signoff-role { padding-top: 1mm; font-size: 10px; color: var(--muted); }

.notice { margin-top: 6mm; padding: 3.5mm 4mm; border-left: 0.7mm solid var(--accent); background: var(--accent-soft); font-size: 12px; color: var(--ink-2); }
.notice-title { margin-bottom: 0.8mm; font-weight: 600; color: var(--accent-ink); }
.prio { font-size: 9px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; white-space: nowrap; }
.prio--high { color: var(--accent-ink); }
.prio--medium { color: var(--ink-2); }
.prio--low { color: var(--ink-3); }

.swatches { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3mm; padding: 1mm 0 4mm; }
.sw-chip { height: 15mm; margin-bottom: 2mm; border-radius: 1.2mm; box-shadow: inset 0 0 0 0.25mm rgba(0, 0, 0, 0.1); }
.sw-name { font-size: 11px; font-weight: 600; color: var(--ink); }
.sw-hex { font-size: 9px; font-variant-numeric: tabular-nums; color: var(--muted); }
.thanks { margin-top: var(--sec-gap); padding: 8mm 0 0; border-top: 0.25mm solid var(--line); }
.thanks-text { margin-bottom: 6mm; font-family: var(--display); font-size: 20px; line-height: 1.4; color: var(--ink); }
.doc--minimal .thanks-text { font-size: 14px; line-height: 1.55; }

.inv-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 8mm; padding-top: 3mm; }
.inv-due { flex: none; text-align: right; }
.inv-amount { margin: 1.5mm 0; font-family: var(--display); font-size: 45px; line-height: 1.05; font-variant-numeric: tabular-nums; color: var(--ink); }
.doc--minimal .inv-amount { font-size: 32px; font-weight: 650; letter-spacing: -0.02em; }
.doc-invoice .doc-sub { margin-top: 2mm; }
.doc-invoice .accent-rule { margin: 7mm 0; }

.pdf-stage { position: fixed; left: -100000px; top: 0; pointer-events: none; }

.measure-root { position: absolute; left: -10000px; top: 0; visibility: hidden; pointer-events: none; }

@media print {
  body:has(> .print-root) { background: #fff !important; margin: 0 !important; padding: 0 !important; }
  body:has(> .print-root) > *:not(.print-root) { display: none !important; }
  .print-root { display: block !important; }
  .print-root .doc-page { height: calc(var(--ph) - 0.6mm); box-shadow: none !important; margin: 0 !important; break-after: page; page-break-after: always; break-inside: avoid; }
  .print-root .doc-page:last-child { break-after: auto; page-break-after: auto; }
}
.print-root { display: none; }
