/* App shell and first primitives, composed only from tokens.css — no raw colour,
   spacing, or type value appears below. The visual language (deep-ink rail with
   inline glyphs, light top bar, tight type scale, Stage-chip control, grouped
   boards) is transcribed from the accepted Gate-C candidate at
   elevated-vayr-ux-lab@da8c159 (src/app/ux25.css §§3–7). Slice 2 formalizes these
   into a shared UI package. */

* {
  box-sizing: border-box;
}

html,
body,
#root {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--ux25-text-base);
  line-height: var(--ux25-line-height);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

h1 {
  font-family: var(--ux25-font-display);
  font-size: var(--ux25-text-xl);
  font-weight: 400;
  letter-spacing: -0.01em;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--space-2);
  top: calc(-1 * var(--space-6));
  z-index: 60;
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.skip-link:focus {
  top: var(--space-2);
}

:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

button {
  font: inherit;
}

.button {
  font: inherit;
  cursor: pointer;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--ux25-radius);
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: none;
}
.button:hover:not(:disabled) {
  border-color: var(--color-accent);
}
.button-primary {
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  border-color: var(--color-accent);
}
.button-primary:hover:not(:disabled) {
  background: var(--ux25-accent-hover);
  border-color: var(--ux25-accent-hover);
}
.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---- Shell ---- */
/* Viewport-locked so the top bar stays fixed and only the main content scrolls
   (n1): the grid's second row is bounded, so .main owns its own overflow rather than
   letting the document grow and carry the taskbar off-screen. */
.shell {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100vh;
}

/* Dark taskbar: the sticky top frame reads as one ink band. */
.shell-top {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}
.shell-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--ux25-header-min-h);
  padding: 0 var(--space-4);
}
.brand {
  margin: 0;
  font-size: var(--ux25-text-sm);
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--color-text);
  white-space: nowrap;
}
.lab-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-fine-2) var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--ux25-radius-sm);
  background: var(--ux25-surface-sunken);
  color: var(--color-muted);
  font-size: var(--ux25-text-2xs);
  letter-spacing: var(--ux25-tracking-caps);
  text-transform: uppercase;
  white-space: nowrap;
}
.topbar-spacer {
  flex: 1;
}
.user-chip {
  margin: 0;
  padding: var(--space-fine-2) var(--space-2);
  background: var(--ux25-surface-sunken);
  border: 1px solid var(--color-border);
  border-radius: var(--ux25-radius-sm);
  color: var(--color-muted);
  font-size: var(--ux25-text-xs);
}
.topbar-button {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--color-muted);
}
.topbar-button:hover:not(:disabled) {
  background: var(--ux25-surface-sunken);
  border-color: var(--color-border);
  color: var(--color-text);
}
.nav-toggle {
  display: none;
}

.shell-body {
  display: grid;
  grid-template-columns: auto 1fr;
  min-height: 0;
}

/* Deep-ink rail with inline glyphs. */
.rail {
  display: flex;
  flex-direction: column;
  gap: var(--space-fine-2);
  width: var(--ux25-rail-w);
  padding: var(--space-3) var(--space-2);
  background: var(--ux25-ink-900);
  border-right: 1px solid var(--ux25-ink-700);
  transition: width var(--motion-medium) ease;
}
.rail-collapsed {
  width: var(--ux25-rail-w-collapsed);
  overflow: hidden;
}
.rail-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: var(--ux25-rail-head-h);
  padding: 0 var(--space-1);
  margin-bottom: var(--space-fine-10);
}
.rail-identity {
  flex: 1;
  min-width: 0;
  font-size: var(--ux25-text-sm);
  font-weight: 600;
  color: var(--ux25-on-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rail-collapse {
  flex: 0 0 auto;
  width: 1.75rem;
  height: var(--ux25-rail-control-h);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--ux25-on-ink-muted);
}
.rail-collapse:hover:not(:disabled) {
  background: var(--ux25-ink-700);
  border-color: var(--ux25-ink-600);
  color: var(--ux25-on-ink);
}
.rail ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-fine-2);
}
.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-fine-10);
  width: 100%;
  padding: var(--space-fine-7) var(--space-2);
  border-radius: var(--ux25-radius-sm);
  background: transparent;
  color: var(--ux25-on-ink-muted);
  font: inherit;
  font-size: var(--ux25-text-sm);
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  box-shadow: none;
  transition:
    background-color var(--motion-fast) ease,
    color var(--motion-fast) ease;
}
.nav-link:hover {
  background: var(--ux25-ink-700);
  color: var(--ux25-on-ink);
}
.nav-link-active {
  background: var(--ux25-ink-700);
  color: var(--ux25-on-ink);
  box-shadow: inset 2px 0 0 var(--ux25-on-ink);
}
.nav-link-disabled {
  color: var(--ux25-ink-400);
  cursor: default;
}
/* The rail's focus ring is --ux25-on-ink-signal. Measured: 9.86:1 on --ux25-ink-900 and
   7.57:1 on --ux25-ink-700; --color-focus measures 3.03:1 and 2.32:1 on the same grounds.
   tests/web/slice22-visual-system-web.test.ts asserts this declaration's value. */
.rail :focus-visible {
  outline-color: var(--ux25-on-ink-signal);
}
/* The pending-application count on the Applications rail item (W4) — its own accent, tabular so
   the width is stable, pushed to the trailing edge of the nav row. */
.rail-count {
  margin-left: auto;
  min-width: 1.25rem;
  padding: 0 var(--space-1);
  text-align: center;
  font-size: var(--ux25-text-2xs);
  font-variant-numeric: tabular-nums;
  border-radius: 999px;
  background: var(--ux25-on-ink-signal);
  color: var(--ux25-ink-900);
  font-weight: 600;
}
.rail-collapsed .rail-count {
  display: none;
}
.rail-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
}
.rail-icon svg {
  width: 17px;
  height: 17px;
}
.rail-collapsed .rail-identity,
.rail-collapsed .rail-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.rail-collapsed .rail-head,
.rail-collapsed .nav-link {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

.main {
  padding: var(--space-4) var(--space-5);
  min-width: 0;
  overflow: auto;
}

/* The feedback region, constrained to the content column (D4) so it never overlays
   the rail, and sticky to the top of the content so it stays visible while the main
   content scrolls (IC-11). */
.main-feedback {
  position: sticky;
  top: 0;
  z-index: 20;
  margin-bottom: var(--space-4);
}

/* ---- Feedback region (IC-11), pinned under the top bar on a light band ---- */
.feedback {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-border);
  border-radius: var(--ux25-radius);
}
.feedback-ok {
  border-left-color: var(--feedback-ok-border);
  border-top-color: var(--tone-won-bg);
  border-right-color: var(--tone-won-bg);
  border-bottom-color: var(--tone-won-bg);
  background: var(--tone-won-bg);
  color: var(--tone-won-fg);
}
.feedback-error {
  border-left-color: var(--feedback-error-border);
  border-top-color: var(--tone-lost-bg);
  border-right-color: var(--tone-lost-bg);
  border-bottom-color: var(--tone-lost-bg);
  background: var(--tone-lost-bg);
  color: var(--tone-lost-fg);
}
.feedback-warn {
  border-left-color: var(--feedback-warn-border);
  border-top-color: var(--tone-warn-bg);
  border-right-color: var(--tone-warn-bg);
  border-bottom-color: var(--tone-warn-bg);
  background: var(--tone-warn-bg);
  color: var(--tone-warn-fg);
}
.feedback-body {
  flex: 1;
}
.feedback-title {
  margin: 0 0 var(--space-1);
  font-weight: 600;
  font-size: var(--ux25-text-sm);
}
.feedback-detail {
  margin: 0;
  font-size: var(--ux25-text-sm);
}
.feedback-dismiss {
  flex-shrink: 0;
}

