/*
  SMCFX colour-theme contract.

  This layer owns semantic colour tokens and colour-only overrides for the
  shared application shell. Geometry belongs to the component stylesheets and
  must remain identical between themes.
*/
:root,
html[data-theme="dark"]{
  color-scheme:dark;
  --theme-canvas:#061017;
  --theme-canvas-alt:#0b1a22;
  --theme-surface:rgba(7,18,27,.78);
  --theme-surface-strong:rgba(2,8,12,.88);
  --theme-surface-soft:rgba(255,255,255,.055);
  --theme-surface-hover:rgba(255,255,255,.09);
  --theme-text:#f3f7f8;
  --theme-text-soft:#d8e3e5;
  --theme-muted:#aebdc1;
  --theme-line:rgba(255,255,255,.11);
  --theme-line-strong:rgba(255,255,255,.22);
  --theme-accent:#8ebd00;
  --theme-accent-strong:#b8e225;
  --theme-accent-soft:rgba(185,229,50,.14);
  --theme-danger:#ff7d7d;
  --theme-success:#8ebd00;
  --theme-warning:#f5b94c;
  --theme-overlay:rgba(0,0,0,.72);
  --theme-shadow-color:rgba(0,0,0,.42);
  --theme-focus-ring:rgba(185,229,50,.32);
  --theme-input:rgba(255,255,255,.055);
  --theme-input-bg:rgba(255,255,255,.055);
  --theme-input-text:#f3f7f8;
  --theme-placeholder:#81929a;

  /* Exact legacy values keep the existing dark preloader pixel-stable. */
  --theme-preloader-backdrop:rgba(5,10,20,.96);
  --theme-preloader-panel-top:rgba(13,19,35,.92);
  --theme-preloader-panel-bottom:rgba(7,10,18,.96);
  --theme-preloader-panel-border:rgba(255,255,255,.12);
  --theme-preloader-panel-shadow:0 18px 54px rgba(0,0,0,.28);
  --theme-preloader-copy:rgba(255,255,255,.7);
  --theme-preloader-art-border:rgba(92,140,255,.6);
  --theme-preloader-art-shadow:0 0 0 1px rgba(255,255,255,.04),0 20px 40px rgba(0,0,0,.28);
  --theme-preloader-pulse-start:rgba(82,151,255,.52);
  --theme-preloader-pulse-end:rgba(188,217,60,.96);
  --theme-preloader-pulse-shadow-start:0 0 0 1px rgba(255,255,255,.04),0 16px 34px rgba(0,0,0,.24),0 0 0 rgba(82,151,255,0);
  --theme-preloader-pulse-shadow-end:0 0 0 1px rgba(255,255,255,.08),0 18px 40px rgba(0,0,0,.28),0 0 26px rgba(188,217,60,.28);
  --theme-preloader-firefox-backdrop:#050a14;
  --theme-preloader-firefox-panel:#0d1323;
  --theme-preloader-firefox-ring:rgba(185,229,50,.2);
  --theme-preloader-firefox-spinner:#b9e532;
}

