/* THE COLOUR RULE (T132-10; CJ 13 Nov 2026 "far less amber", ADMA 17 row 004598, ARCHITECT 15 plan row 004603).
   Every page in Deal Shack follows it:
     attention (amber)  ONLY for something a person must act on now  -> .ds-attention, --ds-attention-*
     failure   (red)    ONLY for a real failure (a check failed, a read failed, a send failed) -> .ds-failure, --ds-failure-*
     plain     (none)   for "none", "nothing to do", "not yet", "not recorded" -> .ds-plain, --ds-plain-fg
   "No arrears", "none accrued", "nothing waiting" are plain text, never amber or red. Each page architect applies the
   rule to its own templates; these classes are additive and change no existing selector. */
/* Deal Shack frame (increment 1; register rows 001247, 001318). Design tokens and the shell -
   sidebar, top bar, back link - from the v4 handoff README. Page content keeps Bootstrap and
   custom.css; only the frame chrome is styled here, with ds- classes so nothing clashes. */
:root {
  --ds-brand: #302a63; --ds-brand-hover: #3b3475; --ds-accent: #5546c8; --ds-accent-tint: #f6f5ff;
  --ds-ink: #242934; --ds-body: #404040; --ds-caption: #6b6b80; --ds-muted: #55555f;
  --ds-page: #f7f8f9; --ds-card: #fff; --ds-white: #fff;
  --ds-rule: #e9edf1; --ds-rule-soft: #f2f4ff;
  --ds-focus: #7366ff;
  --ds-sidebar-w: 232px;
  --ds-font: 'Rubik', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --ds-shadow-card: 0 9px 20px rgba(46,35,94,.07);
  --ds-shadow-side: 0 0 21px rgba(89,102,122,.1);
  /* Content tokens (v4 Cuba): every colour used by the content layer, so no screen or content rule
     carries a raw hex. Status tones (PORTAL-SPEC §2, AA at 12px), form and table surfaces. */
  --ds-red-bg: #fdecea;   --ds-red-fg: #b3261e;
  --ds-amber-bg: #fdf3e0; --ds-amber-fg: #8a5a00; --ds-amber-fg-strong: #6b4600; --ds-amber-border: #e0c48a;
  --ds-blue-bg: #e9eff9;  --ds-blue-fg: #1b4f9c;
  --ds-green-bg: #e6f3ee; --ds-green-fg: #17614a;
  --ds-grey-bg: #f2f2f6;  --ds-grey-fg: #4a4a55;
  --ds-purple-bg: #f1f0ff; --ds-purple-fg: #302a63;
  --ds-field-border: #dcdfe6; --ds-th-bg: #fcfcfd; --ds-row-hover: #fbfbfe;
  --ds-soft-bg: #f1f0ff; --ds-soft-bg-hover: #e7e5ff; --ds-danger-border: #e8b4b0;
  --ds-backdrop: rgba(36, 41, 52, .38);
  --ds-post-accent: #0f6b73; --ds-post-ink: #0b4f55; --ds-post-tint: #f0f8f8;
  --ds-stage-track: #eeecfb;
  --ds-progress-todo: #eef0f4;
  --ds-pre-ring: rgba(85, 70, 200, .45);
  /* Stage C (visual fidelity): the prototype values the frame and screens were still missing. */
  --ds-nav-ink: #4a4a55;               /* idle sidebar item text */
  --ds-post-soft: #e2f3f3;             /* post-funding action button background */
  --ds-shadow-bar: 0 0 21px rgba(89, 102, 122, .06);   /* the top bar's own soft shadow */
  --ds-shadow-menu: 0 20px 50px rgba(46, 35, 94, .18); /* floating menus */
  /* Status pills use Rubik 500 until the v4 frame is on; under .ds-v4 they use the self-hosted Roboto 500 (see below). */
  --ds-column-bg: #eef0f4;             /* pipeline column background */
  --ds-btn-line: #e0e3ea;              /* hairline on small white buttons */
  --ds-pill-font: 'Rubik', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* The colour rule's named tokens and classes (rule at the top of this file). Tokens point at the existing status tones, so
   the colours are the ones the pages already use; nothing below restyles an existing class. */
:root {
  --ds-attention-bg: var(--ds-amber-bg); --ds-attention-fg: var(--ds-amber-fg); --ds-attention-border: var(--ds-amber-border);
  --ds-failure-bg: var(--ds-red-bg);     --ds-failure-fg: var(--ds-red-fg);     --ds-failure-border: var(--ds-danger-border);
  --ds-plain-fg: var(--ds-muted);
}
.ds-attention { background: var(--ds-attention-bg); color: var(--ds-attention-fg); border-color: var(--ds-attention-border); }
.ds-failure   { background: var(--ds-failure-bg);   color: var(--ds-failure-fg);   border-color: var(--ds-failure-border); }
.ds-plain     { background: transparent; color: var(--ds-plain-fg); border-color: var(--ds-rule); }
.ds-attention-text { color: var(--ds-attention-fg); }
.ds-failure-text   { color: var(--ds-failure-fg); }
.ds-plain-text     { color: var(--ds-plain-fg); }

/* Roboto 500 (Latin) for the status pills, self-hosted: no request leaves the site for it. The family is
   only drawn where --ds-pill-font names it, which is under .ds-v4 alone. */
@font-face {
  font-family: 'Roboto'; font-style: normal; font-weight: 500; font-display: swap;
  src: url("../vendor/roboto/roboto-500-latin.a05fa09b1e06.woff2") format("woff2");
}
.ds-v4 { --ds-pill-font: 'Roboto', 'Rubik', system-ui, -apple-system, 'Segoe UI', sans-serif; }

body.ds-body { margin: 0; background: var(--ds-page); color: var(--ds-body);
  font-family: var(--ds-font); font-size: 14px; line-height: 1.5; }

/* The signed-out and refusal states use the same mark, type and card system as the portal. */
.ds-entry-page { min-height: 100vh; }
.ds-entry { box-sizing: border-box; min-height: 100vh; display: grid; place-items: center;
  padding: clamp(20px, 6vw, 64px); }
.ds-entry-card { box-sizing: border-box; width: min(100%, 460px); padding: clamp(24px, 5vw, 38px);
  background: var(--ds-card); border: 1px solid var(--ds-rule); border-radius: 15px;
  box-shadow: var(--ds-shadow-card); }
.ds-entry-brand { display: flex; align-items: center; gap: 10px; color: var(--ds-brand);
  font: 600 17px/1 var(--ds-font); }
.ds-entry-brand svg { flex: none; }
.ds-entry-eyebrow { margin: 27px 0 11px; color: var(--ds-accent); font: 600 11px/1.3 var(--ds-font);
  letter-spacing: .08em; text-transform: uppercase; }
.ds-entry-card h1 { margin: 0; color: var(--ds-ink); font: 500 24px/1.2 var(--ds-font); }
.ds-entry-copy { margin-top: 15px; color: var(--ds-body); font: 400 14px/1.6 var(--ds-font); }
.ds-entry-copy p { margin: 0; }
.ds-entry-copy p + p { margin-top: 10px; }
.ds-entry-actions { margin-top: 27px; }
.ds-entry-actions form { margin: 0; }
.ds-entry-button { box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; max-width: 100%; padding: 11px 18px; border: 0; border-radius: 8px;
  background: var(--ds-brand); color: var(--ds-white); text-decoration: none;
  font: 500 13px/1.2 var(--ds-font); cursor: pointer; }
.ds-entry-button:hover { background: var(--ds-brand-hover); color: var(--ds-white); }
.ds-entry-button:disabled { opacity: .5; cursor: not-allowed; }
.ds-entry-page a:focus-visible, .ds-entry-page button:focus-visible, .ds-entry-page input:focus-visible {
  outline: 3px solid var(--ds-focus); outline-offset: 3px; }

.ds-app { display: grid; grid-template-columns: var(--ds-sidebar-w) minmax(0, 1fr); min-height: 100vh; }
/* Borrower / retired (spec 4.21): the top bar alone, no sidebar, content held to a readable width. */
.ds-app--plain { grid-template-columns: minmax(0, 1fr); }
.ds-app--plain .ds-content { max-width: 880px; }

/* Phone slide-in: the backdrop behind the menu and the close button inside it are shown only on a
   phone (see the responsive block); off a phone they take no space. */
.ds-backdrop { display: none; }
.ds-nav-close { display: none; background: none; border: 0; font-size: 20px; color: var(--ds-body);
  align-self: flex-end; padding: 4px 8px; cursor: pointer; }

/* Sidebar */
.ds-sidebar { background: var(--ds-card); box-shadow: var(--ds-shadow-side);
  padding: 22px 16px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0;
  height: 100vh; overflow-y: auto; }
.ds-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.ds-logo svg { flex-shrink: 0; }                        /* the mark keeps its 30px, never squashed */
.ds-logo > span { display: flex; flex-direction: column; }   /* "Deal Shack" above the tagline */
.ds-logo .ds-name { font-weight: 600; font-size: 20px; line-height: 1; color: var(--ds-brand);
  letter-spacing: -.01em; }
.ds-logo .ds-tagline { font-weight: 400; font-size: 12px; line-height: 1.4; color: var(--ds-caption);
  margin-top: 3px; }
/* Sidebar lockup as drawn in the handoff: mark and name on one line, the tagline on its own line
   below at full width (it no longer wraps beside the mark), the block inset 10px. */
.ds-sidebar .ds-logo { flex-wrap: wrap; row-gap: 8px; padding: 0 10px; }
.ds-sidebar .ds-logo > span { display: contents; }
.ds-sidebar .ds-logo .ds-tagline { flex-basis: 100%; margin-top: 0; }
.ds-group { display: flex; flex-direction: column; gap: 2px; }
.ds-group-label { font-weight: 600; font-size: 11px; line-height: 1; text-transform: uppercase;
  letter-spacing: .08em; color: var(--ds-caption); margin: 4px 8px 6px; }
.ds-nav-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--ds-body); text-decoration: none; font-size: 14px; min-height: 40px; }
.ds-nav-link:hover { background: var(--ds-accent-tint); color: var(--ds-brand); }
.ds-nav-link.active { background: var(--ds-accent-tint); color: var(--ds-brand); font-weight: 500; }
.ds-nav-link .bi { font-size: 16px; }
.ds-side-foot { margin-top: auto; }
.ds-signout { display: block; text-align: center; padding: 10px; border-radius: 8px;
  border: 1px solid var(--ds-rule); color: var(--ds-body); text-decoration: none; font-weight: 500; }
.ds-signout:hover { background: var(--ds-accent-tint); color: var(--ds-brand); }

/* Main + top bar */
.ds-main { display: flex; flex-direction: column; min-width: 0; }
.ds-topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 24px; background: var(--ds-card); border-bottom: 1px solid var(--ds-rule); }
.ds-topbar-title { font-weight: 500; font-size: 20px; line-height: 1.2; color: var(--ds-ink); margin: 0; }
.ds-topbar-right { display: flex; align-items: center; gap: 16px; }
.ds-freshness { font-size: 12px; color: var(--ds-caption); display: flex; align-items: center; gap: 6px; }
.ds-topbar-heading { gap: 8px; }
.ds-topbar-titles { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ds-menu-btn { display: none; background: none; border: 0; font-size: 20px; color: var(--ds-body);
  padding: 4px 8px; }
.ds-content { padding: 20px 24px; }
.ds-retired { font-size: 13px; color: var(--ds-caption); }

/* Today: source-backed CRM work and a separately qualified LedgerEye read. */
.ds-today [hidden] { display: none !important; }
.ds-today-heartbeat { display: flex; align-items: center; gap: 14px; margin-bottom: 20px;
  padding: 14px 20px; border-radius: 15px; background: #fffdf7; color: var(--ds-body); }
.ds-today-heartbeat > span { flex: none; padding: 5px 10px; border-radius: 999px;
  background: var(--ds-amber-bg); color: var(--ds-amber-fg-strong); font-size: 12px; font-weight: 600; }
.ds-today-heartbeat p { margin: 0; font-size: 13px; }
.ds-today-grid { display: flex; flex-wrap: wrap; align-items: stretch; gap: 20px; }
.ds-today-tile { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column;
  background: var(--ds-card); border-radius: 15px; box-shadow: var(--ds-shadow-card); overflow: hidden;
  border-top: 4px solid var(--ds-accent); }
.ds-today-tile--post { --ds-tile-accent: var(--ds-post-accent); --ds-tile-ink: var(--ds-post-ink);
  --ds-tile-tint: var(--ds-post-tint); border-top-color: var(--ds-tile-accent); }
.ds-today-tile--pre { --ds-tile-accent: var(--ds-accent); --ds-tile-ink: var(--ds-brand);
  --ds-tile-tint: var(--ds-accent-tint); }
.ds-today-tile__head { padding: 18px 20px 20px; background: var(--ds-tile-tint); }
.ds-today-tile__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ds-today-tile__kicker { margin: 0; color: var(--ds-tile-accent); font: 600 11px/1.3 var(--ds-font);
  text-transform: uppercase; letter-spacing: .08em; }
.ds-today-tile__action-count { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  border: 0; border-radius: 999px; padding: 4px 10px 4px 4px; background: var(--ds-tile-accent);
  color: var(--ds-white); text-decoration: none; font: 500 12px/1 var(--ds-font); cursor: pointer; }
.ds-today-tile__action-count:hover { color: var(--ds-white); text-decoration: underline; }
.ds-today-tile__action-count span { display: inline-grid; place-items: center; min-width: 22px; width: auto;
  height: 22px; padding: 0 5px; box-sizing: border-box;
  border-radius: 50%; background: var(--ds-white); color: var(--ds-tile-accent); font-weight: 600; }
.ds-today-directory { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 10px 0 16px; padding: 12px; border: 1px solid var(--ds-rule); border-radius: 12px; }
.ds-today-directory[hidden] { display: none; }
.ds-today-directory > div { display: flex; flex-direction: column; min-width: 0; }
.ds-today-directory strong { color: var(--ds-ink); font-size: 13px; font-weight: 600; }
.ds-today-directory span { color: var(--ds-caption); font-size: 12px; }
.ds-today-tile__figure { margin: 18px 0 5px; color: var(--ds-tile-ink); font: 500 28px/1.15 var(--ds-font);
  font-variant-numeric: tabular-nums; }
.ds-today-tile__caption { margin: 0; color: var(--ds-caption); font: 400 13px/1.4 var(--ds-font); }
.ds-today-tile__body { padding: 8px 20px 18px; flex: 1; }
.ds-today-stage { padding: 11px 0; border-bottom: 1px solid var(--ds-rule-soft); }
.ds-today-stage__line { display: flex; align-items: baseline; gap: 8px; }
.ds-today-stage__name { color: var(--ds-body); font-size: 14px; }
.ds-today-stage__value { margin-left: auto; color: var(--ds-caption); font-size: 12px; text-align: right; }
.ds-today-stage__count { min-width: 2ch; color: var(--ds-ink); font-weight: 500; font-size: 14px;
  text-align: right; font-variant-numeric: tabular-nums; }
.ds-today-stage__track { height: 5px; margin-top: 8px; border-radius: 5px; background: var(--ds-stage-track); overflow: hidden; }
.ds-today-stage__track span { display: block; height: 100%; background: var(--ds-accent);
  transition: width .6s ease; }
.ds-today-actions { margin-top: 20px; border-radius: 12px; scroll-margin-top: 20px; }
.ds-today-actions--highlight { box-shadow: 0 0 0 2px var(--ds-pre-ring); }
.ds-today-actions__heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.ds-today-actions__heading h3 { margin: 0; color: var(--ds-ink); font: 600 14px/1.3 var(--ds-font); }
.ds-today-actions__heading span { color: var(--ds-accent); font-size: 12px; }
.ds-today-action { display: grid; grid-template-columns: 34px minmax(0,1fr) auto; align-items: center;
  gap: 8px 12px; padding: 12px; border-radius: 12px; }
.ds-today-action:hover { background: var(--ds-accent-tint); }
.ds-today-action__icon { display: grid; place-items: center; width: 34px; height: 34px;
  border-radius: 10px; background: var(--ds-accent-tint); color: var(--ds-brand); }
.ds-today-action__copy { display: flex; flex-direction: column; min-width: 0; }
.ds-today-action__copy strong { color: var(--ds-ink); font-weight: 500; }
.ds-today-action__copy span { color: var(--ds-caption); font-size: 12px; }
.ds-today-tile__footer { margin-top: auto; padding: 14px 20px 18px; color: var(--ds-tile-accent);
  text-decoration: none; font-size: 13px; font-weight: 500; }
.ds-today-tile__footer:hover { color: var(--ds-tile-accent); text-decoration: underline; }
.ds-today-tile__body--unavailable { display: grid; align-items: center; }
.ds-today-unavailable { display: flex; gap: 14px; align-items: flex-start; color: var(--ds-caption); }
.ds-today-unavailable > .bi { color: var(--ds-tile-accent); font-size: 22px; }
.ds-today-unavailable h3 { margin: 0 0 5px; color: var(--ds-tile-ink); font: 500 15px/1.3 var(--ds-font); }
.ds-today-unavailable p { margin: 0; font-size: 13px; line-height: 1.5; }
.ds-today-statuses { margin-top: 5px; }
.ds-today-excluded { margin: 12px 0; padding: 12px 14px; border-radius: 10px;
  background: var(--ds-amber-bg); color: var(--ds-body); }
.ds-today-excluded summary { cursor: pointer; color: var(--ds-ink); font: 600 13px/1.3 var(--ds-font); }
.ds-today-excluded summary:focus-visible { outline: 2px solid var(--ds-post-accent); outline-offset: 3px; }
.ds-today-excluded__hint { float: right; color: var(--ds-post-ink); font-size: 12px; font-weight: 500; }
.ds-today-excluded[open] .ds-today-excluded__hint { display: none; }
.ds-today-excluded ul { margin: 10px 0 0; padding-left: 18px; font-size: 12px; }
.ds-today-excluded li { margin-top: 4px; overflow-wrap: anywhere; }
/* Today tiles v2 (ship 25): section subtitles, and the one closed notes drop-down at the bottom of each tile. */
.ds-today-subtitle { margin: 16px 0 2px; color: var(--ds-ink); font: 600 13px/1.3 var(--ds-font); letter-spacing: .02em; }
.ds-today-subtitle:first-child { margin-top: 0; }
.ds-today-devnotes { margin: 18px 0 4px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--ds-rule-soft); }
.ds-today-devnotes > summary { cursor: pointer; color: var(--ds-ink); font: 600 13px/1.3 var(--ds-font); }
.ds-today-devnotes > summary:focus-visible { outline: 2px solid var(--ds-post-accent); outline-offset: 3px; }
.ds-today-devnotes__section { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--ds-rule-soft); }
.ds-today-devnotes__section h4 { margin: 0 0 6px; color: var(--ds-ink); font: 600 12px/1.3 var(--ds-font); }
.ds-today-devnotes__section .ds-today-tile__caption + .ds-today-tile__caption { margin-top: 6px; }
.ds-today-excluded a { color: var(--ds-post-ink); text-decoration: underline; }
.ds-today-status-title { margin: 0 0 12px; color: var(--ds-ink); font: 600 14px/1.3 var(--ds-font); }
.ds-today-status-bar { display: flex; gap: 3px; height: 8px; margin-bottom: 12px; border-radius: 4px;
  overflow: hidden; }
