/* Xen costing sheet: the shared stylesheet, console dialect (WP-05).
   Every colour is a token from assets/tokens.css (the catalogue's file); load tokens.css first. No hex here.
   Order: 1 base · 2 type roles · 3 shell · 4 cards, buttons, pills, segmented · 5 fields, owned select, checkbox
   · 6 tables · 7 states · 8 popover, dialogs, toast · 9 motion and media · 10 alias block · 11 legacy page classes. */

/* 1. base */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; min-height: 100%; background-color: var(--color-paper); background-image: var(--ground); background-attachment: fixed; }
@media (min-width: 1024px) { html { zoom: 0.9; } }      /* owner's approved desktop density */
@media print { html { zoom: 1; } }
body { margin: 0; font-family: var(--font-sans); font-size: 13px; line-height: 1.4; color: var(--color-graphite); background: transparent; min-height: 100vh; -webkit-font-smoothing: antialiased; }
/* Under the zoom Chrome's 100vh is 10 % short of the window, so full-height boxes use this. */
@media (min-width: 1024px) { body { min-height: calc(100vh / 0.9); } }
::selection { background: var(--color-accent-wash); color: var(--color-graphite); }
:root { caret-color: var(--color-accent); scrollbar-color: var(--color-rule) transparent; scrollbar-width: thin; }
a { color: var(--color-accent-ink); text-decoration: none; }
@media (hover: hover) { a:hover { text-decoration: underline; } }
img { max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
@media (min-width: 1024px) { :focus-visible { outline-width: calc(2px / 0.9); } }
/* fields draw their own inset ring; the outline stays, transparent, so forced colours still show a ring */
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid transparent; outline-offset: 2px; }
[hidden] { display: none !important; }
.tabular { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-sm { width: 12px; height: 12px; }

/* 2. type roles: pages never set raw sizes */
.t-page { font-size: 22px; line-height: 28px; font-weight: 700; letter-spacing: -0.01em; margin: 0; }
.t-heading { font-size: 16px; line-height: 22px; font-weight: 600; margin: 0; }
.t-figure { font-size: 22px; line-height: 28px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.t-body { font-size: 13px; line-height: 18px; }
.t-caption { font-size: 12px; line-height: 16px; color: var(--color-graphite-muted); }
.t-eyebrow { font-size: 11px; line-height: 14px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; color: var(--color-graphite-muted); }
.t-code { font-size: 11px; line-height: 14px; font-weight: 700; letter-spacing: 0.5px; font-variant-numeric: tabular-nums; color: var(--color-graphite-muted); }

/* 3. shell: rail 208 (56 compact on tablets, a drawer on phones), glass top bar 52. Drawn by xen-shell.js into #xenShell. */
.shell { display: grid; grid-template-columns: 208px minmax(0, 1fr); min-height: 100vh; }
@media (min-width: 1024px) { .shell { min-height: calc(100vh / 0.9); } }
.rail { background: var(--color-navy); color: var(--color-on-navy); padding: 14px 10px; display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 0; align-self: start; height: 100vh; overflow-y: auto; }
@media (min-width: 1024px) { .rail { height: calc(100vh / 0.9); } }
.mark-plate { background: var(--surface-mark); border-radius: var(--radius-md); padding: 8px 12px; display: flex; align-items: center; justify-content: center; margin: 0 4px 10px; }
.mark-plate img { height: 28px; width: auto; display: block; }
.rail-group { font-size: 11px; line-height: 14px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; color: var(--color-on-navy-muted); padding: 10px 14px 4px; }
.rail a { display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 36px; border-radius: var(--radius-chip); color: var(--color-on-navy); font-size: 13px; font-weight: 500; text-decoration: none; }
.rail a .icon { width: 18px; height: 18px; opacity: 0.85; }
@media (hover: hover) { .rail a:hover { background: var(--color-navy-3); text-decoration: none; } }
.rail a[aria-current="page"] { background: var(--color-accent); color: var(--color-on-accent); font-weight: 600; }
.rail a[aria-current="page"] .icon { opacity: 1; }
.rail .nav-group { display: flex; flex-direction: column; gap: 2px; }
.rail .nav-subitems, .rail .nav-subitems-inner { display: contents; }
.rail-foot { margin-top: auto; padding: 12px 14px 0; font-size: 11px; line-height: 14px; color: var(--color-on-navy-muted); border-top: 1px solid var(--color-navy-3); }
.main { min-width: 0; display: flex; flex-direction: column; }
/* WP-07i: the "studying the brass rate" banner slot, under the bar, full width. Empty and collapsed (no gap)
   until xenRenderStudyBanner() fills it. */
.study-banner-slot:empty { display: none; }
.study-banner-slot { padding: 12px 16px 0; }
@media (min-width: 1024px) { .study-banner-slot { padding: 12px 24px 0; } }
.study-banner-slot .notice { align-items: center; flex-wrap: wrap; }
.study-banner-slot .notice .btn + .btn { margin-left: 8px; }
.topbar { position: sticky; top: 0; z-index: 30; height: var(--topbar-h); margin: 12px 16px 0; padding: 0 16px; display: flex; align-items: center; gap: 12px;
  background: var(--color-glass); -webkit-backdrop-filter: blur(18px) saturate(180%); backdrop-filter: blur(18px) saturate(180%);
  border: 1px solid var(--color-glass-edge); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }
.topbar .bar-title { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: 12px; color: var(--color-graphite-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .btn { height: 32px; padding: 0 10px; font-size: 12px; }
.topbar .menu-btn { display: none; }
.content { padding: 20px 16px 48px; max-width: none; width: 100%; display: flex; flex-direction: column; gap: 20px; }   /* WP-07e: no empty band on wide screens; --content-max stays for print and the boards */
@media (min-width: 1024px) { .content { padding: 24px 24px 64px; } .topbar { margin: 12px 24px 0; } }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 16px; }
@media (min-width: 768px) and (max-width: 1023px) {          /* tablet: the compact 56 px rail, icons only */
  .shell { grid-template-columns: 56px minmax(0, 1fr); }
  .rail { padding: 14px 6px; align-items: center; }
  .rail .mark-plate { padding: 6px; margin: 0 0 8px; }
  .rail .mark-plate img { height: 22px; }
  .rail-group, .rail-foot, .rail a span { display: none; }
  .rail a { width: 40px; padding: 0; justify-content: center; }
}
@media (max-width: 767px) {                                   /* phone: the rail is a drawer, opened by the menu button */
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { position: fixed; z-index: 62; left: 0; top: 0; bottom: 0; width: 240px; max-width: 86vw; height: auto; transform: translateX(-105%); border-radius: 0 var(--radius-sheet) var(--radius-sheet) 0; transition: transform 280ms var(--ease-spring); }
  .shell:not([data-rail-open]) .rail { visibility: hidden; transition: transform 280ms var(--ease-spring), visibility 0s linear 280ms; }
  .shell[data-rail-open] .rail { transform: none; }
  .rail-scrim { position: fixed; inset: 0; z-index: 61; background: var(--color-scrim); }
  .topbar { margin: 8px 8px 0; height: 48px; padding: 0 10px; gap: 8px; border-radius: var(--radius-md); }
  .topbar .who, .topbar .segmented { display: none; }
  .topbar .menu-btn { display: inline-flex; }
  .content { padding: 16px 16px 96px; }
  .page-head { flex-direction: column; position: relative; }
  .page-head > .info { position: absolute; top: 0; right: 0; }   /* WP-08b: the (i) sits level with the title, not alone on a row below */
  .page-head:has(> .info) > div:first-child { padding-right: 40px; }
  .page-head > .info .popover { left: auto; right: 0; }
}

/* 4. cards, buttons, pills, chips, segmented */
.card { background: var(--color-card); border: 1px solid var(--color-hairline); border-top-color: var(--color-card-edge); border-radius: var(--radius-card); box-shadow: var(--shadow-card); }
.card-lg { border-radius: var(--radius-lg); }
.card-pad { padding: 16px; }
.card-inset { padding: var(--sp-1); }
.card-inner { border-radius: calc(var(--radius-lg) - 1px - var(--sp-1)); overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--color-navy); color: var(--color-on-navy);
  border-radius: calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px) 0 0; padding: 8px 16px; font-size: 11px; font-weight: 700; line-height: 14px; letter-spacing: 0.5px; text-transform: uppercase; }
.sunken { background: var(--color-paper-sunken); }
.divider { border: 0; border-top: 1px solid var(--color-hairline); margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.card-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.card-grid > * { min-width: 0; }
.card-grid .t-figure, .card-grid td.num { white-space: nowrap; }
.card-grid tr[data-breakdown] td.num { white-space: normal; }
@media (min-width: 768px) { .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .card-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }   /* WP-07h (owner): four across once WP-07e gives room, not stretched past ~420px at 1920 */
.card-grid .form-grid-2 { grid-template-columns: 1fr; }
@media (min-width: 480px) { .card-grid .form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.stat .t-figure.key { color: var(--color-accent); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; }
.section-head .t-eyebrow { padding-left: 2px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: var(--radius-chip); border: 1px solid transparent;
  font-size: 13px; line-height: 18px; font-weight: 700; white-space: nowrap; cursor: pointer; background: transparent; text-decoration: none; }
@media (hover: hover) { .btn:hover { text-decoration: none; } }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12px; }
.btn-lg { height: 48px; padding: 0 20px; font-size: 15px; }
.btn-primary { background: var(--color-accent); color: var(--color-on-accent); }
@media (hover: hover) { .btn-primary:hover { background: var(--color-accent-hover); } }
.btn-secondary { background: var(--color-card); border-color: var(--color-rule); color: var(--color-graphite); }
.btn-accent { background: var(--color-accent-wash); color: var(--color-accent-ink); }
@media (hover: hover) { .btn-accent:hover { background: var(--color-accent-wash-hover); } }
.btn-text { color: var(--color-accent-ink); padding: 0 var(--sp-2); }
.btn-danger { background: var(--color-breach-red-wash); color: var(--color-breach-red); }
@media (hover: hover) { .btn-danger:hover { background: var(--color-breach-red-wash-hover); } }
.btn:disabled, .btn[aria-disabled="true"] { background: var(--color-paper-sunken); color: var(--color-graphite-muted); border-color: transparent; cursor: default; }
.icon-btn { height: 40px; min-width: 40px; padding: 0 12px; border-radius: var(--radius-pill); }   /* legacy pages also use it as a small text button */
.icon-btn:has(> svg:only-child) { width: 40px; padding: 0; }
.btn-google { background: var(--color-card); border-color: var(--color-rule); color: var(--color-graphite); height: 48px; font-size: 15px; width: 100%; }
/* press and materialize: the whole motion vocabulary (web-recipes §9) */
.press, .btn, .info-button, .segmented-option { transition: transform 140ms var(--ease-spring); }
.press:active, .btn:active:not(:disabled), .info-button:active { transform: scale(0.97); }
.materialize { animation: materialize 220ms var(--ease-spring) both; animation-delay: calc(var(--i, 0) * 40ms); }
[data-swapped] .materialize { animation: none; }
@keyframes materialize { from { opacity: 0; transform: scale(0.98); } to { opacity: 1; transform: none; } }

.pill { display: inline-flex; align-items: center; gap: var(--sp-1); padding: var(--sp-half) var(--sp-2); border-radius: var(--radius-pill); font-size: 11px; line-height: 16px; font-weight: 700; white-space: nowrap; }
.pill .icon { width: 12px; height: 12px; }
.pill-info { background: var(--color-info-soft); color: var(--color-info); }
.pill-committed { background: var(--color-committed-green-wash); color: var(--color-committed-green); }
.pill-pending, .pill-new { background: var(--color-pending-amber-wash); color: var(--color-pending-amber); }
.pill-breach { background: var(--color-breach-red-wash); color: var(--color-breach-red); }
.pill-plain { background: var(--color-chip); color: var(--color-chip-text); }
.chip { display: inline-flex; align-items: center; gap: var(--sp-1); height: 28px; padding: 0 10px; border-radius: var(--radius-pill); font-size: 11px; font-weight: 700; background: var(--color-chip); color: var(--color-chip-text); }
.chip-active { background: var(--color-info-soft); color: var(--color-info); }

.segmented { position: relative; display: inline-flex; align-items: center; height: var(--control-h); padding: 2px; border-radius: var(--radius-pill); background: var(--color-paper-sunken); }
.segmented-indicator { position: absolute; top: 2px; bottom: 2px; left: 0; border-radius: var(--radius-pill); background: var(--color-card); box-shadow: 0 1px 2px rgb(7 26 43 / 0.12);
  transition: transform var(--dur-fade-slow) var(--ease-spring), width var(--dur-fade-slow) var(--ease-spring); pointer-events: none; }
.segmented-option { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: var(--sp-1); height: 26px; padding: 0 12px; border: 0; background: transparent; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 500; white-space: nowrap; color: var(--color-graphite-muted); cursor: pointer; }
.segmented-option[aria-checked="true"], .segmented-option[aria-current="page"] { color: var(--color-graphite); font-weight: 600; }
/* with no script the checked option carries its own fill */
.segmented:not([data-ready]) .segmented-option[aria-checked="true"] { background: var(--color-card); }

/* 5. fields */
.field { display: flex; flex-direction: column; gap: var(--sp-1); min-width: 0; }
.label, .field-label { font-size: 13px; line-height: 18px; font-weight: 500; }
.caption, .field-caption { font-size: 12px; line-height: 16px; color: var(--color-graphite-muted); }
.field-error { font-size: 12px; line-height: 16px; color: var(--color-breach-red); }
.input, .select, .textarea { display: flex; align-items: center; gap: 8px; width: 100%; height: 40px; padding: 0 12px; border: 0; border-radius: var(--radius-sm); background: var(--color-card-raised);
  color: var(--color-graphite); box-shadow: inset 0 0 0 1px var(--color-rule); font-size: 13px; text-align: left; }
.textarea { height: auto; min-height: 72px; padding: 10px 12px; resize: vertical; align-items: flex-start; }
.input:focus, .input:focus-within, .select:focus-visible, .textarea:focus { box-shadow: inset 0 0 0 2px var(--color-accent); outline: 2px solid transparent; }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid, .input[aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--color-breach-red); }
.input.num { justify-content: flex-end; text-align: right; font-variant-numeric: tabular-nums; }
.input::placeholder, .textarea::placeholder { color: var(--color-ink-pale); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--color-paper-sunken); color: var(--color-graphite-muted); cursor: default; }
.input .unit { color: var(--color-graphite-muted); margin-left: auto; }
.input-search { border-radius: var(--radius-pill); }
/* WP-08: in a section head the search keeps a set width, so its row's buttons stay beside it (it may shrink on a phone). */
.section-head .input-search { width: 260px; max-width: 100%; flex: 0 1 260px; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 767px) { .form-grid, .form-grid-2 { grid-template-columns: 1fr; } }

