/* cansr.css — shared stylesheet */

/* ── fonts ── */
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("fonts/AtkinsonHyperlegibleNext-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("fonts/AtkinsonHyperlegibleNext-Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("fonts/AtkinsonHyperlegibleNext-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

/* ── design tokens ── */
:root {
  /* colour */
  --primary: oklch(0.322 0.065 161);
  --brand: var(--primary);
  --accent: oklch(0.58 0.128 161);
  --accent-soft: oklch(0.91 0.05 161);
  --bg-dark: oklch(0.943 0.003 265);
  --bg: oklch(0.968 0.003 265);
  --bg-light: #fff;
  --surface: #fff;
  --text: oklch(0.221 0.01 264);
  --text-2: oklch(0.35 0.012 265);
  --muted: oklch(0.50 0.014 265);
  --border: oklch(0.88 0.009 258);
  --border-soft: oklch(0.93 0.007 258);
  --attention: oklch(0.32 0.2 240);
  --attention-tint: oklch(0.95 0.025 240);
  --attention-line: oklch(0.32 0.2 240 / 0.35);
  --danger: oklch(0.579 0.214 27);
  --gold: oklch(0.786 0.16 85);

  /* alpha variants and state colours */
  --primary-dark: oklch(0.3 0.07 162); /* darkened brand — hover state only */
  --bg-dark-50: oklch(94% 0.005 255 / 0.5); /* bg-dark at 50% alpha */
  --ok-line: oklch(72% 0.09 155 / 0.35); /* positive signal border */
  --ok-line-30: oklch(72% 0.09 155 / 0.3); /* ok-line at 30% alpha */
  --warn-line: oklch(70% 0.12 70 / 0.4); /* warning signal border */
  --err-line: oklch(68% 0.15 28 / 0.35); /* error signal border */
  --err-line-30: oklch(68% 0.15 28 / 0.3); /* err-line at 30% alpha */
  /* state text + fill pairs (UX-30: moved from #detail-panel) */
  --ok-fg: oklch(38% 0.09 155);
  --ok-bg: oklch(95% 0.04 155);
  --warn-fg: oklch(42% 0.11 70);
  --warn-bg: oklch(96% 0.05 80);
  --err-fg: oklch(42% 0.14 28);
  --err-bg: oklch(96% 0.03 28);
  --warn-line-solid: oklch(70% 0.12 70); /* opaque warn-line, for a fill */
  --backdrop: oklch(20% 0.01 264 / 0.45); /* modal backdrop */
  --danger-shadow: oklch(0.579 0.214 27 / 0.08); /* danger at 8% alpha */
  --accent-focus:  oklch(0.58 0.128 161 / 0.12); /* accent focus ring shadow */
  --gloss-sm:      oklch(100% 0 none / 0.12);    /* white inset button gloss */
  --shadow-sm: oklch(0% 0 none / 0.08); /* small shadow colour */
  --shadow-md: oklch(0% 0 none / 0.16); /* medium shadow colour */

  /* pipeline state dot tokens */
  --state-queued-dot:     oklch(0.62 0.09 255);
  --state-processing-dot: oklch(0.78 0.16 85);
  --state-complete-dot:   var(--accent);
  --state-errored-dot:    var(--danger);

  /* stuck-label tokens */
  --state-stuck-bg:     oklch(0.95 0.03 85);
  --state-stuck-text:   oklch(0.52 0.14 85);
  --state-stuck-border: var(--warn-line);

  /* outcome chip tokens */
  --chip-running-bg:        oklch(0.94 0.025 255);
  --chip-running-text:      oklch(0.40 0.06 255);
  --chip-running-border:    oklch(0.62 0.09 255 / 0.4);
  --chip-processing-bg:     oklch(0.95 0.03 85);
  --chip-processing-text:   oklch(0.52 0.14 85);
  --chip-processing-border: oklch(0.70 0.12 85 / 0.4);
  --chip-complete-bg:       oklch(0.94 0.03 155);
  --chip-complete-text:     oklch(0.35 0.12 155);
  --chip-complete-border:   oklch(0.50 0.12 155 / 0.35);
  --chip-partial-bg:        oklch(0.95 0.03 85);
  --chip-partial-text:      oklch(0.52 0.14 85);
  --chip-failed-bg:         oklch(0.95 0.025 27);
  --chip-failed-text:       oklch(0.45 0.18 27);

  /* user badge tokens */
  --badge-super-admin-bg:     oklch(0.93 0.03 161);
  --badge-super-admin-text:   oklch(0.32 0.065 161);
  --badge-super-admin-border: oklch(0.58 0.128 161 / 0.3);
  --badge-current-user-bg:    var(--chip-running-bg);

  /* shadows */
  --shadow-row: 0 1px 2px oklch(0% 0 none / 0.03);
  --shadow-row-hover:
    0 1px 2px oklch(0% 0 none / 0.04), 0 6px 18px -8px oklch(0% 0 none / 0.1);

  /* radii */
  --radius-sm: 0.3rem;
  --radius: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-full: 999px;

  /* layout */
  --size-topbar-height: 3.5rem;

  /* type scale — φ^(n/2) */
  --text-minus-2: 0.618rem;
  --text-minus-1: 0.786rem;
  --text-0: 1rem;
  --text-plus-half: 1.128rem;
  --text-plus-1: 1.272rem;
  --text-plus-2: 1.618rem;
  --text-plus-3: 2.058rem;
  --text-plus-4: 2.618rem;
  --lh: 1.618;

  /* spacing — φ^n, used in radiologist */
  --space-xs: 0.236rem;
  --space-sm: 0.382rem;
  --space-md: 0.618rem;
  --space-lg: 1rem;
  --space-xl: 1.618rem;
  --space-2xl: 2.618rem;
}

/* ── reset ── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: var(--bg-dark);
  font-family:
    "Atkinson Hyperlegible Next",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  color: var(--text);
  line-height: var(--lh);
}

a {
  text-decoration: none;
  color: inherit;
}

/* ── utility ── */
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* ── form field ── */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}
.field label {
  font-size: var(--text-minus-1);
  font-weight: 600;
  color: var(--text);
  line-height: 1.618;
  transition: color 150ms;
}
.field:has(input:focus-visible, select:focus-visible) label {
  color: var(--brand);
}
.field input,
.field select {
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-md) var(--space-lg);
  min-height: 44px;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 150ms, box-shadow 150ms, background-color 150ms;
}
.field input:hover,
.field select:hover {
  border-color: var(--muted);
}
.field input:focus-visible,
.field select:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--accent-focus);
}
/* ── buttons ── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--brand);
  border: 1px solid var(--brand);
  color: #fff;
  font: inherit;
  padding: var(--space-md) var(--space-lg);
  min-height: 44px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: opacity 150ms;
}
.btn-primary.is-danger {
  background: var(--danger);
  border-color: var(--danger);
}
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary:not(:disabled):hover { opacity: 0.88; }
.btn-primary:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.btn-ghost {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  font: inherit;
  padding: var(--space-md) var(--space-lg);
  min-height: 44px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 150ms, border-color 150ms;
}
.btn-ghost:hover {
  background: var(--bg);
  border-color: var(--muted);
}
.btn-ghost:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.btn-submit {
  display: block;
  width: 100%;
  min-height: 44px;
  background: var(--brand);
  border: 1px solid var(--brand);
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 150ms, border-color 150ms, transform 100ms, opacity 150ms;
}
.btn-submit:hover:not(:disabled) {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}
.btn-submit:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.btn-submit:active:not(:disabled) {
  transform: scale(0.98);
}
.btn-submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Case-view submit: clinician Submit report, reviewer Submit review (UX-18). */
.plan-submit {
  width: 100%;
  font: inherit;
  padding: var(--space-lg);
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  box-shadow:
    var(--shadow-sm),
    inset 0 1px 0 var(--gloss-sm);
  transition:
    background 0.15s,
    opacity 0.15s;
}
.plan-submit:hover:not(:disabled) {
  background: var(--primary-dark);
}
.plan-submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

