/* ═══════════════════════════════════════════════════════════════════════════
   WAM Ai — REPORT KIT
   The masthead every printed report in the app wears. ONE definition.

   WHY THIS IS A FILE AND NOT INLINE ANYWHERE
   The app's printed reports live in three different kinds of document:
     · the single-page app itself            (wam.html)
     · standalone pages                       (report.html, daily-margin-report.html,
                                               fuel-inventory-report.html)
     · pop-up windows opened by wam.js        (invoice detail, invoice summary, price tags)
   A pop-up gets its OWN document and cannot see wam.html's stylesheet — which is
   precisely why every report grew its own header over time. A linkable file is
   the only thing all three can reach, so this is the source of truth. wam.js
   fetches it once and inlines it into pop-ups (so nothing prints unstyled while a
   stylesheet is still loading); everything else just links it.

   ⚠️ THE RULE UNDER THE MASTHEAD IS DELIBERATE — AND IT REVERSES AN EARLIER
   DECISION, SO READ THIS BEFORE REMOVING IT.
   On 2026-07-27 a ruled masthead was rejected: the sheet already carries five
   horizontal rules, and a sixth read as the ledger's first row. A teal bar down
   the left was used instead.
   On 2026-07-29 Munier chose the rule, having seen his own Gilbarco Passport
   "Store Close" report and SSCS's "Daily Book Analysis" — BOTH of which put a
   rule under a prominent title. The earlier objection no longer applies because
   the teal bar is gone: the rule is now the header's ONLY mark, so it separates
   the masthead from the ledger instead of competing with it.

   ⚠️ NO STATUS CHIP, AND NOTHING THAT ASSUMES A SINGLE DAY.
   The masthead is shared by six reports. Some cover one day, some a month, some
   a year. So the period slot takes ANY string ("07/28/2026", "July 2026", "2026")
   and there is no "open/closed" chip — a day's status lives in the Day Status
   panel on the sheet, where it belongs. Munier, 2026-07-29: "don't use the
   preliminary bubble... with other reports it could be a month/year instead of
   exact date."

   Layout — three rows sharing one left edge and one right edge, then the rule:
     [WAM Ai lockup]                          DAILY BOOKS RECONCILIATION
     Gordon Plaza Sunoco                                    07/28/2026
     Afshar Limited II LLC · Store #5586 · 1260 Annapolis Way, …
     ────────────────────────────────────────────────────────────────

   The identity line spans the full width, so a long address can never be
   clipped — it was being truncated on both stores when it shared a row.
   ⚠️ CACHE-BUST THIS FILE WHEN YOU CHANGE IT.
   Every page links it as `report-kit.css?v=kitNN` (and report-kit.js the same).
   It shipped for two days with NO version at all, so a browser that had already
   loaded it would keep serving the old masthead no matter what was deployed —
   the same trap wam.js?v=wamsheetNN exists to avoid. Bump the NN in ALL FOUR
   pages (wam.html, report.html, daily-margin-report.html,
   fuel-inventory-report.html) in the same commit as any edit here.
   ═══════════════════════════════════════════════════════════════════════════ */

.rh {
  /* margin-bottom is the BREATHING ROOM AFTER THE RULE, before the report starts.
     Munier, 2026-07-29: "enforce a padding after the header black line... right
     now it's a little tight. a slight bit more space." 12px -> 18px. */
  margin: 0 0 18px;
  padding-bottom: 4px;   /* snug to the last line — Munier, 2026-07-29 */
  border-bottom: 1px solid var(--ink, #16181F);
}

.rh-r1, .rh-r2, .rh-r3 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
}
/* Centred, not baseline: an <img> baseline is its BOTTOM edge, so baseline
   alignment drops the mark below the type. Equal heights + centre = one line. */
