/* The free QR invoice (frontend/qr-invoice). Layout only: colours, elevation, buttons, fields, the segmented
   toggle, the switch and the disclosure come from tokens.css and ui.css.

   The tool is the page: a workspace right under the site header, as wide as the header (--site-width). From 1024 px
   the form stands on the left and the preview on the right, half and half; the preview keeps to the window's height,
   so the whole A4 sheet is in view beside the form. Below 1024 px one column: the preview opens over the form
   ("Preview"). The form lies on the page itself (no card): three short blocks divided by hairlines, one fold for
   everything else, one primary button kept in view at the foot.

   Speed: the sheet contains its own layout and paint, and the help and the site footer below the fold are not
   rendered until they come near the window, so a keystroke repaints only what it changes. */

.qri-page .visually-hidden {
    position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.qri-page {
    --qri-desk: #e4ecef;
    --qri-gutter: 24px;
}
:root[data-theme="dark"] .qri-page { --qri-desk: #0e1a21; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .qri-page { --qri-desk: #0e1a21; } }

.qri-unavailable { padding-block: 40px 64px; }
.qri-unavailable h1 { margin: 0 0 16px; font-size: clamp(26px, 3vw, 34px); }
.qri-unavailable p, .qri-noscript {
    margin: 0 0 24px; padding: 18px 20px; border-radius: 14px; background: var(--amber-tint); color: var(--ink); font-size: 16px;
}

/* ---------- the workspace ---------- */
.qri-work { box-sizing: border-box; width: min(var(--site-width, 1400px), calc(100% - 2 * var(--qri-gutter))); margin: 0 auto; }
.qri-side { min-width: 0; padding-top: 22px; }

/* The title, one quiet line, the two kinds of document */
.qri-head { margin-bottom: 4px; }
.qri-page .qri-head h1 { margin: 0 0 10px; font-size: 26px; font-weight: 650; line-height: 1.2; letter-spacing: -.02em; color: var(--ink); }
.qri-head__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; }
.qri-quiet { margin: 0; font-size: 14.5px; line-height: 1.45; color: var(--muted); }
.qri-help-link { margin-left: 6px; color: var(--accent-text); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.qri-help-link:hover { color: var(--ink); }
.qri-modes button { min-width: 0; }

/* What one mode shows and the other does not */
.qri[data-mode="slip"] [data-invoice-only], .qri[data-mode="invoice"] [data-slip-only] { display: none !important; }

/* ---------- the blocks ---------- */
.qri-form { min-width: 0; }
.qri-block { min-width: 0; padding: 16px 0 18px; border-top: 1px solid var(--line); }
.qri-block[data-block="creditor"] { border-top: 0; }
.qri-page .qri-q { display: flex; align-items: baseline; gap: 8px; margin: 0 0 10px; font-size: 17px; font-weight: 650; line-height: 1.3; letter-spacing: -.01em; color: var(--ink); }
.qri-optional { font-size: 13.5px; font-weight: 500; letter-spacing: 0; color: var(--muted); }
/* A question inside a block ("Which account should the money go to?", "And where is your business?") */
.qri-ask { display: block; margin: 14px 0 6px; font-size: 15px; font-weight: 600; line-height: 1.35; color: var(--ink); }

.qri-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.qri-address .qri-fields { grid-template-columns: 8.5em minmax(0, 1fr); }
.qri-fields > * { min-width: 0; }
.qri-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.qri-field--wide, .qri-fields > .qri-field--wide { grid-column: 1 / -1; }
.qri-field__label { font-size: 14px; font-weight: 600; color: var(--ink); }
.qri-field :is(input, select), .qri-line :is(input, select) { width: 100%; }
.qri-page .qri :is(input:not([type="checkbox"]):not([type="file"]), select) { min-height: 46px; }
.qri-field__hint { font-size: 13.5px; line-height: 1.45; color: var(--muted); }
/* Hints that help only while a field is being filled in ("Your IBAN is in your e-banking") */
.qri-field--focus-hint .qri-field__hint { display: none; }
.qri-field--focus-hint:focus-within .qri-field__hint { display: block; }
.qri-error { font-size: 14px; line-height: 1.45; font-weight: 600; color: var(--red-text, #b42318); }
.qri-error:empty, .qri-note:empty { display: none; }
:root[data-theme="dark"] .qri-error { color: #ff8a8a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .qri-error { color: #ff8a8a; } }
.qri-page [aria-invalid="true"] { border-color: var(--red, #d92d20) !important; }

/* The name a block asks for */
.qri-page .qri-field--big input { min-height: 50px; padding: 12px 16px; border-radius: 12px; font-size: 17px; }

/* What the API says under a field: the bank under the IBAN, the register under the VAT number */
.qri-note { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; font-size: 14.5px; line-height: 1.45; font-weight: 600; color: var(--ink); }
.qri-note__ok { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); }
.qri-note__ok::before {
    content: "\2713"; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%;
    background: var(--ok-tint); color: var(--accent-text); font-size: 12px; font-weight: 800;
}
.qri-linkish {
    padding: 0; border: 0; background: none; color: var(--accent-text); font: inherit; font-weight: 600;
    text-decoration: underline; text-underline-offset: 3px; cursor: pointer; text-align: left;
}
.qri-linkish:hover { color: var(--ink); }
.qri-linkish[hidden] { display: none; }

/* ---------- a party: the name, then the card or the address ---------- */
/* A picked or remembered party: its card stands where the name field was (one look, one word to change it). */
.qri-field[hidden] { display: none; }
.qri-card {
    display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 2px 12px; align-items: start; padding: 10px 14px;
    border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
}
.qri-card[hidden] { display: none; }
.qri-card__icon {
    display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px;
    background: var(--surface-2); color: var(--accent-text);
}
/* The name and the two words to change it on the first line; the address and the small print run under both. */
.qri-card__body { display: contents; }
.qri-card__body p { margin: 0; }
.qri-card__icon { grid-row: 1 / span 3; }
.qri-card__name { grid-column: 2; grid-row: 1; font-size: 16px; font-weight: 650; line-height: 1.35; color: var(--ink); overflow-wrap: anywhere; }
.qri-card__lines, .qri-card__meta { grid-column: 2 / -1; min-width: 0; }
.qri-card__lines { font-size: 14.5px; line-height: 1.45; color: var(--ink-2); }
.qri-card__meta { font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.qri-card__lines:empty { display: none; }
.qri-card__meta:has(> [data-card-meta]:empty):has(> [data-card-source][hidden]) { display: none; }
.qri-card__source { display: block; }
.qri-card__source[hidden] { display: none; }
.qri-card__actions { grid-column: 3; grid-row: 1; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 2px 14px; margin: 0; padding-top: 1px; font-size: 14.5px; }
.qri-address[hidden] { display: none; }
.qri-address .qri-ask { margin-top: 12px; }
.qri-country { gap: 0; }
.qri-country__link { margin: 0; font-size: 14px; }
.qri-country__link[hidden], .qri-country__field[hidden] { display: none; }
.qri-country__field { max-width: 22em; }
.qri-remembered { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 8px 0 0; font-size: 13.5px; color: var(--muted); }
.qri-remembered[hidden] { display: none; }

/* ---------- what is charged ---------- */
.qri-lines { display: flex; flex-direction: column; gap: 8px; }
.qri-line-list { display: flex; flex-direction: column; gap: 8px; }
.qri-lines__head, .qri-line {
    display: grid; gap: 8px; align-items: start;
    grid-template-columns: minmax(0, 1fr) 64px 108px 96px 36px;
}
.qri-lines__head { font-size: 13px; font-weight: 600; color: var(--muted); }
.qri-lines__total-head { text-align: right; }
.qri-lines__head [hidden], .qri-line [hidden] { display: none; }
.qri-line label { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.qri-line__total { align-self: center; justify-self: end; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); white-space: nowrap; }
.qri-line__remove {
    display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 46px; border: 0; border-radius: 10px;
    background: transparent; color: var(--muted); cursor: pointer;
}
.qri-line__remove:hover { background: var(--neutral-soft); color: var(--ink); }
/* A different VAT rate per line (asked for under "Rate for all lines"): one more column. */
.qri[data-vat="1"] :is(.qri-lines__head, .qri-line) { grid-template-columns: minmax(0, 1fr) 60px 100px 104px 88px 36px; }
/* The empty line at the end is where the next one is typed: nothing to remove yet. */
.qri-line.is-next .qri-line__remove { visibility: hidden; }
.qri-line.is-next .qri-line__qty input { color: var(--muted); }

.qri-totals { display: grid; gap: 4px; max-width: 320px; margin: 10px 44px 0 auto; padding: 0; }
.qri-totals[hidden] { display: none; }
.qri-totals div { display: flex; justify-content: space-between; gap: 16px; }
.qri-totals div[hidden] { display: none; }
.qri-totals .qri-totals__vat { display: grid; gap: 4px; }
.qri-totals .qri-totals__vat:empty { display: none; }
.qri-totals dt, .qri-totals dd { margin: 0; font-size: 14.5px; color: var(--ink-2); }
.qri-totals dd { font-variant-numeric: tabular-nums; }
.qri-totals__grand { padding-top: 6px; border-top: 1px solid var(--line-strong); }
.qri-totals__grand :is(dt, dd) { font-size: 17px; font-weight: 700; color: var(--ink); }
.qri-totals__included :is(dt, dd) { font-size: 13.5px; color: var(--muted); }
/* While a line is still being typed (no price yet), the last figures the API worked out stay where they are, lighter,
   until its next answer: nothing jumps away and back while the visitor types. */
.qri-page :is(.qri-totals, .qri-sketch__totals, .qri-sketch__amount).is-stale { opacity: .45; }

.qri-vat { display: flex; flex-direction: column; gap: 2px; margin-top: 12px; }
.qri-vat__hint { margin-left: 56px; font-size: 13.5px; line-height: 1.45; color: var(--muted); }
.qri-vat-fields { margin-top: 10px; }
.qri-vat-fields[hidden] { display: none; }
.qri-switch { display: flex; align-items: center; gap: 12px; min-height: 40px; font-size: 15.5px; font-weight: 600; color: var(--ink); cursor: pointer; }
.qri-vat-fields .qri-switch { font-size: 14.5px; }

/* ---------- the amount alone ---------- */
.qri-amount { display: flex; align-items: flex-start; gap: 10px; }
.qri-amount .qri-field { flex: 1 1 auto; max-width: 300px; }
.qri-amount__currency {
    display: inline-flex; align-items: center; justify-content: center; min-width: 56px; min-height: 46px; padding: 0 10px; box-sizing: border-box;
    border-radius: 10px; background: var(--neutral-soft); color: var(--ink); font-size: 15px; font-weight: 700;
}
.qri-amount .qri-field__label { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- everything else: one fold ---------- */
.qri-more { margin: 4px 0 0; border-top: 1px solid var(--line); }
.qri-more > summary {
    display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; list-style: none; cursor: pointer;
}
.qri-more > summary::-webkit-details-marker { display: none; }
.qri-more > summary::marker { content: ''; }
.qri-more > summary:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: 10px; }
.qri-more__text { display: flex; flex-wrap: wrap; align-items: baseline; gap: 1px 12px; min-width: 0; }
.qri-more__title { font-size: 15.5px; font-weight: 650; color: var(--ink); }
.qri-more__hint { font-size: 13.5px; line-height: 1.4; color: var(--muted); }
.qri-more .accordion__icon { width: 28px; height: 28px; }
.qri-more__fields { padding: 4px 0 16px; }
.qri-currency { align-self: flex-start; }
.qri-currency button { min-width: 64px; min-height: 40px; }
.qri-reference .qri-fields { gap: 12px 14px; }
.qri-reference-kind { margin: 0 0 8px; font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.qri-reference-kind[hidden], .qri-reference [hidden] { display: none; }
.qri-reference-shown { margin-top: 8px; }
.qri-logo__row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.qri-logo__preview { max-width: 160px; max-height: 56px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.qri-logo__choose { position: relative; cursor: pointer; }

/* ---------- the button that stays in view ---------- */
.qri-bar {
    position: sticky; bottom: 0; z-index: 6; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px;
    margin: 0 calc(-1 * var(--qri-gutter)); padding: 12px var(--qri-gutter) calc(14px + env(safe-area-inset-bottom, 0px));
    background: var(--bg); border-top: 1px solid var(--line);
}
.qri-bar__text { flex: 1 1 260px; min-width: 0; }
.qri-bar__text:has(.qri-sentence:empty):has(.qri-status:empty) { display: none; }
.qri-sentence { margin: 0; font-size: 14.5px; font-weight: 500; line-height: 1.45; color: var(--muted); }
.qri-sentence.is-ready { font-size: 16px; font-weight: 650; color: var(--ink); }
.qri-sentence:empty { display: none; }
.qri-status { margin: 4px 0 0; font-size: 14.5px; font-weight: 600; color: var(--ink); }
.qri-status:empty { display: none; }
.qri-actions { display: flex; flex: 0 0 auto; align-items: center; justify-content: flex-end; gap: 10px; margin-left: auto; }
.qri-primary { min-width: 0; }
.qri-primary[aria-busy="true"] { cursor: progress; }
.qri-peek {
    display: inline-flex; align-items: center; gap: 6px; min-height: 48px; padding: 0 16px; border: 1px solid var(--line-strong);
    border-radius: 999px; background: var(--surface); color: var(--ink); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
}
.qri-peek .icon { color: var(--accent-text); }

/* ---------- the register lookup, the towns, the person check ---------- */
.qri-lookup { position: relative; }
.qri-suggest {
    position: absolute; left: 0; right: 0; top: calc(100% - 2px); z-index: 20; overflow: hidden;
    background: var(--surface); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: var(--elev-lg);
}
.qri-lookup .qri-suggest { top: 56px; }
.qri-suggest[hidden] { display: none; }
.qri-suggest__list { max-height: 340px; margin: 0; padding: 6px; overflow-y: auto; list-style: none; }
.qri-suggest__item { display: grid; gap: 2px; padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.qri-suggest__item:hover, .qri-suggest__item[aria-selected="true"] { background: var(--accent-tint); }
.qri-suggest__name { font-size: 15.5px; font-weight: 600; color: var(--ink); }
.qri-suggest__meta { font-size: 13.5px; color: var(--muted); }
.qri-suggest__flag { justify-self: start; padding: 1px 8px; border-radius: 999px; background: var(--amber-tint); font-size: 12px; color: var(--ink); }
.qri-suggest__source { margin: 0; padding: 8px 14px 10px; border-top: 1px solid var(--line); font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.qri-suggest__source:empty { display: none; }
.qri-picked { margin: 0; font-size: 14px; line-height: 1.45; color: var(--muted); }
.qri-picked[hidden] { display: none; }
.qri-places { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.qri-places[hidden] { display: none; }
.qri-places__ask { flex-basis: 100%; font-size: 14px; font-weight: 600; color: var(--ink); }
.qri-place {
    max-width: 100%; min-height: 40px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 999px;
    background: var(--surface); color: var(--ink); font: inherit; font-size: 14.5px; font-weight: 600; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis; cursor: pointer;
}
.qri-place:hover { background: var(--accent-tint); }
.qri-person-check:empty { display: none; }
.qri-person-check { margin-bottom: 12px; }

/* ---------- the preview ---------- */
.qri-preview { display: none; min-width: 0; }
.qri-preview__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; min-height: 40px; margin-bottom: 10px; }
.qri-preview__title { display: flex; align-items: center; gap: 8px; margin: 0 auto 0 0; font-size: 15px; font-weight: 650; color: var(--ink); white-space: nowrap; }
.qri-preview__title .icon { color: var(--accent-text); }
.qri-badge { display: inline-flex; align-items: center; min-height: 24px; padding: 0 10px; border-radius: 999px; background: var(--amber-tint); color: var(--ink); font-size: 13px; font-weight: 600; }
.qri-badge[data-state="draft"] { background: var(--accent-tint); }
.qri-badge[data-state="ready"] { background: var(--ok-tint); }
/* The pages of the PDF, to jump to: the invoice, its QR payment slip */
.qri-pages { display: flex; flex-wrap: wrap; gap: 6px; }
.qri-pages[hidden] { display: none; }
.qri-pages button, .qri-exact {
    display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 999px;
    background: var(--surface); color: var(--ink); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.qri-pages button:hover, .qri-exact:hover { background: var(--accent-tint); }
.qri-pages button[aria-pressed="true"] { border-color: var(--accent-solid); background: var(--accent-solid); color: var(--on-accent-solid); }
.qri-exact[hidden] { display: none; }
.qri-exact .icon { color: var(--accent-text); }
.qri-preview__close {
    display: none; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; border-radius: 12px;
    background: var(--surface-2); color: var(--ink); cursor: pointer;
}
/* The desk the sheet lies on: an opaque tone, handed to the document's frame too (assets/js/qr-invoice.js). */
.qri-desk { position: relative; box-sizing: border-box; padding: 20px; border-radius: 18px; background: var(--qri-desk); }
.qri-frame { display: block; border: 0; background: transparent; transform-origin: 0 0; pointer-events: none; }
.qri-frame[hidden] { display: none; }
.qri-desk.is-exact .qri-sketch { display: none; }
.qri-framebox { position: relative; overflow: hidden; margin: 0 auto; }
.qri-framebox[hidden] { display: none; }
.qri-framebox .qri-frame { position: absolute; left: 0; top: 0; }

/* The sketch: an A4 sheet filled with what is typed. Until the visitor's own words are there, a sample in a lighter
   ink stands in their place. Its size and its text are in container units: no layout of the page when it changes. */
.qri-sketch {
    container-type: inline-size; contain: layout paint style; position: relative; overflow: hidden; aspect-ratio: 210 / 297;
    width: 100%; margin-inline: auto;
    background: #fff; color: #1b2328; box-shadow: 0 1px 3px rgba(10, 17, 23, .16), 0 8px 24px -10px rgba(10, 17, 23, .22);
    font-family: Arial, "Liberation Sans", Helvetica, sans-serif; font-size: 10px; line-height: 1.35;
}
.qri-page .qri-sketch :is(p, span, strong, small, div) { color: inherit; }
.qri-sketch [hidden] { display: none !important; }
/* Sample words: a lighter ink (4.9:1 on white), never mistaken for what was typed */
.qri-page .qri-sketch .is-sample { color: #66727b; font-style: italic; font-weight: 400; }
.qri-page .qri-sketch .qri-sketch__made { color: #5f6b73; }
.qri-page .qri-sketch :is(.qri-sketch__title small, .qri-sketch__qty) { color: #4f5b62; }
/* Sizes in container units sit on the sheet's children: on the sheet itself they would measure the desk. */
.qri-sketch__doc { position: absolute; inset: 0 0 35.4% 0; padding: 7cqw 8cqw 0; font-size: 2.3cqw; }
.qri-sketch[data-kind="slip"] .qri-sketch__doc { display: none; }
.qri-sketch__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 4cqw; }
.qri-sketch__from, .qri-sketch__to, .qri-sketch__receipt, .qri-sketch__pay { display: flex; flex-direction: column; gap: .4cqw; min-width: 0; }
.qri-sketch__from > *, .qri-sketch__to > *, .qri-sketch__receipt > *, .qri-sketch__pay > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qri-sketch__from strong { font-size: 3cqw; }
.qri-sketch__logo { max-width: 26cqw; max-height: 11cqw; object-fit: contain; }
.qri-sketch__logo[hidden] { display: none; }
.qri-sketch__to { margin: 5cqw 0 0 52%; min-height: 11cqw; }
.qri-sketch__title { margin-top: 6cqw; font-size: 3.6cqw; font-weight: 700; }
.qri-sketch__title small { display: block; margin-top: .6cqw; font-size: 2.1cqw; font-weight: 400; }
.qri-sketch__lines { margin-top: 3cqw; border-top: .3cqw solid #1b2328; }
.qri-sketch__line { display: grid; grid-template-columns: minmax(0, 1fr) auto 16cqw; gap: 2cqw; align-items: center; padding: 1.2cqw 0; border-bottom: .2cqw solid #e3e8eb; }
.qri-sketch__line > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qri-sketch__num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.qri-sketch__totals { display: flex; flex-direction: column; gap: .6cqw; margin: 2.4cqw 0 0 48%; }
.qri-sketch__totals > div { display: flex; justify-content: space-between; gap: 2cqw; }
.qri-sketch__totals .is-total { padding-top: .8cqw; border-top: .3cqw solid #1b2328; font-weight: 700; }
.qri-sketch__made { position: absolute; left: 0; right: 0; margin: 0; text-align: center; font-size: 1.8cqw; }
.qri-sketch[data-kind="invoice"] .qri-sketch__made { bottom: calc(35.4% + 2.4cqw); }
.qri-sketch[data-kind="slip"] .qri-sketch__made { top: 3.4cqw; }
/* The payment part at the foot: 105 of 297 mm, the receipt 62 of 210 mm, the code 46 mm. */
.qri-sketch__slip { position: absolute; left: 0; right: 0; bottom: 0; height: 35.4%; display: grid; grid-template-columns: 29.5% minmax(0, 1fr); border-top: .25cqw dashed #1b2328; font-size: 1.9cqw; }
.qri-sketch__receipt { padding: 2.4cqw; border-right: .25cqw dashed #1b2328; overflow: hidden; }
.qri-sketch__payment { display: grid; grid-template-columns: 22cqw minmax(0, 1fr); gap: 2.4cqw; padding: 2.4cqw; overflow: hidden; }
.qri-sketch__pay { grid-row: 1; grid-column: 2; overflow: hidden; }
.qri-sketch__label { font-size: 2.6cqw; font-weight: 700; }
.qri-sketch__h { margin-top: .8cqw; font-size: 1.6cqw; font-weight: 700; }
/* The code: SIX's own sample, faded under "Sample", until the API draws the visitor's own */
.qri-sketch__qr { position: relative; grid-row: 1; grid-column: 1; align-self: start; width: 22cqw; aspect-ratio: 1; margin-top: 5.6cqw; }
.qri-sketch__code { display: block; width: 100%; height: 100%; opacity: .24; }
.qri-sketch__qr.is-real .qri-sketch__code { opacity: 1; }
/* The visitor's last code while the document is being changed: lighter until the next complete answer brings the new one. */
.qri-sketch__qr.is-real.is-stale .qri-sketch__code { opacity: .4; }
.qri-sketch__qr.is-real .qri-sketch__stamp { display: none; }
.qri-sketch__stamp {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-14deg);
    padding: .5cqw 1.6cqw; border: .45cqw solid #9a3412; border-radius: 1cqw; background: rgba(255, 255, 255, .92);
    font-size: 3cqw; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap;
}
.qri-page .qri-sketch .qri-sketch__stamp { color: #9a3412; }

/* ---------- after the download ---------- */
.qri-success { display: grid; gap: 16px; margin: 18px 0 24px; outline: none; }
.qri-success[hidden] { display: none; }
.qri-success__done { display: flex; gap: 16px; align-items: flex-start; padding: 18px 20px; border-radius: 16px; background: var(--ok-tint); }
.qri-page .qri-success__done h2 { margin: 2px 0 6px; font-size: 21px; line-height: 1.3; letter-spacing: -.01em; color: var(--ink); }
.qri-success__done p { margin: 0 0 10px; color: var(--ink-2); font-size: 15.5px; line-height: 1.55; }
.qri-success__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.qri-share[hidden] { display: none; }
.qri-cta { display: grid; gap: 12px; justify-items: start; padding: 20px 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.qri-cta__title { max-width: 60ch; margin: 0; font-size: 17.5px; font-weight: 650; line-height: 1.45; color: var(--ink); }
.qri-cta__note { margin: 0; font-size: 14px; color: var(--muted); }

/* ---------- help, below the tool, folded ---------- */
.qri-help { padding-block: 40px 72px; content-visibility: auto; contain-intrinsic-size: auto 120px; }
.qri-help__fold { max-width: 820px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.qri-help__fold > summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; list-style: none; cursor: pointer; }
.qri-help__fold > summary::-webkit-details-marker { display: none; }
.qri-help__fold > summary::marker { content: ''; }
.qri-help__fold > summary:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: 10px; }
.qri-page .qri-help__fold h2 { margin: 0; font-size: 18px; font-weight: 650; line-height: 1.35; }
.qri-help__items { display: grid; gap: 20px; padding: 4px 0 24px; }
.qri-page .qri-help__item h3 { margin: 0 0 6px; font-size: 16px; font-weight: 650; line-height: 1.4; color: var(--ink); }
.qri-page .qri-help__item p { max-width: 70ch; margin: 0; font-size: 15.5px; line-height: 1.6; color: var(--ink-2); }
/* The site footer is far below the tool: rendered when it comes near the window, not on every keystroke. */
.market-footer { content-visibility: auto; contain-intrinsic-size: auto 520px; }
/* The header's bouncing dot rests on its "i" while the visitor works in the tool: an animation that never stops makes
   the browser draw a new frame all the time, and each keystroke waits its turn (measured: 32 ms a key, 16 without). */
body:has(.qri-work :focus) .site-header .animated-logo__dot { animation: none; }

/* ---------- wide screens: the form and the sheet side by side, both in view ---------- */
@media (min-width: 1024px) {
    .qri-work {
        display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: start;
        min-height: calc(100vh - var(--header-height, 72px));
    }
    .qri-bar { margin: 0; padding-inline: 0; }
    .qri-peek { display: none; }
    .qri-preview {
        display: flex; flex-direction: column; position: sticky; top: var(--header-height, 72px); box-sizing: border-box;
        height: calc(100vh - var(--header-height, 72px)); padding: 18px 0 18px;
    }
    /* The desk keeps to the window; the sheet is as large as both its width and its height allow. */
    .qri-desk { flex: 1 1 auto; min-height: 0; container-type: size; display: flex; justify-content: center; align-items: flex-start; }
    .qri-desk .qri-sketch { width: min(100cqw, 100cqh * .7071); }
    .qri-desk.is-exact { display: block; overflow-y: auto; overscroll-behavior: contain; }
}
/* A laptop's short window (1280 x 800): the same view a little tighter, so the fold and the button stay in view. */
@media (min-width: 1024px) and (max-height: 860px) {
    .qri-side { padding-top: 14px; }
    .qri-page .qri-head h1 { margin-bottom: 8px; font-size: 23px; }
    .qri-block { padding: 10px 0 12px; }
    .qri-page .qri-q { margin-bottom: 8px; }
    .qri-ask { margin: 10px 0 5px; }
    .qri-page .qri :is(input:not([type="checkbox"]):not([type="file"]), select) { min-height: 42px; padding-block: 8px; }
    .qri-page .qri-field--big input { min-height: 44px; padding-block: 9px; }
    .qri-vat { margin-top: 8px; }
    .qri-preview { padding-block: 12px; }
}
@media (min-width: 1024px) and (max-width: 1279.98px) {
    .qri-work { gap: 28px; }
    .qri-lines__head, .qri-line { grid-template-columns: minmax(0, 1fr) 56px 96px 84px 32px; }
    .qri-totals { margin-right: 40px; }
}

/* ---------- smaller screens: one column, the preview one tap away ---------- */
@media (max-width: 1023.98px) {
    .qri-page { --qri-gutter: 16px; }
    html.qri-noscroll, html.qri-noscroll body { overflow: hidden; }
    .qri-preview.is-open {
        display: flex; flex-direction: column; position: fixed; inset: 0; z-index: 70; overflow-y: auto;
        padding: 10px 16px calc(20px + env(safe-area-inset-bottom, 0px)); background: var(--bg);
    }
    .qri-preview.is-open .qri-preview__close { display: inline-flex; }
    .qri-preview.is-open .qri-preview__bar { position: sticky; top: -10px; z-index: 3; margin: -10px -16px 12px; padding: 10px 16px; background: var(--bg); border-bottom: 1px solid var(--line); }
    .qri-preview.is-open .qri-desk { padding: 14px; }
    .qri-actions { flex: 1 1 100%; justify-content: stretch; }
    .qri-actions .qri-primary { flex: 1; min-width: 0; justify-content: center; white-space: normal; }
}
@media (max-width: 760px) {
    .qri-side { padding-top: 16px; }
    .qri-page .qri-head h1 { font-size: 23px; margin-bottom: 8px; }
    /* On a phone the bar keeps to the plain sentence before the download; what the preview waits for is in the preview. */
    .qri-sentence:not(.is-ready) { display: none; }
    .qri-bar__text:has(.qri-sentence:not(.is-ready)):has(.qri-status:empty) { display: none; }
    .qri-modes { width: 100%; }
    .qri-fields { grid-template-columns: minmax(0, 1fr); }
    .qri-address .qri-fields { grid-template-columns: 6.5em minmax(0, 1fr); }
    .qri-card { grid-template-columns: 36px minmax(0, 1fr); }
    .qri-card__icon { grid-row: 1 / span 2; }
    .qri-card__actions { grid-column: 2; grid-row: auto; order: 5; justify-content: flex-start; padding-top: 4px; }
    .qri-lines__head { display: none; }
    .qri-line, .qri[data-vat="1"] .qri-line {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) 40px;
        padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
    }
    .qri-line__desc { grid-column: 1 / -1; }
    .qri-line__vat { grid-column: 1 / 3; }
    .qri-line__total { grid-column: 1 / 3; justify-self: start; }
    .qri-line__remove { grid-row: 2; grid-column: 3; }
    .qri-line .visually-hidden { position: static !important; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; white-space: normal; font-size: 12.5px; font-weight: 600; color: var(--muted); }
    .qri-line.is-next .qri-line__desc .visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .qri-totals { max-width: none; margin-right: 0; }
    .qri-vat__hint { margin-left: 0; }
    .qri-pages { order: 3; flex-basis: 100%; }
    .qri-success__done { padding: 16px; }
}
@media (prefers-reduced-motion: no-preference) {
    .qri-card, .qri-address:not([hidden]) { animation: qri-in .18s ease both; }
}
@keyframes qri-in { from { opacity: 0; } to { opacity: 1; } }
