/* Jacquard Trust Centre: one stylesheet (TC-124).

   The Phoenix Design System's tokens, then the redesign's components, ported from
   docs/design/redesign/tc.css without its canvas-only rules. No inline styles, no scripts,
   no :has and no :target (decision 0002; the build brief, section 1). Each later task adds
   its own section at the end of this file and changes nothing above it. */

/* ---------- Fonts (self-hosted, font-src 'self') ---------- */
/* Each URL carries a hash of the file (?v=), checked by a test: a new font is a new URL.
   Outfit and IBM Plex Sans are under the SIL Open Font License (the *-OFL.txt files beside
   them). JQRD Relais (Medium, Medium Italic) is licensed to Jacquard and supplied by Russell. */
@font-face {
  font-family: "J Relais";
  src: url("/static/fonts/JQRDRelais-Medium.woff2?v=9d10b2c9a7d7") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "J Relais";
  src: url("/static/fonts/JQRDRelais-MediumItalic.woff2?v=6013b3daf40e") format("woff2");
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Outfit";
  src: url("/static/fonts/Outfit-Variable.woff2?v=d7340c446921") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/static/fonts/IBMPlexSans-Regular.woff2?v=3b646991d300") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/static/fonts/IBMPlexSans-Medium.woff2?v=0717336fb31f") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/static/fonts/IBMPlexSans-SemiBold.woff2?v=8960851d691c") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens (Phoenix Design System) ---------- */
/* The definitions this file uses, copied from docs/design/redesign/ds/jacquarddesign/
   _ds_bundle.css with the tokens they refer to and the layout tiers for tablet and phone.
   A test checks each one still matches the bundle. */
:root {
  /* ===== Colour: primitives (reached directly or transitively) ===== */
  --white:#FFFFFF;
  --rich-black:#15020C;
  --gold-25:#FEFBF6;   --gold-50:#FBF7F0;   --gold-100:#F6EFE0;
  --grey-100:#C5C0C2;  --grey-300:#847B80;  --grey-400:#5E5559;
  --maroon-50:#E8C8DC; --maroon-100:#CA99B7; --maroon-200:#AF6693; --maroon-300:#95336F;
  --maroon-400:#7A004B; --maroon-500:#670041; --maroon-600:#540037;
  --yellow-100:#FFF9D8; --yellow-300:#FFEC89; --yellow-400:#FFE661; --yellow-500:#F2CE00;
  --pink-50:#FFEBFC;
  --error-red-50:#F9D0D0; --error-red-500:#9D1616;

  /* ===== Colour: semantic roles (light theme) ===== */
  --color-bg-canvas:  var(--gold-50);
  --color-bg-page:    var(--gold-25);
  --color-bg-surface: var(--white);
  --color-bg-subtle:  var(--gold-50);
  --color-bg-sunken:  var(--gold-100);
  --color-bg-hover:    rgba(21,2,12,0.04);
  --color-bg-selected: var(--yellow-100);
  --color-bg-brand:    var(--maroon-400);
  --color-fg-on-brand: var(--white);

  --color-text-default: var(--rich-black);
  --color-text-muted:   var(--grey-400);
  --color-text-subtle:  var(--grey-300);
  --color-text-link:    var(--maroon-400);

  --color-border-default: var(--grey-100);
  --color-border-subtle:  rgba(35,26,31,0.10);
  --color-border-strong:  var(--grey-300);
  --color-border-focus:   var(--maroon-400);

  --color-primary:         var(--yellow-400);
  --color-primary-hover:   var(--yellow-500);
  --color-on-primary:      var(--rich-black);
  --color-secondary:       var(--maroon-400);
  --color-secondary-hover: var(--maroon-500);
  --color-on-secondary:    var(--white);

  --color-info:    var(--maroon-300);
  --color-info-bg: var(--pink-50);
  --color-success-text: #146C4E;
  --color-success-bg:   #D9F2E9;
  --color-warning-text: #8A5400;
  --color-warning-bg:   #FEEBD5;
  --color-danger-text:  #A81E3F;
  --color-danger-bg:    var(--error-red-50);

  /* ===== Type ===== */
  --font-display: 'J Relais', 'Outfit', system-ui, -apple-system, sans-serif;
  --font-sans:    'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-legible: 'IBM Plex Sans', 'Outfit', system-ui, -apple-system, sans-serif;
  --tracking-caps: 0.03em;
  --tracking-tight: -0.02em;
  --font-tabular: 'tnum' 1, 'lnum' 1;

  /* ===== Spacing / layout (desktop tier) ===== */
  --grid-margin: 80px;
  --layout-xxs: 24px;
  --layout-xs:  48px;
  --layout-sm:  64px;

  /* ===== Radii and elevation ===== */
  --radius-sm:   4px;
  --radius-md:   6px;
  --radius-lg:   8px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 2px rgba(21,2,12,0.06);
  --shadow-md: 0 4px 12px rgba(21,2,12,0.08);

  /* ===== Motion ===== */
  --motion-ease-enter: cubic-bezier(0.2, 0.8, 0.2, 1);
  --motion-duration-micro: 150ms;
  --ease-enter: var(--motion-ease-enter);
  --duration-micro: var(--motion-duration-micro);
}