.rh-r1 { align-items: center; }
/* ⚠️ THE THREE ROWS ARE NOT THREE EQUAL THINGS — SPACE THEM ACCORDINGLY.
   ⚠️ AND DO NOT "MEASURE" THIS WITH ESTIMATED CAP-HEIGHT MATHS. A first pass
   computed ink-to-ink gaps using assumed cap-height/descender ratios, concluded
   row 3 needed a NEGATIVE margin, and shipped a header where the address line
   nearly touched the store name above it. The constants did not match this
   typeface. Rendered at 2x and looked at instead — which is how the numbers
   below were chosen.
   Measured 2026-07-29, ink-to-ink (box gaps lie: a 21px line carries far more
   internal leading than a 14px one). The header was reading as three unrelated
   stripes because the optical gaps came out 15.5 / 13.7 / 14.6px — near identical.
   But row 3 DESCRIBES row 2: the address belongs to the store named above it.
   So rows 2+3 are one group, and row 1 is separate:
       row 1 -> row 2   a clear break
       row 2 -> row 3   tight, so they read as one block
   The numbers below are chosen to produce that OPTICALLY, which is why row 3's
   is so much smaller than you would expect — the 21px store name's descender
   space is already doing most of the work. Re-measure if any type size changes.
   Tightened 2026-07-29 on Munier's read of the printed sheet: the whole block
   read as too airy, so row 2 pulled up under the wordmark and row 3 up under the
   store name, and the address line grew (it had gone abnormally small). */
.rh-r2 { margin-top: 5px; }
.rh-r3 { margin-top: 1px; }

/* Brand — the PRIMARY LOCKUP (icon + wordmark), which the brand kit says to use
   by default. Two artworks: dark text for a light ground, white for a dark one.
   Getting this backwards prints an invisible logo. */
/* ⚠️ THE WORDMARK, NOT THE FULL LOCKUP — AND ITS PADDING IS CANCELLED.
   Munier, 2026-07-29: the icon's solid black squircle was the heaviest mark on an
   otherwise light page. The kit forbids recolouring that container, and the
   "transparent" icon variant only has transparent CORNERS, so the sanctioned
   answer is the wordmark — which is also the right mark for a printed record
   (an app icon belongs on a phone home screen, not a letterhead).

   ⚠️ THE ARTWORK HAS BAKED-IN PADDING, so it cannot simply be dropped in.
   Measured by rasterising it and scanning for ink (design-explorations/
   header-2026-07-29/measure.html):
       box 1600 x 446 · ink x 73-1525, y 73-373
       left padding  = 4.563% of the WIDTH
       top/bottom    = 16.4% / 16.1% of the HEIGHT
       letters occupy only 67.5% of the box height
   Two consequences, both handled below:
     1. the left edge is indented, so it would NOT line up with the store name
        under it or with the rule — margin-left cancels exactly that 4.563%,
        which works out to 0.1637 x the rendered height;
     2. the box must be taller than the letters you want. At 16px the letters
        render ~10.8px, which reads level with the 14px uppercase title.
   ⚠️ If the height changes, the negative margin MUST change with it — it is
   derived from the height, not a fixed nudge. */
.rh-lock {
  height: 22px; width: auto; display: block;
  margin-left: -3.6px;   /* 0.1637 x 22px — cancels the artwork's left padding */
}
.rh-lock.dark { display: none; }
:root[data-theme="dark"] .rh-lock.light, .dark .rh-lock.light { display: none; }
:root[data-theme="dark"] .rh-lock.dark,  .dark .rh-lock.dark  { display: block; }

/* ⚠️ THE TITLE IS A TITLE. It used to print at 11.5px in mid-grey against a 21px
   black store name — so the page announced STORE, then DATE, then whispered what
   the report actually was. Munier, 2026-07-29: "the report name should be very
   clearly at the top." Near-black and 14px; still smaller than the store name and
   the period, because it is the LABEL and they are the payload. */
