/* AdCore: the shell every module wears.
   Colour, type, spacing and shape come from the AdComp Support design system
   (tokens.css, a vendored copy of project-unification/docs/design-system).
   This file does two things: it maps the system's tokens onto the ROLE NAMES
   the modules already use (--ink, --panel, --accent, ...), and it styles the
   shell's own classes. Role names are the module-facing API: module CSS uses
   them and never a system token or a hex value. Themes live in tokens.css;
   nothing here changes between light and dark.
   Two selectors on purpose: the system defines --ink (navy / white) on :root,
   and the role --ink means body text. --heading is read on :root, where --ink
   is still the system's; custom properties inherit their COMPUTED value, so
   --heading stays navy everywhere while body re-aliases --ink to --text for
   every descendant. Aliases on body also sit below tokens.css's dark blocks
   in the cascade, so both dark modes (attribute and preference) agree.
   Print tokens (--navy, --teal, ...) are deliberately absent: a module that
   prints re-declares them inside its own .page scope only. @font-face lives
   in fonts.css: the bare layout loads fonts.css without the rest of this file. */

:root {
  --heading: var(--ink);              /* the system's navy, read here before body re-aliases --ink */
  /* frame: the platform's own sizes (the system's page-max is for article pages) */
  --app-max: 1600px; --aside-width: 320px; --control-height: 36px;
}
body {
  /* role names the modules use, resolved through the system tokens on :root */
  /* surfaces and lines */
  --bg: var(--surface); --panel: var(--surface-raised); --field: var(--surface-raised);
  --line: var(--border); --line-strong: var(--border-strong);
  /* text */
  --ink: var(--text); --mute: var(--text-muted);
  /* one action colour */
  --accent: var(--action); --accent-ink: var(--on-action); --accent-hover: var(--action-hover);
  /* status pairs: ground + text, always beside a word, never colour alone */
  --ok-bg: var(--success-soft); --ok-ink: var(--success);
  --warn-bg: var(--warning-soft); --warn-ink: var(--warning);
  --err-bg: var(--danger-soft); --err-ink: var(--danger);
  --info-bg: var(--action-soft); --info-ink: var(--action);
  /* lifecycle flag TRANS (helpers.php flag_chip, Gail 2026-10-04): the system's violet pair stands in for purple */
  --purple-bg: var(--got-soft); --purple-ink: var(--got);
  /* elevation and hover */
  --shadow: var(--shadow-card); --hover-row: var(--surface-subtle);
}
/* ---- end aliases ---- */

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/26px var(--font-sans); }
h1, h2, h3 { color: var(--heading); margin-top: 0; text-wrap: balance; }
h1 { font-size: 24px; line-height: 32px; font-weight: 700; }
h2 { font-size: 19px; line-height: 28px; font-weight: 600; }
h3 { font-size: 16px; line-height: 24px; font-weight: 600; }
a { color: var(--accent); } a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-sm); }
.eyebrow { font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--mute); margin: 0 0 var(--space-2); }
.mute { color: var(--mute); }
.small { font-size: 14px; line-height: 20px; }
code, .code { font-family: var(--font-mono); font-size: .92em; }
.pre-line { white-space: pre-line; }   /* notes and addresses keep their line breaks */

/* ---- layout ---- */
main { max-width: var(--app-max); margin: var(--space-6) auto; padding: 0 var(--space-8) var(--space-12); }
@media (max-width: 640px) { main { padding: 0 var(--space-4) var(--space-8); } }
footer.app-foot { max-width: var(--app-max); margin: 0 auto; padding: 0 var(--space-8) var(--space-6); }   /* the running version (A9); colour from .mute */
@media (max-width: 640px) { footer.app-foot { padding: 0 var(--space-4) var(--space-6); } }
.prose, .content-max { max-width: var(--content-max); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-6); box-shadow: var(--shadow); margin-bottom: var(--space-6); }
.callout { background: var(--info-bg); color: var(--ink); border: 0; border-radius: var(--radius-md); padding: var(--space-3) var(--space-4) var(--space-3) var(--space-8); margin: 0 0 var(--space-4); position: relative; max-width: var(--content-max); }
.callout::before { content: "i"; position: absolute; left: var(--space-3); top: var(--space-3); width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--info-ink); color: var(--info-ink); font: 600 12px/16px var(--font-sans); text-align: center; }
.callout.warn { background: var(--warn-bg); } .callout.warn::before { content: "●"; border: 0; color: var(--warn-ink); font-size: 14px; }
.callout.err { background: var(--err-bg); } .callout.err::before { content: "✕"; border: 0; color: var(--err-ink); }
.callout.ok { background: var(--ok-bg); } .callout.ok::before { content: "✓"; border: 0; color: var(--ok-ink); }
.callout > b:first-child, .callout > strong:first-child { color: var(--heading); display: block; }
.flash { padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); margin: 0 0 var(--space-4); max-width: var(--content-max); }
.flash.ok { background: var(--ok-bg); color: var(--ok-ink); } .flash.warn { background: var(--warn-bg); color: var(--warn-ink); } .flash.error { background: var(--err-bg); color: var(--err-ink); }
.flash.ok::before { content: "✓ "; } .flash.warn::before { content: "● "; } .flash.error::before { content: "✕ "; }