/* Tablet (768-1023): layout tier */
@media (max-width: 1023px) {
  :root {
    --grid-margin: 40px;
    --layout-xxs: 24px; --layout-xs: 40px; --layout-sm: 48px;
  }
}

/* Phone (<768): layout tier */
@media (max-width: 767px) {
  :root {
    --grid-margin: 16px;
    --layout-xxs: 16px; --layout-xs: 32px; --layout-sm: 40px;
  }
}

/* Motion: honour reduced motion (as the bundle does) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--color-bg-canvas);
  color: var(--color-text-default);
  font-family: var(--font-sans);
  font-size: 16px; line-height: 24px; font-weight: 400;
  -webkit-font-smoothing: antialiased;
}
.page { min-height: 100vh; display: flex; flex-direction: column; background: var(--color-bg-canvas); }
.container { width: 100%; max-width: 1280px; margin-inline: auto; padding-inline: var(--grid-margin); }

a { color: var(--color-text-link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--color-border-focus); outline-offset: 2px; }

.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 16px; top: -64px; z-index: 10; padding: 12px 16px; background: var(--color-bg-surface); color: var(--color-text-link); border-radius: var(--radius-sm); box-shadow: var(--shadow-md); }
.skip-link:focus { top: 8px; }

.icon { width: 20px; height: 20px; flex: none; display: block; }
.icon-sm { width: 16px; height: 16px; flex: none; display: block; }
.icon-lg { width: 24px; height: 24px; flex: none; display: block; }

/* ---------- Type ---------- */
h1, h2, h3 { font-family: var(--font-display); font-weight: 500; letter-spacing: var(--tracking-tight); color: var(--color-text-default); margin: 0; }
h1 { font-size: 36px; line-height: 40px; margin-bottom: 16px; }
h2 { font-size: 22px; line-height: 26px; margin-bottom: 16px; }
h3 { font-size: 18px; line-height: 22px; margin-bottom: 8px; }
p { margin: 0 0 16px; }
.eyebrow { margin: 0 0 8px; font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--color-text-link); }
.lede { margin: 0 0 24px; max-width: 640px; font-size: 16px; line-height: 24px; color: var(--color-text-muted); }
.small { font-size: 13px; line-height: 18px; color: var(--color-text-muted); }
.muted { color: var(--color-text-muted); }
.legible { font-family: var(--font-legible); font-feature-settings: var(--font-tabular); }
@media (max-width: 767px) {
  h1 { font-size: 28px; line-height: 32px; }
}

/* ---------- Customer header ---------- */
.site-header { background: var(--color-bg-surface); border-bottom: 1px solid var(--color-border-subtle); }
.header-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; min-height: 72px; padding-block: 16px; }
.brand-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--color-text-default); text-decoration: none; }
.brand:hover { text-decoration: none; }
.wordmark { display: block; height: 20px; width: auto; }
.brand-product { padding-left: 12px; border-left: 1px solid var(--color-border-default); font-size: 13px; line-height: 20px; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--color-text-muted); white-space: nowrap; }
.env-badge { display: inline-flex; align-items: center; padding: 4px 12px; border-radius: var(--radius-full); background: var(--yellow-300); color: var(--rich-black); font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: var(--tracking-caps); text-transform: uppercase; white-space: nowrap; }
.header-actions { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; }
.header-actions form { margin: 0; }
.header-link { font-size: 14px; line-height: 20px; }
@media (max-width: 767px) {
  .header-bar { min-height: 64px; padding-block: 12px; }
  .wordmark { height: 16px; }
  .header-actions { margin-left: 0; width: 100%; justify-content: space-between; }
}
/* 320px: keep wordmark, product name and badge each on one line */
@media (max-width: 359px) {
  .brand { gap: 8px; }
  .brand-group { gap: 8px; }
  .wordmark { height: 14px; }
  .brand-product { padding-left: 8px; font-size: 12px; }
  .env-badge { padding: 4px 8px; font-size: 11px; }
}

