/* ================================================================================================
   THE PRODUCTION DOCUMENT — one stylesheet, every non-financial document.

   Call sheet, equipment list, agreement, risk assessment. The sibling of invoice-doc.css, and
   deliberately NOT the same file: a financial document and an operational one are different
   documents with different obligations, and the acceptance criterion for this whole workstream is
   two intentional PDF families rather than one stretched over both.

   WHAT THIS FILE OWNS. Page size, margins, typography, spacing rhythm, table styling, row padding,
   line height, borders, muted text, print-safe colour, and — the part that matters most — every
   page-break rule. A document template composes the blocks below and supplies its own content and
   its own order. IT NEVER DECLARES ITS OWN @page, ITS OWN BREAK RULES OR ITS OWN PRINT COLOURS.
   Copying print CSS into a second document is the failure this file exists to prevent.

   THE GOAL IS NOT UNIFORM DOCUMENTS. A call sheet and an agreement should not look alike. They
   should be built to the same standard — the same margins, the same type scale, the same idea of
   what a section heading is, the same behaviour at a page break.

   COLOURS ARE THE HANDBOOK'S PAPER TOKENS (11-implementation-tokens §1.6, light/print column),
   restated here as literals because this stylesheet is loaded by a standalone print surface with
   no app theme on it.
   ================================================================================================ */

:root{
  /* ---- the shared foundation. A template may read these; it must not fork them. ------------- */
  --ks-doc-page-margin:     14mm;
  --ks-doc-title-spacing:   18px;
  --ks-doc-section-spacing: 16px;
  --ks-doc-row-padding:     5px 8px;
  --ks-doc-line-height:     1.45;
  --ks-doc-border:          #d7dee5;   /* --pline */
  --ks-doc-border-soft:     #e7ecf1;
  --ks-doc-muted-text:      #5a6b7b;   /* --ink-dim */
  --ks-doc-ink:             #15202b;   /* --ink */
  --ks-doc-faint:           #b7c3cd;   /* --ink-faint */
  --ks-doc-paper2:          #f4f7f9;   /* --paper2, the one tinted surface */
  --ks-doc-accent:          #ff3d63;   /* overridden per document, from the company brand */
}

/* ================================================================================================
   1. THE PAGE

   NO @page HERE, DELIBERATELY — the same rule invoice-doc.css records, for the same reason. This
   stylesheet is loaded by the WHOLE APP so the app's own print frame can draw from it, and an
   unscoped @page would silently change the margins of every other print path in the product: the
   inventory, the un-migrated gear list, the release, any Cmd-P on any screen. The page margin
   therefore lives in the two places that print ONLY this document — print-prod.html and
   prodDocWrap's frame — and is stated as --ks-doc-page-margin so all three agree on one number.
   ================================================================================================ */
.ksp-doc{
  font-family:"Plus Jakarta Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,system-ui,sans-serif;
  font-size:11px;
  line-height:var(--ks-doc-line-height);
  letter-spacing:-.01em;
  color:var(--ks-doc-ink);
  background:#fff;
  max-width:820px;          /* screen preview only; print is governed by @page */
  margin:0 auto;
  padding:var(--ksp-pad, 0);
}

/* PRINT THE COLOUR, ALWAYS. Browsers drop background fills when printing, so the section bands and
   the tinted panels came out as plain text on white — the printed document stops looking like the
   document at exactly the moment it matters. Set unconditionally, not inside @media print:
   Chromium's headless page.pdf() and window.print() both honour it, and screen is unaffected.
   Same decision, same reasoning, as invoice-doc.css. */
.ksp-doc, .ksp-doc *{ -webkit-print-color-adjust:exact; print-color-adjust:exact; }

.ksp-noprint{ display:none !important; }   /* nothing editor-only can reach a production document */

/* ================================================================================================
   2. LETTERHEAD
   ================================================================================================ */
.ksp-top{ display:flex; justify-content:space-between; align-items:flex-start; gap:24px; }
/* The document's name sits on the RIGHT, opposite the letterhead — the same arrangement the
   invoice family uses. It was on the left, which made every production document the mirror image
   of every quote and invoice that left the building. */