.ds-today-status-bar span { display: block; flex-basis: 0; min-width: 0; }
.ds-today-status-bar__on_schedule, .ds-today-status-row__swatch--on_schedule { background: #0f6b73; }
.ds-today-status-bar__in_arrears, .ds-today-status-row__swatch--in_arrears { background: #d9695f; }
.ds-today-status-bar__paused, .ds-today-status-row__swatch--paused { background: #e0a93b; }
.ds-today-status-bar__statement_unreadable,
.ds-today-status-row__swatch--statement_unreadable { background: #a9b3b5; }
.ds-today-status-bar__settled, .ds-today-status-row__swatch--settled { background: #bfe0de; }
.ds-today-status-row { display: flex; align-items: center; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid var(--ds-rule-soft); font-size: 13px; }
.ds-today-status-row__swatch { width: 10px; height: 10px; border-radius: 3px; }
.ds-today-status-row strong { margin-left: auto; font-variant-numeric: tabular-nums; }
.ds-today-status-note { margin: 11px 0 0; color: var(--ds-caption); font-size: 12px; }
.ds-today-action__which { margin-top: 4px; font-size: 12px; }
.ds-today-action__which summary { cursor: pointer; color: var(--ds-caption); }
.ds-today-action__which ul { margin: 4px 0 0; padding-left: 18px; }
.ds-today-lease-note { margin: 12px 0 0; color: var(--ds-amber-fg-strong); font-size: 12px; }
/* Read-only notice and provisional labels (LedgerEye feed.cash_reads; absent = none of these exist). */
.ds-today-reads-notice { margin: 10px 0 14px; padding: 10px 12px; border-left: 4px solid var(--ds-amber-border);
  border-radius: 8px; background: var(--ds-amber-bg); color: var(--ds-amber-fg-strong);
  font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.ds-today-tile__flag { display: inline-block; margin-left: 4px; padding: 2px 9px; border-radius: 999px;
  background: var(--ds-amber-bg); color: var(--ds-amber-fg-strong); font: 600 12px/1.4 var(--ds-font);
  vertical-align: middle; }
.ds-today-provisional { margin: 8px 0 0; color: var(--ds-amber-fg-strong); font-size: 12px; line-height: 1.5;
  overflow-wrap: anywhere; }
.ds-today-provisional p { margin: 0 0 3px; }
.ds-today-tile--post .ds-today-action:hover,
.ds-today-tile--post .ds-today-action__icon { background: var(--ds-post-tint); }
.ds-today-tile--post .ds-today-action__icon { color: var(--ds-post-ink); }
.ds-today-tile--post .ds-today-actions--highlight { box-shadow: 0 0 0 2px rgba(15,107,115,.45); }
.ds-today-tile--post .ds-today-actions__heading span { color: var(--ds-post-accent); }

/* Pipeline: five honest CRM stage columns. The horizontal region keeps card controls usable
   at narrow widths, while each card has its own keyboard link and stage form. */
.ds-pipeline-error { margin: 0; padding: 12px 20px; color: var(--ds-red-fg); }
.ds-pipeline-board { display: flex; gap: 16px; overflow-x: auto; padding: 20px;
  scroll-snap-type: x proximity; }
.ds-pipeline-column { flex: 1 0 250px; min-width: 250px; max-width: 420px; scroll-snap-align: start;
  background: var(--ds-page); border-radius: 12px; padding: 14px; }
.ds-pipeline-column__head { display: flex; justify-content: space-between; align-items: center;
  gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--ds-rule); }
.ds-pipeline-column__head h3 { margin: 0; color: var(--ds-ink); font: 600 14px/1.3 var(--ds-font); }
.ds-pipeline-column__cards { display: flex; flex-direction: column; gap: 12px; padding-top: 12px; }
.ds-pipeline-deal { background: var(--ds-white); border: 1px solid var(--ds-rule); border-radius: 12px;
  padding: 14px; box-shadow: var(--ds-shadow-card); }
.ds-pipeline-deal__name { color: var(--ds-ink); font-weight: 600; text-decoration: none; }
/* p13: a whole card takes keyboard focus when DEALSHACK_PIPELINE_KEYBOARD_SOURCE is on (tabindex only then) */
.ds-pipeline-deal[data-open-href]:focus-visible { outline: 2px solid var(--ds-accent); outline-offset: 2px; }
.ds-pipeline-deal__name:hover { color: var(--ds-accent); text-decoration: underline; }
.ds-pipeline-deal__amount { display: block; margin-top: 5px; color: var(--ds-caption); font-size: 12px; }
.ds-pipeline-deal__facts { display: grid; gap: 5px; margin: 12px 0; font-size: 12px; }
.ds-pipeline-deal__facts div { display: flex; justify-content: space-between; gap: 8px; }
.ds-pipeline-deal__facts dt { color: var(--ds-caption); font-weight: 400; }
.ds-pipeline-deal__facts dd { margin: 0; color: var(--ds-body); text-align: right; overflow-wrap: anywhere; }
.ds-pipeline-deal__move { display: flex; flex-wrap: wrap; align-items: center; gap: 7px;
  padding-top: 12px; border-top: 1px solid var(--ds-rule-soft); }
.ds-pipeline-deal__move label { color: var(--ds-caption); font-size: 12px; }
.ds-pipeline-deal__move select { flex: 1 1 125px; min-width: 0; }
.ds-pipeline-empty { margin: 0; color: var(--ds-caption); font-size: 12px; }
.ds-pipeline-note { margin: 0; padding: 0 20px 20px; color: var(--ds-caption); font-size: 12px; }

/* The queue keeps its five columns readable at narrow widths and 200% zoom. */
.ds-uw-table { min-width: 760px; }
.ds-uw-progress-label { display: block; font-size: 12px; color: var(--ds-body); }
.ds-uw-progress-track { display: block; width: 130px; height: 8px; margin-top: 5px;
  border-radius: 6px; background: var(--ds-stage-track); overflow: hidden; }
.ds-uw-progress-track span { display: block; height: 100%; border-radius: inherit;
  background: var(--ds-accent); }
.ds-broker-table { min-width: 680px; }
.ds-audit-table { min-width: 760px; }
.ds-notices-form { display: inline; }
.ds-bank-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 12px; }
.ds-bank-grid > div { display: flex; flex-direction: column; gap: 5px; padding: 14px;
  border: 1px solid var(--ds-rule); border-radius: 12px; }
.ds-bank-grid span { color: var(--ds-caption); font-size: 12px; }
.ds-bank-grid strong { color: var(--ds-ink); font-size: 18px; font-weight: 500;
  font-variant-numeric: tabular-nums; }
@media (max-width: 520px) {
  .ds-today-stage__line { flex-wrap: wrap; }
  .ds-today-stage__value { margin-left: 0; flex: 1 1 100%; text-align: left; order: 3; }
  .ds-today-stage__count { margin-left: auto; }
  .ds-today-action { grid-template-columns: 34px minmax(0,1fr); }
  .ds-today-action .ds-btn { grid-column: 2; justify-self: start; }
}

/* Avatar menu */
.ds-avatar { position: relative; }
.ds-avatar-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px;
  height: 38px; border-radius: 50%; background: var(--ds-accent-tint); color: var(--ds-brand);
  border: 0; cursor: pointer; font-weight: 600; font-size: 13px; letter-spacing: .02em; }
.ds-avatar-btn:hover { background: var(--ds-rule-soft); }
/* v4 top bar: initials circle, then the handle and role, then a chevron (the handoff's person block). */
.ds-avatar-btn--id { width: auto; height: auto; gap: 10px; padding: 3px 6px 3px 3px; border-radius: 999px;
  background: none; text-align: left; }
.ds-avatar-btn--id:hover { background: var(--ds-accent-tint); }
.ds-avatar-initials { display: inline-flex; align-items: center; justify-content: center; width: 38px;
  height: 38px; flex: none; border-radius: 50%; background: var(--ds-accent-tint); color: var(--ds-brand);
  font-weight: 600; font-size: 13px; }
.ds-avatar-id { display: flex; flex-direction: column; line-height: 1.25; }
.ds-avatar-handle { color: var(--ds-ink); font-weight: 600; font-size: 13px; letter-spacing: 0;
  max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-avatar-role { color: var(--ds-caption); font-weight: 400; font-size: 12px; letter-spacing: 0; }
.ds-avatar-chevron { color: var(--ds-caption); font-size: 12px; }
.ds-avatar-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 240px;
  background: var(--ds-card); border: 1px solid var(--ds-rule); border-radius: 12px;
  box-shadow: var(--ds-shadow-card); padding: 12px; display: none; z-index: 50; }
.ds-avatar-menu.open { display: block; }
.ds-avatar-who { padding: 4px 6px 10px; border-bottom: 1px solid var(--ds-rule-soft); margin-bottom: 8px; }
.ds-avatar-who .ds-who-name { font-weight: 500; color: var(--ds-ink); }
.ds-avatar-who .ds-who-line { font-size: 12px; color: var(--ds-caption); }
.ds-avatar-menu a, .ds-avatar-menu button.ds-linkish { display: block; width: 100%; text-align: left;
  padding: 8px 6px; border-radius: 8px; color: var(--ds-body); text-decoration: none; background: none;
  border: 0; font: inherit; cursor: pointer; }
.ds-avatar-menu a:hover, .ds-avatar-menu button.ds-linkish:hover { background: var(--ds-accent-tint);
  color: var(--ds-brand); }

/* Shared LedgerEye data-integrity drawer. Unknown stays visually distinct from
   a source-confirmed zero; the bell is never painted clear after a failed read. */
.ds-issues-bell { position: relative; display: inline-flex; align-items: center;
  justify-content: center; min-width: 44px; min-height: 44px; padding: 6px;
  border: 1px solid var(--ds-rule); border-radius: 10px; background: var(--ds-card);
  color: var(--ds-body); cursor: pointer; font-size: 17px; }
.ds-issues-bell:hover { background: var(--ds-accent-tint); }
.ds-issues-bell--open { color: var(--ds-red-fg); border-color: var(--ds-danger-border); }
.ds-issues-bell--clear { color: var(--ds-caption); }
.ds-issues-bell--unknown { color: var(--ds-amber-fg-strong); }
.ds-issues-bell__count { position: absolute; top: -7px; right: -7px;
  min-width: 20px; height: 20px; padding: 2px 4px; border-radius: 999px;
  color: #fff; background: var(--ds-red-fg); text-align: center;
  font: 600 11px/16px var(--ds-font); font-variant-numeric: tabular-nums; }
/* "Questions for you" (register row 002361): a red pill that pulses while questions wait for the
   signed-in person; solid red, never animated, for a reader who asks for reduced motion. */
.ds-questions-pill { display: inline-flex; align-items: center; min-height: 36px; padding: 6px 14px;
  border-radius: 999px; background: var(--ds-red-fg); color: #fff; font: 600 13px var(--ds-font);
  text-decoration: none; white-space: nowrap; box-shadow: 0 0 0 0 rgba(179, 38, 30, .55);
  animation: ds-questions-pulse 1.6s ease-in-out infinite; }
.ds-questions-pill:hover, .ds-questions-pill:focus { background: #8f1d17; color: #fff; }
.ds-questions-pill[hidden] { display: none !important; }
@keyframes ds-questions-pulse {
  0% { box-shadow: 0 0 0 0 rgba(179, 38, 30, .55); }
  70% { box-shadow: 0 0 0 10px rgba(179, 38, 30, 0); }
  100% { box-shadow: 0 0 0 0 rgba(179, 38, 30, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .ds-questions-pill { animation: none; box-shadow: none; }
}

/* ── Contracts page (week of 26 Oct, piece A1): templates/deals/contracts_list.html, a read-only list for both staff
   roles. Under .ds-v4 alone. This block sits here, beside the Questions pill's pulse, and NOT at the end of the file:
   several tests read everything after their marker (Stage B, Stage C, Feature 1d, the tap targets) as plain
   .ds-v4 rules and refuse keyframes and widths there. It reuses the card, table, pill and tone classes above, so only the few new parts are
   here. .ds-pulse-amber mirrors LedgerEye's .lb-pulse-amber (a small amber dot that pulses for something a person
   must act on first); it is a still dot for a reader who asks for reduced motion. ── */
.ds-v4 .ds-pulse { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 50%;
  vertical-align: middle; }
.ds-v4 .ds-pulse-amber { background: #d98a1f; box-shadow: 0 0 0 0 rgba(217, 138, 31, .55);
  animation: ds-pulse-amber 1.6s ease-in-out infinite; }
@keyframes ds-pulse-amber {
  0% { box-shadow: 0 0 0 0 rgba(217, 138, 31, .55); }
  70% { box-shadow: 0 0 0 10px rgba(217, 138, 31, 0); }
  100% { box-shadow: 0 0 0 0 rgba(217, 138, 31, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .ds-v4 .ds-pulse-amber { animation: none; box-shadow: none; }
}
.ds-v4 .ds-contracts__counts p { margin: 0 0 8px; }
.ds-v4 .ds-contracts__countline { color: var(--ds-body); font: 400 14px/1.7 var(--ds-font); }
.ds-v4 .ds-contracts__count strong { font-variant-numeric: tabular-nums; }
.ds-v4 .ds-contracts__table td .ds-text-caption { display: inline-block; margin-top: 3px; font: 400 12px/1.5 var(--ds-font); }
.ds-v4 .ds-contracts__more { margin: 0; padding: 12px 20px 16px; color: var(--ds-caption); font: 400 12px/1.5 var(--ds-font); }
.ds-v4 .ds-contracts__empty { margin: 0; padding: 16px 20px 20px; color: var(--ds-muted); font: 400 14px/1.5 var(--ds-font); }
.ds-v4 .ds-contracts__notes p { margin: 0 0 8px; color: var(--ds-body); font: 400 14px/1.5 var(--ds-font); }

.ds-issues-backdrop[hidden], .ds-issues-drawer[hidden],
.ds-issues-memo[hidden], .ds-issues-memo__error[hidden],
.ds-issues-status[hidden], .ds-issues-bell__count[hidden] { display: none !important; }
.ds-issues-backdrop { position: fixed; inset: 0; z-index: 100;
  background: rgba(20, 24, 39, .46); }
.ds-issues-drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 101;
  width: min(480px, 100vw); display: flex; flex-direction: column;
  background: var(--ds-card); box-shadow: -8px 0 28px rgba(20, 24, 39, .16);
  color: var(--ds-body); }
.ds-issues-drawer__head { display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; padding: 20px; border-bottom: 1px solid var(--ds-rule); }
.ds-issues-drawer__head h2 { margin: 0; font: 600 18px/1.3 var(--ds-font); }
.ds-issues-drawer__head p { margin: 5px 0 0; color: var(--ds-caption); font-size: 12px; }
.ds-issues-close { min-width: 44px; min-height: 44px; border: 0; border-radius: 8px;
  background: var(--ds-accent-tint); color: var(--ds-brand); cursor: pointer; }
.ds-issues-status { margin: 0; padding: 16px 20px; color: var(--ds-caption); font-size: 13px; }
/* Read-only notice in the drawer (LedgerEye feed.cash_reads on /api/issues; absent = not rendered). */
.ds-issues-reads-notice { margin: 0 20px 8px; padding: 10px 12px; border-left: 4px solid var(--ds-amber-border);
  border-radius: 8px; background: var(--ds-amber-bg); color: var(--ds-amber-fg-strong);
  font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.ds-issues-list { flex: 1; min-height: 0; overflow-y: auto; margin: 0; padding: 0 20px;
  list-style: none; }
.ds-issues-item { padding: 14px 0; border-bottom: 1px solid var(--ds-rule-soft); }
.ds-issues-item strong { display: block; font: 600 14px/1.4 var(--ds-font); }
.ds-issues-item__meta { display: block; margin-top: 3px; color: var(--ds-caption);
  font-size: 11px; text-transform: capitalize; }
.ds-issues-item--critical strong { color: var(--ds-red-fg); }
.ds-issues-item--warning strong { color: var(--ds-amber-fg-strong); }
.ds-issues-item p { margin: 7px 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; }
.ds-issues-reconciled { display: inline-block; padding: 5px 9px; border-radius: 999px;
  background: var(--ds-green-bg); color: var(--ds-green-fg); font-size: 11px; font-weight: 600; }
.ds-issues-memo-quote { margin: 8px 0 0; padding: 8px 11px; border-left: 3px solid var(--ds-green-fg);
  background: var(--ds-green-bg); color: var(--ds-body); white-space: pre-wrap; overflow-wrap: anywhere;
  font-size: 12px; }
.ds-issues-item a, .ds-issues-dismiss { display: inline-flex; align-items: center;
  min-height: 44px; margin-right: 8px; color: var(--ds-accent); font-size: 12px; }
.ds-issues-dismiss { border: 0; background: none; cursor: pointer; padding: 0; }
.ds-issues-memo { flex: none; padding: 18px 20px; border-top: 1px solid var(--ds-rule);
  background: var(--ds-amber-bg); }
.ds-issues-memo h3 { margin: 0 0 6px; font: 600 15px/1.3 var(--ds-font); }
.ds-issues-memo p { margin: 0 0 8px; font-size: 12px; }
.ds-issues-memo label { display: block; margin-bottom: 6px; font-size: 12px; }
.ds-issues-memo textarea { display: block; width: 100%; padding: 9px; border: 1px solid var(--ds-rule);
  border-radius: 8px; font: 400 13px/1.4 var(--ds-font); }
.ds-issues-memo__error { color: var(--ds-red-fg); margin-top: 8px !important; }
.ds-issues-memo__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ds-issues-drawer__foot { padding: 14px 20px; border-top: 1px solid var(--ds-rule); }
.ds-issues-drawer__foot a { color: var(--ds-accent); font-size: 13px; }

/* Back link */
.ds-back { display: inline-flex; align-items: center; gap: 6px; color: var(--ds-accent);
  text-decoration: none; font-weight: 500; font-size: 13px; margin-bottom: 12px; }
.ds-back:hover { text-decoration: underline; }

/* Focus ring on every control (spec 10.5) */
.ds-app a:focus-visible, .ds-app button:focus-visible, .ds-app input:focus-visible,
.ds-app select:focus-visible, .ds-app textarea:focus-visible {
  outline: 2px solid var(--ds-focus); outline-offset: 2px; }

/* Below 760px: the sidebar becomes a slide-in menu (README responsive). Closed, it is off-screen
   AND hidden, so its links are not in the tab order (visibility:hidden removes them); a backdrop
   covers the page when it is open and closes it on tap; a close button sits inside the panel. */
@media (max-width: 760px) {
  .ds-topbar { flex-wrap: wrap; }
  .ds-topbar-heading { min-width: 0; max-width: 100%; }
  .ds-topbar-title { min-width: 0; overflow-wrap: anywhere; }
  /* The right group may wrap onto a second line (never past the screen edge) so the red
     Questions pill, the bell and the avatar all stay reachable at 360-375px. */
  .ds-topbar-right { margin-left: auto; max-width: 100%; flex-wrap: wrap;
    justify-content: flex-end; row-gap: 8px; }
  .ds-menu-btn { flex-shrink: 0; }
  .ds-app { grid-template-columns: minmax(0, 1fr); }
  .ds-sidebar { position: fixed; left: 0; top: 0; z-index: 60; width: 260px;
    transform: translateX(-100%); visibility: hidden; transition: transform .2s ease, visibility .2s ease; }
  .ds-app.ds-nav-open .ds-sidebar { transform: translateX(0); visibility: visible; }
  .ds-app.ds-nav-open .ds-backdrop { display: block; position: fixed; inset: 0; z-index: 55;
    background: var(--ds-backdrop); }
  .ds-menu-btn, .ds-nav-close { display: inline-block; }
  .ds-nav-link, .ds-nav-close, .ds-avatar-btn, .ds-menu-btn { min-height: 44px; min-width: 44px; }  /* tap targets */
  .ds-app--plain .ds-topbar .ds-logo svg { width: 24px; height: 24px; }   /* smaller mark on a phone */
  .ds-avatar-id, .ds-avatar-chevron { display: none; }   /* phone: the initials circle alone */
  .ds-avatar-btn--id { padding: 3px; }
}
/* Under 520px the LedgerEye freshness text ("LedgerEye data unavailable" while the cash hold is
   on) is hidden and the gaps tighten, so pill + bell + avatar (260px with a two-digit count)
   fit even a 320px screen on one line. */
@media (max-width: 520px) {
  .ds-topbar-right { gap: 8px; }
  .ds-freshness { display: none; }
}

/* ─────────────────────────────────────────────────────────────────────────
   Content components (v4 Cuba, from the round-3 handoff README + PORTAL-SPEC
   §2/§3). The frame above styles only the shell; these style the page CONTENT
   - cards, tables, status pills, buttons, filters and notes - so a screen
   matches the prototype without inline styles. Shared by the People and access,
   Audit and Intake screens (screens stream D1); reusable by every later screen.
   Every colour is a token or a spec status tone; nothing here is Bootstrap.
   ───────────────────────────────────────────────────────────────────────── */

/* Status tones (PORTAL-SPEC §2, all AA at 12px). Used by pills and notes. Tokens only. */
.ds-tone-red    { background: var(--ds-red-bg);    color: var(--ds-red-fg); }
.ds-tone-amber  { background: var(--ds-amber-bg);  color: var(--ds-amber-fg); }
.ds-tone-blue   { background: var(--ds-blue-bg);   color: var(--ds-blue-fg); }
.ds-tone-green  { background: var(--ds-green-bg);  color: var(--ds-green-fg); }
.ds-tone-grey   { background: var(--ds-grey-bg);   color: var(--ds-grey-fg); }
.ds-tone-purple { background: var(--ds-purple-bg); color: var(--ds-purple-fg); }

/* Text-colour utilities, so no template carries an inline colour. */
.ds-text-caption { color: var(--ds-caption); }
.ds-text-muted   { color: var(--ds-muted); }
.ds-text-warn    { color: var(--ds-amber-fg); }
.ds-text-error   { color: var(--ds-red-fg); }
.ds-text-body    { color: var(--ds-body); }

/* A vertical stack of cards, 20px apart (the page's default rhythm). */
.ds-stack { display: flex; flex-direction: column; gap: 20px; }
.ds-email-body { overflow-wrap: anywhere; }
.ds-email-body p { margin: 0 0 10px; }
.ds-email-thread + .ds-email-thread { border-top: 1px solid var(--ds-rule); padding-top: 18px; }
.ds-email-thread h3 { margin: 0 0 6px; font: 600 15px/1.4 var(--ds-font); }

/* Card: white, 15px radius, the card shadow. Header carries the title + optional
   right-hand action; the 1px rule under it is var(--ds-rule) (spec §2). */
.ds-card { background: var(--ds-card); border-radius: 15px; box-shadow: var(--ds-shadow-card); }
.ds-card__head { padding: 20px; border-bottom: 1px solid var(--ds-rule);
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 16px; }
.ds-card__headings { flex: 1 1 260px; min-width: 0; }
.ds-card__title { margin: 0; font: 600 18px/1.3 var(--ds-font); color: var(--ds-body); }
.ds-card__sub { display: block; margin-top: 4px; font: 400 12px/1.5 var(--ds-font); color: var(--ds-caption); }
.ds-card__body { padding: 20px; }
/* People and Audit are adjacent admin destinations. Keep their real route actions
   visible when the card header wraps on a narrow screen. */
.ds-people__tools, .ds-audit__tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ds-people__tools .ds-btn, .ds-audit__tools .ds-btn { min-height: 44px; }
.ds-people__waiting { border-bottom: 1px solid var(--ds-rule-soft); }
.ds-people__waiting .ds-card__head { background: var(--ds-amber-bg); }
.ds-audit__tools .ds-btn { white-space: nowrap; }
@media (max-width: 640px) {
  .ds-people__tools, .ds-audit__tools { width: 100%; }
  .ds-people__tools .ds-btn, .ds-audit__tools .ds-btn { flex: 1 1 auto; }
}

/* Section label (spec §2 progress/label style). */
.ds-section-label { font: 600 11px/1 var(--ds-font); text-transform: uppercase;
  letter-spacing: .08em; color: var(--ds-caption); }

/* Tables: ≤5 columns, header row var(--ds-th-bg), 1px var(--ds-rule-soft) row rules, tabular numbers
   right-aligned. The wrap scrolls sideways inside the card at narrow widths
   (spec §10.5) rather than squeezing; give the table a min-width for that. */
.ds-table-wrap { overflow-x: auto; }
.ds-table { width: 100%; border-collapse: collapse; font: 400 14px/1.4 var(--ds-font); color: var(--ds-body); }
.ds-table thead th { background: var(--ds-th-bg); border-bottom: 1px solid var(--ds-rule-soft);
  padding: 12px; text-align: left; font: 500 13px/1.4 var(--ds-font); color: var(--ds-body); white-space: nowrap; }
.ds-table tbody td { padding: 13px 12px; border-bottom: 1px solid var(--ds-rule-soft); vertical-align: middle; }
.ds-table thead th:first-child, .ds-table tbody td:first-child { padding-left: 20px; }
.ds-table thead th:last-child,  .ds-table tbody td:last-child  { padding-right: 20px; }
.ds-table .ds-num { text-align: right; font-variant-numeric: tabular-nums; }
.ds-table tbody tr:hover { background: var(--ds-row-hover); }
/* A clickable row whose OWN link (the subject) is the target: the row is a mouse convenience only,
   never a button wrapping links, so keyboard focus lands on the real links inside it (D1.5 item 3).
   Those links show the design's purple focus ring through the frame's a:focus-visible rule. */
.ds-row-link { cursor: pointer; }
.ds-rowlink { color: inherit; text-decoration: none; }
.ds-rowlink:hover { color: var(--ds-accent); text-decoration: underline; }
.ds-cell-strong { font-weight: 500; color: var(--ds-ink); }
/* Small caption text INSIDE a cell (a sub-line). It is NOT display:block, so a <td> that carries
   this class stays a table cell; use .ds-subline for a caption that must sit on its own line. */
.ds-cell-sub { font: 400 12px/1.5 var(--ds-font); color: var(--ds-caption); overflow-wrap: anywhere; }
.ds-subline  { display: block; font: 400 12px/1.5 var(--ds-font); color: var(--ds-caption); overflow-wrap: anywhere; }
.ds-cell-muted { color: var(--ds-muted); }

/* Status pill (Roboto 500 12px) and the smaller count badge. Pair with a tone. */
.ds-pill { display: inline-block; padding: 6px 11px; border-radius: 8px;
  font: 500 12px/1.3 'Roboto', sans-serif; }
.ds-badge { display: inline-block; padding: 2px 7px; border-radius: 6px;
  font: 500 11px/1.3 'Roboto', sans-serif; }
.ds-count { display: inline-block; padding: 4px 9px; border-radius: 6px;
  font: 500 12px/1.2 'Roboto', sans-serif; }

/* Buttons (spec §2: 8px radius, 500 13px). Primary is the brand; soft is the
   purple tint; ghost is a hairline; danger is the decline outline; link is bare. */
.ds-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border: 0; border-radius: 8px; font: 500 13px/1.2 var(--ds-font);
  cursor: pointer; text-decoration: none; }
.ds-btn--primary { background: var(--ds-brand); color: var(--ds-white); }
.ds-btn--primary:hover { background: var(--ds-brand-hover); color: var(--ds-white); }
.ds-btn--soft { background: var(--ds-soft-bg); color: var(--ds-purple-fg); }
.ds-btn--soft:hover { background: var(--ds-soft-bg-hover); color: var(--ds-purple-fg); }
.ds-btn--ghost { background: var(--ds-white); border: 1px solid var(--ds-rule); color: var(--ds-body); }
.ds-btn--ghost:hover { background: var(--ds-accent-tint); color: var(--ds-brand); }
.ds-btn--danger { background: var(--ds-white); border: 1px solid var(--ds-danger-border); color: var(--ds-red-fg); }
/* The amber "Cancel change" button on a waiting note. */
.ds-btn--warn { background: var(--ds-white); border: 1px solid var(--ds-amber-border); color: var(--ds-amber-fg-strong); }
.ds-btn--sm { padding: 7px 12px; font-size: 12px; }
.ds-btn--link { padding: 0; border: 0; background: none; color: var(--ds-accent);
  font: 500 12px/1.2 var(--ds-font); cursor: pointer; }
.ds-btn--link:hover { text-decoration: underline; }

/* Form controls in the content (inputs, selects, labelled fields). */
.ds-field { display: flex; flex-direction: column; gap: 6px; }
.ds-field > span, .ds-label { font: 500 13px/1.3 var(--ds-font); color: var(--ds-body); }
.ds-input, .ds-select { height: 40px; padding: 0 12px; border: 1px solid var(--ds-field-border);
  border-radius: 8px; font: 400 14px/1 var(--ds-font); color: var(--ds-ink); background: var(--ds-white); }
.ds-select { padding: 0 10px; }
.ds-input--multiline { height: auto; min-height: 80px; padding: 10px 12px; }
.ds-input--sm, .ds-select--sm { height: 38px; }
/* A compact labelled control inside a table cell: a small caption label above the field. */
.ds-inline-field { display: inline-flex; flex-direction: column; gap: 3px; text-align: left; }
/* An inline checkbox with its own visible text label. */
.ds-check-inline { display: inline-flex; align-items: center; gap: 5px; color: var(--ds-body);
  font: 400 12px/1.5 var(--ds-font); }

/* Filter bar under a card head, and an inline toolbar of controls. */
.ds-filters { padding: 14px 20px; border-bottom: 1px solid var(--ds-rule-soft);
  display: flex; flex-wrap: wrap; gap: 10px; }
.ds-filters--wide { align-items: center; }
.ds-inline-form { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ds-cell-actions { display: inline-flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; }

/* A connection / freshness strip (e.g. the Intake mailbox line). */
.ds-strip { padding: 14px 20px; border-bottom: 1px solid var(--ds-rule-soft);
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
  font: 400 13px/1.4 var(--ds-font); color: var(--ds-muted); }
.ds-intake-check-note { display: inline-flex; align-items: center; gap: 5px;
  color: var(--ds-caption); font-size: 12px; }
.ds-intake-mailbox-table { min-width: 860px; }
/* The pager strip under a table: a top rule, no bottom rule, ends apart. */
.ds-strip--footer { border-bottom: 0; border-top: 1px solid var(--ds-rule-soft); justify-content: space-between; }
/* A jump link to another section on the page (e.g. "N held emails — review them"). */
.ds-jumplink { color: var(--ds-accent); text-decoration: none; font-weight: 500; }
.ds-jumplink:hover { text-decoration: underline; }

/* A tinted panel band inside a card (e.g. the invite-staff panel). */
.ds-panel-tint { padding: 16px 20px; background: var(--ds-accent-tint); border-bottom: 1px solid var(--ds-rule); }

/* A card whose top edge carries an accent (the held-intake "needs you" card). */
.ds-card--accent-amber { border-top: 4px solid var(--ds-amber-fg); }

/* A tinted note / callout row (held intake, a waiting change). Pair with a tone. */
.ds-note { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px 16px;
  padding: 14px 16px; border-radius: 12px; }
.ds-note__body { flex: 1 1 300px; min-width: 0; }
.ds-note__title { font: 500 14px/1.4 var(--ds-font); }
.ds-note__meta { font: 400 12px/1.5 var(--ds-font); text-wrap: pretty; }

/* Empty state inside a card. */
.ds-empty { padding: 24px 20px; font: 400 13px/1.5 var(--ds-font); color: var(--ds-caption); }

/* An intro line above a screen's cards, and a tail spacer for a card with no
   footer (matches the prototype's 12px card tail). */
.ds-intro { font: 400 13px/1.6 var(--ds-font); color: var(--ds-caption); margin: 0; }
.ds-card__tail { height: 12px; }

/* Deal record: source-backed sections stay in one card; the funded handoff keeps
   the same-origin company route visible without opening another user interface. */
.ds-record { display: grid; gap: 18px; margin-bottom: 20px; }
.ds-record__header { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 20px;
  padding: 24px; border-top: 4px solid var(--ds-brand); }
.ds-record__header > div:first-child { flex: 2 1 300px; min-width: 0; }
.ds-record__header h2 { margin: 8px 0; font: 600 26px/1.2 var(--ds-font); color: var(--ds-ink); }
.ds-record__header p { margin: 0; color: var(--ds-caption); }
.ds-record__pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ds-record__headline { display: flex; flex-direction: column; gap: 3px; flex: 1 1 190px; color: var(--ds-caption); font-size: 13px; }
.ds-record__headline strong { color: var(--ds-ink); font: 600 24px/1.2 var(--ds-font); }
.ds-record__action { display: flex; align-items: center; }
.ds-record__renewal { display: flex; gap: 12px; align-items: center; padding: 14px 16px;
  background: var(--ds-purple-bg); border-radius: 12px; color: var(--ds-brand); font-size: 13px; }
.ds-record__renewal .bi { flex: none; font-size: 17px; }
.ds-record__renewal a { color: inherit; font-weight: 500; }
.ds-record__handoff { display: flex; align-items: center; flex-wrap: wrap; gap: 16px;
  padding: 20px; border: 1px solid var(--ds-rule); border-top: 4px solid var(--ds-post-accent);
  border-radius: 15px; background: var(--ds-card); box-shadow: var(--ds-shadow-card); }
.ds-record__handoff-icon { flex: none; display: grid; place-items: center; width: 42px; height: 42px;
  border-radius: 10px; background: var(--ds-post-tint); color: var(--ds-post-ink); font-size: 19px; }
.ds-record__handoff-copy { flex: 1 1 300px; min-width: 0; }
.ds-record__handoff h3 { margin: 5px 0; color: var(--ds-ink); font: 600 18px/1.3 var(--ds-font); }
.ds-record__handoff p { margin: 0; color: var(--ds-caption); font-size: 13px; }
.ds-record__sections { display: block; overflow: hidden; }
.ds-record__sections-head { padding: 20px; border-bottom: 1px solid var(--ds-rule); }
.ds-record__sections-head h3 { margin: 0; color: var(--ds-body); font: 600 18px/1.3 var(--ds-font); }
.ds-record__sections-head p { margin: 4px 0 0; color: var(--ds-caption); font-size: 12px; }
.ds-record__section { overflow: hidden; border-bottom: 1px solid var(--ds-rule-soft); }
.ds-record__section:last-child { border-bottom: 0; }
.ds-record__section > summary { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 17px 20px; cursor: pointer; font-weight: 500; color: var(--ds-ink); }
.ds-record__section > summary > span:first-child { display: inline-flex; align-items: center; gap: 13px; }
.ds-record__section > summary .bi { width: 19px; color: var(--ds-brand); font-size: 17px; }
.ds-record__section > summary > span:last-child { font-weight: 400; font-size: 13px; color: var(--ds-caption); text-align: right; }
.ds-record__section > summary:hover, .ds-record__legacy > summary:hover { background: var(--ds-page); }
.ds-record__section > summary:focus-visible, .ds-record__legacy > summary:focus-visible { outline: 3px solid var(--ds-accent); outline-offset: -3px; }
.ds-record__body { padding: 18px 20px 20px 52px; border-top: 1px solid var(--ds-rule-soft); }
.ds-record__body h3 { margin: 14px 0 10px; font: 600 15px/1.4 var(--ds-font); }
.ds-record__body h3:first-child { margin-top: 0; }
.ds-record__facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 24px; margin: 0; }
.ds-record__facts > div { min-width: 0; }
.ds-record__facts dt { font-size: 12px; color: var(--ds-caption); }
.ds-record__facts dd { margin: 3px 0 0; overflow-wrap: anywhere; }
.ds-record__people { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.ds-record__person { margin: 0; padding: 14px 16px; border: 1px solid var(--ds-rule); border-radius: 12px; }
.ds-record__person h3 { margin: 0 0 12px; }
.ds-record__comment { padding: 11px 0; border-bottom: 1px solid var(--ds-rule-soft); }
.ds-record__comment strong { color: var(--ds-ink); }
.ds-record__comment time { margin-left: 8px; color: var(--ds-caption); font-size: 12px; }
.ds-record__comment p { margin: 5px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.ds-record__comment-form { display: grid; justify-items: start; gap: 9px; margin-top: 18px; }
.ds-record__comment-form label { color: var(--ds-body); font-weight: 500; }
.ds-record__comment-form textarea { box-sizing: border-box; width: min(100%, 700px); padding: 10px 12px;
  border: 1px solid var(--ds-field-border); border-radius: 8px; font: inherit; }
.ds-record__comment-form textarea:focus-visible { outline: 3px solid var(--ds-focus); outline-offset: 2px; }
.ds-record__audit { padding: 12px 0; border-bottom: 1px solid var(--ds-rule); }
.ds-record__audit:first-child { padding-top: 0; }
.ds-record__audit:last-child { border-bottom: 0; }
.ds-record__audit span { display: block; color: var(--ds-caption); font-size: 12px; }
.ds-record__audit p { margin: 4px 0 0; white-space: pre-wrap; }
.ds-record__legacy { margin-bottom: 24px; }
.ds-record__legacy > summary { cursor: pointer; padding: 12px 16px; border: 1px solid var(--ds-rule);
  border-radius: 10px; background: var(--ds-card); color: var(--ds-accent); font-weight: 600; }
.ds-record__legacy > summary .bi { margin-right: 8px; }
.ds-record__legacy[open] > .container-fluid { padding-top: 18px; }
.ds-record__legacy .card { border: 1px solid var(--ds-rule); border-radius: 15px; box-shadow: var(--ds-shadow-card); overflow: hidden; }
.ds-record__legacy .card-header { background: var(--ds-card) !important; color: var(--ds-body) !important;
  border-bottom: 1px solid var(--ds-rule); }
.ds-record__legacy .card-header h5 { font: 600 18px/1.3 var(--ds-font); }
/* Broker application: the eight recorded fields, statement and declaration. */
.ds-submit { max-width: 1040px; margin: 0 auto 32px; }
.ds-submit__intro { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.ds-submit__intro h2 { margin: 7px 0; font: 600 25px/1.25 var(--ds-font); color: var(--ds-ink); }
.ds-submit__intro p { margin: 0; color: var(--ds-caption); }
.ds-submit__form { padding: 24px; }
.ds-submit__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 24px; }
.ds-submit__grid .ds-field label { color: var(--ds-body); font-weight: 500; font-size: 13px; }
.ds-submit__grid .ds-field .ds-input { width: 100%; }
.ds-submit__extra { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--ds-rule); }
.ds-submit__extra h3 { margin: 0 0 8px; font: 600 17px/1.3 var(--ds-font); color: var(--ds-ink); }
.ds-submit__extra p { margin: 0 0 12px; }
.ds-submit__file { height: auto; padding: 9px 12px; width: 100%; }
.ds-submit__consent { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; line-height: 1.5; }
.ds-submit__consent input { margin-top: 3px; flex: 0 0 auto; }
.ds-submit__actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.ds-submit .errorlist { margin: 5px 0 0; padding-left: 18px; color: var(--ds-red-fg); font-size: 12px; }
/* CRM contract request: source-backed request, company history and reviewed form. */
.ds-contract { max-width: 1180px; margin: 0 auto 32px; }
.ds-contract > .ds-note { display: block; margin-bottom: 10px; line-height: 1.5; }
.ds-contract__overview { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px;
  padding: 22px; margin-bottom: 14px; border-top: 4px solid var(--ds-brand); }
.ds-contract__overview h2 { margin: 6px 0; font: 600 24px/1.2 var(--ds-font); color: var(--ds-ink); }
.ds-contract__overview p { margin: 0; color: var(--ds-caption); }
.ds-contract__state { display: flex; flex-direction: column; gap: 4px; min-width: 240px; }
.ds-contract__state strong { color: var(--ds-ink); }
.ds-contract__state span:last-child { color: var(--ds-caption); font-size: 12px; overflow-wrap: anywhere; }
.ds-contract__history, .ds-contract__events { margin-bottom: 16px; }
.ds-contract__history-note { padding: 14px 18px; background: var(--ds-amber-bg); color: var(--ds-body);
  border: 1px solid var(--ds-amber-border); border-radius: 10px; margin-bottom: 14px; font-size: 13px; }
.ds-contract__loan-list { margin: 0 0 14px; padding: 0; list-style: none; }
.ds-contract__loan-list li { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px 12px;
  padding: 10px 0; border-bottom: 1px solid var(--ds-rule-soft); font-size: 13px; }
.ds-contract__loan-list li strong { color: var(--ds-ink); }
.ds-contract__loan-list li span { color: var(--ds-caption); }
.ds-contract__loan-list li a { margin-left: auto; }
.ds-contract__history .ds-card__body > .ds-jumplink { display: inline-flex; margin: 0 14px 8px 0; }
.ds-contract__events p { margin: 0 0 8px; font-size: 13px; }
.ds-contract__events .ds-card__body > p:last-child { margin-bottom: 0; }
.ds-contract__filing { padding: 12px 14px; border-radius: 10px;
  background: var(--ds-purple-bg); color: var(--ds-purple-fg); }
.ds-contract__result { margin: 20px 0; overflow: hidden; }
.ds-contract__result-head { display: flex; align-items: center; gap: 13px; padding: 20px;
  border-bottom: 1px solid var(--ds-rule); }
.ds-contract__result-head > .bi { color: var(--ds-green-fg); font-size: 23px; }
.ds-contract__result-head h2 { margin: 4px 0 0; color: var(--ds-ink); font: 600 18px/1.3 var(--ds-font); }
.ds-contract__result-body { display: grid; justify-items: start; gap: 15px; padding: 20px; }
.ds-contract__result-body > p { margin: 0; }
.ds-contract__downloads { display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  padding: 14px; border: 1px solid var(--ds-rule); border-radius: 12px; }
.ds-contract__downloads p { flex: 1 1 100%; margin: 0; color: var(--ds-caption); font-size: 12px; }
.ds-contract__download-note { padding: 12px 14px; border-radius: 10px;
  background: var(--ds-amber-bg); color: var(--ds-amber-fg-strong); }
.ds-contract__result-body h3 { margin: 5px 0 0; color: var(--ds-body); font: 600 15px/1.3 var(--ds-font); }
.ds-contract__schedule { width: 100%; max-height: 220px; overflow: auto; border: 1px solid var(--ds-rule); border-radius: 10px; }
.ds-contract__form { display: grid; gap: 16px; margin-top: 18px; }
.ds-contract__section { overflow: hidden; }
.ds-contract__actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.ds-contract__form .form-label { color: var(--ds-body); font: 500 13px/1.4 var(--ds-font); }
.ds-contract__form .form-control, .ds-contract__form .form-select { min-height: 40px;
  border-color: var(--ds-field-border); border-radius: 8px; font: 400 14px/1.4 var(--ds-font); }
.ds-contract__form .form-control:focus-visible, .ds-contract__form .form-select:focus-visible,
.ds-contract__form button:focus-visible, .ds-contract__form a:focus-visible,
.ds-contract__result a:focus-visible, .ds-contract__history a:focus-visible,
.ds-contract__events a:focus-visible { outline: 3px solid var(--ds-focus); outline-offset: 2px; }
.ds-contract__table-wrap { overflow-x: auto; }
.ds-contract__table-wrap table { min-width: 680px; }
.ds-contract__table-wrap td { min-width: 130px; }
.ds-contract__table-wrap td:last-child { min-width: 100px; }
.ds-contract__table-wrap .form-control, .ds-contract__table-wrap .form-select { width: 100%; }
.ds-contract__section .ds-card__body .row { align-items: end; }
@media (max-width: 760px) { .ds-contract__loan-list li a { margin-left: 0; width: 100%; } }
.ds-broker-record { display: grid; gap: 16px; margin: 22px 0; }
.ds-broker-record__section { padding: 20px; }
.ds-broker-record__section h2 { margin: 0 0 8px; font: 600 18px/1.3 var(--ds-font); color: var(--ds-ink); }
.ds-broker-record__section ul { margin: 12px 0 18px; padding-left: 18px; }
.ds-broker-record__section li { margin: 5px 0; }
.ds-broker-record__section form { display: grid; gap: 10px; justify-items: start; }
.ds-broker-record__section .ds-input { width: min(100%, 680px); }
.ds-broker-record__comments { margin: 12px 0 18px; }
.ds-broker-record__comments article { padding: 10px 0; border-bottom: 1px solid var(--ds-rule); }
.ds-broker-record__comments article p { margin: 4px 0 0; white-space: pre-wrap; }
/* Borrower application status: v4 §10's 760px stack, 24px title and 30px progress marks.
   The same cards also frame the broker's owner-scoped application view. */
.ds-application { width: 100%; max-width: 920px; margin: 0 auto 32px; }
.ds-application--borrower { max-width: 760px; }
.ds-application__hero { display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 16px; padding: 24px; }
.ds-application__identity { min-width: 0; }
.ds-application__identity h1, .ds-application__identity h2 { margin: 8px 0 0;
  color: var(--ds-ink); font: 500 24px/1.2 var(--ds-font); overflow-wrap: anywhere; }
.ds-application__identity p { margin: 5px 0 0; color: var(--ds-caption);
  font: 400 13px/1.5 var(--ds-font); overflow-wrap: anywhere; }
.ds-application__hero .ds-pill { flex: none; padding: 8px 14px;
  font: 500 13px/1.2 'Roboto', sans-serif; }
.ds-application__hero[data-stage="documents"] .ds-pill { background: var(--ds-amber-bg); color: var(--ds-amber-fg); }
.ds-application__hero[data-stage="funded"] .ds-pill { background: var(--ds-green-bg); color: var(--ds-green-fg); }
.ds-application__hero[data-stage="rejected"] .ds-pill { background: var(--ds-red-bg); color: var(--ds-red-fg); }
.ds-application__timeline { list-style: none; margin: 0; padding: 10px 20px 18px; }
.ds-application__timeline li { display: grid; grid-template-columns: 30px minmax(0, 1fr);
  gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--ds-rule-soft); }
.ds-application__timeline li:last-child { border-bottom: 0; }
.ds-application__marker { display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%; background: var(--ds-progress-todo);
  color: var(--ds-grey-fg); font: 500 13px/1 var(--ds-font); }
.ds-application__timeline li[data-state="done"] .ds-application__marker { background: var(--ds-green-fg); color: var(--ds-white); }
.ds-application__timeline li[data-state="now"] .ds-application__marker { background: var(--ds-brand); color: var(--ds-white); }
.ds-application__timeline li[data-state="stopped"] .ds-application__marker { background: var(--ds-red-fg); color: var(--ds-white); }
.ds-application__timeline strong { display: block; color: var(--ds-ink); font: 500 14px/1.4 var(--ds-font); }
.ds-application__timeline li[data-state="todo"] strong { color: var(--ds-caption); }
.ds-application__timeline p { margin: 2px 0 0; color: var(--ds-caption);
  font: 400 13px/1.5 var(--ds-font); text-wrap: pretty; }
.ds-application__next { margin: 0; padding: 16px 20px; border-radius: 12px;
  background: var(--ds-accent-tint); color: var(--ds-brand);
  font: 400 13px/1.6 var(--ds-font); text-wrap: pretty; }
.ds-application__confirm > p { margin: 0; }
.ds-application__confirm-form { display: grid; justify-items: start; gap: 14px; margin: 18px 0 12px; }
.ds-application__confirm-form .ds-field { width: min(100%, 420px); }
.ds-application__confirm-form .ds-input { width: 100%; box-sizing: border-box; }
.ds-application__loan h3 { margin: 18px 0 7px; color: var(--ds-ink); font: 600 14px/1.3 var(--ds-font); }
.ds-application__loan p { margin: 0 0 8px; }
.ds-application__loan ul { margin: 0; padding-left: 20px; }
.ds-application__back { margin: 0; }
/* Several borrower applications: one own-record link per row, with company text only
   when the view has already cleared that application's registration-number check. */
.ds-application-list ul { margin: 0; padding: 0; list-style: none; }
.ds-application-list li + li { border-top: 1px solid var(--ds-rule-soft); }
.ds-application-list__link { display: flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 10px 4px; color: var(--ds-ink); text-decoration: none; }
.ds-application-list__link:hover { color: var(--ds-accent); }
.ds-application-list__name { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; }
.ds-application-list__name strong { font: 500 14px/1.4 var(--ds-font); }
.ds-application-list__name span { color: var(--ds-caption); font: 400 12px/1.5 var(--ds-font);
  overflow-wrap: anywhere; }
.ds-application-list__link .ds-pill { flex: none; }
.ds-application-list__link[data-stage="approved"] .ds-pill { background: var(--ds-purple-bg); color: var(--ds-purple-fg); }
.ds-application-list__link[data-stage="documents"] .ds-pill { background: var(--ds-amber-bg); color: var(--ds-amber-fg); }
.ds-application-list__link[data-stage="funded"] .ds-pill { background: var(--ds-green-bg); color: var(--ds-green-fg); }
.ds-application-list__link[data-stage="rejected"] .ds-pill { background: var(--ds-red-bg); color: var(--ds-red-fg); }
.ds-application-list__link > .bi { color: var(--ds-accent); }
/* Invitation card follows the designer's vertical 14px field rhythm and 42px controls. */
.ds-invitations__form { display: grid; justify-items: start; gap: 14px; max-width: 560px; }
.ds-invitations__form .ds-field { width: 100%; }
.ds-invitations__form .ds-input, .ds-invitations__form .ds-select { box-sizing: border-box;
  width: 100%; height: 42px; }
.ds-invitations__form .ds-btn { min-height: 44px; }
@media (max-width: 760px) {
  .ds-record__header { padding: 18px; }
  .ds-record__header h2 { font-size: 22px; }
  .ds-record__facts { grid-template-columns: 1fr; }
  .ds-record__section > summary { align-items: flex-start; flex-direction: column; }
  .ds-record__section > summary > span:last-child { text-align: left; }
  .ds-record__section > summary, .ds-record__legacy > summary { min-height: 44px; }
  .ds-record__body { padding-left: 20px; }
  .ds-submit__grid { grid-template-columns: 1fr; }
  .ds-submit__form { padding: 18px; }
}

/* Phones (spec 10.5): 44px minimum tap targets for CONTENT controls AND plain links (View, Download,
   the held-for-review jump link), not only the frame (D1.5 item 4). */
@media (max-width: 760px) {
  .ds-app .ds-btn, .ds-app .ds-input, .ds-app .ds-select,
  .ds-app .ds-btn--sm, .ds-app .ds-btn--link, .ds-app .ds-jumplink,
  .ds-app .ds-content input[type="checkbox"], .ds-app .ds-content input[type="radio"] {
    min-height: 44px;
  }
  .ds-app .ds-content input[type="checkbox"], .ds-app .ds-content input[type="radio"] { min-width: 44px; }
  .ds-app .ds-btn--link, .ds-app .ds-jumplink { min-height: 44px; display: inline-flex; align-items: center; }
  .ds-app .ds-rowlink { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; }
}

/* Analytics uses the shared card/table system and keeps every figure readable
   without a third-party chart script. */
.ds-analytics-range { display: flex; flex-wrap: wrap; gap: 6px; }
.ds-analytics-range a { display: inline-flex; align-items: center; min-height: 44px;
  padding: 8px 12px; border-radius: 8px; color: var(--ds-accent); text-decoration: none;
  background: var(--ds-accent-tint); font: 500 13px/1.2 var(--ds-font); }
.ds-analytics-range a[aria-current="page"] { color: #fff; background: var(--ds-accent); }
.ds-analytics-range a:focus-visible { outline: 2px solid var(--ds-accent); outline-offset: 2px; }
.ds-analytics-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.ds-analytics-metric { display: flex; flex-direction: column; gap: 7px;
  padding: 17px; border: 1px solid var(--ds-rule); border-radius: 12px; }
.ds-analytics-metric > span { font: 600 11px/1.2 var(--ds-font); text-transform: uppercase;
  letter-spacing: .08em; color: var(--ds-caption); }
.ds-analytics-metric > strong { font: 500 26px/1.2 var(--ds-font); font-variant-numeric: tabular-nums; }
.ds-analytics-metric > small { color: var(--ds-caption); line-height: 1.4; }
.ds-analytics .ds-table { min-width: 560px; }
.ds-analytics-number { text-align: right !important; font-variant-numeric: tabular-nums; }
.ds-analytics-number small { color: var(--ds-caption); font-size: 12px; }
@media (max-width: 900px) { .ds-analytics-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .ds-analytics-metrics { grid-template-columns: 1fr; } }

/* ─────────────────────────────────────────────────────────────────────────
   Stage B layout pass (v4 handoff, PORTAL-SPEC 4.3 / 4.7 / 10.5). Every rule below sits under
   .ds-v4, the body class that is present only while DEALSHACK_FRAME_V4 is on, so switching that
   setting off restores the earlier look untouched.
   ───────────────────────────────────────────────────────────────────────── */

/* Underwriting case. The three-column, two-column or one-column choice follows the room actually
   left beside the 232px sidebar (a container query on .uw-case), not the width of the screen:
     below 640px   one column: steps, then the step, then the deal summary
     640px - 1039px two columns: steps with the deal summary under them | the step
     1040px and up  three columns: steps | the step | the deal summary
   The step column keeps at least ~570px in three columns, and wide tables inside it scroll
   sideways inside their own card rather than pushing the summary over them. */
.ds-v4 .uw-case { container: uw-case / inline-size; padding-left: 0; padding-right: 0; }
.ds-v4 .uw-header { padding: 14px 20px; border: 0; border-radius: 15px; box-shadow: var(--ds-shadow-card); }
.ds-v4 .uw-header .co { color: var(--ds-ink); font: 600 16px/1.3 var(--ds-font); overflow-wrap: anywhere; }
.ds-v4 .uw-header .meta { color: var(--ds-caption); font-size: 13px; }
.ds-v4 .uw-case-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; gap: 20px; }
.ds-v4 .uw-case-layout > * { min-width: 0; }
.ds-v4 .uw-case-main, .ds-v4 .uw-case-aside { grid-column: auto; grid-row: auto; }
.ds-v4 .uw-rail { position: static; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 4px; padding: 12px; background: var(--ds-card); border-radius: 15px; box-shadow: var(--ds-shadow-card); }
.ds-v4 .uw-node { gap: 12px; padding: 8px 10px; border-radius: 10px; }
.ds-v4 .uw-node .dot { font-weight: 500; }
.ds-v4 .uw-node .lbl { color: var(--ds-ink); font: 500 14px/1.3 var(--ds-font); }
.ds-v4 .uw-node.done .dot { background: var(--ds-green-fg); border-color: var(--ds-green-fg); }
.ds-v4 .uw-node.current { background: var(--ds-accent-tint); }
.ds-v4 .uw-node.current .dot { background: var(--ds-brand); border-color: var(--ds-brand);
  box-shadow: 0 0 0 4px var(--ds-soft-bg); }
.ds-v4 .uw-node.current .lbl { color: var(--ds-brand); }
.ds-v4 .uw-side { position: static; }
.ds-v4 .uw-side .card { border: 0; border-radius: 15px; box-shadow: var(--ds-shadow-card); overflow: hidden; }
.ds-v4 .uw-side .card-header { padding: 14px 16px; background: var(--ds-card); border-bottom: 1px solid var(--ds-rule);
  color: var(--ds-caption) !important; font: 600 11px/1 var(--ds-font) !important; letter-spacing: .08em !important; }
.ds-v4 .uw-side .card-body { padding: 4px 16px 8px; }
.ds-v4 .uw-side .row-line { flex-wrap: wrap; gap: 2px 12px; padding: 10px 0; border-top-color: var(--ds-rule-soft);
  font-size: 13px; }
.ds-v4 .uw-side .row-line:first-child { border-top: 0; }
.ds-v4 .uw-side .row-line strong { margin-left: auto; color: var(--ds-ink); font-weight: 500; text-align: right;
  overflow-wrap: anywhere; }
.ds-v4 .uw-side .badge { padding: 6px 11px; border-radius: 8px; background: var(--ds-purple-bg) !important;
  color: var(--ds-purple-fg); font: 500 12px/1.3 'Roboto', sans-serif; }
@container uw-case (min-width: 640px) {
  .ds-v4 .uw-case-layout { grid-template-columns: 200px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .ds-v4 .uw-rail { display: flex; flex-direction: column; grid-column: 1; grid-row: 1; }
  .ds-v4 .uw-case-main { grid-column: 2; grid-row: 1 / span 2; }
  .ds-v4 .uw-case-aside { grid-column: 1; grid-row: 2; }
}
@container uw-case (min-width: 1040px) {
  .ds-v4 .uw-case-layout { grid-template-columns: 180px minmax(0, 1fr) 252px; grid-template-rows: none; }
  .ds-v4 .uw-rail { grid-row: auto; position: sticky; top: 12px; }
  .ds-v4 .uw-case-main { grid-column: 2; grid-row: auto; }
  .ds-v4 .uw-case-aside { grid-column: 3; grid-row: auto; }
  .ds-v4 .uw-side { position: sticky; top: 12px; }
}

/* Offer and decision step. The step is a grid whose single track used to size itself to its widest
   child (the 700px options table), which pushed the cards under the deal summary. The track is now
   capped at the column, so the options table scrolls inside its own card; the form rows wrap by the
   room in the column (they used to wrap by screen width, which squeezed every field at 1280). */
.ds-v4 .ds-offer, .ds-v4 .ds-offer__form { grid-template-columns: minmax(0, 1fr); }
.ds-v4 .ds-offer .ds-card { min-width: 0; }
.ds-v4 .ds-offer .row > [class*="col-md-"] { flex: 1 1 140px; width: auto; max-width: 100%; }
.ds-v4 .ds-offer .row > .col-md-3, .ds-v4 .ds-offer .row > .col-md-4 { flex-basis: 200px; }
.ds-v4 .ds-offer .row > .col-md-12, .ds-v4 .ds-offer .row > .col-12 { flex-basis: 100%; }

/* Pipeline (PORTAL-SPEC 4.3, handoff prototype): compact one-row filter bar, narrower columns (220px
   at least, so four fit at 1280 beside the sidebar and the board still scrolls sideways inside its
   card), and cards that read as: company name (600 14px, as recorded), amount (600 18px, brand
   colour), one caption line (source, broker, submitted date) and a one-row move control. The real
   fact list stays in the markup for screen readers (its labels are read, not drawn); the Move
   form, its select, its button and its label are the same elements as before. */
.ds-v4 .ds-pipeline-filters { align-items: flex-end; gap: 8px 10px; padding: 12px 20px; }
.ds-v4 .ds-pipeline-filters .ds-inline-field { gap: 2px; }
.ds-v4 .ds-pipeline-filters .ds-cell-sub { font: 500 11px/1.3 var(--ds-font); color: var(--ds-caption); }
.ds-v4 .ds-pipeline-filters .ds-input--sm, .ds-v4 .ds-pipeline-filters .ds-select--sm { height: 34px; font-size: 13px; }
.ds-v4 .ds-pipeline-filters input[type="number"] { width: 100px; }
.ds-v4 .ds-pipeline-filters input[type="date"] { width: 132px; }
.ds-v4 .ds-pipeline-filters select { width: 136px; }
.ds-v4 .ds-pipeline-filters__actions { display: inline-flex; align-items: flex-end; gap: 8px; }
.ds-v4 .ds-pipeline-filters .ds-btn { height: 34px; }
.ds-v4 .ds-pipeline-board { gap: 14px; padding: 16px 20px 20px; }
.ds-v4 .ds-pipeline-column { flex: 1 0 220px; min-width: 220px; max-width: 360px; padding: 12px;
  background: var(--ds-grey-bg); }
.ds-v4 .ds-pipeline-column__head { padding-bottom: 8px; border-bottom: 0; }
.ds-v4 .ds-pipeline-column__cards { gap: 10px; padding-top: 2px; }
.ds-v4 .ds-pipeline-deal { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 12px; border: 0;
  border-radius: 12px; box-shadow: var(--ds-shadow-card); }
.ds-v4 .ds-pipeline-deal__name { font: 600 14px/1.3 var(--ds-font); overflow-wrap: anywhere; }
.ds-v4 .ds-pipeline-deal__amount { margin-top: 0; color: var(--ds-brand); font: 600 18px/1.25 var(--ds-font);
  font-variant-numeric: tabular-nums; }
.ds-v4 .ds-pipeline-deal__amount--missing { color: var(--ds-caption); font: 400 12px/1.5 var(--ds-font); }
.ds-v4 .ds-pipeline-deal__unit, .ds-v4 .ds-pipeline-deal__facts dt, .ds-v4 .ds-pipeline-deal__move-label {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.ds-v4 .ds-pipeline-deal__facts { display: block; margin: 0; color: var(--ds-caption); font: 400 12px/1.5 var(--ds-font); }
.ds-v4 .ds-pipeline-deal__facts > div { display: inline-block; max-width: 100%; }
.ds-v4 .ds-pipeline-deal__facts dd { display: inline; text-align: left; color: var(--ds-caption); }
.ds-v4 .ds-pipeline-deal__facts > div:nth-child(-n+2)::after { content: "\00b7"; content: "\00b7" / ""; margin: 0 6px; }
.ds-v4 .ds-pipeline-deal__unrecorded::before { content: attr(data-what) ": "; }
.ds-v4 .ds-pipeline-deal__facts > .ds-pipeline-deal__outcome { display: block; margin-top: 2px;
  color: var(--ds-amber-fg); }
.ds-v4 .ds-pipeline-deal__facts > .ds-pipeline-deal__outcome dt { position: static; display: inline; width: auto;
  height: auto; margin: 0 4px 0 0; overflow: visible; clip: auto; white-space: normal; font-weight: 500; }
.ds-v4 .ds-pipeline-deal__facts > .ds-pipeline-deal__outcome dd { color: var(--ds-amber-fg); }
.ds-v4 .ds-pipeline-deal__move { flex-wrap: nowrap; gap: 6px; margin-top: 6px; padding-top: 10px; }
.ds-v4 .ds-pipeline-deal__move select { flex: 1 1 0; min-width: 0; height: 32px; padding: 0 6px; font-size: 12px; }
.ds-v4 .ds-pipeline-deal__move .ds-btn { flex: none; height: 32px; padding: 0 12px; }
@media (max-width: 760px) {
  .ds-v4 .ds-pipeline-filters .ds-inline-field { flex: 1 1 128px; }
  .ds-v4 .ds-pipeline-filters .ds-inline-field > input,
  .ds-v4 .ds-pipeline-filters .ds-inline-field > select { width: 100%; }
}

/* The post-funding failure page for staff, drawn inside the frame (access_portal/refusal_framed.html). */
.ds-v4 .ds-refusal { max-width: 720px; }
.ds-v4 .ds-refusal__body { display: grid; justify-items: start; gap: 16px; }
.ds-v4 .ds-refusal__detail { margin: 0; color: var(--ds-body); font: 400 14px/1.6 var(--ds-font); }

/* UI card 1: the post-funding failure card's page, time, reason, retry line and way back. */
.ds-v4 .ds-le-down { display: grid; gap: 8px; text-align: left; }
.ds-v4 .ds-le-down p { margin: 0; font: 400 14px/1.5 var(--ds-font); }
.ds-v4 .ds-le-down__why { font-weight: 500; }
.ds-v4 .ds-le-down__retry { color: var(--ds-body); }
.ds-v4 .ds-le-down__links a { font-weight: 500; }

/* UI card 1: the "loading" line shown the moment a post-funding (/le/) link is clicked (script loaded only while
   DEALSHACK_UI_CALM is on). */
.ds-v4 .ds-le-loading { position: fixed; left: 0; right: 0; top: 0; z-index: 2000; background: #302a63; color: #fff;
  font: 500 14px/1.4 var(--ds-font); padding: 8px 16px; text-align: center; border-bottom: 3px solid #fff; }

/* Tables. A sideways-scrolling table shows soft edge shadows while there is more to reach (the classic
   background-attachment trick, no script), so a clipped column reads as "scroll" rather than as lost.
   My deals and the Audit log also STACK on a narrow card (below 640px of room): the header row is kept for
   screen readers, each row becomes a small block, and each cell names itself from its data-label. */
.ds-v4 .ds-table-wrap, .ds-v4 .ds-contract__table-wrap {
  background:
    linear-gradient(90deg, var(--ds-card) 30%, transparent) 0 0 / 32px 100% no-repeat local,
    linear-gradient(270deg, var(--ds-card) 30%, transparent) 100% 0 / 32px 100% no-repeat local,
    linear-gradient(90deg, rgba(46, 35, 94, .18), transparent) 0 0 / 14px 100% no-repeat scroll,
    linear-gradient(270deg, rgba(46, 35, 94, .18), transparent) 100% 0 / 14px 100% no-repeat scroll var(--ds-card);
}
.ds-v4 .ds-table-wrap--stack { container: ds-tw / inline-size; }
@container ds-tw (max-width: 639px) {
  .ds-v4 .ds-table-wrap--stack .ds-table--stack { min-width: 0; }
  .ds-v4 .ds-table--stack thead { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  .ds-v4 .ds-table--stack, .ds-v4 .ds-table--stack tbody, .ds-v4 .ds-table--stack tr,
  .ds-v4 .ds-table--stack td { display: block; }
  .ds-v4 .ds-table--stack tbody tr { padding: 12px 20px; border-bottom: 1px solid var(--ds-rule-soft); }
  .ds-v4 .ds-table--stack tbody td, .ds-v4 .ds-table--stack tbody td:first-child,
  .ds-v4 .ds-table--stack tbody td:last-child { position: relative; padding: 3px 0 3px 96px; border: 0;
    text-align: left; min-height: 24px; }
  .ds-v4 .ds-table--stack tbody td:first-child { padding-left: 0; font-size: 14px; }
  .ds-v4 .ds-table--stack tbody td[data-label]::before { content: attr(data-label); position: absolute; left: 0;
    top: 4px; width: 84px; color: var(--ds-caption); font: 400 12px/1.5 var(--ds-font); }
  .ds-v4 .ds-table--stack tbody td[colspan] { padding-left: 0; }
}

/* Notices to review (access_portal/notices_review.html): a card with a sideways-scrolling table. */
.ds-v4 .ds-notices-intro { max-width: 760px; margin-bottom: 16px; }
.ds-v4 .ds-notices-table { min-width: 860px; }
.ds-v4 .ds-notices-table td { vertical-align: top; overflow-wrap: anywhere; }
.ds-v4 .ds-notices-table .ds-notices-form { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 8px 6px 0; }
.ds-v4 .ds-notices-table .ds-input { width: 170px; max-width: 100%; }

/* Bootstrap grid columns wrap by SCREEN width, but beside the 232px sidebar the room is far smaller, so
   a md column was squeezed to ~60-180px (inputs cut off, cards clipped). These rows wrap by the room
   instead: each column has a sensible basis and grows to share the row. */
.ds-v4 .ds-contract__form .row > [class*="col-md-"] { flex: 1 1 160px; width: auto; max-width: 100%; }
.ds-v4 .ds-contract__form .row > .col-md-3, .ds-v4 .ds-contract__form .row > .col-md-4 { flex-basis: 200px; }
.ds-v4 .ds-contract__form .row > .col-md-6 { flex-basis: 280px; }
.ds-v4 .ds-record__legacy .row > .col-md-7 { flex: 7 1 360px; width: auto; max-width: 100%; }
.ds-v4 .ds-record__legacy .row > .col-md-5 { flex: 5 1 300px; width: auto; max-width: 100%; }

/* ─────────────────────────────────────────────────────────────────────────
   Stage C visual fidelity (Claude Design v3 prototype, values read from its inline styles). Every
   rule below sits under .ds-v4, so switching DEALSHACK_FRAME_V4 off restores the earlier look.
   Frame first: sidebar, top bar, issues pill, avatar; then the body padding.
   ───────────────────────────────────────────────────────────────────────── */

/* Sidebar: 14px/1.2 items with an 8px radius and 3px between them; idle text #4a4a55, the active
   item on the purple tint at weight 500; group labels 500 11px; 18px between groups (the sidebar's
   own 22px gap stays between the brand and the first group). */
.ds-v4 .ds-group { gap: 3px; }
.ds-v4 .ds-sidebar .ds-group + .ds-group { margin-top: -4px; }
.ds-v4 .ds-group-label { margin: 0; padding: 0 12px 6px; font-weight: 500; }
.ds-v4 .ds-nav-link { border-radius: 8px; color: var(--ds-nav-ink); line-height: 1.2; }
.ds-v4 .ds-nav-link .bi { flex: none; }
.ds-v4 .ds-nav-link:hover { background: var(--ds-accent-tint); color: var(--ds-brand); }
.ds-v4 .ds-nav-link.active { background: var(--ds-purple-bg); color: var(--ds-brand); font-weight: 500; }

/* Top bar: no rule under it, a soft shadow instead; 16px / 30px padding; the person block's
   initials are 36px at weight 500 and the handle is 500 13px. */
.ds-v4 .ds-topbar { padding: 16px 30px; gap: 12px 20px; border-bottom: 0; box-shadow: var(--ds-shadow-bar); }
.ds-v4 .ds-topbar-heading { gap: 12px; }
.ds-v4 .ds-topbar-titles { gap: 4px; }
.ds-v4 .ds-freshness { line-height: 1.4; }
.ds-v4 .ds-freshness .bi { font-size: 12px; }
.ds-v4 .ds-content { padding: 28px 30px 96px; }
.ds-v4 .ds-avatar-btn--id { gap: 10px; padding: 4px 8px 4px 4px; }
.ds-v4 .ds-avatar-btn--id:hover { background: var(--ds-accent-tint); }
.ds-v4 .ds-avatar-initials { width: 36px; height: 36px; background: var(--ds-purple-bg); font-weight: 500; }
.ds-v4 .ds-avatar-id { line-height: 1.3; }
.ds-v4 .ds-avatar-handle { font-weight: 500; }
.ds-v4 .ds-avatar-chevron { font-size: 11px; }
@media screen and (min-width: 521px) { .ds-v4 .ds-topbar-right { gap: 18px; } }

/* The data-issues control as the prototype's worded pill: red tint with the count while issues are
   open, grey when clear, amber while unknown. data-issues.js keeps setting the same classes, the
   count and the aria-label; the words come from CSS (the label is for the eye; the aria-label is the
   accessible name and starts with exactly those words). One open issue reads "data issue". */
.ds-v4 .ds-issues-bell { min-width: 0; min-height: 0; padding: 8px 12px; border: 0; border-radius: 8px;
  gap: 0; background: var(--ds-amber-bg); color: var(--ds-amber-fg); font: 500 13px/1.2 var(--ds-font); }
.ds-v4 .ds-issues-bell .bi { margin-right: 8px; font-size: 14px; }
.ds-v4 .ds-issues-bell::after { content: "Issues unavailable"; }
.ds-v4 .ds-issues-bell:hover { background: var(--ds-amber-bg); filter: brightness(.96); }
.ds-v4 .ds-issues-bell--open { background: var(--ds-red-bg); color: var(--ds-red-fg); }
.ds-v4 .ds-issues-bell--open:hover { background: var(--ds-red-bg); }
.ds-v4 .ds-issues-bell--open::after { content: "data issues"; }
.ds-v4 .ds-issues-bell--open[aria-label^="1 data issue "]::after { content: "data issue"; }
.ds-v4 .ds-issues-bell--clear { background: var(--ds-grey-bg); color: var(--ds-grey-fg); }
.ds-v4 .ds-issues-bell--clear:hover { background: var(--ds-grey-bg); }
.ds-v4 .ds-issues-bell--clear::after { content: "No open issues"; }
/* While LedgerEye's read-only views are open the script never paints an unqualified all-clear: it labels
   the clear state "No findings \00B7 read-only view - ...", and the pill says so too. The aria-label always
   starts with the pill's visible words (WCAG 2.5.3), so these selectors key on those starts. */
.ds-v4 .ds-issues-bell--clear[aria-label^="No findings"]::after { content: "No findings \00B7  read-only view"; }
.ds-v4 .ds-issues-bell--unknown { background: var(--ds-amber-bg); color: var(--ds-amber-fg); }
.ds-v4 .ds-issues-bell__count { position: static; min-width: 0; height: auto; margin-right: 5px; padding: 0;
  border-radius: 0; background: none; color: inherit; font: inherit; }
/* Ship 8 (item 37): the Companies House watch. The pill suffix, the drawer's top section, the Today row's
   button and the deal record's Watch card. Every rule is under .ds-v4 (the suffix span is drawn only with
   the frame switch on); the pill's red tint stays driven by the data-issue classes alone, never by this
   suffix. Sits before the phone tap-target block, which must stay last in the file. */
.ds-v4 .ds-issues-bell__ch { display: inline; order: 2; white-space: pre-wrap; }
.ds-v4 .ds-issues-bell::after { order: 1; }
/* UI card 6 (review item C8): while LedgerEye cannot be read, the amber pill is ONE small status dot. Hover or
   keyboard focus shows what it means (the same words as its accessible name); activating it still opens the
   issues drawer. On a page that does not use LedgerEye the unavailable state is not drawn at all; open
   findings and the all-clear still show everywhere. */
.ds-v4 .ds-issues-bell--calm.ds-issues-bell--unknown { position: relative; width: 32px; height: 32px; padding: 0; justify-content: center;
  background: transparent; }
.ds-v4 .ds-issues-bell--calm.ds-issues-bell--unknown:hover { background: transparent; filter: none; }
.ds-v4 .ds-issues-bell--calm.ds-issues-bell--unknown .bi,
.ds-v4 .ds-issues-bell--calm.ds-issues-bell--unknown .ds-issues-bell__ch,
.ds-v4 .ds-issues-bell--calm.ds-issues-bell--unknown .ds-issues-bell__count { display: none; }
.ds-v4 .ds-issues-bell--calm.ds-issues-bell--unknown::before { content: ""; width: 12px; height: 12px; border-radius: 50%;
  background: var(--ds-amber-fg-strong); }
.ds-v4 .ds-issues-bell--calm.ds-issues-bell--unknown::after { content: none; }
.ds-v4 .ds-issues-bell--calm.ds-issues-bell--unknown:hover::after,
.ds-v4 .ds-issues-bell--calm.ds-issues-bell--unknown:focus-visible::after { content: attr(aria-label); position: absolute;
  top: calc(100% + 6px); right: 0; z-index: 30; width: max-content; max-width: 260px; padding: 8px 10px;
  border-radius: 8px; background: var(--ds-ink); color: #fff; font: 400 12px/1.4 var(--ds-font);
  text-align: left; white-space: normal; }
.ds-v4 .ds-issues-bell--calm.ds-issues-bell--unknown[data-ds-pop-off]:hover::after,
.ds-v4 .ds-issues-bell--calm.ds-issues-bell--unknown[data-ds-pop-off]:focus-visible::after { content: none; }
.ds-v4 .ds-issues-bell--calm.ds-issues-bell--unknown[data-ds-source-page="0"] { display: none; }
.ds-v4 .ds-issues-ch { flex: none; max-height: 45vh; overflow-y: auto; padding: 14px 20px 4px;
  border-bottom: 1px solid var(--ds-rule); }
.ds-v4 .ds-issues-ch__title { margin: 0 0 6px; color: var(--ds-caption); font: 600 11px/1 var(--ds-font);
  letter-spacing: .08em; text-transform: uppercase; }
.ds-v4 .ds-issues-ch__status { margin: 0 0 10px; color: var(--ds-caption); font-size: 13px; }
.ds-v4 .ds-issues-ch__status--warn { padding: 10px 12px; border-left: 4px solid var(--ds-amber-border);
  border-radius: 8px; background: var(--ds-amber-bg); color: var(--ds-amber-fg-strong); line-height: 1.5; }
.ds-v4 .ds-issues-ch__status[hidden], .ds-v4 .ds-issues-ch__error[hidden] { display: none; }
.ds-v4 .ds-issues-ch__error { margin: 0 0 10px; color: var(--ds-red-fg); font-size: 13px; }
.ds-v4 .ds-issues-ch__list { margin: 0; padding: 0; list-style: none; }
.ds-v4 .ds-issues-ch__item { padding: 12px 0; border-bottom: 1px solid var(--ds-rule-soft); }
.ds-v4 .ds-issues-ch__item:last-child { border-bottom: 0; }
.ds-v4 .ds-issues-ch__more { padding: 10px 0 14px; color: var(--ds-caption); font-size: 13px; }
.ds-v4 .ds-issues-ch__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ds-v4 .ds-issues-ch__kind { padding: 3px 8px; border-radius: 6px; background: var(--ds-amber-bg);
  color: var(--ds-amber-fg); font: 500 11px/1.3 var(--ds-font); }
.ds-v4 .ds-issues-ch__company { color: var(--ds-ink); font: 500 14px/1.4 var(--ds-font); overflow-wrap: anywhere; }
.ds-v4 .ds-issues-ch__summary { margin: 6px 0 2px; color: var(--ds-body); font-size: 13px; line-height: 1.6;
  overflow-wrap: anywhere; }
.ds-v4 .ds-issues-ch__when { display: block; color: var(--ds-caption); font-size: 12px; }
.ds-v4 .ds-issues-ch__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 6px; }
.ds-v4 .ds-issues-ch__actions a, .ds-v4 .ds-issues-ch__seen { display: inline-flex; align-items: center;
  min-height: 44px; padding: 0; border: 0; background: none; color: var(--ds-accent);
  font: 500 13px/1.2 var(--ds-font); cursor: pointer; text-decoration: none; }
.ds-v4 .ds-issues-ch__actions a:hover, .ds-v4 .ds-issues-ch__seen:hover { text-decoration: underline; }
.ds-v4 .ds-issues-ch__seen[disabled] { color: var(--ds-caption); cursor: default; text-decoration: none; }
.ds-v4 .ds-today-action .ds-btn--button { border: 0; cursor: pointer; font-family: inherit; }

/* The deal record's Watch at Companies House card. */
.ds-v4 .ds-record__ch { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px 20px; margin: 16px 0; padding: 14px 18px; border: 1px solid var(--ds-rule); border-radius: 12px;
  background: var(--ds-card); }
.ds-v4 .ds-record__ch-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ds-v4 .ds-record__ch-copy strong { color: var(--ds-ink); font-weight: 500; }
.ds-v4 .ds-record__ch-copy span { color: var(--ds-caption); font-size: 12px; }
.ds-v4 .ds-record__ch-form { margin: 0; }
.ds-v4 .ds-record__ch--on { background: var(--ds-purple-bg); border-color: var(--ds-rule-soft); }
.ds-v4 .ds-record__ch .ds-btn { min-height: 44px; }

/* The avatar menu: 280px, no border, the prototype's floating shadow; the person block 16px with
   the name at 500 14px; items 10px with an 8px radius on the purple hover. */
.ds-v4 .ds-avatar-menu { top: calc(100% + 8px); width: 280px; max-width: calc(100vw - 32px); padding: 0 0 6px;
  border: 0; overflow: hidden; box-shadow: var(--ds-shadow-menu); }
.ds-v4 .ds-avatar-who { margin: 0; padding: 16px; border-bottom: 1px solid var(--ds-rule-soft); }
.ds-v4 .ds-avatar-who .ds-who-name { font-size: 14px; line-height: 1.3; }
.ds-v4 .ds-avatar-menu > a, .ds-v4 .ds-avatar-menu > form { margin: 0 6px; }
.ds-v4 .ds-avatar-who + a, .ds-v4 .ds-avatar-who + form { margin-top: 6px; }
.ds-v4 .ds-avatar-menu a, .ds-v4 .ds-avatar-menu button.ds-linkish { padding: 10px; line-height: 1.2; }
.ds-v4 .ds-avatar-menu .bi { margin-right: 10px !important; }
@media screen and (max-width: 760px) {
  .ds-v4 .ds-topbar { padding: 12px 16px; }
  .ds-v4 .ds-content { padding: 20px 16px 96px; }
  .ds-v4 .ds-issues-bell { min-height: 44px; }   /* tap target (spec 10.5) */
  /* The menu button is the prototype's 44px purple tile; the right-hand group wraps to a second row
     that starts at the left, and the freshness line stays under the title (it is not in that group). */
  .ds-v4 .ds-menu-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px;
    height: 44px; padding: 0; border-radius: 8px; background: var(--ds-purple-bg); color: var(--ds-brand); }
  .ds-v4 .ds-topbar-right { margin-left: 0; justify-content: flex-start; }
}
@media screen and (max-width: 520px) { .ds-v4 .ds-freshness { display: flex; } }

/* Today. Header band: kicker row, 28px figure, caption 8px under it (the band's own 16px rhythm). */
.ds-v4 .ds-today-tile__top { margin-bottom: 16px; }
.ds-v4 .ds-today-tile__figure { margin: 0; }
.ds-v4 .ds-today-tile__caption { margin: 8px 0 0; }
.ds-v4 .ds-today-tile__action-count { gap: 7px; }
.ds-v4 .ds-today-tile__action-count span { min-width: 22px; padding: 0 6px; border-radius: 999px; }
/* Stage rows: label, value and count on one 1.3 line; the bar 7px under it. */
.ds-v4 .ds-today-stage__line { gap: 10px; }
.ds-v4 .ds-today-stage__name, .ds-v4 .ds-today-stage__value, .ds-v4 .ds-today-stage__count { line-height: 1.3; }
.ds-v4 .ds-today-stage__track { margin-top: 7px; }
/* To do: the block bleeds 10px past the body padding so a row's hover tint reaches further than its
   text; each row is a tone tile and the copy, with the action button UNDER the copy. */
.ds-v4 .ds-today-actions { margin: 14px -10px 0; padding: 4px 10px; }
.ds-v4 .ds-today-actions__heading { align-items: center; padding: 10px 0 2px; }
.ds-v4 .ds-today-actions__heading span { font: 500 12px/1 var(--ds-font); font-variant-numeric: tabular-nums; }
.ds-v4 .ds-today-action { grid-template-columns: 34px minmax(0, 1fr); margin: 0 -12px; }
.ds-v4 .ds-today-action .ds-btn { grid-column: 2; justify-self: start; gap: 6px; white-space: nowrap; }
.ds-v4 .ds-today-action__icon { font-size: 15px; }
.ds-v4 .ds-today-action__copy strong { line-height: 1.35; }
.ds-v4 .ds-today-action__copy span { line-height: 1.5; }
.ds-v4 .ds-today-tile--post .ds-btn--soft { background: var(--ds-post-soft); color: var(--ds-post-ink); }
.ds-v4 .ds-today-tile--post .ds-btn--soft:hover { background: var(--ds-post-soft); filter: brightness(.96); }
/* The tone of each item's tile follows its icon, as in the prototype's seven items. */
.ds-v4 .ds-today-action__icon:has(.bi-x-circle-fill),
.ds-v4 .ds-today-action__icon:has(.bi-exclamation-octagon-fill) { background: var(--ds-red-bg); color: var(--ds-red-fg); }
.ds-v4 .ds-today-action__icon:has(.bi-file-earmark-x-fill),
.ds-v4 .ds-today-action__icon:has(.bi-question-diamond-fill),
.ds-v4 .ds-today-action__icon:has(.bi-envelope) { background: var(--ds-amber-bg); color: var(--ds-amber-fg); }
.ds-v4 .ds-today-action__icon:has(.bi-clipboard-check) { background: var(--ds-blue-bg); color: var(--ds-blue-fg); }
.ds-v4 .ds-today-action__icon:has(.bi-file-earmark-text) { background: var(--ds-purple-bg); color: var(--ds-purple-fg); }
.ds-v4 .ds-today-action__icon:has(.bi-shield-exclamation) { background: var(--ds-grey-bg); color: var(--ds-grey-fg); }
/* The footer link sits at the body's left edge, 16px under the last row, with its arrow 6px off. */
.ds-v4 .ds-today-tile__footer { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px;
  padding: 16px 20px 18px; line-height: 1.2; }
/* Heartbeat strip: card shadow, amber pill with the 3px corner, text at 13px/1.6. */
.ds-v4 .ds-today-heartbeat { align-items: flex-start; gap: 12px; box-shadow: var(--ds-shadow-card); }
.ds-v4 .ds-today-heartbeat > span { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px;
  border-radius: 3px; background: var(--ds-amber-bg); color: var(--ds-amber-fg); font: 500 12px/1.2 var(--ds-pill-font); }
.ds-v4 .ds-today-heartbeat > span .bi { font-size: 13px; }
.ds-v4 .ds-today-heartbeat p { line-height: 1.6; }

/* Pipeline (v3 prototype): no wrapping card - a caption line, the filter row on the page, then grey
   columns of white cards. The heading stays for screen readers (the top bar already says Pipeline). */
.ds-v4 .ds-pipeline-card { background: none; box-shadow: none; }
.ds-v4 .ds-pipeline-card .ds-card__head { padding: 0 0 16px; border-bottom: 0; align-items: center; gap: 10px 16px; }
.ds-v4 .ds-pipeline-card .ds-card__title { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.ds-v4 .ds-pipeline-card .ds-card__sub { margin: 0; font: 400 13px/1.5 var(--ds-font); }
.ds-v4 .ds-pipeline-card .ds-card__head .ds-btn--ghost { padding: 9px 14px; border: 0; background: var(--ds-purple-bg);
  color: var(--ds-purple-fg); font-size: 13px; }
.ds-v4 .ds-pipeline-card .ds-card__head .ds-btn--ghost:hover { background: var(--ds-soft-bg-hover); }
.ds-v4 .ds-pipeline-filters { padding: 0 0 16px; border-bottom: 0; gap: 10px; }
.ds-v4 .ds-pipeline-filters .ds-input--sm, .ds-v4 .ds-pipeline-filters .ds-select--sm { height: 38px; padding: 0 10px;
  border-radius: 8px; font: 400 13px/1 var(--ds-font); color: var(--ds-ink); }
.ds-v4 .ds-pipeline-filters .ds-btn { height: 38px; }
.ds-v4 .ds-pipeline-filters .ds-btn--ghost { border-color: var(--ds-btn-line); color: var(--ds-nav-ink); }
.ds-v4 .ds-pipeline-board { padding: 0 0 4px; }
.ds-v4 .ds-pipeline-column { padding: 14px; border-radius: 15px; background: var(--ds-column-bg); }
.ds-v4 .ds-pipeline-column__head { padding: 2px 4px 8px; gap: 8px; }
.ds-v4 .ds-pipeline-column__head h3 { color: var(--ds-body); line-height: 1.2; }
.ds-v4 .ds-pipeline-column__head .ds-count { padding: 3px 8px; border-radius: 6px; background: var(--ds-white);
  color: var(--ds-nav-ink); font: 500 12px/1.2 var(--ds-pill-font); }
.ds-v4 .ds-pipeline-column__cards { gap: 10px; padding-top: 0; }
.ds-v4 .ds-pipeline-deal { gap: 8px; padding: 14px; box-shadow: 0 9px 20px rgba(46, 35, 94, .06); }
.ds-v4 .ds-pipeline-deal__name { font: 500 14px/1.3 var(--ds-font); color: var(--ds-ink); }
.ds-v4 .ds-pipeline-deal__amount { font: 500 16px/1.2 var(--ds-font); }
.ds-v4 .ds-pipeline-deal__amount--missing { font: 400 12px/1.5 var(--ds-font); }
.ds-v4 .ds-pipeline-deal__move { margin-top: 2px; padding-top: 10px; }
.ds-v4 .ds-pipeline-deal__move select { height: 32px; padding: 0 2px 0 8px; border-color: var(--ds-btn-line);
  color: var(--ds-nav-ink); font: 500 12px/1.2 var(--ds-font); }
.ds-v4 .ds-pipeline-deal__move .ds-btn { border: 1px solid var(--ds-btn-line); background: var(--ds-white);
  color: var(--ds-nav-ink); font-size: 12px; }
.ds-v4 .ds-pipeline-deal__move .ds-btn:hover { background: var(--ds-accent-tint); color: var(--ds-brand); }
.ds-v4 .ds-pipeline-note { padding: 16px 0 0; }
@media screen and (min-width: 761px) { .ds-v4 .ds-pipeline-column { min-height: 460px; } }

/* Bootstrap theme. Most screens still use Bootstrap classes for their forms, tables, alerts, badges and
   buttons; these rules draw them in the prototype's palette so a screen no longer shows Bootstrap blue,
   yellow alerts or heavy cards. Colour variables are set on .ds-app (the whole signed-in frame). */
.ds-v4 .ds-app { --bs-body-color: var(--ds-body); --bs-heading-color: var(--ds-ink); --bs-secondary-color: var(--ds-caption);
  --bs-border-color: var(--ds-rule); --bs-link-color-rgb: 85, 70, 200; --bs-link-hover-color-rgb: 59, 46, 163; }
.ds-v4 .card { border: 0; border-radius: 15px; box-shadow: var(--ds-shadow-card); }
/* A card that carries a Bootstrap border colour (e.g. border-danger) keeps its border: it is a signal. */
.ds-v4 .card[class*="border-"] { border-width: 1px; border-style: solid; }
.ds-v4 .card:hover { box-shadow: var(--ds-shadow-card) !important; }
.ds-v4 .card-header { padding: 20px; background: var(--ds-card); border-bottom: 1px solid var(--ds-rule); color: var(--ds-body); }
.ds-v4 .card-header h5, .ds-v4 .card-header .h5, .ds-v4 .card-header h4, .ds-v4 .card-header h6 { margin: 0;
  font: 600 18px/1.3 var(--ds-font); color: inherit; }
/* Headers without a Bootstrap bg-* colour take the ink colour; coloured headers keep their own
   (white) text so a heading never sits dark-on-dark. */
.ds-v4 .card-header:not([class*="bg-"]) h5, .ds-v4 .card-header:not([class*="bg-"]) .h5,
.ds-v4 .card-header:not([class*="bg-"]) h4, .ds-v4 .card-header:not([class*="bg-"]) h6 { color: var(--ds-body); }
.ds-v4 .card-body { padding: 20px; }
.ds-v4 .card-footer { background: var(--ds-card); border-top: 1px solid var(--ds-rule-soft); }
.ds-v4 .btn { --bs-btn-padding-x: 16px; --bs-btn-padding-y: 9px; --bs-btn-font-size: 13px; --bs-btn-font-weight: 500;
  --bs-btn-border-radius: 8px; line-height: 1.2; }
.ds-v4 .btn-sm { --bs-btn-padding-x: 12px; --bs-btn-padding-y: 7px; --bs-btn-font-size: 12px; }
.ds-v4 .btn-primary { --bs-btn-bg: var(--ds-brand); --bs-btn-border-color: var(--ds-brand); --bs-btn-color: #fff;
  --bs-btn-hover-bg: var(--ds-brand-hover); --bs-btn-hover-border-color: var(--ds-brand-hover); --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: var(--ds-brand-hover); --bs-btn-active-border-color: var(--ds-brand-hover); --bs-btn-active-color: #fff;
  --bs-btn-disabled-bg: var(--ds-brand); --bs-btn-disabled-border-color: var(--ds-brand); --bs-btn-focus-shadow-rgb: 115, 102, 255; }
.ds-v4 .btn-outline-primary { --bs-btn-color: var(--ds-purple-fg); --bs-btn-bg: var(--ds-purple-bg); --bs-btn-border-color: var(--ds-purple-bg);
  --bs-btn-hover-color: var(--ds-purple-fg); --bs-btn-hover-bg: var(--ds-soft-bg-hover); --bs-btn-hover-border-color: var(--ds-soft-bg-hover);
  --bs-btn-active-color: var(--ds-purple-fg); --bs-btn-active-bg: var(--ds-soft-bg-hover); --bs-btn-active-border-color: var(--ds-soft-bg-hover);
  --bs-btn-disabled-color: var(--ds-purple-fg); --bs-btn-disabled-bg: var(--ds-purple-bg); --bs-btn-disabled-border-color: var(--ds-purple-bg);
  --bs-btn-focus-shadow-rgb: 115, 102, 255; }
.ds-v4 .btn-outline-secondary, .ds-v4 .btn-secondary { --bs-btn-color: var(--ds-nav-ink); --bs-btn-bg: var(--ds-white); --bs-btn-border-color: var(--ds-btn-line);
  --bs-btn-hover-color: var(--ds-brand); --bs-btn-hover-bg: var(--ds-accent-tint); --bs-btn-hover-border-color: var(--ds-btn-line);
  --bs-btn-active-color: var(--ds-brand); --bs-btn-active-bg: var(--ds-accent-tint); --bs-btn-active-border-color: var(--ds-btn-line);
  --bs-btn-disabled-color: var(--ds-nav-ink); --bs-btn-disabled-bg: var(--ds-white); --bs-btn-disabled-border-color: var(--ds-btn-line);
  --bs-btn-focus-shadow-rgb: 115, 102, 255; }
.ds-v4 .btn-success { --bs-btn-bg: var(--ds-green-fg); --bs-btn-border-color: var(--ds-green-fg); --bs-btn-color: #fff;
  --bs-btn-hover-bg: #124d3a; --bs-btn-hover-border-color: #124d3a; --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: #124d3a; --bs-btn-active-border-color: #124d3a; --bs-btn-disabled-bg: var(--ds-green-fg); --bs-btn-disabled-border-color: var(--ds-green-fg); }
.ds-v4 .btn-outline-success { --bs-btn-color: var(--ds-green-fg); --bs-btn-border-color: var(--ds-green-bg); --bs-btn-bg: var(--ds-green-bg);
  --bs-btn-hover-color: var(--ds-green-fg); --bs-btn-hover-bg: var(--ds-green-bg); --bs-btn-hover-border-color: var(--ds-green-fg);
  --bs-btn-active-color: var(--ds-green-fg); --bs-btn-active-bg: var(--ds-green-bg); --bs-btn-active-border-color: var(--ds-green-fg); }
.ds-v4 .btn-danger { --bs-btn-bg: var(--ds-red-fg); --bs-btn-border-color: var(--ds-red-fg); --bs-btn-color: #fff;
  --bs-btn-hover-bg: #8f1d17; --bs-btn-hover-border-color: #8f1d17; --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: #8f1d17; --bs-btn-active-border-color: #8f1d17; --bs-btn-disabled-bg: var(--ds-red-fg); --bs-btn-disabled-border-color: var(--ds-red-fg); }
.ds-v4 .btn-outline-danger { --bs-btn-color: var(--ds-red-fg); --bs-btn-bg: var(--ds-white); --bs-btn-border-color: var(--ds-danger-border);
  --bs-btn-hover-color: var(--ds-red-fg); --bs-btn-hover-bg: var(--ds-red-bg); --bs-btn-hover-border-color: var(--ds-danger-border);
  --bs-btn-active-color: var(--ds-red-fg); --bs-btn-active-bg: var(--ds-red-bg); --bs-btn-active-border-color: var(--ds-danger-border); }
.ds-v4 .btn-warning, .ds-v4 .btn-outline-warning { --bs-btn-color: var(--ds-amber-fg-strong); --bs-btn-bg: var(--ds-white); --bs-btn-border-color: var(--ds-amber-border);
  --bs-btn-hover-color: var(--ds-amber-fg-strong); --bs-btn-hover-bg: var(--ds-amber-bg); --bs-btn-hover-border-color: var(--ds-amber-border);
  --bs-btn-active-color: var(--ds-amber-fg-strong); --bs-btn-active-bg: var(--ds-amber-bg); --bs-btn-active-border-color: var(--ds-amber-border); }
.ds-v4 .btn-info, .ds-v4 .btn-outline-info { --bs-btn-color: var(--ds-blue-fg); --bs-btn-bg: var(--ds-blue-bg); --bs-btn-border-color: var(--ds-blue-bg);
  --bs-btn-hover-color: var(--ds-blue-fg); --bs-btn-hover-bg: var(--ds-blue-bg); --bs-btn-hover-border-color: var(--ds-blue-fg);
  --bs-btn-active-color: var(--ds-blue-fg); --bs-btn-active-bg: var(--ds-blue-bg); --bs-btn-active-border-color: var(--ds-blue-fg); }
.ds-v4 .alert { padding: 13px 16px; border: 0; border-radius: 12px; font-size: 13px; line-height: 1.6; }
.ds-v4 .alert-warning { --bs-alert-bg: var(--ds-amber-bg); --bs-alert-color: var(--ds-amber-fg-strong); --bs-alert-link-color: var(--ds-amber-fg-strong); }
.ds-v4 .alert-success { --bs-alert-bg: var(--ds-green-bg); --bs-alert-color: var(--ds-green-fg); --bs-alert-link-color: var(--ds-green-fg); }
.ds-v4 .alert-danger { --bs-alert-bg: var(--ds-red-bg); --bs-alert-color: var(--ds-red-fg); --bs-alert-link-color: var(--ds-red-fg); }
.ds-v4 .alert-info { --bs-alert-bg: var(--ds-blue-bg); --bs-alert-color: var(--ds-blue-fg); --bs-alert-link-color: var(--ds-blue-fg); }
.ds-v4 .badge { padding: 6px 11px; border-radius: 8px; font: 500 12px/1.3 var(--ds-pill-font); }
.ds-v4 .badge.bg-success, .ds-v4 .badge.text-bg-success { background-color: var(--ds-green-bg) !important; color: var(--ds-green-fg) !important; }
.ds-v4 .badge.bg-warning, .ds-v4 .badge.text-bg-warning { background-color: var(--ds-amber-bg) !important; color: var(--ds-amber-fg) !important; }
.ds-v4 .badge.bg-danger, .ds-v4 .badge.text-bg-danger { background-color: var(--ds-red-bg) !important; color: var(--ds-red-fg) !important; }
.ds-v4 .badge.bg-info, .ds-v4 .badge.text-bg-info { background-color: var(--ds-blue-bg) !important; color: var(--ds-blue-fg) !important; }
.ds-v4 .badge.bg-primary, .ds-v4 .badge.text-bg-primary { background-color: var(--ds-purple-bg) !important; color: var(--ds-purple-fg) !important; }
.ds-v4 .badge.bg-secondary, .ds-v4 .badge.bg-light, .ds-v4 .badge.bg-dark, .ds-v4 .badge.text-bg-secondary,
.ds-v4 .badge.text-bg-light, .ds-v4 .badge.text-bg-dark { background-color: var(--ds-grey-bg) !important; color: var(--ds-grey-fg) !important; }
.ds-v4 .table { --bs-table-color: var(--ds-body); --bs-table-border-color: var(--ds-rule-soft); --bs-table-hover-bg: var(--ds-row-hover);
  --bs-table-striped-bg: var(--ds-row-hover); font-size: 14px; }
.ds-v4 .table > thead > tr > th { padding: 12px; background: var(--ds-th-bg); border-bottom: 1px solid var(--ds-rule-soft);
  color: var(--ds-body); font: 500 13px/1.4 var(--ds-font); text-transform: none; letter-spacing: 0; }
.ds-v4 .table > tbody > tr > td { padding: 13px 12px; vertical-align: middle; }
.ds-v4 .form-control, .ds-v4 .form-select { border-color: var(--ds-field-border); border-radius: 8px; color: var(--ds-ink);
  font: 400 14px/1.4 var(--ds-font); }
.ds-v4 .form-control:focus, .ds-v4 .form-select:focus { border-color: var(--ds-focus); box-shadow: 0 0 0 .2rem rgba(115, 102, 255, .2); }
/* An invalid field keeps Bootstrap's red border (the plain-field rule above would otherwise win). */
.ds-v4 .form-control.is-invalid, .ds-v4 .form-select.is-invalid { border-color: var(--bs-form-invalid-border-color); }
.ds-v4 .form-control-sm, .ds-v4 .form-select-sm { border-radius: 8px; font-size: 13px; }
.ds-v4 .form-label { margin-bottom: 6px; color: var(--ds-body); font: 500 13px/1.3 var(--ds-font); }
.ds-v4 .progress { --bs-progress-bg: var(--ds-progress-todo); --bs-progress-bar-bg: var(--ds-accent); border-radius: 999px; }
.ds-v4 .list-group { --bs-list-group-border-color: var(--ds-rule-soft); --bs-list-group-border-radius: 12px; }

/* Cards, notes and strips that read as text: the card sub-line carries the prototype's .7px tracking
   (the Pipeline caption keeps none), and the Intake and Underwriting screens' remaining details. */
.ds-v4 .ds-card__sub { letter-spacing: .7px; }
.ds-v4 .ds-pipeline-card .ds-card__sub { letter-spacing: 0; }
.ds-v4 .ds-filters .ds-section-label, .ds-v4 .ds-inline-field .ds-section-label { font: 500 12px/1.3 var(--ds-font);
  letter-spacing: 0; text-transform: none; }
.ds-v4 .ds-intake-mailbox-table td:nth-child(4) { white-space: nowrap; }
.ds-v4 .ds-uw-progress-track { height: 6px; border-radius: 999px; background: #eef1f6; }
.ds-v4 .ds-uw-progress-track span { background: var(--ds-brand); }
.ds-v4 .ds-uw-table .ds-num { font-weight: 500; }

/* Deal record header (v3 prototype): no accent bar, 24px padding, the name at 500 24px, 13px/1.2 pills
   with the 8px / 14px chip, and a gap between the primary button and the credit-evidence link. */
.ds-v4 .ds-record__header { align-items: center; gap: 20px; padding: 24px; border-top: 0; }
.ds-v4 .ds-record__header h2 { margin: 6px 0 5px; font: 500 24px/1.2 var(--ds-font); }
.ds-v4 .ds-record__header p { font: 400 13px/1.5 var(--ds-font); }
.ds-v4 .ds-record__header .ds-pill { padding: 8px 14px; font: 500 13px/1.2 var(--ds-pill-font); }
.ds-v4 .ds-record__headline strong { font-weight: 500; }
.ds-v4 .ds-record__action { flex-wrap: wrap; gap: 10px 16px; }
.ds-v4 .ds-record__renewal { font: 400 13px/1.6 var(--ds-font); }
.ds-v4 .ds-record__section > summary { font-size: 14px; line-height: 1.3; }
.ds-v4 .ds-people__waiting .ds-card__head { background: none; }
.ds-v4 .ds-field .ds-section-label { font: 500 13px/1.3 var(--ds-font); letter-spacing: 0; text-transform: none; color: var(--ds-body); }

/* Sidebar count badges (Stage D; v3 prototype: a 3px 7px pill at the right of the item, radius 6px,
   500 11px/1.2, tones blue / amber / red). Each badge is an empty hidden span until
   static/js/sidebar-badges.js fills it with a real, complete, positive count; an item with no work
   waiting shows no badge at all. */
.ds-v4 .ds-nav-badge { flex: none; margin-left: auto; padding: 3px 7px; border-radius: 6px;
  font: 500 11px/1.2 var(--ds-pill-font); }
.ds-v4 .ds-nav-badge[hidden] { display: none; }
.ds-v4 .ds-nav-badge--blue  { background: var(--ds-blue-bg);  color: var(--ds-blue-fg); }
.ds-v4 .ds-nav-badge--amber { background: var(--ds-amber-bg); color: var(--ds-amber-fg); }
.ds-v4 .ds-nav-badge--red   { background: var(--ds-red-bg);   color: var(--ds-red-fg); }

/* Ship 7: the two read-only Admin reference pages, "Emails we send" and "Sign-in & refusals"
   (access_portal/emails_we_send.html, signin_refusals.html). Under .ds-v4 alone; with the frame switch
   off the pages are plain but still readable. Nothing here is clickable except plain links. */
.ds-v4 .ds-emails__intro { margin: 0; max-width: 760px; color: var(--ds-caption); font: 400 13px/1.5 var(--ds-font); }
.ds-v4 .ds-emails__warn { margin: 0; padding: 12px 16px; border-radius: 10px; background: var(--ds-amber-bg);
  color: var(--ds-amber-fg); font: 400 13px/1.5 var(--ds-font); }
.ds-v4 .ds-emails__layout { display: grid; grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: 20px; align-items: start; }
.ds-v4 .ds-emails__list { padding: 10px; min-width: 0; }
.ds-v4 .ds-emails__group { margin: 10px 12px 6px; color: var(--ds-caption);
  font: 600 11px/1.3 var(--ds-font); letter-spacing: .07em; text-transform: uppercase; }
.ds-v4 .ds-emails__items { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 2px; }
.ds-v4 .ds-emails__item { display: flex; flex-direction: column; gap: 3px; padding: 12px; border-radius: 10px;
  color: var(--ds-ink); text-decoration: none; }
.ds-v4 .ds-emails__item:hover { background: var(--ds-row-hover); color: var(--ds-ink); }
.ds-v4 .ds-emails__item.is-selected { background: var(--ds-accent-tint); }
.ds-v4 .ds-emails__item:focus-visible, .ds-v4 .ds-signin-preview__tab:focus-visible {
  outline: 2px solid var(--ds-focus); outline-offset: 2px; }
.ds-v4 .ds-emails__name { font: 500 14px/1.3 var(--ds-font); }
.ds-v4 .ds-emails__audience { color: var(--ds-caption); font: 400 12px/1.4 var(--ds-font); }
.ds-v4 .ds-emails__detail { min-width: 0; }
.ds-v4 .ds-emails__head { padding: 20px; border-bottom: 1px solid var(--ds-rule); }
.ds-v4 .ds-emails__status { display: inline-block; margin: 0 0 10px; padding: 4px 10px; border-radius: 8px;
  background: var(--ds-green-bg); color: var(--ds-green-fg); font: 500 12px/1.3 var(--ds-font); }
.ds-v4 .ds-emails__status.is-built-off { background: var(--ds-amber-bg); color: var(--ds-amber-fg); }
.ds-v4 .ds-emails__title { margin: 0 0 12px; color: var(--ds-ink); font: 600 18px/1.3 var(--ds-font); }
.ds-v4 .ds-emails__fields { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px;
  margin: 0; color: var(--ds-muted); font: 400 13px/1.5 var(--ds-font); }
.ds-v4 .ds-emails__fields dt { color: var(--ds-caption); font-weight: 400; }
.ds-v4 .ds-emails__fields dd { margin: 0; overflow-wrap: anywhere; }
.ds-v4 .ds-emails__fields dd.ds-emails__subject { color: var(--ds-ink); font: 500 16px/1.4 var(--ds-font); }
.ds-v4 .ds-emails__body { box-sizing: border-box; max-width: 660px; margin: 0; padding: 24px 20px; color: var(--ds-body);
  font: 400 14px/1.6 var(--ds-font); white-space: pre-wrap; overflow-wrap: anywhere; }
.ds-v4 .ds-emails__foot { padding: 14px 20px 18px; border-top: 1px solid var(--ds-rule);
  color: var(--ds-muted); font: 400 13px/1.5 var(--ds-font); }
.ds-v4 .ds-emails__foot p { margin: 0 0 6px; }
.ds-v4 .ds-emails__foot-title { margin: 0 0 6px; color: var(--ds-caption); font: 600 11px/1.3 var(--ds-font);
  letter-spacing: .07em; text-transform: uppercase; }
.ds-v4 .ds-emails__note { color: var(--ds-caption); }
.ds-v4 .ds-signin-preview__tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.ds-v4 .ds-signin-preview__tab { padding: 8px 14px; border: 1px solid var(--ds-rule); border-radius: 8px;
  background: var(--ds-white); color: var(--ds-body); font: 500 13px/1.2 var(--ds-font); text-decoration: none; }
.ds-v4 .ds-signin-preview__tab:hover { background: var(--ds-accent-tint); color: var(--ds-brand); }
.ds-v4 .ds-signin-preview__tab.is-selected { border-color: var(--ds-brand); background: var(--ds-brand);
  color: var(--ds-white); }
.ds-v4 .ds-signin-preview__stage { padding: 20px; border-radius: 0 0 15px 15px; background: var(--ds-column-bg); }
/* Inert on purpose: the specimen card cannot be clicked, tabbed into or scrolled, so no button or link in it works. */
.ds-v4 .ds-signin-preview__frame { display: block; width: 100%; height: 600px; border: 0; border-radius: 12px;
  background: var(--ds-page); pointer-events: none; }
@media screen and (max-width: 760px) {
  .ds-v4 .ds-emails__layout { grid-template-columns: minmax(0, 1fr); }
  .ds-v4 .ds-emails__fields { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .ds-v4 .ds-emails__fields dd { margin-bottom: 8px; }
  .ds-v4 .ds-signin-preview__tab { display: inline-flex; align-items: center; min-height: 44px; }
  .ds-v4 .ds-emails__item { min-height: 44px; }
  .ds-v4 .ds-signin-preview__stage { padding: 12px; }
}

/* ── w26 A2 (Brokers page): Admin -> Brokers (templates/deals/brokers_list.html), a read-only list for Operations. Under .ds-v4
   alone; it reuses the emails-page, table, pill and held-list classes above, so only the few new parts are here. Six columns, so
   the table keeps a minimum width and scrolls sideways inside its card on a narrow screen (spec 10.5). Nothing on it is a control.
   Placed BEFORE the Ship 5 tap-target block on purpose: core.tests.test_frame_tap_targets requires that block to be the last thing in
   the file and to hold no width rule after it. ── */
.ds-v4 .ds-brokers__summary { margin: 0; padding: 12px 16px; border-radius: 10px; background: var(--ds-grey-bg);
  color: var(--ds-grey-fg); font: 400 13px/1.5 var(--ds-font); }
.ds-v4 .ds-brokers__table { min-width: 860px; }
.ds-v4 .ds-brokers__table tbody td { vertical-align: top; }
.ds-v4 .ds-brokers__table .ds-text-warn { white-space: nowrap; }
.ds-v4 .ds-brokers__row .ds-pill { margin-top: 6px; }
.ds-v4 .ds-brokers__row .ds-subline { margin-top: 2px; }
.ds-v4 .ds-brokers__funded { padding-bottom: 6px; }
.ds-v4 .ds-brokers__note { padding-bottom: 8px; }
/* ── end w26 A2 (Brokers page) ── */

/* ── w26 A3 (Brokers editing): the per-row edit controls on Admin -> Brokers, drawn only while DEALSHACK_BROKERS_EDIT is on.
   Under .ds-v4 alone, before the Ship 5 tap-target block for the same reason as the A2 block above. The one form per row sits
   in the first cell; the type, tier and rate controls name it with form="". ── */
.ds-v4 .ds-brokers__table .ds-select { width: 100%; min-width: 190px; box-sizing: border-box; }
.ds-v4 .ds-brokers__table .ds-brokers__rate { width: 84px; box-sizing: border-box; text-align: right; }
.ds-v4 .ds-brokers__form { margin: 10px 0 0; }
/* ── end w26 A3 (Brokers editing) ── */

/* Ship 5: 44px tap targets on phones (spec 10.5). Under .ds-v4 and a phone-width screen only, so the
   desktop look and the frame-off look are untouched. Bootstrap buttons, menu items and page links grow
   by padding (their text stays centred and they keep their display mode); the Deal Shack buttons and the
   small links grow by min-height. The status pills (spans) are not controls and are left alone; a pill
   that is a link or a button gets the height. */
@media screen and (max-width: 760px) {
  .ds-v4 .btn, .ds-v4 .btn-sm { --bs-btn-padding-y: 14px; }          /* 13px / 12px text at 1.2 + 28 + 2 border = 44+ */
  .ds-v4 .btn, .ds-v4 .ds-btn, .ds-v4 .ds-btn--sm, .ds-v4 button[type="submit"], .ds-v4 input[type="submit"],
  .ds-v4 input[type="button"] { min-height: 44px; }
  .ds-v4 .pagination { --bs-pagination-padding-y: 10px; }              /* 24px line + 20 + 2 border */
  .ds-v4 .dropdown-menu { --bs-dropdown-item-padding-y: 10px; }
  .ds-v4 .ds-btn--link, .ds-v4 .ds-jumplink, .ds-v4 .ds-back, .ds-v4 .ds-today-tile__footer,
  .ds-v4 a.ds-pill, .ds-v4 button.ds-pill {
    display: inline-flex; align-items: center; min-height: 44px; }
  .ds-v4 .ds-rowlink { display: inline-flex; align-items: center; min-width: 44px; min-height: 44px; }
  .ds-v4 .uw-side a.row-line { align-items: center; min-height: 44px; }   /* the Underwriting side-list rows */
  /* Single-line fields; three classes deep so a page's own 40px field rule (.ds-offer, .ds-contract__form) loses. */
  .ds-v4 .ds-content .form-select,
  .ds-v4 .ds-content .form-control:not(textarea):not([type="file"]):not([type="checkbox"]):not([type="radio"]) {
    min-height: 44px; }
  /* The pipeline card: the deal name link is the card's main control; Move is a select and a button. */
  .ds-v4 .ds-pipeline-deal__name { display: flex; align-items: center; min-height: 44px; }
  .ds-v4 .ds-pipeline-deal__move select { height: 44px; }
  .ds-v4 .ds-pipeline-deal__move .ds-btn { height: auto; min-height: 44px; }
  /* Today's "N to do" button, the red Questions pill, and the testing Feedback pill and its two buttons. */
  .ds-v4 .ds-today-tile__action-count, .ds-v4 .ds-questions-pill, .ds-v4 .ds-fb__pill,
  .ds-v4 .ds-fb__send, .ds-v4 .ds-fb__cancel { min-height: 44px; }
}

/* Ship 5 (prototype): the post-funding status bar sits in the tile's tinted head band, under the caption.
   today-ledgereye.js builds it here only for a complete status count with something to draw (the host
   stays hidden otherwise); the title, swatches and counts stay in the body. Under .ds-v4 alone, and the
   container exists only while the frame switch is on. */
.ds-v4 .ds-today-tile__statusbar { margin-top: 14px; }
.ds-v4 .ds-today-tile__statusbar[hidden] { display: none; }
.ds-v4 .ds-today-tile__statusbar .ds-today-status-bar { margin-bottom: 0; height: 8px; border-radius: 4px; }

/* Feature 1d (broker emails): "Broker emails held back" (access_portal/broker_emails_held.html), a read-only Admin page
   for Operations. Under .ds-v4 alone; it reuses the emails-page and table classes above, so only the few new parts are here.
   Nothing on it is clickable except plain links. */
.ds-v4 .ds-held__mode { margin: 0; padding: 12px 16px; border-radius: 10px; background: var(--ds-amber-bg);
  color: var(--ds-amber-fg); font: 400 13px/1.5 var(--ds-font); }
.ds-v4 .ds-held__mode.is-live { background: var(--ds-green-bg); color: var(--ds-green-fg); }
.ds-v4 .ds-held__status { margin: 0 0 10px; }
.ds-v4 .ds-held__count { margin: 0; padding: 12px 20px 16px; color: var(--ds-caption); font: 400 12px/1.5 var(--ds-font); }
.ds-v4 .ds-held__empty { margin: 0; padding: 16px 20px 20px; color: var(--ds-muted); font: 400 14px/1.5 var(--ds-font); }
.ds-v4 .ds-held .ds-emails__group { margin-top: 16px; }

/* ── Week of 26 Oct (Risk grades page, piece A5): Pre-funding -> Risk grades (templates/deals/risk_grades.html), a read-only
   page. Under .ds-v4 alone; it reuses the card, table, pill, count and note classes above, so only the plain text lines
   under the tables are new. No colour is invented: the grade chips are the existing status tones. The block ends with its
   last rule (a test needs the file to end in a rule, so there is no closing comment). ── */
.ds-v4 .ds-riskgrades__line { margin: 0; padding: 14px 20px 0; color: var(--ds-caption); font: 400 13px/1.5 var(--ds-font); }
.ds-v4 .ds-riskgrades__line:last-child { padding-bottom: 18px; }
.ds-v4 .ds-riskgrades__line--warn { padding-bottom: 14px; color: var(--ds-amber-fg); }
/* w26-A4 (renewal chip): the "Renewal N" chip on Pipeline cards (templates/deals/kanban.html) and the deal record's
   renewal banner (templates/deals/_renewal_banner.html). Under .ds-v4 alone, and drawn only while the switch
   DEALSHACK_RENEWAL_CHIP is on. The chip is the existing purple pill; the line beneath it is caption-sized, and
   amber when the earlier deal is not linked. The link line uses .ds-jumplink so the phone tap-target rule reaches it. */
.ds-v4 .ds-pipeline-deal__renewal { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.ds-v4 .ds-pipeline-deal__renewal .ds-pill { padding: 3px 9px; font: 500 12px/1.4 var(--ds-pill-font); }
.ds-v4 .ds-pipeline-deal__renewal-line { font: 400 12px/1.4 var(--ds-font); color: var(--ds-caption); word-wrap: break-word; }
.ds-v4 a.ds-pipeline-deal__renewal-line { color: var(--ds-accent); font-weight: 500; }
.ds-v4 .ds-pipeline-deal__renewal-line--attention { color: var(--ds-amber-fg-strong); font-weight: 500; }
.ds-v4 .ds-pipeline-note--renewals { padding-top: 6px; }
.ds-v4 .ds-record__renewal--detail > div { display: flex; flex-direction: column; gap: 2px; }
.ds-v4 .ds-record__renewal-line { font-weight: 400; word-wrap: break-word; }
.ds-v4 .ds-record__renewal-line--attention { color: var(--ds-amber-fg-strong); font-weight: 500; }