/* ---------- Admin header: maroon band, staff label, nav ---------- */
.admin-header { background: var(--color-bg-brand); color: var(--color-fg-on-brand); }
.admin-header :focus-visible { outline-color: var(--yellow-400); }
.admin-header .brand { color: var(--white); }
.admin-header .brand-product { color: var(--maroon-50); border-left-color: var(--maroon-200); }
.admin-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; min-height: 72px; padding-block: 16px; }
.staff-label { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px; border: 1px solid var(--maroon-100); border-radius: var(--radius-full); color: var(--white); font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: var(--tracking-caps); text-transform: uppercase; white-space: nowrap; }
.admin-user { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; font-size: 14px; line-height: 20px; color: var(--maroon-50); }
.admin-user strong { color: var(--white); font-weight: 500; }
.admin-user form { margin: 0; }
.admin-nav { background: var(--maroon-600); }
.admin-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 4px; }
.admin-nav a { display: flex; align-items: center; min-height: 48px; padding: 0 12px; border-bottom: 4px solid transparent; border-top: 4px solid transparent; color: var(--white); font-size: 14px; line-height: 20px; font-weight: 500; text-decoration: none; }
.admin-nav a:hover { background: var(--maroon-500); }
.admin-nav a[aria-current="page"] { border-bottom-color: var(--yellow-400); }
.admin-nav-mobile { display: none; }
.admin-nav-mobile summary { list-style: none; display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 0 var(--grid-margin); color: var(--white); font-size: 14px; font-weight: 500; letter-spacing: var(--tracking-caps); text-transform: uppercase; cursor: pointer; }
.admin-nav-mobile summary::-webkit-details-marker { display: none; }
.admin-nav-mobile[open] summary .chevron { transform: rotate(180deg); }
.admin-nav-mobile ul { flex-direction: column; padding: 0 0 8px; }
.admin-nav-mobile a { padding: 0 var(--grid-margin); border-top: 0; border-bottom: 0; border-left: 4px solid transparent; }
.admin-nav-mobile a[aria-current="page"] { border-left-color: var(--yellow-400); background: var(--maroon-500); }
@media (max-width: 767px) {
  .admin-bar { min-height: 64px; padding-block: 12px; }
  .admin-user { margin-left: 0; width: 100%; justify-content: space-between; }
  .admin-nav-desktop { display: none; }
  .admin-nav-mobile { display: block; }
}

/* ---------- Main, footer ---------- */
.site-main { flex: 1; width: 100%; max-width: 1280px; margin-inline: auto; padding: var(--layout-xs) var(--grid-margin) var(--layout-sm); }
.site-footer { margin-top: auto; border-top: 1px solid var(--color-border-subtle); background: var(--color-bg-page); }
.footer-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; padding-block: 24px; font-size: 13px; line-height: 18px; color: var(--color-text-muted); }
.footer-bar p { margin: 0; }
.footer-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 24px; }

