/* ══════════════════════════════════════════════════════════════════════════════════════════════════
   CADENCE — application layer (A4c)
   ══════════════════════════════════════════════════════════════════════════════════════════════════
   The authenticated surfaces of talaissuing.com: the customer member area (CSR helper, upload and
   download, request/response) and the internal operator screens (enrolment intake, notifications,
   dashboard, SLA tracking).

   LOADED SEPARATELY, ON PURPOSE. `cadence.css` carries the tokens, the base and the marketing layer;
   this file carries the application components and is loaded only by pages that have one. The
   homepage is the highest-traffic page on the site and should not pay for a data table it never
   renders.

   IT DEFINES NO TOKENS. Every value here resolves through `cadence.css` — a second file redeclaring
   `--cd-steel` is how two halves of one system start disagreeing about what steel is. Load
   `cadence.css` first, always.

   SAME LANGUAGE, DIFFERENT REGISTER. The marketing face is airy and slow; a console is dense and
   quick. Type steps down, spacing tightens, motion shortens — but the palette, the radii and the
   mono micro-labels are unchanged, so a customer crossing from the homepage into their member area
   is still somewhere they recognise.
   ══════════════════════════════════════════════════════════════════════════════════════════════════ */


/* ═══════════════ 1 · SHELL ═══════════════
   Sidebar + content, with the sidebar fixed and the content scrolling under a sticky bar. Grid rather
   than flex so the sidebar's width is stated once and the content column simply takes the rest. */

.cd-app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px 1fr;
  background: var(--cd-paper);
  color: var(--cd-ink);
  font: 400 15px/1.6 var(--cd-sans);
  -webkit-font-smoothing: antialiased;
}

.cd-side {
  position: sticky; top: 0; align-self: start;
  height: 100vh; overflow-y: auto;
  background: var(--cd-panel);
  border-right: 1px solid var(--cd-hairline);
  display: flex; flex-direction: column;
}

.cd-sidebrand {
  display: flex; align-items: center; gap: 10px;
  height: 64px; padding-inline: 20px;
  border-bottom: 1px solid var(--cd-hairline);
  flex: 0 0 auto;
}
.cd-sidebrand .cd-glyph { width: 20px; height: 20px; }
.cd-sidebrand .cd-word { font-size: 15px; }

.cd-sidenav { padding: 16px 12px; flex: 1 1 auto; }

/* Group heading — the same mono micro-label the marketing face uses for eyebrows, so the two
   surfaces are audibly the same system even where nothing else is shared. */
.cd-sidetitle {
  padding: 16px 10px 6px;
  font-family: var(--cd-mono); font-size: 10.5px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--cd-muted);
}
.cd-sidetitle:first-child { padding-top: 4px; }

.cd-sidelink {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--cd-r-m);
  font-size: 14px; color: var(--cd-ink-2);
  border-left: 2px solid transparent;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}
.cd-sidelink:hover { background: var(--cd-steel-tint); color: var(--cd-ink); }
.cd-sidelink svg { width: 16px; height: 16px; flex: 0 0 auto; }
.cd-sidelink svg * { stroke: currentColor; stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* The steel bar, not a filled block: the active row should read at a glance without becoming the
   loudest thing on a screen full of data. */
.cd-sidelink.cd-on {
  background: var(--cd-steel-tint); color: var(--cd-steel);
  border-left-color: var(--cd-steel);
}

/* Count on the right of a nav row — the intake queue's whole job is saying how many are waiting. */
.cd-sidecount {
  margin-left: auto;
  font-family: var(--cd-mono); font-size: 10.5px;
  color: var(--cd-muted);
}
.cd-sidelink.cd-on .cd-sidecount { color: var(--cd-steel); }

.cd-sidefoot {
  padding: 14px 20px; border-top: 1px solid var(--cd-hairline);
  font-family: var(--cd-mono); font-size: 10.5px; letter-spacing: .06em;
  color: var(--cd-muted); flex: 0 0 auto;
}

.cd-main { min-width: 0; display: flex; flex-direction: column; }

.cd-appbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  height: 64px; padding-inline: clamp(16px, 2.5vw, 32px);
  background: var(--cd-paper);
  border-bottom: 1px solid var(--cd-hairline);
}
.cd-appbar-title { font-size: 15px; font-weight: 500; }
.cd-appbar-acts { display: flex; align-items: center; gap: 10px; margin-left: auto; }

