/* ============================================================
   The printed order form.

   A separate stylesheet, not a chunk of app.css: this file does not
   describe an interface, it describes paper. It is therefore written
   in millimetres, ignores the application theme, and depends on
   no MudBlazor variable — a document must come out identical
   from two browsers and two themes.

   What is common to every printed document — the sheet
   format, the preview frame, the action bar, the @media print
   rule — lives in paper.css. Here, what the order form
   says, and only that.

   What replaces the Excel workbook, point by point:
     - the "…………" dotted leaders typed by hand become a
       dotted border, which holds the line at every
       width;
     - the amount columns use tabular figures, so they are
       aligned without having to count spaces;
     - the vertical rules disappear: alignment is what
       separates the columns, and it does so better;
     - a single tint, the range colour, on the titles and the
       section rules. The rest is black on white, because this
       document goes to a customer's printer.
   ============================================================ */

/* The sheet also carries the "paper" class, which gives it its format and background; what
   follows is only the order form's layout. The document fits on one page, hence the
   flex column: it is what pushes the signature block to the bottom of the sheet. */
.of {
    --of-ink: #14181d;
    /* Secondary text, dark enough to survive an office printer: the first proofs came back
       annotated "more visible" wherever a lighter grey had been used. */
    --of-muted: #3f4650;
    --of-rule: #d9dde2;
    --of-hair: #ecEEF1;
    --of-accent: #0e6e63;

    padding: 10mm 12mm 8mm;
    font-size: 8pt;
    line-height: 1.28;

    display: flex;
    flex-direction: column;
}

/* --- Header --- */
.of-head {
    display: flex;
    align-items: flex-start;
    gap: 10mm;
    padding-bottom: 2mm;
    border-bottom: 2px solid var(--of-ink);
}

.of-eyebrow {
    margin: 0 0 1mm;
    font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
    font-size: 7pt;
    font-weight: 500;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--of-accent);
}

.of-title {
    margin: 0;
    font-family: "IBM Plex Sans Condensed", "IBM Plex Sans", sans-serif;
    font-size: 16pt;
    font-weight: 700;
    letter-spacing: -.015em;
    line-height: 1.08;
    color: var(--of-accent);
}

.of-intro {
    margin: 1mm 0 0;
    max-width: 118mm;
    font-size: 7.6pt;
    color: var(--of-muted);
}

/* The vintage year: it is the first landmark when three versions are lying around on a desk. */
/* Vintage year and logo on the same line, not one under the other: stacked, they cost
   enough height to push the longest grids onto a second page. */
.of-stamp {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 3.5mm;
}

.of-stamp-id {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .5mm;
    text-align: right;
}

/* The range logo on its solid block. All four range logos are white: that is how
   they were designed, and the workbook already placed them on a dark background. The block stays
   small — a full-width reversed logo would cost one cartridge per order form. */
/* --- The three ranges ---

   The workbooks told the ranges apart by the colour of the block behind the logo:
   Popsy blue, Allegro Online blue, Subito green — that is how a salesperson recognises an
   order form before even reading it.

   One tint per range, used for everything on the sheet: logo block, title, year, banner,
   section rules, customer frame. The sheet first had two — the workbook's light tint behind
   the logo, a darker one for the text, which the light tint was too pale to carry at
   7 points — and on paper the logo read as another blue than the rest of the page. The tint
   kept is the dark one: it carries a white logo as well as small text on white. The price
   list's range dots read the same variables. */
:root {
    --range-popsy: #2f5597;
    --range-online: #2573c1;
    --range-subito: #4e7a32;
    /* Allegro Windows had no workbook to borrow from: a slate, as dark as the others, that
       reads as neither Popsy's blue nor Allegro Online's. */
    --range-windows: #3d5170;
}

/* The class comes from the logo key: the document stores no colour in the database, it stores its
   range, and the colour follows from it. Placed after .of, these rules win over its accent. */
.of-range-allegro-popsy {
    --of-accent: var(--range-popsy);
}

.of-range-allegro-online {
    --of-accent: var(--range-online);
}

.of-range-allegro-subito {
    --of-accent: var(--range-subito);
}

.of-range-allegro-windows {
    --of-accent: var(--range-windows);
}

/* The block is the accent itself, so it can never drift from the rest of the sheet. A document
   without a range has no logo to put on it. */
.of-badge {
    display: block;
    flex: none;
    padding: 1.8mm 2.5mm;
    border-radius: 1.2mm;
    background: var(--of-accent);
}

.of-badge img {
    display: block;
    width: 30mm;
    height: auto;
}

.of-stamp-year {
    font-family: "IBM Plex Sans Condensed", sans-serif;
    font-size: 15pt;
    font-weight: 700;
    line-height: 1;
    color: var(--of-accent);
}