/* ---- Opportunity toolbar (IC-02) ---- */
.surface-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.surface-head h1 {
  margin: 0;
}

/* Pipeline switcher (D2): its own bar above the board toolbar, set off by a rule, so
   switching the pipeline reads as a context switch distinct from filtering within it. */
.pipeline-switcher {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}
.pipeline-switcher-label {
  font-size: var(--ux25-text-2xs);
  font-weight: 600;
  letter-spacing: var(--ux25-tracking-caps);
  text-transform: uppercase;
  color: var(--color-muted);
}
.pipeline-switcher-options {
  display: inline-flex;
  gap: var(--space-2);
}
.pipeline-tab {
  font-size: var(--ux25-text-sm);
}
.pipeline-tab-active {
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  border-color: var(--color-accent);
}
.pipeline-tab-active:hover:not(:disabled) {
  background: var(--ux25-accent-hover);
  border-color: var(--ux25-accent-hover);
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  margin-bottom: var(--space-4);
}
.toolbar label {
  font-size: var(--ux25-text-xs);
  color: var(--color-muted);
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}
.toolbar select {
  font: inherit;
  font-size: var(--ux25-text-sm);
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--ux25-line-control);
  border-radius: var(--ux25-radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
}
.toolbar-spacer {
  flex: 1;
}
.view-toggle {
  display: inline-flex;
  border: 1px solid var(--ux25-line-control);
  border-radius: var(--ux25-radius-sm);
  overflow: hidden;
}
.view-toggle button {
  border: none;
  border-left: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  padding: var(--space-1) var(--space-3);
  font-size: var(--ux25-text-sm);
  cursor: pointer;
}
.view-toggle button:first-child {
  border-left: none;
}
.view-toggle button[aria-pressed='true'] {
  background: var(--color-accent);
  color: var(--color-accent-contrast);
}

/* ---- List view ---- */
.view-list {
  border: 1px solid var(--color-border);
  border-radius: var(--ux25-radius-lg);
  overflow: hidden;
  box-shadow: var(--ux25-shadow-sm);
}
/* The closed list clips row backgrounds to its rounded border. While a Stage menu is
   open, let that anchored popup escape the list's bounds; otherwise a short exact-record
   Dashboard drill (one or two rows) cuts off the lower destinations. The surrounding
   .main scroll region still owns viewport containment. */
.view-list:has(.stage-chip[aria-expanded='true']) {
  overflow: visible;
}

/* The whole row is the drawer opener (IC-03: the name inside it goes to the contact
   record instead); the former .list-open inner opener is gone with it. */
.list-row {
  display: grid;
  grid-template-columns: 2fr auto 1fr;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  cursor: pointer;
}
.list-row:last-child {
  border-bottom: none;
}
/* Slice 12 Unit 4 — the bulk-assign multi-select column. It exists only while the
   caller passes a selection (list view, live list), so rows without it keep the
   template above. */
.list-row:has(.list-select) {
  grid-template-columns: auto 2fr auto 1fr;
}
.list-select {
  display: inline-flex;
  align-items: center;
}
.list-select input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--color-accent);
}
.list-assignee {
  font-size: var(--ux25-text-sm);
  color: var(--color-muted);
}
.card-name {
  font-weight: 600;
  font-size: var(--ux25-text-sm);
}

/* ---- Boards: grouped by defined Stage order (B6) ---- */
/* The board ground is --ux25-surface, whose value the document's data-theme selects
   (tokens.css). Each stage region's wash is measured against this ground by
   tests/web/unit4-stage-palette-web.test.ts (:root) and
   tests/web/slice25-theme-board-web.test.ts (data-theme='dark'). */
.board-horizontal,
.board-vertical {
  background: var(--ux25-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--ux25-radius-lg);
  box-shadow: var(--ux25-shadow-sm);
  padding: var(--space-3);
}
.board-horizontal {
  display: flex;
  gap: var(--space-3);
  overflow-x: auto;
}
.board-horizontal .board-column {
  flex: 0 0 15rem;
  min-width: 15rem;
}
/* A consistent column body height so a board's presence is governed by the view, not by
   how many cards the pipeline happens to hold (review W2). Card sizing is already uniform
   across pipelines; without this floor a sparse board (e.g. a freshly populated onboarding
   pipeline) collapsed its columns to a fraction of a populated pipeline's height. The floor
   only sets a minimum — a busier column still grows past it. */
.board-horizontal .board-column-body {
  min-height: 16rem;
}
/* Vertical board: stacked Stage sections; its cards are governed separately from
   the horizontal board's density (B7) and laid out compactly in a grid. */
