/* Research and Library visibility repair. Scoped to these workspaces only. */
html body #app .research-hub :is(
 .rv31-nav-item,.rv31-nav-item span,.rv31-section-head p,
 .rv31-person-link--empty,.rv31-person-link b,.rv31-person-avatar,
 .rv31-domain small,.rv31-domain-label,.rv31-programme-open,
 .rv31-line-tabs button,.rv31-stream-metric small,.rv31-stream-arrow,
 .rv31-governance-metrics span,.rv31-output-row span,.rv31-output-row small,.rv31-output-row i,
 .rv32-pulse-row span,.rv32-pulse-row small,.rv36-filter-count,
 .rv32-state-rail button,.rv32-state-rail button span,
 .rv32-stage-rail button,.rv32-stage-rail button span,.rv32-stage-rail button strong,
 .rv32-row-governance>span,.rv32-row-recruitment>span,.rv32-row-recruitment small,
 .rv32-project-context>span,.rv32-row-arrow,.rv32-record-meta>span,
 .rv32-not-recorded,.rv32-governance-intro small,.rv32-governance-item span,
 .rv32-governance-item small,.rv32-project-step span,.rv32-section-heading>div>span,
 .rv32-fact-grid span,.rv32-fact-grid small,.rv32-side-section>span,
 .rv32-side-facts small,.rv32-line-link i,
 .rv33-relationship-band span,.rv33-relationship-band small,.rv33-life-lane-head span,
 .rv33-life-node span,.rv33-life-lane>p,.rv35-section-intro small,.rv35-section-intro>span
){color:#4c6576!important}
html body #app .research-hub .rv31-pulse-cell:not(.rv31-pulse-cell--lead) :is(.rv31-pulse-kicker,small){color:#4c6576!important}
/* Dark panels need explicit light text; generic heading rules previously won. */
html body #app .research-hub .rv32-innovation-need h2{color:#f3f8fa!important;line-height:1.45!important}
html body #app .research-hub .rv32-study-command .rv32-not-recorded{color:#c2d7df!important}
html body #app .research-hub :is(.rv31-nav-item.on,.rv31-line-tabs button.on,.rv32-state-rail button.on){color:#123d50!important}
html body #app .research-hub :is(.rv31-search,.rv32-search) input::placeholder{color:#526b7c!important;opacity:1!important}
html body #app .research-hub :is(.rv31-search,.rv32-search):focus-within{outline:2px solid #087c86;outline-offset:4px}
html body #app .research-hub .module-header .rv31-text-action{padding:9px 12px!important}
html body #app .research-hub .module-header .rv31-action-glyph{background:transparent!important;color:inherit!important;border-color:currentColor!important}
html body #app .news-view :is(.news-v25-tabs button span,.knowledge-v23-visibility,.publication-v23-missing,.knowledge-v23-meta span){color:#4c6576!important}
html body #app .news-view .publication-v23-year{color:#4c6576!important}
html body #app .news-view .news-v25-search input::placeholder{color:#526b7c!important;opacity:1!important}
html body #app .news-view .news-v25-search:focus-within{outline:2px solid #087c86!important;outline-offset:4px!important}
html body #app :is(.research-hub,.news-view) :is(button,a):focus-visible{outline:2px solid #087c86!important;outline-offset:3px!important}
html body #app :is(.research-hub,.news-view) .module-header button:focus-visible{outline-color:#97e1e2!important}
html body #app .news-view .news-editorial-kicker{text-transform:none!important}
/* Prevent flex shrinking from superimposing labels; keep all controls reachable. */
html body #app .news-view :is(.news-v25-tabs,.news-v28-lensbar){gap:18px!important;overflow-x:auto!important;flex-wrap:nowrap!important;scrollbar-width:thin!important}
html body #app .news-view :is(.news-v25-tabs,.news-v28-lensbar)>button{flex:0 0 auto!important;white-space:nowrap!important;min-height:42px!important}
html body #app .news-view .news-v25-tabs{min-width:0!important;max-width:100%!important}
html body #app .news-view .news-v28-lens-label{flex-shrink:0!important}
@media(max-width:720px){
 html body #app .news-view .news-v25-commandbar,
 html body #app .news-view .news-v25-commandbar:has(.news-v27-command-context){display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;gap:12px!important;padding:0 18px 14px!important}
 html body #app .news-view .news-v25-tabs{grid-column:1/-1!important;width:100%!important}
 html body #app .news-view .news-v25-search{display:flex!important;min-width:0!important;width:100%!important;grid-column:1!important}
 html body #app .news-view .news-v25-search input{min-width:0!important;width:100%!important}
 html body #app .news-view .news-v25-filter-toggle{grid-column:2!important}
 html body #app .news-view .news-v25-shown{grid-column:1/-1!important}
 html body #app .news-view .news-v25-collapse{width:auto!important;padding:0 10px!important;gap:7px!important}
 html body #app .news-view .news-v37-collapse-label{display:inline!important}
 html body #app .research-hub .rv31-search{width:100%!important;max-width:none!important}
 html body #app .research-hub .rv31-section-head{flex-direction:column!important;align-items:stretch!important;gap:18px!important}
 html body #app .research-hub .rv31-nav{overflow-x:auto!important;flex-wrap:nowrap!important;gap:20px!important}
 html body #app .research-hub .rv31-nav-item{flex:0 0 auto!important}
}
html body #app .research-hub :is(
 .rv32-project-stage-rail button span,.rv32-project-stage-rail button strong,
 .rv33-intel-panel header span,.rv33-intel-panel header small,
 .rv33-programme-table em,.rv33-programme-table i,.rv33-intel-list small,.rv33-intel-list i,
 .rv31-governance-title small,.rv31-line-tabs button span,.rv31-workstream-head>div>span
){color:#4c6576!important}

/* ── Research Intelligence charts (CSS magnitude bars — responsive, no overflow) ── */
#app .rv34-charts{display:grid;grid-template-columns:repeat(auto-fit,minmax(290px,1fr));gap:16px;margin:18px 38px 0;}
#app .rv34-chart{border:1px solid #e3eae8;border-radius:14px;background:#fff;padding:16px 18px 18px;min-width:0;}
#app .rv34-chart>header{display:flex;flex-direction:column;gap:3px;margin-bottom:14px;}
#app .rv34-chart>header span{font:700 9.5px/1 'DM Sans',sans-serif;text-transform:uppercase;letter-spacing:.07em;color:#7b8c96;}
#app .rv34-chart>header h3{margin:0;font:650 15px/1.2 'DM Sans',sans-serif;color:#0f3d3d;}
#app .rv34-bar{display:grid;grid-template-columns:minmax(0,98px) minmax(0,1fr) auto;align-items:center;gap:11px;padding:5px 0;}
#app .rv34-bar__label{font:600 11.5px/1.2 'DM Sans',sans-serif;color:#44525a;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
#app .rv34-bar__track{height:9px;background:#eef3f2;border-radius:999px;overflow:hidden;min-width:0;}
#app .rv34-bar__fill{display:block;height:100%;border-radius:999px;transition:width .4s ease;min-width:3px;}
#app .rv34-bar__val{font:700 12px/1 'DM Mono',monospace;color:#0f3d3d;white-space:nowrap;text-align:right;}
#app .rv34-chart__empty{font:500 12px/1.4 'DM Sans',sans-serif;color:#8a979c;padding:6px 0;}
@media(max-width:1100px){#app .rv34-charts{margin-left:24px;margin-right:24px;}}
@media(max-width:700px){#app .rv34-charts{margin-left:18px;margin-right:18px;grid-template-columns:1fr;}}

/* Spreadsheet preview: prevent global full-width controls from crushing identity. */
html body #app .research-preview-toolbar{
 display:flex!important;flex-wrap:wrap;gap:12px!important;flex-shrink:0;
}
html body #app .research-preview-toolbar>div:first-child{
 flex:1 1 340px!important;min-width:min(100%,280px)!important;
}
html body #app .research-preview-toolbar>div:first-child>div{min-width:0;overflow-wrap:normal;word-break:normal}
html body #app .research-preview-toolbar>div:first-child>div>div:first-child{font-size:12px!important;line-height:1.5;letter-spacing:.07em!important}
html body #app .research-preview-toolbar>div:first-child img{max-width:120px;object-fit:contain}
html body #app .research-preview-toolbar>select{
 flex:0 0 160px!important;width:160px!important;max-width:100%;min-width:0!important;
 font-size:14px!important;min-height:42px;box-sizing:border-box;
}
html body #app .research-preview-toolbar>div:not(:first-child),
html body #app .research-preview-toolbar>button{flex:0 0 auto!important}
html body #app .research-preview-toolbar>button,
html body #app .research-preview-toolbar>div:not(:first-child)>button{white-space:nowrap;min-height:42px;min-width:42px}
@media(max-width:900px){
 html body #app .research-preview-toolbar>div:first-child{flex-basis:100%!important}
}
@media(max-width:480px){
 html body #app .research-preview-toolbar{padding:14px 12px!important;gap:8px!important}
 html body #app .research-preview-toolbar>div:first-child{gap:9px!important;min-width:0!important}
 html body #app .research-preview-toolbar>div:first-child img{max-width:88px;height:auto!important}
 html body #app .research-preview-toolbar>select{flex-basis:100%!important;width:100%!important;font-size:16px!important}
 html body #app .research-preview-toolbar>div:not(:first-child)>div{left:0;right:auto!important;max-width:calc(100vw - 100px);box-sizing:border-box}
}