/* ── topbar ── */
body > header {
  background: var(--surface);
  border-bottom: 0.25rem solid var(--brand);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--size-topbar-height);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
}

body > header nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.topbar__brand {
  display: flex;
  align-items: center;
  column-gap: 0.618rem;
  margin-right: 1.5rem;
  color: var(--brand);
  font-size: var(--text-plus-1);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
}

.topbar__brand img {
  display: block;
  height: 26px;
  width: auto;
}

.topbar__nav-links {
  display: flex;
  align-items: center;
  gap: 0.125rem;
}

.topbar__nav-link {
  display: flex;
  align-items: center;
  padding: 0 0.875rem;
  color: var(--text-2);
  transition: color 150ms;
}

.topbar__nav-link:hover {
  color: var(--brand);
}
.topbar__nav-link.active {
  color: var(--brand);
  font-weight: 600;
}

body > header aside {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar__bell {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border);
  background: none;
  color: var(--text-2);
  font: inherit;
  cursor: pointer;
  transition:
    border-color 150ms,
    color 150ms;
}

.topbar__bell:disabled {
  cursor: default;
}

.topbar__bell:not(:disabled):hover {
  border-color: var(--brand);
  color: var(--brand);
}

.topbar__profile {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  cursor: pointer;
  transition: opacity 150ms;
}

.topbar__profile:hover {
  opacity: 0.8;
}

.topbar__avatar {
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-full);
  background: var(--brand);
  color: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-minus-2);
  font-weight: 600;
  flex-shrink: 0;
}

.topbar__profile-name {
  font-size: var(--text-0);
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}
.topbar__profile-role {
  font-size: var(--text-minus-1);
  color: var(--muted);
  line-height: 1.3;
}

.topbar__hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 0.3rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
}

.topbar__hamburger span {
  display: block;
  width: 1.25rem;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition:
    transform 200ms,
    opacity 200ms;
}

.topbar__hamburger.open span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.topbar__hamburger.open span:nth-child(2) {
  opacity: 0;
}
.topbar__hamburger.open span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.topbar__drawer {
  display: none;
  flex-direction: column;
  position: fixed;
  top: var(--size-topbar-height);
  left: 0;
  right: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 0.5rem 1rem oklch(0% 0 none / 0.08);
  transform: translateY(-110%);
  opacity: 0;
  transition:
    transform 200ms ease,
    opacity 200ms ease;
  z-index: 999;
}

.topbar__drawer.open {
  transform: translateY(0);
  opacity: 1;
}

.topbar__drawer-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.5rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition:
    background 150ms,
    color 150ms;
}