.board-vertical {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
/* The stage colour tokens, bound once per preset and consumed by every stage-tinted
   element (the board regions and the configuration surface's swatches). A stage
   whose stored colour is absent carries no attribute and keeps the neutral fallback
   below — nothing here re-derives a colour. */
[data-stage-color='sky'] {
  --stage-wash: var(--ux25-stage-sky-wash);
  --stage-edge: var(--ux25-stage-sky-edge);
}
[data-stage-color='mint'] {
  --stage-wash: var(--ux25-stage-mint-wash);
  --stage-edge: var(--ux25-stage-mint-edge);
}
[data-stage-color='lavender'] {
  --stage-wash: var(--ux25-stage-lavender-wash);
  --stage-edge: var(--ux25-stage-lavender-edge);
}
[data-stage-color='amber'] {
  --stage-wash: var(--ux25-stage-amber-wash);
  --stage-edge: var(--ux25-stage-amber-edge);
}
[data-stage-color='rose'] {
  --stage-wash: var(--ux25-stage-rose-wash);
  --stage-edge: var(--ux25-stage-rose-edge);
}
[data-stage-color='teal'] {
  --stage-wash: var(--ux25-stage-teal-wash);
  --stage-edge: var(--ux25-stage-teal-edge);
}
[data-stage-color='slate'] {
  --stage-wash: var(--ux25-stage-slate-wash);
  --stage-edge: var(--ux25-stage-slate-edge);
}
[data-stage-color='coral'] {
  --stage-wash: var(--ux25-stage-coral-wash);
  --stage-edge: var(--ux25-stage-coral-edge);
}

/* The wash covers the WHOLE stage region — heading, body, and empty state — in both
   board views (brief §4), never only a header strip. */
.board-column {
  background: var(--stage-wash, var(--ux25-surface-sunken));
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: var(--space-fine-10);
}
.board-vertical .board-column-body {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: var(--space-2);
}
/* The three text colours rendered directly on the wash are the two tokens the
   palette test measures against every preset. */
.board-column-title {
  display: flex;
  align-items: center;
  gap: var(--space-fine-7);
  margin: 0 0 var(--space-2);
  padding-bottom: var(--space-fine-7);
  border-bottom: 2px solid var(--stage-edge, var(--color-border));
  font-size: var(--ux25-text-sm);
  font-weight: 600;
  color: var(--ux25-stage-wash-text);
}
.board-column-count {
  font-family: var(--ux25-font-display);
  font-size: var(--ux25-text-lg);
  font-weight: 400;
  color: var(--ux25-stage-wash-text-muted);
}
.board-column-retired {
  margin-left: auto;
  padding: 0 var(--space-fine-5);
  border-radius: var(--ux25-radius-sm);
  background: var(--tone-neutral-bg);
  color: var(--tone-neutral-fg);
}
.board-column-empty {
  font-size: var(--ux25-text-xs);
  color: var(--ux25-stage-wash-text-muted);
  padding: var(--space-2) var(--space-1);
  margin: 0;
}
/* Permitted drop target — dashed signal outline plus a tinted field, so it reads
   without relying on hue alone. */
.board-column-drop-target {
  outline: 2px dashed var(--ux25-signal);
  outline-offset: -2px;
  background: var(--ux25-signal-soft);
}

/* ---- Stage colour swatch ---- */
.stage-swatch-row {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.stage-swatch {
  flex-shrink: 0;
  width: 0.875rem;
  height: 0.875rem;
  border-radius: var(--ux25-radius-sm);
  background: var(--stage-wash, var(--ux25-surface-sunken));
  border: 1px solid var(--stage-edge, var(--color-border));
}
.stage-swatch-label {
  font-size: var(--ux25-text-sm);
}

/* ---- Work card ---- */
.work-card {
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--ux25-radius);
  padding: var(--space-2) var(--space-fine-10);
  margin-bottom: var(--space-2);
  box-shadow: var(--ux25-shadow-xs);
  cursor: pointer;
  transition:
    border-color var(--motion-fast) ease,
    box-shadow var(--motion-fast) ease;
}
.board-vertical .board-column-body .work-card {
  margin-bottom: 0;
}
.work-card:hover {
  border-color: var(--ux25-line-strong);
  box-shadow: var(--ux25-shadow-md);
}
.work-card:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}
.work-card[draggable='true'] {
  cursor: grab;
}
.work-card-title {
  margin: 0;
  font-size: var(--ux25-text-sm);
  font-weight: 600;
  letter-spacing: -0.003em;
}
.work-card-meta {
  margin: var(--space-fine-3) 0 0;
  font-size: var(--ux25-text-xs);
  color: var(--color-muted);
}
.work-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-fine-6);
  margin-top: var(--space-fine-7);
}

/* ---- Stage chip + in-place move menu (IC-04) ---- */
.move-menu {
  position: relative;
  margin: 0;
}
.stage-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-fine-5);
  padding: var(--space-fine-2) var(--space-fine-7);
  border: 1px solid var(--color-border);
  border-radius: var(--ux25-radius-sm);
  background: var(--tone-progress-bg);
  color: var(--tone-progress-fg);
  font-size: var(--ux25-text-xs);
  font-weight: 500;
  box-shadow: none;
}
.stage-chip:hover:not(:disabled) {
  background: var(--color-surface);
  border-color: var(--ux25-accent-line);
}
.stage-chip[aria-expanded='true'] {
  background: var(--color-surface);
  border-color: var(--color-accent);
}
.stage-caret {
  font-size: 0.5625rem;
  opacity: 0.65;
}
.badge-symbol {
  color: var(--ux25-accent-bright);
}
/* The AnchoredMenu portal layer (menu.tsx): fixed positioning from the anchor's
   viewport rect, above the drawer and modal surfaces (z-index 45). The inline
   top/left are supplied by the primitive. */
.menu-portal {
  position: fixed;
  z-index: 60;
}
.move-menu-list {
  min-width: 12rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-fine-2);
  margin: 0;
  padding: var(--space-1);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--ux25-shadow-lg);
}
.move-option {
  border: 0;
  background: transparent;
  box-shadow: none;
  text-align: left;
  justify-content: flex-start;
  font-weight: 450;
  font-size: var(--ux25-text-sm);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.move-option:hover:not(:disabled) {
  background: var(--ux25-accent-soft);
}
.move-option-protected {
  color: var(--color-muted);
}
.move-option-tag {
  margin-left: auto;
  font-size: var(--ux25-text-2xs);
  letter-spacing: var(--ux25-tracking-caps);
  text-transform: uppercase;
  color: var(--ux25-lost-fg);
  background: var(--ux25-lost-bg);
  padding: 0 var(--space-fine-5);
  border-radius: var(--ux25-radius-sm);
}

/* ---- Status badge ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--ux25-text-xs);
  padding: var(--space-fine-2) var(--space-fine-7);
  border-radius: var(--ux25-radius-sm);
  background: var(--tone-neutral-bg);
  color: var(--tone-neutral-fg);
}
.badge-progress {
  background: var(--tone-progress-bg);
  color: var(--tone-progress-fg);
}
.badge-won {
  background: var(--tone-won-bg);
  color: var(--tone-won-fg);
}
.badge-lost {
  background: var(--tone-lost-bg);
  color: var(--tone-lost-fg);
}
/* A strong dedupe match — its own attention tone from the token set (not the loss tone). */
.badge-strong {
  background: var(--tone-warn-bg);
  color: var(--tone-warn-fg);
}

/* ---- Quick-view drawer (IC-05/06) ---- */
.drawer-scrim {
  position: fixed;
  inset: 0;
  background: var(--ux25-scrim);
  z-index: 44;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(var(--ux25-drawer-w), 100%);
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  box-shadow: var(--ux25-shadow-lg);
  z-index: 45;
  padding: var(--space-4);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}
.drawer h2 {
  margin: 0;
  font-size: var(--ux25-text-lg);
}
.drawer dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-1) var(--space-3);
  margin: 0;
  align-items: center;
}
.drawer dt {
  color: var(--color-muted);
  font-size: var(--ux25-text-sm);
}
.drawer dd {
  margin: 0;
}
.drawer-stage {
  overflow: visible;
}
/* Slice 10 §6 — the drawer's in-context control row: the Stage chip and the Status
   chip side by side, each opening its own menu in place (ux-selection 2026-08-10
   addendum). Wraps rather than overflowing at the narrow widths. */
