/* SWISO 0.20.307 — complete Forge Current dark-mode correction.
   Scope is deliberately limited to Forge + Forge Current + dark mode. */
html[data-theme="dark"][data-swiso-palette="forge-current"] body[data-portal="forge"]{
  --f307-canvas:#071c28;
  --f307-surface:#102b38;
  --f307-surface-2:#173744;
  --f307-field:#0b2430;
  --f307-border:#3b606b;
  --f307-border-strong:#56808a;
  --f307-text:#f2f8f9;
  --f307-muted:#b9cdd3;
  --f307-link:#73d7e3;
  --f307-focus:#70d7e3;
}

/* Forge-owned shell surfaces. These selectors cannot match Pathway, Hub or
   another Forge palette. */
html[data-theme="dark"][data-swiso-palette="forge-current"] body[data-portal="forge"] #r65Sidebar#r65Sidebar{
  background:var(--f307-canvas)!important;
  background-image:none!important;
  border-color:var(--f307-border)!important;
  color:var(--f307-text)!important;
}
html[data-theme="dark"][data-swiso-palette="forge-current"] body[data-portal="forge"] #r65Sidebar#r65Sidebar :is(h1,h2,h3,h4,strong,b,label,small,span){color:inherit}
html[data-theme="dark"][data-swiso-palette="forge-current"] body[data-portal="forge"] #r65Sidebar#r65Sidebar .nav-group-title{
  background:var(--f307-surface)!important;
  border-color:var(--f307-border)!important;
  color:var(--f307-text)!important;
}
html[data-theme="dark"][data-swiso-palette="forge-current"] body[data-portal="forge"] #r65Sidebar#r65Sidebar .nav-link{
  background:transparent!important;
  border-color:transparent!important;
  color:var(--f307-muted)!important;
}
html[data-theme="dark"][data-swiso-palette="forge-current"] body[data-portal="forge"] #r65Sidebar#r65Sidebar .nav-link:is(:hover,:focus-visible,[aria-current="page"],.active),
html[data-theme="dark"][data-swiso-palette="forge-current"] body[data-portal="forge"] #r65Sidebar#r65Sidebar .nav-group-title:is(:hover,:focus-visible,[aria-expanded="true"]){
  background:#20505c!important;
  border-color:var(--f307-border-strong)!important;
  color:#fff!important;
}
html[data-theme="dark"][data-swiso-palette="forge-current"] body[data-portal="forge"] #r65Sidebar#r65Sidebar :is(input,select,textarea){
  background:var(--f307-field)!important;
  border-color:var(--f307-border-strong)!important;
  color:var(--f307-text)!important;
  color-scheme:dark;
}
html[data-theme="dark"][data-swiso-palette="forge-current"] body[data-portal="forge"] #r65Sidebar#r65Sidebar .nav-version{
  background:var(--f307-canvas)!important;
  border-color:var(--f307-border)!important;
  color:var(--f307-muted)!important;
}

/* Overview canvas. The double id matches the late visual289 owner that left
   the light gradient visible below the corrected cards in 0.20.306. */
html[data-theme="dark"][data-swiso-palette="forge-current"] body[data-portal="forge"] #managementView#managementView{
  background:var(--f307-canvas)!important;
  background-image:none!important;
  color:var(--f307-text)!important;
}
html[data-theme="dark"][data-swiso-palette="forge-current"] body[data-portal="forge"] #managementView#managementView .forge209-overview{
  background:var(--f307-canvas)!important;
  color:var(--f307-text)!important;
}
html[data-theme="dark"][data-swiso-palette="forge-current"] body[data-portal="forge"] #managementView#managementView .forge209-overview .forge209-grid>article{
  background:var(--f307-surface)!important;
  background-image:none!important;
  border-color:var(--f307-border)!important;
  color:var(--f307-text)!important;
  box-shadow:none!important;
}
html[data-theme="dark"][data-swiso-palette="forge-current"] body[data-portal="forge"] #managementView#managementView .forge209-overview .forge209-grid>article :is(h1,h2,h3,h4,small,strong){color:var(--f307-text)!important}
html[data-theme="dark"][data-swiso-palette="forge-current"] body[data-portal="forge"] #managementView#managementView .forge209-overview .forge209-grid>article p{color:var(--f307-muted)!important}

