/* Magnet Studio M41 — final dark contrast, active navigation and remaining light panels.
   Screenshot-driven follow-up to M40. Loaded last. */

html[data-theme='dark']{
  --m41-surface:#111a2f;
  --m41-surface-2:#0d1528;
  --m41-surface-3:#18233e;
  --m41-line:rgba(160,181,232,.19);
  --m41-line-strong:rgba(132,155,255,.43);
  --m41-text:#f6f8ff;
  --m41-copy:#b7c2d8;
  --m41-muted:#8996b0;
  --m41-blue:#91a3ff;
  --m41-green:#65e0b7;
}

/* --------------------------------------------------------------------------
   Global header and footer contrast
   -------------------------------------------------------------------------- */
html[data-theme='dark'] body :where(.ms-nav a,.ms-account-link,.ms-cart-link){
  color:#d7e0f2!important;
}
html[data-theme='dark'] body .ms-nav a:is(.is-active,[aria-current='page']){
  color:#fff!important;
  background:linear-gradient(145deg,rgba(76,101,255,.24),rgba(156,86,255,.15))!important;
  box-shadow:inset 0 0 0 1px rgba(137,158,255,.18),0 8px 22px rgba(0,0,0,.2)!important;
  text-shadow:0 1px 12px rgba(145,161,255,.3);
}
html[data-theme='dark'] body .ms-nav a:is(.is-active,[aria-current='page'])::after,
html[data-theme='dark'] body .ms-nav a:is(.is-active,[aria-current='page'])::before{
  opacity:1!important;
}
html[data-theme='dark'] body:has(.m23-account-shell) .ms-account-link,
html[data-theme='dark'] body .ms-account-link[aria-current='page']{
  color:#fff!important;
  border-color:var(--m41-line-strong)!important;
  background:linear-gradient(145deg,rgba(76,101,255,.3),rgba(157,84,255,.19))!important;
  box-shadow:0 10px 25px rgba(0,0,0,.22)!important;
}
html[data-theme='dark'] body :where(.ms-cart-link,.ms-account-link){
  border-color:var(--m41-line)!important;
  background:#111a2f!important;
}
html[data-theme='dark'] body :where(.ms-cart-link.is-disabled,.ms-cart-link[aria-disabled='true'],.ms-cart-link:disabled){
  color:#8b98b2!important;
  background:#111827!important;
  opacity:1!important;
}
html[data-theme='dark'] .ms-footer{
  color:#d8e0f2!important;
  border-top-color:var(--m41-line)!important;
}
html[data-theme='dark'] .ms-footer :where(.ms-brand,.ms-brand b,.ms-brand small,h3,b,a){color:#e8edfa!important}
html[data-theme='dark'] .ms-footer :where(p,small,span:not(.ms-brand):not(.ms-brand *)){color:#8f9bb4!important}
html[data-theme='dark'] .ms-footer a:hover{color:#fff!important}

/* --------------------------------------------------------------------------
   Public pages — exact screenshot fixes
   -------------------------------------------------------------------------- */
html[data-theme='dark'] .m17-page .m17-link{
  color:#dfe6ff!important;
  text-decoration:none!important;
}
html[data-theme='dark'] .m17-page .m17-link svg{color:#91a4ff!important}
html[data-theme='dark'] .m17-product-row__copy>.m17-link{
  min-height:38px;
  padding:8px 12px;
  border:1px solid var(--m41-line)!important;
  border-radius:999px;
  background:#10192d!important;
  box-shadow:0 8px 20px rgba(0,0,0,.2);
}
html[data-theme='dark'] .m17-product-row__copy>.m17-link:hover{
  color:#fff!important;
  border-color:var(--m41-line-strong)!important;
  background:linear-gradient(145deg,rgba(73,99,255,.25),rgba(146,82,255,.14))!important;
}

/* Products comparison table: every row is a direct div, not an article. */
html[data-theme='dark'] .m17-compare__table{
  overflow:hidden;
  border:1px solid var(--m41-line)!important;
  background:#0d1528!important;
  box-shadow:0 22px 54px rgba(0,0,0,.28)!important;
}
html[data-theme='dark'] .m17-compare__table>div{
  color:#dce4f6!important;
  border-color:var(--m41-line)!important;
  background:#111a2f!important;
}
html[data-theme='dark'] .m17-compare__table>div:nth-child(even){background:#16213a!important}
html[data-theme='dark'] .m17-compare__table>div.is-head{
  color:#aebbd3!important;
  background:#1b2743!important;
}
html[data-theme='dark'] .m17-compare__table>div>span{
  color:inherit!important;
  border-color:var(--m41-line)!important;
}
html[data-theme='dark'] .m17-compare__table>div>span:first-child{color:#f3f6ff!important;font-weight:780}
html[data-theme='dark'] .m17-compare__table svg{color:var(--m41-green)!important}

/* Pricing controls: remove white cards and restore labels. */
html[data-theme='dark'] .m17-calculator__controls .m17-control{
  color:var(--m41-text)!important;
  border:1px solid var(--m41-line)!important;
  border-radius:18px;
  background:#0d1528!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.025)!important;
}
html[data-theme='dark'] .m17-calculator__controls .m17-control>b{
  color:#c8d2e7!important;
}
html[data-theme='dark'] .m17-calculator__controls .m17-control>div{background:transparent!important}
html[data-theme='dark'] .m17-calculator__controls .m17-control button{
  color:#dfe6f7!important;
  border-color:var(--m41-line)!important;
  background:#111a2f!important;
}
html[data-theme='dark'] .m17-calculator__controls .m17-control button.is-selected{
  color:#fff!important;
  border-color:rgba(155,174,255,.5)!important;
  background:linear-gradient(135deg,#6079f5,#8d68ef 66%,#c95ba3)!important;
  box-shadow:0 10px 24px rgba(50,63,173,.28)!important;
}

/* Support photo checklist and proof action. */
html[data-theme='dark'] .m17-photo-guide__copy>div>article{
  color:var(--m41-text)!important;
  border:1px solid var(--m41-line)!important;
  background:#10192d!important;
  box-shadow:0 10px 25px rgba(0,0,0,.18)!important;
}
html[data-theme='dark'] .m17-photo-guide__copy>div>article>span{
  color:#fff!important;
  background:#1d2a4a!important;
}
html[data-theme='dark'] .m17-photo-guide__copy>div>article b{color:#f4f7ff!important}
html[data-theme='dark'] .m17-photo-guide__copy>div>article small{color:#aebbd1!important}
html[data-theme='dark'] .m17-human-card button{
  color:#06271f!important;
  border:1px solid rgba(104,228,186,.48)!important;
  background:linear-gradient(135deg,#8ef0cf,#c8f6e8)!important;
  box-shadow:0 12px 28px rgba(36,191,143,.18)!important;
  font-weight:850!important;
}
html[data-theme='dark'] .m17-human-card button svg{color:#08785e!important}

/* B2B flow strip: the white surface is the nested final div. */
html[data-theme='dark'] .m17-b2b-flow>div:last-child{
  overflow:hidden;
  border:1px solid var(--m41-line)!important;
  border-radius:20px;
  background:#0d1528!important;
}
html[data-theme='dark'] .m17-b2b-flow>div:last-child>article{
  color:var(--m41-text)!important;
  border-color:var(--m41-line)!important;
  background:#111a2f!important;
}
html[data-theme='dark'] .m17-b2b-flow>div:last-child>article:nth-child(even){background:#16213a!important}
html[data-theme='dark'] .m17-b2b-flow>div:last-child>article span{color:#8ea2ff!important}
html[data-theme='dark'] .m17-b2b-flow>div:last-child>article b{color:#f4f7ff!important}
html[data-theme='dark'] .m17-b2b-flow>div:last-child>article small{color:#aab6cd!important}

/* --------------------------------------------------------------------------
   Account — active header, proof flow and small white tiles
   -------------------------------------------------------------------------- */
html[data-theme='dark'] .m23-proof-flow>span,
html[data-theme='dark'] .m23-account-roadmap>div>article{
  color:#dce4f7!important;
  border:1px solid var(--m41-line)!important;
  background:#10192d!important;
  box-shadow:none!important;
}
html[data-theme='dark'] .m23-proof-flow>span.is-done,
html[data-theme='dark'] .m23-account-roadmap>div>article.is-done{
  border-color:rgba(87,218,175,.31)!important;
  background:linear-gradient(145deg,rgba(24,88,70,.42),rgba(13,37,34,.72))!important;
}
html[data-theme='dark'] .m23-proof-flow>span :where(b,svg),
html[data-theme='dark'] .m23-account-roadmap>div>article :where(b,svg){color:#eef3ff!important}
html[data-theme='dark'] .m23-proof-flow>span small{color:#aebad0!important}
html[data-theme='dark'] .m23-proof-flow>i{background:var(--m41-line)!important}
html[data-theme='dark'] .m23-empty .m23-secondary{
  color:#eef3ff!important;
  border-color:var(--m41-line)!important;
  background:#111a2f!important;
}

/* --------------------------------------------------------------------------
   Studio — demo card, cloud action, selected tools and disabled navigation
   -------------------------------------------------------------------------- */
html[data-theme='dark'] .m2-studio-app .m7-demo-card{
  color:var(--m41-text)!important;
  border:1px solid var(--m41-line)!important;
  background:linear-gradient(145deg,#17213b,#10182c)!important;
  box-shadow:0 16px 34px rgba(0,0,0,.25)!important;
}
html[data-theme='dark'] .m2-studio-app .m7-demo-card>svg:first-child{
  color:#fff!important;
  background:linear-gradient(145deg,#536cff,#8a58ee)!important;
}
html[data-theme='dark'] .m2-studio-app .m7-demo-card b{color:#f4f7ff!important}
html[data-theme='dark'] .m2-studio-app .m7-demo-card small{color:#b2bdd3!important}
html[data-theme='dark'] .m2-studio-app .m7-demo-card>svg:last-child{color:#91a4ff!important}
html[data-theme='dark'] .m2-studio-app .m22-cloud-save{
  color:#e6ecfa!important;
  border-color:var(--m41-line)!important;
  background:#111a2f!important;
}
html[data-theme='dark'] .m2-studio-app .m22-cloud-save.is-synced{
  color:#aaf0d7!important;
  border-color:rgba(91,219,178,.3)!important;
  background:rgba(20,75,61,.36)!important;
}
html[data-theme='dark'] .m2-studio-app .m7-step-nav button:disabled{
  color:#7f8ca7!important;
  border-color:rgba(151,171,219,.11)!important;
  background:#0d1528!important;
  opacity:1!important;
}
html[data-theme='dark'] .m2-studio-app .m7-step-nav button:disabled :where(b,small,svg){color:#7f8ca7!important}
html[data-theme='dark'] .m2-studio-app .m4-preview-tabs button:is(.is-active,[aria-pressed='true']){
  color:#fff!important;
  border-color:rgba(153,173,255,.48)!important;
  background:linear-gradient(145deg,#5d73ee,#865fe7)!important;
}

/* --------------------------------------------------------------------------
   Production Admin — exact state classes used by React components
   -------------------------------------------------------------------------- */
html[data-theme='dark'] .m27-admin-shell .m27-priority-row button{
  color:#aebbd2!important;
  border-color:var(--m41-line)!important;
  background:#10192d!important;
}
html[data-theme='dark'] .m27-admin-shell .m27-priority-row button :where(b,small){color:inherit!important}
html[data-theme='dark'] .m27-admin-shell .m27-priority-row button.is-selected{
  color:#fff!important;
  border-color:rgba(139,160,255,.48)!important;
  background:linear-gradient(145deg,rgba(73,99,255,.33),rgba(145,89,255,.2))!important;
  box-shadow:0 12px 28px rgba(0,0,0,.22)!important;
}
html[data-theme='dark'] .m27-admin-shell .m27-priority-row button.is-selected.is-urgent{
  color:#ffe0ad!important;
  border-color:rgba(255,183,91,.4)!important;
  background:rgba(103,63,19,.42)!important;
}
html[data-theme='dark'] .m27-admin-shell .m27-priority-row button.is-selected.is-hold{
  color:#ffc4cb!important;
  border-color:rgba(244,109,126,.4)!important;
  background:rgba(99,33,45,.45)!important;
}
html[data-theme='dark'] .m27-admin-shell .m27-control-field>span{color:#c6d0e4!important}
html[data-theme='dark'] .m27-admin-shell .m27-checklist-head :where(b,small){color:#cfd8eb!important}
html[data-theme='dark'] .m27-admin-shell .m27-checklist-head em{
  color:#cbd5ff!important;
  background:#18233e!important;
}
html[data-theme='dark'] .m27-admin-shell .m27-production-checklist button{
  color:#b4bfd5!important;
  border-color:var(--m41-line)!important;
  background:#10192d!important;
}
html[data-theme='dark'] .m27-admin-shell .m27-production-checklist button b{color:#eef3ff!important}
html[data-theme='dark'] .m27-admin-shell .m27-production-checklist button small{color:#9eabc3!important}
html[data-theme='dark'] .m27-admin-shell .m27-production-checklist button>span{
  color:#a8b5ce!important;
  background:#1b2742!important;
}
html[data-theme='dark'] .m27-admin-shell .m27-production-checklist button.is-checked{
  border-color:rgba(90,220,177,.35)!important;
  background:linear-gradient(145deg,rgba(24,87,69,.4),rgba(12,37,33,.72))!important;
}
html[data-theme='dark'] .m27-admin-shell .m27-production-checklist button.is-checked>span{
  color:#6ce1b9!important;
  background:rgba(52,143,112,.28)!important;
}
html[data-theme='dark'] .m27-admin-shell .m27-control-message{
  color:#ffd992!important;
  background:rgba(102,65,18,.34)!important;
}
html[data-theme='dark'] .m27-admin-shell .m27-control-message.is-error{
  color:#ffb8c2!important;
  background:rgba(105,31,43,.4)!important;
}
html[data-theme='dark'] .m27-admin-shell .m27-control-message.is-success{
  color:#9ce9cf!important;
  background:rgba(20,83,66,.42)!important;
}
html[data-theme='dark'] .m27-admin-shell .m27-control-actions{
  border-top-color:var(--m41-line)!important;
}
html[data-theme='dark'] .m27-admin-shell .m27-control-actions>div small{color:#9eabc3!important}
html[data-theme='dark'] .m27-admin-shell .m27-order-row{
  color:#d9e1f2!important;
  border-color:var(--m41-line)!important;
  background:#10192d!important;
}
html[data-theme='dark'] .m27-admin-shell .m27-order-row.is-selected{
  color:#fff!important;
  border-color:var(--m41-line-strong)!important;
  background:linear-gradient(145deg,rgba(73,99,255,.28),rgba(145,89,255,.16))!important;
}
html[data-theme='dark'] .m27-admin-shell .m27-workflow-steps article{
  color:#b4bfd5!important;
  background:#10192d!important;
}
html[data-theme='dark'] .m27-admin-shell .m27-workflow-steps article.is-done,
html[data-theme='dark'] .m27-admin-shell .m27-workflow-steps article.is-current{
  color:#f3f6ff!important;
  background:#17233d!important;
}

@media(max-width:780px){
  html[data-theme='dark'] body .ms-nav a:is(.is-active,[aria-current='page']){background:rgba(77,101,255,.2)!important}
  html[data-theme='dark'] .m17-product-row__copy>.m17-link{width:max-content;max-width:100%}
  html[data-theme='dark'] .m17-compare__table>div{min-width:680px}
  html[data-theme='dark'] .m17-b2b-flow>div:last-child>article{min-height:0}
}

@media(prefers-reduced-motion:reduce){
  html[data-theme='dark'] .m17-product-row__copy>.m17-link,
  html[data-theme='dark'] .m27-admin-shell .m27-order-row{transition:none!important}
}