.topbar__drawer-link:last-child {
  border-bottom: none;
}
.topbar__drawer-link:hover {
  background: var(--bg);
  color: var(--brand);
}
.topbar__drawer-link svg {
  color: var(--muted);
  flex-shrink: 0;
  transition: color 150ms;
}
.topbar__drawer-link:hover svg {
  color: var(--brand);
}

/* ── case list layout (clinician + coordinator) ── */
main {
  flex: 1;
  padding: calc(var(--size-topbar-height) + 2rem)
    max(1.5rem, calc((100% - 72rem) / 2 + 1.5rem)) 3rem;
  scroll-padding-top: calc(var(--size-topbar-height) + var(--space-md)); /* scrolled-to parts clear the fixed top bar (UX-35) */
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.page-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0 0.25rem;
}

h1.page-title {
  font-size: var(--text-plus-3);
  font-weight: 600;
  color: var(--text);
  line-height: 1.15;
  letter-spacing: -0.01em;
}
h1.page-title .count {
  color: var(--muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.date-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

details.date-group {
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 150ms;
}
details.date-group[open] {
  border-color: var(--border);
}

details.date-group > summary {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  cursor: pointer;
  list-style: none;
  padding: var(--space-lg);
  user-select: none;
}
details.date-group > summary::-webkit-details-marker {
  display: none;
}

.summary__chev {
  display: grid;
  place-items: center;
  width: 1.25rem;
  height: 1.25rem;
  color: var(--muted);
  transition:
    transform 200ms,
    color 150ms;
}
details.date-group[open] .summary__chev {
  transform: rotate(90deg);
  color: var(--brand);
}

.summary__date {
  font-size: var(--text-plus-1);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.005em;
}

.summary__count {
  font-size: var(--text-minus-2);
  font-weight: 600;
  color: var(--brand);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-full);
  background: var(--accent-soft);
  border: 1px solid oklch(from var(--accent-soft) calc(l - 0.05) c h);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.summary__rule {
  flex: 1;
  height: 1px;
  background: var(--border-soft);
  margin: 0 var(--space-sm);
}

/* Shared case list (ARCH-21): rows, header, count badge. No per-screen overrides (DESIGN.md). */
.list-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0 var(--space-xs) var(--space-md);
}
.list-title {
  font-size: var(--text-plus-1);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}
.list-count-badge {
  font-size: var(--text-minus-2);
  font-weight: 600;
  color: var(--brand);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-full);
  background: var(--accent-soft);
  border: 1px solid oklch(from var(--accent-soft) calc(l - 0.05) c h);
  font-variant-numeric: tabular-nums;
}

.case-list {
  list-style: none;
  padding: 0 var(--space-md) var(--space-md);
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.case-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: var(--space-md) var(--space-lg);
  cursor: pointer;
  box-shadow: var(--shadow-row);
  transition: box-shadow 150ms, border-color 150ms,
    transform 150ms cubic-bezier(0.25, 1, 0.5, 1);
}
.case-item:hover {
  box-shadow: var(--shadow-row-hover);
  border-color: var(--border);
  transform: translateY(-1px);
}
.case-item:active {
  transform: translateY(0);
}
.case-item.active {
  background: color-mix(in oklch, var(--accent) 8%, transparent);
  border-color: var(--border);
  /* UX-06: --accent left accent bar marks the open case (selection
     signal, DESIGN.md). inset box-shadow → no layout shift. */
  box-shadow: inset var(--space-xs) 0 0 0 var(--accent), var(--shadow-row);
}
.case-item:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.case-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}
.case-item-row1 {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}
.case-item-name {
  font-size: var(--text-0);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.case-item-row2 {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 0;
}
.case-item-diag {
  font-size: var(--text-minus-1);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.case-item-chev {
  color: var(--muted);
  flex-shrink: 0;
  transition: color 150ms, transform 150ms;
}
.case-item:hover .case-item-chev {
  color: var(--brand);
  transform: translateX(2px);
}

.case-table-wrap {
  padding: 0 var(--space-md) 0.75rem;
}

.case-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 0.375rem;
  table-layout: auto;
}

.case-table th {
  font-size: var(--text-minus-1);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-2);
  text-align: left;
  padding: 0.25rem 1.272rem;
  white-space: nowrap;
}

.case-table tbody tr {
  background: var(--surface);
  box-shadow: var(--shadow-row);
  cursor: pointer;
  transition:
    box-shadow 150ms,
    border-color 150ms;
}
.case-table tbody tr:hover {
  box-shadow: var(--shadow-row-hover);
}
.case-table tbody tr:hover td {
  border-color: var(--border);
}
.case-table tbody tr:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.case-table td {
  padding: 0.75rem 1.272rem;
  vertical-align: middle;
  text-align: left;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  transition: border-color 150ms;
}
.case-table td:first-child {
  border-left: 1px solid var(--border-soft);
  border-radius: var(--radius) 0 0 var(--radius);
}
.case-cell {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.618rem;
  font-size: var(--text-0);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.005em;
  white-space: nowrap;
}
.case-table td:nth-last-child(3),
.case-table td:nth-last-child(2),
.case-table th:nth-child(2),
.case-table th:nth-child(3) {
  white-space: nowrap;
  text-align: left;
}
.case-table td:last-child {
  border-right: 1px solid var(--border-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  width: 1%;
  white-space: nowrap;
}

.chip {
  display: inline-block;
  padding: var(--space-xs) 0.618rem;
  border-radius: 4px;
  font-size: var(--text-minus-1);
  font-weight: 600;
  color: var(--attention);
  border: 1px solid color-mix(in oklch, var(--attention) 30%, transparent);
  background: color-mix(in oklch, var(--attention) 8%, white);
  white-space: nowrap;
  flex-shrink: 0;
}

.classification-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-minus-1);
  font-weight: 600;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-weight: 600;
  font-size: var(--text-minus-1);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-full);
}
.status-chip.queued {
  background: var(--chip-running-bg);
  color: var(--chip-running-text);
  border: 1px solid var(--chip-running-border);
}
.status-chip.processing {
  background: var(--chip-processing-bg);
  color: var(--chip-processing-text);
  border: 1px solid var(--chip-processing-border);
}
.status-chip.complete {
  background: var(--chip-complete-bg);
  color: var(--chip-complete-text);
  border: 1px solid var(--ok-line);
}
.status-chip.stuck {
  background: var(--warn-bg);
  color: var(--warn-fg);
  border: 1px solid var(--warn-line);
}
.status-chip.errored {
  background: var(--chip-failed-bg);
  color: var(--chip-failed-text);
  border: 1px solid var(--err-line);
}