.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 32px; }
.page-header .lede { margin-bottom: 0; }
.back-link { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 24px; font-size: 14px; line-height: 20px; }
.stack { display: flex; flex-direction: column; gap: 24px; }
.section-gap { margin-top: var(--layout-xxs); }
.two-col { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 1023px) { .two-col { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Surfaces ---------- */
.panel, .card { background: var(--color-bg-surface); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 32px; }
.panel > :last-child, .card > :last-child { margin-bottom: 0; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.card-title h2 { margin: 0; }
@media (max-width: 767px) { .panel, .card { padding: 24px; } }

.auth { display: flex; justify-content: center; padding-top: var(--layout-xxs); }
.auth-panel { width: 100%; max-width: 520px; padding: 48px; }
.auth-foot { margin: 24px 0 0; padding-top: 24px; border-top: 1px solid var(--color-border-subtle); }
.auth-links { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 24px; font-size: 14px; line-height: 20px; }
.auth-links form { margin: 0; }
.auth-mark { display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; margin-bottom: 24px; border-radius: var(--radius-full); background: var(--color-bg-sunken); color: var(--color-text-link); }
@media (max-width: 767px) {
  .auth { padding-top: 0; }
  .auth-panel { padding: 24px; }
}

/* ---------- Buttons ---------- */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 24px; border: 1px solid transparent; border-radius: var(--radius-full); background: var(--color-primary); color: var(--color-on-primary); font-family: var(--font-sans); font-size: 14px; line-height: 20px; font-weight: 500; letter-spacing: var(--tracking-caps); text-transform: uppercase; text-decoration: none; white-space: nowrap; cursor: pointer; transition: background var(--duration-micro) var(--ease-enter); }
.button:hover { background: var(--color-primary-hover); text-decoration: none; }
.button-secondary { background: var(--color-secondary); color: var(--color-on-secondary); }
.button-secondary:hover { background: var(--color-secondary-hover); }
.button-ghost { background: transparent; color: var(--color-text-default); border-color: var(--color-border-strong); }
.button-ghost:hover { background: var(--color-bg-hover); }
.button-danger { background: var(--color-danger-text); color: var(--white); }
.button-danger:hover { background: var(--error-red-500); }
.button-on-brand { background: transparent; color: var(--white); border-color: var(--maroon-100); }
.button-on-brand:hover { background: var(--maroon-300); }
.button-small { min-height: 32px; padding: 0 16px; font-size: 12px; line-height: 16px; }
.button-block { width: 100%; white-space: normal; text-align: center; padding-block: 12px; overflow-wrap: anywhere; }
@media (max-width: 767px) {
  .button { white-space: normal; text-align: center; padding-block: 12px; overflow-wrap: anywhere; }
}
.button[disabled], .button[disabled]:hover { background: var(--color-bg-sunken); color: var(--color-text-subtle); border-color: var(--color-border-default); cursor: not-allowed; }
.button-link, .button-link-danger { display: inline; min-height: 24px; padding: 0; border: 0; background: none; color: var(--color-text-link); font: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; cursor: pointer; }
.button-link:hover { text-decoration-thickness: 2px; }
.button-link-danger { color: var(--color-danger-text); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; margin-top: 8px; }
.actions form { margin: 0; }

/* ---------- Forms ---------- */
form { margin: 0; }
.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.label, .field > label { font-size: 14px; line-height: 20px; font-weight: 500; color: var(--color-text-default); }
.optional { font-weight: 400; color: var(--color-text-muted); }
.hint { font-size: 13px; line-height: 18px; color: var(--color-text-muted); margin: 0; }
.hint.section-gap { margin-top: var(--layout-xxs); }
.hint + .actions, .form-row + .actions { margin-top: 24px; }
.input, .select, .textarea { width: 100%; min-height: 48px; padding: 12px; border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm); background: var(--color-bg-surface); color: var(--color-text-default); font-family: var(--font-legible); font-size: 16px; line-height: 22px; }
.textarea { min-height: 96px; resize: vertical; }
.select { appearance: none; padding-right: 40px; background-image: none; }
.select-wrap { position: relative; }
.select-wrap .icon { position: absolute; right: 12px; top: 14px; pointer-events: none; color: var(--color-text-muted); }
.input-code { max-width: 280px; font-size: 24px; line-height: 32px; letter-spacing: 0.2em; font-feature-settings: var(--font-tabular); }
.input-file { padding: 8px; font-family: var(--font-sans); font-size: 14px; }
.input-file::file-selector-button { margin-right: 16px; min-height: 32px; padding: 0 16px; border: 1px solid var(--color-border-strong); border-radius: var(--radius-full); background: var(--color-bg-subtle); font: inherit; font-weight: 500; cursor: pointer; }
.input-search { padding-left: 40px; }
.search-wrap { position: relative; }
.search-wrap .icon { position: absolute; left: 12px; top: 14px; color: var(--color-text-muted); }
.field-error .input, .field-error .select, .field-error .textarea { border: 2px solid var(--color-danger-text); padding: 11px; }
.error-message { display: flex; align-items: flex-start; gap: 8px; margin: 0; color: var(--color-danger-text); font-size: 14px; line-height: 20px; font-weight: 500; }
.error-message > span { min-width: 0; overflow-wrap: anywhere; }
.error-message .icon { width: 20px; height: 20px; }
.checkbox, .radio { display: flex; align-items: flex-start; gap: 12px; font-size: 16px; line-height: 24px; }
.checkbox input, .radio input { flex: none; width: 24px; height: 24px; margin: 0; accent-color: var(--color-secondary); }
fieldset { min-width: 0; margin: 0 0 24px; padding: 0; border: 0; }
legend { padding: 0; margin-bottom: 12px; font-size: 14px; line-height: 20px; font-weight: 500; }
.choice-list { display: flex; flex-direction: column; gap: 12px; }
.sub-choices { margin: 0 0 8px 36px; }
.sub-choices fieldset { margin-bottom: 12px; }
.sub-choices legend { margin-bottom: 8px; font-size: 13px; line-height: 18px; color: var(--color-text-muted); }
.sub-choices .checkbox { font-size: 14px; line-height: 24px; }
.choice-hint { display: block; font-size: 13px; line-height: 18px; color: var(--color-text-muted); }
.form-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px 24px; }
.form-row .field { flex: 1 1 240px; margin-bottom: 0; }
.form-row .field-narrow { flex: 0 1 200px; }