/* owned select: a button that opens a listbox; the native <select> stays underneath (forms, forced colours) */
.select-wrap { position: relative; display: block; min-width: 0; }
.select-wrap > select { position: absolute; inset: 0; opacity: 0; pointer-events: none; width: 100%; height: 100%; }
.select { justify-content: space-between; cursor: pointer; }
.select .select-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select .select-value.is-placeholder { color: var(--color-ink-pale); }
.select .icon { color: var(--color-graphite-muted); }
.select[aria-expanded="true"] .icon { transform: rotate(180deg); }
.listbox { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); max-height: 264px; overflow-y: auto; margin: 0; padding: 4px; list-style: none;
  background: var(--color-card-raised); border: 1px solid var(--color-hairline); border-radius: var(--radius-md); box-shadow: var(--shadow-raised); }
.listbox[data-up] { top: auto; bottom: calc(100% + 4px); }
.listbox [role="option"] { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; padding: 0 10px; border-radius: var(--radius-sm); font-size: 13px; cursor: pointer; }
.listbox [role="option"][data-active] { background: var(--color-accent-wash); }
.listbox [role="option"][aria-selected="true"] { font-weight: 600; }
.listbox [role="option"][aria-disabled="true"] { color: var(--color-graphite-muted); cursor: default; }
@media (forced-colors: active) { .select-wrap > select { position: static; opacity: 1; pointer-events: auto; } .select-wrap > .select, .select-wrap > .listbox { display: none; } }