.ksp-idblock{ min-width:0; text-align:right; }
.ksp-title{
  font-size:21px; font-weight:800; line-height:1.1; letter-spacing:-.02em;
  color:var(--ks-doc-accent); text-transform:uppercase;
}
/* The line that identifies the document beneath its title — a call sheet's day type, an
   agreement's template header. NOT uppercased: it carries proper nouns and dates as often as it
   carries a category label, and shouting a project name back at the reader is not a style. */
.ksp-subtitle{
  font-size:9.5px; font-weight:700; letter-spacing:.02em;
  color:var(--ks-doc-muted-text); margin-top:5px; max-width:52ch;
}
.ksp-who{ text-align:left; min-width:0; }
.ksp-logo{ max-height:34px; max-width:150px; object-fit:contain; display:block; margin:0 auto 5px 0; }
/* THE COMPANY IS NAMED IN THE SAME HAND AS THE CLIENT. This was 800 with the tracking pulled in,
   against the client's name at 700 with none, so the two names facing each other across the same
   document were visibly different type — the heavier cut reads as a different family rather than a
   heavier weight of the same one. The client's setting is the one that looked right, so it is the
   one both use. Size still separates them; weight no longer does. */
.ksp-co{ font-size:14px; font-weight:700; }
.ksp-codet{
  font-size:8.5px; line-height:1.5; color:var(--ks-doc-muted-text);
  white-space:pre-line; margin-top:2px;
}
/* The accent rule under the letterhead. One weight, one colour, on every production document —
   the single strongest signal that these are one family. */
.ksp-hr{ height:2px; background:var(--ks-doc-accent); margin:10px 0 0; }
.ksp-strap{
  font-size:11.5px; font-weight:700; color:var(--ks-doc-ink);
  margin:8px 0 0; line-height:1.4;
}

/* ================================================================================================
   3. SECTIONS
   ================================================================================================ */
.ksp-sec{ margin-top:var(--ks-doc-section-spacing); }
.ksp-sec:first-of-type{ margin-top:var(--ks-doc-title-spacing); }

.ksp-h{
  font-size:9.5px; font-weight:800; letter-spacing:.16em; text-transform:uppercase;
  color:var(--ks-doc-accent);
  border-bottom:1.5px solid var(--ks-doc-accent);
  padding-bottom:4px; margin-bottom:8px;
  display:flex; align-items:baseline; justify-content:space-between; gap:16px;
}
/* The section's own count or progress, inside its heading so a page break cannot separate the two. */
.ksp-h .m{
  font-size:8.5px; font-weight:700; letter-spacing:.08em;
  color:var(--ks-doc-muted-text); white-space:nowrap; flex:0 0 auto;
}

/* ================================================================================================
   4. FACTS — the label/value information row (handbook 11 §13.5, printed form)
   ================================================================================================ */
.ksp-facts{ width:100%; border-collapse:collapse; }
.ksp-facts th{
  text-align:left; vertical-align:top; white-space:nowrap;
  font-size:9px; font-weight:800; letter-spacing:.06em; text-transform:uppercase;
  color:var(--ks-doc-muted-text);
  padding:3px 14px 3px 0; width:1%;
}
.ksp-facts td{
  vertical-align:top; padding:3px 0; font-size:11px; white-space:pre-line;
}
/* A URL is an identifier: it wraps, it never truncates, and it never overflows the page. */
.ksp-facts td a, .ksp-url{ color:var(--ks-doc-ink); word-break:break-word; text-decoration:none; }

/* ================================================================================================
   5. TABLES
   ================================================================================================ */
.ksp-tab{ width:100%; border-collapse:collapse; table-layout:fixed; }
/* The section name, inside the head so it repeats with the columns it names. Styled to match
   .ksp-h exactly — it IS a section heading; the only thing that changed is which element it sits
   in, and therefore whether a page break carries it along. */