/* Every Forge workbench route is mounted below this exact owner. The high
   specificity is intentional: several legacy route styles use duplicated ids. */
html[data-theme="dark"][data-swiso-palette="forge-current"] body[data-portal="forge"] #moduleView#moduleView{
  background:var(--f307-canvas)!important;
  background-image:none!important;
  color:var(--f307-text)!important;
}
html[data-theme="dark"][data-swiso-palette="forge-current"] body[data-portal="forge"] #moduleView#moduleView[data-forge-page] :is(section,article,form,fieldset,details){
  background-color:var(--f307-surface)!important;
  border-color:var(--f307-border)!important;
  color:var(--f307-text)!important;
}
html[data-theme="dark"][data-swiso-palette="forge-current"] body[data-portal="forge"] #moduleView#moduleView :is(
  .module-heading,.module-workbench,.special-workspace,.filter-strip,.workflow-summary,
  .register-toolbar,.register-frame,.register-card-grid,.empty-register,.page-status,
  .panel,.audit-notice,.learning-notice,.v291-workflow-banner,.v291-workflow-intro,
  .v291-workflow-step,.v292-guidance-hero,.v292-guidance-note,.v292-journey>article,
  .v292-guide-grid>article,.v293-guidance-hero,.v293-guidance-note,.v293-journey>article,
  .v293-guide-grid>article,.v294-guidance-hero,.v294-guidance-note,.v294-journey>article,
  .v294-guide-grid>article,.r65-surface,.r65-builder-body,.r65-form,.r65-ea,
  .forge-batch01-panel,.sig226,.office-form,.office-controls199,.office-format200,
  .forge216-panel,.forge267-repo-head,.forge267-pack-link,.forge226-profile-bar,
  .forge226-sector-layout,.v290-ea-tools,.forge218-industry,.forge209-actions,
  .r58-brand-centre,.forge226-report-list,.module-assurance-disclosure203,
  .governance-queue195,.forge210-modules,.f272-card,.forge209-user,
  [data-forge-layout="industry-ea-codes"],[data-forge-layout="users"],[data-users],
  [data-forge-layout="my-licence"],.pathway-licence-card,.licence-holder,
  .licence-meta>article,.licensed-products,.licensed-product-grid>a,
  .forge210-module-grid>*,.forge209-metrics>article,.pathway-market-links,
  .licence-terms-grid>article
){
  background:var(--f307-surface)!important;
  background-image:none!important;
  border-color:var(--f307-border)!important;
  color:var(--f307-text)!important;
  box-shadow:none!important;
}
html[data-theme="dark"][data-swiso-palette="forge-current"] body[data-portal="forge"] #moduleView#moduleView :is(article,section,div,form,fieldset,details)[data-empty="true"],
html[data-theme="dark"][data-swiso-palette="forge-current"] body[data-portal="forge"] #moduleView#moduleView :is(.empty-state,.loading-state,.notice,.callout,[role="status"]){
  background:var(--f307-surface)!important;
  background-image:none!important;
  border-color:var(--f307-border)!important;
  color:var(--f307-text)!important;
}
html[data-theme="dark"][data-swiso-palette="forge-current"] body[data-portal="forge"] #moduleView#moduleView :is(h1,h2,h3,h4,h5,h6,legend,label,strong,th,.title,.card-title){color:var(--f307-text)!important}
html[data-theme="dark"][data-swiso-palette="forge-current"] body[data-portal="forge"] #moduleView#moduleView :is(p,small,.muted,.helper,.hint,.description,td){color:var(--f307-muted)!important}
html[data-theme="dark"][data-swiso-palette="forge-current"] body[data-portal="forge"] #moduleView#moduleView a:not(.button):not([role="button"]){color:var(--f307-link)!important}
html[data-theme="dark"][data-swiso-palette="forge-current"] body[data-portal="forge"] #moduleView#moduleView .forge209-user>div,
html[data-theme="dark"][data-swiso-palette="forge-current"] body[data-portal="forge"] #moduleView#moduleView fieldset>label{
  background-color:var(--f307-surface)!important;
  border-color:var(--f307-border)!important;
  color:var(--f307-text)!important;
}