/* Research and Library only: allow search results to extend beyond the toolbar.
   The legacy navbar overflow rules clipped both painting and pointer access. */
html body #app:has(.research-hub,.news-view) .shell2.top-navbar{
 overflow:visible!important;max-height:none!important;
}

/* Phase 2: shared introductions and readable Research / Library controls. */
html body #app :is(.research-hub,.news-view) .module-header p:not(.admin-kicker){font-size:16px!important;line-height:1.55!important}
html body #app :is(.research-hub,.news-view) .module-header :is(.rv31-eyebrow,.rv32-eyebrow,.news-editorial-kicker){font-size:12px!important;color:#a8c9cf!important}
html body #app .research-hub :is(.rv31-line-hero,.rv32-collection-hero,.rv32-record-hero).module-header{display:flex!important;align-items:flex-start!important;flex-wrap:wrap!important;gap:16px 24px!important}
html body #app .research-hub .rv32-collection-hero>div:first-child{flex:1 1 360px;min-width:0}
html body #app .research-hub .rv31-line-copy{flex:1 1 340px;min-width:0}
html body #app .research-hub .rv31-line-actions{display:flex;flex-wrap:wrap;gap:8px;align-self:flex-start}
html body #app .research-hub .rv32-record-copy{flex:1 0 100%;min-width:0}
html body #app .research-hub .rv32-record-hero.module-header>p.ac-notice{flex:1 0 100%;color:#173449!important;background:#eef6f7!important;padding:12px 16px;max-width:none!important;margin:0!important}
html body #app .research-hub .module-header :is(.rv32-record-meta>span,.rv31-person-link b,.rv31-person-link--empty){color:#d6e6ee!important;font-size:14px!important;line-height:1.5}
html body #app .research-hub .module-header .rv31-person-link{color:#e5f0f4!important;font-size:15px}
html body #app .research-hub .module-header .rv31-line-keywords span{background:#203f52;color:#d6e6ee;border-color:#567080;font-size:13px}
html body #app .research-hub .module-header :is(button,.rv31-round-action span){font-size:14px!important}
html body #app .research-hub .module-header button{min-height:42px!important;height:auto!important;max-width:100%;white-space:normal}
html body #app .research-hub .module-header :is(.rv32-circle-action,.rv31-round-action){background:#203f52!important;color:#f3f8fa!important;border-color:#567080!important;min-width:42px}
html body #app .research-hub .module-header .rv32-add-action{color:#d5f3f2!important}
html body #app .research-hub .module-header :is(button,a):focus-visible{outline-color:#97e1e2!important}
html body #app .research-hub :is(.rv31-nav-item,.rv31-line-tabs button,.rv32-state-rail button,.rv32-stage-rail button,.rv32-back,.rv31-back){font-size:15px!important;line-height:1.4!important;min-height:42px}
html body #app .research-hub :is(.rv31-nav-item span,.rv31-line-tabs button span,.rv32-state-rail button span,.rv36-filter-count){font-size:14px!important}
html body #app .research-hub :is(.rv31-search,.rv32-search){min-height:44px;height:auto;min-width:0}
html body #app .research-hub :is(.rv31-search,.rv32-search) input{font-size:16px!important;line-height:1.5!important;min-width:0}
html body #app .research-hub :is(.rv31-line-tabs,.rv32-state-rail,.rv32-stage-rail){overflow-x:auto;max-width:100%;gap:18px}
html body #app .research-hub :is(.rv31-line-tabs,.rv32-state-rail,.rv32-stage-rail)>button{flex:0 0 auto;white-space:nowrap}
html body #app .news-view :is(.news-v25-tabs button,.news-v28-lensbar button,.news-v25-filter-toggle){font-size:15px!important;line-height:1.4!important}
html body #app .news-view :is(.news-v25-tabs button span,.news-v28-lensbar button span,.news-v28-lens-label,.news-v25-shown,.news-v25-index){font-size:14px!important}
html body #app .news-view .news-v25-search{min-height:44px;height:auto!important;min-width:0}
html body #app .news-view .news-v25-search input{font-size:16px!important;line-height:1.5!important;min-height:44px}
html body #app .news-view .news-v25-filter-panel{display:flex;flex-wrap:wrap;gap:16px}
html body #app .news-view .news-v25-filter-panel label{flex:1 1 180px;min-width:0}
html body #app .news-view .news-v25-filter-panel label>span{font-size:14px!important}
html body #app .news-view .news-v25-filter-panel select{font-size:16px!important;min-height:44px;width:100%}
/* Editor is mounted outside .news-view; use its Library-specific classes. */
html body #app .news-v27-record-inspector>header strong,
html body #app .news-v27-inspector-fields label>span{font-size:14px!important;line-height:1.4!important;letter-spacing:0!important}
html body #app .news-v27-inspector-fields :is(input,select){font-size:16px!important;min-height:44px!important;min-width:0}
@media(max-width:900px){
 html body #app .news-view .news-v25-commandbar{display:flex!important;flex-wrap:wrap!important;gap:12px!important}
 html body #app .news-view .news-v25-tabs{flex:1 0 100%!important}
 html body #app .news-view .news-v25-search{flex:1 1 200px!important}
}
@media(max-width:640px){
 html body #app .research-hub .module-header :is(.rv31-line-copy,.rv32-record-copy),
 html body #app .research-hub .rv32-collection-hero>div:first-child{flex:0 1 auto;width:100%}
 html body #app .research-hub .rv32-record-hero.module-header>p.ac-notice{flex-basis:auto;width:100%}
 html body #app .research-hub .rv32-record-hero.module-header{flex-direction:row!important}
}

