/* Magnet Studio M39 — system / light / dark theme.
   Loaded last so the dark palette remains coherent across public pages,
   Studio, Account, commerce, Admin and Operations without touching logic. */
:root{--m39-bg:#f4f6fb;--m39-bg-2:#edf1f8;--m39-panel:rgba(255,255,255,.92);--m39-panel-strong:#fff;--m39-soft:#f5f7fc;--m39-line:rgba(29,44,88,.11);--m39-text:#111b39;--m39-copy:#667087;--m39-muted:#8a94a8;--m39-shadow:0 24px 68px rgba(28,42,82,.11);--m39-blue:#5f78ff;--m39-violet:#8b62ff;--m39-pink:#ed55b5;--m39-green:#38c99a}
html[data-theme='dark']{--m37-ink:#f4f7ff;--m37-copy:#aab7d0;--m37-line:rgba(164,181,225,.13);--m37-line-strong:rgba(116,142,255,.29);--m37-surface:rgba(18,24,44,.92);--m37-shadow:0 24px 72px rgba(0,0,0,.31);--m37-shadow-raised:0 32px 88px rgba(0,0,0,.4);--m37-focus:0 0 0 4px rgba(100,126,255,.25);--m39-bg:#090d1a;--m39-bg-2:#0e1426;--m39-panel:rgba(17,23,43,.89);--m39-panel-strong:#151c32;--m39-soft:#11182b;--m39-line:rgba(159,178,224,.14);--m39-text:#f4f7ff;--m39-copy:#aebbd3;--m39-muted:#7f8ba6;--m39-shadow:0 26px 78px rgba(0,0,0,.34);--m39-blue:#7c92ff;--m39-violet:#a47aff;--m39-pink:#ff70c4;--m39-green:#50d7aa;color-scheme:dark}
html[data-theme='dark']{background:#090d1a!important}html[data-theme='dark'] body{background:radial-gradient(circle at 14% -8%,rgba(83,103,255,.16),transparent 31%),radial-gradient(circle at 92% 2%,rgba(221,64,174,.1),transparent 27%),linear-gradient(180deg,#090d1a,#0c1222 45%,#090d1a)!important;color:var(--m39-text)}
html[data-theme='dark'] ::selection{color:#fff;background:rgba(109,132,255,.4)}
html[data-theme='dark'] :where(h1,h2,h3,h4,h5,h6,strong,b){color:var(--m39-text)}
html[data-theme='dark'] :where(p,li,dd,small,em,label){color:var(--m39-copy)}
html[data-theme='dark'] :where(hr){border-color:var(--m39-line)}

/* Theme switch */
.m39-theme-switch{display:inline-flex;align-items:center;gap:3px;padding:4px;border:1px solid rgba(38,54,102,.11);border-radius:14px;background:rgba(246,248,253,.88);box-shadow:inset 0 1px 0 rgba(255,255,255,.85);backdrop-filter:blur(18px) saturate(145%)}
.m39-theme-switch button{display:grid;place-items:center;min-width:31px;height:31px;padding:0 7px;border:0;border-radius:10px;background:transparent;color:#78849b;cursor:pointer;transition:transform .2s ease,background .2s ease,color .2s ease,box-shadow .2s ease}.m39-theme-switch button svg{width:16px;height:16px}.m39-theme-switch button span{display:none}.m39-theme-switch button:hover{transform:translateY(-1px);color:#3158ff;background:rgba(255,255,255,.86)}.m39-theme-switch button.is-active{color:#fff;background:linear-gradient(145deg,#3158ff,#7c51f5);box-shadow:0 8px 18px rgba(49,88,255,.22)}
html[data-theme='dark'] .m39-theme-switch{border-color:rgba(157,176,226,.15);background:rgba(10,15,29,.74);box-shadow:inset 0 1px 0 rgba(255,255,255,.055),0 12px 28px rgba(0,0,0,.2)}html[data-theme='dark'] .m39-theme-switch button{color:#8995ad}html[data-theme='dark'] .m39-theme-switch button:hover{color:#d9e0ff;background:rgba(112,132,255,.12)}html[data-theme='dark'] .m39-theme-switch button.is-active{color:#fff;background:linear-gradient(145deg,#607cff,#9a6cff 68%,#e45aae);box-shadow:0 9px 22px rgba(80,102,255,.28)}

/* Shared public shell */
html[data-theme='dark'] :where(.ms-app,.m16-home,.m17-page,.m23-account-shell,.m25-commerce-shell,.m27-admin-shell,.m30-operations){background:transparent!important;color:var(--m39-text)}
html[data-theme='dark'] .ms-topbar{color:#cbd4ec;background:linear-gradient(90deg,#111a36,#1a1740 55%,#32152f);border-color:rgba(255,255,255,.06)}
html[data-theme='dark'] .ms-header,html[data-theme='dark'] body:has(.m16-home) .ms-header,html[data-theme='dark'] body:has(.m17-page) .ms-header,html[data-theme='dark'] body:has(.m23-account-shell) .ms-header,html[data-theme='dark'] body:has(.m25-commerce-shell) .ms-header,html[data-theme='dark'] body:has(.m30-operations) .ms-header{border-color:rgba(164,182,229,.12)!important;background:linear-gradient(112deg,rgba(17,23,43,.94),rgba(12,18,34,.88))!important;box-shadow:0 18px 54px rgba(0,0,0,.32),inset 0 1px 0 rgba(255,255,255,.055)!important}
html[data-theme='dark'] .ms-header.is-m37-scrolled{background:rgba(12,18,34,.88)!important;box-shadow:0 22px 62px rgba(0,0,0,.42)!important}
html[data-theme='dark'] :where(.ms-nav a,.ms-account-link,.ms-cart-link,.ms-menu){color:#c4cee4}html[data-theme='dark'] :where(.ms-nav a:hover,.ms-nav a.is-active,.ms-nav a[aria-current='page'],.ms-account-link:hover,.ms-cart-link:hover){color:#fff;background:rgba(115,137,255,.1)}
html[data-theme='dark'] .ms-mobile-nav{border-color:var(--m39-line);background:rgba(12,18,34,.97);box-shadow:0 24px 70px rgba(0,0,0,.42)}html[data-theme='dark'] .ms-mobile-nav a{color:#d7def0;border-color:var(--m39-line)}
html[data-theme='dark'] .ms-footer{border-color:var(--m39-line);background:linear-gradient(180deg,#0d1325,#090d1a);color:var(--m39-copy)}

/* Public landing and content surfaces */
html[data-theme='dark'] .m16-home .m16-hero,html[data-theme='dark'] .m17-page .m17-hero,html[data-theme='dark'] .m23-account-shell .m23-account-hero,html[data-theme='dark'] .m25-commerce-shell .m25-confirmation-hero{border-color:rgba(153,174,226,.15)!important;background:radial-gradient(circle at 8% 5%,rgba(86,108,255,.23),transparent 30%),radial-gradient(circle at 92% 5%,rgba(232,73,180,.16),transparent 27%),linear-gradient(145deg,#151d36,#10172a 68%,#171127)!important;box-shadow:0 38px 104px rgba(0,0,0,.4),inset 0 1px 0 rgba(255,255,255,.06)!important}
html[data-theme='dark'] .m16-home .m16-final,html[data-theme='dark'] .m17-page .m17-final,html[data-theme='dark'] .m30-operations .m30-hero{border-color:rgba(153,174,226,.14)!important;background:radial-gradient(circle at 91% 14%,rgba(141,96,255,.2),transparent 31%),radial-gradient(circle at 8% 90%,rgba(52,103,255,.12),transparent 28%),linear-gradient(135deg,#151d35,#101628 65%,#1c1026)!important;box-shadow:0 28px 82px rgba(0,0,0,.34)!important}
html[data-theme='dark'] :where(.m16-home,.m17-page) :where(.m16-trust,.m16-products__grid article,.m16-smartcut__flow,.m16-smartcut__steps article,.m16-production,.m16-production__points article,.m16-sheet-story,.m16-sheet-facts article,.m16-studio-story,.m17-product-row,.m17-process__list article,.m17-price-includes article,.m17-help-topics article,.m17-b2b-benefits article,.m17-b2b-uses article,.m17-faq details,.m17-calculator__controls,.m17-calculator__summary,.m17-dark-story,.m17-deep-dive,.m17-proof-story,.m17-volume,.m17-photo-guide,.m17-support-human,.m17-b2b-workspace,.m17-b2b-volume,.m18-rail){border-color:rgba(156,176,226,.13)!important;background:linear-gradient(145deg,rgba(20,27,49,.94),rgba(14,20,37,.9))!important;box-shadow:var(--m39-shadow)!important}
html[data-theme='dark'] :where(.m16-home,.m17-page) :where(.m16-products__grid article,.m16-smartcut__steps article,.m16-production__points article,.m16-sheet-facts article,.m17-product-row,.m17-process__list article,.m17-price-includes article,.m17-help-topics article,.m17-b2b-benefits article,.m17-b2b-uses article):hover{border-color:rgba(120,146,255,.28)!important;box-shadow:0 28px 72px rgba(0,0,0,.42),0 0 0 1px rgba(112,136,255,.07)!important}
html[data-theme='dark'] .m17-page .m17-faq details[open]{border-color:rgba(116,143,255,.28)!important;background:linear-gradient(145deg,#171f38,#11182b)!important}html[data-theme='dark'] .m17-page .m17-faq details[open] summary{color:#aebcff;background:rgba(104,127,255,.08)!important}
html[data-theme='dark'] :where(.m16-home,.m17-page) :where(.m16-hero__copy>p,.m16-section-head>p,.m16-production__copy>p,.m16-sheet-story__copy>p,.m16-studio-story__copy>p,.m17-hero__copy>p,.m17-section-head>p,.m17-product-row__copy>p,.m17-process__copy>p,.m17-deep-dive__copy>p,.m17-proof-story__copy>p,.m17-volume>div:first-child>p,.m17-photo-guide__copy>p,.m17-support-human>div:first-child>p,.m17-b2b-workspace__copy>p,.m17-b2b-volume>div:first-child>p){color:var(--m39-copy)!important}
html[data-theme='dark'] :where(.m16-kicker,.m17-kicker,.m23-kicker,.m30-kicker){border-color:rgba(112,138,255,.2);background:rgba(89,110,255,.1);color:#b5c1ff}
html[data-theme='dark'] :where(.m16-photo-card,.m17-visual-card,.m17-photo-guide__visual,.m16-hero__visual){border-color:rgba(158,178,226,.13);background:#0d1427}

/* Account, commerce and payment */
html[data-theme='dark'] .m23-account-shell :where(.m23-account-nav,.m23-panel,.m23-profile-card,.m23-device-card,.m23-security-card,.m23-project-card,.m23-proof-overview,.m23-order-list article,.m23-proof-list article,.m23-account-roadmap article,.m23-empty,.m23-loading),html[data-theme='dark'] .m25-commerce-shell :where(.m25-steps,.m25-cart-item,.m25-form-card,.m25-summary-card,.m25-order-detail-card,.m25-order-timeline-card,.m25-empty-commerce,.m25-checkout-summary,.m26-payment-panel){border-color:rgba(158,177,226,.13)!important;background:linear-gradient(145deg,rgba(20,27,49,.95),rgba(14,20,37,.92))!important;box-shadow:var(--m39-shadow)!important}
html[data-theme='dark'] .m23-account-shell .m23-account-nav{backdrop-filter:blur(22px) saturate(130%)}
html[data-theme='dark'] :where(.m23-account-shell,.m25-commerce-shell) :where(.m23-account-nav button,.m23-account-nav a,.m25-steps button,.m25-shipping-choices label,.m25-payment-preview){color:#cbd4e9;border-color:var(--m39-line);background:rgba(11,17,32,.48)}
html[data-theme='dark'] :where(.m23-account-shell,.m25-commerce-shell) :where(.is-active,.is-selected){border-color:rgba(116,142,255,.3)!important;background:linear-gradient(145deg,rgba(91,111,255,.18),rgba(148,91,255,.12))!important}
html[data-theme='dark'] .m25-commerce-shell :where(.m25-safe-note,.m25-legal-note,.m26-payment-trust){border-color:rgba(65,207,160,.2)!important;background:linear-gradient(145deg,rgba(28,82,67,.23),rgba(14,33,32,.66))!important}
html[data-theme='dark'] .m26-test-note{border-color:rgba(255,190,92,.18);background:rgba(128,75,16,.18);color:#ffd79b}

/* Forms and generic controls */
html[data-theme='dark'] :where(.m23-account-shell,.m25-commerce-shell,.m2-studio-app,.m27-admin-shell,.m30-operations,.m17-page) :where(input,select,textarea){color:#eef2ff!important;border-color:rgba(159,178,224,.15)!important;background:#0f1629!important;box-shadow:inset 0 1px 0 rgba(255,255,255,.025)}
html[data-theme='dark'] :where(input,select,textarea)::placeholder{color:#68758f}html[data-theme='dark'] :where(input,select,textarea):focus{border-color:rgba(116,143,255,.5)!important;background:#121a30!important}
html[data-theme='dark'] :where(.m23-secondary,.m25-secondary,.m2-secondary-button,.m27-save-secondary,.m30-hero__actions button){color:#dfe6f8!important;border-color:rgba(159,178,224,.16)!important;background:rgba(17,24,44,.94)!important}
html[data-theme='dark'] :where(.m23-secondary,.m25-secondary,.m2-secondary-button,.m27-save-secondary,.m30-hero__actions button):hover{border-color:rgba(121,147,255,.3)!important;background:#18213b!important}

/* Studio — dark chrome, luminous colour-accurate workbench */
html[data-theme='dark'] .m2-studio-app{background:radial-gradient(circle at 13% -4%,rgba(76,98,255,.2),transparent 29%),radial-gradient(circle at 91% 0,rgba(225,67,176,.12),transparent 26%),linear-gradient(180deg,#090d1a,#0d1426 58%,#090d1a)!important;color:var(--m39-text)}
html[data-theme='dark'] .m2-studio-app .m2-site-header{border-bottom-color:rgba(157,176,225,.12)!important;background:rgba(10,15,29,.9)!important;box-shadow:0 16px 50px rgba(0,0,0,.38)!important;backdrop-filter:blur(22px) saturate(135%)}
html[data-theme='dark'] .m2-studio-app .m2-site-header.is-m37-scrolled{background:rgba(10,15,29,.84)!important;box-shadow:0 20px 62px rgba(0,0,0,.46)!important}
html[data-theme='dark'] .m2-studio-app :where(.m2-site-header nav a,.m2-header-link,.m2-header-cart,.m2-brand){color:#d5ddef}
html[data-theme='dark'] .m2-studio-app :where(.m2-project-bar,.m2-tool-rail,.m2-canvas-panel,.m2-inspector){border-color:rgba(158,178,226,.13)!important;background:linear-gradient(145deg,rgba(18,25,46,.96),rgba(12,18,34,.94))!important;box-shadow:0 26px 78px rgba(0,0,0,.34)!important}
html[data-theme='dark'] .m2-studio-app .m2-editor-grid{background:linear-gradient(145deg,#0c1221,#11182b)!important}
html[data-theme='dark'] .m2-studio-app .m2-stage{border-color:rgba(155,174,219,.14)!important;background:radial-gradient(circle at 50% 45%,rgba(56,70,111,.22),transparent 48%),linear-gradient(145deg,#10172a,#0c1324)!important;box-shadow:inset 0 1px 0 rgba(255,255,255,.035),inset 0 0 0 1px rgba(117,137,192,.025)!important}
html[data-theme='dark'] .m2-studio-app .m2-canvas-footer{color:#98a5bf;border-color:var(--m39-line)}
html[data-theme='dark'] .m2-studio-app :where(.m2-tool-rail button,.m2-mode-list button,.m6-cut-presets button,.m3-tool-grid button,.m7-art-presets button,.m7-layout-switch button,.m2-segmented button,.m3-preset-row button,.m2-quantity button){color:#cbd4e7;border-color:rgba(159,178,224,.13)!important;background:rgba(11,17,32,.68)!important}
html[data-theme='dark'] .m2-studio-app :where(.m2-tool-rail button.is-active,.m2-mode-list button.is-selected,.m6-cut-presets button.is-selected,.m3-tool-grid button.is-selected,.m7-art-presets button.is-selected,.m7-layout-switch button.is-selected,.m2-segmented button.is-selected,.m3-preset-row button.is-selected){color:#fff!important;border-color:rgba(123,147,255,.34)!important;background:linear-gradient(145deg,rgba(76,101,255,.27),rgba(143,91,255,.17))!important;box-shadow:0 13px 30px rgba(0,0,0,.26),inset 0 1px 0 rgba(255,255,255,.055)!important}
html[data-theme='dark'] .m2-studio-app :where(.m2-panel-heading,.m2-project-bar,.m2-file-card,.m2-process-state,.m5-mask-edit-card,.m6-cut-compare,.m7-quality-card,.m2-proof-note,.m2-order-summary,.m3-upload-tip,.m36-manual-hint,.m39-upscale-entry){border-color:rgba(157,176,225,.13)!important}
html[data-theme='dark'] .m2-studio-app :where(.m2-file-card,.m2-process-state,.m5-mask-edit-card,.m6-cut-compare,.m7-quality-card,.m2-proof-note,.m2-order-summary,.m3-upload-tip,.m36-manual-hint,.m39-upscale-entry){background:linear-gradient(145deg,rgba(21,29,52,.94),rgba(14,20,37,.91))!important;box-shadow:0 16px 42px rgba(0,0,0,.24)!important}
html[data-theme='dark'] .m2-studio-app .m2-dropzone{color:#bdc8df;border-color:rgba(120,145,255,.27)!important;background:linear-gradient(145deg,rgba(64,83,160,.11),rgba(17,24,44,.58))!important}
html[data-theme='dark'] .m2-studio-app .m2-panel-heading{border-bottom-color:var(--m39-line)!important}html[data-theme='dark'] .m2-studio-app .m2-range input[type='range']{accent-color:#8094ff}
html[data-theme='dark'] .m2-studio-app .m3-step-nav{border-color:var(--m39-line);background:rgba(10,16,30,.82)}html[data-theme='dark'] .m2-studio-app .m3-step-nav button{color:#cbd4e8}

/* Safe Upscale in dark */
html[data-theme='dark'] .m38-upscale{color:var(--m39-text);border-color:rgba(135,158,255,.2);background:radial-gradient(circle at 94% 2%,rgba(144,93,255,.23),transparent 31%),linear-gradient(145deg,#171f39,#11182c 66%,#171129);box-shadow:0 24px 70px rgba(0,0,0,.34),inset 0 1px 0 rgba(255,255,255,.05)}
html[data-theme='dark'] .m38-upscale__head p,html[data-theme='dark'] .m38-upscale__modes small,html[data-theme='dark'] .m38-upscale__facts small,html[data-theme='dark'] .m38-upscale__result p,html[data-theme='dark'] .m39-upscale-entry p{color:var(--m39-copy)}
html[data-theme='dark'] .m38-upscale :where(.m38-upscale__quality article,.m38-upscale__modes button,.m38-upscale__scales button,.m38-upscale__facts span,.m38-upscale__result,.m38-upscale__actions .is-secondary),html[data-theme='dark'] .m39-upscale-entry button{color:#dce4f7;border-color:rgba(158,178,226,.14);background:rgba(10,16,30,.68)}
html[data-theme='dark'] .m38-upscale__quality article.is-ready,html[data-theme='dark'] .m38-upscale__result{background:rgba(25,91,73,.23)!important;border-color:rgba(75,213,169,.2)!important}html[data-theme='dark'] .m38-upscale__quality article.is-good{background:rgba(67,83,172,.18)!important}html[data-theme='dark'] .m38-upscale__quality article.is-warning{background:rgba(124,78,23,.2)!important}
html[data-theme='dark'] .m38-upscale__modes button.is-selected{background:linear-gradient(145deg,rgba(77,102,255,.26),rgba(143,91,255,.16));border-color:rgba(125,149,255,.35)}html[data-theme='dark'] .m38-upscale__progress{border-color:rgba(117,143,255,.22);background:rgba(49,64,129,.18)}html[data-theme='dark'] .m38-upscale__warning{background:rgba(128,80,20,.2);color:#ffdaa2}html[data-theme='dark'] .m38-upscale__warning.is-error{background:rgba(126,41,55,.24);color:#ffb9c3}

/* Admin and operations */
html[data-theme='dark'] .m27-admin-shell{background:radial-gradient(circle at 3% 0,rgba(75,98,255,.18),transparent 27%),linear-gradient(180deg,#090d1a,#0c1222)!important}
html[data-theme='dark'] .m27-admin-shell :where(.m27-sidebar,.m27-topbar,.m27-kpi,.m27-queue-card,.m27-detail,.m27-detail-section,.m27-project-card,.m27-production-control,.m27-production-evidence),html[data-theme='dark'] .m30-operations :where(.m30-hero,.m30-panel,.m30-check-card,.m30-count-card){border-color:rgba(158,178,226,.13)!important;background:linear-gradient(145deg,rgba(20,27,49,.96),rgba(14,20,37,.93))!important;box-shadow:var(--m39-shadow)!important}
html[data-theme='dark'] .m27-admin-shell .m27-topbar{background:rgba(10,16,30,.88)!important;backdrop-filter:blur(22px) saturate(130%)}html[data-theme='dark'] .m27-admin-shell .m27-order-row{color:#d5deef;border-color:var(--m39-line);background:rgba(10,16,30,.55)}html[data-theme='dark'] .m27-admin-shell .m27-order-row.is-selected{border-color:rgba(118,145,255,.32)!important;background:linear-gradient(110deg,rgba(72,94,218,.24),rgba(129,66,145,.17))!important}
html[data-theme='dark'] .m27-admin-shell .m27-production-control.is-ready{border-color:rgba(76,215,170,.24)!important;background:radial-gradient(circle at 100% 0,rgba(49,202,152,.16),transparent 32%),linear-gradient(145deg,#142c2c,#111b2b)!important}
html[data-theme='dark'] .m30-check-card.is-deferred{border-color:rgba(255,186,86,.18)!important;background:rgba(91,59,18,.2)!important}

@media(max-width:780px){.m39-theme-switch{padding:3px;border-radius:12px}.m39-theme-switch button{min-width:29px;height:29px;padding:0 6px}.m39-theme-switch button:hover{transform:none}html[data-theme='dark'] .m2-studio-app .m2-site-header{background:rgba(10,15,29,.94)!important}html[data-theme='dark'] body:has(.m16-home) .ms-header,html[data-theme='dark'] body:has(.m17-page) .ms-header,html[data-theme='dark'] body:has(.m23-account-shell) .ms-header,html[data-theme='dark'] body:has(.m25-commerce-shell) .ms-header,html[data-theme='dark'] body:has(.m30-operations) .ms-header{background:rgba(11,17,32,.94)!important}}
@media(prefers-reduced-motion:reduce){.m39-theme-switch *{transition:none!important}}