/* ── verdict chip (NS-12) — streamlining recommendation on queues/lists.
   Three variants mirror the MDT-banner verdict states (green/attention/red);
   colour is always paired with the chip text. Reuses existing tokens. ── */
.verdict-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-weight: 600;
  font-size: var(--text-minus-1);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-full);
  white-space: nowrap;
}
.verdict-chip.soc {
  background: var(--chip-complete-bg);
  color: var(--chip-complete-text);
  border: 1px solid var(--ok-line);
}
.verdict-chip.mdt {
  background: var(--attention-tint);
  color: var(--attention);
  border: 1px solid var(--attention-line);
}
.verdict-chip.returned {
  background: var(--chip-failed-bg);
  color: var(--chip-failed-text);
  border: 1px solid var(--err-line);
}

/* ── modal ── */
dialog {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  box-shadow: 0 2px 8px var(--shadow-sm), 0 16px 48px var(--shadow-md);
  background: var(--bg-light);
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
}
dialog::backdrop {
  background: var(--backdrop);
}
.modal-inner {
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-md);
  padding-top: var(--space-sm);
}

/* action feedback (.action-feedback) — in-context success/error for mutating
   POSTs (UX-01 #146). Block-level live region; colour always paired with text. */
.action-feedback {
  display: none;
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.action-feedback.is-visible {
  display: block;
}
.action-feedback.success {
  background: var(--chip-complete-bg);
  color: var(--chip-complete-text);
  border-color: var(--chip-complete-border);
}
.action-feedback.error {
  background: var(--chip-failed-bg);
  color: var(--chip-failed-text);
  border-color: var(--err-line);
}

body > footer {
  text-align: left;
  padding: 1rem max(2rem, calc((100% - 72rem) / 2 + 2rem));
  border-top: 1px solid var(--border-soft);
  font-size: var(--text-minus-1);
  color: var(--muted);
  background: var(--bg-dark);
}

@media (max-width: 768px) {
  main {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .topbar__nav-links,
  .topbar__bell,
  .topbar__profile {
    display: none !important;
  }
  body > header aside {
    display: flex !important;
  }
  .topbar__hamburger {
    display: flex;
  }
  .topbar__drawer {
    display: flex;
  }

  .case-table-wrap {
    padding: 0 0.5rem 0.5rem;
  }
}

/* ── shell layout (clinician + coordinator) ── */
.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  --panel-w: 720px;
  grid-template-columns: 1fr 0px;
  overflow: hidden;
}
.layout.panel-open {
  grid-template-columns: minmax(300px, 380px) 1fr;
}
.layout.panel-closing {
  grid-template-columns: minmax(300px, 380px) 1fr;
}
.layout.no-transition #detail-panel {
  transition: none;
}
.layout > main {
  overflow-y: auto;
  min-height: 0;
  min-width: 560px;
}
.layout.panel-open > main {
  min-width: 0;
}

/* split-panel: full-screen takeover on mobile. Must follow the desktop .layout
   rules above: equal specificity, so the later rule wins (#485). */
@media (max-width: 768px) {
  .layout > main {
    min-width: 0;
  }
  .layout.panel-open {
    grid-template-columns: 0 1fr;
  }
  .layout.panel-closing {
    grid-template-columns: 0 1fr;
  }
  .layout.panel-open > main {
    overflow: hidden;
  }
  .layout.panel-open #detail-panel {
    border-left: none;
  }
}

@media (min-width: 1920px) {
  .layout {
    --panel-w: 780px;
  }
}

@media (max-width: 1440px) {
  .layout {
    --panel-w: 560px;
  }
}