/* Only shown below the sidebar's breakpoint. */
.cd-sidetgl { display: none; }

.cd-page { padding: clamp(20px, 3vw, 32px) clamp(16px, 2.5vw, 32px) 64px; flex: 1 1 auto; }
.cd-page-narrow { max-width: 860px; }


/* ═══════════════ 2 · PAGE FURNITURE ═══════════════ */

.cd-pagehead {
  display: flex; align-items: flex-start; gap: 16px 24px; flex-wrap: wrap;
  padding-bottom: 18px; margin-bottom: 22px;
  border-bottom: 1px solid var(--cd-hairline);
}
.cd-pagehead h1 {
  font-family: var(--cd-sans); font-weight: 300; letter-spacing: -0.01em;
  font-size: clamp(22px, 2.6vw, 28px); line-height: 1.2; margin: 0;
}
.cd-pagehead p { margin-top: 6px; color: var(--cd-ink-2); font-size: 14px; max-width: 68ch; }
.cd-pagehead-acts { display: flex; gap: 10px; margin-left: auto; flex-wrap: wrap; }

.cd-panel {
  background: var(--cd-panel);
  border: 1px solid var(--cd-hairline);
  border-radius: var(--cd-r-l);
  padding: var(--cd-sp-5);
}
.cd-panel + .cd-panel { margin-top: var(--cd-sp-4); }
.cd-panel-head {
  display: flex; align-items: center; gap: 12px;
  padding-bottom: 12px; margin-bottom: 16px;
  border-bottom: 1px solid var(--cd-hairline);
}
.cd-panel-head h2 { font-size: 15px; font-weight: 600; margin: 0; }
.cd-panel-head .cd-panel-acts { margin-left: auto; display: flex; gap: 8px; }
.cd-panel-sub { font-size: 13px; color: var(--cd-muted); }

.cd-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--cd-sp-4); }
.cd-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--cd-sp-4); }

/* Dashboard figure — the serif returns here, deliberately. A number is the one thing on an operator
   screen worth setting in the marketing face's voice. */
.cd-stat { background: var(--cd-panel); border: 1px solid var(--cd-hairline); border-radius: var(--cd-r-l); padding: 18px 20px; }
.cd-stat-fig { font-family: var(--cd-serif); font-size: 30px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.cd-stat-cap { margin-top: 4px; font-family: var(--cd-mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--cd-muted); }
.cd-stat-crit .cd-stat-fig { color: var(--cd-crit); }
.cd-stat-warn .cd-stat-fig { color: var(--cd-warn); }


/* ═══════════════ 3 · TAGS ═══════════════
   Tinted rather than solid. A queue is mostly status column; solid chips turn a table into bunting. */

.cd-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px; border-radius: var(--cd-r-chip, var(--cd-r-s));
  font-family: var(--cd-mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  border: 1px solid transparent; white-space: nowrap;
}
.cd-tag-good { background: var(--cd-good-tint); color: var(--cd-good); border-color: var(--cd-good); }
.cd-tag-warn { background: var(--cd-warn-tint); color: var(--cd-warn); border-color: var(--cd-warn); }
.cd-tag-crit { background: var(--cd-crit-tint); color: var(--cd-crit); border-color: var(--cd-crit); }
.cd-tag-muted { background: var(--cd-steel-tint); color: var(--cd-muted); border-color: var(--cd-hairline); }
.cd-tag-steel { background: var(--cd-steel-tint); color: var(--cd-steel); border-color: var(--cd-steel); }

/* Callouts — the SENTENCE-length sibling of the tag. A tag is a chip (nowrap, uppercase mono);
   any status message longer than a couple of words belongs here instead, where it wraps. */
.cd-callout {
  display: block; padding: 10px 14px; margin: 0 0 14px;
  border: 1px solid var(--cd-hairline); border-left-width: 3px; border-radius: var(--cd-r-s);
  background: var(--cd-steel-tint); font-size: 13px; line-height: 1.55;
}
.cd-callout-good { background: var(--cd-good-tint); border-color: var(--cd-good); }
.cd-callout-warn { background: var(--cd-warn-tint); border-color: var(--cd-warn); }
.cd-callout-crit { background: var(--cd-crit-tint); border-color: var(--cd-crit); }


/* ═══════════════ 4 · TABLE ═══════════════ */

.cd-tablewrap {
  border: 1px solid var(--cd-hairline); border-radius: var(--cd-r-l);
  background: var(--cd-panel); overflow-x: auto;
}
.cd-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.cd-table th {
  text-align: left; white-space: nowrap;
  padding: 11px 16px;
  font-family: var(--cd-mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--cd-muted); font-weight: 400;
  border-bottom: 1px solid var(--cd-hairline);
  background: var(--cd-paper);
}
.cd-table td { padding: 13px 16px; border-bottom: 1px solid var(--cd-line-2, var(--cd-hairline)); vertical-align: middle; }
.cd-table tbody tr:last-child td { border-bottom: 0; }
/* A row that is history, not state: a withdrawn release (2026-09-28) stays in the list, read but not reached for. */
.cd-table tbody tr.cd-row-muted td { opacity: .55; }
.cd-table tbody tr.cd-row-muted td form, .cd-table tbody tr.cd-row-muted td .cd-tag-warn { opacity: 1; }
.cd-table tbody tr { transition: background-color .15s ease; }
.cd-table tbody tr:hover { background: var(--cd-steel-tint); }
.cd-table .cd-num { text-align: right; font-variant-numeric: tabular-nums; }
.cd-table .cd-rowacts { text-align: right; white-space: nowrap; }
.cd-cellname { font-weight: 500; }
.cd-cellsub { display: block; margin-top: 2px; font-size: 12.5px; color: var(--cd-muted); }
.cd-mono-cell { font-family: var(--cd-mono); font-size: 12px; color: var(--cd-ink-2); }


/* ═══════════════ 5 · FORMS ═══════════════ */

.cd-field { margin-bottom: var(--cd-sp-4); }
.cd-field:last-child { margin-bottom: 0; }
.cd-label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; }
.cd-reqd::after { content: " *"; color: var(--cd-crit); }

