/* SWISO 0.20.291 targeted body hierarchy, workflow and contrast refinement.
   Exact protected baseline: installed 0.20.290.
   The universal header, command bar and navigation structure are out of scope. */

/* Forge light mode: white working surfaces for every approved palette. */
html:not([data-theme="dark"]) body[data-portal="forge"] #moduleView#moduleView{
  --v291-surface:#fff;
  --v291-surface-soft:#f7f9fa;
  --v291-text:#172f3f;
  --v291-muted:#5b707d;
  --v291-line:color-mix(in srgb,var(--v290-accent,#176a78) 18%,#d8e1e5)
}
html:not([data-theme="dark"]) body[data-portal="forge"] #moduleView#moduleView :is(
  .panel,.dashboard-panel,.r65-surface,.f272-card,.f272-panel,.forge209-section,.forge209-user,
  .forge210-modules,.forge210-module-grid>article,.forge218-industry,.forge226-profile-bar,
  .forge226-sector-layout,.forge222-purpose,.forge221-config,.forge223-import,.licensed-products,
  .pathway-market-links,.licence-terms-grid>article,fieldset,.v291-workflow-banner
){
  background:#fff!important;color:var(--v291-text)!important;border-color:var(--v291-line)!important;
  box-shadow:0 5px 15px rgba(18,54,70,.075)!important
}
html:not([data-theme="dark"]) body[data-portal="forge"] #moduleView#moduleView :is(input,select,textarea){
  background:#fff!important;color:var(--v291-text)!important
}

/* Five-step workflow banner shared by Folder Indexer and PDF tools. */
body[data-portal="forge"] #moduleView#moduleView .v291-workflow-banner{
  position:relative;display:grid!important;grid-template-columns:minmax(210px,1.15fr) repeat(5,minmax(118px,1fr));
  gap:10px;align-items:stretch;margin:0 0 16px!important;padding:14px!important;
  border:1px solid var(--v290-border,#d4dfe4)!important;border-left:4px solid var(--v290-accent,#176a78)!important;
  border-radius:10px!important;background:var(--v290-surface,#fff)!important;box-shadow:var(--v290-shadow)!important
}
body[data-portal="forge"] #moduleView#moduleView .v291-workflow-intro{align-self:center;min-width:0;padding:2px 9px 2px 3px}
body[data-portal="forge"] #moduleView#moduleView .v291-workflow-intro strong{display:block;margin-bottom:4px;color:var(--v290-text,#17354a)!important;font-size:15px!important}
body[data-portal="forge"] #moduleView#moduleView .v291-workflow-intro small{display:block;color:var(--v290-muted,#617582)!important;font-size:12.5px!important;line-height:1.4!important}
body[data-portal="forge"] #moduleView#moduleView .v291-workflow-step{
  position:relative;min-width:0;min-height:58px;padding:10px 9px 9px 37px;border:1px solid var(--v290-border,#d4dfe4);
  border-radius:8px;background:var(--v290-surface-2,#f7f9fa);color:var(--v290-text,#17354a);
  font-size:12.5px;font-weight:800;line-height:1.35
}
body[data-portal="forge"] #moduleView#moduleView .v291-workflow-step::before{
  content:attr(data-step);position:absolute;left:9px;top:10px;width:20px;height:20px;display:grid;place-items:center;
  border-radius:50%;background:var(--v290-accent,#176a78);color:#fff;font-size:11px;font-weight:900
}
body[data-portal="forge"] #moduleView#moduleView[data-v291-workflow] :is(.forge209-actions,.forge226-toolbar,.r65-actions){gap:10px!important;align-items:center!important}
body[data-portal="forge"] #moduleView#moduleView[data-v291-workflow] :is(button,input,select){min-height:36px}
body[data-portal="forge"] #moduleView#moduleView[data-v291-workflow="folder"] [data-v291-result="empty"]{
  min-height:48px!important;height:auto!important;padding:12px 14px!important
}
body[data-portal="forge"] #moduleView#moduleView[data-v291-workflow="folder"] [data-v291-guidance]{
  max-width:105ch;margin:10px 0 0!important;padding:9px 12px!important;border-left:3px solid var(--v290-accent,#176a78);
  background:var(--v290-surface-2,#f7f9fa);color:var(--v290-muted,#617582)!important;font-size:12.5px!important;line-height:1.45!important
}

/* Workflow guidance must remain readable when Forge uses dark mode. */
html[data-theme="dark"] body[data-portal="forge"] #moduleView#moduleView .v291-workflow-banner{
  background:#132b3b!important;color:#eef6f7!important;border-color:#35596a!important;
  border-left-color:var(--v290-accent,#35a8b8)!important;box-shadow:0 8px 22px rgba(0,0,0,.24)!important
}
html[data-theme="dark"] body[data-portal="forge"] #moduleView#moduleView .v291-workflow-intro strong{
  color:#f3f8f9!important
}
html[data-theme="dark"] body[data-portal="forge"] #moduleView#moduleView .v291-workflow-intro small{
  color:#bed0d6!important
}
html[data-theme="dark"] body[data-portal="forge"] #moduleView#moduleView .v291-workflow-step{
  background:#193848!important;color:#eef6f7!important;border-color:#3b6171!important
}
html[data-theme="dark"] body[data-portal="forge"] #moduleView#moduleView[data-v291-workflow="folder"] [data-v291-guidance],
html[data-theme="dark"] body[data-portal="forge"] #moduleView#moduleView[data-v291-workflow="folder"] [data-v291-result="empty"]{
  background:#173544!important;color:#c6d7dc!important;border-color:#3b6171!important
}