/* owned checkbox: a hidden input and a drawn box */
.check { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 24px; cursor: pointer; font-size: 13px; }
.check > input { position: absolute; opacity: 0; width: 20px; height: 20px; margin: 0; cursor: pointer; }
.check-box { width: 20px; height: 20px; flex: none; border-radius: 6px; box-shadow: inset 0 0 0 1px var(--color-rule); background: var(--color-card-raised);
  display: inline-flex; align-items: center; justify-content: center; color: var(--color-on-accent); }
.check-box .icon { width: 14px; height: 14px; stroke-width: 3; opacity: 0; transform: scale(0.6); transition: transform 120ms var(--ease-spring), opacity 120ms ease-out; }
.check > input:checked + .check-box, .check > input:indeterminate + .check-box { background: var(--color-accent); box-shadow: none; }
.check > input:checked + .check-box .icon, .check > input:indeterminate + .check-box .icon { opacity: 1; transform: none; }
.check > input:focus-visible + .check-box { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.check > input:disabled + .check-box { background: var(--color-paper-sunken); box-shadow: inset 0 0 0 1px var(--color-hairline); }
@media (forced-colors: active) { .check > input { position: static; opacity: 1; } .check-box { display: none; } }

/* 6. tables: eyebrow and action row above the card, navy column row in both themes, SN first, 42 px rows */
.table-scroll { overflow-x: auto; position: relative; }   /* WP-07d: keeps absolutely positioned children (.sr-only) inside the scroll box */
.data-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.data-table.facts { min-width: 0; }
/* WP-07c (owner P5): a change figure. Up = pending amber, down = committed green, never red (one red per screen);
   the arrow is aria-hidden and the signed % stays, so colour is never alone. */
.change { display: inline-flex; align-items: center; justify-content: flex-end; gap: 2px; font-weight: 700; }
.change .icon { width: 12px; height: 12px; }
.change-up { color: var(--color-pending-amber); }
.change-down { color: var(--color-committed-green); }
.change-flat { color: var(--color-graphite-muted); font-weight: 400; }   /* WP-07c: a two-column list of figures (label, value) fits a phone */
.data-table th { text-align: left; white-space: nowrap; font-size: 11px; font-weight: 700; line-height: 14px; letter-spacing: 0.5px; text-transform: uppercase; color: var(--color-on-navy); background: var(--color-navy); padding: 10px var(--sp-3); }
.data-table th:first-child { padding-left: var(--sp-4); }
.data-table th:last-child { padding-right: var(--sp-4); }
.data-table td { padding: 9px var(--sp-3); border-top: 1px solid var(--color-hairline); font-size: 12px; line-height: 18px; height: 42px; vertical-align: middle; }
.data-table td:first-child { padding-left: var(--sp-4); }
.data-table td:last-child { padding-right: var(--sp-4); }
.data-table tbody tr:first-child td { border-top: 0; }
.data-table tbody tr:nth-child(even) td { background: var(--color-paper-sunken); }
@media (hover: hover) { .data-table tbody tr:hover td { background: var(--color-accent-wash); } }
.data-table tbody tr.selected td { background: var(--color-accent-wash); }
/* WP-08b: a table wider than its card shows a fading right edge, and an identifying column stays at the left. */
.table-scroll[data-overflow="end"] { -webkit-mask-image: linear-gradient(to right, black calc(100% - 32px), transparent); mask-image: linear-gradient(to right, black calc(100% - 32px), transparent); }
.data-table .col-sticky { position: sticky; left: 0; z-index: 1; background: var(--color-card); box-shadow: 1px 0 0 var(--color-hairline); }
.data-table th.col-sticky { z-index: 2; background: var(--color-navy); }
.data-table tbody tr:nth-child(even) td.col-sticky { background: var(--color-paper-sunken); }
@media (hover: hover) { .data-table tbody tr:hover td.col-sticky { background: linear-gradient(var(--color-accent-wash), var(--color-accent-wash)), var(--color-card); } }
.data-table tbody tr.selected td.col-sticky { background: linear-gradient(var(--color-accent-wash), var(--color-accent-wash)), var(--color-card); }
.data-table .col-sticky:has(.popover:not([hidden])) { z-index: 4; }
.info.row-info { display: none; vertical-align: middle; margin-left: 6px; }
.row-info .popover { white-space: normal; font-weight: 400; letter-spacing: 0; font-variant-numeric: tabular-nums; }
@media (max-width: 1439px) { .col-wide { display: none; } .info.row-info { display: inline-flex; } .data-table:has(.col-wide) td input.cell { width: 72px; } }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table td.code { white-space: nowrap; }   /* WP-07: a cat no never breaks at its hyphen */
.card-head .pill { text-transform: none; letter-spacing: 0; }   /* WP-07c: a pill in a navy head keeps sentence case */
.data-table th.num { text-align: right; }
.data-table .sn { font-variant-numeric: tabular-nums; width: 1%; }
.data-table td.sn { color: var(--color-graphite-muted); }   /* WP-08b: only body cells are muted; the th keeps the navy-head ink */
.data-table .code { font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 0.3px; }
.data-table .actions { text-align: right; white-space: nowrap; }
.data-table .actions .btn { height: 32px; width: 32px; padding: 0; border-radius: var(--radius-sm); position: relative; }
/* WP-08b: a 44 x 44 hit area around the 32 px box (inset is from the padding box, inside the 1px border); neighbours sit 8 px apart so one never covers another's visible box */
.data-table .actions .btn::after { content: ''; position: absolute; inset: -7px; }
.data-table .actions .btn + .btn { margin-left: 8px; }
.data-table td input.cell { height: 30px; width: 88px; text-align: right; font-variant-numeric: tabular-nums; }
.data-table th[data-sortable] { cursor: pointer; user-select: none; }
.data-table th[data-sortable] .icon { width: 12px; height: 12px; vertical-align: -1px; margin-left: 4px; opacity: 0.6; }
.data-table th[aria-sort="ascending"] .icon, .data-table th[aria-sort="descending"] .icon { opacity: 1; }
.data-table th[aria-sort="descending"] .icon { transform: scaleY(-1); }
.data-table th .sort-btn { all: unset; cursor: pointer; display: inline-flex; align-items: center; }
.data-table th .sort-btn:focus-visible { outline: 2px solid var(--color-accent-wash-hover); outline-offset: 2px; }
.list-footer { display: flex; align-items: center; justify-content: flex-end; gap: 16px; padding: 10px 16px; font-size: 12px; color: var(--color-graphite-muted); }
.list-footer .pager { display: flex; gap: 4px; }
.list-footer .pager .btn { height: 36px; width: 36px; padding: 0; border-radius: var(--radius-sm); }
.list-footer select { height: 32px; }

/* 7. states */
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius-md); border: 1px solid transparent; font-size: 13px; line-height: 18px; }
.notice .icon { margin-top: 1px; }
.notice-warn { background: var(--color-pending-amber-wash); color: var(--color-pending-amber); }
.notice-error { background: var(--color-breach-red-wash); color: var(--color-breach-red); }
.notice-info { background: var(--color-info-soft); color: var(--color-info); }
.notice .btn { margin-left: auto; height: 32px; padding: 0 12px; font-size: 12px; }
.empty { border: 1px dashed var(--color-rule); border-radius: var(--radius-card); background: var(--color-card); padding: 32px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.skeleton { background: var(--color-paper-selected); border-radius: var(--radius-sm); height: 14px; animation: breathe 900ms ease-in-out infinite alternate; }
@keyframes breathe { from { opacity: 0.55; } to { opacity: 1; } }
.skeleton-row { display: grid; grid-template-columns: 40px 1.4fr 1fr 1fr 0.8fr; gap: 16px; align-items: center; height: 42px; padding: 0 24px; border-top: 1px solid var(--color-hairline); }

/* 8. the (i) popover, dialogs, toast */
.info { position: relative; display: inline-flex; }
.info-button { width: 24px; height: 24px; border-radius: var(--radius-pill); border: 0; background: transparent; color: var(--color-graphite-muted); display: inline-flex; align-items: center; justify-content: center; padding: 0; cursor: pointer; }
.info-button[aria-expanded="true"] { background: var(--color-paper-sunken); }
@media (hover: hover) { .info-button:hover { background: var(--color-paper-sunken); } }
.card-head .info-button { color: currentColor; }
.popover { position: absolute; top: 30px; left: -6px; z-index: 30; width: min(340px, calc(100vw - 48px)); padding: 12px 14px; border-radius: var(--radius-md); background: var(--color-card-raised); box-shadow: var(--shadow-raised);
  border: 1px solid var(--color-hairline); font-size: 13px; line-height: 19px; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--color-graphite); text-align: left; }