/* --- What is included ---

   The one solid fill of the sheet besides the logo, on purpose: "all services included" is
   the argument against the competition, and it has to catch the eye before the prices do.
   The fill takes the dark range colour, not the light one: white text on Allegro Online's
   light blue would not survive an office printer. The services sit on one line, in ink,
   inside the frame — a strip, not a block, so the sheet does not grow. */
.of-included {
    display: flex;
    align-items: stretch;
    margin-top: 2.4mm;
    border: 1.5px solid var(--of-accent);
    border-radius: 1.5mm;
    overflow: hidden;
    break-inside: avoid;
}

.of-included-title {
    flex: none;
    display: flex;
    align-items: center;
    padding: 1.4mm 3.5mm;
    background: var(--of-accent);
    font-family: "IBM Plex Sans Condensed", "IBM Plex Sans", sans-serif;
    font-size: 10pt;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #fff;
}

/* One line on every sheet, whatever the number of services: a banner that wraps on one form
   and not on the next is twice as tall and reads as another design. When the services do not
   fit, paper.fit (wwwroot/js/print.js) lowers --of-included-fit and the text shrinks — gaps
   and marks included, as they are in em — until they do. Only past its floor does the list
   wrap again (.of-included-wrap), rather than becoming unreadable. */
.of-included ul {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: .2em 1.55em;
    margin: 0;
    padding: 1.2mm 3.5mm;
    list-style: none;
    font-size: calc(8.2pt * var(--of-included-fit, 1));
    font-weight: 600;
    white-space: nowrap;
    color: var(--of-ink);
}

.of-included ul.of-included-wrap {
    flex-wrap: wrap;
    white-space: normal;
}

.of-included li::before {
    content: "✓";
    margin-right: .4em;
    font-weight: 700;
    color: var(--of-accent);
}

/* --- The grid --- */
.of-grid {
    width: 100%;
    border-collapse: collapse;
    margin-top: 2.4mm;
}

.of-grid thead th {
    padding: 0 0 1mm;
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 6.5pt;
    font-weight: 500;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--of-muted);
    text-align: center;
}

.of-c-label {
    text-align: left;
    width: auto;
}

/* The column is wide enough for "Support pack/year*" on one line in every language; a
   longer title wraps rather than widening the column. Title and amounts are centred
   on the same axis, so the title sits over its figures whatever its length. */
.of-c-price {
    width: 32mm;
    text-align: center;
    vertical-align: top;
}

/* The section title: a solid rule under the name, in the accent colour.
   It opens the group without boxing it, which keeps the grid light. */
.of-section th {
    text-align: left;
    padding: 2.2mm 0 .8mm;
    border-bottom: 1.5px solid var(--of-accent);
}

.of-grid tbody:first-of-type .of-section th {
    padding-top: 1mm;
}

.of-section-title {
    font-family: "IBM Plex Sans Condensed", sans-serif;
    font-size: 9.5pt;
    font-weight: 600;
    letter-spacing: -.005em;
    color: var(--of-accent);
}

.of-section-subtitle {
    margin-left: 2mm;
    font-size: 7.2pt;
    font-weight: 400;
    color: var(--of-muted);
}

.of-subheading th {
    text-align: left;
    padding: 2.2mm 0 .6mm;
    font-size: 7.8pt;
    font-weight: 600;
    color: var(--of-ink);
}

.of-note td {
    padding: .4mm 0 1mm;
    font-size: 6.8pt;
    font-style: italic;
    color: var(--of-muted);
}

/* A service line. The rule is a hairline: it guides the eye to the amount
   without gridding the page. */
.of-line > td {
    padding: .7mm 0;
    border-bottom: 1px solid var(--of-hair);
    vertical-align: top;
}

.of-line:last-child > td {
    border-bottom: 0;
}

.of-label {
    font-weight: 500;
}

/* The checkbox. A square drawn as a border: it always prints, whereas an
   <input type=checkbox> depends on browser settings. */
.of-tick {
    display: inline-block;
    width: 2.9mm;
    height: 2.9mm;
    margin-right: 2mm;
    border: 1px solid #6f7782;
    border-radius: .6mm;
    vertical-align: -.5mm;
    flex: none;
}

.of-bullets {
    margin: .6mm 0 0 5mm;
    padding: 0;
    list-style: none;
    columns: 2;
    column-gap: 6mm;
}

.of-bullets-stacked {
    columns: 1;
}

.of-label strong,
.of-bullets strong {
    font-weight: 700;
}

.of-bullets li {
    position: relative;
    padding-left: 2.6mm;
    font-size: 7.3pt;
    color: var(--of-ink);
    break-inside: avoid;
}

/* The dash is a character, not a drawn bar: it shares the text's baseline whatever the font
   and the zoom. A bar placed in em landed near the baseline and read as an underscore. */