/* Error summary: first in main, links to fields */
.error-summary { margin-bottom: 32px; padding: 24px; border: 2px solid var(--color-danger-text); border-radius: var(--radius-lg); background: var(--color-bg-surface); }
.error-summary-title { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-family: var(--font-sans); font-size: 16px; line-height: 24px; font-weight: 500; letter-spacing: 0; color: var(--color-danger-text); }
.error-summary ul { margin: 0; padding-left: 28px; }
.error-summary a { overflow-wrap: anywhere; color: var(--color-danger-text); font-weight: 500; }

/* ---------- Banners ([role=alert], [role=status]) ---------- */
.banner { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 24px; padding: 16px; border: 1px solid; border-radius: var(--radius-lg); font-size: 14px; line-height: 20px; color: var(--color-text-default); }
.banner p { margin: 0; }
.banner-title { font-weight: 500; }
.banner-success { background: var(--color-success-bg); border-color: var(--color-success-text); }
.banner-success .icon { color: var(--color-success-text); }
.banner-error { background: var(--color-danger-bg); border-color: var(--color-danger-text); }
.banner-error .icon { color: var(--color-danger-text); }
.banner-warning { background: var(--color-warning-bg); border-color: var(--color-warning-text); }
.banner-warning .icon { color: var(--color-warning-text); }
.banner-info { background: var(--color-info-bg); border-color: var(--color-info); }
.banner-info .icon { color: var(--color-info); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--radius-full); font-family: var(--font-sans); font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: var(--tracking-caps); text-transform: uppercase; white-space: nowrap; }
.badge .icon-sm { width: 12px; height: 12px; }
.badge-success { background: var(--color-success-bg); color: var(--color-success-text); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning-text); }
.badge-danger { background: var(--color-danger-bg); color: var(--color-danger-text); }
.badge-info { background: var(--color-info-bg); color: var(--color-info); }
.badge-neutral { background: var(--color-bg-sunken); color: var(--color-text-muted); }
.badge-access { background: var(--maroon-50); color: var(--maroon-600); }
.badge-list { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; background: var(--color-bg-surface); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; font-family: var(--font-legible); font-size: 14px; line-height: 20px; font-feature-settings: var(--font-tabular); }
caption { padding: 16px; text-align: left; font-family: var(--font-sans); font-size: 14px; line-height: 20px; color: var(--color-text-muted); caption-side: top; border-bottom: 1px solid var(--color-border-subtle); }
th { padding: 12px 16px; text-align: left; vertical-align: bottom; background: var(--color-bg-subtle); border-bottom: 1px solid var(--color-border-default); font-family: var(--font-sans); font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--color-text-muted); white-space: nowrap; }
td { padding: 12px 16px; vertical-align: top; border-bottom: 1px solid var(--color-border-subtle); }
tbody th { background: none; text-transform: none; letter-spacing: 0; font-family: var(--font-legible); font-size: 14px; line-height: 20px; color: var(--color-text-default); vertical-align: top; white-space: normal; border-bottom: 1px solid var(--color-border-subtle); }
tr:last-child td, tr:last-child th { border-bottom: 0; }
.cell-sub { display: block; font-size: 13px; line-height: 18px; color: var(--color-text-muted); }
.cell-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px 16px; }
.cell-actions form { margin: 0; }
.num { text-align: right; }
.group-row th { background: var(--color-bg-sunken); font-family: var(--font-sans); font-size: 14px; letter-spacing: 0; text-transform: none; color: var(--color-text-default); }
.table-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; font-size: 14px; }