html[data-theme="light"]{
  color-scheme:light;
  --theme-canvas:#f3f7fc;
  --theme-canvas-alt:#e8f1f9;
  --theme-surface:rgba(255,255,255,.9);
  --theme-surface-strong:#ffffff;
  --theme-surface-soft:#edf4fa;
  --theme-surface-hover:#e3eef8;
  --theme-text:#10243a;
  --theme-text-soft:#2d4864;
  --theme-muted:#49627a;
  --theme-line:rgba(27,82,128,.15);
  --theme-line-strong:rgba(27,82,128,.27);
  /* Form controls meet a 3:1 boundary contrast on the white input surface. */
  --theme-control-border:#7895ad;
  --theme-control-border-hover:#4f86ad;
  --theme-control-focus-ring:rgba(18,111,172,.24);
  --theme-control-focus-spread:1px;
  --theme-control-readonly:#f2f7fb;
  --theme-accent:#126fac;
  --theme-accent-strong:#075a91;
  --theme-accent-soft:rgba(18,111,172,.13);
  --theme-danger:#b92f4a;
  --theme-success:#147453;
  --theme-warning:#915d08;
  --theme-overlay:rgba(15,35,58,.42);
  --theme-shadow-color:rgba(25,65,105,.16);
  --theme-focus-ring:rgba(11,120,187,.3);
  --theme-input:#ffffff;
  --theme-input-bg:#ffffff;
  --theme-input-text:#10243a;
  --theme-placeholder:#5d758c;

  --theme-preloader-backdrop:rgba(237,245,252,.97);
  --theme-preloader-panel-top:rgba(255,255,255,.97);
  --theme-preloader-panel-bottom:rgba(232,242,250,.98);
  --theme-preloader-panel-border:rgba(27,82,128,.17);
  --theme-preloader-panel-shadow:0 18px 54px rgba(25,65,105,.16);
  --theme-preloader-copy:#526a80;
  --theme-preloader-art-border:rgba(34,126,190,.62);
  --theme-preloader-art-shadow:0 0 0 1px rgba(255,255,255,.72),0 20px 40px rgba(25,65,105,.17);
  --theme-preloader-pulse-start:rgba(34,126,190,.56);
  --theme-preloader-pulse-end:rgba(7,90,145,.9);
  --theme-preloader-pulse-shadow-start:0 0 0 1px rgba(255,255,255,.72),0 16px 34px rgba(25,65,105,.13),0 0 0 rgba(34,126,190,0);
  --theme-preloader-pulse-shadow-end:0 0 0 1px rgba(255,255,255,.9),0 18px 40px rgba(25,65,105,.16),0 0 26px rgba(34,126,190,.2);
  --theme-preloader-firefox-backdrop:#edf5fc;
  --theme-preloader-firefox-panel:#ffffff;
  --theme-preloader-firefox-ring:rgba(18,111,172,.2);
  --theme-preloader-firefox-spinner:#126fac;

  /* Legacy aliases consumed by the shared panel component stylesheets. */
  --smc-bg:var(--theme-canvas);
  --smc-bg-2:var(--theme-canvas-alt);
  --smc-panel:var(--theme-surface);
  --smc-panel-strong:var(--theme-surface-strong);
  --smc-glass:var(--theme-surface-soft);
  --smc-glass-2:rgba(18,111,172,.035);
  --smc-line:var(--theme-line);
  --smc-line-strong:var(--theme-line-strong);
  --smc-text:var(--theme-text);
  --smc-muted:var(--theme-muted);
  --smc-soft:var(--theme-text-soft);
  --smc-primary:var(--theme-accent);
  --smc-primary-2:var(--theme-accent-strong);
  --smc-primary-soft:var(--theme-accent-soft);
  --smc-danger:var(--theme-danger);
  --smc-shadow:0 34px 100px var(--theme-shadow-color);
  --bg:var(--theme-canvas);
  --panel:var(--theme-surface);
  --panel-soft:var(--theme-surface-soft);
  --text:var(--theme-text);
  --muted:var(--theme-muted);
  --accent:var(--theme-accent);
  --accent-2:var(--theme-accent-strong);
  --line:var(--theme-line);
  --border:var(--theme-line);
  --danger:var(--theme-danger);
  --shadow:0 24px 60px var(--theme-shadow-color);
  scrollbar-color:#78a8cb #e8f1f9;
}

/* Shared theme switch: its desktop slot is out of flow, preserving neighbours. */
.top-actions.hasThemeToggle{position:relative}
.themeToggleSlot{
  position:absolute;
  z-index:2;
  left:calc(100% + 12px);
  top:50%;
  width:42px;
  height:42px;
  flex:0 0 42px;
  direction:rtl;
  transform:translateY(-50%);
}
.themeToggle{
  width:42px;
  height:42px;
  min-width:42px;
  min-height:42px;
  display:grid;
  place-items:center;
  padding:0;
  border:1px solid var(--theme-line);
  border-radius:50%;
  background:var(--theme-surface-soft);
  color:var(--theme-text-soft);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 10px 26px var(--theme-shadow-color);
  cursor:pointer;
  font:inherit;
  transition:color .18s ease,background-color .18s ease,border-color .18s ease,box-shadow .18s ease;
}
.themeToggle:hover{
  color:var(--theme-accent-strong);
  background:var(--theme-accent-soft);
  border-color:color-mix(in srgb,var(--theme-accent) 38%,transparent);
}
.themeToggle:focus-visible{
  outline:3px solid var(--theme-focus-ring);
  outline-offset:3px;
}
.themeToggleIcon,
.themeToggleIcon svg{
  width:20px;
  height:20px;
  display:block;
}
.themeToggleIcon svg{
  fill:none;
  stroke:currentColor;
  stroke-width:1.8;
  stroke-linecap:round;
  stroke-linejoin:round;
}
.themeToggleIcon--sun{display:none}
html[data-theme="light"] .themeToggleIcon--sun{display:block}
html[data-theme="light"] .themeToggleIcon--moon{display:none}
.themeToggleSr{
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap;
  border:0;
}
.themeMenuToggle{display:none}