.popover-lead { font-weight: 600; margin: 0 0 6px; }
.popover p { margin: 0; }
.popover p + p { margin-top: 6px; }

.scrim { position: fixed; inset: 0; background: var(--color-scrim); display: flex; align-items: center; justify-content: center; z-index: 65; padding: 16px; }
.dialog { width: 440px; max-width: 100%; max-height: calc(100vh - 32px); overflow-y: auto; background: var(--color-card-raised); border-radius: var(--radius-lg); box-shadow: var(--shadow-overlay); padding: 20px; }
.dialog .t-heading { margin-bottom: 8px; }
.dialog p { margin: 0; }
.dialog ul { margin: 10px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.dialog li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--color-paper-sunken); font-size: 12px; }
.dialog li .t-caption { text-align: right; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.dialog .form-stack { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.scrim.form-scrim { z-index: 61; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--color-navy); color: var(--color-on-navy); padding: 10px 16px; font-size: 13px; font-weight: 600;
  display: none; box-shadow: var(--shadow-toast); z-index: 60; max-width: min(520px, calc(100vw - 32px)); border-radius: var(--radius-md); }
.toast.show { display: block; animation: toast-in 220ms var(--ease-spring) both; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px) scale(0.98); } to { opacity: 1; transform: translate(-50%, 0); } }