/* Stacked rows on phones (alternative to scrolling) */
@media (max-width: 767px) {
  .table-stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table-stack tr { display: block; padding: 16px; border-bottom: 1px solid var(--color-border-subtle); }
  .table-stack tr:last-child { border-bottom: 0; }
  .table-stack td, .table-stack tbody th { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 12px; padding: 4px 0; border: 0; }
  .table-stack td::before, .table-stack tbody th::before { content: attr(data-label); font-family: var(--font-sans); font-size: 12px; line-height: 20px; font-weight: 500; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--color-text-muted); }
  .table-stack .cell-actions { justify-content: flex-start; }
  .table-stack .cell-sub { grid-column: 2; overflow-wrap: anywhere; }
  .table-stack .num { text-align: left; }
  .table-stack .badge { white-space: normal; }
  .table-stack .group-row { padding: 12px 16px; background: var(--color-bg-sunken); }
  .table-stack .group-row th { display: block; padding: 0; background: none; }
  .table-stack .group-row th::before { content: none; }
}

/* ---------- Pagination, filters, view switch ---------- */
.pagination { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; list-style: none; margin: 0; padding: 0; }
.pagination a, .pagination span { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 40px; padding: 0 12px; border-radius: var(--radius-full); font-size: 14px; }
.pagination [aria-current="page"] { background: var(--color-secondary); color: var(--white); text-decoration: none; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; margin-bottom: 24px; padding: 24px; background: var(--color-bg-surface); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-lg); }
.filter-bar .field { flex: 1 1 180px; margin: 0; }
.filter-bar .checkbox { flex-basis: 100%; font-size: 14px; }
.view-switch { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0 0 24px; padding: 0; }
.view-switch a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border: 1px solid var(--color-border-strong); border-radius: var(--radius-full); color: var(--color-text-default); font-size: 14px; font-weight: 500; text-decoration: none; }
.view-switch a:hover { background: var(--color-bg-hover); }
.view-switch a[aria-current="page"] { background: var(--color-secondary); border-color: var(--color-secondary); color: var(--white); }

/* ---------- Admin tiles (retained) ---------- */
.tile-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.tile { display: flex; flex-direction: column; gap: 8px; height: 100%; min-height: 152px; padding: 24px; background: var(--color-bg-surface); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); color: var(--color-text-default); text-decoration: none; }
.tile:hover { border-color: var(--color-border-strong); box-shadow: var(--shadow-md); text-decoration: none; }
.tile-icon { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; margin-bottom: 8px; border-radius: var(--radius-full); background: var(--maroon-50); color: var(--maroon-500); }
.tile-title { font-family: var(--font-display); font-size: 20px; line-height: 24px; letter-spacing: var(--tracking-tight); }
.tile-desc { font-size: 14px; line-height: 20px; color: var(--color-text-muted); }

.attention-list { list-style: none; margin: 0; padding: 0; }
.attention-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 12px 0; border-bottom: 1px solid var(--color-border-subtle); font-size: 14px; line-height: 20px; }
.attention-list li:last-child { border-bottom: 0; }

/* ---------- Customer documents ---------- */
.doc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.doc { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px 24px; align-items: start; padding: 24px; background: var(--color-bg-surface); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.doc-mark { display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: var(--radius-lg); background: var(--color-bg-sunken); color: var(--color-text-link); }
.doc-type { margin: 0 0 4px; font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--color-text-link); }
.doc-title { margin: 0 0 4px; font-size: 18px; line-height: 22px; }
.doc-desc { margin: 0 0 8px; font-size: 14px; line-height: 20px; color: var(--color-text-default); max-width: 640px; white-space: pre-line; }
.doc-meta { margin: 0; font-family: var(--font-legible); font-size: 13px; line-height: 18px; color: var(--color-text-muted); }
.doc-action { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.doc-action form { display: flex; flex-direction: column; align-items: inherit; }
.header-link[aria-current="page"] { font-weight: 600; text-decoration-thickness: 2px; }
.file-meta { font-family: var(--font-legible); font-size: 13px; line-height: 18px; color: var(--color-text-muted); white-space: nowrap; }
.library-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; margin: 32px 0 16px; }
.library-head h2 { margin: 0; }
.category-nav { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0 0 8px; padding: 0; }
.category-nav a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border: 1px solid var(--color-border-strong); border-radius: var(--radius-full); background: var(--color-bg-surface); color: var(--color-text-default); font-size: 14px; line-height: 20px; font-weight: 500; text-decoration: none; }
.category-nav a:hover { background: var(--color-bg-hover); }
.category { margin-top: 40px; }
.category > h2 { margin-bottom: 16px; }
.ask-line { margin-top: 32px; font-size: 14px; line-height: 20px; color: var(--color-text-muted); }
@media (max-width: 767px) {
  .doc { grid-template-columns: auto minmax(0, 1fr); padding: 16px; gap: 16px; }
  .doc-mark { width: 40px; height: 40px; }
  .doc-action { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; }
  .doc-action .button, .doc-action form { width: 100%; }
}