.rh-title {
  font-size: 21px; font-weight: 800; letter-spacing: -.022em; text-transform: uppercase;
  color: var(--ink, #16181F); white-space: nowrap; text-align: right;
}

/* The two things an operator uses to file and find a printed report. */
.rh-store {
  font-size: 21px; font-weight: 800; letter-spacing: -.022em; line-height: 1.05;
  color: var(--ink, #16181F); min-width: 0;
}
/* The PERIOD. Any shape — a date, a month, a year, a range. */
.rh-when {
  font-size: 18px; font-weight: 800; letter-spacing: -.01em;
  color: var(--ink, #16181F); font-variant-numeric: tabular-nums;
  white-space: nowrap; flex: 0 0 auto;
}

/* The record detail — quiet, but always present: it is what makes the page a
   record. Spans the row so a long address is never clipped. */
/* ⚠️ 12px, not 10.5px. Munier, 2026-07-29: "the site id line is abnormally
   smaller text." It carried the two things you file a sheet by — the Site ID and
   the address — at a size that read as fine print. Bumped so it is plainly
   legible, still clearly below the store name. .rh-sub (the note on the same row)
   matches it, so the row reads level. */
.rh-ident { font-size: 12px; color: var(--ink-3, #6E7280); line-height: 1.4; min-width: 0; }
.rh-dot   { margin: 0 6px; opacity: .45; }
/* A GAP between two already-labelled facts ("Site ID: 5586" / "Address: ..."),
   where a dot would just be one more mark to read past. */
.rh-gap   { display: inline-block; width: 22px; }
/* Optional right-hand note (the invoice puts its vendor here). Plain text — NOT
   a chip, and never a day status. */
.rh-sub   { font-size: 12px; color: var(--ink-3, #6E7280); white-space: nowrap; flex: 0 0 auto; }

/* The period exists twice on purpose: a picker on screen, plain text on paper.
   A <select> prints as an empty box — a printed copy once came back with no
   date on it at all. */
.rh-date { display: none; }

/* Phone: the title may wrap — never slice mid-letter (AP-32). The print block
   below keeps its own sizes, so paper is untouched. */
@media (max-width: 480px) {
  .rh-title { font-size: 15px; white-space: normal; line-height: 1.15; }
  .rh-r1 { gap: 12px; }
}

@media print {
  .rh { margin: 0 0 16px; padding-bottom: 4px; }
  .rh-lock  { height: 21px; margin-left: -3.4px; }   /* 0.1637 x 21px, for the 20px print title */
  .rh-title { font-size: 20px; }   /* tracking inherits from the screen rule */
  .rh-r2    { margin-top: 4px; }
  .rh-r3    { margin-top: 1px; }
  .rh-store { font-size: 20px; }
  .rh-when  { font-size: 17px; }
  .rh-ident, .rh-sub { font-size: 11.5px; }
  /* swap the control for the plain period */
  .rh-pick { display: none !important; }
  .rh-date { display: inline !important; }
  /* paper is always light, whatever theme the screen was in */
  .rh-lock.dark  { display: none !important; }
  .rh-lock.light { display: block !important; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   THE FOOTER
   Pairs with the masthead and uses the SAME anchor bar — deliberately. The
   header was chosen because it does not add a horizontal rule to a page already
   carrying five; a ruled footer would undo that at the other end. Teal bar top
   and bottom, nothing in between competing with the ledger's own rules.

   It carries what makes a printed page a RECORD rather than a printout: who it
   is about, where the figures came from, which day, and when it was printed.

   ⚠️ The footer used to print at 8.5px — below --fs-xs, the smallest step in the
   design's own scale — while carrying the provenance line that makes the sheet
   auditable. It does not go below 10px again.
   ═══════════════════════════════════════════════════════════════════════════ */
.rf {
  margin-top: 16px;
  padding-top: 8px;
  border-top: 1px solid var(--ink, #16181F);
}
.rf-r1, .rf-r2 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
}
.rf-r2 { margin-top: 3px; }

.rf-who   { font-size: 10.5px; color: var(--ink-3, #6E7280); line-height: 1.45; min-width: 0; }
.rf-who b { color: var(--ink-2, #4B5563); font-weight: 700; }
.rf-when  { font-size: 10.5px; color: var(--ink-3, #6E7280); white-space: nowrap; flex: 0 0 auto; }

.rf-src     { font-size: 10px; color: var(--ink-3, #6E7280); opacity: .85; line-height: 1.45; min-width: 0; }
.rf-printed { font-size: 10px; color: var(--ink-3, #6E7280); opacity: .85; white-space: nowrap; flex: 0 0 auto; }

@media print {
  .rf { margin-top: 14px; padding-top: 7px; }
  .rf-who, .rf-when { font-size: 10px; }
  .rf-src, .rf-printed { font-size: 9.5px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   ⚠️ NO LIGHT GREY ON PAPER. Munier, 2026-07-29: "I don't want any grey text.
   If you do grey, make it very dark grey so it's easily readable."

   The screen token --ink-3 is #8892a8 — a light blue-grey at roughly 3.6:1
   contrast on white. That is the single worst thing you can send to a laser
   printer: light greys are not printed as grey ink, they are DITHERED into
   scattered dots, so they come out washed and broken up in a way they never look
   on screen. Every secondary line on these reports used it — the Site ID and
   address, the note slot, the whole footer.

   For print it becomes #374151 (10.3:1). Still visibly secondary to the near-
   black figures, but solid ink rather than a dot pattern.
   Redefined as a TOKEN so everything downstream darkens at once, rather than
   chasing individual rules and missing some.
   ═══════════════════════════════════════════════════════════════════════════ */
@media print {
  :root {
    --ink-3: #374151 !important;
  }
  /* opacity does the same damage as a light colour — it thins the ink. */
  .rf-src, .rf-printed { opacity: 1 !important; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   THE PRINTED PAGE — margin, and "Page 1 of 3"

   ⚠️⚠️ THIS @page IS THE SINGLE SOURCE OF TRUTH FOR PRINT MARGINS, AND IT IS
   ENFORCED STRICTLY. Munier, 2026-07-29: "apply this to all pages in wam ai and
   enforce it strictly and don't let any specific rules for any printable page
   break this standard." The rule for every printable surface in the app:
     · MARGIN is 0.5in on all four edges. No page may set a different margin.
     · A page may override `size` (portrait <-> landscape) when its table needs
       the width — orientation is allowed to vary, THE MARGIN IS NOT.
     · Header, footer and the "Page X of Y" box come from THIS kit
       (wamMasthead / wamFooter / this @page). A page must not roll its own.
     · THE ONE EXEMPTION is Price Tags (wam.js) — a physical die-cut label sheet,
       not a document, so it prints full-bleed (margin:0). It is commented as such
       at its source. Nothing else is exempt.
   Audited 2026-07-29, all conform: wam.html (Daily Books), report.html,
   daily-margin-report.html, fuel-inventory-report.html, and the invoice
   detail/summary/batch prints in wam.js. The one violation found — invoice detail
   at 0.4in — was corrected to 0.5in in the same pass.

   ⚠️ THIS CORRECTS A CLAIM THIS FILE'S SIBLING USED TO MAKE. report-kit.js said
   browsers "cannot count pages from HTML". That WAS true and is not any more:
   Chrome shipped CSS Paged Media margin boxes with counter(pages) in November
   2024, and Safari 18.2 followed. Verified on a real 3-page print. (MDN still
   documents it as unsupported — MDN is out of date.)

   MARGIN = 0.5in top / 0.5in sides / 0.65in bottom — ASYMMETRIC ON PURPOSE.
   Munier, 2026-07-29: "0.75 margin is too much... is it normal to have top and
   bottom margins as one thing and the side margins as another?" Yes — Excel's
   "Normal" preset is 0.75in vertical with 0.70in sides, its "Narrow" is 0.75in
   vertical with 0.25in sides. The edges solve different problems:
     · TOP and SIDES carry nothing (every margin box there is empty), so the only
       limit is the printer floor — 0.5in is double it, comfortably safe.
     · BOTTOM carries the page number, and Chrome CENTRES text in the band, so the
       gap to the paper edge is (margin - line height)/2. With a 9pt number:
           0.50in -> 0.188in from the edge   CLIPPED on Canon
           0.55in -> 0.213in                 tight
           0.65in -> 0.263in                 SAFE
       0.65in is the smallest bottom margin that keeps it clear.
   Net gain over 0.75in all round: +0.50in of width (+7%) and +0.35in of height.
   Firefox is explicitly out of scope (Munier: "i dont care about firefox").

   The old rationale, kept because the numbers still bind:
     · office lasers physically cannot print to the edge — HP clips at 0.167in,
       Brother 0.16in, Canon ~0.20in and worse again on the top edge when
       duplexing. Design floor is 0.25in from every edge.
     · Chrome centres margin-box text in the margin band, so the gap from the
       paper edge is (margin − line height) / 2. With a 9pt footer:
           0.75in margin -> 0.302in from the edge   SAFE
           0.50in        -> 0.177in                 on Canon's clip line
           0.40in        -> 0.125in                 CLIPPED
       0.75in is the smallest common margin that keeps this footer off the edge.
   There is NO standard to appeal to here — not SEC, IRS, GAAP, AICPA or PCAOB.
   The usual range is 0.5–1.0in and 0.75in sits mid-range.

   ⚠️ ALL SIXTEEN MARGIN BOXES ARE DECLARED, and that is not padding.
   Chrome's print dialog has "Headers and footers" ticked by default and fills any
   box you did NOT claim with its own date / URL / page number. Claiming only the
   edge boxes is not enough — it escapes into the CORNERS and still prints its own
   number beside yours. Every box must be claimed, empty ones included.

   ⚠️ The operator can still defeat this: Chrome honours @page margins only while
   the dialog's Margins dropdown says "Default". Switched to None or Minimum, the
   band collapses and the footer clips. Nothing in CSS can prevent that.

   ⚠️ Firefox renders NO margin boxes at all — no page number there. Its own
   print-dialog header/footer is the fallback.
   ═══════════════════════════════════════════════════════════════════════════ */
@page {
  size: letter portrait;
  /* top | sides | bottom. Bottom was 0.65in while the page number was CENTRED in
     the band (it needed the room to clear the edge). The number is now pinned to
     the TOP of the band (vertical-align:top, confirmed working on Munier's own
     print 2026-07-29), so it rides just under the footer regardless of band size
     — which frees the bottom to shrink to 0.45in. Munier: "push current footer
     down" so it and the page number sit lower together, giving the report more
     height. Set to 0.5in uniform — a bog-standard page margin (QuickBooks'
     default, well within every office printer) that drops the footer + page
     number 0.15in from the old 0.65in and frees that height for the report.
     ⚠️ NOT pushed tighter than 0.5in: a headless --print-to-pdf measurement of
     the number's clearance proved UNRELIABLE (it positions the bottom band
     differently from a real interactive print), so the authoritative check is a
     real Cmd+P print. 0.5in is safe by standard practice; go below it only after
     confirming clearance on actual paper. */
  margin: 0.5in;

  /* the one we want. ⚠️ vertical-align:top pins the number to the TOP of the
     bottom band — right under the footer — instead of centred in it. Munier,
     2026-07-29: "the footer needs to sit... just a little higher than the page
     numbers. too much space right now." Centred, the number floats in the middle
     of a 0.65in band, ~0.3in below the footer; top-aligned it tucks up under it.
     ZERO clipping risk: if a browser ignores the property the number just stays
     centred, exactly as before. ⚠️ NOT YET PROVEN on paper — needs a print test;
     once confirmed, the bottom margin can drop (0.65 -> ~0.45) for more content
     height, which is UNSAFE while the number might still be centring. */
  @bottom-center { content: "Page " counter(page) " of " counter(pages);
                   font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
                   font-size: 9pt; color: #374151; vertical-align: top; }

  /* every other box claimed, so Chrome cannot fill it with its own furniture */
  @top-left-corner    { content: ""; }
  @top-left           { content: ""; }
  @top-center         { content: ""; }
  @top-right          { content: ""; }
  @top-right-corner   { content: ""; }
  @left-top           { content: ""; }
  @left-middle        { content: ""; }
  @left-bottom        { content: ""; }
  @right-top          { content: ""; }
  @right-middle       { content: ""; }
  @right-bottom       { content: ""; }
  @bottom-left-corner { content: ""; }
  @bottom-left        { content: ""; }
  @bottom-right       { content: ""; }
  @bottom-right-corner{ content: ""; }
}