.drawer-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}
/* A prompt that renders only for the choice that needs it — the outcome note on
   won/lost. Set apart from the control that opened it, not a standing form. */
.drawer-prompt {
  margin-top: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--ux25-surface-sunken);
}
.drawer-prompt-title {
  margin: 0 0 var(--space-2);
  font-size: var(--ux25-text-sm);
  font-weight: 560;
}
.drawer-prompt-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}
/* The reopen advisory, in the G5 cross-pipeline panel's shape (.disposition) and
   inside the drawer rather than in a modal. */
.drawer-warning {
  margin-top: var(--space-2);
}
.drawer-warning .disposition-actions {
  margin-top: var(--space-3);
  flex-wrap: wrap;
}
/* Each opportunity the advisory names is itself the button that opens it (owner early
   look, 2026-08-26). Full width and left-aligned so the whole line reads as one
   control, on the surface colour rather than the panel's warn wash so the affordance
   stands out against it. */
.advisory-links {
  list-style: none;
  margin: var(--space-3) 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.advisory-link {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  font-size: var(--ux25-text-sm);
}
.advisory-link:hover:not(:disabled) {
  border-color: var(--color-accent);
  background: var(--ux25-accent-soft);
}
.drawer-section {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-3);
}
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-2);
}
.field label {
  font-size: var(--ux25-text-sm);
  color: var(--color-muted);
}
.field select,
.field input,
.field textarea {
  font: inherit;
  font-size: var(--ux25-text-sm);
  padding: var(--space-2);
  border: 1px solid var(--ux25-line-control);
  border-radius: var(--ux25-radius);
  background: var(--color-surface);
  color: var(--color-text);
}
.activity {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.activity li {
  border: 1px solid var(--color-border);
  border-radius: var(--ux25-radius-sm);
  padding: var(--space-2);
  font-size: var(--ux25-text-sm);
}
.activity-meta {
  color: var(--color-muted);
}
/* The R2 note on a PENDING application (apps/web/src/submissions.tsx renders it directly
   after .submission-head), in the warn tone. The rule matches the pending card's note and not
   the promoted trace's, which keeps .activity-meta's muted register (Slice 18 D-3); asserted in
   tests/web/slice30-surfaces-web.test.ts. */
.submission-head + .erased-link-note {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--tone-warn-bg);
  border-left: 3px solid var(--feedback-warn-border);
  border-radius: var(--ux25-radius);
  background: var(--tone-warn-bg);
  color: var(--tone-warn-fg);
}

/* ---- Intake: add-candidate surface + dedupe disposition (brief §4) ---- */
.intake {
  margin-bottom: var(--space-4);
}
/* Add-candidate modal (D3): a centered overlay over the drawer scrim, dismissed by
   its close control, Escape, or an outside click. */
.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(34rem, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  overflow: auto;
  z-index: 45;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--ux25-shadow-lg);
}
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}
.modal-head h2 {
  margin: 0;
  font-size: var(--ux25-text-lg);
}
/* A borderless close glyph tucked into the top-right corner (F2). It keeps an
   accessible hit target and the shared focus ring (:focus-visible), and stays a real
   button for keyboard activation. */
.modal-close {
  flex: 0 0 auto;
  margin: calc(-1 * var(--space-2)) calc(-1 * var(--space-2)) 0 auto;
  padding: var(--space-1) var(--space-2);
  line-height: var(--ux25-line-height-tight);
  font-size: var(--ux25-text-xl);
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--color-muted);
}
.modal-close:hover:not(:disabled) {
  background: var(--ux25-surface-sunken);
  border-color: transparent;
  color: var(--color-text);
}
.modal-form {
  display: flex;
  flex-direction: column;
}
.intake-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
/* A denied field carries a non-color-only cue: an inset bar plus the aria-invalid
   state and the role="alert" message text (IC-13, IC-11). */
.field input[aria-invalid='true'],
.field select[aria-invalid='true'],
.field textarea[aria-invalid='true'] {
  border-color: var(--feedback-error-border);
  box-shadow: inset 2px 0 0 var(--feedback-error-border);
}
.field-error {
  margin: 0;
  font-size: var(--ux25-text-xs);
  color: var(--ux25-lost-fg);
}
.field-hint {
  margin: 0;
  font-size: var(--ux25-text-xs);
  color: var(--color-muted);
}
.dedupe {
  margin-top: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--feedback-warn-border);
  border-left-width: 3px;
  border-radius: var(--radius);
  background: var(--tone-warn-bg);
  color: var(--tone-warn-fg);
  max-width: 34rem;
}
.dedupe-lead {
  margin: 0 0 var(--space-2);
  font-size: var(--ux25-text-sm);
}
.dedupe-list {
  list-style: none;
  margin: 0 0 var(--space-3);
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.dedupe-match {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}
.dedupe-name {
  font-weight: 560;
  font-size: var(--ux25-text-sm);
}
.dedupe-signals {
  font-size: var(--ux25-text-xs);
}

/* ---- Pre-write dedupe decision, shown inside the add-candidate modal (B1/D3) ---- */
.disposition {
  padding: var(--space-3);
  border: 1px solid var(--feedback-warn-border);
  border-left-width: 3px;
  border-radius: var(--radius);
  background: var(--tone-warn-bg);
  color: var(--tone-warn-fg);
}
.disposition .feedback-title {
  margin: 0 0 var(--space-1);
  font-weight: 600;
  font-size: var(--ux25-text-sm);
}
.disposition .feedback-detail {
  margin: 0;
  font-size: var(--ux25-text-sm);
}
.disposition .dedupe-list {
  margin-top: var(--space-2);
  margin-bottom: var(--space-3);
}
.disposition-note {
  margin: 0 0 var(--space-3);
  font-size: var(--ux25-text-xs);
}
.disposition-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* ---- Contacts surface (Slice 10 §4: column-configurable, sortable, filterable) ---- */
.contacts-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(16rem, 1fr);
  gap: var(--space-4);
  align-items: start;
}
/* The list block: filter bar, sortable header, and the listbox of rows. The header
   and every row share one grid template, carried in --contacts-grid (set inline by
   the surface from the visible column set — the value is data, the styling is here,
   the same split AnchoredMenu uses for its anchor-derived position). */