/* ---------- Empty and status states ---------- */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 64px 24px; background: var(--color-bg-surface); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-lg); }
.empty-state .lede { margin-inline: auto; }
.state-mark { display: flex; align-items: center; justify-content: center; width: 56px; height: 56px; margin-bottom: 24px; border-radius: var(--radius-full); background: var(--color-bg-sunken); color: var(--color-text-link); }
.state-mark .icon-lg { width: 28px; height: 28px; }
.state-mark-warning { background: var(--color-warning-bg); color: var(--color-warning-text); }
.state-mark-danger { background: var(--color-danger-bg); color: var(--color-danger-text); }

/* ---------- NDA reading layout ---------- */
.reading { max-width: 760px; margin-inline: auto; }
.summary-list { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 32px; margin: 0 0 32px; padding: 24px; background: var(--color-bg-surface); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-lg); font-size: 14px; line-height: 20px; }
.summary-list dt { color: var(--color-text-muted); }
.summary-list dd { margin: 0; font-family: var(--font-legible); }
.nda-text { padding: 48px; background: var(--color-bg-surface); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-lg); font-family: var(--font-legible); font-size: 16px; line-height: 26px; }
.nda-text h2 { font-size: 22px; line-height: 26px; margin-bottom: 24px; }
.nda-text h3 { margin: 32px 0 8px; font-family: var(--font-legible); font-size: 16px; line-height: 24px; font-weight: 600; letter-spacing: 0; }
.nda-text p { margin: 0 0 16px; }
.nda-text > :first-child { margin-top: 0; }
.nda-text strong { font-weight: 600; }
.accept-box { margin-top: 32px; padding: 32px; background: var(--color-bg-surface); border: 2px solid var(--color-secondary); border-radius: var(--radius-lg); }
.accept-box .checkbox { margin-bottom: 24px; }
.record-note { margin: 16px 0 0; font-size: 13px; line-height: 18px; color: var(--color-text-muted); }
@media (max-width: 767px) {
  .summary-list { grid-template-columns: minmax(0, 1fr); gap: 4px; padding: 16px; }
  .summary-list dd { margin-bottom: 8px; }
  .nda-text { padding: 24px; font-size: 16px; line-height: 24px; }
  .accept-box { padding: 24px; }
}

.change-summary { margin-bottom: 32px; padding: 24px; background: var(--color-info-bg); border: 1px solid var(--color-info); border-radius: var(--radius-lg); }
.change-summary h2 { margin-bottom: 8px; font-size: 18px; line-height: 22px; }
.change-summary p { margin-bottom: 8px; }
.change-summary p:last-child { margin-bottom: 0; }
.textarea-tall { min-height: 320px; }
.preview-frame { padding: 24px; border: 2px dashed var(--color-border-strong); border-radius: var(--radius-lg); background: var(--color-bg-canvas); }
.preview-frame .nda-text { padding: 32px; }

