/* ========================================================================
   WPU Research Hub Design System V40.40.0
   Fluent/Workspace-inspired tokens and shared components.
   ======================================================================== */
:root{
  color-scheme:light;
  --wpu-font-sans:"Segoe UI",Inter,Roboto,"Helvetica Neue",Arial,sans-serif;
  --wpu-primary:#0f6cbd;
  --wpu-primary-hover:#115ea3;
  --wpu-primary-active:#0c3b5e;
  --wpu-primary-soft:#eaf3fc;
  --wpu-focus:#0b57d0;
  --wpu-focus-color:#0b57d0;
  --wpu-accent:#f8cf3c;
  --wpu-canvas:#f5f7fa;
  --wpu-surface:#fff;
  --wpu-surface-subtle:#f8fafc;
  --wpu-surface-muted:#f1f4f8;
  --wpu-text:#202124;
  --wpu-text-secondary:#3c4043;
  --wpu-text-muted:#5f6b7a;
  --wpu-border:#d8dee8;
  --wpu-border-strong:#b7c2d0;
  --wpu-success:#107c10;
  --wpu-warning:#8a6100;
  --wpu-danger:#c42b1c;
  --wpu-info:#0067b8;
  --wpu-radius-sm:8px;
  --wpu-radius:12px;
  --wpu-radius-lg:16px;
  --wpu-shadow-1:0 1px 2px rgba(15,23,42,.06),0 3px 10px rgba(15,23,42,.04);
  --wpu-shadow-2:0 8px 26px rgba(15,23,42,.10);
  --wpu-content-readable:76rem;
  --wpu-content-wide:90rem;
  --wpu-touch:44px;
  --wpu-space-1:.25rem;
  --wpu-space-2:.5rem;
  --wpu-space-3:.75rem;
  --wpu-space-4:1rem;
  --wpu-space-5:1.25rem;
  --wpu-space-6:1.5rem;
  --wpu-space-8:2rem;
}

html{font-family:var(--wpu-font-sans);text-size-adjust:100%}
body{font-family:var(--wpu-font-sans);color:var(--wpu-text);background:var(--wpu-canvas)}

.wpu-sr-only{
  position:absolute!important;width:1px!important;height:1px!important;padding:0!important;
  margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;
  white-space:nowrap!important;border:0!important;
}

.wpu-readable{width:min(100%,var(--wpu-content-readable));margin-inline:auto}
.wpu-content-wide{width:min(100%,var(--wpu-content-wide));margin-inline:auto}

:where(.rp-main,.content-area,.wpu-modern-page-shell) :where(h1,h2,h3,h4){
  color:var(--wpu-text);text-wrap:balance;
}

:where(.rp-main,.content-area,.wpu-modern-page-shell) :where(p,li,.form-text,.help-text){
  text-wrap:pretty;
}

/* Page headers and action rows */
:where(.rp-page-head,.page-header,.smart-upload-page-header,.accred-hero>div:first-child){
  min-width:0;
}

:where(.rp-page-head,.page-header,.smart-upload-page-header) h1{
  margin-block:0 .35rem;
  font-size:clamp(1.55rem,2.3vw,2.25rem);
  line-height:1.18;
  letter-spacing:-.025em;
  font-weight:720;
}

:where(.page-actions,.action-row,.toolbar,.smart-upload-header-actions){
  display:flex;align-items:center;justify-content:flex-end;gap:.625rem;flex-wrap:wrap;min-width:0;
}

/* Cards and neutral surfaces */
:where(.rp-card,.panel,.card-admin,.smart-upload-card,.report-panel,.wpu-card){
  min-width:0;
  border:1px solid var(--wpu-border);
  border-radius:var(--wpu-radius-lg);
  background:var(--wpu-surface);
  box-shadow:var(--wpu-shadow-1);
}

:where(.rp-card,.panel,.card-admin,.smart-upload-card,.report-panel,.wpu-card):focus-within{
  border-color:color-mix(in srgb,var(--wpu-primary) 32%,var(--wpu-border));
}