.contacts-table {
  min-width: 0;
}
.contacts-filterbar {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.contacts-filter {
  flex: 1;
  min-width: 0;
}
.contacts-columns-head,
.contacts-table .contacts-row {
  display: grid;
  grid-template-columns: var(--contacts-grid);
  gap: var(--space-2);
  align-items: center;
}
.contacts-columns-head {
  padding: 0 var(--space-3);
}
.contacts-sort {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  justify-content: flex-start;
  min-width: 0;
  padding: var(--space-1) 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  color: var(--color-muted);
  font: inherit;
  font-size: var(--ux25-text-xs);
  font-weight: 560;
  letter-spacing: var(--ux25-tracking-caps);
  text-transform: uppercase;
  cursor: pointer;
}
.contacts-sort:hover {
  color: var(--color-text);
}
.contacts-sort-active {
  color: var(--color-text);
}
.contacts-sort-arrow {
  font-size: 0.5625rem;
}
.contacts-column-mark {
  display: inline-block;
  width: 1em;
}
.contacts-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--color-surface);
}
/* Base row treatment, shared with the merge picker's stacked rows (merge.tsx),
   which keep the pre-unit name-over-sub shape; the workspace table overrides the
   layout to its column grid above. */
.contacts-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-fine-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background: transparent;
  border: 0;
  box-shadow: none;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
}
.contacts-list > li + li {
  border-top: 1px solid var(--color-border);
}
.contacts-table .contacts-row + .contacts-row {
  border-top: 1px solid var(--color-border);
}
.contacts-row:hover {
  background: var(--ux25-surface-sunken);
}
.contacts-row-active {
  background: var(--ux25-accent-soft);
  box-shadow: inset 2px 0 0 var(--color-accent);
}
.contacts-cell {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--ux25-text-sm);
}
.contacts-row-name {
  font-weight: 560;
  font-size: var(--ux25-text-sm);
}
.contacts-row-sub {
  font-size: var(--ux25-text-xs);
}
.contacts-empty {
  padding: var(--space-4);
}
/* The workspace list's empty and no-match states (review N6). The listbox holds
   `option` children only, so with no rows it has no children at all and collapses to
   its own two borders — a hairline box above the message. It is hidden while empty,
   and the message that stands in its place carries the surface treatment the list
   would have had, so both states render as the list they replace rather than as bare
   text under an empty rule. Scoped to `.contacts-table`: the same class names the
   detail column's "Loading the contact…" and "Select a contact…" placeholders, which
   sit outside the list and are unchanged. */
.contacts-table .contacts-list:empty {
  display: none;
}
.contacts-table .contacts-empty {
  margin: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
}
/* IC-03: the contact name on an opportunity card or list row is its own control,
   going to the contact record, distinct from the surrounding open-the-drawer
   surface. */
.contact-name-link {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
}
.contact-name-link:hover,
.contact-name-link:focus-visible {
  color: var(--color-accent);
  text-decoration: underline;
}
/* The contact record's linked opportunities across pipelines (Slice 10 §4). */
.contact-opportunities {
  margin-top: var(--space-4);
}
.contact-opportunities h3 {
  margin: 0 0 var(--space-2);
  font-size: var(--ux25-text-sm);
}
.contact-opportunity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.contact-opportunity {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-1) var(--space-2);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: none;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
  font-size: var(--ux25-text-sm);
}
.contact-opportunity:hover {
  background: var(--ux25-surface-sunken);
  border-color: var(--ux25-accent-line);
}
.contact-opportunity-pipeline {
  font-weight: 560;
}
.contact-opportunity-stage {
  color: var(--color-muted);
}
.contact-detail {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  padding: var(--space-4);
}
/* The back affordance for the narrow-width master/detail swap (review W3). Hidden where
   both columns show side by side (the list is already visible); revealed at <=720. */
.contacts-back {
  display: none;
  align-items: center;
  align-self: flex-start;
  margin-bottom: var(--space-3);
  padding: var(--space-1) var(--space-2);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text);
  font: inherit;
  font-size: var(--ux25-text-sm);
  cursor: pointer;
}
.contacts-back:hover {
  background: var(--ux25-surface-sunken);
}
.contact-detail h2 {
  margin: 0 0 var(--space-3);
  font-size: var(--ux25-text-lg);
}
.contact-detail dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-2) var(--space-3);
  margin: 0;
}
.contact-detail dt {
  color: var(--color-muted);
  font-size: var(--ux25-text-sm);
}
.contact-detail dd {
  margin: 0;
  font-size: var(--ux25-text-sm);
}

/* ---- Containment at the four widths (IC-13) ---- */
/* Only the horizontal board owns horizontal overflow; the document never does. */
@media (max-width: 1280px) {
  .main {
    padding: var(--space-4);
  }
}
@media (max-width: 720px) {
  /* Q11: at narrow widths the rail becomes an off-canvas drawer toggled by the
     Menu button, keyboard-accessible, with containment preserved. */
  .nav-toggle {
    display: inline-flex;
  }
  .shell-body {
    grid-template-columns: 1fr;
  }
  .rail {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 43;
    transform: translateX(-100%);
    transition: transform var(--motion-medium);
  }
  .rail-open {
    transform: translateX(0);
  }
  .list-row {
    grid-template-columns: 1fr auto;
  }
  .list-assignee {
    display: none;
  }
  .drawer {
    width: 100%;
  }
  .contacts-layout {
    grid-template-columns: 1fr;
  }
  /* Master/detail swap (review W3): with only one column of width, a selected contact
     shows the detail in place of the list (reachable, readable) instead of stacked far
     below it. The back control returns to the list. */
  .contacts-layout-detail .contacts-table {
    display: none;
  }
  .contacts-back {
    display: inline-flex;
  }
}
@media (max-width: 375px) {
  .main {
    padding: var(--space-3);
  }
  .surface-head {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Slice 3 Unit 4 — handoff production experience. Composed from tokens only; no
   hardcoded color, spacing, or type. */

/* Dev-build-only bar (the principal switcher). Warn-toned so it reads plainly as a
   nonproduction tool; structurally absent from a production build. */
.dev-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding: var(--space-2) var(--space-4);
  background: var(--tone-warn-bg);
  color: var(--tone-warn-fg);
  border-bottom: 1px solid var(--color-border);
  font-size: var(--ux25-text-sm);
}
.dev-bar-tag {
  font-weight: 700;
  letter-spacing: var(--ux25-tracking-caps);
  text-transform: uppercase;
  font-size: var(--ux25-text-2xs);
  padding: var(--space-1) var(--space-2);
  border: 1px solid currentColor;
  border-radius: var(--radius);
}
.dev-bar .field {
  flex-direction: row;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
}
.dev-bar .field label {
  margin: 0;
  white-space: nowrap;
}
.dev-bar-note {
  flex: 1 1 16rem;
}

/* Lineage on an onboarding opportunity. */
.lineage-origin {
  font-size: var(--ux25-text-sm);
  color: var(--color-text);
}
/* Slice 10 §6 — the facts read off the lineage chain and the opportunity's own
   activity, beside the one-line origin: the origin's stage, the time between the
   origin and the handoff, and who performed it. */
.lineage-facts {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-1) var(--space-3);
  margin: var(--space-2) 0 0;
  font-size: var(--ux25-text-sm);
}
.lineage-facts dt {
  color: var(--color-muted);
}
.lineage-facts dd {
  margin: 0;
}
/* D-1 (ruled): the stated absence reads as ordinary fact, not an error — the same muted
   treatment .lineage-facts dt already carries above. */