/* Native controls, including file selectors. */
html[data-theme="dark"][data-swiso-palette="forge-current"] body[data-portal="forge"] #moduleView#moduleView :is(input:not([type="checkbox"]):not([type="radio"]),select,textarea){
  background:var(--f307-field)!important;
  background-image:none!important;
  border-color:var(--f307-border-strong)!important;
  color:var(--f307-text)!important;
  color-scheme:dark;
}
html[data-theme="dark"][data-swiso-palette="forge-current"] body[data-portal="forge"] #moduleView#moduleView input[type="file"]::file-selector-button{
  background:var(--f307-surface-2)!important;
  border-color:var(--f307-border)!important;
  color:var(--f307-text)!important;
}
html[data-theme="dark"][data-swiso-palette="forge-current"] body[data-portal="forge"] #moduleView#moduleView ::placeholder{color:#98b3bb!important;opacity:1}
html[data-theme="dark"][data-swiso-palette="forge-current"] body[data-portal="forge"] #moduleView#moduleView :is(button,.button,[role="button"]):not(.primary){
  background:var(--f307-surface-2)!important;
  border-color:var(--f307-border-strong)!important;
  color:var(--f307-text)!important;
}
html[data-theme="dark"][data-swiso-palette="forge-current"] body[data-portal="forge"] :is(#moduleView#moduleView,#r65Sidebar#r65Sidebar) :is(button,.button,a,input,select,textarea,[role="button"]):focus-visible{
  outline:3px solid var(--f307-focus)!important;
  outline-offset:2px!important;
}

/* Tables, rows, modal surfaces and navigation states. */
html[data-theme="dark"][data-swiso-palette="forge-current"] body[data-portal="forge"] #moduleView#moduleView :is(table,tbody,tr,td,th){
  background-color:var(--f307-surface)!important;
  border-color:var(--f307-border)!important;
}
html[data-theme="dark"][data-swiso-palette="forge-current"] body[data-portal="forge"] #moduleView#moduleView thead th{
  background:var(--f307-surface-2)!important;
  color:var(--f307-text)!important;
}
html[data-theme="dark"][data-swiso-palette="forge-current"] body[data-portal="forge"] :is(.modal,.dialog,[role="dialog"]){
  background:var(--f307-surface)!important;
  background-image:none!important;
  border-color:var(--f307-border)!important;
  color:var(--f307-text)!important;
}

/* Approved document/report previews remain paper white by design. */
html[data-theme="dark"][data-swiso-palette="forge-current"] body[data-portal="forge"] #moduleView#moduleView :is(.r58-preview,.document-preview,.page-preview,.paper-preview){
  background:#fff!important;
  color:#17354a!important;
}
html[data-theme="dark"][data-swiso-palette="forge-current"] body[data-portal="forge"] #moduleView#moduleView :is(.r58-preview,.document-preview,.page-preview,.paper-preview) :is(h1,h2,h3,h4,h5,h6,p,small,label,strong,span){color:inherit!important}

@media(prefers-reduced-motion:reduce){
  html[data-theme="dark"][data-swiso-palette="forge-current"] body[data-portal="forge"] :is(#r65Sidebar,#managementView,#moduleView) *{
    transition-duration:.01ms!important;
    animation-duration:.01ms!important;
  }
}