/* Both contracts are styled on purpose: `.cd-control` as a wrapper div AND directly on the control.
   TalaWebMain's forms were written `<input class="cd-control">` against a stylesheet that only knew the
   wrapper form, so every enrolment/response/refuse field rendered browser-bare (2026-08-11). The class ON
   the element is the contract going forward; the wrapper selectors stay for existing markup. */
.cd-control input:not([type="checkbox"]):not([type="radio"]),
.cd-control select,
.cd-control textarea,
input.cd-control:not([type="checkbox"]):not([type="radio"]),
select.cd-control,
textarea.cd-control {
  width: 100%;
  padding: 9px 11px;
  font: 400 14px/1.5 var(--cd-sans);
  color: var(--cd-ink);
  background: var(--cd-panel);
  border: 1px solid var(--cd-hairline);
  border-radius: var(--cd-r-m);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.cd-control textarea, textarea.cd-control { resize: vertical; min-height: 84px; }
.cd-control input:focus, .cd-control select:focus, .cd-control textarea:focus,
input.cd-control:focus, select.cd-control:focus, textarea.cd-control:focus {
  outline: none; border-color: var(--cd-steel);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--cd-steel) 22%, transparent);
}
.cd-control input:disabled, .cd-control select:disabled, .cd-control textarea:disabled,
input.cd-control:disabled, select.cd-control:disabled, textarea.cd-control:disabled {
  background: var(--cd-steel-tint); color: var(--cd-muted); cursor: not-allowed;
}
.cd-control input::placeholder, .cd-control textarea::placeholder,
input.cd-control::placeholder, textarea.cd-control::placeholder { color: var(--cd-muted); }

/* File inputs get the same dress — the native "Choose File" chrome was the barest thing on the page. */
.cd-control input[type="file"], input.cd-control[type="file"] { padding: 6px 8px; cursor: pointer; }
.cd-control input[type="file"]::file-selector-button,
input.cd-control[type="file"]::file-selector-button {
  appearance: none; margin-right: 11px; padding: 6px 13px; cursor: pointer;
  font: 600 12.5px/1.4 var(--cd-sans); color: var(--cd-ink);
  background: var(--cd-steel-tint); border: 1px solid var(--cd-hairline); border-radius: var(--cd-r-s);
  transition: border-color .18s ease;
}
.cd-control input[type="file"]::file-selector-button:hover,
input.cd-control[type="file"]::file-selector-button:hover { border-color: var(--cd-steel); }

.cd-help { margin-top: 6px; font-size: 12.5px; color: var(--cd-muted); line-height: 1.55; }