.lineage-fact-absent {
  color: var(--color-muted);
}
.lineage-events {
  margin-top: var(--space-3);
}
.lineage-events-title {
  margin: 0 0 var(--space-2);
  font-size: var(--ux25-text-sm);
  font-weight: 560;
  color: var(--color-muted);
}

/* The direct-entry action on a contact's record. */
.contact-actions {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* The dev force-conflict control reads as a dev tool: a dashed divider sets it apart. */
.dev-force-conflict {
  border-top-style: dashed;
}

/* Slice 18 Unit 4 (D-3, E2, E6): the standing fact on an erased contact's record page.
   Ordinary fact, not a warning — no error/warning colour, no icon, `--color-muted` only,
   the same discipline `.lineage-fact-absent` carries. Deliberately its own class rather
   than `.merge-redirect-note`, whose warn-toned border this is not. */
.contact-erasure-note {
  margin: 0 0 var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-muted);
  font-size: var(--ux25-text-sm);
}

/* Slice 18 Unit 4 (D-5, D14): the erase confirm-and-execute panel, in merge.tsx's
   "What confirming will change" neutral (non-warning) box — rendered in place, never a
   modal. */
.erase-confirm {
  margin-top: var(--space-4);
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
}
.erase-confirm h3 {
  margin: 0 0 var(--space-2);
  font-size: var(--ux25-text-sm);
}
.erase-confirm-list {
  margin: 0 0 var(--space-3);
  padding-left: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  font-size: var(--ux25-text-sm);
}

/* Slice 4 Unit 4 — the public application surface. Composed only from tokens; it forks no
   token and owns no colour, spacing, or type. Mobile-first: the base rules target the 375
   primary width (a single full-width column); wider widths only centre and cap the card.
   The frame is intentionally different from the authenticated Shell — no rail, no session
   chip, no navigation — because an anonymous candidate has none of those. */
.public {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
}
.public-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding: var(--space-3) var(--space-4);
  background: var(--ux25-ink-800);
  color: var(--color-accent-contrast);
}
.public-brand {
  margin: 0;
  font-weight: 660;
  letter-spacing: var(--ux25-tracking-caps);
  text-transform: uppercase;
  font-size: var(--ux25-text-sm);
}
.public-main {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: var(--space-4);
}
.public-card {
  width: 100%;
  max-width: 34rem;
  align-self: flex-start;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--ux25-radius-lg);
  box-shadow: var(--ux25-shadow-sm);
  padding: var(--space-5);
}
.public-card h1 {
  margin: 0 0 var(--space-2);
}
.public-message p {
  color: var(--color-muted);
  margin: var(--space-2) 0 0;
}
.public-note {
  color: var(--color-muted);
  font-size: var(--ux25-text-sm);
  margin: 0 0 var(--space-4);
}
.public-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
/* The submit error region (IC-11 semantics on the public page): announced via role="alert",
   never steals focus, and the form keeps every entered value for correction. */
.public-error {
  margin: var(--space-2) 0 0;
  padding: var(--space-3);
  border: 1px solid var(--feedback-error-border);
  border-radius: var(--ux25-radius-sm);
  background: var(--tone-lost-bg);
  color: var(--tone-lost-fg);
  font-size: var(--ux25-text-sm);
}
.public-actions {
  margin-top: var(--space-4);
}
.public-actions .button {
  width: 100%;
}
@media (min-width: 721px) {
  .public-main {
    padding: var(--space-6) var(--space-4);
  }
  .public-actions .button {
    width: auto;
  }
}