.of-bullets li::before {
    content: "–";
    position: absolute;
    left: 0;
    top: 0;
    color: #7d848e;
}

/* The amounts: monospaced with tabular figures, hence aligned column by column
   without having to think about it. */
.of-money {
    font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
    font-variant-numeric: tabular-nums;
    font-size: 8.6pt;
    font-weight: 500;
}

/* The amount and its unit, centred as one box. The box has a fixed minimum width and
   right-aligns its content, so the figures of a column still line up by the units digit. */
.of-amount {
    display: inline-block;
    min-width: 14mm;
    text-align: right;
    white-space: nowrap;
}

.of-unit {
    display: block;
    font-size: 6.8pt;
    color: var(--of-muted);
}

.of-footnote {
    margin: 1.3mm 0 0;
    font-size: 6.9pt;
    color: var(--of-muted);
}

/* --- Blocks under the grid --- */
.of-block-title {
    display: block;
    margin-bottom: .9mm;
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 6.5pt;
    font-weight: 500;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--of-muted);
}

.of-options,
.of-fields {
    margin-top: 2mm;
    padding-top: 1.5mm;
    border-top: 1px solid var(--of-rule);
    break-inside: avoid;
}

.of-options ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: .4mm 5mm;
    font-size: 7.4pt;
}

.of-options li {
    display: flex;
    align-items: flex-start;
}

/* --- Service sheet ---

   The problem and the time spent, written by hand during the call. Same rule above, same
   title in the range colour as the options block: they read as part of what is ordered,
   before the customer's frame. The ruled lines are borders, not a background, so they
   print whatever the "background graphics" setting of the print dialog. */
.of-service {
    margin-top: 2.4mm;
    padding-top: 1.5mm;
    border-top: 1px solid var(--of-rule);
    break-inside: avoid;
}

.of-service .of-block-title {
    font-family: "IBM Plex Sans Condensed", "IBM Plex Sans", sans-serif;
    font-size: 7.6pt;
    font-weight: 700;
    letter-spacing: .08em;
    color: var(--of-accent);
}

.of-ruled span {
    display: block;
    height: 6.6mm;
    border-bottom: 1px dotted #868d97;
}

.of-service .of-row {
    margin: 1.5mm 0 0;
}

/* Wide enough for a date and an hour written by hand: « 12/03/2027 14 h 30 ». */
.of-w-time {
    flex: 0 0 72mm;
}

/* --- Fields to fill in ---

   The dotted line replaces the "……………" typed in the workbook. It holds its
   width whatever the length of the label, which a string of dots could
   not do: that is why the workbook's columns never lined up. */
.of-row {
    display: flex;
    gap: 4mm;
    margin-bottom: 1.7mm;
}

.of-row label {
    display: flex;
    align-items: flex-end;
    gap: 2mm;
    font-size: 7.4pt;
    color: var(--of-muted);
    white-space: nowrap;
    padding-bottom: .3mm;
    border-bottom: 1px dotted #868d97;
    min-height: 4.1mm;
}

.of-grow {
    flex: 1 1 auto;
    min-width: 0;
}

/* Wide enough for "BE 0123.456.789" written by hand after a two-part label. */
.of-w-vat {
    flex: 0 0 68mm;
}

.of-w-small {
    flex: 0 0 26mm;
}

/* The fiscal year line under the grid: no rule above it, it belongs to the grid. Wide enough
   for "2027" or "01/07/2027 – 30/06/2028" written by hand. */
.of-fiscal {
    margin: 2mm 0 0;
}

.of-w-fiscal {
    flex: 0 0 90mm;
}

/* At 26 mm, "Code postal" left room for barely three handwritten digits. */
.of-w-postal {
    flex: 0 0 38mm;
}

.of-choices {
    align-items: center;
    gap: 5mm;
    margin-bottom: 1.2mm;
}

.of-choice-label {
    font-size: 7.4pt;
    color: var(--of-muted);
}

.of-choice {
    display: inline-flex;
    align-items: center;
    font-size: 7.4pt;
}

/* --- The customer's frame ---

   Everything the customer fills in, from their details to the signature, in one box drawn
   in the range colour. A border, not a tint: a background would cost ink on every copy and
   fades on a mediocre printer, whereas a line stays sharp. The frame is pushed to the
   bottom of the sheet, just above the footer, as the signature was before it. */
.of-customer {
    margin-top: auto;
    padding: 1.8mm 3.5mm 2.5mm;
    border: 1.5px solid var(--of-accent);
    border-radius: 1.5mm;

    /* If a long grid splits the frame across two pages, each half keeps its border. */
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}

/* Inside the frame, the block titles are in bold ink: they head what the customer writes.
   The condensed face of the grid's section titles, not the mono one: Plex Mono is only
   served up to 500, and a bold the browser synthesizes smudges on paper. */
