/* Reading Room — design tokens + components.
   Dark is the default (low-ambient reading rooms); [data-theme=light] is the alternative.
   Text/background pairs are chosen for WCAG 2.2 AA (>= 4.5:1 body text). */

:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1015;
  --surface: #141920;
  --surface-2: #1a2029;
  --surface-3: #222a35;
  --line: #29313c;
  --line-strong: #3a4452;
  --text: #e7eaef;
  --muted: #a1abb9;
  --faint: #7c8796;
  --accent: #7fb0ff;          /* accent text on dark surfaces */
  --accent-bg: #2563eb;       /* primary button background (white text 5.2:1) */
  --accent-bg-hover: #1d4ed8;
  --accent-soft: rgba(96, 150, 255, 0.14);
  --ok: #4ade80;
  --ok-soft: rgba(74, 222, 128, 0.13);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.13);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.13);
  --violet: #b69cff;
  --focus: #9cc2ff;
  --paper: #10151b;           /* report editor surface */
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.35);
  --viewer-bg: #000;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f7f8fb;
  --surface-3: #edf0f5;
  --line: #dde2ea;
  --line-strong: #c5ccd8;
  --text: #121822;
  --muted: #536072;
  --faint: #6b7686;
  --accent: #1d4ed8;
  --accent-bg: #2563eb;
  --accent-bg-hover: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.09);
  --ok: #15803d;
  --ok-soft: rgba(21, 128, 61, 0.1);
  --warn: #a16207;
  --warn-soft: rgba(202, 138, 4, 0.13);
  --danger: #b91c1c;
  --danger-soft: rgba(185, 28, 28, 0.08);
  --violet: #6d28d9;
  --focus: #2563eb;
  --paper: #ffffff;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.14), 0 2px 6px rgba(15, 23, 42, 0.08);
  --viewer-bg: #0b0d10;
}

:root {
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --topbar-h: 48px;
  --rail-w: 288px;
  --report-w: clamp(380px, 38vw, 760px);
  --font: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono", monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font: 14px/1.45 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1, "cv11" 1;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
kbd, .rr-kbd {
  display: inline-block; min-width: 1.6em; padding: 0 0.4em; border: 1px solid var(--line-strong);
  border-bottom-width: 2px; border-radius: 4px; font: 11px/1.6 var(--font); color: var(--muted);
  background: var(--surface-2); text-align: center;
}
.rr-mono { font-family: var(--mono); font-size: 12.5px; }
.rr-muted { color: var(--muted); font-size: 0.92em; }
.rr-empty { color: var(--muted); }
.rr-error { color: var(--danger); }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.rr-i { width: 18px; height: 18px; flex: none; vertical-align: -4px; }
.rr-i-sm { width: 14px; height: 14px; vertical-align: -2px; }
.rr-i-lg { width: 28px; height: 28px; }

/* ---------- buttons, inputs ---------- */
button, input, select, textarea { font: inherit; color: inherit; }
.rr-btn, .rr-login button, .rr-filters button, dialog menu button, .rr-main form button[type=submit] {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 32px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text);
  cursor: pointer; font-weight: 500; white-space: nowrap;
  transition: background 0.12s var(--ease), border-color 0.12s var(--ease), transform 0.06s;
}
.rr-btn:hover { background: var(--surface-3); text-decoration: none; }
.rr-btn:active { transform: translateY(1px); }
.rr-btn-primary, .rr-login button {
  background: var(--accent-bg); border-color: transparent; color: #fff;
}
.rr-btn-primary:hover, .rr-login button:hover { background: var(--accent-bg-hover); }
.rr-btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.rr-btn-ghost:hover { color: var(--text); }
.rr-btn-lg { min-height: 40px; padding: 0 18px; font-size: 15px; }
.rr-btn[disabled], .rr-btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; }
.rr-iconbtn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer;
}
.rr-iconbtn:hover { background: var(--surface-3); color: var(--text); }
.rr-iconbtn[disabled] { opacity: 0.35; cursor: default; background: transparent; }

input[type=text], input[type=search], input[type=password], input[type=date], select, textarea {
  background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  min-height: 32px; padding: 4px 10px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--focus); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- top bar ---------- */
.rr-topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px; padding: 0 14px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.rr-brand { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 650; letter-spacing: -0.01em; }
.rr-brand:hover { text-decoration: none; }
.rr-brand-mark {
  width: 22px; height: 22px; border-radius: 6px;
  background: conic-gradient(from 210deg, var(--accent-bg), #60a5fa, #a78bfa, var(--accent-bg));
  box-shadow: inset 0 0 0 5px var(--surface);
}
.rr-topbar-spacer { flex: 1; display: flex; align-items: center; min-width: 0; }
.rr-toplink { color: var(--muted); display: inline-flex; align-items: center; gap: 5px; font-weight: 500; }
.rr-toplink:hover { color: var(--text); text-decoration: none; }

.rr-seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; }
.rr-seg a, .rr-seg button {
  display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 0 11px; border-radius: 6px;
  color: var(--muted); font-weight: 500; border: 0; background: transparent; cursor: pointer; white-space: nowrap;
}
.rr-seg a:hover, .rr-seg button:hover { color: var(--text); text-decoration: none; }
.rr-seg .active, .rr-seg [aria-pressed="true"] { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.25); }

/* user menu */
.rr-menu { position: relative; }
.rr-menu > summary { list-style: none; cursor: pointer; }
.rr-menu > summary::-webkit-details-marker { display: none; }
.rr-user-chip { display: flex; align-items: center; gap: 8px; padding: 3px 10px 3px 3px; border-radius: 999px; border: 1px solid var(--line); }
.rr-user-chip:hover { background: var(--surface-3); }
.rr-avatar { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 650; font-size: 12px; color: #fff; background: linear-gradient(135deg, #3b82f6, #8b5cf6); }
.rr-user-name { max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rr-menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.rr-menu-head { padding: 8px 10px 10px; font-weight: 600; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: flex; flex-direction: column; }
.rr-menu-head span { color: var(--muted); font-weight: 400; font-size: 12px; text-transform: capitalize; }
.rr-menu-panel button, .rr-menu-panel a {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 6px;
  border: 0; background: transparent; color: var(--text); cursor: pointer; text-align: left; font: inherit;
}
.rr-menu-panel button:hover, .rr-menu-panel a:hover { background: var(--surface-3); text-decoration: none; }
.rr-menu-panel .rr-i { color: var(--muted); }
.rr-inline-form { display: block; margin: 0; }

/* ---------- generic pages ---------- */
.rr-main { padding: 22px clamp(16px, 3vw, 40px) 40px; max-width: 1480px; margin: 0 auto; }
.rr-login { max-width: 360px; margin: 10vh auto; padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.rr-login h1 { margin-bottom: 18px; }
.rr-login form { display: flex; flex-direction: column; gap: 14px; }
.rr-login label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13px; }
.rr-login button { min-height: 38px; margin-top: 4px; }
/* Two-factor enrollment (account_mfa.html): the QR stays dark-on-white in either theme so phones can scan it. */
.rr-mfa-qr { background: #fff; padding: 12px; border-radius: var(--radius, 6px); width: max-content; margin: 0 auto 12px; }
.rr-mfa-qr svg { display: block; }
.rr-mfa-secret { user-select: all; letter-spacing: 0.05em; font-size: 14px; color: var(--text); }
.rr-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 16px; }
.rr-filters label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 4px; }

/* ---------- worklist page ---------- */
.rr-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.rr-sub { margin: 6px 0 0; color: var(--muted); }
.rr-sub strong { color: var(--text); }
.rr-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.rr-chip {
  display: inline-flex; align-items: center; gap: 7px; min-height: 30px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); font-weight: 500; background: transparent; white-space: nowrap;
}
.rr-chip:hover { color: var(--text); border-color: var(--line-strong); text-decoration: none; }
.rr-chip.active { color: var(--text); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.rr-count { font-size: 12px; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--surface-3); color: var(--text); text-align: center; }