/* ---------- Knowledge bank ---------- */
.breadcrumb { margin-bottom: 16px; font-size: 14px; line-height: 20px; }
.breadcrumb ol { display: flex; flex-wrap: wrap; gap: 4px 8px; list-style: none; margin: 0; padding: 0; color: var(--color-text-muted); }
.breadcrumb li + li::before { content: "/"; margin-right: 8px; color: var(--color-text-subtle); }
.search-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; max-width: 640px; margin-bottom: 40px; }
.search-row .field { flex: 1 1 280px; margin: 0; }
.kb-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 16px; }
.kb-card { display: flex; flex-direction: column; gap: 12px; height: 100%; padding: 24px; background: var(--color-bg-surface); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.kb-card-head { display: flex; align-items: center; gap: 12px; }
.kb-card h2 { margin: 0; font-size: 20px; line-height: 24px; }
.kb-card h2 a { color: var(--color-text-default); text-decoration: none; }
.kb-card h2 a:hover { text-decoration: underline; }
.kb-card p { margin: 0; font-size: 14px; line-height: 20px; color: var(--color-text-muted); }
.kb-topics { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--color-border-subtle); padding-top: 12px; }
.kb-topics a { font-size: 14px; line-height: 20px; }
.kb-more { margin-top: auto; font-size: 14px; font-weight: 500; }
.kb-layout { display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-start; }
.kb-side { flex: 1 1 220px; max-width: 280px; }
.kb-main { flex: 999 1 560px; min-width: 0; }
.side-nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.side-nav a { display: block; padding: 8px 12px; border-radius: var(--radius-md); color: var(--color-text-default); text-decoration: none; font-size: 14px; line-height: 20px; }
.side-nav a:hover { background: var(--color-bg-hover); }
.side-nav a[aria-current="page"] { background: var(--color-bg-selected); font-weight: 500; }
.side-title { margin: 0 0 8px; font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--color-text-muted); }
.topic-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.topic-item { padding: 20px 24px; background: var(--color-bg-surface); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-lg); }
.topic-item h2 { margin: 0 0 4px; font-size: 18px; line-height: 22px; }
.topic-item p { margin: 0 0 8px; font-size: 14px; line-height: 20px; }
.topic-item .doc-meta { margin: 0; }
.answer { padding: 40px; background: var(--color-bg-surface); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-lg); font-family: var(--font-legible); font-size: 16px; line-height: 26px; }
.answer h2 { margin: 24px 0 8px; font-family: var(--font-legible); font-size: 18px; line-height: 24px; font-weight: 600; letter-spacing: 0; }
.answer ul { margin: 0 0 16px; padding-left: 24px; }
.answer p:last-child { margin-bottom: 0; }
.related { margin-top: 32px; }
.related h2 { font-size: 18px; line-height: 22px; }
.related-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.related-list li { display: flex; align-items: center; gap: 12px; font-size: 14px; line-height: 20px; }
.related-list .doc-mark { width: 32px; height: 32px; }
.related-list .doc-mark .icon { width: 18px; height: 18px; }
@media (max-width: 767px) {
  .kb-side { max-width: none; order: 2; }
  .answer { padding: 24px; }
}

/* ---------- Confirm (destructive GET page) ---------- */
.confirm { max-width: 640px; }
.consequences { margin: 0 0 24px; padding-left: 24px; }
.consequences li { margin-bottom: 8px; }

/* ---------- App: pieces the boards do not draw (TC-124) ---------- */
/* A short run kept on one line, such as "8-digit" in the sign-in pages' text. */
.nowrap { white-space: nowrap; }
/* The document type icon (partials/doc_icon.html) inside the customer list's tinted mark. */
.doc-mark .doc-icon { width: 28px; height: 28px; }
/* Staff documents: the type icon beside a title, in the list and in the page heading. */
.doc-link { display: inline-flex; align-items: center; gap: 8px; }
.doc-link .doc-icon { flex: none; }
.doc-heading { display: flex; align-items: center; gap: 12px; }
.doc-heading .doc-icon { flex: none; color: var(--color-text-link); }
/* Long values (an email address, a file name) break rather than widen a table: the
   table would otherwise scroll inside its frame, on phones above all. */
.table-stack td, .table-stack tbody th { overflow-wrap: anywhere; }
/* The same for a choice's label: a long email address beside a tick must wrap, and a
   label (a flex item) may shrink below its longest word to do so. */
.checkbox, .radio { overflow-wrap: anywhere; }
.checkbox > label, .radio > span { min-width: 0; }
/* A row of fields followed by more fields: the same gap as between single fields. */
.form-row + .field, .form-row + fieldset, .form-row + .form-row { margin-top: 24px; }
/* On phones a stacked cell is a grid, its label in the first column: everything in the
   cell goes in the second (text and a badge after it, say), and a badge keeps its width. */
@media (max-width: 767px) {
  .table-stack td > *, .table-stack tbody th > * { grid-column: 2; }
  .table-stack td > .badge, .table-stack tbody th > .badge { justify-self: start; }
}

/* Sign-in and error states (TC-125). */
.sign-in-address { overflow-wrap: anywhere; }

/* Staff pages (TC-127). */
.staff-identity { overflow-wrap: anywhere; }

/* Document categories (TC-128). */
.category-nav a, .category > h2, #archive-heading, #rename-heading, #remove-heading { overflow-wrap: anywhere; }
.category .doc-title { margin: 0 0 4px; }

/* Customer knowledge bank (TC-130). */
.kb-main, .kb-card, .kb-side { overflow-wrap: anywhere; }
.kb-topic-layout .answer { margin-top: 24px; }