/* EA codes: stable rows, readable wrapping and a balanced mapping panel. */
body[data-portal="forge"] #moduleView#moduleView [data-forge-layout="industry-ea-codes"]{
  display:grid!important;gap:14px!important
}
body[data-portal="forge"] #moduleView#moduleView [data-forge-layout="industry-ea-codes"] .forge226-profile-bar{
  display:grid!important;grid-template-columns:minmax(260px,.7fr) minmax(360px,1.3fr)!important;gap:12px!important;
  align-items:end!important;padding:14px!important
}
body[data-portal="forge"] #moduleView#moduleView [data-forge-layout="industry-ea-codes"] .forge226-sector-layout{
  grid-template-columns:minmax(560px,1.55fr) minmax(410px,1fr)!important;gap:16px!important;align-items:start!important
}
body[data-portal="forge"] #moduleView#moduleView [data-forge-layout="industry-ea-codes"] fieldset.r65-ea{
  grid-template-columns:repeat(2,minmax(250px,1fr))!important;gap:8px!important;max-height:500px!important;padding:15px!important
}
body[data-portal="forge"] #moduleView#moduleView fieldset.r65-ea>label:not(.v290-file-field){
  min-height:48px!important;height:auto!important;grid-template-columns:18px 64px minmax(0,1fr)!important;
  align-items:center!important;gap:8px!important;padding:8px 10px!important;overflow:visible!important
}
body[data-portal="forge"] #moduleView#moduleView fieldset.r65-ea>label:not(.v290-file-field)>:is(span,strong,small){
  min-width:0!important;white-space:normal!important;overflow:visible!important;text-overflow:clip!important;line-height:1.3!important
}
body[data-portal="forge"] #moduleView#moduleView fieldset.r65-ea>:is(.sb253-ea-tools,.v290-ea-tools){
  grid-template-columns:minmax(260px,1fr) max-content max-content!important;align-items:center!important
}
body[data-portal="forge"] #moduleView#moduleView [data-forge-layout="industry-ea-codes"] .forge218-industry{
  min-height:100%!important;padding:17px!important
}
body[data-portal="forge"] #moduleView#moduleView [data-forge-layout="industry-ea-codes"] .forge218-controls{
  grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:13px!important
}