/* Controls: consistent 44px targets without enlarging passive text links. */
:where(.btn,button:not(.btn-close),.form-control,.form-select,input[type="file"]){min-height:var(--wpu-touch)}
:where(.btn,button){border-radius:var(--wpu-radius-sm);font-weight:650}
:where(.form-control,.form-select){
  border-color:var(--wpu-border-strong);
  border-radius:var(--wpu-radius-sm);
  background-color:#fff;
  color:var(--wpu-text);
}
:where(.form-control,.form-select):focus{
  border-color:var(--wpu-primary);
  box-shadow:0 0 0 3px color-mix(in srgb,var(--wpu-focus-color) 20%,transparent);
}
:where(.form-label,label){color:var(--wpu-text-secondary)}
:where(.form-text,.help,.help-text){color:var(--wpu-text-muted);line-height:1.45}

:where(.btn-primary,.rp-btn-primary){
  border-color:var(--wpu-primary);background:var(--wpu-primary);color:#fff;
}
:where(.btn-primary,.rp-btn-primary):hover{border-color:var(--wpu-primary-hover);background:var(--wpu-primary-hover);color:#fff}
:where(.btn-outline-primary){border-color:var(--wpu-primary);color:var(--wpu-primary)}
:where(.btn-outline-primary):hover{border-color:var(--wpu-primary-hover);background:var(--wpu-primary-hover);color:#fff}

:where(a,button,input,select,textarea,[tabindex]):focus-visible{
  outline:3px solid var(--wpu-focus-color,var(--wpu-focus))!important;
  outline-offset:2px!important;
}

.btn-close{min-width:var(--wpu-touch);min-height:var(--wpu-touch);background-position:center}

/* Modal and drawer comfort. */
.modal-content{border:1px solid var(--wpu-border);border-radius:var(--wpu-radius-lg);box-shadow:var(--wpu-shadow-2)}
.modal-header,.modal-footer{border-color:var(--wpu-border)}
.offcanvas{background:var(--wpu-surface);color:var(--wpu-text)}

/* Data tables: the runtime adds these attributes only to local scroll regions. */
:where(.table-responsive,.rp-table-wrap,.table-wrap,[data-responsive-table-wrap]){
  max-width:100%;overflow-x:auto;overflow-y:hidden;overscroll-behavior-inline:contain;
  -webkit-overflow-scrolling:touch;scrollbar-gutter:stable;
}
[data-responsive-table-wrap][data-has-overflow="true"]:focus-visible{outline:3px solid var(--wpu-focus-color,var(--wpu-focus));outline-offset:3px}
[data-responsive-table-wrap]>.wpu-responsive-wide-table{width:100%;min-width:var(--wpu-table-min-width,42rem);margin-bottom:0}
.wpu-table-scroll-hint{display:flex;align-items:center;gap:.45rem;margin:.25rem 0 .5rem;color:var(--wpu-text-muted);font-size:.8125rem;line-height:1.4}
.wpu-table-scroll-hint::before{content:"\2194";color:var(--wpu-primary);font-weight:800}
.wpu-table-scroll-hint[hidden]{display:none!important}
:is(.table,.table-accred,.modern-table) th{overflow-wrap:normal;word-break:keep-all;hyphens:none}
:is(.table,.table-accred,.modern-table) :is(.badge,.badge-soft,.status-badge,.btn,.dropdown-toggle,.actions,.action-cell,.status-cell){overflow-wrap:normal;word-break:keep-all;white-space:nowrap}

/* Semantic navigation states added by the server/runtime enhancement. */
:where(.rp-desktop-nav,.rp-mobile-nav,.rp-tabs,.sidebar,.navbar-nav) [aria-current="page"],
:where(.rp-desktop-nav,.rp-mobile-nav,.rp-tabs) .is-current{
  font-weight:750;
}

.rp-tabs a[aria-current="page"]{color:var(--wpu-primary);border-color:var(--wpu-primary)}
.rp-breadcrumb[aria-label="Breadcrumb"]{line-height:1.5}
.rp-breadcrumb [aria-current="page"]{color:var(--wpu-text-secondary);font-weight:650}
.rp-breadcrumb i{color:var(--wpu-text-muted)}

/* Researcher shell: compact 72px app bar on desktop and 64px on mobile. */
html body.researcher-portal-body.wpu-pixel-shell-v40-35-4 .rp-topbar.wpu-pixel-header-v40-35-4{
  position:sticky!important;top:0!important;padding:8px 12px 0!important;
}
html body.researcher-portal-body.wpu-pixel-shell-v40-35-4 .rp-topbar.wpu-pixel-header-v40-35-4 .rp-topbar-inner{
  max-width:var(--wpu-content-wide)!important;min-height:72px!important;padding:8px 12px!important;
  gap:12px!important;border-radius:16px!important;
}
html body.researcher-portal-body.wpu-pixel-shell-v40-35-4 .rp-topbar.wpu-pixel-header-v40-35-4 .rp-topbar-inner::before{
  width:48px!important;height:8px!important;border-radius:0 8px 0 0!important;
}
html body.researcher-portal-body.wpu-pixel-shell-v40-35-4 .rp-topbar.wpu-pixel-header-v40-35-4 .rp-brand{
  flex:0 1 260px!important;width:auto!important;max-width:260px!important;gap:10px!important;
}
html body.researcher-portal-body.wpu-pixel-shell-v40-35-4 .rp-topbar.wpu-pixel-header-v40-35-4 .rp-brand img{
  width:48px!important;height:48px!important;min-width:48px!important;flex-basis:48px!important;
  padding:4px!important;border-width:2px!important;border-radius:12px!important;
}
html body.researcher-portal-body.wpu-pixel-shell-v40-35-4 .rp-topbar.wpu-pixel-header-v40-35-4 .rp-brand>span{
  width:auto!important;max-width:200px!important;gap:2px!important;overflow:hidden!important;
}
html body.researcher-portal-body.wpu-pixel-shell-v40-35-4 .rp-topbar.wpu-pixel-header-v40-35-4 .rp-brand strong{
  font-size:.98rem!important;line-height:1.15!important;white-space:nowrap!important;
  overflow:hidden!important;text-overflow:ellipsis!important;
}
html body.researcher-portal-body.wpu-pixel-shell-v40-35-4 .rp-topbar.wpu-pixel-header-v40-35-4 .rp-brand small{
  font-size:.68rem!important;line-height:1.2!important;
}
html body.researcher-portal-body.wpu-pixel-shell-v40-35-4 .rp-topbar.wpu-pixel-header-v40-35-4 .rp-desktop-nav{
  gap:2px!important;
}
html body.researcher-portal-body.wpu-pixel-shell-v40-35-4 .rp-topbar.wpu-pixel-header-v40-35-4 .rp-desktop-nav>a,
html body.researcher-portal-body.wpu-pixel-shell-v40-35-4 .rp-topbar.wpu-pixel-header-v40-35-4 .rp-desktop-nav>.dropdown>.rp-nav-dropdown,
html body.researcher-portal-body.wpu-pixel-shell-v40-35-4 .rp-topbar.wpu-pixel-header-v40-35-4 .rp-user-menu,
html body.researcher-portal-body.wpu-pixel-shell-v40-35-4 .rp-topbar.wpu-pixel-header-v40-35-4 .wpu30-admin-link{
  min-height:44px!important;padding-inline:10px!important;border-radius:10px!important;font-size:.82rem!important;
}
html body.researcher-portal-body.wpu-pixel-shell-v40-35-4 .rp-topbar.wpu-pixel-header-v40-35-4 .rp-desktop-nav>a[aria-current="page"],
html body.researcher-portal-body.wpu-pixel-shell-v40-35-4 .rp-topbar.wpu-pixel-header-v40-35-4 .rp-desktop-nav .is-current{
  border-color:rgba(255,255,255,.32)!important;background:rgba(255,255,255,.16)!important;
  box-shadow:inset 0 -3px 0 var(--wpu-accent)!important;
}

.researcher-portal-body .rp-main{width:min(100%,var(--wpu-content-wide));padding:clamp(1rem,2vw,2rem)}
.researcher-portal-body .rp-footer.wpu-unified-site-footer{max-width:var(--wpu-content-wide)!important}
.researcher-portal-body .rp-footer-links a{min-height:44px!important;padding:10px 12px!important}
.researcher-portal-body .rp-mobile-nav a{min-height:44px}
.researcher-portal-body .rp-mobile-nav a[aria-current="page"]{background:var(--wpu-primary-soft);color:var(--wpu-primary)}

.rp-profile-completion{flex:0 1 280px;width:min(100%,280px);min-width:0}
.rp-profile-completion .rp-progress{height:10px}
.rp-profile-form-actions{display:flex;justify-content:flex-end;gap:.75rem;flex-wrap:wrap}

/* Authentication and setup continuity. */
.wpu-auth-body,.wpu-setup-page{position:relative}
.wpu-auth-body{--wpu-focus:rgba(11,79,196,.16)}
.wpu-setup-page{background:linear-gradient(145deg,#eef4ff,#f8fbff 55%,#fff9e8)}
.wpu-auth-back{
  position:fixed;z-index:5;top:max(16px,env(safe-area-inset-top));left:max(16px,env(safe-area-inset-left));
  display:inline-flex;align-items:center;gap:.5rem;min-height:44px;padding:.55rem .8rem;
  border:1px solid var(--wpu-border);border-radius:10px;background:rgba(255,255,255,.94);
  color:var(--wpu-primary-active);font-weight:650;text-decoration:none;box-shadow:var(--wpu-shadow-1);
}
.wpu-auth-back:hover{background:#fff;color:var(--wpu-primary)}

/* Dedicated legal shell, deliberately independent of DB-backed public chrome. */
.wpu-legal-body{margin:0;min-height:100dvh;background:var(--wpu-canvas);color:var(--wpu-text);line-height:1.65}
.wpu-legal-skip{position:fixed;top:-100px;left:12px;z-index:100;background:#fff;padding:.7rem 1rem;border-radius:8px}
.wpu-legal-skip:focus{top:12px}
.wpu-legal-header{background:linear-gradient(135deg,#073b84,#0f6cbd);color:#fff;border-bottom:4px solid var(--wpu-accent)}
.wpu-legal-appbar{
  width:min(calc(100% - 32px),var(--wpu-content-readable));margin-inline:auto;min-height:64px;
  display:flex;align-items:center;justify-content:space-between;gap:1rem;
}
.wpu-legal-brand{display:flex;align-items:center;gap:.65rem;color:#fff;text-decoration:none;font-weight:750}
.wpu-legal-brand-mark{display:grid;place-items:center;width:36px;height:36px;border-radius:10px;background:rgba(255,255,255,.14)}
.wpu-legal-nav{display:flex;align-items:center;gap:.35rem;flex-wrap:wrap;justify-content:flex-end}
.wpu-legal-nav a{display:inline-flex;align-items:center;min-height:44px;padding:.5rem .7rem;border-radius:8px;color:#fff;text-decoration:none;font-size:.9rem;font-weight:650}
.wpu-legal-nav a:hover,.wpu-legal-nav a[aria-current="page"]{background:rgba(255,255,255,.15)}
.wpu-legal-hero{width:min(calc(100% - 32px),var(--wpu-content-readable));margin-inline:auto;padding:clamp(2rem,5vw,3.5rem) 0}
.wpu-legal-hero h1{margin:0 0 .5rem;color:#fff;font-size:clamp(2rem,5vw,3.25rem);line-height:1.12;letter-spacing:-.035em}
.wpu-legal-hero p{max-width:54rem;margin:0;color:#e8f2ff;font-size:1rem}
.wpu-legal-main{width:min(calc(100% - 32px),62rem);margin-inline:auto;padding:clamp(1.25rem,3vw,2rem) 0 3rem}
.wpu-legal-card{margin-bottom:1rem;padding:clamp(1.1rem,3vw,1.75rem);border:1px solid var(--wpu-border);border-radius:var(--wpu-radius-lg);background:#fff;box-shadow:var(--wpu-shadow-1)}
.wpu-legal-card h2{margin:0 0 .75rem;color:#12355b;font-size:clamp(1.2rem,2.8vw,1.5rem)}
.wpu-legal-card :where(ul,ol){padding-left:1.35rem}
.wpu-legal-card li+li{margin-top:.45rem}
.wpu-legal-card a{color:var(--wpu-primary-active);font-weight:650}
.wpu-legal-note{padding:.85rem 1rem;border-left:4px solid var(--wpu-accent);border-radius:8px;background:#fff8d6;color:#564400}
.wpu-legal-muted{color:var(--wpu-text-muted)}
.wpu-legal-footer{padding:1.25rem 16px 2rem;border-top:1px solid var(--wpu-border);background:#fff;text-align:center;color:var(--wpu-text-muted);font-size:.9rem}

/* Announcement motion controls and safe static/reduced-motion state. */
.global-announcement-bar .announcement-motion-toggle{
  display:inline-flex;align-items:center;justify-content:center;gap:.4rem;min-height:44px;padding:.5rem .7rem;
  border:1px solid currentColor;border-radius:999px;background:transparent;color:inherit;font-size:.78rem;font-weight:750;
}
.global-announcement-bar .announcement-btn{min-height:44px}
.global-announcement-bar :is(.global-announcement-ticker,.global-announcement-static,.global-announcement-rotator){
  font-size:clamp(.8125rem,var(--announcement-font-size,.86rem),1rem);
}
.global-announcement-bar .announcement-motion-toggle:hover{background:rgba(255,255,255,.13)}
.global-announcement-bar.pause-on-hover:hover .announcement-ticker-track,
.global-announcement-bar:focus-within .announcement-ticker-track,
.global-announcement-bar.is-motion-paused .announcement-ticker-track{animation-play-state:paused!important}
.global-announcement-bar.is-motion-paused .announcement-rotator-item{transition:none!important}

/* Dense pages explicitly cited in the audit. */
.accred-grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,180px),1fr))!important}
.report-panel>.d-flex:first-child{flex-wrap:wrap}
.smart-upload-page .smart-upload-layout>*{min-width:0}
.smart-upload-page .smart-upload-savebar{flex-wrap:wrap}

/* Researcher brand at desktop/laptop widths: retain the complete product name
   as readable text and remove the secondary tagline before it can collide with
   navigation. No ellipsis or clipped leaf text is used. */
@media(min-width:1200px) and (max-width:1599.98px){
  html body.researcher-portal-body.wpu-pixel-shell-v40-35-4 .rp-topbar.wpu-pixel-header-v40-35-4 .rp-brand{
    flex-basis:250px!important;width:250px!important;max-width:250px!important;gap:10px!important;
  }
  html body.researcher-portal-body.wpu-pixel-shell-v40-35-4 .rp-topbar.wpu-pixel-header-v40-35-4 .rp-brand img{
    width:58px!important;height:58px!important;min-width:58px!important;flex-basis:58px!important;
  }
  html body.researcher-portal-body.wpu-pixel-shell-v40-35-4 .rp-topbar.wpu-pixel-header-v40-35-4 .rp-brand>span{
    width:182px!important;max-width:182px!important;overflow:visible!important;
  }
  html body.researcher-portal-body.wpu-pixel-shell-v40-35-4 .rp-topbar.wpu-pixel-header-v40-35-4 .rp-brand strong{
    display:block!important;white-space:normal!important;overflow:visible!important;text-overflow:clip!important;
    overflow-wrap:normal!important;word-break:normal!important;hyphens:none!important;
    font-size:.94rem!important;line-height:1.08!important;
  }
  html body.researcher-portal-body.wpu-pixel-shell-v40-35-4 .rp-topbar.wpu-pixel-header-v40-35-4 .rp-brand small{
    display:none!important;
  }
}

@media(min-width:1600px){
  html body.researcher-portal-body.wpu-pixel-shell-v40-35-4 .rp-topbar.wpu-pixel-header-v40-35-4 .rp-brand{
    flex-basis:320px!important;width:320px!important;max-width:320px!important;gap:14px!important;
  }
  html body.researcher-portal-body.wpu-pixel-shell-v40-35-4 .rp-topbar.wpu-pixel-header-v40-35-4 .rp-brand>span{
    width:226px!important;max-width:226px!important;overflow:visible!important;
  }
  html body.researcher-portal-body.wpu-pixel-shell-v40-35-4 .rp-topbar.wpu-pixel-header-v40-35-4 .rp-brand strong,
  html body.researcher-portal-body.wpu-pixel-shell-v40-35-4 .rp-topbar.wpu-pixel-header-v40-35-4 .rp-brand small{
    white-space:normal!important;overflow:visible!important;text-overflow:clip!important;
    overflow-wrap:normal!important;word-break:normal!important;hyphens:none!important;
  }
}

@media(max-width:1199.98px){
  html body.researcher-portal-body.wpu-pixel-shell-v40-35-4 .rp-topbar.wpu-pixel-header-v40-35-4{
    padding:8px 10px 0!important;
  }
  html body.researcher-portal-body.wpu-pixel-shell-v40-35-4 .rp-topbar.wpu-pixel-header-v40-35-4 .rp-topbar-inner{
    min-height:64px!important;padding:6px 10px!important;border-radius:14px!important;
  }
  html body.researcher-portal-body.wpu-pixel-shell-v40-35-4 .rp-topbar.wpu-pixel-header-v40-35-4 .rp-brand{
    flex:1 1 auto!important;max-width:calc(100% - 58px)!important;
  }
  html body.researcher-portal-body.wpu-pixel-shell-v40-35-4 .rp-topbar.wpu-pixel-header-v40-35-4 .rp-brand img{
    width:44px!important;height:44px!important;min-width:44px!important;flex-basis:44px!important;
  }
  html body.researcher-portal-body.wpu-pixel-shell-v40-35-4 .rp-topbar.wpu-pixel-header-v40-35-4 .rp-brand>span{
    max-width:min(420px,calc(100vw - 142px))!important;
  }
  html body.researcher-portal-body.wpu-pixel-shell-v40-35-4 .rp-topbar.wpu-pixel-header-v40-35-4 .rp-brand strong{
    font-size:.94rem!important;
  }
  html body.researcher-portal-body.wpu-pixel-shell-v40-35-4 .rp-topbar.wpu-pixel-header-v40-35-4 .rp-brand small{
    font-size:.68rem!important;
  }
}

@media(max-width:767.98px){
  :where(.rp-page-head,.page-header,.smart-upload-page-header){align-items:stretch;flex-direction:column}
  :where(.page-actions,.action-row,.toolbar,.smart-upload-header-actions){justify-content:flex-start}
  .rp-profile-completion{width:100%;max-width:none;flex-basis:auto}
  .rp-profile-form-actions>.btn{flex:1 1 12rem}
  .wpu-auth-back{position:absolute}
  .wpu-login-page,.wpu-setup-page{padding-top:76px!important}
  .accred-grid{grid-template-columns:1fr!important}
  .report-panel{padding:14px!important}
  .report-panel>.d-flex:first-child>.btn{width:100%}
  .smart-upload-page .smart-upload-header-actions>.btn{flex:1 1 12rem}
  .smart-upload-page .image-result-stats{grid-template-columns:1fr 1fr}
}

@media(max-width:575.98px){
  html body.researcher-portal-body.wpu-pixel-shell-v40-35-4 .rp-topbar.wpu-pixel-header-v40-35-4 .rp-brand strong{
    display:-webkit-box!important;white-space:normal!important;-webkit-box-orient:vertical;-webkit-line-clamp:2;
    overflow:hidden!important;text-overflow:clip!important;line-height:1.1!important;
  }
  .wpu-legal-appbar{align-items:flex-start;flex-direction:column;padding-block:.7rem}
  .wpu-legal-nav{width:100%;justify-content:flex-start}
  .wpu-legal-nav a{flex:1 1 auto;justify-content:center}
  .wpu-legal-hero,.wpu-legal-main{width:min(calc(100% - 24px),62rem)}
  .wpu-legal-card{border-radius:12px}
  .global-announcement-actions{align-items:stretch}
  .global-announcement-bar .announcement-motion-toggle{flex:1 1 auto;min-height:44px}
  .smart-upload-page .image-result-stats{grid-template-columns:1fr}
  .smart-upload-page .image-result-stats>div{grid-template-columns:36px minmax(0,1fr) auto}
  .smart-upload-page .image-matching-rule-card{margin-inline:15px}
  .smart-upload-page .smart-upload-savebar .btn{width:100%}
}

@media(prefers-reduced-motion:reduce){
  .announcement-ticker-track{animation:none!important;transform:none!important}
  .announcement-rotator-item{transition:none!important}
}

@media(forced-colors:active){
  :where(.rp-card,.panel,.card-admin,.smart-upload-card,.report-panel,.wpu-card,.wpu-legal-card){border:1px solid CanvasText}
}