/* Slice 4 Unit 4 — the authenticated promotion (Applications) surface. Tokens only. */
.submissions-intro {
  max-width: 44rem;
}
.submission-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.submission-card {
  border: 1px solid var(--color-border);
  border-radius: var(--ux25-radius);
  background: var(--color-surface);
  box-shadow: var(--ux25-shadow-xs);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.submission-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.submission-answers {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(8rem, max-content) 1fr;
  gap: var(--space-1) var(--space-3);
}
.submission-answer {
  display: contents;
}
.submission-answer dt {
  font-size: var(--ux25-text-sm);
  color: var(--color-muted);
}
.submission-answer dd {
  margin: 0;
  font-size: var(--ux25-text-sm);
  color: var(--color-text);
}
.submission-matches {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-3);
}
.submission-matches-title {
  margin: 0 0 var(--space-2);
  font-size: var(--ux25-text-sm);
  font-weight: 640;
}
.submission-activity {
  display: block;
}
.submission-suggestion {
  margin: 0;
  font-size: var(--ux25-text-sm);
  color: var(--tone-progress-fg);
  background: var(--tone-progress-bg);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--ux25-radius-sm);
}
/* The held-pending (merge) state: warn-toned, honest — not the error tone. */
.submission-held {
  margin: 0;
  font-size: var(--ux25-text-sm);
  color: var(--tone-warn-fg);
  background: var(--tone-warn-bg);
  border: 1px solid var(--feedback-warn-border);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--ux25-radius-sm);
}
.submission-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
}
.submission-action {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
/* The merge action stacks its controls over a standing note: merge names the eventual action,
   and the note tells the truth about what happens now (survivorship isn't available yet). */
.submission-action-merge {
  flex-direction: column;
  align-items: flex-start;
}
.submission-action-controls {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.submission-merge-note {
  margin: var(--space-1) 0 0;
  max-width: 24rem;
}
/* The advisory "Suggested" marker — informational, not a selected/pressuring state. */
.suggested-tag {
  font-size: var(--ux25-text-2xs);
  letter-spacing: var(--ux25-tracking-caps);
  text-transform: uppercase;
  color: var(--color-muted);
}
@media (max-width: 720px) {
  .submission-answers {
    grid-template-columns: 1fr;
    gap: 0 0;
  }
  .submission-answer dt {
    margin-top: var(--space-2);
  }
  .submission-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .submission-action {
    justify-content: space-between;
  }
}

/* Slice 11 Dashboard. This is the narrowly owner-authorized shared treatment for
   the Dashboard cards, controls, funnel and semantic table; every value comes from
   the existing token layer. */
.dashboard-scope,
.dashboard-window,
.dashboard-section-head p,
.dashboard-coverage,
.dashboard-comparison {
  margin: 0;
  color: var(--color-muted);
  font-size: var(--ux25-text-sm);
}
.dashboard-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--ux25-radius);
  background: var(--color-surface);
}
.dashboard-controls .field {
  min-width: min(100%, 14rem);
}
.dashboard-window {
  margin-bottom: var(--space-4);
}
.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.dashboard-card {
  min-width: 0;
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--ux25-radius);
  background: var(--color-surface);
  box-shadow: var(--ux25-shadow-xs);
}
.dashboard-card h2 {
  margin: 0 0 var(--space-3);
  font-size: var(--ux25-text-sm);
}
.dashboard-count,
.dashboard-trend {
  margin: 0 0 var(--space-2);
}
.dashboard-count-action {
  font-size: var(--ux25-text-xl);
  font-weight: 640;
  font-variant-numeric: tabular-nums;
}
.dashboard-trend {
  font-weight: 600;
}
.dashboard-comparison {
  margin-bottom: var(--space-3);
}
.dashboard-funnel {
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--ux25-radius);
  background: var(--color-surface);
}
.dashboard-section-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.dashboard-section-head h2 {
  margin: 0 0 var(--space-1);
  font-size: var(--ux25-text-lg);
}
.dashboard-empty {
  padding: var(--space-3);
  background: var(--ux25-surface-sunken);
  color: var(--color-muted);
}
.dashboard-funnel-visual {
  list-style: none;
  margin: 0 0 var(--space-5);
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.dashboard-funnel-stage {
  display: grid;
  grid-template-columns: minmax(10rem, 1fr) minmax(8rem, 2fr) minmax(14rem, auto);
  align-items: center;
  gap: var(--space-3);
}
.dashboard-stage-label,
.dashboard-stage-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.dashboard-funnel-stage progress {
  width: 100%;
  accent-color: var(--color-accent);
}
.dashboard-table-scroll {
  max-width: 100%;
  overflow-x: auto;
}
.dashboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--ux25-text-sm);
}
.dashboard-table caption {
  text-align: left;
  font-weight: 640;
  margin-bottom: var(--space-2);
}
.dashboard-table th,
.dashboard-table td {
  padding: var(--space-2);
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  vertical-align: middle;
}

@media (max-width: 1280px) {
  .dashboard-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dashboard-funnel-stage {
    grid-template-columns: minmax(9rem, 1fr) minmax(8rem, 2fr);
  }
  .dashboard-stage-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .dashboard-cards {
    grid-template-columns: 1fr;
  }
  .dashboard-section-head,
  .dashboard-stage-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .dashboard-funnel-stage {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 375px) {
  .dashboard-controls,
  .dashboard-funnel,
  .dashboard-card {
    padding: var(--space-3);
  }
}

/* Slice 5 Unit 4 — the contact merge surface, its picker, and the reference-redirect
   note. Every colour is a token. Spacing, type and shape follow the patterns already in
   this file, which include literal values (review m2). */

/* A labeled group of mutually exclusive options rendered as pressed-state buttons — the
   treatment the pipeline switcher established, so the merge surface introduces no second
   selection language. */
.choice-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.choice-group-legend {
  font-size: var(--ux25-text-xs);
  letter-spacing: var(--ux25-tracking-caps);
  text-transform: uppercase;
  color: var(--color-muted);
}
.choice-group-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  align-items: stretch;
}
.choice-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-fine-2);
  padding: var(--space-2) var(--space-3);
  text-align: left;
  min-width: 0;
}
/* Selected state carries a mark and a border weight, not colour alone (IC-13). */
.choice-option-selected {
  border-color: var(--color-accent);
  background: var(--ux25-accent-soft);
  box-shadow: inset 2px 0 0 var(--color-accent);
}
.choice-option-mark {
  font-size: var(--ux25-text-xs);
  color: var(--color-accent);
  min-height: 1em;
}
.choice-option-label {
  font-size: var(--ux25-text-sm);
  font-weight: 560;
  overflow-wrap: anywhere;
}
.choice-option-detail {
  font-size: var(--ux25-text-xs);
  color: var(--color-muted);
  overflow-wrap: anywhere;
}

/* The merge dialog itself: the shared modal frame, widened for two records side by side
   and scrollable so it stays document-contained at every width. */
.merge-surface,
.merge-picker {
  width: min(46rem, calc(100vw - var(--space-5)));
  max-height: calc(100vh - var(--space-5));
  overflow-y: auto;
}
.merge-lead {
  margin: 0 0 var(--space-3);
}
.merge-survivor {
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--ux25-surface-sunken);
}
.merge-fields {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-4);
}
.merge-field-same {
  display: flex;
  flex-direction: column;
  gap: var(--space-fine-2);
  margin: 0;
  font-size: var(--ux25-text-sm);
}
.merge-summary {
  margin-top: var(--space-4);
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
}
.merge-summary h3 {
  margin: 0 0 var(--space-2);
  font-size: var(--ux25-text-sm);
}
.merge-summary-list {
  margin: 0;
  padding-left: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  font-size: var(--ux25-text-sm);
}
.merge-denial {
  margin-top: var(--space-4);
}
.merge-collisions {
  margin-top: var(--space-2);
  margin-bottom: var(--space-3);
}
.merge-actions {
  margin-top: var(--space-4);
}
.merge-picker-list {
  margin-top: var(--space-3);
  margin-bottom: var(--space-3);
  max-height: 18rem;
  overflow-y: auto;
}
/* The invariant-2.15 redirect note on a resolved reference. */
.merge-redirect-note {
  margin: 0 0 var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--feedback-warn-border);
  border-left-width: 3px;
  border-radius: var(--radius);
  background: var(--tone-warn-bg);
  color: var(--tone-warn-fg);
  font-size: var(--ux25-text-sm);
}
.contact-activity {
  margin-top: var(--space-4);
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-3);
}
.contact-activity h3 {
  margin: 0 0 var(--space-2);
  font-size: var(--ux25-text-sm);
}