/* Colour-only treatment for the shared authenticated shell. */
html[data-theme="light"] body{
  color:var(--theme-text);
  background:
    linear-gradient(90deg,rgba(27,82,128,.045) 1px,transparent 1px),
    radial-gradient(960px 420px at 90% -10%,rgba(65,151,211,.18),transparent 60%),
    radial-gradient(780px 380px at 0% 100%,rgba(112,174,218,.16),transparent 60%),
    linear-gradient(180deg,#f9fcff,#eef5fb 54%,#e7f0f8);
}
html[data-theme="light"] body::before{
  background:
    linear-gradient(90deg,rgba(18,111,172,.07),transparent 30%,transparent 72%,rgba(55,142,155,.055)),
    radial-gradient(680px 240px at 50% 0%,rgba(255,255,255,.86),transparent 70%);
}
html[data-theme="light"] .topbar,
html[data-theme="light"] .siteHeader{
  background:
    radial-gradient(760px 90px at 84% 0%,rgba(52,142,205,.12),transparent 70%),
    linear-gradient(180deg,rgba(255,255,255,.97),rgba(239,246,252,.92));
  border-bottom-color:var(--theme-line-strong);
  box-shadow:0 18px 70px rgba(25,65,105,.13),inset 0 -1px 0 rgba(27,82,128,.08);
}
html[data-theme="light"] .topbar::after,
html[data-theme="light"] .siteHeader::after{
  background:linear-gradient(90deg,transparent,rgba(18,111,172,.55),rgba(18,111,172,.2),transparent);
  box-shadow:0 0 26px rgba(18,111,172,.17);
}
html[data-theme="light"] .brand-mark,
html[data-theme="light"] .smc-brand__logo{
  background:rgba(255,255,255,.76);
  border-color:var(--theme-line);
  box-shadow:0 0 0 7px rgba(18,111,172,.04),0 16px 42px rgba(25,65,105,.13);
}
html[data-theme="light"] .topbarIdentity strong,
html[data-theme="light"] .accountMenuIdentity strong,
html[data-theme="light"] .accountMenuItemCopy strong,
html[data-theme="light"] .fxCardTitle{color:var(--theme-text)}
html[data-theme="light"] .topbarIdentity em,
html[data-theme="light"] .accountMenuIdentity small,
html[data-theme="light"] .accountMenuItemCopy small,
html[data-theme="light"] .accountMenuSectionLabel{color:var(--theme-muted)}
html[data-theme="light"] .topbarIdentity::after{
  background:linear-gradient(180deg,transparent,var(--theme-line-strong),transparent);
}
html[data-theme="light"] .panelModeBar{
  border-color:var(--theme-line);
  background:
    radial-gradient(260px 60px at 50% 0%,rgba(18,111,172,.12),transparent 70%),
    linear-gradient(180deg,rgba(255,255,255,.92),rgba(226,238,248,.78));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.9),0 18px 46px rgba(25,65,105,.12);
}
html[data-theme="light"] .panelModeButton{
  border-color:var(--theme-line);
  background:rgba(255,255,255,.72);
  color:var(--theme-text-soft);
}
html[data-theme="light"] .panelModeButton:hover{
  border-color:color-mix(in srgb,var(--theme-accent) 30%,transparent);
  background:var(--theme-accent-soft);
  box-shadow:0 0 24px rgba(18,111,172,.1);
}
html[data-theme="light"] .panelModeButton.is-active{
  color:#ffffff;
  background:linear-gradient(135deg,#3194d2 0%,var(--theme-accent) 48%,var(--theme-accent-strong) 100%);
  border-color:rgba(7,90,145,.55);
  box-shadow:0 0 0 1px rgba(18,111,172,.1),0 14px 34px rgba(25,65,105,.18),inset 0 1px 0 rgba(255,255,255,.45);
}
html[data-theme="light"] .panelModeBadge{
  color:#ffffff;
  background:linear-gradient(135deg,#3a9bd8,var(--theme-accent-strong));
  border-color:rgba(255,255,255,.75);
  box-shadow:0 0 0 3px rgba(18,111,172,.08),0 8px 20px rgba(25,65,105,.17);
}
html[data-theme="light"] .accountMenu summary,
html[data-theme="light"] .smc-accountMenu summary{
  border-color:var(--theme-line);
  background:
    radial-gradient(circle at 70% 22%,rgba(18,111,172,.13),transparent 54%),
    linear-gradient(180deg,rgba(255,255,255,.96),rgba(231,241,249,.82));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.9),0 18px 42px rgba(25,65,105,.13);
}
html[data-theme="light"] .accountMenuPanel,
html[data-theme="light"] .smc-accountMenu__panel{
  border-color:var(--theme-line-strong);
  background:
    radial-gradient(420px 170px at 100% 0%,rgba(18,111,172,.11),transparent 60%),
    linear-gradient(180deg,rgba(255,255,255,.99),rgba(237,245,251,.98));
  box-shadow:0 28px 80px rgba(25,65,105,.18),inset 0 1px 0 rgba(255,255,255,.95);
}
html[data-theme="light"] .accountMenuIdentity{
  border-color:var(--theme-line);
  background:
    radial-gradient(180px 80px at 100% 0%,rgba(18,111,172,.1),transparent 68%),
    rgba(255,255,255,.72);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.92);
}
html[data-theme="light"] .accountMenuUtilityGroup{border-top-color:var(--theme-line)}
html[data-theme="light"] .accountMenuDashboardLink{
  border-color:rgba(18,111,172,.1);
  background:linear-gradient(90deg,rgba(18,111,172,.045),rgba(255,255,255,.2));
}
html[data-theme="light"] .accountMenuDashboardLink:hover{
  border-color:rgba(18,111,172,.23);
  background:linear-gradient(90deg,rgba(18,111,172,.11),rgba(255,255,255,.35))!important;
}
html[data-theme="light"] .accountMenuItemIcon{
  color:var(--theme-accent);
  background:
    radial-gradient(circle at 50% 0%,rgba(18,111,172,.14),transparent 62%),
    linear-gradient(180deg,rgba(255,255,255,.92),rgba(224,237,247,.7));
  border-color:rgba(18,111,172,.2);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.92);
}
html[data-theme="light"] .accountMenuPanel a,
html[data-theme="light"] .smc-accountMenu__panel a{color:var(--theme-text-soft)}
html[data-theme="light"] .accountMenuPanel a:hover,
html[data-theme="light"] .smc-accountMenu__panel a:hover{background:var(--theme-surface-hover)}
html[data-theme="light"] .panel{
  border-color:var(--theme-line);
  background:
    radial-gradient(760px 260px at 100% 0%,rgba(18,111,172,.08),transparent 68%),
    linear-gradient(180deg,rgba(255,255,255,.93),rgba(237,245,251,.88));
  box-shadow:0 30px 90px rgba(25,65,105,.14),inset 0 1px 0 rgba(255,255,255,.94);
}
html[data-theme="light"] .sidebar{
  border-inline-start-color:var(--theme-line);
  background:
    radial-gradient(260px 190px at 80% 0%,rgba(18,111,172,.12),transparent 72%),
    linear-gradient(180deg,rgba(249,252,255,.96),rgba(229,240,248,.96));
}
html[data-theme="light"] .sidebar-head::after{
  background:linear-gradient(90deg,transparent,var(--theme-line-strong),transparent);
}
html[data-theme="light"] .sidebar-foot{border-top-color:var(--theme-line)}
html[data-theme="light"] .sideMiniLink{
  border-color:var(--theme-line);
  background:rgba(255,255,255,.68);
  color:var(--theme-text-soft);
}
html[data-theme="light"] .content-head{
  border-bottom-color:var(--theme-line);
  background:
    linear-gradient(90deg,rgba(18,111,172,.07),transparent 48%),
    rgba(255,255,255,.42);
}
html[data-theme="light"] .nav a,
html[data-theme="light"] .navGroup > summary{color:var(--theme-text-soft)}
html[data-theme="light"] .nav a:hover,
html[data-theme="light"] .navGroup > summary:hover{
  background:var(--theme-surface-hover);
  border-color:var(--theme-line);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.85),0 10px 30px rgba(25,65,105,.09);
}
html[data-theme="light"] .nav a.active,
html[data-theme="light"] .navGroup.is-active > summary{
  background:
    radial-gradient(150px 62px at 96% 50%,rgba(18,111,172,.17),transparent 72%),
    linear-gradient(90deg,rgba(18,111,172,.11),rgba(255,255,255,.25));
  border-color:rgba(18,111,172,.25);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.9),0 0 0 1px rgba(18,111,172,.05),0 0 32px rgba(25,65,105,.08);
}
html[data-theme="light"] .navIcon{
  color:var(--theme-accent);
  border-color:var(--theme-line);
  background:linear-gradient(180deg,rgba(255,255,255,.92),rgba(224,237,247,.72));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.95);
}
html[data-theme="light"] .fxCard,
html[data-theme="light"] .card{
  border-color:var(--theme-line)!important;
  background:
    radial-gradient(620px 210px at 100% 0%,rgba(18,111,172,.08),transparent 64%),
    linear-gradient(180deg,rgba(255,255,255,.94),rgba(235,244,251,.84))!important;
  box-shadow:0 30px 90px rgba(25,65,105,.13),inset 0 1px 0 rgba(255,255,255,.94)!important;
}
html[data-theme="light"] .btn,
html[data-theme="light"] .fxBtn,
html[data-theme="light"] .fxCheckboxWrap{
  border-color:var(--theme-line);
  background:rgba(255,255,255,.72);
  color:var(--theme-text);
}
html[data-theme="light"] .btn:hover,
html[data-theme="light"] .fxBtn:hover{background:var(--theme-surface-hover)}
html[data-theme="light"] input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="range"]):not([type="color"]):not([type="image"]):not([type="file"]),
html[data-theme="light"] select,
html[data-theme="light"] textarea,
html[data-theme="light"] .fxInput,
html[data-theme="light"] .fxSelect,
html[data-theme="light"] .fxTextarea{
  color-scheme:light;
  border-color:var(--theme-control-border);
  background-color:var(--theme-input);
  color:var(--theme-text);
  -webkit-text-fill-color:var(--theme-text);
}
html[data-theme="light"] :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="range"]):not([type="color"]):not([type="image"]):not([type="file"]),select,textarea,.fxInput,.fxSelect,.fxTextarea):hover:not(:disabled):not(:focus){
  border-color:var(--theme-control-border-hover);
}
html[data-theme="light"] :is(input[readonly],textarea[readonly],input:disabled,select:disabled,textarea:disabled){
  border-color:var(--theme-control-border);
  background-color:var(--theme-control-readonly);
}
html[data-theme="light"] input::placeholder,
html[data-theme="light"] textarea::placeholder{color:var(--theme-placeholder)}
html[data-theme="light"] .content-body select,
html[data-theme="light"] .content-body select option,
html[data-theme="light"] .content-body select optgroup{
  color-scheme:light;
  background-color:var(--theme-input)!important;
  color:var(--theme-text)!important;
  -webkit-text-fill-color:var(--theme-text);
}
html[data-theme="light"] .content-body select option:checked{
  background:var(--theme-accent-soft)!important;
  box-shadow:0 0 0 100vmax var(--theme-accent-soft) inset;
  color:var(--theme-accent-strong)!important;
  -webkit-text-fill-color:var(--theme-accent-strong);
}
html[data-theme="light"] .content-body select option:disabled,
html[data-theme="light"] .content-body select:disabled{
  color:var(--theme-muted)!important;
  -webkit-text-fill-color:var(--theme-muted);
}
html[data-theme="light"] .content-body select:focus-visible{
  border-color:var(--theme-accent)!important;
  box-shadow:0 0 0 var(--theme-control-focus-spread) var(--theme-control-focus-ring);
}