/* ---- header: two rows by design (ruling R5) — brand + account on row 1, the nav on row 2 ---- */
header.app { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; column-gap: var(--space-6); padding: 0 var(--space-8); background: var(--header-bg); color: var(--header-text); }
header.app .brand { grid-row: 1; grid-column: 1; display: flex; align-items: center; gap: var(--space-3); color: var(--header-text); text-decoration: none; padding: var(--space-3) 0; }
header.app .mark { display: block; width: 28px; height: 28px; padding: 3px; background: var(--header-text); border-radius: var(--radius-sm); }
header.app .name { display: flex; flex-direction: column; line-height: 1.1; }
header.app .wordmark { font-size: 18px; font-weight: 700; }
header.app .door { color: var(--header-muted); margin: 2px 0 0; }
header.app .who { grid-row: 1; grid-column: 3; display: flex; align-items: center; gap: var(--space-3); color: var(--header-muted); font-size: 14px; flex-wrap: wrap; justify-content: flex-end; }
header.app .who a, header.app .who button.linkish { color: var(--header-muted); }
header.app .who a:hover, header.app .who button.linkish:hover { color: var(--header-text); background: none; }
header.app .who button.icon { display: inline-flex; padding: var(--space-1); line-height: 0; text-decoration: none; }   /* sun / moon: 20px line icon in currentColor (design system: iconography) */
header.app .who button.icon svg { width: 20px; height: 20px; }
header.app .who button.icon[aria-pressed="true"] { color: var(--brand-green); }
/* Icons: the vendored Lucide sprite (public/assets/icons.svg) through icon(); 20px, the text's colour, 16px inside table rows and chips */
svg.icon { width: 20px; height: 20px; vertical-align: -4px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }   /* a <use> clone does not inherit the sprite root's attributes, so the line style lives here */
a.icon-link { display: inline-flex; color: var(--accent); } a.icon-link svg.icon { width: 1em; height: 1em; vertical-align: 0; }   /* an icon-only link (Deployments device links) */
table.data svg.icon, .chip svg.icon, .small svg.icon { width: 16px; height: 16px; vertical-align: -3px; }
header.app form { margin: 0; display: inline; }
/* Find a client in the header (Round 2 A7): overrides form.search's Home sizing and the header's inline forms */
header.app form.search.head { grid-row: 1; grid-column: 2; justify-self: end; width: 100%; max-width: 26rem; margin: 0; font-size: 14px; }
header.app form.search.head label { display: block; margin: 0; color: var(--header-text); }
header.app form.search.head input[type=text] { width: 100%; min-width: 0; height: var(--control-height); font-size: 14px; padding: 0 var(--space-3); background: var(--field); color: var(--ink); border: 1px solid var(--line); }
header.app form.search.head input[type=text]::placeholder { color: var(--mute); opacity: 1; }   /* the placeholder is the visible label: AA on --field in both schemes */
header.app .who a.guide { font-weight: 600; }
/* The view-as chip opens the viewed person's roles (Round 2 B10), and the name opens Your access (B2): overlays, so the two-row header never grows */
header.app .viewas, header.app .access { position: relative; }
header.app .viewas > summary, header.app .access > summary { cursor: pointer; list-style: none; }
header.app .viewas > summary::-webkit-details-marker, header.app .access > summary::-webkit-details-marker { display: none; }
header.app .access > summary:hover, header.app .access[open] > summary { color: var(--header-text); }
header.app .viewas-box, header.app .access-box { position: absolute; top: calc(100% + var(--space-2)); right: 0; z-index: 20; min-width: 16rem; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-overlay); padding: var(--space-3) var(--space-4); }
header.app .access-box { width: min(22rem, calc(100vw - 2 * var(--space-4))); }
header.app .viewas-box p, header.app .access-box p { margin: 0 0 var(--space-2); color: var(--heading); }
header.app .access-box p.small { color: var(--ink); }
header.app .viewas-box ul.role-summary, header.app .access-box ul.role-summary { margin: 0 0 var(--space-3); padding-left: var(--space-4); }
header.app .viewas-box button.linkish, header.app .viewas-box button.linkish:hover, header.app .who .access-box a, header.app .who .access-box a:hover { color: var(--accent); }
@media (max-width: 640px) { header.app .viewas-box, header.app .access-box { right: auto; left: 0; } }
header.app nav { grid-column: 1 / -1; grid-row: 2; display: flex; gap: var(--space-1); overflow-x: auto; scrollbar-width: none; }
header.app nav a { display: inline-block; padding: var(--space-2) var(--space-3) var(--space-3); color: var(--header-muted); text-decoration: none; font-weight: 600; font-size: 14px; white-space: nowrap; border-bottom: 2px solid transparent; }
header.app nav a:hover { color: var(--header-text); }
header.app nav a[aria-current="page"] { color: var(--header-text); border-bottom-color: var(--brand-green); }
header.app :focus-visible { outline-color: var(--brand-green); }
.brand-strip { height: var(--brand-strip); background: linear-gradient(90deg, var(--brand-blue), var(--brand-green)); }
/* Half a laptop screen: the account items fill row 1, so Find a client takes a row of its own under it (final review, D191) */
@media (min-width: 641px) and (max-width: 900px) {
  header.app form.search.head { grid-row: 2; grid-column: 1 / -1; justify-self: stretch; max-width: none; padding-bottom: var(--space-2); }
  header.app nav { grid-row: 3; }
}
@media (max-width: 640px) {
  header.app { grid-template-columns: 1fr; padding: 0 var(--space-4); }
  header.app .who { grid-row: 2; grid-column: 1; justify-content: flex-start; padding-bottom: var(--space-2); }
  header.app form.search.head { grid-row: 3; grid-column: 1; justify-self: stretch; max-width: none; padding-bottom: var(--space-2); }
  header.app nav { grid-row: 4; flex-wrap: wrap; overflow-x: visible; }   /* wraps, never scrolls (spec 4) */
}