#detail-panel {
  position: relative;
  overflow-y: auto;
  min-height: 0;
  border-left: 1px solid var(--border-soft);
  transform: translateX(100%);
  transition: transform 300ms ease, border-color 300ms ease;
}
.layout.panel-open #detail-panel {
  transform: translateX(0);
  border-left-color: var(--brand);
}
.layout.panel-closing #detail-panel {
  transform: translateX(100%);
}
#detail-panel[hidden] {
  display: block !important;
  overflow: hidden;
}
.panel-close {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: inherit;
  color: #fff;
  background: var(--brand);
  border: 1px solid var(--brand);
  border-radius: var(--r-sm);
  padding: var(--space-sm) 0.618rem;
  min-height: 44px;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.panel-close:hover {
  opacity: 0.88;
}
.panel-close:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ── detail panel scoped styles (clinician + coordinator) ── */
#detail-panel {
  --brand: oklch(34% 0.07 162);
  --brand-soft: oklch(34% 0.07 162 / 0.08);
  --bg-dark: oklch(94% 0.005 255);
  --bg: oklch(97% 0.003 255);
  --bg-light: #fff;
  --page: var(--bg-dark);
  --surface: var(--bg-light);
  --text: oklch(22% 0.015 260);
  --muted: oklch(52% 0.015 260);
  --border: oklch(91% 0.006 255);
  --border-strong: oklch(84% 0.008 255);
  --ok-line: oklch(72% 0.09 155);
  --warn-line: oklch(70% 0.12 70);
  --err-line: oklch(68% 0.15 28);
  --r-sm: 0.381rem;
  --r-md: 0.618rem;
  --r-lg: 1rem;
  --shadow-sm: 0 1px 2px oklch(20% 0.02 260 / 0.04);
  --shadow-md:
    0 1px 2px oklch(20% 0.02 260 / 0.04), 0 4px 12px oklch(20% 0.02 260 / 0.04);
  --ring: 0 0 0 3px oklch(34% 0.07 162 / 0.18);
  background: var(--page);
}

#detail-panel *:focus {
  outline: none;
}
#detail-panel *:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--space-xs);
}

#detail-panel a {
  text-decoration: none;
  color: inherit;
}

#detail-panel .signals-table {
  font-variant-numeric: tabular-nums;
}

/* 56rem content column + 2.058rem side padding (no token); DESIGN.md → Case view */
#detail-panel .detail-main {
  flex: 1;
  max-width: calc(56rem + 2 * 2.058rem);
  width: 100%;
  margin: 0 auto;
  padding: calc(var(--size-topbar-height) + 1.618rem) 2.058rem 2.618rem;
}

.case-header {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.618rem;
}
.case-meta {
  margin-right: auto;
}
.case-meta h1 {
  font-size: 2.058rem;
  font-weight: 600;
  line-height: 1.272;
  letter-spacing: -0.02em;
  color: var(--text);
}

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

/* ── case tabs (UX-09 #480, ADR-0021) — clinician + coordinator case view.
   Boxed tabs: uniform 1px border, --space-xs apart; the selected tab takes the
   card's --bg and a card-coloured bottom border so it joins its panel, and the
   card gives up its top border and top-left radius. Selection is also carried by
   weight and aria-selected, never colour alone. ── */
.case-tabs {
  display: flex;
  gap: var(--space-xs);
}
.case-tab {
  min-height: 44px;
  padding: var(--space-md) var(--space-lg);
  font: inherit;
  font-size: var(--text-0);
  font-weight: 500;
  color: var(--muted);
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: var(--r-md) var(--r-md) 0 0;
  cursor: pointer;
  transition: color 0.15s;
}
.case-tab:not([aria-selected="true"]):hover {
  color: var(--text);
}
.case-tab[aria-selected="true"] {
  background: var(--bg);
  color: var(--brand);
  font-weight: 600;
  border-bottom-color: var(--bg);
}
.case-tabs + .card {
  border-top: 0;
  border-top-left-radius: 0;
}
.case-tabpanel {
  padding: var(--space-xl);
}
/* CL-31 (#711): the empty-state line of a case tab with no data yet. */
.case-empty {
  color: var(--muted);
}

/* ── case view (UX-12 #643; CO-13 #676) — clinician + coordinator. Content column
   56rem, --space-2xl between sections, nothing below --text-0 in the panel
   (DESIGN.md → Case view). ── */
#detail-panel .panel-close {
  font-size: var(--text-0);
}
.triage {
  margin-bottom: var(--space-2xl);
}
.triage h2 {
  font-size: var(--text-plus-1);
  font-weight: 600;
  margin-bottom: var(--space-md);
}
/* One aligned label/value grid: Triage results and Reasoning */
.case-grid {
  margin: 0;
}
.case-grid > div {
  display: grid;
  grid-template-columns: 12rem minmax(0, 1fr);
  column-gap: var(--space-lg);
  padding: var(--space-md) 0;
}
.case-grid > div + div {
  border-top: 1px solid var(--border);
}
.case-grid dt {
  font-weight: 600;
  color: var(--muted);
}
.case-grid dd {
  margin: 0;
  color: var(--text);
}
.triage dd {
  font-weight: 600;
}
.triage-class {
  font-size: var(--text-plus-half);
  display: flex;
  align-items: center;
  gap: var(--space-md);
}
.triage-class::before {
  content: "";
  width: var(--space-md);
  height: var(--space-md);
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.triage-class[data-rec="standard_of_care"] { color: var(--ok-fg); }
.triage-class[data-rec="full_mdt_review"] { color: var(--attention); }
.triage-class[data-rec="cannot_verify"] { color: var(--err-fg); }
.reasoning-source {
  margin-top: var(--space-xs);
  color: var(--muted);
}
.staging-list {
  margin: 0;
  padding-left: var(--space-lg);
}
/* the evidence table at body size, header cells over their columns */
#case-panel-reasoning .signals-table {
  margin-top: 0;
}
#case-panel-reasoning .signals-table thead th {
  font-size: var(--text-0);
  padding-top: 0;
}
/* Radiology report: fills the case-view card (no card inside a card) */
#case-panel-report,
#pact-panel-report {
  padding: 0;
}
#case-panel-report .report-viewer,
#pact-panel-report .report-viewer {
  overflow: hidden;
}
#case-panel-report .report-frame,
#pact-panel-report .report-frame {
  display: block;
  width: 100%;
  height: 26rem;
  border: 0;
}
#case-panel-report .report-empty,
#pact-panel-report .report-empty {
  margin: 0;
  padding: var(--space-xl);
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.618;
  text-align: center;
}
#case-panel-evidence ul {
  margin: 0;
  padding-inline-start: 1.25em;
  display: grid;
  gap: var(--space-sm);
}
/* CL-32: guideline links read as links, not body text (WCAG 1.4.1). */
#case-panel-evidence a {
  color: var(--primary);
  text-decoration: underline;
}
@media (max-width: 768px) {
  .case-grid > div {
    grid-template-columns: minmax(0, 1fr);
    row-gap: var(--space-xs);
  }
}