html body #app .research-hub .rv32-record-hero.module-header>button:not(.rv32-circle-action){background:#eef6f3!important}

/* Phase 3: the Library command palette must fit short viewports as well as
   narrow ones. Keep search and keyboard hints fixed; scroll only results.
   This surface is teleported to body, so it must not be scoped under #app. */
html body .news-v28-command-layer{padding:clamp(12px,8dvh,80px) 16px 16px;box-sizing:border-box;overflow:hidden}
html body .news-v28-command{display:flex;flex-direction:column;min-height:0;max-height:100%;width:min(680px,100%)}
html body .news-v28-command>header,
html body .news-v28-command>label,
html body .news-v28-command>footer{flex-shrink:0}
html body .news-v28-command-results{min-height:0;overflow-y:auto;overscroll-behavior:contain}
html body .news-v28-command>label input{min-width:0}
html body .news-v28-command-results button{min-width:0}
html body .news-v28-command-results button span{overflow-wrap:anywhere;font-size:15px;line-height:1.4}
html body .news-v28-command-results button small{font-size:13px;line-height:1.4}

/* Phase 5B: Highlight readers use navy chrome. Connection metadata belongs to
   the same dark reading context, while relationship tiles remain light. */
html body #app .nrd-v27.nrd--highlight .nrd-v28-connections{
  border-top-color:rgba(223,240,242,.24);
}
html body #app .nrd-v27.nrd--highlight .nrd-v28-connections>header span{
  color:#edf7f8;
}
html body #app .nrd-v27.nrd--highlight .nrd-v28-connections>header strong{
  color:#c8dade;
}
@media(max-width:640px){
 html body #app .nrd-v27 .nrd-v28-connections{padding-left:18px!important;padding-right:18px!important}
 html body #app .nrd-v27 .nrd-v28-connections>header{align-items:flex-start;flex-wrap:wrap;gap:8px 18px}
 html body #app .nrd-v27 .nrd-v28-connections>header span{font-size:clamp(23px,7vw,28px);line-height:1.16}
}