/* Text for screen readers only (a label the design shows by its placeholder) */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---- controls ---- */
.btn { display: inline-flex; align-items: center; min-height: var(--control-height); font: 600 14px/20px var(--font-sans); padding: var(--space-2) var(--space-4); border-radius: var(--radius-md); cursor: pointer; border: 1px solid transparent; text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); } .btn.primary:hover { background: var(--accent-hover); color: var(--accent-ink); }
.btn.ghost { background: var(--panel); color: var(--accent); border-color: var(--line-strong); } .btn.ghost:hover { background: var(--info-bg); }
.btn.danger { background: var(--err-ink); color: var(--accent-ink); } .btn.danger:hover { filter: brightness(.9); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
button.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; border-radius: var(--radius-sm); }
button.linkish:hover { background: var(--info-bg); text-decoration: none; }
label { display: flex; flex-direction: column; gap: var(--space-1); font-size: 14px; line-height: 20px; color: var(--mute); }
label.check { flex-direction: row; align-items: center; gap: var(--space-2); color: var(--ink); }
input:not([type]), input[type=text], input[type=email], input[type=date], input[type=number], input[type=search], select, textarea { font: inherit; padding: 0 var(--space-3); border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--field); color: var(--ink); min-width: 12rem; }
input:not([type]), input[type=text], input[type=email], input[type=date], input[type=number], input[type=search], select { height: var(--control-height); }
textarea { padding: var(--space-2) var(--space-3); }
input[disabled], select[disabled], textarea[disabled] { opacity: .5; cursor: not-allowed; }
form.inline { display: flex; gap: var(--space-3); align-items: end; flex-wrap: wrap; }
.chip { display: inline-block; padding: var(--space-1) var(--space-2); border-radius: var(--radius-pill); background: var(--hover-row); color: var(--mute); font-size: 12px; line-height: 16px; font-weight: 600; margin-right: var(--space-1); }
.chip.ok { background: var(--ok-bg); color: var(--ok-ink); } .chip.ok::before { content: "✓ "; }
.chip.warn { background: var(--warn-bg); color: var(--warn-ink); } .chip.warn::before { content: "● "; }
.chip.err { background: var(--err-bg); color: var(--err-ink); } .chip.err::before { content: "✕ "; }
.chip.info { background: var(--info-bg); color: var(--info-ink); } .chip.info::before { content: "i "; }
.chip.purple { background: var(--purple-bg); color: var(--purple-ink); }
.chip.neutral { background: var(--hover-row); color: var(--mute); }
.chip.yes { background: var(--ok-bg); color: var(--ok-ink); }   /* a held permission (Permissions page): the word, no tick */
dl.role-help { flex-basis: 100%; display: grid; grid-template-columns: max-content 1fr; gap: var(--space-1) var(--space-3); margin: 0 0 var(--space-4); font-size: 14px; line-height: 20px; color: var(--mute); }
dl.role-help dt { font-weight: 600; color: var(--ink); }
dl.role-help dd { margin: 0; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 20px; background: var(--panel); }
table.data th, table.data td { text-align: left; padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--mute); }
table.data th a { color: inherit; text-decoration: none; }
table.data th a:hover { color: var(--accent); text-decoration: underline; }
table.data th[aria-sort] { color: var(--heading); }
table.data tbody tr:hover { background: var(--hover-row); }
tr.mute td { color: var(--mute); }

