/* Login uses the same shared theme tokens as the authenticated feature pages. */
body.ui-theme-login {
    --login-page-bg: #f8fafc;
    --login-surface: #ffffff;
    --login-text: #0f172a;
    --login-muted: #64748b;
    --login-label: #334155;
    --login-border: #cbd5e1;
    --login-divider: #e2e8f0;
    --login-input-bg: #ffffff;
    --login-primary: #4f46e5;
    --login-primary-hover: #4338ca;
    --login-outline-hover: #f1f5f9;
    --login-danger: #ef4444;
    --login-success: #10b981;
    --login-overlay: rgba(15, 23, 42, 0.55);
    --login-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --login-modal-shadow: 0 24px 80px rgba(15, 23, 42, 0.2);
}

html[data-ui-theme="dark"] body.ui-theme-login {
    --login-page-bg: #11151d;
    --login-surface: #191f2a;
    --login-text: #f1f5f9;
    --login-muted: #aab4c3;
    --login-label: #dbe4f0;
    --login-border: #3a4555;
    --login-divider: rgba(148, 163, 184, 0.2);
    --login-input-bg: #151b24;
    --login-primary: #9297ff;
    --login-primary-hover: #b7b9ff;
    --login-outline-hover: #2d394c;
    --login-danger: #ff8f8c;
    --login-success: #70d5a1;
    --login-overlay: rgba(3, 7, 18, 0.72);
    --login-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
    --login-modal-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

body.ui-theme-login {
    background: var(--login-page-bg);
    color: var(--login-text);
}

.theme-toggle {
    height: 36px;
    padding: 0 11px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 8px;
    background: rgba(248, 250, 252, 0.88);
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    flex: 0 0 auto;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 650;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.theme-toggle:hover {
    color: #1f2937;
    background: #fff;
    border-color: rgba(79, 70, 229, 0.3);
    transform: translateY(-1px);
}

.theme-toggle-icon {
    display: none;
    width: 16px;
    height: 16px;
}

html[data-ui-theme-mode="auto"] .theme-icon-auto,
html[data-ui-theme-mode="dark"] .theme-icon-dark,
html[data-ui-theme-mode="light"] .theme-icon-light {
    display: block;
}

html[data-ui-theme="dark"] { color-scheme: dark; }

html[data-ui-theme="dark"] body.ui-theme-design-agent,
html[data-ui-theme="dark"] body.ui-theme-vector-trace,
html[data-ui-theme="dark"] body.ui-theme-image-upscale,
html[data-ui-theme="dark"] body.ui-theme-image-cutout,
html[data-ui-theme="dark"] body.ui-theme-svg-processing,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent {
    background: #11151d;
    color: #e5e7eb;
}

html[data-ui-theme="dark"] body.ui-theme-dashboard {
    --page-bg: linear-gradient(180deg, #10141b 0%, #151a23 48%, #11151d 100%);
    --surface-primary: rgba(25, 31, 42, 0.94);
    --surface-secondary: rgba(30, 37, 49, 0.94);
    --surface-border: rgba(148, 163, 184, 0.18);
    --surface-border-strong: rgba(129, 140, 248, 0.34);
    --text-primary: #edf2f7;
    --text-secondary: #aab4c3;
    --brand-primary: #a5b4fc;
    --brand-primary-strong: #7dd3fc;
    --shadow-soft: 0 14px 38px rgba(0, 0, 0, 0.24);
    --shadow-hover: 0 18px 44px rgba(0, 0, 0, 0.32);
    background: var(--page-bg);
    color: var(--text-primary);
}

html[data-ui-theme="dark"] body.ui-theme-design-agent .navbar,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .navbar,
html[data-ui-theme="dark"] body.ui-theme-dashboard .navbar {
    background: rgba(18, 23, 32, 0.94);
    border-bottom-color: rgba(148, 163, 184, 0.16);
    box-shadow: 0 1px 14px rgba(0, 0, 0, 0.24);
}

html[data-ui-theme="dark"] body.ui-theme-design-agent .nav-brand,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .nav-brand,
html[data-ui-theme="dark"] body.ui-theme-dashboard .nav-brand,
html[data-ui-theme="dark"] body.ui-theme-design-agent .nav-link:hover,
html[data-ui-theme="dark"] body.ui-theme-design-agent .nav-link.active,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .nav-link:hover,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .nav-link.active,
html[data-ui-theme="dark"] body.ui-theme-dashboard .nav-link:hover,
html[data-ui-theme="dark"] body.ui-theme-dashboard .nav-link.active { color: #f8fafc !important; }

html[data-ui-theme="dark"] body.ui-theme-design-agent .nav-link,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .nav-link,
html[data-ui-theme="dark"] body.ui-theme-dashboard .nav-link { color: #aab4c3; }

html[data-ui-theme="dark"] body.ui-theme-design-agent .nav-link:hover,
html[data-ui-theme="dark"] body.ui-theme-design-agent .nav-link.active,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .nav-link:hover,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .nav-link.active,
html[data-ui-theme="dark"] body.ui-theme-dashboard .nav-link:hover,
html[data-ui-theme="dark"] body.ui-theme-dashboard .nav-link.active { background: rgba(255, 255, 255, 0.09); }

html[data-ui-theme="dark"] .theme-toggle,
html[data-ui-theme="dark"] body.ui-theme-design-agent .user-name-badge,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .user-name-badge,
html[data-ui-theme="dark"] body.ui-theme-dashboard .user-name-badge {
    color: #cbd5e1;
    background: rgba(43, 51, 65, 0.92);
    border-color: rgba(148, 163, 184, 0.22);
    box-shadow: none;
}

html[data-ui-theme="dark"] .theme-toggle:hover,
html[data-ui-theme="dark"] body.ui-theme-design-agent .user-name-badge:hover,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .user-name-badge:hover,
html[data-ui-theme="dark"] body.ui-theme-dashboard .user-name-badge:hover {
    color: #fff;
    background: #333c4b;
    border-color: rgba(129, 140, 248, 0.42);
}

html[data-ui-theme="dark"] body.ui-theme-design-agent .user-popover,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .user-popover,
html[data-ui-theme="dark"] body.ui-theme-dashboard .user-popover {
    background: rgba(24, 30, 40, 0.98);
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
}

html[data-ui-theme="dark"] body.ui-theme-design-agent .popover-header,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .popover-header,
html[data-ui-theme="dark"] body.ui-theme-dashboard .popover-header,
html[data-ui-theme="dark"] body.ui-theme-design-agent .popover-link.danger,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .popover-link.danger,
html[data-ui-theme="dark"] body.ui-theme-dashboard .popover-link.danger { border-color: rgba(148, 163, 184, 0.16); }

html[data-ui-theme="dark"] body.ui-theme-design-agent .popover-name,
html[data-ui-theme="dark"] body.ui-theme-design-agent .popover-link,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .popover-name,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .popover-link,
html[data-ui-theme="dark"] body.ui-theme-dashboard .popover-name,
html[data-ui-theme="dark"] body.ui-theme-dashboard .popover-link { color: #e5e7eb; }

html[data-ui-theme="dark"] body.ui-theme-design-agent .popover-email,
html[data-ui-theme="dark"] body.ui-theme-design-agent .balance-label,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .popover-email,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .balance-label,
html[data-ui-theme="dark"] body.ui-theme-dashboard .popover-email,
html[data-ui-theme="dark"] body.ui-theme-dashboard .balance-label { color: #9aa6b6; }

html[data-ui-theme="dark"] body.ui-theme-design-agent .popover-balance,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .popover-balance,
html[data-ui-theme="dark"] body.ui-theme-dashboard .popover-balance,
html[data-ui-theme="dark"] body.ui-theme-design-agent .popover-link:hover,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .popover-link:hover,
html[data-ui-theme="dark"] body.ui-theme-dashboard .popover-link:hover {
    background: #202735;
    border-color: rgba(148, 163, 184, 0.16);
}

html[data-ui-theme="dark"] body.ui-theme-design-agent .warning-popup-content,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .warning-popup-content,
html[data-ui-theme="dark"] body.ui-theme-design-agent .reverse-prompt-modal,
html[data-ui-theme="dark"] body.ui-theme-design-agent .clarification-dialog {
    color: #e5e7eb;
    background: #191f2a;
    border-color: #303948;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.42);
}

html[data-ui-theme="dark"] body.ui-theme-design-agent .popup-header-title,
html[data-ui-theme="dark"] body.ui-theme-design-agent .popup-highlight-text,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .popup-header-title,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .popup-highlight-text,
html[data-ui-theme="dark"] body.ui-theme-design-agent .reverse-modal-header,
html[data-ui-theme="dark"] body.ui-theme-design-agent .clarification-title,
html[data-ui-theme="dark"] body.ui-theme-design-agent .clarification-option-title {
    color: #f1f5f9;
}

html[data-ui-theme="dark"] body.ui-theme-design-agent .popup-body,
html[data-ui-theme="dark"] body.ui-theme-design-agent .card-desc,
html[data-ui-theme="dark"] body.ui-theme-design-agent .checkbox-wrapper,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .popup-body,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .card-desc,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .checkbox-wrapper,
html[data-ui-theme="dark"] body.ui-theme-design-agent .clarification-option-desc {
    color: #aab4c3;
}

html[data-ui-theme="dark"] body.ui-theme-design-agent .popup-close-icon,
html[data-ui-theme="dark"] body.ui-theme-design-agent .popup-image-card,
html[data-ui-theme="dark"] body.ui-theme-design-agent .popup-guide-box,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .popup-close-icon,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .popup-image-card,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .popup-guide-box,
html[data-ui-theme="dark"] body.ui-theme-design-agent .reverse-modal-header,
html[data-ui-theme="dark"] body.ui-theme-design-agent .reverse-image-upload,
html[data-ui-theme="dark"] body.ui-theme-design-agent .reverse-result,
html[data-ui-theme="dark"] body.ui-theme-design-agent .clarification-question,
html[data-ui-theme="dark"] body.ui-theme-design-agent .clarification-option {
    color: #dbe4f0;
    background: #222a37;
    border-color: #3a4555;
}

html[data-ui-theme="dark"] body.ui-theme-design-agent .popup-close-icon:hover,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .popup-close-icon:hover,
html[data-ui-theme="dark"] body.ui-theme-design-agent .clarification-option:hover {
    color: #fff;
    background: #2b3442;
}

html[data-ui-theme="dark"] body.ui-theme-design-agent .popup-guide-highlight,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .popup-guide-highlight { color: #93c5fd; }

html[data-ui-theme="dark"] body.ui-theme-design-agent .clarification-actions {
    border-color: #303948;
}

/* Vector layout page */
html[data-ui-theme="dark"] body.ui-theme-design-agent .design-workspace > .card,
html[data-ui-theme="dark"] body.ui-theme-design-agent .design-preview-card,
html[data-ui-theme="dark"] body.ui-theme-design-agent .organize-preview-card {
    color: #e5e7eb;
    background: #191f2a;
    border-color: #303948;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.24);
}

html[data-ui-theme="dark"] body.ui-theme-design-agent h1,
html[data-ui-theme="dark"] body.ui-theme-design-agent h2,
html[data-ui-theme="dark"] body.ui-theme-design-agent h3,
html[data-ui-theme="dark"] body.ui-theme-design-agent .design-preview-title,
html[data-ui-theme="dark"] body.ui-theme-design-agent .design-history h3,
html[data-ui-theme="dark"] body.ui-theme-design-agent .design-history-summary,
html[data-ui-theme="dark"] body.ui-theme-design-agent .annotation-preview-heading,
html[data-ui-theme="dark"] body.ui-theme-design-agent .image-organize-heading h2,
html[data-ui-theme="dark"] body.ui-theme-design-agent .organize-upload-title,
html[data-ui-theme="dark"] body.ui-theme-design-agent .image-history-card-title,
html[data-ui-theme="dark"] body.ui-theme-design-agent .copy-choice-dialog h3,
html[data-ui-theme="dark"] body.ui-theme-design-agent .design-preparation-summary strong { color: #f1f5f9; }

html[data-ui-theme="dark"] body.ui-theme-design-agent .form-label,
html[data-ui-theme="dark"] body.ui-theme-design-agent .design-preview-status,
html[data-ui-theme="dark"] body.ui-theme-design-agent .design-history-list,
html[data-ui-theme="dark"] body.ui-theme-design-agent .design-history-meta,
html[data-ui-theme="dark"] body.ui-theme-design-agent .design-feature,
html[data-ui-theme="dark"] body.ui-theme-design-agent .copy-status,
html[data-ui-theme="dark"] body.ui-theme-design-agent .word-image-meta,
html[data-ui-theme="dark"] body.ui-theme-design-agent .copy-image-fields label,
html[data-ui-theme="dark"] body.ui-theme-design-agent .copy-image-system,
html[data-ui-theme="dark"] body.ui-theme-design-agent .image-organize-heading p,
html[data-ui-theme="dark"] body.ui-theme-design-agent .organize-upload-copy,
html[data-ui-theme="dark"] body.ui-theme-design-agent .image-history-card-meta,
html[data-ui-theme="dark"] body.ui-theme-design-agent .copy-choice-dialog p,
html[data-ui-theme="dark"] body.ui-theme-design-agent .design-preparation-summary span,
html[data-ui-theme="dark"] body.ui-theme-design-agent .design-check,
html[data-ui-theme="dark"] body.ui-theme-design-agent .free-design-status-row,
html[data-ui-theme="dark"] body.ui-theme-design-agent .free-design-flow-detail { color: #aab4c3; }

html[data-ui-theme="dark"] body.ui-theme-design-agent .form-input,
html[data-ui-theme="dark"] body.ui-theme-design-agent .reverse-user-input,
html[data-ui-theme="dark"] body.ui-theme-design-agent .clarification-input,
html[data-ui-theme="dark"] body.ui-theme-design-agent .copy-image-fields input,
html[data-ui-theme="dark"] body.ui-theme-design-agent .copy-image-fields textarea {
    color: #edf2f7;
    background: #111720;
    border-color: #394455;
}

html[data-ui-theme="dark"] body.ui-theme-design-agent .form-input::placeholder,
html[data-ui-theme="dark"] body.ui-theme-design-agent .reverse-user-input::placeholder,
html[data-ui-theme="dark"] body.ui-theme-design-agent .clarification-input::placeholder { color: #758195; }

html[data-ui-theme="dark"] body.ui-theme-design-agent .mode-card,
html[data-ui-theme="dark"] body.ui-theme-design-agent .quick-btn,
html[data-ui-theme="dark"] body.ui-theme-design-agent .design-tool-button,
html[data-ui-theme="dark"] body.ui-theme-design-agent .body-action-button,
html[data-ui-theme="dark"] body.ui-theme-design-agent .copy-expand-btn,
html[data-ui-theme="dark"] body.ui-theme-design-agent .copy-actions button,
html[data-ui-theme="dark"] body.ui-theme-design-agent .copy-image-toolbar button,
html[data-ui-theme="dark"] body.ui-theme-design-agent .image-candidates-toggle,
html[data-ui-theme="dark"] body.ui-theme-design-agent .organize-upload-actions button,
html[data-ui-theme="dark"] body.ui-theme-design-agent .image-history-entry,
html[data-ui-theme="dark"] body.ui-theme-design-agent .image-history-actions button,
html[data-ui-theme="dark"] body.ui-theme-design-agent .image-history-header button,
html[data-ui-theme="dark"] body.ui-theme-design-agent .copy-choice-actions button,
html[data-ui-theme="dark"] body.ui-theme-design-agent .clarification-cancel,
html[data-ui-theme="dark"] body.ui-theme-design-agent .free-design-flow-action {
    color: #dbe4f0;
    background: #222a37;
    border-color: #3a4555;
}

html[data-ui-theme="dark"] body.ui-theme-design-agent .mode-card:hover,
html[data-ui-theme="dark"] body.ui-theme-design-agent .quick-btn:hover,
html[data-ui-theme="dark"] body.ui-theme-design-agent .design-tool-button:hover:not(:disabled),
html[data-ui-theme="dark"] body.ui-theme-design-agent .body-action-button:hover:not(:disabled) {
    color: #bfdbfe;
    background: #293345;
    border-color: #4f6b91;
}

html[data-ui-theme="dark"] body.ui-theme-design-agent .mode-card.active,
html[data-ui-theme="dark"] body.ui-theme-design-agent .clarification-option.selected,
html[data-ui-theme="dark"] body.ui-theme-design-agent .free-design-flow {
    color: #bfdbfe;
    background: #1d2b42;
    border-color: #3b82f6;
}

html[data-ui-theme="dark"] body.ui-theme-design-agent .design-feature,
html[data-ui-theme="dark"] body.ui-theme-design-agent .organize-source-panel,
html[data-ui-theme="dark"] body.ui-theme-design-agent .copy-organize-panel,
html[data-ui-theme="dark"] body.ui-theme-design-agent .image-organize-panel,
html[data-ui-theme="dark"] body.ui-theme-design-agent .free-design-status,
html[data-ui-theme="dark"] body.ui-theme-design-agent .design-options-after-action,
html[data-ui-theme="dark"] body.ui-theme-design-agent .design-history,
html[data-ui-theme="dark"] body.ui-theme-design-agent .design-history-left,
html[data-ui-theme="dark"] body.ui-theme-design-agent .design-history-item,
html[data-ui-theme="dark"] body.ui-theme-design-agent .word-image-candidate,
html[data-ui-theme="dark"] body.ui-theme-design-agent .copy-image-annotation,
html[data-ui-theme="dark"] body.ui-theme-design-agent .image-history-card,
html[data-ui-theme="dark"] body.ui-theme-design-agent .copy-choice-dialog,
html[data-ui-theme="dark"] body.ui-theme-design-agent .copy-fullscreen-card,
html[data-ui-theme="dark"] body.ui-theme-design-agent .design-preparation-summary div,
html[data-ui-theme="dark"] body.ui-theme-design-agent #imagePreviewSection,
html[data-ui-theme="dark"] body.ui-theme-design-agent #tokenUsageDisplay {
    color: #dbe4f0;
    background: #1d2430 !important;
    border-color: #343f50 !important;
}

html[data-ui-theme="dark"] body.ui-theme-design-agent .design-preview-header,
html[data-ui-theme="dark"] body.ui-theme-design-agent .design-preview-toolbar,
html[data-ui-theme="dark"] body.ui-theme-design-agent .organize-preview-body,
html[data-ui-theme="dark"] body.ui-theme-design-agent .annotation-preview-section {
    background: #1d2430;
    border-color: #343f50;
}

html[data-ui-theme="dark"] body.ui-theme-design-agent .design-preview-toolbar button {
    color: #dbe4f0;
    background: #252e3c;
    border-color: #3a4555;
}

html[data-ui-theme="dark"] body.ui-theme-design-agent .design-preview-empty,
html[data-ui-theme="dark"] body.ui-theme-design-agent .organize-preview-empty {
    color: #96a3b5;
    background: #151b24;
}

html[data-ui-theme="dark"] body.ui-theme-design-agent .design-preview-viewport {
    background-color: #10151d;
    background-image: linear-gradient(45deg, #1c2430 25%, transparent 25%), linear-gradient(-45deg, #1c2430 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #1c2430 75%), linear-gradient(-45deg, transparent 75%, #1c2430 75%);
}

/* Generated artwork stays color-accurate and independent from the application theme. */
html[data-ui-theme="dark"] body.ui-theme-design-agent .design-preview-stage,
html[data-ui-theme="dark"] body.ui-theme-design-agent .design-preview-canvas,
html[data-ui-theme="dark"] body.ui-theme-design-agent .design-preview-iframe { background: #fff; }

html[data-ui-theme="dark"] body.ui-theme-design-agent .free-design-status-row strong {
    color: #f1f5f9 !important;
    font-weight: 700;
}

html[data-ui-theme="dark"] body.ui-theme-design-agent .free-design-status-row,
html[data-ui-theme="dark"] body.ui-theme-design-agent .free-design-status-row > span {
    color: #cbd5e1 !important;
}

html[data-ui-theme="dark"] body.ui-theme-design-agent .free-design-status-row button {
    color: #9fc1ff !important;
}

html[data-ui-theme="dark"] body.ui-theme-design-agent .legacy-mode-switch span {
    color: #7f8da1;
}

html[data-ui-theme="dark"] body.ui-theme-design-agent .legacy-mode-switch button,
html[data-ui-theme="dark"] body.ui-theme-design-agent #beautifyPromptBtn,
html[data-ui-theme="dark"] body.ui-theme-design-agent #quickInputGuideBtn button,
html[data-ui-theme="dark"] body.ui-theme-design-agent #btnFreeInput,
html[data-ui-theme="dark"] body.ui-theme-design-agent #freeModeToggleContainer label,
html[data-ui-theme="dark"] body.ui-theme-design-agent .design-tool-button {
    color: #edf3ff !important;
    background: #202938 !important;
    border-color: #4a5b75 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16) !important;
}

html[data-ui-theme="dark"] body.ui-theme-design-agent .legacy-mode-switch button:hover,
html[data-ui-theme="dark"] body.ui-theme-design-agent #beautifyPromptBtn:hover,
html[data-ui-theme="dark"] body.ui-theme-design-agent #quickInputGuideBtn button:hover,
html[data-ui-theme="dark"] body.ui-theme-design-agent #btnFreeInput:hover,
html[data-ui-theme="dark"] body.ui-theme-design-agent #freeModeToggleContainer label:hover,
html[data-ui-theme="dark"] body.ui-theme-design-agent .design-tool-button:hover:not(:disabled) {
    color: #e8eef8 !important;
    background: #2d394c !important;
    border-color: #6880a4 !important;
}

html[data-ui-theme="dark"] body.ui-theme-design-agent .legacy-mode-switch button.active {
    color: #bfdbfe !important;
    background: #1d2b42 !important;
    border-color: #3b82f6 !important;
}

html[data-ui-theme="dark"] body.ui-theme-design-agent #beautifyPromptBtn {
    color: #c7d2fe !important;
}

html[data-ui-theme="dark"] body.ui-theme-design-agent #freeModeToggleContainer {
    color: #cbd5e1 !important;
    background: #171e29 !important;
    border-color: #303b4c !important;
}

html[data-ui-theme="dark"] body.ui-theme-design-agent .free-design-flow-step {
    color: #98a7bb;
    background: #222a37;
}

html[data-ui-theme="dark"] body.ui-theme-design-agent .free-design-flow-step.active {
    color: #bfdbfe;
    background: #233554;
}

html[data-ui-theme="dark"] body.ui-theme-design-agent .free-design-flow-step.done {
    color: #86efac;
    background: #17362c;
}

html[data-ui-theme="dark"] body.ui-theme-design-agent .pending-image-recovery button {
    color: #fde68a;
    background: #302a1c;
    border-color: #665a2f;
}

html[data-ui-theme="dark"] body.ui-theme-design-agent .word-image-delete {
    color: #fda4af;
    background: #342029;
    border-color: #70404c;
}

/* Tracing page */
html[data-ui-theme="dark"] body.ui-theme-vector-trace .trace-workspace > .card,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .trace-preview-panel {
    color: #e5e7eb;
    background: #191f2a;
    border-color: #303948;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.24);
}

html[data-ui-theme="dark"] body.ui-theme-vector-trace h1,
html[data-ui-theme="dark"] body.ui-theme-vector-trace h2,
html[data-ui-theme="dark"] body.ui-theme-vector-trace h3,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .trace-preview-title,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .trace-history-header h2,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .trace-history-summary { color: #f1f5f9; }

html[data-ui-theme="dark"] body.ui-theme-vector-trace .trace-card-intro,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .legacy-mode-label,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .form-label,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .trace-preview-metrics,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .trace-preview-scale,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .trace-history-list,
html[data-ui-theme="dark"] body.ui-theme-vector-trace #traceTaskMeta,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .trace-overlay-control { color: #aab4c3; }

html[data-ui-theme="dark"] body.ui-theme-vector-trace .form-input {
    color: #edf2f7;
    background: #111720;
    border-color: #394455;
}

html[data-ui-theme="dark"] body.ui-theme-vector-trace .form-input::placeholder { color: #758195; }

html[data-ui-theme="dark"] body.ui-theme-vector-trace .upload-section,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .legacy-mode-switch button,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .quick-btn,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .trace-vectorize-btn,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .trace-history,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .trace-history-item,
html[data-ui-theme="dark"] body.ui-theme-vector-trace #progressContainer,
html[data-ui-theme="dark"] body.ui-theme-vector-trace #tokenUsageDisplay {
    color: #dbe4f0;
    background: #1d2430 !important;
    border-color: #343f50 !important;
}

html[data-ui-theme="dark"] body.ui-theme-vector-trace .legacy-mode-switch button:hover,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .quick-btn:hover,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .trace-vectorize-btn:hover,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .trace-history-item:hover:not(:disabled) {
    color: #bfdbfe;
    background: #293345;
    border-color: #4f6b91;
}

html[data-ui-theme="dark"] body.ui-theme-vector-trace .legacy-mode-switch button.active,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .trace-history-item.selected {
    color: #bfdbfe;
    background: #1d2b42;
    border-color: #3b82f6;
}

html[data-ui-theme="dark"] body.ui-theme-vector-trace .trace-preview-header,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .trace-preview-toolbar,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .trace-overlay-control,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .trace-preview-footer {
    background: #1d2430;
    border-color: #343f50;
}

html[data-ui-theme="dark"] body.ui-theme-vector-trace .trace-preview-tabs {
    background: #111720;
    border-color: #343f50;
}

html[data-ui-theme="dark"] body.ui-theme-vector-trace .trace-preview-tab,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .trace-icon-btn,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .trace-toolbar-btn,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .trace-result-secondary { color: #cbd5e1; }

html[data-ui-theme="dark"] body.ui-theme-vector-trace .trace-preview-tab.active,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .trace-icon-btn,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .trace-toolbar-btn,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .trace-result-secondary {
    background: #252e3c;
    border-color: #3a4555;
}

html[data-ui-theme="dark"] body.ui-theme-vector-trace .trace-preview-empty,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .trace-preview-stage,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .trace-preview-viewport {
    color: #96a3b5;
    background: #10151d;
}

/* Source images and generated vectors stay on a neutral white artboard. */
html[data-ui-theme="dark"] body.ui-theme-vector-trace .trace-preview-canvas,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .trace-preview-reference,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .trace-preview-frame { background: #fff; }

/* Dashboard */
html[data-ui-theme="dark"] body.ui-theme-dashboard .card.styled-card,
html[data-ui-theme="dark"] body.ui-theme-dashboard .ledger-card,
html[data-ui-theme="dark"] body.ui-theme-dashboard .history-item,
html[data-ui-theme="dark"] body.ui-theme-dashboard .local-history-tile,
html[data-ui-theme="dark"] body.ui-theme-dashboard .modal-content {
    color: var(--text-primary);
    background: #191f2a;
    border-color: #303948;
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.26);
}

html[data-ui-theme="dark"] body.ui-theme-dashboard .ledger-entry-button,
html[data-ui-theme="dark"] body.ui-theme-dashboard .ledger-entry-button:hover,
html[data-ui-theme="dark"] body.ui-theme-dashboard .recharge-card-surface,
html[data-ui-theme="dark"] body.ui-theme-dashboard .recharge-card-panel,
html[data-ui-theme="dark"] body.ui-theme-dashboard .recharge-card-step,
html[data-ui-theme="dark"] body.ui-theme-dashboard .recharge-card-mini-tip,
html[data-ui-theme="dark"] body.ui-theme-dashboard .redeem-textarea,
html[data-ui-theme="dark"] body.ui-theme-dashboard .recharge-card-textarea {
    color: var(--text-primary);
    background: #1d2430;
    border-color: #343f50;
    box-shadow: none;
}

html[data-ui-theme="dark"] body.ui-theme-dashboard .section-title,
html[data-ui-theme="dark"] body.ui-theme-dashboard .tool-grid,
html[data-ui-theme="dark"] body.ui-theme-dashboard .tool-card,
html[data-ui-theme="dark"] body.ui-theme-dashboard .ledger-section-content,
html[data-ui-theme="dark"] body.ui-theme-dashboard .modal-header,
html[data-ui-theme="dark"] body.ui-theme-dashboard .modal-footer,
html[data-ui-theme="dark"] body.ui-theme-dashboard .history-item,
html[data-ui-theme="dark"] body.ui-theme-dashboard .local-history-thumb-button { border-color: #303948; }

html[data-ui-theme="dark"] body.ui-theme-dashboard .tool-card:hover,
html[data-ui-theme="dark"] body.ui-theme-dashboard .history-item:hover,
html[data-ui-theme="dark"] body.ui-theme-dashboard .local-history-action:hover,
html[data-ui-theme="dark"] body.ui-theme-dashboard .local-history-load-more:hover { background: #222a37; }

html[data-ui-theme="dark"] body.ui-theme-dashboard .tool-desc,
html[data-ui-theme="dark"] body.ui-theme-dashboard .history-meta,
html[data-ui-theme="dark"] body.ui-theme-dashboard .modal-subtitle,
html[data-ui-theme="dark"] body.ui-theme-dashboard .modal-footer-meta,
html[data-ui-theme="dark"] body.ui-theme-dashboard .local-history-tile-meta,
html[data-ui-theme="dark"] body.ui-theme-dashboard .local-history-empty,
html[data-ui-theme="dark"] body.ui-theme-dashboard .local-history-error { color: var(--text-secondary); }

html[data-ui-theme="dark"] body.ui-theme-dashboard .history-prompt,
html[data-ui-theme="dark"] body.ui-theme-dashboard .local-history-tile-title,
html[data-ui-theme="dark"] body.ui-theme-dashboard .modal-title,
html[data-ui-theme="dark"] body.ui-theme-dashboard input,
html[data-ui-theme="dark"] body.ui-theme-dashboard textarea,
html[data-ui-theme="dark"] body.ui-theme-dashboard select { color: var(--text-primary); }

html[data-ui-theme="dark"] body.ui-theme-dashboard input,
html[data-ui-theme="dark"] body.ui-theme-dashboard textarea,
html[data-ui-theme="dark"] body.ui-theme-dashboard select,
html[data-ui-theme="dark"] body.ui-theme-dashboard .btn-outline,
html[data-ui-theme="dark"] body.ui-theme-dashboard .modal-action-btn-secondary,
html[data-ui-theme="dark"] body.ui-theme-dashboard .local-history-action,
html[data-ui-theme="dark"] body.ui-theme-dashboard .local-history-load-more,
html[data-ui-theme="dark"] body.ui-theme-dashboard .local-media-icon-button {
    background: #222a37;
    border-color: #3a4555;
    color: #dbe4f0;
    box-shadow: none;
}

html[data-ui-theme="dark"] body.ui-theme-dashboard .local-history-empty,
html[data-ui-theme="dark"] body.ui-theme-dashboard .local-history-error,
html[data-ui-theme="dark"] body.ui-theme-dashboard .local-media-viewer-body {
    background: #141a23;
    border-color: #303948;
}

html[data-ui-theme="dark"] body.ui-theme-dashboard .card [style*="color: #111"],
html[data-ui-theme="dark"] body.ui-theme-dashboard .card [style*="color:#111"] {
    color: var(--text-primary) !important;
}

html[data-ui-theme="dark"] body.ui-theme-dashboard .card [style*="color: #666"],
html[data-ui-theme="dark"] body.ui-theme-dashboard .card [style*="color:#666"],
html[data-ui-theme="dark"] body.ui-theme-dashboard .card [style*="color: #444"],
html[data-ui-theme="dark"] body.ui-theme-dashboard .card [style*="color:#444"],
html[data-ui-theme="dark"] body.ui-theme-dashboard .card [style*="color: #888"],
html[data-ui-theme="dark"] body.ui-theme-dashboard .card [style*="color:#888"] {
    color: var(--text-secondary) !important;
}

html[data-ui-theme="dark"] body.ui-theme-dashboard .card.styled-card > div[style*="background: #fff"] {
    color: var(--text-secondary);
    background: #222a37 !important;
    border-color: #3a4555 !important;
}

html[data-ui-theme="dark"] body.ui-theme-dashboard .history-source-switch,
html[data-ui-theme="dark"] body.ui-theme-dashboard .more-menu,
html[data-ui-theme="dark"] body.ui-theme-dashboard .modal-footer,
html[data-ui-theme="dark"] body.ui-theme-dashboard .image-preview-stage {
    background: #141a23;
    border-color: #303948;
}

html[data-ui-theme="dark"] body.ui-theme-dashboard .history-source-tab,
html[data-ui-theme="dark"] body.ui-theme-dashboard .more-btn,
html[data-ui-theme="dark"] body.ui-theme-dashboard .more-menu-item,
html[data-ui-theme="dark"] body.ui-theme-dashboard .close-modal { color: #aab4c3; }

html[data-ui-theme="dark"] body.ui-theme-dashboard .history-source-tab:hover,
html[data-ui-theme="dark"] body.ui-theme-dashboard .history-source-tab.active,
html[data-ui-theme="dark"] body.ui-theme-dashboard .more-btn:hover,
html[data-ui-theme="dark"] body.ui-theme-dashboard .more-menu-item:hover,
html[data-ui-theme="dark"] body.ui-theme-dashboard .close-modal:hover {
    color: #f1f5f9;
    background: #252e3c;
}

html[data-ui-theme="dark"] body.ui-theme-dashboard #tabAll,
html[data-ui-theme="dark"] body.ui-theme-dashboard #tabFav {
    color: #cbd5e1 !important;
    border-bottom-color: #64748b !important;
}

html[data-ui-theme="dark"] body.ui-theme-dashboard .status-success,
html[data-ui-theme="dark"] body.ui-theme-dashboard .status-waived,
html[data-ui-theme="dark"] body.ui-theme-dashboard .history-expired-badge {
    color: #dbe4f0;
    background: #222a37;
    border-color: #3a4555;
}

html[data-ui-theme="dark"] body.ui-theme-dashboard .image-preview-empty { color: var(--text-secondary); }
html[data-ui-theme="dark"] body.ui-theme-dashboard .image-preview-stage img { background: #fff; }

html[data-ui-theme="dark"] body.ui-theme-dashboard #previewLoadingOverlay { background: rgba(12, 16, 22, 0.86); }
html[data-ui-theme="dark"] body.ui-theme-dashboard #previewLoadingOverlay > div:last-child { color: #dbe4f0 !important; }

/* Dashboard notice content may contain administrator-authored inline colors. */
html[data-ui-theme="dark"] body.ui-theme-dashboard #dynamicNotificationContainer,
html[data-ui-theme="dark"] body.ui-theme-dashboard #dynamicNotificationContainer p,
html[data-ui-theme="dark"] body.ui-theme-dashboard #dynamicNotificationContainer div,
html[data-ui-theme="dark"] body.ui-theme-dashboard #dynamicNotificationContainer span,
html[data-ui-theme="dark"] body.ui-theme-dashboard #dynamicNotificationContainer li {
    color: #cbd5e1 !important;
}

html[data-ui-theme="dark"] body.ui-theme-dashboard #dynamicNotificationContainer h1,
html[data-ui-theme="dark"] body.ui-theme-dashboard #dynamicNotificationContainer h2,
html[data-ui-theme="dark"] body.ui-theme-dashboard #dynamicNotificationContainer h3,
html[data-ui-theme="dark"] body.ui-theme-dashboard #dynamicNotificationContainer strong,
html[data-ui-theme="dark"] body.ui-theme-dashboard #dynamicNotificationContainer b {
    color: #f1f5f9 !important;
}

html[data-ui-theme="dark"] body.ui-theme-dashboard #dynamicNotificationContainer a {
    color: #8fb4ff !important;
    text-decoration-color: rgba(143, 180, 255, 0.55);
}

html[data-ui-theme="dark"] body.ui-theme-dashboard #dynamicNotificationContainer a:hover {
    color: #b9ceff !important;
}

html[data-ui-theme="dark"] body.ui-theme-dashboard .ledger-entry-action {
    color: #a9c3ff;
    background: #252e3c;
    border-color: #3a4555;
    box-shadow: none;
}

html[data-ui-theme="dark"] body.ui-theme-dashboard .ledger-entry-button:hover .ledger-entry-action,
html[data-ui-theme="dark"] body.ui-theme-dashboard .ledger-entry-button:focus-visible .ledger-entry-action {
    color: #d6e2ff;
    background: #2b3545;
    border-color: #53647a;
}

html[data-ui-theme="dark"] body.ui-theme-dashboard .ledger-entry-button:focus-visible {
    outline: 2px solid #7c9cff;
    outline-offset: -3px;
}

html[data-ui-theme="dark"] body.ui-theme-dashboard #ledgerLimitSelect,
html[data-ui-theme="dark"] body.ui-theme-dashboard #ledgerKeywordInput {
    color: #e5edf7 !important;
    background: #141a23 !important;
    border-color: #3a4555 !important;
}

html[data-ui-theme="dark"] body.ui-theme-dashboard #ledgerLimitSelect:focus,
html[data-ui-theme="dark"] body.ui-theme-dashboard #ledgerKeywordInput:focus {
    border-color: #7c9cff !important;
    box-shadow: 0 0 0 3px rgba(124, 156, 255, 0.16);
}

html[data-ui-theme="dark"] body.ui-theme-dashboard #ledgerKeywordInput::placeholder { color: #7f8da1; }

html[data-ui-theme="dark"] body.ui-theme-dashboard #ledgerNoticeText {
    color: #aebbd0 !important;
    background: #141a23 !important;
    border-color: #303b4c !important;
}

html[data-ui-theme="dark"] body.ui-theme-dashboard #ledgerSummaryText { color: #b9c6d8 !important; }

html[data-ui-theme="dark"] body.ui-theme-dashboard #ledgerSectionContent thead tr,
html[data-ui-theme="dark"] body.ui-theme-dashboard #ledgerTableBody tr {
    border-color: #303948 !important;
}

html[data-ui-theme="dark"] body.ui-theme-dashboard #ledgerSectionContent th {
    color: #e2e8f0 !important;
}

html[data-ui-theme="dark"] body.ui-theme-dashboard #ledgerTableBody td {
    color: #bdc9da;
}

html[data-ui-theme="dark"] body.ui-theme-dashboard #ledgerTableBody td[style*="color: #111"],
html[data-ui-theme="dark"] body.ui-theme-dashboard #ledgerTableBody td[style*="color:#111"] {
    color: #e2e8f0 !important;
}

html[data-ui-theme="dark"] body.ui-theme-dashboard #ledgerTableBody td[style*="color: #666"],
html[data-ui-theme="dark"] body.ui-theme-dashboard #ledgerTableBody td[style*="color:#666"],
html[data-ui-theme="dark"] body.ui-theme-dashboard #ledgerTableBody td[style*="color: #888"],
html[data-ui-theme="dark"] body.ui-theme-dashboard #ledgerTableBody td[style*="color:#888"] {
    color: #98a7bb !important;
}

html[data-ui-theme="dark"] body.ui-theme-dashboard #ledgerTableBody td[style*="color:#059669"] { color: #4ade80 !important; }
html[data-ui-theme="dark"] body.ui-theme-dashboard #ledgerTableBody td[style*="color:#dc2626"] { color: #fb7185 !important; }

/* Shared navigation and account surfaces for the remaining creation tools. */
html[data-ui-theme="dark"] body.ui-theme-image-upscale .navbar,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .navbar,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .topbar {
    background: rgba(18, 23, 32, 0.96);
    border-color: rgba(148, 163, 184, 0.16);
    box-shadow: 0 1px 14px rgba(0, 0, 0, 0.24);
}

html[data-ui-theme="dark"] body.ui-theme-image-upscale .nav-brand,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .nav-brand,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .brand,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .brand { color: #f1f5f9; }

html[data-ui-theme="dark"] body.ui-theme-image-upscale .nav-link,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .nav-link,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .nav-link,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .product-nav a { color: #aab4c3; }

html[data-ui-theme="dark"] body.ui-theme-image-upscale .nav-link:hover,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .nav-link.active,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .nav-link:hover,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .nav-link.active,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .nav-link:hover,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .nav-link.active,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .product-nav a:hover,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .product-nav a.active {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.09);
}

html[data-ui-theme="dark"] body.ui-theme-image-upscale .user-name-badge,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .user-name-badge {
    color: #cbd5e1;
    background: #252e3c;
}

html[data-ui-theme="dark"] body.ui-theme-image-upscale .user-name-badge:hover,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .user-name-badge:hover { background: #303a49; }

html[data-ui-theme="dark"] body.ui-theme-image-upscale .user-popover,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .user-popover {
    color: #e5e7eb;
    background: rgba(24, 30, 40, 0.98);
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
}

html[data-ui-theme="dark"] body.ui-theme-image-upscale .popover-header,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .popover-header,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .popover-link.danger,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .popover-link.danger { border-color: rgba(148, 163, 184, 0.16); }

html[data-ui-theme="dark"] body.ui-theme-image-upscale .popover-name,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .popover-link,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .popover-name,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .popover-link { color: #e5e7eb; }

html[data-ui-theme="dark"] body.ui-theme-image-upscale .popover-email,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .balance-label,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .popover-email,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .balance-label { color: #9aa6b6; }

html[data-ui-theme="dark"] body.ui-theme-image-upscale .popover-balance,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .popover-balance,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .popover-link:hover,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .popover-link:hover {
    color: #f8fafc;
    background: #202735;
    border-color: rgba(148, 163, 184, 0.16);
}

/* PPT creation shell. Generated slides remain isolated inside light iframes. */
html[data-ui-theme="dark"] body.ui-theme-ppt-agent {
    --ink: #edf2f7;
    --muted: #9aa6b6;
    --soft: #1d2430;
    --canvas: #10151d;
    --line: #303948;
    --line-strong: #3a4555;
    --panel: #191f2a;
    --accent: #7c9cff;
    --accent-dark: #6384e8;
    --accent-soft: #1d2b42;
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.26);
}

html[data-ui-theme="dark"] body.ui-theme-ppt-agent .settings-panel,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .workspace,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .slide-rail,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .ppt-history-panel { background: #191f2a; }

html[data-ui-theme="dark"] body.ui-theme-ppt-agent .panel-heading,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .rail-heading,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .ppt-history-heading { border-color: #303948; }

html[data-ui-theme="dark"] body.ui-theme-ppt-agent .form-section,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .advanced-settings,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .advanced-body,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .asset-item,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .asset-option,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .purpose-upload,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .form-footer,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .task-status-bar,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .slide-list-item,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .ppt-history-item,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .export-menu-popover {
    color: #dbe4f0;
    background: #1d2430;
    border-color: #343f50;
}

html[data-ui-theme="dark"] body.ui-theme-ppt-agent input,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent select,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent textarea {
    color: #edf2f7;
    background: #111720;
    border-color: #394455;
}

html[data-ui-theme="dark"] body.ui-theme-ppt-agent input::placeholder,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent textarea::placeholder { color: #758195; }

html[data-ui-theme="dark"] body.ui-theme-ppt-agent .field-label,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .toggle-row strong,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .advanced-settings summary,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .empty-state h2,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .ppt-history-heading,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .ppt-history-item strong,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .export-menu-popover button { color: #e8edf5; }

html[data-ui-theme="dark"] body.ui-theme-ppt-agent .field-meta,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .quiet-label,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .auto-design-note,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .purpose-upload small,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .asset-option small,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .asset-meta,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .slide-number,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .ppt-history-item small,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .export-menu-popover button small { color: #9aa6b6; }

html[data-ui-theme="dark"] body.ui-theme-ppt-agent .workspace-toolbar,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .confirm-header,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .confirm-actions,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .ppt-share-header,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .ppt-edit-header,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .ppt-edit-preview-toolbar,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .ppt-edit-actions { background: #1d2430; border-color: #343f50; }

html[data-ui-theme="dark"] body.ui-theme-ppt-agent .icon-btn,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .secondary-btn,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .toolbar-btn,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .ppt-edit-upload-row button,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .ppt-share-item-actions button {
    color: #dbe4f0;
    background: #252e3c;
    border-color: #3a4555;
}

html[data-ui-theme="dark"] body.ui-theme-ppt-agent .icon-btn:hover,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .secondary-btn:hover,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .toolbar-btn:hover,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .purpose-upload:hover,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .slide-list-item:hover,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .ppt-history-item:hover,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .export-menu-popover button:hover { background: #293345; border-color: #4f6b91; }

html[data-ui-theme="dark"] body.ui-theme-ppt-agent .empty-mark { color: #aab4c3; background: #1d2430; border-color: #3a4555; }
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .preview-area,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .ppt-edit-preview { background: #10151d; }
html[data-ui-theme="dark"] body.ui-theme-ppt-agent #previewFrame,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent #editPreviewFrame { color-scheme: light; background: #fff; }

html[data-ui-theme="dark"] body.ui-theme-ppt-agent .confirm-dialog,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .export-dialog,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .ppt-share-dialog,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .ppt-edit-shell,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .ppt-edit-pages,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .ppt-edit-controls,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .ppt-share-history {
    color: #e5e7eb;
    background: #191f2a;
    border-color: #303948;
}

html[data-ui-theme="dark"] body.ui-theme-ppt-agent .confirm-section pre,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .confirm-options span,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .ppt-edit-slide-row,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .ppt-edit-scope-option,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .ppt-edit-presets label,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .ppt-edit-asset-row,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .ppt-share-toggles label,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .ppt-share-pricing,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .ppt-share-item {
    color: #dbe4f0;
    background: #1d2430;
    border-color: #343f50;
}

html[data-ui-theme="dark"] body.ui-theme-ppt-agent .confirm-label,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .ppt-share-header h2,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .ppt-share-form-grid label,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .ppt-share-toggles label,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .ppt-share-item-head strong { color: #e8edf5; }

html[data-ui-theme="dark"] body.ui-theme-ppt-agent .segmented-control { background: #111720; border-color: #343f50; }
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .segmented-control button { color: #aab4c3; }
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .segmented-control button.active,
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .ppt-edit-slide-row:hover { color: #dbeafe; background: #253149; }
html[data-ui-theme="dark"] body.ui-theme-ppt-agent .ppt-share-qr { color-scheme: light; background: #fff; }

/* Image upscale and repair. Image pixels keep their original colors. */
html[data-ui-theme="dark"] body.ui-theme-image-upscale {
    --bg: #11151d;
    --surface: #191f2a;
    --surface-soft: #1d2430;
    --line: #343f50;
    --line-soft: #303948;
    --text: #edf2f7;
    --sub: #9aa6b6;
    --primary: #7c9cff;
    --primary-dark: #6384e8;
    --shadow: 0 16px 42px rgba(0, 0, 0, 0.26);
}

html[data-ui-theme="dark"] body.ui-theme-image-upscale .workspace-title,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .side-card h3,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .upload-zone strong,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .field-label,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .history-title,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .task-runtime-title,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .preview-empty-title { color: #edf2f7; }

html[data-ui-theme="dark"] body.ui-theme-image-upscale .preview-col,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .side-col,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .mode-switcher,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .page-note {
    color: #dbe4f0;
    background: #191f2a;
    border-color: #303948;
    box-shadow: none;
}

html[data-ui-theme="dark"] body.ui-theme-image-upscale .preview-shell,
html[data-ui-theme="dark"] body.ui-theme-image-upscale #previewViewport,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .side-tabs,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .upload-zone,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .file-meta,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .status-box,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .note-item,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .field-chip,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .history-empty,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .history-item,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .history-thumb {
    color: #cbd5e1;
    background: #141a23;
    border-color: #303948;
}

html[data-ui-theme="dark"] body.ui-theme-image-upscale .mode-switch-btn,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .side-tab { color: #aab4c3; }

html[data-ui-theme="dark"] body.ui-theme-image-upscale .mode-switch-btn:hover,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .side-tab:hover { color: #f1f5f9; background: #252e3c; }

html[data-ui-theme="dark"] body.ui-theme-image-upscale .side-tab.active {
    color: #f1f5f9;
    background: #293345;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.24);
}

html[data-ui-theme="dark"] body.ui-theme-image-upscale .btn-secondary,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .zoom-btn,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .zoom-indicator,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .history-btn,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .compare-value {
    color: #dbe4f0;
    background: #252e3c;
    border-color: #3a4555;
}

html[data-ui-theme="dark"] body.ui-theme-image-upscale .zoom-btn:hover,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .zoom-indicator:hover,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .history-btn:hover { background: #303a49; border-color: #53647a; }

html[data-ui-theme="dark"] body.ui-theme-image-upscale .field-input,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .field-textarea {
    color: #edf2f7;
    background: #111720;
    border-color: #394455;
}

html[data-ui-theme="dark"] body.ui-theme-image-upscale .field-input::placeholder,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .field-textarea::placeholder { color: #758195; }

html[data-ui-theme="dark"] body.ui-theme-image-upscale .task-runtime-card {
    color: #dbe4f0;
    background: #1d2b42;
    border-color: #3d5375;
    box-shadow: none;
}

html[data-ui-theme="dark"] body.ui-theme-image-upscale .task-runtime-card.success { background: #17362c; border-color: #286449; }
html[data-ui-theme="dark"] body.ui-theme-image-upscale .task-runtime-card.danger { background: #3a2027; border-color: #70404c; }
html[data-ui-theme="dark"] body.ui-theme-image-upscale .task-runtime-elapsed,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .task-runtime-desc,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .task-runtime-meta,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .compare-toolbar-label { color: #b8c4d5; }

html[data-ui-theme="dark"] body.ui-theme-image-upscale .mode-guide-dialog {
    color: #e5e7eb;
    background: #191f2a;
    border-color: #303948;
}

html[data-ui-theme="dark"] body.ui-theme-image-upscale .mode-guide-card {
    color: #edf2f7;
    background: #1d2430;
    border-color: #343f50;
}

html[data-ui-theme="dark"] body.ui-theme-image-upscale .mode-guide-card-copy,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .mode-guide-card-foot,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .mode-guide-remember { color: #aab4c3; }

html[data-ui-theme="dark"] body.ui-theme-image-upscale .mode-guide-note {
    color: #bdc9da;
    background: #141a23;
}

html[data-ui-theme="dark"] body.ui-theme-image-upscale .compare-scene,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .compare-scene img {
    color-scheme: light;
    background: #fff;
}

/* Cutout workspace. Preview images and alpha pixels are never filtered. */
html[data-ui-theme="dark"] body.ui-theme-image-cutout {
    --bg: #11151d;
    --card: #191f2a;
    --line: #343f50;
    --text: #edf2f7;
    --muted: #9aa6b6;
    --brand: #7c9cff;
    --brand-hover: #6384e8;
    --brand-soft: #1d2b42;
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.26);
}

html[data-ui-theme="dark"] body.ui-theme-image-cutout .card,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .cutout-workflow-switch,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .history-modal,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .cutout-entry-dialog {
    color: #e5e7eb;
    background: #191f2a;
    border-color: #303948;
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.26);
}

html[data-ui-theme="dark"] body.ui-theme-image-cutout .panel-title,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .history-title,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .history-modal-title,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .ai-price-value,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .split-layout-title,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .split-layout-preview-empty strong,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .cutout-entry-card strong { color: #edf2f7; }

html[data-ui-theme="dark"] body.ui-theme-image-cutout .field label,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .switch-row,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .color-label,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .ai-price-title,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .split-layout-field label { color: #cbd5e1; }

html[data-ui-theme="dark"] body.ui-theme-image-cutout .cutout-workflow-copy,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .history-sub,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .history-modal-subtitle,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .ai-price-note,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .split-layout-subtitle,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .split-layout-field-hint,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .split-layout-preview-empty,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .cutout-entry-card p { color: #9aa6b6; }

html[data-ui-theme="dark"] body.ui-theme-image-cutout .preview-mode-switch button,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .btn-ghost,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .mode-switch-btn,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .history-btn,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .history-modal-close,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .cutout-workflow-btn {
    color: #dbe4f0;
    background: #252e3c;
    border-color: #3a4555;
}

html[data-ui-theme="dark"] body.ui-theme-image-cutout .preview-mode-switch button:hover,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .btn-ghost:hover:not(:disabled),
html[data-ui-theme="dark"] body.ui-theme-image-cutout .mode-switch-btn:hover,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .history-btn:hover,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .history-modal-close:hover,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .cutout-workflow-btn:hover { color: #f8fafc; background: #303a49; border-color: #53647a; }

html[data-ui-theme="dark"] body.ui-theme-image-cutout .preview-mode-switch button.active,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .mode-switch-btn.active,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .cutout-workflow-btn.active {
    color: #bfdbfe;
    background: #1d2b42;
    border-color: #4f7dcc;
}

html[data-ui-theme="dark"] body.ui-theme-image-cutout .field select,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .field input[type="text"],
html[data-ui-theme="dark"] body.ui-theme-image-cutout .field input[type="number"],
html[data-ui-theme="dark"] body.ui-theme-image-cutout .split-layout-field select,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .split-layout-field textarea {
    color: #edf2f7;
    background: #111720;
    border-color: #394455;
}

html[data-ui-theme="dark"] body.ui-theme-image-cutout .split-layout-field textarea::placeholder { color: #758195; }

html[data-ui-theme="dark"] body.ui-theme-image-cutout .preview-floating-switch { background: rgba(25, 31, 42, 0.9); border-color: #3a4555; }
html[data-ui-theme="dark"] body.ui-theme-image-cutout .mini-card,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .mini-head,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .mini-meta,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .status-box,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .desktop-note,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .history-empty,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .history-item,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .history-modal-section,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .ai-price-box,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .custom-color-panel,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .split-layout-status,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .cutout-entry-note {
    color: #bdc9da;
    background: #1d2430;
    border-color: #343f50;
}

html[data-ui-theme="dark"] body.ui-theme-image-cutout .mini-card.active,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .mini-card.active .mini-head,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .split-layout-mode-note {
    color: #bfdbfe;
    background: #1d2b42;
    border-color: #3d5375;
}

html[data-ui-theme="dark"] body.ui-theme-image-cutout .cutout-entry-options { background: #191f2a; }
html[data-ui-theme="dark"] body.ui-theme-image-cutout .cutout-entry-card {
    color: #edf2f7;
    background: #1d2430;
    border-color: #343f50;
}

html[data-ui-theme="dark"] body.ui-theme-image-cutout .cutout-entry-card:hover:not(:disabled),
html[data-ui-theme="dark"] body.ui-theme-image-cutout .cutout-entry-card:focus-visible:not(:disabled) { background: #252e3c; border-color: #5d7fb7; }
html[data-ui-theme="dark"] body.ui-theme-image-cutout .cutout-entry-action { color: #cbd5e1; }

html[data-ui-theme="dark"] body.ui-theme-image-cutout .board-wrap,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .mini-preview,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .split-layout-preview-shell { background-color: #10151d; border-color: #303948; }

html[data-ui-theme="dark"] body.ui-theme-image-cutout .board-wrap.transparent-bg,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .mini-preview.transparent-bg {
    background-color: #1d2430;
    background-image: linear-gradient(45deg, #394455 25%, transparent 25%), linear-gradient(-45deg, #394455 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #394455 75%), linear-gradient(-45deg, transparent 75%, #394455 75%);
}

html[data-ui-theme="dark"] body.ui-theme-image-cutout .board-wrap img,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .mini-preview img,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .split-layout-preview-shell img { filter: none; }

/* SVG processing shell. Do not target #svg or its descendants: those are export data. */
html[data-ui-theme="dark"] body.ui-theme-svg-processing {
    --bg: #11151d;
    --surface: #191f2a;
    --surface-soft: #1d2430;
    --line: #343f50;
    --line-soft: #303948;
    --text: #edf2f7;
    --muted: #9aa6b6;
    --muted-2: #7f8da1;
    --accent: #7c9cff;
    --accent-dark: #6384e8;
    --accent-soft: #1d2b42;
    --shadow: 0 14px 38px rgba(0, 0, 0, 0.26);
}

html[data-ui-theme="dark"] body.ui-theme-svg-processing .workspace-card,
html[data-ui-theme="dark"] body.ui-theme-svg-processing #options,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .flat-control-col,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .vector-entry-guide-dialog,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .warning-popup-content {
    color: #e5e7eb;
    background: #191f2a;
    border-color: #303948;
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.26);
}

html[data-ui-theme="dark"] body.ui-theme-svg-processing .workspace-topbar,
html[data-ui-theme="dark"] body.ui-theme-svg-processing #options,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .flat-preview-col { border-color: #303948; }

html[data-ui-theme="dark"] body.ui-theme-svg-processing .workspace-status,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .upload-title,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .opt-title,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .advanced-history-title,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .advanced-history-item-name,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .advanced-billing strong,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .flat-preview-empty strong,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .flat-control-label,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .popup-header-title,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .popup-card-title,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .vector-entry-guide-card strong { color: #edf2f7; }

html[data-ui-theme="dark"] body.ui-theme-svg-processing .toolbar-btn,
html[data-ui-theme="dark"] body.ui-theme-svg-processing #export,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .mode-btn,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .zoom-btn,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .zoom-indicator,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .seg-btn,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .slider-value,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .advanced-history-btn,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .workflow-entry-actions,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .workflow-entry-btn {
    color: #dbe4f0;
    background: #252e3c;
    border-color: #3a4555;
}

html[data-ui-theme="dark"] body.ui-theme-svg-processing .toolbar-btn:hover,
html[data-ui-theme="dark"] body.ui-theme-svg-processing #export:hover,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .mode-btn:hover,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .zoom-btn:hover,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .zoom-indicator:hover,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .seg-btn:hover,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .advanced-history-btn:hover,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .workflow-entry-btn:hover { color: #f8fafc; background: #303a49; border-color: #53647a; }

html[data-ui-theme="dark"] body.ui-theme-svg-processing .mode-btn.active,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .seg-btn.selected,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .workflow-entry-btn.active {
    color: #fff;
    background: #4f6fba;
    border-color: #6f91dc;
}

html[data-ui-theme="dark"] body.ui-theme-svg-processing #drop,
html[data-ui-theme="dark"] body.ui-theme-svg-processing #droptext,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .advanced-panel,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .advanced-status,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .advanced-billing,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .advanced-history-empty,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .advanced-history-item,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .flat-ratio-chip,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .flat-status,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .vector-entry-guide-note,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .popup-card {
    color: #bdc9da;
    background: #1d2430;
    border-color: #343f50;
}

html[data-ui-theme="dark"] body.ui-theme-svg-processing #droptext.hovering,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .advanced-status.ready,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .advanced-history-item.active {
    color: #dbeafe;
    background: #1d2b42;
    border-color: #4f6b91;
}

html[data-ui-theme="dark"] body.ui-theme-svg-processing .upload-pill,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .flat-ratio-chip { color: #cbd5e1; }

html[data-ui-theme="dark"] body.ui-theme-svg-processing .slider-label,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .flat-control-hint,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .flat-preview-empty,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .advanced-note,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .advanced-history-subtitle,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .advanced-history-item-time,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .advanced-history-item-meta,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .workflow-entry-copy,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .popup-body,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .vector-entry-guide-card p { color: #9aa6b6; }

html[data-ui-theme="dark"] body.ui-theme-svg-processing .flat-control-col select,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .flat-control-col textarea {
    color: #edf2f7;
    background: #111720;
    border-color: #394455;
}

html[data-ui-theme="dark"] body.ui-theme-svg-processing .flat-control-col textarea::placeholder { color: #758195; }

html[data-ui-theme="dark"] body.ui-theme-svg-processing .flat-preview-col,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .flat-preview-shell { background: #10151d; border-color: #303948; }
html[data-ui-theme="dark"] body.ui-theme-svg-processing .flat-preview-shell img { filter: none; }

html[data-ui-theme="dark"] body.ui-theme-svg-processing .vector-entry-guide-options { background: #191f2a; }
html[data-ui-theme="dark"] body.ui-theme-svg-processing .vector-entry-guide-card {
    color: #edf2f7;
    background: #1d2430;
    border-color: #343f50;
}
html[data-ui-theme="dark"] body.ui-theme-svg-processing .vector-entry-guide-card:hover,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .vector-entry-guide-card:focus-visible { background: #252e3c; border-color: #5d7fb7; }
html[data-ui-theme="dark"] body.ui-theme-svg-processing .vector-entry-guide-action { color: #cbd5e1; }

html[data-ui-theme="dark"] body.ui-theme-bitmap-vectorize-legacy .vectorize-notice-dialog {
    color: #e5e7eb;
    background: #191f2a;
    border-color: #303948;
    box-shadow: 0 22px 58px rgba(0, 0, 0, 0.42);
}

html[data-ui-theme="dark"] body.ui-theme-bitmap-vectorize-legacy .vectorize-notice-title { color: #f1f5f9; }
html[data-ui-theme="dark"] body.ui-theme-bitmap-vectorize-legacy .vectorize-notice-text,
html[data-ui-theme="dark"] body.ui-theme-bitmap-vectorize-legacy .vectorize-notice-checkbox { color: #aab4c3; }
html[data-ui-theme="dark"] body.ui-theme-bitmap-vectorize-legacy .vectorize-notice-footer { border-color: #303948; }
html[data-ui-theme="dark"] body.ui-theme-bitmap-vectorize-legacy .vectorize-notice-close {
    color: #cbd5e1;
    background: #252e3c;
}
html[data-ui-theme="dark"] body.ui-theme-bitmap-vectorize-legacy .vectorize-notice-close:hover { background: #303a49; }
html[data-ui-theme="dark"] body.ui-theme-bitmap-vectorize-legacy .vectorize-notice-confirm {
    color: #fff;
    background: #5b7fdf;
    border-color: #6f91dc;
}

html[data-ui-theme="dark"] body.ui-theme-svg-processing .popup-close-icon { color: #cbd5e1; background: #252e3c; }
html[data-ui-theme="dark"] body.ui-theme-svg-processing .popup-card.good { background: #17362c; border-color: #286449; }
html[data-ui-theme="dark"] body.ui-theme-svg-processing .popup-card.bad { background: #3a2b1d; border-color: #76532e; }

html[data-ui-theme="dark"] body.ui-theme-svg-processing .navbar {
    background: rgba(18, 23, 32, 0.96);
    border-bottom-color: rgba(148, 163, 184, 0.16);
    box-shadow: 0 1px 14px rgba(0, 0, 0, 0.24);
}

html[data-ui-theme="dark"] body.ui-theme-svg-processing .nav-brand,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .nav-link:hover,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .nav-link.active {
    color: #f8fafc;
}

html[data-ui-theme="dark"] body.ui-theme-svg-processing .nav-link { color: #aab4c3; }
html[data-ui-theme="dark"] body.ui-theme-svg-processing .nav-link:hover,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .nav-link.active { background: rgba(255, 255, 255, 0.09); }

html[data-ui-theme="dark"] body.ui-theme-svg-processing .user-name-badge {
    color: #cbd5e1;
    background: rgba(43, 51, 65, 0.92);
}

html[data-ui-theme="dark"] body.ui-theme-svg-processing .user-name-badge:hover {
    color: #fff;
    background: #333c4b;
}

html[data-ui-theme="dark"] body.ui-theme-svg-processing .user-popover {
    background: rgba(24, 30, 40, 0.98);
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
}

html[data-ui-theme="dark"] body.ui-theme-svg-processing .popover-name,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .popover-link { color: #e5e7eb; }
html[data-ui-theme="dark"] body.ui-theme-svg-processing .popover-email,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .balance-label { color: #9aa6b6; }
html[data-ui-theme="dark"] body.ui-theme-svg-processing .popover-balance,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .popover-link:hover { background: #202735; }
html[data-ui-theme="dark"] body.ui-theme-svg-processing .popover-link.danger:hover { background: #3a252b; }

html[data-ui-theme="dark"] body.ui-theme-svg-processing .workflow-entry-switch {
    background: #191f2a;
    border-color: #303948;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

html[data-ui-theme="dark"] body.ui-theme-svg-processing .workflow-entry-actions {
    background: #111720;
    border-color: #303948;
}

html[data-ui-theme="dark"] body.ui-theme-svg-processing .workflow-entry-btn { color: #9aa6b6; }
html[data-ui-theme="dark"] body.ui-theme-svg-processing .workflow-entry-btn:hover { color: #edf2f7; background: #252e3c; }
html[data-ui-theme="dark"] body.ui-theme-svg-processing .workflow-entry-btn.active { color: #fff; background: #4f6fba; }

html[data-ui-theme="dark"] body.ui-theme-svg-processing .toolbar-btn.toolbar-btn-primary,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .flat-actions .primary {
    color: #fff;
    background: #5b7fdf;
    border-color: #6f91dc;
    box-shadow: 0 8px 20px rgba(79, 111, 186, 0.24);
}

html[data-ui-theme="dark"] body.ui-theme-svg-processing .toolbar-btn.toolbar-btn-primary:hover,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .flat-actions .primary:hover {
    background: #6d8fe8;
    border-color: #86a5f2;
}

html[data-ui-theme="dark"] body.ui-theme-svg-processing progress,
html[data-ui-theme="dark"] body.ui-theme-svg-processing progress::-webkit-progress-bar,
html[data-ui-theme="dark"] body.ui-theme-svg-processing input[type="range"] { background: #303a49; }

html[data-ui-theme="dark"] body.ui-theme-svg-processing input[type="range"]::-webkit-slider-thumb,
html[data-ui-theme="dark"] body.ui-theme-svg-processing input[type="range"]::-moz-range-thumb { border-color: #1d2430; }

html[data-ui-theme="dark"] body.ui-theme-svg-processing .advanced-desktop-notice,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .advanced-desktop-copy,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .advanced-desktop-notice .desktop-download-cta { color: #9aa6b6; }

html[data-ui-theme="dark"] body.ui-theme-svg-processing .advanced-result.error {
    color: #fecaca;
    background: #3a252b;
    border-color: #7f3d4b;
}

/* The rendered bitmap/canvas/SVG artboard stays light without changing SVG attributes. */
html[data-ui-theme="dark"] body.ui-theme-svg-processing #preview-viewport.has-preview #canvas-container {
    color-scheme: light;
    background: #fff;
}

/* System notifications intentionally keep the same light appearance on every page. */
.system-notification-popup-card {
    color-scheme: light;
    color: #0f172a !important;
    background: #fff !important;
}

.system-notification-popup-card .system-notification-popup-header {
    background: #fff !important;
    border-color: #e2e8f0 !important;
}

.system-notification-popup-card .system-notification-popup-title {
    color: #0f172a !important;
}

.system-notification-popup-card .system-notification-popup-subtitle {
    color: #64748b !important;
}

.system-notification-popup-card .system-notification-popup-close {
    color: #334155 !important;
    background: #f1f5f9 !important;
}

.system-notification-popup-card .system-notification-popup-close:hover {
    background: #e2e8f0 !important;
}

.system-notification-popup-card .system-notification-popup-body {
    color: #334155;
    background: #fff;
}

.system-notification-popup-card .system-notification-popup-footer {
    background: #fff;
}

body.ui-theme-image-gen #actionContainer {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
}

body.ui-theme-image-gen #actionContainer > #generateBtn:only-child {
    grid-column: 1 / -1;
}

body.ui-theme-image-gen #actionContainer > #generateBtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    min-height: 78px;
    padding: 11px 18px;
    line-height: 1.15;
    text-align: center;
    white-space: normal;
}

body.ui-theme-image-gen #generateBtn .generate-btn-title,
body.ui-theme-image-gen #generateBtn .generate-btn-detail {
    display: block;
    max-width: 100%;
}

body.ui-theme-image-gen #generateBtn .generate-btn-title {
    white-space: nowrap;
    line-height: 1.08;
}
body.ui-theme-image-gen #generateBtn .generate-btn-detail {
    font-size: 0.78em;
    font-weight: 700;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

@media (max-width: 680px) {
    .theme-toggle-label { display: none; }
    .theme-toggle { width: 36px; padding: 0; }

    body.ui-theme-svg-processing .nav-links .theme-toggle,
    body.ui-theme-image-upscale .nav-links .theme-toggle,
    body.ui-theme-image-cutout .nav-links .theme-toggle {
        order: -1;
    }
}