.rr-filterbar { position: relative; display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 14px; }
.rr-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.rr-searchbox {
  position: relative; display: flex; align-items: center; gap: 8px; flex: 1 1 320px; max-width: 520px;
  min-height: 34px; padding: 0 10px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--muted);
}
.rr-searchbox:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px var(--accent-soft); }
.rr-searchbox input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 0; min-height: 32px; box-shadow: none !important; color: var(--text); }
.rr-kbd-hint { flex: none; }
.rr-more { position: relative; }
.rr-more > summary { list-style: none; cursor: pointer; min-height: 32px; display: inline-flex; align-items: center; padding: 0 10px; color: var(--muted); border-radius: var(--radius-sm); }
.rr-more > summary::-webkit-details-marker { display: none; }
.rr-more > summary:hover { color: var(--text); background: var(--surface-3); }
.rr-more[open] > summary { color: var(--text); }
.rr-more-panel { display: flex; gap: 10px; flex-wrap: wrap; padding-top: 8px; }

.rr-search-results {
  position: absolute; z-index: 20; top: 40px; left: 0; width: min(560px, 100%); max-height: 60vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px;
}

.rr-table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
table.rr-list { width: 100%; border-collapse: collapse; }
table.rr-list th {
  text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2);
}
table.rr-list td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.rr-list tbody tr:last-child td { border-bottom: 0; }
table.rr-list tr.rr-row { cursor: pointer; transition: background 0.08s; }
table.rr-list tr.rr-row:hover { background: var(--surface-2); }
table.rr-list tr.rr-row.rr-selected, table.rr-list tr.rr-row:focus-visible { background: var(--accent-soft); outline: none; box-shadow: inset 3px 0 0 var(--accent); }
.rr-col-status { width: 28px; padding-right: 0 !important; }
.rr-cell-main { font-weight: 500; }
.rr-cell-sub { color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.rr-flag-overdue { color: var(--warn); font-weight: 500; }
.rr-hint { color: var(--muted); font-size: 12px; margin-top: 12px; }
.rr-empty-state { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 42px 0; color: var(--muted); }
.rr-empty-state .rr-i { color: var(--ok); }

/* status dots / pills / doc letters */
.rr-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex: none; }
.rr-dot-ready_to_review { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.rr-dot-in_progress { background: var(--violet); }
.rr-dot-received, .rr-dot-worksheet_generated { background: var(--warn); }
.rr-dot-signed, .rr-dot-addended { background: var(--ok); }
.rr-dot-not_performed { background: var(--danger); }
.rr-dot-incomplete { background: transparent; border: 2px solid var(--faint); }

.rr-badge {
  display: inline-flex; align-items: center; min-height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 500;
  background: var(--surface-3); color: var(--muted); white-space: nowrap;
}
.rr-badge-ready_to_review { background: var(--accent-soft); color: var(--accent); }
.rr-badge-in_progress { background: color-mix(in srgb, var(--violet) 16%, transparent); color: var(--violet); }
.rr-badge-received, .rr-badge-worksheet_generated { background: var(--warn-soft); color: var(--warn); }
.rr-badge-signed, .rr-badge-addended { background: var(--ok-soft); color: var(--ok); }
.rr-badge-not_performed { background: var(--danger-soft); color: var(--danger); }
.rr-doc {
  display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: 3px; border-radius: 5px;
  font-size: 11px; font-weight: 650; background: var(--surface-3); color: var(--muted);
}
.rr-doc-tech_report { background: var(--ok-soft); color: var(--ok); }
.rr-doc-worksheet { background: var(--accent-soft); color: var(--accent); }

/* ---------- search result items (list page + rail) ---------- */
.rr-sr-head { padding: 6px 8px; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.rr-sr-item { display: grid; grid-template-columns: 12px 1fr auto; gap: 2px 10px; align-items: center; padding: 8px; border-radius: 6px; color: var(--text); }
.rr-sr-item:hover, .rr-sr-item.rr-active { background: var(--surface-3); text-decoration: none; }
.rr-sr-item .rr-sr-name { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rr-sr-item .rr-sr-meta { grid-column: 2 / 4; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rr-sr-item .rr-sr-date { color: var(--muted); font-size: 12px; }
.rr-sr-empty { padding: 10px 8px; color: var(--muted); }

/* ---------- dialogs, toast ---------- */
.rr-dialog, dialog {
  border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); color: var(--text);
  box-shadow: var(--shadow); padding: 22px; max-width: min(560px, 92vw);
}
dialog::backdrop { background: rgba(5, 8, 12, 0.6); backdrop-filter: blur(2px); }
dialog h2 { margin-bottom: 14px; }
dialog menu { display: flex; justify-content: flex-end; gap: 8px; margin: 18px 0 0; padding: 0; }
dialog menu button[value=confirm] { background: var(--accent-bg); color: #fff; border-color: transparent; }
table.rr-keys { border-collapse: collapse; width: 100%; }
table.rr-keys td { padding: 7px 4px; border-bottom: 1px solid var(--line); }
table.rr-keys td:first-child { white-space: nowrap; padding-right: 18px; }

.rr-toast-host { position: fixed; z-index: 60; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.rr-toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 12px;
  background: var(--surface-3); color: var(--text); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow);
  animation: rr-rise 0.22s var(--ease);
}
.rr-toast .rr-i { color: var(--ok); }
.rr-toast a { font-weight: 600; }
@keyframes rr-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* =====================================================================
   Reading workspace
   ===================================================================== */
body.rr-body-workspace { overflow: hidden; }
body.rr-body-workspace .rr-main-workspace { height: calc(100vh - var(--topbar-h)); }

.rr-ws {
  height: 100%; display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr);
  transition: grid-template-columns 0.18s var(--ease);
}
.rr-ws.rr-rail-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
.rr-ws.rr-rail-collapsed .rr-rail { visibility: hidden; }

/* rail */
.rr-rail { min-width: 0; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line); overflow: hidden; }
.rr-rail-head { padding: 12px 12px 8px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--line); }
.rr-rail .rr-searchbox { max-width: none; flex: none; }
.rr-rail-views { display: flex; flex-wrap: wrap; gap: 4px; }
.rr-rail-views .rr-chip { min-height: 26px; padding: 0 9px; font-size: 12.5px; }
.rr-rail-list { flex: 1; overflow-y: auto; padding: 6px; }
.rr-rail-item {
  display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 1px 10px; align-items: center;
  padding: 8px 10px; border-radius: 8px; color: var(--text); position: relative;
}
.rr-rail-item:hover { background: var(--surface-2); text-decoration: none; }
.rr-rail-item.rr-current { background: var(--accent-soft); }
.rr-rail-item.rr-current::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--accent); }
.rr-rail-name { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rr-rail-meta { grid-column: 2 / 4; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rr-rail-age { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.rr-rail-item.rr-overdue .rr-rail-age { color: var(--warn); font-weight: 600; }
.rr-rail-foot { padding: 8px 12px; border-top: 1px solid var(--line); color: var(--faint); font-size: 12px; display: flex; justify-content: space-between; gap: 8px; }
.rr-rail-empty { padding: 18px 10px; color: var(--muted); text-align: center; }

/* work area */
.rr-work { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.rr-banner-bar {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 8px;
  background: var(--surface); border-bottom: 1px solid var(--line); min-height: 56px;
}
.rr-patient { min-width: 0; display: flex; flex-direction: column; }
.rr-patient-name { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rr-patient-ids { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 12.5px; }
.rr-patient-ids b { color: var(--text); font-weight: 550; }
.rr-banner-exam { margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 0; }
.rr-exam-title { text-align: right; min-width: 0; }
.rr-exam-type { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rr-exam-sub { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.rr-nav-btns { display: flex; gap: 2px; padding-left: 8px; border-left: 1px solid var(--line); }
.rr-priors > summary { list-style: none; cursor: pointer; color: var(--accent); font-size: 12.5px; white-space: nowrap; }
.rr-priors > summary::-webkit-details-marker { display: none; }
.rr-priors .rr-menu-panel { left: 0; right: auto; min-width: 300px; }
.rr-priors .rr-menu-panel a { display: grid; grid-template-columns: 1fr auto; gap: 8px; }

.rr-split { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 6px var(--report-w); }
.rr-stage { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); background: var(--viewer-bg); }
.rr-stage-bar {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px; background: var(--surface);
  border-bottom: 1px solid var(--line); min-height: 44px;
}
.rr-stage-bar .rr-seg button { min-height: 28px; }
.rr-stage-bar .rr-seg .rr-late-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.rr-stage-tools { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.rr-stage-body { position: relative; min-height: 0; }
.rr-stage-body > iframe, .rr-stage-body > .rr-stage-pane { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.rr-stage-pane iframe { width: 100%; height: 100%; border: 0; background: #525659; }
.rr-scheduled { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; height: 100%; color: #b8c0cc; }

.rr-divider { cursor: col-resize; background: var(--line); position: relative; }
.rr-divider::after { content: ""; position: absolute; inset: 0 -4px; }
.rr-divider:hover, .rr-divider.rr-dragging { background: var(--accent-bg); }
.rr-split.rr-dragging iframe { pointer-events: none; }

/* report panel */
.rr-report { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: var(--surface); }
.rr-report-head { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--line); min-height: 44px; }
.rr-report-head h2 { font-size: 14px; }
.rr-report-head .rr-spacer { flex: 1; }
.rr-report-scroll { overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.rr-editor-wrap { position: relative; }
textarea#body {
  display: block; width: 100%; min-height: 34vh; resize: vertical; padding: 16px 18px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  font: 14.5px/1.6 var(--font); color: var(--text); tab-size: 4;
}
textarea#body[readonly] { color: var(--muted); background: var(--surface-2); }
textarea#body:focus { border-color: var(--focus); box-shadow: 0 0 0 3px var(--accent-soft); }

.rr-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); padding: 12px 14px; }
.rr-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }

/* code chips */
.rr-codefield { display: flex; flex-direction: column; gap: 8px; }
.rr-codefield + .rr-codefield { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.rr-codefield-label { display: flex; align-items: baseline; gap: 8px; }
.rr-codefield-label strong { font-size: 13px; }
.rr-codefield-label span { color: var(--muted); font-size: 12px; }
.rr-codechips { display: flex; flex-wrap: wrap; gap: 6px; }
.rr-codechip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-height: 28px; padding: 0 4px 0 10px;
  border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line-strong); font-size: 12.5px;
}
.rr-codechip b { font-family: var(--mono); font-weight: 600; }
.rr-codechip span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 30ch; }
.rr-codechip .rr-primary-tag { color: var(--accent); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.rr-codechip button { width: 24px; height: 24px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.rr-codechip button:hover { background: var(--danger-soft); color: var(--danger); }
.rr-codeinput { width: 100%; }
.rr-codeinput[disabled] { opacity: 0.5; }
.rr-codeinput[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

/* hand-written values (contract from main; restyled) */
.rr-hand { border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--line)); background: var(--warn-soft); border-radius: var(--radius); padding: 12px 14px; }
.rr-hand h4 { font-size: 13px; margin-bottom: 4px; display: flex; justify-content: space-between; gap: 8px; }
.rr-hand .rr-hand-help { margin: 0 0 8px; color: var(--muted); font-size: 12.5px; }
.rr-hand ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.rr-hand li { position: relative; display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; background: var(--surface); border: 1px solid var(--line); }
.rr-hand li:hover, .rr-hand li:focus-visible { border-color: var(--warn); }
.rr-hand li code { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.rr-hand li .rr-hand-state { margin-left: auto; font-size: 12px; color: var(--warn); }
.rr-hand li .rr-hand-state::after { content: "Check ink"; }
.rr-hand li.confirmed { opacity: 0.75; }
.rr-hand li.confirmed .rr-hand-state { color: var(--ok); }
.rr-hand li.confirmed .rr-hand-state::after { content: "\2713 Confirmed"; }
.rr-hand .rr-hand-peek {
  display: none; position: absolute; z-index: 5; right: 8px; bottom: calc(100% + 6px); max-width: 280px; max-height: 140px;
  background: #fff; border: 1px solid var(--line-strong); border-radius: 6px; box-shadow: var(--shadow);
}
.rr-hand li:hover .rr-hand-peek[src], .rr-hand li:focus .rr-hand-peek[src] { display: block; }
#rr-hand-dialog img { display: block; max-width: 100%; margin: 10px 0; background: #fff; border-radius: 6px; border: 1px solid var(--line); }

.rr-signed-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rr-signed-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.rr-signed-list .rr-muted { flex-basis: 100%; }

/* activity */
.rr-activity > summary { cursor: pointer; color: var(--muted); list-style: none; display: flex; align-items: center; gap: 6px; }
.rr-activity > summary::-webkit-details-marker { display: none; }
.rr-activity[open] > summary { margin-bottom: 8px; color: var(--text); }
table.rr-history { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
table.rr-history th, table.rr-history td { text-align: left; padding: 5px 6px; border-bottom: 1px solid var(--line); font-size: 12px; vertical-align: top; }
table.rr-history th { color: var(--muted); font-weight: 600; }
table.rr-history td.rr-detail { font-family: var(--mono); font-size: 11px; color: var(--muted); word-break: break-word; }

/* sign bar */
.rr-signbar { border-top: 1px solid var(--line); background: var(--surface); padding: 10px 14px 12px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 -8px 20px rgba(0,0,0,.12); }
.rr-readiness { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 24px; }
.rr-ready-item { display: inline-flex; align-items: center; gap: 4px; min-height: 24px; padding: 0 9px 0 6px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--danger-soft); color: var(--danger); }
.rr-ready-item.ok { background: var(--ok-soft); color: var(--ok); }
.rr-ready-item .rr-i { width: 14px; height: 14px; }
.rr-savestate { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.rr-savestate.rr-bad { color: var(--danger); }
.rr-sign-msg { color: var(--danger); font-size: 12.5px; font-weight: 500; flex-basis: 100%; }
.rr-sign-row { display: flex; align-items: center; gap: 10px; }
.rr-sign-who { min-width: 0; color: var(--muted); font-size: 12px; line-height: 1.3; }
.rr-sign-who b { display: block; color: var(--text); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rr-sign-row .rr-btns { margin-left: auto; display: flex; gap: 8px; }
#rr-sign-next-btn { min-height: 38px; padding: 0 16px; }
#rr-sign-btn { min-height: 38px; }
.rr-signbar-done { display: flex; align-items: center; gap: 10px; color: var(--ok); font-weight: 500; }

.rr-late { color: var(--warn); font-size: 12px; display: inline-flex; align-items: center; gap: 4px; }
.rr-note { padding: 8px 12px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--text); font-size: 12.5px; }

/* smaller screens: keep everything reachable */
@media (max-width: 1280px) {
  :root { --rail-w: 248px; }
  .rr-user-name, .rr-toplink span.rr-hide-sm { display: none; }
}
@media (max-width: 1100px) {
  .rr-ws { grid-template-columns: 0 minmax(0, 1fr); }
  .rr-ws .rr-rail { visibility: hidden; }
  .rr-ws.rr-rail-open { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
  .rr-ws.rr-rail-open .rr-rail { visibility: visible; }
  .rr-exam-sub { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- report replica (structured report edited on the page itself) ---------- */
.rr-replica { display: flex; flex-direction: column; gap: 10px; }
.rr-replica-bar { display: flex; align-items: center; gap: 10px; min-height: 28px; }
.rr-replica-hint { color: var(--muted); font-size: 12.5px; }
.rr-replica-state { margin-left: auto; color: var(--muted); font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }
.rr-replica-state.rr-bad { color: var(--danger); }
.rr-btn-sm { min-height: 28px; padding: 0 10px; font-size: 12.5px; }
.rr-replica-pages { display: flex; flex-direction: column; gap: 14px; }
.rr-sheet {
  position: relative; width: 100%; aspect-ratio: 8.5 / 11; background: #fff; color: #111;
  border-radius: 3px; box-shadow: 0 1px 2px rgba(0,0,0,.35), 0 8px 24px rgba(0,0,0,.28);
}
[data-theme="light"] .rr-sheet { box-shadow: 0 1px 2px rgba(15,23,42,.12), 0 8px 24px rgba(15,23,42,.12); outline: 1px solid var(--line); }
.rr-replica-actual .rr-replica-pages { overflow-x: auto; }
.rr-replica-actual .rr-sheet { width: 816px; flex: none; }
.rr-sheet-img { display: block; width: 100%; height: 100%; border-radius: 3px; user-select: none; -webkit-user-drag: none; }
.rr-sheet-skeleton { display: grid; place-items: center; color: #6b7280; font-size: 13px;
  background: repeating-linear-gradient(180deg, #fff 0 22px, #f3f4f6 22px 24px); }
.rr-fld {
  position: absolute; display: block; padding: 0; margin: 0; border: 1.5px solid transparent; border-radius: 3px;
  background: transparent; cursor: pointer; min-width: 12px; min-height: 12px;
}
.rr-fld:hover { border-color: rgba(37, 99, 235, .55); background: rgba(37, 99, 235, .06); }
.rr-fld:focus-visible, .rr-fld.rr-fld-open { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.28); background: rgba(37, 99, 235, .08); }
.rr-fld-changed { background: rgba(37, 99, 235, .10); }
.rr-fld-hand { border-color: #d97706; background: rgba(245, 158, 11, .16); }
.rr-fld-hand::after { content: ""; position: absolute; top: -4px; right: -4px; width: 8px; height: 8px; border-radius: 50%; background: #d97706; box-shadow: 0 0 0 2px #fff; }
span.rr-fld { cursor: default; pointer-events: none; }
.rr-sheet-band { position: absolute; border: 1.5px dashed #2563eb; border-radius: 4px; background: rgba(37,99,235,.04);
  display: grid; place-items: center; pointer-events: none; }
.rr-sheet-band span { font-size: 11px; color: #1d4ed8; background: #fff; padding: 1px 6px; border-radius: 4px; }
.rr-replica-sign-note { margin: 0; color: var(--muted); font-size: 12px; }

.rr-report-scroll { position: relative; }
.rr-fld-pop {
  position: absolute; z-index: 25; width: min(360px, calc(100% - 16px)); padding: 12px; display: flex; flex-direction: column; gap: 8px;
  background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow);
}
.rr-pop-label { font-weight: 600; font-size: 13px; }
.rr-pop-note { color: var(--muted); font-size: 12px; }
.rr-pop-ink { display: block; max-width: 100%; max-height: 120px; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.rr-pop-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.rr-opt { min-height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); cursor: pointer; font: inherit; font-size: 13px; }
.rr-opt:hover { background: var(--surface-3); }
.rr-opt[aria-pressed="true"] { background: var(--accent-bg); border-color: transparent; color: #fff; }
.rr-pop-input { width: 100%; font: 14px/1.5 var(--font); }
textarea.rr-pop-input { resize: vertical; min-height: 110px; }
.rr-pop-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.rr-fld-overflow { border-color: #dc2626 !important; background: rgba(220, 38, 38, .10); }
.rr-pop-warn { color: var(--danger); font-weight: 500; }
.rr-signed-pdf { width: 100%; height: calc(100vh - 260px); min-height: 420px; border: 1px solid var(--line); border-radius: 4px; background: #525659; }

/* Stale-draft conflict (save refused with 409 changed_elsewhere): keep text, tell the physician. */
.rr-stale-notice { margin: 8px 12px; padding: 10px 12px; border: 1px solid var(--danger); background: var(--danger-soft); border-radius: 8px; }
.rr-stale-notice[hidden] { display: none; }
.rr-stale-notice p { margin: 0 0 8px; }
.rr-stale-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* server-side paging (100 rows per page) */
.rr-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 8px 0; color: var(--muted); font-size: 13px; }
.rr-pager-nav { display: flex; align-items: center; gap: 4px; }
.rr-pager-pos { padding: 0 6px; color: var(--text); }
.rr-pager [aria-disabled="true"] { opacity: .4; pointer-events: none; }

/* Technologist edit-only cue (sign bar) and the forced first-login password notice. */
.rr-tech-cue b { color: var(--warn); white-space: normal; }
.rr-notice { margin: 0 0 14px; padding: 10px 12px; border-radius: var(--radius, 6px); background: var(--warn-soft); color: var(--text); font-size: 13px; line-height: 1.4; }

/* Laterality selector in the codes card (exam page; reading_room/laterality.py). */
.rr-laterality { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px dashed var(--line); }
.rr-laterality-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rr-laterality .rr-seg button { min-height: 28px; }
.rr-laterality [hidden] { display: none; }

/* ---------- status legend (2026-10-09): "?" button beside the status chips + dialog ---------- */
.rr-legend-btn { width: 28px; height: 28px; border-radius: 999px; border-color: var(--line); flex: none; }
.rr-legend-btn:hover { border-color: var(--line-strong); }
.rr-rail-views .rr-legend-btn { width: 26px; height: 26px; }
.rr-chips > .rr-legend-btn { align-self: center; }
.rr-legend { max-width: min(680px, 94vw); max-height: 90vh; overflow-y: auto; }
.rr-legend h3 { margin: 14px 0 6px; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.rr-legend-list { display: grid; grid-template-columns: max-content 1fr; gap: 0; margin: 0; }
.rr-legend-list dt, .rr-legend-list dd { margin: 0; padding: 8px 0; border-bottom: 1px solid var(--line); }
.rr-legend-list dt { padding-right: 18px; }
.rr-legend-list dd { color: var(--text); line-height: 1.4; }
.rr-legend-list .rr-chip { cursor: default; }
@media (max-width: 560px) {
  .rr-legend-list { grid-template-columns: 1fr; }
  .rr-legend-list dt { border-bottom: 0; padding-bottom: 0; }
}
/* ---------- stage: split view (images | document) and pop-out (fb/popout) ---------- */
/* Split: the stage body becomes a 2-column grid, images left and the selected document right. Both panes
   stay mounted (no iframe reload); the JS only toggles [hidden] and this class. */
.rr-stage-body.rr-stage-split {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr);
  gap: 2px; background: var(--line);
}
.rr-stage-body.rr-stage-split > iframe,
.rr-stage-body.rr-stage-split > .rr-stage-pane { position: relative; inset: auto; min-width: 0; min-height: 0; }
.rr-stage-body.rr-stage-split > [data-pane="images"] { grid-column: 1; grid-row: 1; background: var(--viewer-bg); }
.rr-stage-body.rr-stage-split > .rr-stage-pane { grid-column: 2; grid-row: 1; }
/* The two new controls make the bar wider than a narrow stage (5 tabs + viewer toggle + Split + 2 icons): let it wrap
   onto a second row instead of spilling over the divider and the report panel. */
.rr-stage { grid-template-columns: minmax(0, 1fr); }
.rr-stage-bar { flex-wrap: wrap; row-gap: 4px; }
.rr-stage-bar .rr-seg button[disabled] { opacity: 0.4; cursor: default; }
.rr-stage-bar .rr-seg button[disabled]:hover { color: var(--muted); }
@media (max-width: 1100px) {
  /* too narrow for two readable panes: stack them instead */
  .rr-stage-body.rr-stage-split { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); }
  .rr-stage-body.rr-stage-split > .rr-stage-pane { grid-column: 1; grid-row: 2; }
}
/* =====================================================================
   Navigation quick wins (2026-10-09): home control, worklist row links, prior-exam chips
   ===================================================================== */
/* Brand = home button: mark + name, then a "Worklist" pill with a house icon. */
.rr-home { padding: 2px 4px 2px 2px; border-radius: 9px; }
.rr-home:hover { background: var(--surface-2); }
.rr-home .rr-home-pill {
  display: inline-flex; align-items: center; gap: 5px; margin-left: 4px; min-height: 26px; padding: 0 10px 0 8px;
  border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface-2);
  color: var(--muted); font-size: 13px; font-weight: 500;
}
.rr-home:hover .rr-home-pill, .rr-home:focus-visible .rr-home-pill { color: var(--text); background: var(--surface-3); }
@media (max-width: 1100px) { .rr-home .rr-brand-name { display: none; } }

/* Worklist rows: the patient cell is a real link (opens the exam in a new tab). */
.rr-row-link { display: block; color: inherit; }
.rr-row-link:hover { text-decoration: none; }
.rr-row-link:hover .rr-cell-main { text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 3px; }

/* Prior exams: one-click chips under the patient ids (each opens in a new tab). */
/* The patient block takes the space left of the exam block (so a row of chips wraps instead of squeezing it). */
.rr-banner-bar .rr-patient { flex: 1 1 0; }
.rr-prior-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 6px; margin-top: 2px; min-width: 0; }
.rr-prior-label { color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
.rr-prior-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 34ch; min-height: 22px; padding: 0 9px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font-size: 12px; white-space: nowrap;
}
.rr-prior-chip:hover { background: var(--surface-3); border-color: var(--line-strong); text-decoration: none; }
.rr-prior-chip .rr-dot { width: 7px; height: 7px; }
.rr-prior-chip .rr-dot-ready_to_review { box-shadow: none; }
.rr-prior-type { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.rr-prior-date { flex: none; margin-left: -3px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rr-prior-chips .rr-priors > summary { padding: 0 4px; }
/* ---------------------------------------------------------------------------------------------
   Review strip (initReviewStrip): under the OHIF viewer, a large image counter, Prev / Next,
   auto-advance with a per-image dwell, and "Fit each image". Always dark like the viewer in both
   themes; the counter is legacy-PACS overlay yellow (#FFD600 on near-black, about 14:1).
   --------------------------------------------------------------------------------------------- */
.rr-stage { grid-template-rows: auto minmax(0, 1fr) auto; }
.rr-review-strip {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: 6px 10px;
  background: #0a0b0d; border-top: 1px solid #262b33; color: #d7dce3; font-size: 13px;
  container: rr-strip / inline-size;
}
.rr-review-strip[hidden] { display: none; }
.rr-rs-counter {
  min-width: 15ch; margin-right: 4px; color: #FFD600; font: 700 20px/1.25 var(--mono);
  font-variant-numeric: tabular-nums; white-space: nowrap; text-shadow: 0 1px 0 #000;
}
.rr-rs-counter b { font-weight: 700; }
.rr-rs-counter.rr-rs-counted { font-style: italic; }   /* counted by the strip, not read from the viewer */
.rr-rs-btn {
  display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 0 10px;
  border: 1px solid #3a414c; border-radius: var(--radius-sm); background: #171b21; color: #e7eaef;
  font: inherit; font-weight: 600; cursor: pointer;
}
.rr-rs-btn:hover { background: #232a34; }
.rr-rs-btn[disabled] { opacity: 0.4; cursor: default; background: #171b21; }
.rr-rs-auto[aria-pressed="true"] { background: #FFD600; border-color: #FFD600; color: #111; }
.rr-rs-lock[aria-pressed="true"] { background: #FFD600; border-color: #FFD600; color: #111; }
.rr-rs-field { display: inline-flex; align-items: center; gap: 6px; color: #c3cad4; white-space: nowrap; cursor: pointer; }
.rr-rs-field select {
  min-height: 30px; padding: 0 6px; background: #171b21; color: #e7eaef;
  border: 1px solid #3a414c; border-radius: var(--radius-sm); font: inherit;
}
.rr-rs-field input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: #FFD600; }
/* The note never wraps the strip (a height change would resize the viewer mid-review); too narrow to read, it is
   dropped: the counter ("31 / 31") and the Auto-advance button state still say what happened. */
.rr-rs-note { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #aeb6c2; font-size: 12.5px; }
@container rr-strip (max-width: 899px) { .rr-rs-note { display: none; } }
.rr-review-strip :focus-visible { outline: 2px solid #9cc2ff; outline-offset: 2px; }
/* Viewer iframe stays laid out while a reference document is shown (fix: "image shrinks when going
   back and forth"). With display:none the OHIF 3.12 side-panel ResizeObserver converts its pixel
   widths against a 0-px panel group and corrupts them, so the viewport came back narrower after each
   Images <-> document switch (measured 373 -> 387 -> 264 px wide canvas). visibility:hidden keeps
   the iframe's size; the document pane sits on top and hidden content takes no pointer/focus. */
.rr-stage-body > #rr-viewer-frame[hidden] { display: block !important; visibility: hidden !important; }
/* ===== Compare with a prior (banner menu; 2-up in OHIF) ===== */
.rr-compare > summary { list-style: none; cursor: pointer; color: var(--accent); font-size: 12.5px; white-space: nowrap; }
.rr-compare > summary::-webkit-details-marker { display: none; }
.rr-compare.rr-compare-on > summary { color: var(--text); background: var(--accent-soft); border-radius: 999px; padding: 0 8px; }
.rr-compare .rr-menu-panel { left: 0; right: auto; z-index: 30; min-width: 340px; max-width: min(460px, 80vw); max-height: 60vh; overflow: auto; }
.rr-compare .rr-menu-panel button.rr-compare-item { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: baseline; }
.rr-compare-item[aria-pressed="true"] { background: var(--accent-soft); }
.rr-compare-desc { font-weight: 550; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rr-compare-date { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.rr-compare-meta { grid-column: 1 / -1; color: var(--faint); font-size: 12px; }
.rr-compare-note { margin: 0; padding: 6px 10px; color: var(--muted); font-size: 12px; line-height: 1.4; white-space: normal; }
.rr-compare-hint { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 8px; }
/* ---- Pop-out window wrapper (/exams/<id>/popout/<kind>; fb2/nav2) ---------------------------------------------
   No app shell: a one-line patient/exam header over the document or viewer, which fills the rest of the window. */
body.rr-body-popout { overflow: hidden; }
body.rr-body-popout .rr-main-popout { padding: 0; max-width: none; margin: 0; height: 100vh; }
.rr-popout { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.rr-popout-bar {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 16px; flex: 0 0 auto;
  padding: 8px 14px; background: var(--surface); border-bottom: 1px solid var(--line); font-size: 13px;
}
.rr-popout-name { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }
.rr-popout-item { color: var(--muted); white-space: nowrap; }
.rr-popout-item b { color: var(--text); font-weight: 600; }
.rr-popout-type { color: var(--text); }
.rr-popout-kind {
  margin-left: auto; padding: 1px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent);
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.rr-popout-frame { flex: 1 1 auto; min-height: 0; width: 100%; border: 0; background: var(--surface-2); }
.rr-popout-empty {
  flex: 1 1 auto; display: flex; align-items: center; justify-content: center; padding: 24px;
  color: var(--muted); font-size: 16px; text-align: center;
}
/* The moment the exam changes the old patient is hidden; the next page replaces this one. */
.rr-popout.rr-popout-switch .rr-popout-bar, .rr-popout.rr-popout-switch .rr-popout-frame,
.rr-popout.rr-popout-switch .rr-popout-empty { visibility: hidden; }
.rr-popout-switching {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 16px; background: var(--bg);
}
.rr-popout-switching[hidden] { display: none; }

/* ---------------------------------------------------------------------------------------------
   Review strip speed slider (fb2/prefetch): replaces the dwell <select>. 1 s ... 10 s per image
   (1 ... 0.1 frame/s); the live label has a fixed width so the strip does not jitter while dragging.
   --------------------------------------------------------------------------------------------- */
.rr-rs-speed input[type="range"] { width: 96px; margin: 0; accent-color: #FFD600; cursor: pointer; }
.rr-rs-speed output { display: inline-block; min-width: 20ch; color: #e7eaef; font-size: 12.5px; font-variant-numeric: tabular-nums; }
/* ---- No accession: exam named by its StudyInstanceUID tail (fb2/noacc, 2026-10-09) ---- */
.rr-noacc { color: var(--warn); cursor: help; }

/* ---- Split 3:2, worklist no-match note (fb3/splitux, 2026-10-09) -------------------------------------------------
   Split gives the images 3 parts and the document 2: OHIF needs the width more than a PDF page does. The stacked
   layout under 1100 px (rows, not columns) is unchanged. */
.rr-stage-body.rr-stage-split { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
@media (max-width: 1100px) {
  .rr-stage-body.rr-stage-split { grid-template-columns: minmax(0, 1fr); }
}
/* The quick filter hid every row on this page: one quiet line where the rows were. */
.rr-filter-empty[hidden] { display: none; }
.rr-filter-empty .rr-empty-state { padding: 28px 12px; text-align: center; }
.rr-filter-empty .rr-empty-state .rr-i { color: var(--faint); }
.rr-filter-empty p { margin: 0; overflow-wrap: anywhere; }

/* ---- Worklist column filters: a multi-select in every column header (fb3/techfilter, 2026-10-09) ---------------
   The header button ("Technologist: You") is the column header itself, so it shares the column's width and moves
   with it; its panel drops below. The table wrap lets the panel out (and rounds its own corners instead). */
.rr-colfilter-form { display: none; }
.rr-table-wrap.rr-has-colfilters { overflow: visible; }
.rr-has-colfilters table.rr-list thead th:first-child { border-top-left-radius: var(--radius-lg); }
.rr-has-colfilters table.rr-list thead th:last-child { border-top-right-radius: var(--radius-lg); }
.rr-has-colfilters table.rr-list tbody tr:last-child td:first-child { border-bottom-left-radius: var(--radius-lg); }
.rr-has-colfilters table.rr-list tbody tr:last-child td:last-child { border-bottom-right-radius: var(--radius-lg); }
table.rr-list thead tr.rr-colhead th { position: relative; padding: 6px 6px; vertical-align: middle; }
table.rr-list thead tr.rr-colhead th.rr-th-plain { padding-left: 12px; }
.rr-colfilter { position: relative; }
.rr-colfilter > summary { list-style: none; }
.rr-colfilter > summary::-webkit-details-marker { display: none; }
.rr-colfilter-btn {
  display: flex; align-items: center; max-width: 100%; min-height: 30px; padding: 0 6px; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer; white-space: nowrap; overflow: hidden; user-select: none;
}
.rr-colfilter-btn:hover { background: var(--surface-3); color: var(--text); }
.rr-colfilter-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.rr-colfilter-sep { white-space: pre; }
.rr-colfilter-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--faint); }
.rr-colfilter-btn .rr-i { flex: none; margin-left: 3px; }
.rr-colfilter-on > .rr-colfilter-btn { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--text); }
.rr-colfilter-on .rr-colfilter-value { color: var(--text); font-weight: 650; }
.rr-colfilter-panel {
  position: absolute; z-index: 25; top: calc(100% + 4px); left: 0; min-width: 220px; max-width: min(360px, 86vw);
  padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 400; color: var(--text);
}
tr.rr-colhead th:nth-last-child(-n+2) .rr-colfilter-panel { left: auto; right: 0; }
.rr-colfilter-find { width: 100%; margin-bottom: 6px; }
.rr-colfilter-actions { display: flex; gap: 6px; margin-bottom: 4px; }
.rr-colfilter-actions .rr-btn { min-height: 26px; padding: 0 10px; font-size: 12.5px; }
.rr-colfilter-options { display: flex; flex-direction: column; max-height: min(320px, 50vh); overflow: auto; }
.rr-colfilter-opt { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: var(--radius-sm); cursor: pointer; white-space: nowrap; }
.rr-colfilter-opt:hover, .rr-colfilter-opt:focus-within { background: var(--surface-2); }
.rr-colfilter-opt[hidden] { display: none; }
.rr-colfilter-opt input { width: 15px; height: 15px; margin: 0; flex: none; accent-color: var(--accent); }
.rr-colfilter-dates { display: flex; flex-direction: column; gap: 8px; }
.rr-colfilter-dates .rr-colfilter-actions { margin: 2px 0 0; }
.rr-th-patient { min-width: 210px; }
.rr-th-patient .rr-th-search { max-width: none; min-height: 30px; text-transform: none; letter-spacing: 0; font-weight: 400; }
.rr-th-patient .rr-th-search input { min-height: 28px; font-size: 13px; }
.rr-th-patient .rr-search-results { top: calc(100% + 2px); left: 6px; text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 13px; color: var(--text); }
.rr-col-tech { white-space: nowrap; }
.rr-colfilter-reset { align-self: center; margin-left: 6px; font-size: 12.5px; }
.rr-tech-hint a { margin-left: 4px; white-space: nowrap; }
.rr-account { max-width: 460px; }
.rr-account code { font-size: 12px; }
.rr-codes-form { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin: 0; }
.rr-codes-form input { width: 9em; }

/* ---------- Config module (/config/*, admin only; its own tab) ---------- */
.rr-config { max-width: none; padding: 0; }
.rr-config-top {
  position: sticky; top: 0; z-index: 30; min-height: var(--topbar-h); flex-wrap: wrap;
  display: flex; align-items: center; gap: 14px; padding: 6px 18px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.rr-config-tag { color: var(--accent); font-weight: 600; margin-left: 2px; }
.rr-config-who { color: var(--faint); font-size: 12.5px; }
.rr-config-sync { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 3px 10px; border-radius: 999px; }
.rr-config-sync.is-ok { color: var(--ok); background: var(--ok-soft); }
.rr-config-sync.is-warn { color: var(--warn); background: var(--warn-soft); }
.rr-config-alert { margin: 14px 24px 0; padding: 10px 14px; border-radius: 8px; color: var(--danger); background: var(--danger-soft); }
.rr-config-page { padding: 20px 24px 60px; max-width: 1600px; margin: 0 auto; }
.rr-config-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.rr-config-head h1 { margin: 0 0 4px; font-size: 22px; letter-spacing: -0.01em; }
.rr-config-lede { margin: 0; color: var(--muted); max-width: 820px; }
.rr-config-crumb { margin: 0 0 8px; color: var(--muted); font-size: 12.5px; }
.rr-config-search { display: inline-flex; align-items: center; gap: 6px; color: var(--faint); }
.rr-config-search input { width: 240px; }
.rr-config-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; }
.rr-config-card h2 { margin: 0 0 8px; font-size: 15px; display: inline-flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.rr-config-card h3 { margin: 14px 0 6px; font-size: 13px; color: var(--muted); }
.rr-config-card details > summary { cursor: pointer; list-style: revert; }
.rr-config-card details > summary h2 { margin: 0; }
.rr-config-sub { color: var(--faint); font-weight: 400; font-size: 12px; }
.rr-config-hint { color: var(--muted); font-size: 12.5px; margin: 4px 0 10px; }
.rr-config-label { display: block; color: var(--faint); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.rr-config-row { display: flex; gap: 8px; }
.rr-config-row input { flex: 1; max-width: 560px; }
.rr-config-scroll { overflow-x: auto; }
.rr-config-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rr-config-table th { text-align: left; color: var(--faint); font-weight: 500; font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.rr-config-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.rr-config-table tr:last-child td { border-bottom: 0; }
.rr-config-table input[type=text], .rr-config-table select, .rr-config-table textarea { width: 100%; min-width: 90px; }
.rr-config-table textarea { resize: vertical; font: inherit; }
.rr-config-table tr.is-off td { opacity: .55; }
.rr-config-table tr.rr-config-new td { background: var(--surface-2); }
.rr-config-plain { margin: 0; padding-left: 18px; }
.rr-config-plain li { margin: 4px 0; }
.rr-nowrap { white-space: nowrap; }
.rr-num { text-align: right; font-variant-numeric: tabular-nums; }
.rr-wordlist { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.rr-config code, .rr-wordlist code { font-family: var(--mono); font-size: 12px; padding: 1px 6px; border-radius: 5px; background: var(--surface-3); color: var(--text); }
.rr-opt { display: inline-block; font-size: 12px; padding: 1px 7px; margin: 1px 3px 1px 0; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted); }
.rr-opt.is-normal { border-color: transparent; background: var(--ok-soft); color: var(--ok); }
.rr-pill { display: inline-block; font-size: 11px; padding: 0 7px; border-radius: 999px; background: var(--surface-3); color: var(--muted); }
.rr-pill-accent { background: var(--accent-soft); color: var(--accent); }
.rr-tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.rr-tpl-card { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); color: var(--text); }
.rr-tpl-card:hover { border-color: var(--line-strong); background: var(--surface-2); text-decoration: none; }
.rr-tpl-card[hidden] { display: none; }
.rr-tpl-code { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--accent); letter-spacing: .02em; }
.rr-tpl-title { font-weight: 600; }
.rr-tpl-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; color: var(--faint); font-size: 12px; }
.rr-tpl-warn { color: var(--warn); font-size: 12px; }
.rr-tpl-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 42%); gap: 16px; align-items: start; }
.rr-tpl-preview { position: sticky; top: calc(var(--topbar-h) + 16px); }
.rr-tpl-preview iframe { width: 100%; height: calc(100vh - var(--topbar-h) - 80px); min-height: 520px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.rr-map-result { display: grid; grid-template-columns: 2fr 1.4fr 1fr 1fr; gap: 16px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.rr-dict-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; align-items: start; }
.rr-dict { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--surface-2); }
.rr-dict > summary { cursor: pointer; }
.rr-dict-table { margin-top: 6px; }
.rr-dict-table tbody { display: block; max-height: 320px; overflow-y: auto; }
.rr-dict-table thead, .rr-dict-table tbody tr { display: table; width: 100%; table-layout: fixed; }
.rr-config [hidden] { display: none !important; }
.rr-config-toast { position: fixed; right: 20px; bottom: 20px; z-index: 50; max-width: 460px; padding: 10px 14px; border-radius: 8px; background: var(--surface-3); color: var(--text); box-shadow: var(--shadow); border-left: 3px solid var(--ok); }
.rr-config-toast.is-bad { border-left-color: var(--danger); }
.rr-config-toast[hidden] { display: none; }
/* Tech-note shorthand tab */
#rr-sh-sample { width: 100%; max-width: 760px; }
#rr-sh-result.rr-map-result { grid-template-columns: 1fr; }
.rr-sh-out { min-height: 1.4em; white-space: pre-wrap; font-weight: 600; }
.rr-sh-help { margin: 4px 0 10px; padding-left: 18px; }
.rr-config-table td.rr-center { text-align: center; }
/* Report replica popover: the tech's original note beside the expanded "Other" text */
.rr-pop-orig { color: var(--faint); font-size: 12px; white-space: pre-wrap; max-height: 6.5em; overflow-y: auto; margin: 6px 0 0; }
@media (max-width: 1100px) {
  .rr-tpl-layout { grid-template-columns: 1fr; }
  .rr-tpl-preview { position: static; }
  .rr-map-result { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .rr-config-page { padding: 14px 16px 40px; }
  .rr-config-top { padding: 6px 16px; }
  .rr-config-search input { width: 100%; }
  .rr-config-nav { max-width: 100%; overflow-x: auto; }
  .rr-map-result { grid-template-columns: 1fr; }
}

/* ---- Incoming data while the exam is open (reading_room/incoming.py; app.js initIncoming) -------------------
   A pulsing warn-coloured button in the banner; the callout under it lists exactly what arrived. Reduced motion:
   no pulse, a steady double ring instead (the global reduced-motion rule above stops every animation). */
.rr-incoming { position: relative; flex: none; }
.rr-incoming[hidden] { display: none; }
.rr-incoming-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 28px; padding: 0 12px 0 10px; border-radius: 999px;
  border: 1px solid var(--warn); background: var(--warn-soft); color: var(--warn); font: inherit; font-size: 12.5px;
  font-weight: 650; cursor: pointer; white-space: nowrap;
}
.rr-incoming-btn:hover { background: color-mix(in srgb, var(--warn) 22%, transparent); }
.rr-incoming-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.rr-incoming-pulse { position: relative; width: 9px; height: 9px; border-radius: 50%; background: var(--warn); flex: none; }
.rr-incoming-pulse::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--warn);
  animation: rr-incoming-ping 1.4s var(--ease) infinite;
}
.rr-incoming:not(.rr-incoming-seen) .rr-incoming-btn { animation: rr-incoming-glow 1.4s ease-in-out infinite; }
.rr-incoming-seen .rr-incoming-pulse::after { animation: none; opacity: 0; }
.rr-incoming-info .rr-incoming-btn { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.rr-incoming-info .rr-incoming-pulse, .rr-incoming-info .rr-incoming-pulse::after { background: var(--accent); border-color: var(--accent); }
.rr-incoming-info .rr-incoming-pulse::after { background: transparent; }
@keyframes rr-incoming-ping { 0% { transform: scale(0.6); opacity: 0.9; } 80%, 100% { transform: scale(1.9); opacity: 0; } }
@keyframes rr-incoming-glow {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--warn) 0%, transparent); }
  50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--warn) 35%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .rr-incoming-pulse::after { opacity: 0; }
  .rr-incoming:not(.rr-incoming-seen) .rr-incoming-btn { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--warn); }
  .rr-incoming-info:not(.rr-incoming-seen) .rr-incoming-btn { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
}
.rr-incoming-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; width: min(620px, 92vw); max-height: min(70vh, 720px);
  overflow: auto; padding: 14px 16px; background: var(--surface); color: var(--text); border: 1px solid var(--line-strong);
  border-top: 3px solid var(--warn); border-radius: var(--radius); box-shadow: var(--shadow); text-align: left;
}
.rr-incoming-info .rr-incoming-panel { border-top-color: var(--accent); }
.rr-incoming-panel[hidden] { display: none; }
.rr-inc-head { display: flex; align-items: baseline; gap: 12px; justify-content: space-between; }
.rr-inc-head h3 { margin: 0; font-size: 15px; text-transform: none; letter-spacing: normal; color: var(--text); }
.rr-inc-series td:nth-child(n+3) { white-space: nowrap; }
.rr-inc-lead { margin: 8px 0 0; color: var(--muted); }
.rr-inc-sec { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); }
.rr-inc-sec h4 { margin: 0 0 6px; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.rr-inc-sec p { margin: 4px 0; }
.rr-inc-note { color: var(--muted); font-size: 12.5px; }
.rr-inc-tablewrap { overflow-x: auto; margin: 6px 0; }
.rr-inc-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.rr-inc-table caption { text-align: left; font-weight: 600; padding: 2px 0 6px; color: var(--text); }
.rr-inc-table th { text-align: left; font-weight: 600; color: var(--muted); padding: 4px 8px 4px 0; border-bottom: 1px solid var(--line); }
.rr-inc-table td { padding: 4px 8px 4px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.rr-inc-table tr.rr-inc-more { display: none; }
.rr-inc-table.rr-inc-all tr.rr-inc-more { display: table-row; }
.rr-inc-new { color: var(--warn); font-weight: 600; }
.rr-incoming-info .rr-inc-new { color: var(--accent); }
.rr-inc-keep { color: var(--ok); font-weight: 600; }
.rr-inc-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.rr-inc-actions p { margin: 0; }
.rr-inc-msg { margin: 8px 0 0; min-height: 1em; color: var(--muted); font-size: 12.5px; }
.rr-inc-msg:empty { display: none; }
/* worklist: a pending incoming update on the exam */
.rr-incoming-mark {
  display: inline-grid; place-items: center; width: 18px; height: 18px; margin-left: 4px; border-radius: 50%;
  background: var(--warn-soft); color: var(--warn); font-size: 11px; font-weight: 700; vertical-align: middle;
}
.rr-replica-fmode { color: var(--muted); font-size: 12px; }
.rr-replica-fmode.rr-fmode-edited { color: var(--warn, #9a6700); font-weight: 600; }

/* exam setup: sonographer + study type (2026-10-30) */
.rr-setup { margin: 4px 0 6px; font-size: 13px; }
.rr-setup > summary { cursor: pointer; color: var(--muted, #667); }
.rr-setup-body { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 14px; padding: 6px 0; }
.rr-setup-body label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.rr-setup-body select { min-width: 190px; }
.rr-ws-layout { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; flex-basis: 100%; font-size: 12px; }
.rr-ws-layout-current { font-weight: 600; }

/* Click-to-sort header buttons (list.html sortbtn): none -> asc -> desc -> none. */
.rr-th-flex { display: inline-flex; align-items: center; gap: 4px; }
a.rr-sort { display: inline-block; min-width: 18px; padding: 2px 4px; border-radius: 4px; color: var(--muted, #888); text-decoration: none; font-size: 12px; line-height: 1; vertical-align: middle; }
a.rr-sort:hover, a.rr-sort:focus-visible { background: var(--accent-soft); color: var(--text); }
a.rr-sort-on { color: var(--accent); font-weight: 600; }
th.rr-th-patient .rr-searchbox { display: inline-flex; }

/* Potential worklist merge badge + panel (list.html, worklist_merge.py). */
.rr-merge { margin-top: 4px; }
.rr-merge-badge { display: inline-block; cursor: pointer; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--accent-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); list-style: none; }
.rr-merge-badge::-webkit-details-marker { display: none; }
.rr-merge-panel { margin-top: 6px; padding: 8px 10px; border: 1px solid var(--border, #ccc); border-radius: 6px; background: var(--surface, var(--bg)); max-width: 420px; font-size: 12px; }
.rr-merge-dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 4px 0 8px; }
.rr-merge-dl dt { color: var(--muted, #888); }
.rr-merge-dl dd { margin: 0; }
.rr-merge-warn { margin: 0 0 8px; color: var(--warn, #b45309); }
.rr-merge-msg { margin-left: 8px; }

/* Proxy signing ("View worklist as", migration 0016) */
.rr-proxy-banner {
  position: sticky; top: 0; z-index: 31; display: flex; align-items: center; gap: 10px;
  padding: 6px 14px; background: var(--warn-soft); color: var(--text);
  border-bottom: 2px solid var(--warn); font-size: 13px;
}
.rr-proxy-banner span { flex: 1; min-width: 0; }
.rr-proxy-banner strong { color: var(--warn); }
body:has(.rr-proxy-banner) { --proxy-h: 46px; }
.rr-proxy-banner { height: var(--proxy-h, 46px); box-sizing: border-box; overflow: hidden; }
body:has(.rr-proxy-banner) .rr-topbar { top: var(--proxy-h); }
body.rr-body-workspace:has(.rr-proxy-banner) .rr-main-workspace { height: calc(100vh - var(--topbar-h) - var(--proxy-h)); }
.rr-proxy-pick { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.rr-proxy-pick label { color: var(--muted); font-size: 13px; }
.rr-proxy-pick select { max-width: 220px; }
.rr-proxy-table td, .rr-proxy-table th { vertical-align: top; }
.rr-proxy-table form { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0; }

/* Worksheet rebuild outcome (sign bar + Exam setup), driven by /exams/<id>/regenerate-status */
.rr-regen-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; max-width: 34em; min-width: 0; align-self: center; }
.rr-regen-status[hidden] { display: none; }
.rr-regen-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rr-regen-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: currentColor; }
.rr-regen-pending { color: var(--warn); }
.rr-regen-pending .rr-regen-dot { animation: rr-regen-pulse 1.1s ease-in-out infinite; }
.rr-regen-done { color: var(--ok); }
.rr-regen-failed { color: var(--danger); }
.rr-regen-reload { color: inherit; font-weight: 600; text-decoration: underline; }
@keyframes rr-regen-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .rr-regen-pending .rr-regen-dot { animation: none; } }

/* Software Dev Comments (Mgmt Module feedback to the development team; 2026-11-09) */
.rr-devc { display: flex; flex-direction: column; gap: 8px; }
.rr-devc-toggle { align-self: flex-start; }
.rr-devc-count { color: var(--muted); font-weight: 400; }
.rr-devc-panel { display: flex; flex-direction: column; gap: 8px; }
.rr-devc-panel[hidden] { display: none; }
.rr-devc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rr-devc-list li { border-left: 3px solid var(--line); padding: 2px 0 2px 8px; }
.rr-devc-meta { font-size: 12px; color: var(--muted); }
.rr-devc-body { white-space: pre-wrap; word-break: break-word; }
.rr-devc-note { font-size: 12px; margin-top: 2px; }
.rr-devc-badge { display: inline-block; padding: 0 6px; border-radius: 999px; font-size: 11px; background: var(--accent-soft); color: var(--accent); }
.rr-devc-badge.rr-devc-accepted, .rr-devc-badge.rr-devc-built { background: var(--ok-soft); color: var(--ok); }
.rr-devc-badge.rr-devc-rejected, .rr-devc-badge.rr-devc-deferred { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.rr-devc-label { font-size: 13px; font-weight: 600; }
.rr-devc textarea { width: 100%; box-sizing: border-box; resize: vertical; min-height: 80px; font: inherit;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; }
.rr-devc-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.rr-devc-state { margin-right: auto; font-size: 12px; }