@media (max-width:860px){
  .themeToggleSlot{
    right:calc(100% + 10px);
    left:auto;
  }
}
@media (max-width:640px){
  .themeToggleSlot{display:none}
  .themeMenuToggle{
    min-height:44px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    padding:0 12px;
    border:1px solid var(--theme-line);
    border-radius:8px;
    background:var(--theme-surface-soft);
    color:var(--theme-text-soft);
    cursor:pointer;
    font:inherit;
  }
  .themeMenuToggle:hover{
    border-color:color-mix(in srgb,var(--theme-accent) 30%,var(--theme-line));
    background:var(--theme-surface-hover);
    color:var(--theme-accent-strong);
  }
  .themeMenuToggle:focus-visible{
    outline:3px solid var(--theme-focus-ring);
    outline-offset:2px;
  }
  .themeMenuToggle .themeToggleIcon,
  .themeMenuToggle .themeToggleIcon svg{
    width:18px;
    height:18px;
  }
  .themeMenuToggleCopy{
    color:currentColor;
    font-size:11px;
    font-weight:950;
  }
}

@media (prefers-reduced-motion:reduce){
  .themeToggle{transition:none}
}

.siteBrandGroup{display:flex;align-items:center;gap:10px;flex-shrink:0}.siteBrandGroup>.themeToggleSlot,.topbarBrandZone>.themeToggleSlot{position:static!important;inset:auto!important;transform:none!important;display:block!important;width:36px;height:36px;flex:0 0 36px}.siteBrandGroup .themeToggle,.topbarBrandZone>.themeToggleSlot .themeToggle{width:36px;height:36px;min-width:36px;min-height:36px}

.topbarBrandZone>.brand{order:0!important}.topbarBrandZone>.themeToggleSlot{order:1!important}.topbarBrandZone>.topbarNoticeRail{order:2!important}