/* 8b. density (WP-07g, owner, 12 Oct): "internal software... reduce row spacing to save space and minimise
   scrolling"; corrected to "rows 42->34px, fields and buttons 40->32px, do not square the corners, maintain the
   design, just reduce the space." Spacing only: no radius, shadow, colour, token or type-size change. Desktop and
   tablet (pointer: fine); the (pointer: coarse) block below still wins for touch (44px), since it comes later. */
.btn, .icon-btn { height: 32px; }
.icon-btn:has(> svg:only-child) { width: 32px; }
.btn-sm { height: 28px; }
.input, .select, .textarea { height: 32px; }
.textarea { height: auto; }
.card-pad { padding: 12px; }
.content { gap: 12px; }
.stack { gap: 10px; }
.stat { padding: 12px; }
.data-table th { padding: 7px 12px; }
.data-table th:first-child { padding-left: 16px; }
.data-table th:last-child { padding-right: 16px; }
.data-table td { padding: 6px 12px; height: 34px; }
.data-table td:first-child { padding-left: 16px; }
.data-table td:last-child { padding-right: 16px; }
.data-table td input.cell { height: 26px; }
.data-table .actions .btn { height: 28px; width: 28px; }
.data-table .actions .btn + .btn { margin-left: 6px; }
.skeleton-row { height: 34px; }