.h3 {
  font-size: 0.786rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.618rem;
  line-height: 1.618;
}

.ph-nondep {
  margin-top: 1.272rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.618;
}

.l2-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  margin-top: 0.618rem;
  font-size: 0.786rem;
  color: var(--brand);
  text-decoration: none;
  font-weight: 500;
  transition: gap 0.15s;
}
.l2-link:hover {
  text-decoration: underline;
}
.l2-link::after {
  content: "→";
  transition: transform 0.15s;
}
.l2-link:hover::after {
  transform: translateX(2px);
}


@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0s !important;
    animation-duration: 0s !important;
  }
}

/* AU-04: auth shell (login, set-password). Picture left, brand on top of the right
   side, the form beneath it with no card. See docs/DESIGN.md → Auth shell. */
body.auth {
  display: grid;
  grid-template-columns: 42% 1fr;
  grid-template-rows: 1fr;
  grid-auto-rows: 0;
  min-height: 100vh;
}
.auth-pic {
  grid-area: 1 / 1;
  position: relative;
  overflow: hidden;
  border-right: 1px solid var(--border);
}
.auth-pic img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}
.auth-side { grid-area: 1 / 2; min-width: 0; padding: var(--space-2xl); }
.auth-brand {
  display: flex;
  align-items: center;
  column-gap: 0.618rem;
  color: var(--brand);
  font-size: var(--text-plus-2);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
}
.auth-brand img { height: 2.618rem; width: auto; }
.auth-form {
  flex: none;
  display: block;
  padding: 0;
  max-width: 24rem;
  margin: var(--space-2xl) auto 0;
}
.auth-form h1 {
  font-size: var(--text-plus-3);
  font-weight: 600;
  line-height: 1.236;
  letter-spacing: -0.01em;
  margin: 0 0 var(--space-md);
}
.auth-form .field label,
.auth-hint,
.auth-readonly,
.auth-error { font-size: 1rem; }
.auth-lede,
.auth-note { font-size: 1rem; color: var(--text-2); }
.auth-lede { margin: 0 0 var(--space-xl); }
.auth-note { margin: var(--space-2xl) 0 0; }
.auth-hint { color: var(--text-2); margin: calc(-1 * var(--space-sm)) 0 var(--space-lg); }
.auth-readonly {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-xs) var(--space-lg);
  margin: 0 0 var(--space-xl);
}
.auth-readonly div { display: contents; }
.auth-readonly dt { color: var(--muted); }
.auth-readonly dd { margin: 0; font-weight: 600; }
.auth-readonly dd,
.auth-lede strong { overflow-wrap: anywhere; }
.auth-pw { position: relative; }
.auth-pw input { padding-right: 4.236rem; }
.auth-toggle {
  position: absolute;
  right: var(--space-sm);
  top: 50%;
  transform: translateY(-50%);
  min-height: 36px;
  padding: 0 var(--space-md);
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--brand);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}
.auth-toggle:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.auth-form .btn-submit { margin-top: var(--space-lg); }
.auth-link { line-height: 44px; text-align: center; }
.auth-error {
  margin: var(--space-lg) 0 0;
  padding: var(--space-md) var(--space-lg);
  background: var(--err-bg);
  border: 1px solid var(--err-line);
  border-radius: var(--radius-sm);
  color: var(--err-fg);
}
@media (max-width: 760px) {
  body.auth {
    grid-template-columns: 1fr;
    grid-template-rows: 11rem 1fr;
  }
  .auth-pic {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .auth-side { grid-area: 2 / 1; padding: var(--space-xl); }
}

/* AUTH-05: sign-in loader overlay. Full-screen branded transition cover:
   the pulsing mark + status text (AU-04). See docs/DESIGN.md → Loader overlay. */
.loader-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
  background: var(--bg-dark);
}
.loader-overlay img {
  display: block;
  height: 2.618rem;
  width: auto;
  animation: pulse 1.4s cubic-bezier(0.22, 1, 0.36, 1) infinite alternate;
}
.loader-status {
  font-size: var(--text-0);
  font-weight: 500;
  color: var(--muted);
  line-height: 1.618;
}
@keyframes pulse {
  from { transform: scale(0.92); opacity: 0.55; }
  to { transform: scale(1); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .loader-overlay img { animation: none; }
}

.signals-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
  line-height: 1.618;
  margin-top: var(--space-xs);
}
.signals-table thead th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.786rem;
  padding: 0.618rem;
  border-bottom: 1px solid var(--border-strong);
}
.signals-table thead th:first-child {
  padding-left: 0;
}
.signals-table thead th:last-child {
  padding-right: 0;
}
.signals-table tbody td {
  padding: 1rem 0.618rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text);
}
.signals-table tbody td:first-child {
  padding-left: 0;
  font-weight: 600;
}
.signals-table tbody td:last-child {
  padding-right: 0;
}
.signals-table.evidence tbody td:nth-child(2) {
  font-weight: 600;
}
.signals-table.evidence thead th:last-child,
.signals-table.evidence tbody td:last-child {
  text-align: left;
  white-space: normal;
}
.signals-table tbody tr:last-child td {
  border-bottom: none;
}
.signals-table td:nth-last-child(2) {
  white-space: nowrap;
  font-weight: 500;
}
.signals-table td:last-child,
.signals-table th:last-child {
  text-align: right;
  white-space: nowrap;
}
/* The demo Staging block's value column carries long narrative evidence — wrap and
   left-align so it does not inherit the table-wide nowrap and clip off the panel edge. */