/* ---- dashboard tiles ---- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: var(--space-4); margin: var(--space-4) 0; }
.tile { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-6); text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.tile:hover { border-color: var(--line-strong); color: var(--ink); }
.tile b { display: block; color: var(--heading); font-size: 16px; line-height: 24px; font-weight: 600; }
.tile span { display: block; color: var(--mute); font-size: 14px; line-height: 20px; margin-top: var(--space-1); }
.tile span.chip { display: inline-block; font-size: 12px; }
.tile.disabled { opacity: .5; pointer-events: none; }

/* ---- login ---- */
.login { max-width: 28rem; margin: var(--space-16) auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-8); box-shadow: var(--shadow); text-align: center; }
.login .lockup { display: block; margin: 0 auto var(--space-4); padding: var(--space-3); background: var(--header-text); border-radius: var(--radius-md); }
.login .callout { text-align: left; }
.login .door-line { margin: 0 0 var(--space-6); font-weight: 600; color: var(--ink); }   /* which door this is (Round 2 E7) */

/* ---- role matrix (admin) ---- */
table.matrix td, table.matrix th { text-align: center; }
table.matrix td:first-child, table.matrix th:first-child { text-align: left; }

/* ---- dashboard client search ---- */
form.search { position: relative; margin: 0 0 var(--space-4); max-width: 34rem; }
form.search input[type=text] { width: 100%; height: auto; font-size: 16px; padding: var(--space-3) var(--space-4); }
ul.suggest { position: absolute; left: 0; right: 0; z-index: 5; margin: var(--space-1) 0 0; padding: var(--space-1) 0; list-style: none; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-overlay); }
ul.suggest li a { display: block; padding: var(--space-2) var(--space-4); color: var(--ink); text-decoration: none; }
ul.suggest li[aria-selected="true"] a, ul.suggest li a:hover { background: var(--hover-row); }
/* A client picker's input and its menu inside a form row (form[data-client-pick]); the menu hangs under the input. */
.ac-wrap { position: relative; display: inline-block; }

/* ---- client record: stacked edit form, inline row actions ---- */
form.stack { display: grid; gap: var(--space-4); max-width: var(--content-max); }
form.stack .row { display: flex; gap: var(--space-3); align-items: end; flex-wrap: wrap; }
form.stack fieldset { border: 1px solid var(--line); border-radius: var(--radius-md); margin: 0; display: grid; gap: var(--space-4); }
form.stack fieldset p { margin: 0; }
form.stack textarea { min-height: 4.5rem; }
/* Round 2 D2: the loss reason shows while CANCELLED is ticked; without :has() it simply always shows */
form.stack .loss-fields { display: grid; gap: var(--space-2); }
form.stack:has(input[name="is_cancelled"]:not(:checked)) .loss-fields { display: none; }
form.inline-form { display: inline; margin: 0; }
.chips { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; margin: 0 0 var(--space-4); }
table.data td.actions form { display: inline; margin: 0 var(--space-1) 0 0; }
table.history details { margin-top: var(--space-1); }
table.history dl { margin: var(--space-1) 0 0; display: grid; grid-template-columns: auto 1fr; gap: var(--space-1) var(--space-3); }
table.history dt { color: var(--mute); } table.history dd { margin: 0; overflow-wrap: anywhere; }