/* Errors are text, not just a red ring — a colour-blind operator gets the same message. */
.cd-err { display: block; margin-top: 6px; font-size: 12.5px; color: var(--cd-crit); }
.cd-field-bad .cd-control input,
.cd-field-bad .cd-control select,
.cd-field-bad .cd-control textarea,
.cd-field-bad input.cd-control,
.cd-field-bad select.cd-control,
.cd-field-bad textarea.cd-control { border-color: var(--cd-crit); }

.cd-check { display: flex; align-items: flex-start; gap: 9px; }
.cd-check input { width: 15px; height: 15px; margin-top: 3px; accent-color: var(--cd-steel); flex: 0 0 auto; }
.cd-check label { font-size: 14px; }

.cd-formgrid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--cd-sp-4); }

/* Validation summary — the same box the marketing drawers use, in the critical register. */
.cd-summary {
  border: 1px solid var(--cd-crit); border-left-width: 3px; border-radius: var(--cd-r-m);
  background: var(--cd-crit-tint); color: var(--cd-ink);
  padding: 11px 14px; margin-bottom: var(--cd-sp-4); font-size: 13px;
}
.cd-summary:empty { display: none; }
.cd-summary ul { margin: 0; padding: 0; list-style: none; }


/* ═══════════════ 6 · FILE UPLOAD ═══════════════
   A label wrapping a visually-hidden input: the whole zone is the control, keyboard and pointer
   alike, without a click handler pretending to be one. */