[data-demo-staging-body] td:last-child {
  text-align: left;
  white-space: normal;
}

@media (max-width: 768px) {
  .case-tabs {
    min-width: 0;
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }
  .case-tabs::-webkit-scrollbar {
    display: none;
  }
  .case-tab {
    flex-shrink: 0;
    white-space: nowrap;
    padding: var(--space-md);
  }
  /* The scrolling row clips anything outside it: draw the focus ring inside. */
  #detail-panel .case-tab:focus-visible {
    outline-offset: -2px;
  }
  #detail-panel .detail-main {
    padding: calc(var(--size-topbar-height) + 1rem) 1rem 2.058rem;
  }
  .case-tabpanel {
    padding: var(--space-lg);
  }
  #detail-panel .case-header {
    position: sticky;
    top: var(--size-topbar-height);
    z-index: 10;
    background: var(--bg-light);
    margin-left: -1rem;
    margin-right: -1rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-soft);
    flex-wrap: wrap;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .case-meta h1 {
    font-size: 1.618rem;
  }
  .case-table th:nth-child(2),
  .case-table td:nth-child(2) {
    display: none;
  }
  .case-cell {
    white-space: normal;
  }
}

/* DEMO-11 (#627): upload + Pipeline Status modal and its page-head entry —
   shared by the coordinator and the demo clinician (DESIGN.md). */
/* ── page-head action group ── */
.page-head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-md);
}
/* UX-35 (#812): guided tour — (?) trigger, spotlight, step card (DESIGN.md → Guided tour) */
.guide-trigger {
  inline-size: 44px;
  block-size: 44px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-light);
  color: var(--text);
  font-family: inherit;
  font-weight: 600;
  font-size: var(--text-0);
  line-height: 1;
  cursor: pointer;
}
.guide-trigger:hover {
  border-color: var(--muted);
}
.guide-trigger:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.guide-tour {
  position: fixed;
  inset: 0;
  z-index: 1100;
}
.guide-tour.is-centred {
  background: var(--backdrop);
}
.guide-tour__spot {
  position: fixed;
  border-radius: var(--radius-lg);
  box-shadow: 0 0 0 100vmax var(--backdrop);
  transition:
    top 250ms ease,
    left 250ms ease,
    width 250ms ease,
    height 250ms ease;
}
.guide-tour__card {
  position: fixed;
  inline-size: min(24rem, calc(100vw - 2 * var(--space-lg)));
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: var(--space-sm);
  padding: var(--space-lg);
  background: var(--bg-light);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 8px var(--shadow-sm), 0 16px 48px var(--shadow-md);
}
.guide-tour__card h3,
.guide-tour__card p {
  margin: 0;
}
.guide-tour__count {
  color: var(--muted);
  font-size: var(--text-minus-1);
}
.guide-tour__card p:not(.guide-tour__count) {
  line-height: 1.5;
  overflow-y: auto;
}
.guide-tour__nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-block-start: var(--space-sm);
}
.guide-tour__nav > span {
  display: flex;
  gap: var(--space-sm);
}
.guide-tour__card button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
/* count badge on the single status-first Pipeline entry (#139) */
.pipeline-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.272rem;
  padding: 0 var(--space-xs);
  margin-left: var(--space-xs);
  border-radius: var(--radius-full);
  background: var(--bg-light);
  color: var(--primary);
  font-size: var(--text-minus-2);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
/* ── cohort modal (upload + pipeline) ── */
dialog#cohort-modal {
  width: min(600px, 90vw);
  max-height: 80vh;
  overflow: hidden;
}

/* combined modal: header + two stacked sections */
.cohort-inner {
  max-height: 80vh;
  overflow-y: auto;
}
.cohort-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cohort-title {
  font-size: var(--text-plus-2);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}