/* 9. motion and media preferences */
@media (pointer: coarse) {
  .btn, .icon-btn, .input, .select, .segmented-option, .info-button, .listbox [role="option"] { min-height: 44px; }
  .icon-btn { min-width: 44px; }
  .check > input, .check-box { width: 24px; height: 24px; }
  .input, .select, .textarea, input, select, textarea { font-size: 16px; }
  .data-table .actions .btn, .list-footer .pager .btn { height: 44px; width: 44px; }
  .data-table .actions .btn::after { inset: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-iteration-count: 1 !important; transition-duration: 120ms !important; }
  .materialize { animation: fade-only 120ms ease-out both; }
  .press:active, .btn:active:not(:disabled), .info-button:active { transform: none; }
  .skeleton { animation: none; }
  .rail, .segmented-indicator { transition-duration: 120ms !important; }
  @keyframes fade-only { from { opacity: 0; } to { opacity: 1; } }
}
@media (prefers-reduced-transparency: reduce) {
  .topbar { background: var(--color-card); -webkit-backdrop-filter: none; backdrop-filter: none; border-color: var(--color-hairline); }
}
@media (prefers-contrast: more) {
  .topbar, .card { border-color: var(--color-graphite); }
  .btn-secondary, .input, .select { border-color: var(--color-graphite); }
}
@media (forced-colors: active) {
  .btn, .input, .select, .card, .topbar { border: 1px solid CanvasText; }
  .rail a[aria-current="page"] { outline: 2px solid Highlight; }
}
@media print {
  .rail, .topbar, .toast, .rail-scrim { display: none !important; }
  .shell { display: block; }
  .content { max-width: none; padding: 0; }
}

/* 10. alias block: the old variable names, so every page keeps rendering until its rebuild.  WP-07 removes */
:root {
  --navy: var(--color-navy); --navy-2: var(--color-navy-2); --navy-3: var(--color-navy-3);
  --white: var(--color-card); --bg: var(--color-paper); --bg-2: var(--color-paper-sunken);
  --border: var(--color-rule); --muted: var(--color-graphite-muted); --ink: var(--color-graphite); --on-dark: var(--color-on-navy);
  --blue: var(--color-accent); --blue-hover: var(--color-accent-hover); --blue-light: var(--color-accent-wash);
  --red: var(--color-breach-red); --amber: var(--color-pending-amber); --amber-bg: var(--color-pending-amber-wash); --amber-border: var(--color-pending-amber);
  --topbar-glass: var(--color-glass); --card-glass: var(--color-glass); --glass-border: var(--color-glass-edge); --glass-blur: 18px;
}

/* Wraps a .page-header alongside its ⓘ info-toggle so the icon sits on
   the title's own line (top-right) instead of opening a dedicated row
   underneath it — used only on pages that have that toggle. */
.page-header-row{display:flex;justify-content:space-between;align-items:flex-start;gap:16px;}
.page-header-row .page-header{margin-bottom:14px;flex:1;min-width:0;}
.page-header-row .info-toggle{flex:none;margin-top:1px;}

/* ---------- THEME TOGGLE ---------- */
.theme-toggle{
  display:flex;align-items:center;gap:6px;
  background:var(--bg-2);border:1px solid var(--border);
  color:var(--ink);font-size:11px;font-weight:700;
  padding:5px 10px;border-radius:var(--radius-pill);
  cursor:pointer;font-family:inherit;
}
.theme-toggle:hover{border-color:var(--blue);color:var(--blue);}
.theme-toggle{transition:transform .1s var(--ease-spring), border-color .15s ease, color .15s ease;}
.theme-toggle:active{transform:scale(.94);}
.theme-toggle svg{width:13px;height:13px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;}

.page-header{margin-bottom:14px;}
.page-header h1{font-size:16px;margin:0 0 3px;letter-spacing:.2px;color:var(--ink);}
.page-header p{margin:0;color:var(--muted);font-size:12px;}

/* Wraps a .page-header alongside its ⓘ info-toggle so the icon sits on
   the title's own line (top-right) instead of opening a dedicated row
   underneath it — used only on pages that have that toggle. */
.page-header-row{display:flex;justify-content:space-between;align-items:flex-start;gap:16px;}
.page-header-row .page-header{margin-bottom:14px;flex:1;min-width:0;}
.page-header-row .info-toggle{flex:none;margin-top:1px;}