/* Users: explicit columns rather than the previous ambiguous pseudo-heading. */
body[data-portal="forge"] #moduleView#moduleView [data-forge-layout="users"]>[data-users]::before{display:none!important}
body[data-portal="forge"] #moduleView#moduleView .v291-user-head,
body[data-portal="forge"] #moduleView#moduleView [data-forge-layout="users"]>[data-users]>.forge209-user{
  display:grid!important;grid-template-columns:38px minmax(280px,1.65fr) minmax(115px,.45fr) minmax(110px,.45fr) minmax(230px,1fr) 118px!important;
  align-items:center!important;column-gap:12px!important
}
body[data-portal="forge"] #moduleView#moduleView .v291-user-head{
  min-height:38px;padding:8px 12px;border-bottom:1px solid var(--v290-border-strong,#a8bec8);
  background:var(--v290-surface-3,#edf3f5);color:var(--v290-muted,#617582);font-size:11px;font-weight:900;
  letter-spacing:.055em;text-transform:uppercase
}
body[data-portal="forge"] #moduleView#moduleView .v291-user-head span:first-child{grid-column:1/3}
body[data-portal="forge"] #moduleView#moduleView [data-forge-layout="users"]>[data-users]>.forge209-user{
  min-height:58px!important;padding:9px 12px!important;border-bottom:1px solid var(--v290-border,#d4dfe4)!important;border-radius:0!important;box-shadow:none!important
}
body[data-portal="forge"] #moduleView#moduleView [data-forge-layout="users"]>[data-users]>.forge209-user::before{
  grid-column:1!important;grid-row:1!important;width:30px!important;height:30px!important;content:attr(data-v290-initials)!important;
  border-color:color-mix(in srgb,var(--v291-avatar,var(--v290-accent)) 38%,var(--v290-border))!important;
  background:color-mix(in srgb,var(--v291-avatar,var(--v290-accent)) 13%,var(--v290-surface))!important;
  color:var(--v291-avatar,var(--v290-accent))!important
}
body[data-portal="forge"] #moduleView#moduleView [data-forge-layout="users"]>[data-users]>.forge209-user:nth-of-type(5n+1){--v291-avatar:var(--v290-accent,#176a78)}
body[data-portal="forge"] #moduleView#moduleView [data-forge-layout="users"]>[data-users]>.forge209-user:nth-of-type(5n+2){--v291-avatar:#4b83b2}
body[data-portal="forge"] #moduleView#moduleView [data-forge-layout="users"]>[data-users]>.forge209-user:nth-of-type(5n+3){--v291-avatar:var(--v290-success,#168060)}
body[data-portal="forge"] #moduleView#moduleView [data-forge-layout="users"]>[data-users]>.forge209-user:nth-of-type(5n+4){--v291-avatar:#8a63a8}
body[data-portal="forge"] #moduleView#moduleView [data-forge-layout="users"]>[data-users]>.forge209-user:nth-of-type(5n){--v291-avatar:#a66b2b}
body[data-portal="forge"] #moduleView#moduleView [data-forge-layout="users"] .forge209-user>div:first-of-type{grid-column:2!important;grid-row:1!important}
body[data-portal="forge"] #moduleView#moduleView [data-forge-layout="users"] .forge209-user>div:nth-of-type(2){display:contents!important}
body[data-portal="forge"] #moduleView#moduleView [data-forge-layout="users"] .v291-user-role{grid-column:3!important;color:var(--v290-muted)!important;font-size:12.5px!important}
body[data-portal="forge"] #moduleView#moduleView [data-forge-layout="users"] .forge209-user .f272-status{grid-column:4!important;justify-self:start!important}
body[data-portal="forge"] #moduleView#moduleView [data-forge-layout="users"] .forge209-user>small{grid-column:5!important;grid-row:1!important;display:block!important}
body[data-portal="forge"] #moduleView#moduleView [data-forge-layout="users"] .forge209-user>button{grid-column:6!important;grid-row:1!important;width:100%!important}
body[data-portal="forge"] #moduleView#moduleView [data-forge-layout="users"]>.forge209-section{display:none!important}