.upload-section,
.pipeline-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}
.cohort-section-title {
  font-size: var(--text-plus-1);
  font-weight: 600;
  color: var(--text);
}
.drop-zone {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: var(--space-xl) var(--space-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  text-align: center;
  cursor: pointer;
  transition:
    border-color 150ms,
    background 150ms;
}
.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.drop-zone svg {
  color: var(--muted);
}
.drop-zone p {
  font-size: var(--text-0);
  color: var(--text);
}
.choose-link {
  background: none;
  border: none;
  color: var(--primary);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}
.drop-zone-meta {
  font-size: var(--text-minus-1);
  color: var(--muted);
}
.upload-file-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}
.upload-file-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.upload-file-item svg {
  color: var(--primary);
  flex-shrink: 0;
}
.upload-file-info {
  flex: 1;
  min-width: 0;
}
.upload-file-name {
  font-size: var(--text-minus-1);
  font-weight: 500;
  color: var(--text);
  overflow-wrap: anywhere;
  display: block;
}
.upload-file-size {
  font-size: var(--text-minus-1);
  color: var(--muted);
}
.upload-file-state {
  flex-shrink: 0;
  font-size: var(--text-minus-1);
  font-weight: 600;
  color: var(--muted);
}
.upload-file-item.bad .upload-file-state,
.upload-file-item.bad .upload-file-size {
  color: var(--warn-fg);
}
.drop-zone-meta strong {
  font-weight: 600;
  color: var(--text);
}
.upload-file-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  padding: var(--space-xs);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  transition:
    color 150ms,
    background 150ms;
}
.upload-file-remove:hover {
  color: var(--danger);
  background: var(--danger-shadow);
}
/* ── pipeline section ── */
.pipeline-inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}
.pipeline-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font: inherit;
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-sm);
  transition: color 150ms, background 150ms;
}
.pipeline-close:hover {
  color: var(--text);
  background: var(--bg);
}
.pipeline-batch {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.pipeline-batch-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.pipeline-batch-date {
  font-size: var(--text-minus-1);
  font-weight: 600;
  color: var(--text);
}
.pipeline-case-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
  font-size: var(--text-minus-1);
  color: var(--text);
}
.pipeline-case-row:last-child {
  border-bottom: none;
}
.pipeline-case-name {
  font-weight: 500;
}
/* UX-04 (#203): indeterminate progress bar — Processing rows only.
   Signals active work without an ETA; pairs with the Processing chip,
   never colour/animation alone. Reduced-motion handled globally in
   cansr.css (animation-duration: 0s), collapsing it to a static fill. */
.pipeline-progress {
  flex-basis: 100%;
  height: var(--space-xs);
  margin-top: var(--space-sm);
  background: var(--chip-processing-bg);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.pipeline-progress-bar {
  width: 40%;
  height: 100%;
  background: var(--chip-processing-text);
  border-radius: var(--radius-full);
  animation: pipeline-sweep 1.4s ease-in-out infinite;
}
@keyframes pipeline-sweep {
  from { transform: translateX(-100%); }
  to { transform: translateX(300%); }
}

/* ── UX-22 (#722): internal reviewer workbench, report beside the findings. Scoped to
   .case-split, which only the workbench has. Below 1100px the tab row stays and each
   finding gains Show in report; at 1100px and up Review and Hospital report sit side
   by side (DESIGN.md → Internal reviewer workbench). ── */
.case-split .finding-evidence[tabindex] { cursor: pointer; }
.case-split .finding-evidence:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.case-split .finding.selected { box-shadow: inset 0 0 0 2px var(--primary); }
#detail-panel .case-split .finding-link { color: var(--primary); text-decoration: underline; }
.case-split .finding-nomatch { display: none; margin: 0; color: var(--muted); }
.case-split .finding.nomatch .finding-nomatch { display: block; }
.case-split .finding.nomatch .finding-link { display: none; }
.case-split .report-heading,
.case-split .report-back { display: none; }
#detail-panel .case-split .report-back.on { display: inline-block; color: var(--primary); text-decoration: underline; padding: var(--space-md) var(--space-xl) 0; }
@media (min-width: 1100px) {
  #detail-panel .detail-main:has(.case-split) { max-width: none; }
  .case-split { display: grid; grid-template-columns: 1fr 1fr; column-gap: var(--space-xl); align-items: start; }
  .case-split > .triage,
  .case-split > .card > #case-panel-review { grid-column: 1; }
  .case-split .case-tabs { display: none; }
  #detail-panel .case-split > .card { display: contents; border: 0; padding: 0; background: transparent; box-shadow: none; border-radius: 0; }
  .case-split #case-panel-review { padding: 0; }
  .case-split #case-panel-review[hidden] { display: block !important; } /* no tab row: never hide Review */
  .case-split #case-panel-report,
  .case-split #case-panel-report[hidden] {
    display: flex !important; /* the tab row is gone: the [hidden] rule must not hide the report */
    flex-direction: column; grid-column: 2; grid-row: 1 / span 3;
    position: sticky; top: calc(var(--size-topbar-height) + var(--space-lg));
    height: calc(100vh - 2 * var(--size-topbar-height) - 2 * var(--space-lg));
    border-left: 1px solid var(--border); padding-inline-start: var(--space-xl);
  }
  .case-split .report-heading { display: block; font-size: var(--text-plus-1); font-weight: 600; margin-bottom: var(--space-md); }
  .case-split #case-panel-report .report-viewer { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .case-split #case-panel-report .report-frame { flex: 1; height: auto; }
  .case-split #case-panel-report .report-empty { padding-inline: 0; text-align: start; }
  .case-split .finding-link,
  #detail-panel .case-split .report-back.on { display: none; }
}
/* #761: the workbench Review grid is one column (labels above content) at every width; beside
   the case list below 1100px the 12rem label column pushed the verdict buttons out of the card. */
.case-split .case-grid > div { grid-template-columns: minmax(0, 1fr); row-gap: var(--space-xs); }
