/* PDF · Modern invoice (A4: 794 × 1123 CSS px) */
.viewer{background:#E9E7E1;min-height:100vh}
.vbar{position:sticky;top:0;z-index:10;background:#fff;border-bottom:1px solid var(--line)}
.vbar-act{display:flex;align-items:center;gap:8px}
.vbar-in{max-width:1000px;margin:0 auto;padding:12px 24px;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px}
.vbar .ttl{display:flex;flex-direction:column}
.vbar .ttl b{font-size:15px;font-weight:600;letter-spacing:-.01em}
.vbar .ttl span{font-size:12px;color:var(--muted)}
.sheets-wrap{padding:32px 16px 64px;display:flex;justify-content:center;overflow:hidden}
.sheets{display:flex;flex-direction:column;gap:24px;transform-origin:top center}
.capturing .sheets{transform:none!important}

/* the sheet is paper: always light, even in dark theme */
.sheet{--ink:#12161F;--ink-2:#3F4550;--muted:#5B6270;--line:#E4E2DC;--field:#DCD9D2;--subtle:#FAF9F6;--navy:#0F1B3D;--green-bg:#E7F4EE;--green-d:#0B6447;--danger:#A32A12;--danger-bg:#FBEAE7;color-scheme:light}
.sheet{flex:0 0 auto;width:794px;height:1123px;padding:64px 72px 56px;background:#fff;font-family:var(--sans);color:var(--ink);font-size:12px;line-height:1.5;display:flex;flex-direction:column;position:relative;overflow:hidden;box-shadow:0 1px 3px rgba(15,27,61,.10),0 12px 32px rgba(15,27,61,.10)}
.sheet .band{position:absolute;left:0;top:0;right:0;height:8px;background:var(--navy)}
.sheet-main{flex:1 1 auto;min-height:0;overflow:hidden;display:flex;flex-direction:column}
.sheet .mono{font-family:var(--mono);font-variant-numeric:tabular-nums}
.s-head{display:flex;justify-content:space-between;align-items:flex-start;gap:24px}
.s-logo{width:48px;height:48px;border-radius:12px;background:var(--navy);display:flex;align-items:center;justify-content:center;color:#fff;font-weight:700;font-size:18px;letter-spacing:-.02em}
.s-logo-img{max-width:180px;max-height:64px;display:block;object-fit:contain;object-position:left top}
.s-from{display:flex;flex-direction:column;white-space:pre-line}
.s-from b{font-size:15px;font-weight:600}
.s-from span{color:var(--muted)}
.s-title{display:flex;flex-direction:column;align-items:flex-end;gap:10px;text-align:right}
.s-title h1{font-size:40px;line-height:1;font-weight:600;letter-spacing:-.03em;color:var(--navy)}
.s-title .no{font-family:var(--mono);font-size:13px;font-weight:500}
.s-pill{padding:3px 10px;border-radius:999px;background:#E8EEFB;color:#1E3FA8;font-size:11px;font-weight:600;letter-spacing:.04em;text-transform:uppercase}
.s-pill.paid{background:var(--green-bg);color:var(--green-d)}
.s-pill.overdue{background:var(--danger-bg);color:var(--danger)}
.s-pill.quote{background:#FDF1E3;color:#B4530A}
.s-div{height:1px;background:var(--field);margin:32px 0 24px;flex:0 0 auto}
.s-parties{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:24px}
.s-lbl{font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
.s-addr{display:flex;flex-direction:column;white-space:pre-line;overflow-wrap:anywhere}
.s-addr b{font-weight:600;font-size:13px}
.s-addr span{color:var(--ink-2)}
.s-meta{display:flex;flex-direction:column;gap:6px;background:var(--subtle);border:1px solid var(--line);border-radius:10px;padding:12px 14px}
.s-meta div{display:flex;justify-content:space-between;gap:8px}
.s-meta .k{color:var(--muted)}
.s-cont{display:flex;justify-content:space-between;align-items:baseline;padding-bottom:4px}
.s-cont b{font-size:18px;font-weight:600;letter-spacing:-.02em;color:var(--navy)}
table.s-lines{width:100%;border-collapse:separate;border-spacing:0;margin-top:32px}
.s-lines th{background:var(--navy);box-shadow:1px 0 0 var(--navy),-1px 0 0 var(--navy);color:#fff;text-align:left;padding:10px 12px;font-size:11px;font-weight:600;letter-spacing:.06em;text-transform:uppercase}
.s-lines th:first-child{border-radius:8px 0 0 8px;width:28px;box-shadow:1px 0 0 var(--navy)}
.s-lines th:last-child{border-radius:0 8px 8px 0;width:104px;box-shadow:-1px 0 0 var(--navy)}
.s-lines th.r,.s-lines td.r{text-align:right}
.s-lines td{padding:14px 12px;vertical-align:top;border-bottom:1px solid var(--line)}
.s-lines td.n{color:var(--muted)}
.s-lines .d1{font-weight:600;font-size:13px;overflow-wrap:anywhere}
.s-lines .d2{color:var(--muted);white-space:pre-line;overflow-wrap:anywhere}
.s-bottom{display:flex;justify-content:space-between;gap:32px;margin-top:28px}
.s-notes{flex:1;display:flex;flex-direction:column;gap:18px;padding-top:4px;min-width:0}
.s-notes span:not(.s-lbl){color:var(--ink-2);white-space:pre-line;overflow-wrap:anywhere}
.s-sum{flex:0 0 272px;display:flex;flex-direction:column;gap:8px}
.s-sum .rw{display:flex;justify-content:space-between;gap:8px}
.s-sum .k{color:var(--muted)}
.s-bal{margin-top:8px;border:1.5px solid var(--navy);border-radius:10px;background:#F3F5FA;padding:14px 16px;display:flex;justify-content:space-between;align-items:center;gap:8px}
.s-bal .s-lbl{font-weight:700;color:var(--navy);white-space:nowrap}
.s-bal .mono{white-space:nowrap}
.s-bal .mono{font-size:22px;font-weight:600;letter-spacing:-.02em;color:var(--navy)}

/* off-screen stage used for direct downloads */
.pdf-stage{position:fixed;left:-10000px;top:0;width:794px;pointer-events:none}
.pdf-stage .sheet{box-shadow:none}

.notfound{max-width:520px;margin:96px auto;padding:40px;text-align:center}

@media print{
  @page{size:A4 portrait;margin:0}
  /* print colours exactly as on screen (navy band, logo, table header, badges) even if
     "Background graphics" is switched off in the print dialog */
  *,*::before,*::after{-webkit-print-color-adjust:exact!important;print-color-adjust:exact!important;color-adjust:exact!important}
  html,body,.viewer{background:#fff!important;margin:0!important;padding:0!important}
  html{color-scheme:light}
  .vbar,.toast{display:none!important}
  .sheets-wrap{padding:0!important;display:block;overflow:visible}
  .sheets{transform:none!important;gap:0;display:block;height:auto!important;margin:0}
  .sheet{box-shadow:none!important;width:210mm;height:296.9mm;margin:0;break-after:page;page-break-after:always;break-inside:avoid}
  .sheet:last-child{break-after:auto;page-break-after:auto}
}