/* ---- client record: two columns from 1100px, the aside sticky ---- */
main.with-aside { display: grid; grid-template-columns: minmax(0, 1fr); column-gap: var(--space-8); row-gap: 0; }
.client-record, .client-aside { margin-top: var(--space-4); }
@media (min-width: 1100px) {
  main.with-aside { grid-template-columns: minmax(0, 1fr) var(--aside-width); }
  main.with-aside > h1, main.with-aside > .chips, main.with-aside > .flash, main.with-aside > p { grid-column: 1 / -1; }
  .client-aside { position: sticky; top: var(--space-6); align-self: start; max-height: calc(100vh - 2 * var(--space-6)); overflow-y: auto; }
}
.client-aside .panel { padding: var(--space-4); }
.client-aside h2 { font-size: 16px; line-height: 24px; margin-bottom: var(--space-3); }
.client-aside dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: var(--space-1) var(--space-3); font-size: 14px; line-height: 20px; }
.client-aside dt { color: var(--mute); } .client-aside dd { margin: 0; overflow-wrap: anywhere; }
.client-aside .panel-empty { margin: 0; }   /* a panel's one sentence sits like its neighbours' rows: small, no extra space (render pass 2026-10-31) */

/* ---- usage (usage plan Task 9): the Usage block, the same partial on both doors ---- */
.usage h3 { margin: var(--space-4) 0 var(--space-2); }
.usage-source-line { margin: 0 0 var(--space-3); }
/* a bar series (13 months, 13 weeks): each bar's height is --usage-h, its share of the series' largest; the title names the figure */
.usage-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 28px; vertical-align: middle; }
.usage-bar { display: block; width: 6px; height: var(--usage-h, 0%); min-height: 2px; background: var(--accent); border-radius: 1px 1px 0 0; }
.usage-bar.zero { height: 1px; min-height: 1px; background: var(--line-strong); }
.usage-weeks { display: flex; align-items: flex-end; gap: var(--space-2); flex-wrap: wrap; }
/* what the client's database does not record: a dashed note, never a zero */
.usage-untracked { border: 1px dashed var(--line-strong); border-radius: var(--radius-md); padding: var(--space-2) var(--space-3); color: var(--mute); }
.usage-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: var(--space-3); }
.usage-tile { border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-3); background: var(--panel); }
.usage-tile b { display: block; color: var(--heading); font-size: 19px; line-height: 28px; font-weight: 600; }
.usage-tile > span { display: block; color: var(--mute); font-size: 14px; line-height: 20px; }
.usage-tile b .mute { font-size: 16px; font-weight: 400; }
.usage-fix { margin: 0; padding-left: var(--space-4); }
.usage-fix li { margin: var(--space-1) 0; }
/* Narrow (a phone, or a narrow column on either door): each payment source is a card, not a 5-column row (browser render
   pass, 2026-10-31). Row 1 the name, last payment and last 30 days, each figure under its column's name; row 2 the reading;
   row 3 the 13 bars. The column heads stay for screen readers; nothing scrolls sideways. */
.usage { container: usage / inline-size; }
@container usage (max-width: 600px) {
  table.usage-sources, table.usage-sources tbody { display: block; }
  table.usage-sources thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  table.usage-sources tr { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: var(--space-2) var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--line); }
  table.usage-sources tr:first-child { border-top: 1px solid var(--line); }
  table.usage-sources td { display: block; padding: 0; border: 0; }
  table.usage-sources td[data-label]::before { content: attr(data-label); display: block; color: var(--mute); font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }   /* the eyebrow, as the table.data th it stands in for */
  table.usage-sources td.usage-src { grid-column: 1; grid-row: 1; }
  table.usage-sources td.usage-last { grid-column: 2; grid-row: 1; }
  table.usage-sources td.usage-30 { grid-column: 3; grid-row: 1; }
  table.usage-sources td.usage-read { grid-column: 1 / -1; grid-row: 2; }
  table.usage-sources td.usage-series { grid-column: 1 / -1; grid-row: 3; display: flex; align-items: flex-end; gap: var(--space-2); }
  table.usage-sources td.usage-series::before { order: 1; }
}
/* Narrower still (a 320-390px phone): the two eyebrowed figures take about 232px, so beside them the name had 6-76px and
   was drawn over "Last payment". Under 360px the name and place get row 1 to themselves, the two figures sit side by side
   on row 2, the reading row 3, the bars row 4 (render pass review, 2026-10-31). */