.ksp-tab thead tr.cap th{
  background:transparent; color:var(--ks-doc-accent);
  font-size:9.5px; font-weight:800; letter-spacing:.16em; text-transform:uppercase;
  border-bottom:1.5px solid var(--ks-doc-accent);
  padding:0 0 4px; text-align:left;
}
.ksp-tab thead tr.cap th .caph{
  display:flex; align-items:baseline; justify-content:space-between; gap:16px;
}
.ksp-tab thead tr.cap th .m{
  font-size:8.5px; font-weight:700; letter-spacing:.08em;
  color:var(--ks-doc-muted-text); white-space:nowrap; flex:0 0 auto; text-transform:none;
}
/* The gap between that heading and the column band, which .ksp-h got from its own margin.
   NO background-clip HERE: with border-collapse the cells share a border, and clipping the fill to
   the padding box left a white seam down the middle of the accent band between every pair of
   columns. The spacing wants padding, not clipping. */
.ksp-tab thead tr.cap + tr th{ padding-top:12px; }
.ksp-tab th{
  background:var(--ks-doc-accent); color:#fff;
  font-size:8px; font-weight:800; letter-spacing:.1em; text-transform:uppercase;
  text-align:left; padding:4px 8px; white-space:nowrap;
}
.ksp-tab td{
  border-bottom:1px solid var(--ks-doc-border-soft);
  padding:var(--ks-doc-row-padding);
  font-size:10px; vertical-align:top;
  overflow-wrap:anywhere;              /* a long word wraps rather than escaping its column */
}
.ksp-tab tr:last-child td{ border-bottom:0; }
.ksp-tab td.b{ font-weight:700; }
/* A cell's second line: the item's model, serial, case and notes under its name. Secondary by size
   and colour, never by being hard to read — it is still the operational detail somebody is packing
   from. Same reasoning as .ksp-note. */
.ksp-tab td .s{
  font-size:8.5px; line-height:1.45; color:var(--ks-doc-muted-text);
  margin-top:2px; white-space:pre-line;
}
.ksp-tab td.n{ white-space:nowrap; }
.ksp-tab td.r{ text-align:right; }

/* ================================================================================================
   6. THE KEY-TIMES BAND
   ================================================================================================ */
.ksp-times{ width:100%; border-collapse:collapse; table-layout:fixed; text-align:center; }
.ksp-times td{ border:1px solid var(--ks-doc-border); padding:7px 5px; }
.ksp-times .l{
  font-size:8px; font-weight:800; letter-spacing:.1em; text-transform:uppercase;
  color:var(--ks-doc-accent);
}
.ksp-times .v{ font-size:14px; font-weight:800; margin-top:2px; letter-spacing:-.01em; }

/* ================================================================================================
   7. THE RUN SHEET — a time gutter and a block of production detail, not a spreadsheet.

   The hierarchy is carried by size and weight rather than by columns, so a multi-line note or a
   long kit list stays legible instead of being crushed into a 60px cell. READABILITY OVER PAPER
   ECONOMY: an item is never compressed to win space and the schedule takes as many pages as it
   needs.
   ================================================================================================ */
.ksp-run{ width:100%; border-collapse:collapse; table-layout:fixed; }
.ksp-run td{ border-top:1px solid var(--ks-doc-border-soft); padding:11px 0 12px; vertical-align:top; }
.ksp-run tr:first-child td{ border-top:0; padding-top:2px; }
.ksp-run .t{ width:96px; white-space:nowrap; padding-right:12px; }
.ksp-run .t .s{ font-size:11.5px; font-weight:800; letter-spacing:-.01em; }
.ksp-run .t .e{ font-size:10.5px; color:var(--ks-doc-muted-text); margin-top:1px; }
.ksp-run .b{ padding-left:0; }
.ksp-run .b.cat{ padding-left:11px; border-left:3px solid var(--ksp-cat, transparent); }
.ksp-run .cl{ font-size:7.5pt; font-weight:800; letter-spacing:.09em; margin-bottom:1mm; }
.ksp-run .ti{ font-size:14px; font-weight:800; line-height:1.3; letter-spacing:-.015em; }
.ksp-run .de{ font-size:9.5px; color:var(--ks-doc-muted-text); margin-top:2px; }
.ksp-run .no{ font-size:11px; margin-top:5px; white-space:pre-line; }
.ksp-run .eq{ font-size:9.5px; color:var(--ks-doc-muted-text); font-style:italic; margin-top:4px; white-space:pre-line; }

