/* Shared application surfaces. Task-specific views attach their own sheets on entry. */
:root {
  --desk-ink: #152e36;
  --desk-muted: #486168;
  --desk-rule: #cddad8;
  --desk-wash: #edf3f1;
  --desk-teal: #11655e;
  --desk-deep: #15443f;
  --desk-active: #d6ece6;
  --desk-paper: #fff;
  --desk-amber: #a35b14;
  --desk-fail: #b93943;
  --desk-gray: #7b898b;
  --surface-page: #f1f5f3;
  --brand: var(--desk-teal);
  --brand-2: var(--desk-deep);
  --brand-3: var(--desk-deep);
  --brand-tint: var(--desk-wash);
  --text: var(--desk-ink);
  --sidebar: var(--desk-paper);
  --sidebar-text: var(--desk-muted);
  --sidebar-text-active: var(--desk-deep);
  --sidebar-border: var(--desk-rule);
  --sidebar-accent: var(--desk-teal);
  --sidebar-hover: var(--desk-wash);
  --sidebar-raised: var(--desk-active);
  --sidebar-w: 238px;
  --content-max: 1440px;
}
.evidence-entry { background: var(--desk-paper); border: 1px solid var(--desk-rule); border-radius: 6px; padding: clamp(16px,2vw,28px); }
.evidence-heading { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px; }
.evidence-heading h2, .evidence-heading p { margin:0; }
.evidence-heading p { margin-top:4px; color:var(--desk-muted); }
.evidence-counts { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(145px,100%),1fr)); margin:18px 0; gap:8px; }
.evidence-counts a { display:grid; gap:3px; padding:12px; border:1px solid var(--desk-rule); border-radius:5px; color:var(--desk-ink); }
.evidence-counts strong { font-size:24px; line-height:1.15; }
.evidence-counts span { color:var(--desk-muted); }
.directory-work-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); align-items:start; gap:14px; margin:.75rem 0; }
.directory-group { min-width:0; }
.directory-group > h2, .overview-work > h2 { margin:0 0 10px; font-size:1.12rem; color:var(--desk-ink); }
.study-command-overview { max-width:72rem; }
.study-command-overview .overview-metrics { align-items:start; grid-template-columns:minmax(8rem,.7fr) minmax(14rem,1.3fr) minmax(13rem,1fr); padding:1rem 0; }
.study-command-overview .overview-metrics small, .workspace-participant-counts dt { font-size:.83rem; color:var(--desk-muted); }
.study-command-overview .metric-context { margin:.35rem 0; color:var(--desk-muted); font-size:.84rem; line-height:1.4; }
.workspace-participant-counts { display:flex; flex-wrap:wrap; gap:.55rem 1.2rem; margin:0; }
.workspace-participant-counts dd { margin:.15rem 0 0; font-variant-numeric:tabular-nums; font-size:1.35rem; font-weight:650; line-height:1.2; }
.overview-attention, .overview-work { margin-block:1.25rem; }
.overview-attention { border-inline-start:3px solid var(--desk-teal); padding:.25rem 1rem; }
.overview-attention .waiting-card, .overview-area .flow-card { margin:0; padding:0; border:0; box-shadow:none; background:transparent; }
.overview-attention .waiting-card h2, .overview-work > h2 { font-size:1.12rem; }
.overview-attention .study-where { margin:.45rem 0; }
.overview-returned { display:flex; align-items:baseline; flex-wrap:wrap; gap:.1rem .7rem; margin:.45rem 0; font-size:.85rem; color:var(--desk-muted); }
.overview-area { margin:0; background:var(--desk-paper); border:1px solid var(--desk-rule); }
.overview-area + .overview-area { border-top:0; }
.overview-area:first-of-type { border-radius:7px 7px 0 0; }
.overview-area:last-of-type { border-radius:0 0 7px 7px; }
.overview-area > summary { display:grid; align-items:baseline; grid-template-columns:minmax(11rem,.4fr) 1fr auto; gap:.6rem; cursor:pointer; list-style:none; padding:1rem 1.15rem; }
.overview-area > summary::-webkit-details-marker { display:none; }
.overview-area > summary::after { content:""; width:.45rem; height:.45rem; border:solid currentColor; border-width:0 1.5px 1.5px 0; transform:rotate(45deg); align-self:center; }
.overview-area[open] > summary { background:var(--desk-wash); }
.overview-area[open] > summary::after { transform:rotate(225deg); }
.overview-area > summary:is(:hover,:focus-visible) { background:var(--desk-wash); }
.area-title { font-weight:650; color:var(--desk-deep); }
.area-purpose { color:var(--desk-muted); font-size:.9rem; line-height:1.45; }
.overview-area-body { padding:.85rem 1.15rem 1rem; }
.overview-area-body .overview-setup { border:0; padding:0; background:transparent; }
.workspace-actions { display:flex; flex-wrap:wrap; gap:.4rem 1.1rem; }
.workspace-action { padding:.3rem 0; font-weight:600; color:var(--desk-teal); text-decoration:underline; text-underline-offset:3px; }
.overview-area-body .sem-fold, .overview-attention .sem-fold { margin:.55rem 0 0; padding:.4rem 0 0; border:0; border-top:1px solid var(--desk-rule); box-shadow:none; }
.overview-patient-search { display:flex; flex-wrap:wrap; align-items:end; gap:8px; margin:0 0 12px; }
.overview-patient-search label { display:grid; flex:1 1 12rem; min-width:0; gap:4px; max-width:27rem; color:var(--desk-ink); font-weight:600; }
.overview-patient-search input { min-width:0; width:100%; }
@media(max-width:840px) {
  .directory-work-grid, .study-command-overview .overview-metrics { grid-template-columns:minmax(0,1fr); }
  .study-command-overview .overview-metrics { gap:.8rem; }
  .study-command-overview .overview-metrics > div { border:0; padding:0; }
  .overview-area > summary { grid-template-columns:1fr auto; gap:.15rem .6rem; }
  .area-purpose { grid-column:1; }
  .overview-area > summary::after { grid-column:2; grid-row:1 / 3; }
}
.audit-time { white-space:normal; color:var(--desk-muted); }
.audit-time span { white-space:nowrap; }
@media(max-width:650px) {
  .audit-row { flex-wrap:wrap; }
  .audit-row .audit-body { flex:1 1 65%; min-width:0; }
  .audit-aside { flex-basis:100%; justify-items:start; text-align:start; }
}
/* Shared source metadata also appears in the study Data and standards workstations. */
.sg-note { margin: 0; color: var(--text-body); font-size: var(--fs-small); }
.sg-coverage { margin: 0; color: var(--text-dim); font-size: var(--fs-small); font-variant-numeric: tabular-nums; }
.sg-count { font-variant-numeric: tabular-nums; color: var(--text-faint); }
.sidebar-brand { min-height: 68px; padding: 12px 18px; border-bottom: 1px solid var(--desk-rule); }
.sidebar-brand .brand-mark, .auth-card .brand-mark {
  border-radius: 9px 3px 9px 3px; background: var(--desk-deep); color: var(--on-accent);
}
.sidebar-brand .brand-mark { width: 34px; height: 34px; }
.brand-title { display: grid; gap: 2px; font-size: 16px; letter-spacing: -.035em; }
.brand-title small { color: var(--desk-muted); font-size: 10px; letter-spacing: .06em; }
.nav-find { display: flex; align-items: center; gap: 9px; margin: 16px 13px 4px; padding: 0 10px; border: 1px solid var(--desk-rule); border-radius: 6px; }
.nav-find:focus-within { outline: 2px solid var(--desk-teal); outline-offset: 1px; }
.nav-find input { width: 100%; min-width: 0; height: 34px; border: 0; outline: 0; background: transparent; font: inherit; font-size: 13px; color: var(--desk-ink); }
.nav-find input:focus-visible { outline: none; }
.nav-find-icon { position: relative; width: 12px; height: 12px; border: 1.6px solid currentColor; border-radius: 50%; flex: none; }
.nav-find-icon::after { content: ''; position: absolute; width: 6px; height: 1.5px; background: currentColor; transform: rotate(45deg); right: -4px; bottom: -2px; }
.nav-find-status { margin: 4px 14px; font-size: 12px; }
.nav { padding: 8px 10px 18px; }
.nav [hidden], .nav-find-status[hidden] { display: none !important; }
.nav-label { white-space: normal; border-top: 1px solid var(--desk-rule); margin-top: 8px; padding-top: 14px; letter-spacing: .045em; }
.nav-glyph { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.45; stroke-linejoin: round; stroke-linecap: round; }
.nav-group > summary { padding: 7px 10px; font-weight: 600; }
.nav-group > summary::before { order: 2; margin-inline-start: auto; }
.nav-group .nav-group { margin-inline-start: 12px; }
.nav-group .nav-group > summary { color: var(--text-dim); font-size: var(--fs-meta); }
#nav-group-portfolio {
  margin-block: 10px 6px;
  padding: 3px;
  border: 1px solid var(--desk-rule);
  border-block-start: 2px solid var(--desk-muted);
  border-radius: 6px;
  background: var(--desk-wash);
}
#nav-group-portfolio > summary { color: var(--desk-ink); }
#nav-group-portfolio .nav-title { white-space: normal; overflow-wrap: anywhere; }
.nav-scope-hint { display: block; margin-block-start: 2px; color: var(--desk-muted); font-size: var(--fs-meta); font-weight: 400; }
/* Label an actionable destination even when the adjacent group is collapsed. */
.nav-tab:has(.nav-dot), .nav-group:not([open]) > summary:has(.nav-dot) {
  background: var(--warn-tint);
  box-shadow: inset 3px 0 var(--desk-amber);
}
.nav-tab.is-active:has(.nav-dot) { box-shadow: inset 3px 0 var(--sidebar-accent); }
.nav-group > summary[data-active-area] { font-weight:700; color:var(--sidebar-text-active); }
.nav > .nav-tab.nav-child { margin-inline-start:14px; padding-inline-start:14px; border-inline-start:1px solid var(--desk-rule); border-radius:0; }
.nav-tab .nav-dot, .nav-group > summary .nav-dot {
  display: table; width: auto; height: auto; margin: 2px 0 0; padding: 1px 5px; border-radius: 4px;
  color: #713b08; background: #fff0d8;
  font-size: 11px; font-weight: 600; line-height: 1.35;
}
.nav-group[open] > summary .nav-dot { display: none; }
.nav-group .nav-child { border-inline-start: 1px solid var(--desk-rule); border-radius: 0 6px 6px 0; margin-inline-start: 18px; padding-inline-start: 14px; width: calc(100% - 18px); }
.sidebar-footer { padding: 9px 14px; }
.sidebar-systems { color: var(--desk-muted); }
.topbar { background: var(--desk-paper); border-bottom: 1px solid var(--desk-rule); }
.main-content { padding: clamp(16px,1.7vw,28px) clamp(16px,2.4vw,40px) 48px; }
.study-chrome { padding: 9px 14px; background: var(--desk-paper); border: 1px solid var(--desk-rule); border-inline-start: 4px solid var(--desk-teal); border-radius: 5px; }
.study-head { flex-wrap:wrap; align-items:center; }
.study-head-id { flex:1 1 min(100%,22rem); }
.study-head-utility { display:flex; flex-wrap:wrap; gap:6px; max-width:100%; }
@media(max-width:650px) {
  .study-head { display:grid; grid-template-columns:minmax(0,1fr); gap:9px; }
}
.study-head-title h1 { font-size: clamp(17px,1.5vw,24px); line-height: 1.15; }
.study-head-description { margin-top: 6px; max-width: 76ch; font-size: var(--fs-small); color: var(--text-dim); overflow-wrap: anywhere; }
.study-chrome [data-study-access-slot]:empty { display: none; }
.view > .card, .task-body > .card { border-color: var(--desk-rule); box-shadow: none; border-radius: 6px; }
.view .btn-primary { background: var(--desk-teal); border-color: var(--desk-teal); color: var(--on-accent); }
.view .btn-primary:hover { background: var(--desk-deep); }
.desk-heading, .studies-desk > .section-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding-block: 3px 12px; border-bottom: 1px solid var(--desk-rule); }
.desk-heading h1, .studies-desk > .section-head h1 { font-size: clamp(24px,2vw,33px); letter-spacing: -.045em; }
.home-front { display: grid; grid-template-columns: minmax(0,2.4fr) minmax(190px,1fr); gap: 16px; align-items: start; }
.home-front > :only-child { grid-column: 1/-1; }
.home-front .hero { margin: 0; max-width: none; min-width: 0; padding: clamp(16px,2.5vw,34px); border-left: 4px solid var(--desk-teal); border-radius: 6px; background: var(--desk-paper); }
.home-front .hero:has([data-tone="warning"]) { border-color: var(--desk-amber); }
.home-front .hero-h1 { color: var(--desk-ink); font-size: clamp(23px,2.6vw,38px); line-height: 1.12; letter-spacing: -.045em; max-width: 35ch; }
.home-front .hero-body { margin-top: 12px; font-size: 14px; }
.home-front .hero-actions { margin-top: 16px; }
.home-front .priority-study { margin: 6px 0; color: var(--desk-teal); font-weight: 650; }
.home-stage-run { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 4px; margin-top: 14px; }
.home-stage-run a { display: grid; gap: 1px; padding-top: 5px; color: var(--desk-ink); border-top: 3px solid var(--desk-rule); }
.home-stage-run span { color: var(--desk-muted); font-size: 11px; }
.home-stage-run [data-stage-state=done] { border-color: var(--desk-teal); }
.home-stage-run :is([data-stage-state=warn],[data-stage-state=next]) { border-color: var(--desk-amber); }
.home-stage-run [data-stage-state=error] { border-color: var(--desk-fail); }
.hold-related > summary { font-size: 12px; cursor: pointer; color: var(--desk-teal); }
.hold-related { padding: 5px 0; }
.home-front .hero-digest { display: block; margin-top: 18px; }
.hero-digest summary { cursor: pointer; font-weight: 600; }
.hero-digest[open] > span, .hero-digest[open] > a { display: block; margin-top: 6px; }
.portfolio-counts { padding: 16px; background: var(--desk-deep); color: var(--on-accent); border-radius: 6px; }
.portfolio-counts h2 { color: inherit; font-size: 14px; margin: 0 0 4px; }
.portfolio-counts a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-block: 9px; color: inherit; border-bottom: 1px solid color-mix(in srgb, currentColor 28%, transparent); }
.portfolio-counts a:last-child { border-bottom: 0; }
.portfolio-counts b, .task-totals b, .portfolio-filters b { font-size: 24px; font-variant-numeric: tabular-nums; line-height: 1; letter-spacing: -.06em; }
.portfolio-filters, .task-totals { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 1px; background: var(--desk-rule); border: 1px solid var(--desk-rule); border-radius: 6px; overflow: hidden; }
.portfolio-filters > button, .task-totals > div { display: flex; align-items: center; gap: 10px; padding: 12px; background: var(--desk-paper); color: var(--desk-muted); border: 0; text-align: left; font: inherit; }
.portfolio-filters button { cursor: pointer; }
.portfolio-filters button[aria-pressed=true] { color: var(--on-accent); background: var(--desk-deep); }
.portfolio-filters button:focus-visible { outline-offset: -3px; }
.task-totals b { color: var(--desk-ink); }
.roster-pipeline { display: grid; grid-template-columns: repeat(4,1fr); gap: 3px; }
.roster-pipeline span { display: grid; gap: 3px; font-size: 10px; }
.roster-pipeline i { display: block; height: 4px; border-radius: 1px; background: var(--desk-rule); }
.roster-pipeline [data-stage-state=done] i { background: var(--desk-teal); }
.roster-pipeline :is([data-stage-state=warn],[data-stage-state=next]) i { background: var(--desk-amber); }
.roster-pipeline [data-stage-state=error] i { background: var(--desk-fail); }
.roster-pipeline :is([data-stage-state=unknown],[data-stage-state=bypassed]) i { background: repeating-linear-gradient(120deg,var(--desk-gray) 0 3px,transparent 3px 6px); }
.task-desk { display: grid; grid-template-columns: minmax(140px,19%) minmax(0,1fr); gap: 16px; align-items: start; }
.task-roster { position: sticky; top: 0; display: grid; gap: 2px; min-width: 0; }
.task-roster h2 { font-size: 13px; margin: 6px 8px; }
.task-roster a { display: block; color: var(--desk-muted); padding: 6px 8px; overflow-wrap: anywhere; border-radius: 4px; }
.task-roster [aria-current] { color: var(--desk-deep); background: var(--desk-active); font-weight: 650; }
.task-body { display: grid; gap: 10px; min-width: 0; }
.task-body > [data-hold-group=waiting] { border-top: 3px solid var(--desk-amber); }
.task-body .hold-study { font-size: 14px; }
.owner-workbench { display: grid; grid-template-columns: minmax(165px,27%) minmax(0,1fr); gap: 14px; align-items: start; }
.owner-queue, .owner-record, .doc-sections > div:not(:empty), .recovery-desk {
  padding: 14px; background: var(--desk-paper); border: 1px solid var(--desk-rule); border-radius: 6px; min-width: 0;
}
.owner-record { display: grid; gap: 12px; }
.document-register .doc-study-card { min-width: 0; width: 100%; margin: 0; }
.document-register .doc-row { flex-wrap: wrap; row-gap: var(--space-1); }
.document-register .doc-name { overflow-wrap: anywhere; white-space: normal; }
.document-register .doc-study-id { min-width: 0; }
.vendor-oversight .owner-record:has([data-detail]:empty):has([data-editor]:empty) { display: none; }
.owner-queue h3 { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; margin-bottom: 10px; }
.owner-queue a { display: grid; gap: 3px; padding: 9px; border-block-start: 1px solid var(--desk-rule); }
.owner-queue a[aria-current] { background: var(--desk-active); }
.owner-queue a span, .owner-queue small { color: var(--desk-muted); }
.doc-sections { display: grid; gap: 12px; }
.doc-sections > div:empty { display: none; }
.identity-desk [data-study-record] { border-inline-start: 3px solid var(--desk-teal); }
.recovery-desk { margin: min(10vh,70px) auto; max-width: 680px; }
.auth-wrap { background: var(--desk-wash); }
.auth-card { border-radius: 8px; border-top: 5px solid var(--desk-teal); box-shadow: var(--shadow-panel); }
.auth-wrap .brand { justify-content: start; }
.auth-wrap .btn-primary { background: var(--desk-teal); }
@media (min-width: 821px) { .home-desk { align-self: start; } }
@media (max-width: 820px) {
  .sidebar-brand { border: 0; min-height: 0; padding: 7px 4px; }
  .sidebar-brand .brand-mark { width: 27px; height: 27px; }
  .brand-title { font-size: 14px; }
  .brand-title small { font-size: 9px; }
  .nav-find, .nav-find-status { display: none; }
  .nav-open .nav-find { display: flex; grid-column: 1/-1; margin: 4px 0; }
  .nav-open .nav-find-status:not([hidden]) { display: block; grid-column: 1/-1; }
  .home-front, .task-desk, .owner-workbench { grid-template-columns: minmax(0,1fr); }
  .task-roster { position: static; display: flex; align-items: baseline; overflow-x: auto; }
  .task-roster a, .task-roster h2 { white-space: nowrap; flex: none; }
  .task-totals > div, .portfolio-filters > button { align-items: start; flex-direction: column; gap: 6px; padding: 9px; font-size: 12px; }
  .main-content { padding: 12px 12px 32px; }
  .portfolio-counts { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
  .portfolio-counts h2 { grid-column: 1/-1; }
  .portfolio-counts a { flex-direction: column-reverse; align-items: start; justify-content: end; border: 0; font-size: 12px; }
}

.canonical-split:has(.canonical-editor.hidden),
.semantic-profile-split:has(#profile-form.hidden) { grid-template-columns: minmax(0, 1fr); }

.sp-timeline-picker { display:flex; flex-wrap:wrap; gap:.45rem .8rem; margin:.75rem 0 1rem; border:1px solid var(--desk-rule); border-radius:.6rem; padding:.6rem .85rem; }
.sp-timeline-picker legend { color:var(--desk-muted); padding:0 .35rem; }
.sp-timeline-picker label { display:inline-flex; align-items:center; gap:.35rem; cursor:pointer; }
.sp-timeline-study { min-width:0; padding:.75rem 0; border-top:1px solid var(--desk-rule); }
.sp-timeline-study h3 { margin:0 0 .45rem; }
.sp-timeline-study [data-timeline-selection] { margin-top:.5rem; padding:.8rem 1rem; }
.sp-timeline-study .ap3m-bar { top:12px; height:12px; border-radius:999px; }
.sp-timeline-study .ap3m-bar:not(.is-current) { opacity:.8; }
.sp-timeline-head { display:flex; justify-content:space-between; align-items:baseline; gap:1rem; }
.sp-groups .sp-groups-table { table-layout: fixed; }
.sp-groups-table tbody th[scope="row"] { padding: .8rem 1rem; border-bottom: 1px solid var(--desk-rule); }
.sp-groups-table thead th:first-child { width: 24%; }
.sp-groups .sp-group-members, .sp-groups .sp-member-sites { list-style: none; margin: 0; padding: 0; }
.sp-group-members > li + li { border-top: 1px solid var(--desk-rule); margin-top: .6rem; padding-top: .6rem; }
.sp-member-location, .sp-member-sites, .sp-site-detail { color: var(--desk-muted); font-size: var(--fs-micro); }
.sp-member-arm { font-weight: 650; }
.sp-site-detail summary { cursor: pointer; width: fit-content; }
.sp-site-detail[open] summary { margin-bottom: .25rem; }
.sp-member-sites li { padding: .12rem 0; }
@media (max-width: 680px) {
  .sp-groups .sp-groups-table, .sp-groups-table tbody, .sp-groups-table tr, .sp-groups-table td,
  .sp-groups-table tbody th[scope="row"] { display: block; width: auto; }
  .sp-groups-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .sp-groups-table tbody th[scope="row"] { background: var(--surface-2); }
  .sp-groups-table tbody tr + tr { border-top: 2px solid var(--desk-rule); }
  .sp-groups-table tbody td { padding: .7rem 1rem; }
  .sp-groups-table tbody td::before { display: block; content: attr(data-column-label); font-weight: 650; margin-bottom: .45rem; }
}
@media (max-width: 600px) {
  .sp-timeline-study .ap3m-scroll { --ap3m-label: clamp(100px, 30vw, 150px); --ap3m-count: 0px; }
  .sp-timeline-study .ap3m-head, .sp-timeline-study .ap3m-lane { grid-template-columns: var(--ap3m-gutter) var(--ap3m-label) minmax(150px, 1fr) 0; }
  .sp-timeline-study .ap3m-body { min-width: calc(var(--ap3m-gutter) + var(--ap3m-label) + 150px); }
  .sp-timeline-study .ap3m-head-count, .sp-timeline-study .ap3m-count, .sp-timeline-study .ap3m-month:nth-child(even) { display: none; }
  .sp-timeline-head a { white-space: nowrap; }
}