/* ---------- FORM CONTROLS ---------- */
.field{display:flex;flex-direction:column;gap:4px;}
.field label:not(.check){   /* WP-07: a checkbox label is body text, sentence case */
  font-size:10.5px;text-transform:uppercase;letter-spacing:.5px;
  color:var(--muted);font-weight:700;
}
select,input[type=number],input[type=text]{
  border:1px solid var(--border);
  background:var(--white);
  padding:6px 8px;
  font-size:12.5px;
  font-family:inherit;
  color:var(--ink);
  border-radius:var(--radius-sm);
  height:30px;
}
textarea{
  border:1px solid var(--border);
  background:var(--white);
  padding:6px 8px;
  font-size:12.5px;
  font-family:inherit;
  color:var(--ink);
  border-radius:var(--radius-sm);
  resize:vertical;
  min-height:56px;
}
select:focus,input:focus,textarea:focus{
  outline:none;border-color:var(--blue);box-shadow:0 0 0 1px var(--blue);
}
input[readonly]{background:var(--bg-2);color:var(--muted);}
.code-display{
  border:1px solid var(--navy-3);
  background:var(--navy-3);
  color:var(--on-dark);
  padding:6px 8px;height:30px;
  font-size:13px;font-weight:700;letter-spacing:.5px;
  display:flex;align-items:center;
  border-radius:var(--radius-sm);
}

/* ---------- BANNERS ---------- */
.banner{
  padding:9px 12px;font-size:11.5px;margin-bottom:10px;border:1px solid;
  display:none;border-radius:var(--radius-md);
}
.banner.warn{background:var(--amber-bg);border-color:var(--amber-border);color:var(--amber);}
.banner.dup{background:rgba(196,50,47,.1);border-color:rgba(196,50,47,.35);color:var(--color-breach-red);}
.banner.info{background:var(--blue-light);border-color:rgba(22,131,255,.35);color:var(--blue);}
.banner.show{display:block;}
/* WP-03: an amount box that is not a number. */
.field-error{display:block;font-size:11px;color:var(--red);margin-top:2px;}
input[aria-invalid="true"]{border-color:var(--red);}
.banner strong{font-weight:800;}

/* ---------- TABLES ---------- */
.table-wrap, .summary-wrap, .table-wrap.shared-table-wrap{border-radius:var(--radius-md);overflow:hidden;}
table{width:100%;border-collapse:collapse;font-size:12px;}
th{
  background:var(--bg-2);
  text-align:left;font-size:10px;text-transform:uppercase;letter-spacing:.4px;
  color:var(--muted);font-weight:700;
  padding:7px 8px;border-bottom:1px solid var(--border);border-top:1px solid var(--border);
}
th.num,td.num{text-align:right;}
td{padding:6px 8px;border-bottom:1px solid var(--bg-2);vertical-align:middle;color:var(--ink);}
tbody tr:nth-child(even) td{background:var(--bg-2);}
/* Blue tint rather than a darker grey — a grey-on-grey hover was invisible
   on already-striped (nth-child even) rows; a distinct hue reads on both.
   Selector must match tbody tr:nth-child(even) td's specificity (3 elements)
   or the stripe wins on even rows regardless of source order. */
tbody tr:hover td{background:var(--blue-light);}
.sno-cell{color:var(--muted);white-space:nowrap;width:1%;text-align:center;}

/* ---------- PAGINATION (shared by any list/table that grows) ---------- */
.pagination-bar{
  display:flex;align-items:center;justify-content:flex-end;gap:16px;
  padding:10px 4px;font-size:11.5px;color:var(--muted);
}
.pagination-size{display:flex;align-items:center;gap:6px;}
.pagination-size select{height:26px;font-size:11.5px;padding:2px 6px;width:auto;}
.pagination-range{white-space:nowrap;}
.pagination-nav{display:flex;align-items:center;gap:2px;}
.pagination-nav button{
  width:26px;height:26px;
  background:var(--white);border:1px solid var(--border);color:var(--ink);
  border-radius:var(--radius-sm);cursor:pointer;
  display:flex;align-items:center;justify-content:center;
  font-family:inherit;
  transition:border-color .15s ease, color .15s ease, transform .1s var(--ease-spring);
}
.pagination-nav button:hover:not(:disabled){border-color:var(--blue);color:var(--blue);}
.pagination-nav button:active:not(:disabled){transform:scale(.9);}
.pagination-nav button:disabled{opacity:.4;cursor:not-allowed;}
.pagination-nav svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;}
td input,td select{width:100%;height:26px;padding:3px 6px;font-size:12px;}
.row-total{font-weight:700;}
.remove-row{
  background:none;border:none;color:var(--red);cursor:pointer;font-size:14px;font-weight:800;
  line-height:1;padding:0 4px;
}
.add-row-btn{
  margin-top:8px;
  background:var(--white);border:1px solid var(--border);
  color:var(--ink);padding:7px 10px;font-size:11.5px;font-weight:700;
  cursor:pointer;width:100%;text-align:center;
  border-radius:var(--radius-md);
  transition:border-color .15s ease, color .15s ease, transform .1s var(--ease-spring);
}
.add-row-btn:hover{border-color:var(--blue);color:var(--blue);}
.add-row-btn:active{transform:scale(.99);}

/* ---------- STATUS PILLS ---------- */
.status-pill{
  font-size:10px;font-weight:700;letter-spacing:.5px;
  padding:2px 8px;
  background:var(--navy-3);
  border:1px solid var(--navy-3);
  color:var(--color-on-navy-muted);
  border-radius:var(--radius-pill);
}
.status-pill.draft{color:var(--color-domain-amber-on-navy);}
.status-pill.active{color:var(--color-domain-emerald-on-navy);}
.status-pill.inactive{color:var(--color-on-navy);background:var(--color-alert);border-color:var(--color-alert);}
.status-pill.locked{color:var(--color-domain-emerald-on-navy);}
.status-pill.superseded{color:var(--color-on-navy-muted);}