.of-customer .of-block-title {
    font-family: "IBM Plex Sans Condensed", "IBM Plex Sans", sans-serif;
    font-size: 7.6pt;
    font-weight: 700;
    letter-spacing: .08em;
    color: var(--of-ink);
}

/* Above the options block, the title takes the range colour, like the section titles it follows. */
.of-options .of-block-title {
    font-family: "IBM Plex Sans Condensed", "IBM Plex Sans", sans-serif;
    font-size: 7.6pt;
    font-weight: 700;
    letter-spacing: .08em;
    color: var(--of-accent);
}

/* The frame already opens the block: the first one needs neither rule nor gap above it. */
.of-customer > :first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

/* --- Signature --- */
.of-sign {
    padding-top: 2.5mm;
    display: flex;
    gap: 7mm;
    align-items: flex-end;
    break-inside: avoid;
}

.of-sign-terms {
    flex: 1 1 auto;
    font-size: 6.9pt;
    color: var(--of-muted);
    max-width: 96mm;
}

.of-sign-terms p {
    margin: 0 0 1.5mm;
}

.of-instructions {
    font-style: italic;
}

/* Above the serial number line: the size of the signature terms, close to its field. */
.of-fields .of-instructions {
    margin: 0 0 .6mm;
    font-size: 6.9pt;
    color: var(--of-muted);
}

.of-sign-boxes {
    display: flex;
    gap: 4mm;
    flex: 0 0 auto;
}

.of-sign-box {
    width: 30mm;
    height: 14mm;
    border: 1px solid var(--of-rule);
    border-radius: 1mm;
    padding: 1.4mm 2mm;
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 6.5pt;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--of-muted);
}

.of-sign-box-wide {
    width: 52mm;
}

/* --- Footer --- */
.of-foot {
    margin-top: 3mm;
    padding-top: 1.6mm;
    border-top: 1px solid var(--of-ink);
    display: flex;
    align-items: flex-start;
    gap: 5mm;
    font-size: 6.5pt;
    color: var(--of-muted);
}

.of-foot > div {
    display: flex;
    flex-direction: column;
    gap: .3mm;
}

/* The company logo, in colour: it is the only one of the four that exists in a version for a light
   background, so it holds its place at the foot of the sheet with nothing behind it. */
.of-foot-logo {
    flex: none;
    width: 26mm;
    height: auto;
    align-self: flex-start;
    margin-top: -.5mm;
}

.of-foot span:first-child {
    font-weight: 600;
    color: var(--of-ink);
}

.of-foot-mail {
    flex: 1 1 auto;
    align-items: center;
    text-align: center;
    padding-top: .2mm;
}

.of-foot-mail span:first-child {
    font-weight: 500;
    color: var(--of-accent);
}

.of-foot-right {
    text-align: right;
    align-items: flex-end;
}

/* --- Terms of sale ---

   The back of the order form: fourteen articles of prose that must hold on one sheet. The
   Word original got there in 4-point Calibri with 4 mm margins; here the condensed face at
   6 points does it in two columns, as the original had, with margins a printer can honour.
   The title is that of a contract, longer than a range name: it is set smaller. */
.of-terms-sheet {
    padding: 7mm 9mm 6mm;
}

.of-terms-sheet .of-title {
    font-size: 12pt;
}

.of-terms {
    flex: 1 0 auto;
    margin-top: 1mm;
    column-count: 2;
    column-gap: 5mm;
    font-family: "IBM Plex Sans Condensed", "IBM Plex Sans", sans-serif;
    font-size: 6pt;
    line-height: 1.24;
    text-align: justify;
    hyphens: auto;
}

.of-article {
    margin-bottom: 1.4mm;
}

.of-article-title {
    margin: 0 0 .5mm;
    font-family: "IBM Plex Sans Condensed", sans-serif;
    font-size: 7pt;
    font-weight: 700;
    color: var(--of-accent);
    break-after: avoid;
}

.of-article-sub {
    margin: .8mm 0 .3mm;
    font-size: 6.3pt;
    font-weight: 600;
    color: var(--of-ink);
    break-after: avoid;
}

.of-article p {
    margin: 0 0 .6mm;
}

.of-terms-ref {
    margin: 1mm 0 0;
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 6pt;
    text-align: right;
    color: var(--of-muted);
}

/* ============================================================
   Printing.

   The foundation — the page format, removing the application
   around it, the preview frame — is in paper.css. All that
   remains here is what is specific to the order form: the edit
   screen, in case someone hits Ctrl+P from it rather than from the
   print page.
   ============================================================ */
@media print {
    .price-edit-pane,
    .price-preview-head {
        display: none !important;
    }
}