/* ================================================================================================
   8. GROUPED LISTS — the equipment list's shape (phase 2), declared here because it is a shared
   block and not a gear-list-specific one: a risk assessment's control list is the same object.
   ================================================================================================ */
.ksp-grp{ margin-top:9px; }
.ksp-grp:first-child{ margin-top:0; }
.ksp-grp .gl{
  font-size:9px; font-weight:800; letter-spacing:.1em; text-transform:uppercase;
  color:var(--ks-doc-accent); margin-bottom:3px;
}
.ksp-grp .gi{
  font-size:10px; padding:2.5px 0 2.5px 10px; border-bottom:1px solid var(--ks-doc-border-soft);
  text-indent:-10px;
}
.ksp-grp .gi:last-child{ border-bottom:0; }
.ksp-grp .gi .m{ color:var(--ks-doc-muted-text); }

/* ================================================================================================
   8b. SIGNATURES — the agreement's block, and the reason .ksp-sig is in the break rules.

   A signature and the identity it belongs to are ONE object: the ink, the rule beneath it, the
   party label, the name, the role, the date and the signing evidence. The shared break rules hold
   the whole thing together, so a name never prints on one page with its signature on the next.
   ================================================================================================ */
.ksp-sig{ margin-top:20px; }
/* THE TWO RULES ARE ONE LINE. Both cells carry the same 50px ink box above their rule, so aligning
   the cells at the TOP puts the rules level. Aligned at the end, the signer's extra role line
   under the rule pushed that rule up by a line (measured 2026-09-06 on a countersigned PDF:
   signature rule 17px above the date rule; owner: "the date and signature line on the same level"). */
.ksp-sig .row{ display:grid; grid-template-columns:1fr 210px; gap:34px; align-items:start; }
.ksp-sig .ink{ height:50px; display:flex; align-items:flex-end; }
/* NEVER SCALED UP. A small capture stays small — enlarging one makes a hesitant signature look
   like a confident one, which is not a rendering decision anybody is entitled to make. */
.ksp-sig .ink img{ max-height:50px; max-width:100%; width:auto; object-fit:contain; object-position:left bottom; }
.ksp-sig .ink .typed{ font-size:19px; line-height:1.1; padding-bottom:2px; }
.ksp-sig .line{ border-bottom:1px solid var(--ks-doc-muted-text); }
.ksp-sig .k{
  font-size:7.5px; font-weight:800; letter-spacing:.11em; text-transform:uppercase;
  color:var(--ks-doc-muted-text); margin-top:6px;
}
.ksp-sig .n{ font-size:10.5px; margin-top:3px; }
.ksp-sig .r{ font-size:8px; color:var(--ks-doc-muted-text); margin-top:2px; }
.ksp-sig-intro{ font-size:9px; line-height:1.6; color:var(--ks-doc-muted-text); margin-bottom:4px; }

/* ---- the verification code ---------------------------------------------------------------- */
.ksp-qr{ display:flex; align-items:flex-end; gap:12px; margin-top:6px; }
.ksp-qr .c{
  font-size:8px; letter-spacing:.1em; text-transform:uppercase; font-weight:700;
  color:var(--ks-doc-muted-text); padding-bottom:3px;
}
.ksp-qr .c .u{
  display:block; margin-top:3px; font-weight:400; letter-spacing:0; text-transform:none;
  font-size:8px; word-break:break-all; max-width:44ch;
}

/* ================================================================================================
   9. TEXT, LINKS, NOTES, FOOTER
   ================================================================================================ */
.ksp-text{ font-size:11px; line-height:1.6; white-space:pre-line; }
.ksp-text.dim{ color:var(--ks-doc-muted-text); }
.ksp-text p{ margin:0 0 8px; }
.ksp-text p:last-child{ margin-bottom:0; }