/* ---------- MODAL ---------- */
.modal-overlay{
  position:fixed;inset:0;background:var(--color-scrim);
  display:none;align-items:center;justify-content:center;z-index:60;
}
.modal-overlay.show{display:flex;}
.modal{
  background:var(--color-card-raised);
  width:420px;max-width:92vw;
  border:1px solid var(--glass-border);
  border-radius:var(--radius-lg);
  overflow:hidden;
}
.modal-overlay.show .modal{animation:materialize 220ms var(--ease-spring) both;}
.modal-head{
  background:var(--navy);color:var(--on-dark);
  padding:12px 16px;font-weight:700;font-size:12.5px;letter-spacing:.4px;
  display:flex;justify-content:space-between;align-items:center;
}
.modal-close{background:none;border:none;color:var(--color-on-navy-muted);font-size:16px;cursor:pointer;line-height:1;}
.modal-close:hover{color:var(--on-dark);}
.modal-body{padding:18px;display:flex;flex-direction:column;gap:14px;}
.modal-foot{padding:14px 18px;border-top:1px solid var(--border);display:flex;gap:8px;justify-content:flex-end;}
.field-hint{font-size:10.5px;color:var(--muted);}
.field-hint.error{color:var(--red);font-weight:700;}
input:disabled, select:disabled, .icon-btn:disabled, .expand-toggle:disabled{opacity:.5;cursor:not-allowed;}

/* ---------- ACCESS DENIED (permission gate) ---------- */
.access-denied{
  background:var(--white);border:1px solid var(--border);
  padding:32px;text-align:center;color:var(--muted);
  border-radius:var(--radius-lg);
}

/* ---------- NOTE BLOCKS & ICON BUTTONS ---------- */
.note-block{
  display:grid;grid-template-rows:minmax(0,1fr);
  overflow:hidden;
  background:var(--white);border:1px solid var(--border);
  margin-bottom:14px;
  border-radius:var(--radius-md);
  transition:grid-template-rows .3s var(--ease-spring), border-color .3s var(--ease-spring), margin .3s var(--ease-spring);
}
/* Two-part fix for the 0fr collapse trick: a bare `0fr` track still
   reserves its content's min-content height, so it must be wrapped in
   minmax(0, ...); and even once the track itself measures 0, the grid
   item doesn't shrink to fit it, so its content visually spills past
   the (correctly zero-height) container unless the container also
   clips it — hence overflow:hidden on .note-block itself above, not
   just on .note-block-inner. */
.note-block.collapsed{grid-template-rows:minmax(0,0fr);border-color:transparent;margin-bottom:0;}
.note-block-inner{
  overflow:hidden;min-height:0;
  padding:11px 14px;font-size:11.5px;color:var(--muted);
}
.note-block-inner strong{color:var(--ink);}

.info-toggle{
  background:var(--white);border:1px solid var(--border);color:var(--blue);
  width:21px;height:21px;border-radius:50%;
  font-size:11px;font-weight:800;font-style:normal;line-height:1;cursor:pointer;
  display:inline-flex;align-items:center;justify-content:center;
  flex-shrink:0;font-family:Georgia,serif;
  transition:background .15s ease, transform .1s var(--ease-spring);
}
.info-toggle:hover{background:var(--blue-light);}
.info-toggle:active{transform:scale(.9);}
.info-toggle.active{background:var(--blue);color:var(--color-on-accent);border-color:var(--blue);}

/* ---------- GENERIC SURFACES (panels/cards used across pages) ---------- */
.col, .panel, .dept-card, .shared-card, .particulars-panel, .product-panel,
.versions-wrap, .compare-wrap, .table-wrap, .log-wrap, .settings-bar, .month-bar,
.brass-rate-bar, .filter-bar, .browse-toolbar, .toolbar, .stat-tile, .quicklink,
.activity-wrap, .empty-state, .empty-note, .empty-list, .placeholder,
.select-hint, .add-col-panel, .mini-card, .shared-table-wrap, .total-box,
.right-panel > .placeholder{
  border-radius:var(--radius-lg);
  overflow:hidden;
}
.col-head, .panel-head, .dept-head, .shared-head, .particulars-panel-head,
.product-panel-head, .versions-head, .compare-head, .mini-head{
  border-radius:var(--radius-lg) var(--radius-lg) 0 0;
}


/* old button and small-button classes the pages still use */
.btn-block{flex:1;}
.copy-btn{font-size:11px;font-weight:700;background:var(--color-card);color:var(--color-accent-ink);border:1px solid var(--color-accent);padding:3px 9px;cursor:pointer;border-radius:var(--radius-pill);}
.copy-btn:hover{background:var(--color-accent-wash);}
.icon-btn:not(.btn){display:inline-flex;align-items:center;justify-content:center;gap:6px;height:32px;min-height:0;background:var(--color-card);border:1px solid var(--color-rule);color:var(--color-graphite);font-size:12px;font-weight:700;cursor:pointer;}
.icon-btn:not(.btn):has(> svg:only-child){width:32px;padding:0;}
.icon-btn:not(.btn):hover{border-color:var(--color-accent);color:var(--color-accent-ink);}
.icon-btn:not(.btn):active:not(:disabled){transform:scale(.97);}
.icon-btn.danger:hover{border-color:var(--color-breach-red);color:var(--color-breach-red);}
.icon-btn:disabled{background:var(--color-paper-sunken);color:var(--color-graphite-muted);}