/* Phase 5B: a short Highlight must not reserve almost the entire viewport.
   Preserve a spacious editorial stage while allowing text to determine height.
   Narrow screens stack the image/fallback and copy instead of keeping the
   desktop's 420px minimum column. */
html body #app .nrd-v27-highlight{
 min-height:clamp(360px,62dvh,620px)!important;
}
@media(max-width:700px){
 html body #app .nrd-v27-highlight,
 html body #app .nrd-v27-highlight.has-fallback,
 html body #app .nrd-v27-highlight.is-copy-right{
  grid-template-columns:minmax(0,1fr)!important;
  min-height:0!important;
 }
 html body #app .nrd-v27-highlight .nrd-v23-highlight-copy{
  grid-column:1!important;grid-row:auto!important;
  min-width:0;padding:28px 22px 42px!important;text-align:left!important;
  align-items:flex-start!important;
 }
 html body #app .nrd-v27-highlight .nrd-v23-highlight-media,
 html body #app .nrd-v27-highlight .nrd-v26-highlight-fallback{
  grid-column:1!important;grid-row:auto!important;
  min-width:0;min-height:180px;max-height:34dvh;
 }
 html body #app .nrd-v27-highlight .nrd-v23-highlight-copy h1{
  font-size:clamp(34px,8vw,50px)!important;overflow-wrap:anywhere;
 }
}