/* ---- Configuration surface (Slice 6 Unit 4) ---- */
.settings-lead {
  margin: 0 0 var(--space-4);
  max-width: 46rem;
  font-size: var(--ux25-text-sm);
  color: var(--color-muted);
}
/* A refused write, held above the panels with the recovery path beside it (IC-11). */
.settings-failure {
  margin-bottom: var(--space-4);
  padding: var(--space-3);
  border: 1px solid var(--feedback-error-border);
  border-left-width: 3px;
  border-radius: var(--radius);
  background: var(--tone-lost-bg);
  color: var(--tone-lost-fg);
}
.settings-failure .button {
  margin-top: var(--space-2);
}
.settings-panel {
  margin-bottom: var(--space-4);
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  box-shadow: var(--ux25-shadow-xs);
}
.settings-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border);
}
.settings-panel h2 {
  margin: 0;
  font-size: var(--ux25-text-lg);
}
.settings-panel h3 {
  margin: var(--space-4) 0 var(--space-2);
  font-size: var(--ux25-text-2xs);
  font-weight: 600;
  letter-spacing: var(--ux25-tracking-caps);
  text-transform: uppercase;
  color: var(--color-muted);
}
.settings-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.settings-row .field {
  flex: 1 1 14rem;
  min-width: 0;
  margin: 0;
}
.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.settings-stages {
  list-style: none;
  margin: 0;
  padding: 0;
}
.settings-stage {
  padding: var(--space-3);
  margin-bottom: var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--ux25-radius-sm);
  background: var(--ux25-surface-sunken);
}
.settings-stage-key {
  font-family: var(--ux25-font-numeric);
  font-size: var(--ux25-text-xs);
  color: var(--color-muted);
}
/* The one-way confirmation: retirement cannot be undone in this slice, so the control
   states that before it acts. */
.settings-confirm {
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--feedback-warn-border);
  border-left-width: 3px;
  border-radius: var(--radius);
  background: var(--tone-warn-bg);
  color: var(--tone-warn-fg);
}
.settings-confirm .button {
  margin: var(--space-2) var(--space-2) 0 0;
}
.settings-outcome,
.settings-retired {
  margin-top: var(--space-4);
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border);
}
.settings-add {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}
.settings-add .button {
  margin-top: var(--space-2);
}
/* Eight preset swatches: a denser grid than the two-column ChoiceGroup default, so the
   whole palette is visible at once without the picker owning the panel. */
.stage-color-picker .choice-group-options {
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
}

@media (max-width: 720px) {
  /* One column of width: the two records stack. Each option keeps the record's name on
     its own line, so which record a value came from stays readable when they are no
     longer beside each other. */
  .choice-group-options {
    grid-template-columns: 1fr;
  }
  .merge-surface,
  .merge-picker {
    width: calc(100vw - var(--space-4));
  }
  /* The configuration surface stacks: a row's field takes the full width and its
     controls sit under it, so nothing is pushed past the document edge (IC-13). */
  .settings-row {
    align-items: stretch;
  }
  .settings-row .field {
    flex-basis: 100%;
  }
}

/* ---- Slice 10 §7 — the promotion trace ----
   Two mount points, one visual treatment: the promoted section of the Applications
   surface, and the derived entry the drawer's Activity list carries. The difference
   rows are read-only; nothing here is a control. */
.promoted-section {
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}
.promoted-section-title {
  margin: 0 0 var(--space-1);
  font-size: var(--ux25-text-base);
  font-weight: 640;
}
.promoted-section-note {
  margin: 0 0 var(--space-3);
  max-width: 44rem;
}
.promotion-entry {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.promotion-entry-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}
.promotion-entry-line {
  margin: 0;
  font-size: var(--ux25-text-sm);
}
/* The derived entry inside the drawer's Activity list: the same list item treatment as
   every other entry, with the trace's own block flowing inside it. */
.activity-promotion {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.promotion-differences {
  border: 1px solid var(--color-border);
  border-radius: var(--ux25-radius-sm);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.promotion-differences-title {
  margin: 0;
  font-size: var(--ux25-text-sm);
  font-weight: 640;
}
.promotion-basis {
  margin: 0;
  font-size: var(--ux25-text-xs);
  max-width: 44rem;
}
.promotion-difference-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.promotion-difference {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  font-size: var(--ux25-text-sm);
}
.promotion-difference-field {
  margin: 0;
  font-weight: 560;
}
.promotion-difference-values {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(8rem, max-content) 1fr;
  gap: var(--space-1) var(--space-3);
}
.promotion-difference-values dt {
  color: var(--color-muted);
}
.promotion-difference-values dd {
  margin: 0;
  color: var(--color-text);
}
.promotion-value-record {
  color: var(--color-muted);
}
@media (max-width: 720px) {
  .promotion-difference-values {
    grid-template-columns: 1fr;
    gap: 0 0;
  }
  .promotion-difference-values dt {
    margin-top: var(--space-2);
  }
}

/* ---- Slice 13 Unit 5: workspace picker, capture control, support surfaces ---- */
.workspace-picker-trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  max-width: 16rem;
}
.workspace-picker-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.workspace-menu-option[aria-current='true'] {
  font-weight: 640;
}
.feedback-actions {
  margin-top: var(--space-2);
}
.report-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.report-card {
  border: 1px solid var(--color-border);
  border-radius: var(--ux25-radius);
  background: var(--color-surface);
  box-shadow: var(--ux25-shadow-xs);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.report-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
}
.report-state {
  font-size: var(--ux25-text-2xs);
  letter-spacing: var(--ux25-tracking-caps);
  text-transform: uppercase;
  padding: 0 var(--space-fine-5);
  border-radius: var(--ux25-radius-sm);
  border: 1px solid var(--color-border);
  color: var(--color-muted);
}
.report-facts {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(8rem, max-content) 1fr;
  gap: var(--space-1) var(--space-3);
}
.report-facts dt {
  font-size: var(--ux25-text-sm);
  color: var(--color-muted);
}
.report-facts dd {
  margin: 0;
  font-size: var(--ux25-text-sm);
  color: var(--color-text);
}
.report-body {
  margin: 0;
  white-space: pre-wrap;
}
.report-notes {
  list-style: none;
  margin: 0;
  padding: var(--space-2) 0 0;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.report-note-meta {
  font-size: var(--ux25-text-sm);
  color: var(--color-muted);
}
.report-note-text {
  margin: 0;
  white-space: pre-wrap;
}
.report-actions {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
}
.report-refusal {
  margin: 0;
}
/* ---- Slice 29 Unit 3 (Track C): the workspace picker's agency heading (D-4c) ---- */
.workspace-menu-agency {
  padding: var(--space-2) var(--space-3);
  font-size: var(--ux25-text-xs);
  color: var(--color-muted);
}
/* One agency's options inside their labelled group: the column and gap .move-menu-list declares. */
.workspace-menu-agency-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-fine-2);
}
/* ---- End Slice 29 Unit 3 (Track C) ---- */