/* Pathway light mode: neutral canvas, white panels and explicit readable ink. */
html:not([data-theme="dark"]) body[data-portal="pathway"] .workspace{
  background:radial-gradient(circle at 92% 4%,rgba(23,137,117,.055),transparent 31rem),linear-gradient(150deg,#f1f5f4,#f8faf9)!important;
  color:#1c322f!important
}
html:not([data-theme="dark"])[data-swiso-palette="british-botanical"] body[data-portal="pathway"] .workspace{
  background:radial-gradient(circle at 92% 4%,rgba(85,125,102,.055),transparent 30rem),linear-gradient(150deg,#f2f5f1,#fafbf9)!important
}
html:not([data-theme="dark"]) body[data-portal="pathway"] .swiso-runtime-content{
  color:#1c322f!important
}
html:not([data-theme="dark"]) body[data-portal="pathway"] .swiso-runtime-content :is(h1,h2,h3,h4,h5,strong,legend,summary,label){color:#1b302e!important}
html:not([data-theme="dark"]) body[data-portal="pathway"] .swiso-runtime-content :is(p,small,.muted){color:#596d69!important}
html:not([data-theme="dark"]) body[data-portal="pathway"] .swiso-runtime-content :is(
  .panel,.pathway-licence-card,.licensed-products,.pathway-market-links,.licence-terms-grid>article,
  .licensed-product-grid>a,.pathway-market-links a,.overview-heading170,.pathway-overview-card,.pathway235-banner
){
  background:#fff!important;color:#1c322f!important;border-color:#ccd9d5!important;box-shadow:0 5px 15px rgba(26,61,55,.075)!important
}
html:not([data-theme="dark"]) body[data-portal="pathway"] .swiso-runtime-content :is(.pathway-licence-card,.pathway-licence-card article){
  background:#fff!important;color:#1c322f!important
}
html:not([data-theme="dark"]) body[data-portal="pathway"] .swiso-runtime-content .pathway-licence-card :is(h1,h2,h3,h4,strong,span,p,small){
  color:#1c322f!important;text-shadow:none!important;opacity:1!important
}
html:not([data-theme="dark"]) body[data-portal="pathway"] .swiso-runtime-content .pathway-licence-card small,
html:not([data-theme="dark"]) body[data-portal="pathway"] .swiso-runtime-content .pathway-licence-card p{color:#596d69!important}
html:not([data-theme="dark"]) body[data-portal="pathway"] .sidebar :is(.nav-label,.nav-link,.nav-group-title,.sidebar-foot strong){color:#203c38!important}
html:not([data-theme="dark"]) body[data-portal="pathway"] .sidebar .nav-link :is(span,strong,small){color:#203c38!important}
html:not([data-theme="dark"]) body[data-portal="pathway"] .sidebar .nav-link.active{color:#173c35!important}

@media(max-width:1250px){
  body[data-portal="forge"] #moduleView#moduleView .v291-workflow-banner{grid-template-columns:repeat(3,minmax(0,1fr))!important}
  body[data-portal="forge"] #moduleView#moduleView .v291-workflow-intro{grid-column:1/-1}
  body[data-portal="forge"] #moduleView#moduleView [data-forge-layout="industry-ea-codes"] .forge226-sector-layout{grid-template-columns:1fr!important}
  body[data-portal="forge"] #moduleView#moduleView .v291-user-head,
  body[data-portal="forge"] #moduleView#moduleView [data-forge-layout="users"]>[data-users]>.forge209-user{grid-template-columns:36px minmax(220px,1.4fr) 105px 105px minmax(180px,1fr) 108px!important}
}
@media(max-width:820px){
  body[data-portal="forge"] #moduleView#moduleView .v291-workflow-banner{grid-template-columns:1fr!important}
  body[data-portal="forge"] #moduleView#moduleView [data-forge-layout="industry-ea-codes"] .forge226-profile-bar,
  body[data-portal="forge"] #moduleView#moduleView [data-forge-layout="industry-ea-codes"] fieldset.r65-ea{grid-template-columns:1fr!important}
  body[data-portal="forge"] #moduleView#moduleView .v291-user-head{display:none!important}
  body[data-portal="forge"] #moduleView#moduleView [data-forge-layout="users"]>[data-users]>.forge209-user{
    grid-template-columns:36px minmax(0,1fr) auto!important;grid-template-rows:auto auto auto!important;gap:6px 10px!important
  }
  body[data-portal="forge"] #moduleView#moduleView [data-forge-layout="users"] .forge209-user>div:first-of-type{grid-column:2/4!important}
  body[data-portal="forge"] #moduleView#moduleView [data-forge-layout="users"] .v291-user-role{grid-column:2!important;grid-row:2!important}
  body[data-portal="forge"] #moduleView#moduleView [data-forge-layout="users"] .forge209-user .f272-status{grid-column:3!important;grid-row:2!important}
  body[data-portal="forge"] #moduleView#moduleView [data-forge-layout="users"] .forge209-user>small{grid-column:2/4!important;grid-row:3!important}
  body[data-portal="forge"] #moduleView#moduleView [data-forge-layout="users"] .forge209-user>button{grid-column:2/4!important;grid-row:4!important;width:max-content!important}
}