@container usage (max-width: 360px) {
  table.usage-sources tr { grid-template-columns: auto auto minmax(0, 1fr); }
  table.usage-sources td.usage-src { grid-column: 1 / -1; grid-row: 1; }
  table.usage-sources td.usage-last { grid-column: 1; grid-row: 2; }
  table.usage-sources td.usage-30 { grid-column: 2; grid-row: 2; }
  table.usage-sources td.usage-read { grid-row: 3; }
  table.usage-sources td.usage-series { grid-row: 4; }
}

/* ---- the Daily check's history on Deployments' record (checks::_history_section, browser render pass 2026-10-31) ----
   One table with fixed columns, so Day, Status, Note, Ticket and Recorded by line up across sources; each source's
   name heads its own <tbody> with space above it. A section under 56rem (a phone or a tablet) stacks each day instead:
   day and status, then the note, then the ticket and who recorded it, so nothing is cut off. 56rem because the four
   fixed columns take 37.5rem: at the narrowest table the Note column still has about 16rem (review, 2026-10-31). */
#check-history { container: check-history / inline-size; }
table.check-history { table-layout: fixed; }
table.check-history col.ch-day { width: 8.5rem; }
table.check-history col.ch-status { width: 11rem; }
table.check-history col.ch-ticket { width: 8rem; }
table.check-history col.ch-by { width: 10rem; }
table.check-history td { overflow-wrap: break-word; }
table.check-history td.ch-day, table.check-history td.ch-status { white-space: nowrap; }
table.check-history tr.ch-source th { padding-top: var(--space-6); font-size: 16px; line-height: 24px; letter-spacing: 0; text-transform: none; color: var(--heading); }
table.check-history tbody:first-of-type tr.ch-source th { padding-top: var(--space-3); }
table.check-history tbody tr.ch-source:hover { background: none; }
@container check-history (max-width: 56rem) {
  table.check-history, table.check-history tbody, table.check-history tr, table.check-history th, table.check-history td { display: block; }
  table.check-history colgroup { display: none; }
  table.check-history thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  table.check-history tbody tr:not(.ch-source) { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); grid-template-areas: "day status" "note note" "ticket by"; gap: var(--space-1) var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--line); }
  table.check-history td, table.check-history tr.ch-source th { padding-left: 0; padding-right: 0; }
  table.check-history td { padding: 0; border: 0; }
  table.check-history td.ch-day { grid-area: day; font-weight: 600; color: var(--ink); }
  table.check-history td.ch-status { grid-area: status; }
  table.check-history td.ch-note { grid-area: note; }
  table.check-history td.ch-note:empty, table.check-history td.ch-ticket:empty { display: none; }
  table.check-history td.ch-ticket { grid-area: ticket; }
  table.check-history td.ch-by { grid-area: by; color: var(--mute); }
  table.check-history td.ch-ticket:empty + td.ch-by { grid-column: 1 / -1; }
}
@container check-history (max-width: 20rem) {
  table.check-history tbody tr:not(.ch-source) { grid-template-columns: minmax(0, 1fr); grid-template-areas: "day" "status" "note" "ticket" "by"; }
}

/* ---- the other door's reports (Round 2 A8) and printing (A5) ---- */
.other-reports summary { cursor: pointer; font-weight: 600; }
.other-reports table.data { margin-top: var(--space-3); }
.print-head { display: none; }
/* A page that carries a print head (_print_head.php) prints without the shell; platform.js prints it light. */
@media print {
  body:has(.print-head) header.app, body:has(.print-head) .brand-strip, body:has(.print-head) footer.app-foot, body:has(.print-head) .flash, .other-reports { display: none; }
  /* The print head names the page and the HQ copy once, so the screen's title and as-of line stay off the paper (final review, D188). */
  body:has(.print-head) main h1, body:has(.print-head) main .hq-freshness { display: none; }
  body:has(.print-head) main { max-width: none; margin: 0; padding: 0; }
  .print-head { display: grid; gap: var(--space-1); padding-bottom: var(--space-3); margin-bottom: var(--space-4); border-bottom: 1px solid var(--line); }
  .print-head b { font-size: 20px; line-height: 28px; color: var(--heading); }
}