.cd-upload {
  display: grid; place-items: center; gap: 8px; text-align: center;
  padding: 28px 20px;
  border: 1px dashed var(--cd-hairline); border-radius: var(--cd-r-l);
  background: var(--cd-panel);
  cursor: pointer;
  transition: border-color .18s ease, background-color .18s ease;
}
.cd-upload:hover, .cd-upload.cd-drag { border-color: var(--cd-steel); background: var(--cd-steel-tint); }
.cd-upload input[type="file"] {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.cd-upload:focus-within { border-color: var(--cd-steel); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cd-steel) 22%, transparent); }
.cd-upload svg { width: 22px; height: 22px; color: var(--cd-steel); }
.cd-upload svg * { stroke: currentColor; stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.cd-upload-main { font-size: 14px; font-weight: 500; }
.cd-upload-sub { font-family: var(--cd-mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--cd-muted); }
.cd-upload-file { font-family: var(--cd-mono); font-size: 12px; color: var(--cd-steel); }


/* ═══════════════ 7 · ARTEFACT ROW ═══════════════
   The Trust Centre's unit: a published file with its fingerprint. The fingerprint is the point — it
   is what someone verifies against — so it gets its own line in mono rather than a tooltip. */

.cd-artefact {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 14px 16px;
  border: 1px solid var(--cd-hairline); border-radius: var(--cd-r-l);
  background: var(--cd-panel);
}
.cd-artefact + .cd-artefact { margin-top: 10px; }
.cd-artefact-ic {
  width: 34px; height: 34px; flex: 0 0 auto;
  display: grid; place-items: center;
  border: 1px solid var(--cd-hairline); border-radius: var(--cd-r-m);
  color: var(--cd-steel); background: var(--cd-steel-tint);
}
.cd-artefact-ic svg { width: 16px; height: 16px; }
.cd-artefact-ic svg * { stroke: currentColor; stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.cd-artefact-x { min-width: 0; flex: 1 1 260px; }
.cd-artefact-name { font-size: 14px; font-weight: 500; }
.cd-artefact-meta {
  margin-top: 3px; font-family: var(--cd-mono); font-size: 11px;
  color: var(--cd-muted); overflow-wrap: anywhere;
}
.cd-artefact-acts { margin-left: auto; display: flex; gap: 8px; }


/* ═══════════════ 8 · EMPTY STATE & PAGER ═══════════════ */

.cd-empty {
  display: grid; place-items: center; gap: 6px; text-align: center;
  padding: 44px 24px;
  border: 1px dashed var(--cd-hairline); border-radius: var(--cd-r-l);
  background: var(--cd-panel);
}
.cd-empty svg { width: 22px; height: 22px; color: var(--cd-muted); }
.cd-empty svg * { stroke: currentColor; stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.cd-empty b { font-size: 14.5px; font-weight: 600; }
.cd-empty span { font-size: 13px; color: var(--cd-muted); max-width: 52ch; }

/* A list's search and filters: one row, the search box takes the slack, everything wraps on a narrow screen. */
.cd-filterbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.cd-filterbar input[type="search"].cd-control { flex: 1 1 280px; min-width: 0; }
.cd-filterbar select.cd-control { flex: 0 1 180px; width: auto; }
/* A list that paging and search links land on: clear of the sticky app bar (64px) when scrolled to. */
.cd-anchor { scroll-margin-top: 80px; }
.cd-pager { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.cd-pager-info { font-family: var(--cd-mono); font-size: 11px; color: var(--cd-muted); }
.cd-pager-acts { margin-left: auto; display: flex; gap: 6px; }


/* ═══════════════ 9 · DRAWER ═══════════════
   Cadence's own offcanvas. No Bootstrap — the estate's drawers are Bootstrap's, and importing a
   framework to slide a panel would undo what "self-contained" was for (D50).

   `hidden` until JS opens it, so a no-JS load never leaves a stray panel on the page. */

.cd-scrim {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(6, 10, 20, .5);
  opacity: 0; transition: opacity .22s ease;
}
.cd-scrim.cd-shown { opacity: 1; }

.cd-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 61;
  width: min(460px, 100vw);
  display: flex; flex-direction: column;
  background: var(--cd-panel);
  border-left: 1px solid var(--cd-hairline);
  box-shadow: var(--cd-shadow-pop);
  transform: translateX(100%);
  transition: transform .26s cubic-bezier(.32, .72, 0, 1);
}
.cd-drawer.cd-shown { transform: none; }
.cd-drawer[data-cd-width="wide"] { width: min(680px, 100vw); }
.cd-drawer[data-cd-width="full"] { width: min(980px, 100vw); }

.cd-drawer-head {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 18px 20px; border-bottom: 1px solid var(--cd-hairline);
  flex: 0 0 auto;
}
.cd-drawer-ic {
  width: 32px; height: 32px; flex: 0 0 auto; display: grid; place-items: center;
  border: 1px solid var(--cd-hairline); border-radius: var(--cd-r-m);
  background: var(--cd-steel-tint); color: var(--cd-steel);
}
.cd-drawer-ic svg { width: 16px; height: 16px; }
.cd-drawer-ic svg * { stroke: currentColor; stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.cd-drawer-head h3 { font-size: 15px; font-weight: 600; margin: 0; }
.cd-drawer-sub { margin-top: 3px; font-size: 12.5px; color: var(--cd-muted); }
.cd-drawer-close {
  margin-left: auto; width: 30px; height: 30px; display: grid; place-items: center;
  border: 1px solid var(--cd-hairline); border-radius: var(--cd-r-m); color: var(--cd-ink-2);
  transition: border-color .18s ease, color .18s ease;
}
.cd-drawer-close:hover { border-color: var(--cd-steel); color: var(--cd-steel); }
.cd-drawer-close svg { width: 14px; height: 14px; }
.cd-drawer-close svg * { stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; }

.cd-drawer-body { padding: 20px; overflow-y: auto; flex: 1 1 auto; }
/* A release note shown as written (it rides the signed feed and prints plain on device consoles): wrapped, readable, no styling of its own. */
.cd-notes { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-family: inherit; font-size: 13.5px; line-height: 1.55; color: var(--cd-ink-2); }
.cd-drawer-foot {
  display: flex; align-items: center; gap: 10px; justify-content: flex-end;
  padding: 14px 20px; border-top: 1px solid var(--cd-hairline);
  flex: 0 0 auto;
}

/* The submit button's busy state — set by the AJAX layer, so a double-submit is impossible rather
   than merely discouraged. */
.cd-btn[disabled], .cd-btn.cd-busy { opacity: .6; pointer-events: none; }


/* ═══════════════ 10 · TOASTS ═══════════════ */

.cd-toasts {
  position: fixed; right: 16px; bottom: 16px; z-index: 70;
  display: flex; flex-direction: column; gap: 10px;
  width: min(360px, calc(100vw - 32px));
}
.cd-toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px;
  background: var(--cd-panel);
  border: 1px solid var(--cd-hairline); border-left-width: 3px;
  border-radius: var(--cd-r-m);
  box-shadow: var(--cd-shadow-pop);
  font-size: 13.5px; line-height: 1.5;
  opacity: 0; transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
}
.cd-toast.cd-shown { opacity: 1; transform: none; }
.cd-toast-good { border-left-color: var(--cd-good); }
.cd-toast-warn { border-left-color: var(--cd-warn); }
.cd-toast-crit { border-left-color: var(--cd-crit); }
.cd-toast-info { border-left-color: var(--cd-steel); }
.cd-toast b { display: block; font-size: 13px; margin-bottom: 2px; }
.cd-toast-x { margin-left: auto; color: var(--cd-muted); font-size: 16px; line-height: 1; }


/* ═══════════════ 11 · RESPONSIVE ═══════════════ */

@media (max-width: 1020px) {
  .cd-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  /* The sidebar becomes a slide-over rather than collapsing to icons: a console navigated by icon
     alone is a memory test, and these are screens people visit occasionally. */
  .cd-app { grid-template-columns: 1fr; }
  .cd-side {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 62;
    width: 264px; height: 100dvh;
    transform: translateX(-100%);
    transition: transform .26s cubic-bezier(.32, .72, 0, 1);
  }
  .cd-side.cd-shown { transform: none; }
  .cd-sidetgl { display: grid; }
  .cd-formgrid2, .cd-grid-2, .cd-grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .cd-pagehead-acts { margin-left: 0; width: 100%; }
  .cd-artefact-acts { margin-left: 0; width: 100%; }
}


/* ═══════════════ 12 · REDUCED MOTION ═══════════════ */

@media (prefers-reduced-motion: reduce) {
  .cd-drawer, .cd-scrim, .cd-side, .cd-toast { transition-duration: .01ms !important; }
}

/* ── The topology board (Topology plan §4) — services rail, box cards, drag targets, config panel. ── */
.cd-topo { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: var(--cd-sp-4); align-items: start; }
@media (max-width: 900px) { .cd-topo { grid-template-columns: 1fr; } }

.cd-topo-status { position: sticky; top: 8px; z-index: 30; margin-bottom: 12px; padding: 9px 14px;
  border: 1px solid var(--cd-good, #69c388); border-left-width: 3px; border-radius: var(--cd-r-m);
  background: var(--cd-panel); color: var(--cd-ink); font-size: 13px; }
.cd-topo-status.bad { border-color: var(--cd-crit); }

/* TC27/TC28 — the version lifecycle: a requested version is FROZEN and the board renders read-only
   (edit controls absent, not disabled); the server refuses every write regardless. */
.cd-topo-freeze { grid-column: 1 / -1; padding: 10px 14px; border: 1px solid var(--cd-warn, #d9a54a);
  border-left-width: 3px; border-radius: var(--cd-r-m); background: var(--cd-panel);
  color: var(--cd-ink); font-size: 13px; }
.cd-topo-version { grid-column: 1 / -1; padding: 8px 14px; border: 1px solid var(--cd-hairline);
  border-left: 3px solid var(--cd-steel, #7c8aa0); border-radius: var(--cd-r-m); background: var(--cd-panel);
  color: var(--cd-muted); font-size: 12.5px; }
.cd-topo-lifecycle { display: flex; align-items: baseline; gap: 10px; margin: 8px 0 0; font-size: 13px;
  color: var(--cd-muted); }
.cd-topo-state { flex: none; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
  letter-spacing: .02em; border: 1px solid var(--cd-hairline); color: var(--cd-ink); }
.cd-topo-state.draft { border-color: var(--cd-good, #69c388); }
.cd-topo-state.frozen { border-color: var(--cd-warn, #d9a54a); }
span.cd-topo-boxname { border: 0; background: transparent; font-weight: 600; color: var(--cd-ink); }

.cd-topo-h { margin: 0 0 4px; font-size: 16px; font-weight: 700; color: var(--cd-ink); }
.cd-topo-sub { margin: 0 0 10px; font-size: 12.5px; color: var(--cd-muted); }
.cd-topo-kind { margin: 0 0 8px; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--cd-muted); }

.cd-topo-rail { background: var(--cd-panel); border: 1px solid var(--cd-hairline); border-radius: var(--cd-r-m); padding: 16px; }
.cd-topo-group { padding: 10px 0; border-top: 1px solid var(--cd-hairline); }
.cd-topo-group:first-of-type { border-top: 0; }
.cd-topo-service { display: flex; align-items: baseline; gap: 8px; padding: 4px 0; font-size: 13px; }
.cd-topo-service-label { font-weight: 600; color: var(--cd-ink); }
.cd-topo-service-addr { color: var(--cd-muted); font-family: var(--cd-mono); font-size: 12px; flex: 1; overflow-wrap: anywhere; }
.cd-topo-add { display: flex; gap: 6px; margin-top: 6px; }
.cd-topo-add input, .cd-topo-addip input, .cd-topo-boxname, .cd-topo-backing input, .cd-topo-newbox input,
.cd-topo-config input, .cd-topo-config select {
  font: 400 13px/1.4 var(--cd-sans); color: var(--cd-ink); background: var(--cd-paper);
  border: 1px solid var(--cd-hairline); border-radius: var(--cd-r-s); padding: 6px 8px; min-width: 0; }
.cd-topo-add input { flex: 1; }
.cd-topo-add .cd-topo-port { flex: 0 0 64px; }
.cd-topo-plus, .cd-topo-x, .cd-topo-mini { border: 1px solid var(--cd-hairline); background: var(--cd-panel);
  color: var(--cd-muted); border-radius: var(--cd-r-s); cursor: pointer; font-size: 12.5px; padding: 2px 8px; }
.cd-topo-plus:hover, .cd-topo-mini:hover { border-color: var(--cd-steel); color: var(--cd-ink); }
.cd-topo-x:hover { border-color: var(--cd-crit); color: var(--cd-crit); }
.cd-topo-backing { display: flex; flex-direction: column; gap: 8px; }
.cd-topo-backing label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--cd-muted); }

.cd-topo-main { min-width: 0; }
.cd-topo-gate { border: 1px solid var(--cd-warn, #b6893b); border-left-width: 3px; border-radius: var(--cd-r-m);
  background: var(--cd-panel); color: var(--cd-ink); font-size: 13px; padding: 10px 14px; margin-bottom: 14px; }
.cd-topo-tray { background: var(--cd-panel); border: 1px dashed var(--cd-hairline); border-radius: var(--cd-r-m);
  padding: 12px 16px; margin-bottom: 14px; }
.cd-topo-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cd-topo-chip { border: 1px solid var(--cd-hairline); background: var(--cd-paper); color: var(--cd-ink);
  border-radius: 999px; padding: 4px 12px; font-size: 12.5px; cursor: grab; user-select: none; }
.cd-topo-chip.fed { border-color: var(--cd-steel); }
.cd-topo-chip.gated { opacity: .45; cursor: not-allowed; }

.cd-topo-boxes { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.cd-topo-box { background: var(--cd-panel); border: 1px solid var(--cd-hairline); border-radius: var(--cd-r-m);
  padding: 14px; transition: border-color .15s ease, box-shadow .15s ease; }
.cd-topo-box.over { border-color: var(--cd-steel); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cd-steel) 25%, transparent); }
.cd-topo-boxhead { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.cd-topo-boxname { flex: 1; font-weight: 700; font-size: 15px; background: transparent; border-color: transparent; }
.cd-topo-boxname:hover, .cd-topo-boxname:focus { border-color: var(--cd-hairline); background: var(--cd-paper); }
.cd-topo-ips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.cd-topo-ip { display: inline-flex; align-items: center; gap: 5px; font-family: var(--cd-mono); font-size: 12px;
  color: var(--cd-ink); border: 1px solid var(--cd-hairline); border-radius: var(--cd-r-s); padding: 2px 6px; }
.cd-topo-addip { display: inline-flex; gap: 5px; }
.cd-topo-addip input { width: 110px; font-family: var(--cd-mono); font-size: 12px; }
.cd-topo-apps { display: flex; flex-direction: column; gap: 6px; min-height: 40px; }
.cd-topo-app { display: flex; align-items: center; gap: 8px; border: 1px solid var(--cd-hairline);
  border-radius: var(--cd-r-s); background: var(--cd-paper); padding: 7px 10px; font-size: 13px; }
.cd-topo-app.fed { border-left: 3px solid var(--cd-steel); }
.cd-topo-app-name { font-weight: 600; color: var(--cd-ink); }
.cd-topo-app-bind { flex: 1; color: var(--cd-muted); font-family: var(--cd-mono); font-size: 11.5px; overflow-wrap: anywhere; }
.cd-topo-newbox { display: flex; gap: 8px; align-items: center; border-style: dashed; }
.cd-topo-newbox input { flex: 1; }

.cd-topo-overlay { position: fixed; inset: 0; background: color-mix(in srgb, var(--cd-ink) 45%, transparent);
  display: flex; align-items: center; justify-content: center; z-index: 60; }
.cd-topo-config { background: var(--cd-paper); border: 1px solid var(--cd-hairline); border-radius: var(--cd-r-m);
  box-shadow: var(--cd-shadow-pop); padding: 20px 22px; width: min(440px, calc(100vw - 40px));
  display: flex; flex-direction: column; gap: 10px; max-height: 85vh; overflow: auto; }
.cd-topo-field { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--cd-muted); }
.cd-topo-configbtns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* Topology board refinements (bench UX 2026-08-12): chips queue left-to-right and WRAP — never stack; a
   bound address wears steel and lists its ports; app rows wrap their meta instead of forcing width. */
.cd-topo-ips { display: flex; flex-direction: row; flex-wrap: wrap; gap: 6px; align-items: center; }
.cd-topo-ip { flex: 0 0 auto; width: auto; }
.cd-topo-ip.used { border-color: var(--cd-steel); color: var(--cd-steel); background: var(--cd-steel-tint); }
.cd-topo-ip-ports { font-size: 10px; opacity: .85; letter-spacing: .02em; }
.cd-topo-app { flex-wrap: wrap; }
.cd-topo-app-bind { flex: 1 1 140px; }
.cd-topo-boxes { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.cd-topo-chip { flex: 0 0 auto; }

/* The app-wiring drawer (bench ruling 2026-08-12): click the app name, see everything it depends on. */
.cd-topo-appwrap { display: flex; flex-direction: column; }
.cd-topo-app-name { border: 0; background: transparent; padding: 0; font: inherit; font-weight: 600;
  color: var(--cd-ink); cursor: pointer; text-align: left; }
.cd-topo-app-name:hover { color: var(--cd-steel); }
.cd-topo-app-detail { margin: 2px 0 4px; padding: 8px 12px; border-left: 2px solid var(--cd-hairline);
  display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; font-size: 12px; }
.cd-topo-app-detail dt { color: var(--cd-muted); font-family: var(--cd-mono); font-size: 10.5px;
  text-transform: uppercase; letter-spacing: .06em; align-self: baseline; }
.cd-topo-app-detail dd { margin: 0; color: var(--cd-ink); overflow-wrap: anywhere; }

/* Accordion state on the wiring drawer: the open row reads as selected, the caret is the affordance. */
.cd-topo-app-name.open { color: var(--cd-steel); }

/* The hidden-attribute trap (bench 2026-08-12): `display: grid` on the drawer BEATS the UA's
   `[hidden] { display: none }`, so every drawer rendered open no matter what the accordion said.
   The attribute must win explicitly. */
.cd-topo-app-detail[hidden] { display: none; }

/* Wrap opt-out for the nowrap th default — a seven-IP box header wraps instead of forcing a scrollbar. */
.cd-table th.cd-wrap { white-space: normal; overflow-wrap: anywhere; }

/* ═══════════════ PRINT (bench 2026-08-12) ═══════════════
   The checklist is an install-day DOCUMENT — printed or saved as PDF from the browser, which keeps ONE
   renderer (the doctrine: pure derivation, nothing to drift). Print kills the two web conveniences that
   ruin paper: horizontal scroll containers (clip at the page edge) and nowrap cells (force the width that
   needed the scrollbar). Everything wraps, chrome disappears, tokens force light. */
@media print {
  .cd-root {
    --cd-paper: #fff; --cd-panel: #fff; --cd-ink: #111; --cd-ink-2: #222; --cd-muted: #555;
    --cd-hairline: #bfbfbf; --cd-steel: #333; --cd-steel-tint: transparent;
    --cd-good-tint: transparent; --cd-warn-tint: transparent; --cd-crit-tint: transparent;
  }
  body { background: #fff; }
  .cd-side, .cd-appbar, .cd-btn, .cd-pagehead-acts, .cd-pagehead > div:last-child { display: none !important; }
  .cd-app { display: block; }
  .cd-page { padding: 0; }
  .cd-panel { padding: 10px 12px; }
  .cd-panel + .cd-panel { margin-top: 10px; }
  .cd-panel-head { break-after: avoid; }
  .cd-tablewrap { overflow: visible; border-radius: 0; }
  .cd-table { font-size: 10.5px; table-layout: fixed; }
  .cd-table th { white-space: normal; overflow-wrap: anywhere; padding: 5px 8px; }
  .cd-table td { padding: 5px 8px; overflow-wrap: anywhere; }
  .cd-mono-cell { font-size: 10px; overflow-wrap: anywhere; }
  thead { display: table-header-group; }  /* headers repeat when a long sheet crosses pages */
  tr { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}
