/* Shared dark surfaces. Artwork, color samples and image previews keep their colors. */
html[data-theme="dark"] {
 color-scheme:dark;
 --background:#080808;--panel:#111111;--navy:#f5f5f5;--muted:#b6b6b6;--line:#393939;
 --dark-raised:#202020;--dark-hover:#2c2c2c;--dark-edge:#555555;--dark-accent:#a7c1ff;
 --blue:#a7c1ff;--purple:#d5b3ff;
 scrollbar-color:#606060 #111111;
}
html[data-theme="dark"] body,html[data-theme="dark"] .workspace,html[data-theme="dark"] .editor {background:#080808;color:var(--navy)}
html[data-theme="dark"] :is(.topbar,.sidebar,.properties,.editor-bottom,.canvas-controls,.tools,.app-menu,.language-menu,dialog,.canvas-menu,.inline-type-panel,.text-popover,.text-editor-panel,.pathfinder-panel,.analytics-consent) {
 background:#111111!important;color:var(--navy)!important;border-color:var(--line)!important;box-shadow:0 12px 36px #0006;
}
html[data-theme="dark"] :is(dialog,.properties,.sidebar,.app-menu) {scrollbar-color:#606060 #111111}
html[data-theme="dark"] dialog::backdrop {background:#000b;backdrop-filter:blur(5px)}
html[data-theme="dark"] :is(h1,h2,h3,h4,legend,label,output,kbd) {color:var(--navy)}
html[data-theme="dark"] :is(p,small,figcaption,.help,.fine,.field,.numeric-grid label,.inline-type-panel label,.saved,.sidebar-footer,.section-title,.mode-label,.history-info,.history-status,.interchange-note,.shortcut-empty,.shortcut-category-heading) {color:var(--muted)}
html[data-theme="dark"] :is(.property-section h3,.panel-heading>span,.eyebrow,.export-option strong,.panel-heading em) {color:var(--dark-accent)!important}
html[data-theme="dark"] :is(.property-section,.account-packages,.shortcut-dialog-footer,.desktop-text-handle,.divider,hr) {border-color:var(--line)}
html[data-theme="dark"] a {color:#a7c1ff}
html[data-theme="dark"] button:not(:where(.palette button,[data-color],[data-bg])) {
 background:var(--dark-raised)!important;color:var(--navy)!important;border-color:var(--dark-edge)!important;box-shadow:none;
}
html[data-theme="dark"] button:not(:where(.palette button,[data-color],[data-bg])):hover:not(:disabled) {background:var(--dark-hover)!important;border-color:#8b8b8b!important}
html[data-theme="dark"] :is(button,input,select,textarea,[tabindex]):focus-visible {outline:3px solid #adc7ff!important;outline-offset:2px}
html[data-theme="dark"] :is(input,select,textarea):not([type="color"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not(.inline-text-input) {
 background:#191919!important;color:var(--navy)!important;border-color:var(--dark-edge)!important;
}
html[data-theme="dark"] :is(input,textarea)::placeholder {color:#ababab;opacity:1}
html[data-theme="dark"] :is(select option,select optgroup) {background:#191919;color:var(--navy)}
html[data-theme="dark"] :is(input[type="checkbox"],input[type="radio"],input[type="range"],progress) {accent-color:#9bbaff;color-scheme:dark}
html[data-theme="dark"] :is(button:disabled,input:disabled,select:disabled) {opacity:1!important;color:#999!important;background:#171717!important;border-color:#393939!important;cursor:not-allowed;box-shadow:none!important}
/* Active states are visible on touchscreens without relying on hover. */
html[data-theme="dark"] :is(button.primary,button.active,button[aria-pressed="true"],button[aria-selected="true"],button[aria-current="page"],.shortcut-catalog button.candidate,#mobileProperties,#exportBtn,.analytics-consent [data-yes],.confirm-primary) {
 background:#294ba8!important;color:#fff!important;border-color:#96b5ff!important;
}
html[data-theme="dark"] :is(button.primary,button.active,button[aria-pressed="true"],button[aria-selected="true"],.confirm-primary):hover:not(:disabled) {background:#345bc2!important}
html[data-theme="dark"] :is(.tools button.active,.smart-guides-toggle.active) {box-shadow:inset 0 0 0 1px #96b5ff!important}
html[data-theme="dark"] :is(.tool-category-tabs,.tool-categories,.tool-tabs,.shortcut-categories,.mobile-text-actions) {background:#111111!important;color:var(--navy)!important;border-color:var(--line)!important}
html[data-theme="dark"] .tool-category-tabs button.active {background:#294ba8!important;border-color:#96b5ff!important}
html[data-theme="dark"] :is(.wallet-summary,.menu-wallet,.auth-tabs,.upload-card,.project-card,.credit-topups,.color-row,.png-quality,.export-preview-settings,.enhance-quota,.enhance-loading,.enhance-packs,.subscription-choice,.history-preview,.history-item-icon,.dialog-icon,.recovery-codes,.account-packages article) {
 background:#1b1b1b!important;color:var(--navy)!important;border-color:var(--line)!important;
}
html[data-theme="dark"] :is(.wallet-summary,.menu-wallet,.project-card,.credit-topups,.account-packages article) :is(p,small,span) {color:var(--muted)}
html[data-theme="dark"] :is(.color-row label,.color-row+.palette+.field-row label,.paint-targets,.field-row label) {color:var(--navy)!important}
html[data-theme="dark"] .color-row+.palette+.field-row label {background:#1b1b1b;border-color:#555}
/* Do not turn the palette into six identical gray buttons. */
html[data-theme="dark"] .palette button {background:var(--color)!important;border:3px solid #111!important;outline:1px solid #888;box-shadow:none}
html[data-theme="dark"] .palette button:hover {outline:2px solid #c3d5ff}
html[data-theme="dark"] input[type="color"] {color-scheme:dark;background:#202020!important;border:1px solid #777!important;padding:4px}
html[data-theme="dark"] .hue-wheel:before {background:#111}
html[data-theme="dark"] :is(.color-cursor,.hue-cursor) {border-color:#fff;box-shadow:0 0 0 1px #111}
/* Canvas background preferences are independent of UI theme and export colors. */
html[data-theme="dark"] #canvasHost {border-color:#393939;color:#d2d2d2}
html[data-theme="dark"] #canvasHost:not(.bg-light):not(.bg-dark):not([style*="background"]) {background-color:#181818;background-image:radial-gradient(#414141 1px,transparent 1px)}
html[data-theme="dark"] #canvasHost.bg-light {background:#fff;color:#172851}
html[data-theme="dark"] #canvasHost.bg-dark {background:#080808;background-image:none}
html[data-theme="dark"] .backgrounds button {background:#202020;color:var(--navy);border-color:#555}
html[data-theme="dark"] .backgrounds button.active {background:#294ba8;color:white;border-color:#96b5ff}
html[data-theme="dark"] .canvas-upload-prompt button {background:#202020!important;color:#bed0ff!important;border-color:#697b9e!important}
html[data-theme="dark"] .inline-text-editor:not(.mobile-text-entry) {color-scheme:light;background:white!important;color:#172851!important}
html[data-theme="dark"] .mobile-text-sheet .mobile-text-entry {background:#191919!important;color:#f5f5f5!important;outline-color:#777}
html[data-theme="dark"] .website-brand img {filter:brightness(0) invert(1)}
html[data-theme="dark"] :is(.layer.selected,.layer.selected button) {background:#20345f!important;color:#dbe7ff!important;border-color:#7c9ee9!important}
html[data-theme="dark"] :is(.layer span:last-child,.canvas-menu kbd) {color:#b6b6b6}
html[data-theme="dark"] #appMenu #accountBtn {background:#143b2b!important;color:#bcf1d5!important;border-color:#39765a!important}
html[data-theme="dark"] #appMenu #logoutBtn {background:transparent!important;color:#ffadb3!important;border-color:#393939!important}
html[data-theme="dark"] #signedInPanel #securityBtn {background:#202c47!important;color:#d8e4ff!important;border-color:#677ca9!important}
html[data-theme="dark"] :is(.security-qr,[data-qr] canvas,[data-qr] img) {color-scheme:light;background:#fff!important}
html[data-theme="dark"] :is(.account-packages article[data-status="expired"],.account-packages article[data-status="revoked"]) {background:#181818!important;color:#b6b6b6!important;border-style:dashed}
/* Every plan keeps its accent while the card itself is neutral black. */
html[data-theme="dark"] #plansDialog .modern-plans>article {background:#191919!important;color:var(--navy);border-color:color-mix(in srgb,var(--plan-accent) 55%,#777)!important;box-shadow:none}
html[data-theme="dark"] #plansDialog .modern-plans>article>span:not(.mini-banner):not(.mini-discount-ribbon),html[data-theme="dark"] #plansDialog .plan-allowance-simple>strong {color:color-mix(in srgb,var(--plan-accent) 40%,white)!important}
html[data-theme="dark"] #plansDialog :is(h3,.topup-price,.topup-card>strong,.enhance-catalog article>b) {color:var(--navy)}
html[data-theme="dark"] #plansDialog :is(li,p,small,del,#oneTimeExpiryNote,.plus-price-status) {color:#c2c2c2}
html[data-theme="dark"] #plansDialog .modern-plans li::before {background:#303030;color:color-mix(in srgb,var(--plan-accent) 40%,white)}
html[data-theme="dark"] #plansDialog .modern-plans article>button {background:#294ba8!important;color:#fff!important;border:1px solid #96b5ff}
html[data-theme="dark"] #plansDialog :is(.topup-card,.enhance-catalog article) {background:#191919!important;border-color:#454545!important;color:var(--navy)}
html[data-theme="dark"] #plansDialog :is(#miniPlanCard,#miniPlusPlanCard).halloween-deal {background:radial-gradient(ellipse at 100% 0,#69401a45,transparent 60%),#191919!important;border-color:#987341!important}
html[data-theme="dark"] #plansDialog .mini-banner {background:#ffdda2!important;color:#50320b!important}
html[data-theme="dark"] #plansDialog .halloween-deal-label {background:#382615;color:#ffd39b!important;border-color:#987341}
html[data-theme="dark"] #plansDialog .modern-plans .mini-plan>button {background:#ad641b!important;color:white!important;border-color:#edbf7e}
html[data-theme="dark"] #miniWelcomeOffer.halloween-deal {background:radial-gradient(ellipse at 50% 0,#69401a55,transparent 65%),#111!important}
html[data-theme="dark"] #miniWelcomeOffer.halloween-deal :is(p,del) {color:#d4c6b7}
html[data-theme="dark"] #miniWelcomeOffer.halloween-deal .welcome-action {background:#ffb34b!important;color:#27180a!important;border-color:#ffcc84!important}
/* Messages retain meaningful status colors, with readable text. */
html[data-theme="dark"] #toast.toast {background:#1c293f;color:#dce8ff;border-color:#657da4}
html[data-theme="dark"] #toast.toast[data-type="error"],html[data-theme="dark"] .inline-type-panel .text-overflow-note {background:#3c1c22;color:#ffd2d8;border-color:#a76370}
html[data-theme="dark"] #toast.toast .toast-close {background:transparent!important;color:inherit!important}
html[data-theme="dark"] #registrationVerification {background:#173629;color:#c3f2d8;border-color:#4a8d6b}
html[data-theme="dark"] :is(.enhance-button,.enhance-actions [data-start],.enhance-actions [data-apply]) {background:#146448!important;color:#fff!important;border-color:#7bcab0!important}
html[data-theme="dark"] :is(.premium-tag,.free-tag) {background:#302343;color:#e6d0ff;border-color:#80669d}
html[data-theme="dark"] :is(.free-tag) {background:#173629;color:#c3f2d8;border-color:#4a8d6b}
html[data-theme="dark"] :is(.enhance-source,.action-confirm .confirm-image-preview) {background:#1b1b1b;border-color:#555}
html[data-theme="dark"] :is(.enhance-source figcaption,.action-confirm .confirm-image-preview figcaption) {color:#b6b6b6}
/* A preview is a rendering surface, not UI chrome. Never invert its artwork. */
html[data-theme="dark"] :is(.history-preview img,.vector-import-dialog img,.enhance-preview img,.enhance-source img,.project-card img,.export-preview-image) {color-scheme:light}
@media(max-width:1100px){.theme-toggle{display:none!important}#appMenu #themeMenuBtn:not([hidden]){display:flex!important;align-items:center;gap:12px;min-height:48px}}
@media(min-width:1101px){#appMenu #themeMenuBtn{display:none!important}}
/* Compact status surfaces must use the same contrast as the rest of the header. */
html[data-theme="dark"] :is(.balance,.upload-icon,.price-card,.enhance-demo,.enhance-catalog,.quality-spark,.quality-notice [data-size]) {background:#202020!important;color:#dce7ff!important;border-color:#5e5e5e!important}
html[data-theme="dark"] .balance :is(b,span) {color:#f0d18a!important}
html[data-theme="dark"] :is(.price-card p,.price-card small,.enhance-demo-caption,.enhance-catalog p,.enhance-quota span) {color:#c2c2c2}
html[data-theme="dark"] :is(button,input,select,textarea):disabled,html[data-theme="dark"] #plansDialog .modern-plans article>button:disabled {background:#171717!important;color:#999!important;border-color:#393939!important;box-shadow:none!important}
#themeMenuBtn svg{display:block;width:22px;height:22px;flex:0 0 22px}
html[data-theme="dark"] .properties-heading {background:#111111!important;color:var(--navy)!important;border-color:var(--line)!important}
html[data-theme="dark"] .two-factor-dialog [data-note] {color:#ffc5ac}
html[data-theme="dark"] .conversion-action #vectorizeBtn {background:#7040a8!important;color:white!important;border-color:#bc9ce5!important}
html[data-theme="dark"] :is(.crop-controls,.drawing-quick-settings,.shape-tooltip,.app-update-notice,.export-preview-loading,.shortcut-dialog-footer) {background:#1b1b1b!important;color:#e6e6e6!important;border-color:#666!important}
html[data-theme="dark"] .crop-controls button[data-apply] {background:#294ba8!important;color:#fff!important;border-color:#96b5ff!important}
html[data-theme="dark"] .inline-text-input:not(.mobile-text-entry) {background:transparent!important;color-scheme:dark}
html[data-theme="dark"] .premium-tag {background:#302343!important;color:#e6d0ff!important;border-color:#80669d!important}
html[data-theme="dark"] #offerLoginContext {background:#292035!important;color:#e6d0ff!important;border-color:#80669d!important}
html[data-theme="dark"] .shortcut-dialog-footer strong {color:#bed0ff}
html[data-theme="dark"] #walkthroughDialog .walkthrough-controls #walkthroughBack {
 background:var(--dark-raised)!important;color:var(--navy)!important;border-color:var(--dark-edge)!important;
}
html[data-theme="dark"] .png-quality #pngSizePreview {color:var(--dark-accent)}