/* A PDF cannot open a checkout or a group order, so a link prints as what it is: a name and the
   address underneath it. Never a button that does nothing on paper. */
.ksp-linkrow{ font-size:11px; }
.ksp-linkrow .l{ font-weight:700; }
.ksp-linkrow .u{ font-size:9.5px; color:var(--ks-doc-muted-text); word-break:break-word; margin-top:1px; }

/* FINE PRINT IS STILL PRINT. This was --ks-doc-faint (#b7c3cd), which is about 1.9:1 on white —
   below any usable threshold, and the block it styles is the confidentiality clause: the one
   paragraph on a call sheet that carries a legal obligation. Secondary is a matter of SIZE and
   POSITION, not of being hard to read (handbook 08). Muted is 6.4:1 and still reads as fine print. */
.ksp-note{ font-size:8.5px; line-height:1.55; color:var(--ks-doc-muted-text); margin-top:14px; }
.ksp-foot{
  margin-top:18px; padding-top:9px; border-top:1px solid var(--ks-doc-border);
  font-size:8.5px; color:var(--ks-doc-muted-text);
  display:flex; justify-content:space-between; gap:16px;
}

/* ================================================================================================
   10. PAGE BREAKS — the whole reason this file exists.

   Every rule below is stated once, here, and applies to every production document. A template that
   needs different behaviour marks a block, it does not write a rule.
   ================================================================================================ */

/* A HEADING NEVER ENDS A PAGE. break-after:avoid on the heading and break-inside:avoid on the
   heading-plus-first-rows wrapper are both needed: the first stops "SAFETY & LOGISTICS" printing
   alone at the foot of page 1, the second stops a two-row section splitting for no reason. */
.ksp-h{ break-after:avoid; page-break-after:avoid; }

/* SHORT SECTIONS STAY WHOLE. The template marks a block `keep` when its content is bounded — a
   facts grid, a notes paragraph, a key-times band. Long content is deliberately NOT marked, so it
   flows across pages naturally rather than being pushed whole onto a fresh page and leaving half a
   page blank. */
.ksp-sec.keep{ break-inside:avoid; page-break-inside:avoid; }

/* A ROW IS ATOMIC. A crew member, a talent call, a schedule item — each is one fact and is never
   split down the middle by a page break. This is the CSS equivalent of csPdf's measure-then-turn,
   and unlike it, it cannot be forgotten by the next block that gets added. */
.ksp-tab tr, .ksp-run tr, .ksp-grp .gi{ break-inside:avoid; page-break-inside:avoid; }

/* COLUMN HEADINGS REPEAT. A table continuing onto page 2 reads as a different table without them. */
.ksp-tab thead{ display:table-header-group; }
.ksp-run thead{ display:table-header-group; }

/* A SIGNATURE IS NEVER SEPARATED FROM WHAT IT SIGNS. Reserved for the agreements migration
   (phase 3) — the rule belongs to the shared foundation, so that migration changes rendering only
   and inherits its pagination rather than reimplementing it. */
.ksp-sig{ break-inside:avoid; page-break-inside:avoid; }
.ksp-sig-intro{ break-after:avoid; page-break-after:avoid; }

/* LONG CONTENT CONTINUES NATURALLY. An agreement's clause body, a 200-item gear list and a
   40-item schedule are all allowed to run over as many pages as they need. Nothing is ever scaled
   down to fit: there is no zoom, no shrink-to-fit and no font-size reduction anywhere in this
   file, because an unreadable document is not a shorter document. */
.ksp-flow{ break-inside:auto; page-break-inside:auto; }

/* ORPHANS AND WIDOWS. Two lines minimum either side of a break in any running text. */
.ksp-doc{ orphans:2; widows:2; }

/* ================================================================================================
   11. SCREEN PREVIEW — the local print frame and the on-screen comparison render the same markup,
   so the preview cannot flatter the PDF. Padding only; nothing structural changes.
   ================================================================================================ */
@media screen{
  .ksp-doc{ --ksp-pad:28px; }
}
