body.xcg-night.infinite-canvas-open {
    color-scheme: dark;
}

body.xcg-night.infinite-canvas-open :is(.nic-context-menu, .nic-account-popover, .nic-wallet-block, .nic-crop-dialog, .nic-repaint-dialog, .nic-highres-dialog, .nic-expand-dialog, .nic-repaint-side, .nic-crop-preview-panel, .nic-loading-panel, .nic-limit-warning-dialog, .nic-repaint-model-popover) {
    background: #20252b !important;
    border-color: #46515f !important;
    color: #edf2f7 !important;
}

body.xcg-night.infinite-canvas-open :is(.nic-node-toolbar, .nic-result-toolbar, .nic-batchbar, .nic-crop-head, .nic-crop-foot, .nic-repaint-head, .nic-repaint-foot, .nic-repaint-toolbar, .nic-highres-head, .nic-highres-foot, .nic-expand-head, .nic-expand-foot, .nic-expand-toolbar) {
    background: #272e37 !important;
    border-color: #46515f !important;
    color: #edf2f7 !important;
}

body.xcg-night.infinite-canvas-open :is(.nic-account-chip, .nic-account-chip-icon, .nic-account-avatar, .nic-account-profile, .nic-account-head, .nic-account-popover-total, .nic-account-popover-grid div, .nic-account-popover-list div, .nic-wallet-stat-grid div, .nic-account-stats div, .nic-wallet-log-item, .nic-wallet-empty, .nic-wallet-status, .nic-limit-stepper, .nic-repaint-tool-group, .nic-reverse-result, .nic-reverse-tool-state, .nic-reverse-tool-summary, .nic-highres-source, .nic-expand-target, .nic-status, .nic-empty) {
    background: #303944 !important;
    border-color: #506071 !important;
    color: #edf2f7 !important;
}

body.xcg-night.infinite-canvas-open :is(.nic-account-user-copy strong, .nic-account-popover-grid strong, .nic-account-popover-list strong, .nic-account-profile strong, .nic-wallet-stat-grid strong, .nic-account-stats strong, .nic-wallet-block-head, .nic-wallet-log-item strong, .nic-wallet-log-item b, .nic-account-head-top strong, .nic-account-menu-list strong, .nic-list-name, .nic-node-prompt, .nic-reverse-result p, .nic-reverse-tool-title, .nic-reverse-tool-state strong, .nic-crop-title, .nic-crop-preview-title, .nic-repaint-title, .nic-repaint-side-title, .nic-repaint-brush, .nic-repaint-model, .nic-highres-title, .nic-highres-model, .nic-expand-title, .nic-expand-side-title, .nic-recent-title, .nic-batch-count, .nic-chat-result-state strong) {
    color: #edf2f7 !important;
}

body.xcg-night.infinite-canvas-open :is(.nic-kicker, .nic-search-icon, .nic-panel-sub, .nic-account-user-copy small, .nic-account-popover-head small, .nic-account-popover-head span, .nic-account-popover-note, .nic-account-popover-grid span, .nic-account-popover-list span, .nic-account-profile span, .nic-wallet-stat-grid span, .nic-account-stats span, .nic-wallet-block-head span, .nic-wallet-usage-date, .nic-wallet-usage-meta, .nic-wallet-log-item span, .nic-wallet-pagination span, .nic-account-head-top span, .nic-account-menu-list span, .nic-list-meta, .nic-node-meta, .nic-reverse-label, .nic-reverse-summary, .nic-reverse-tool-summary, .nic-reverse-tool-state small, .nic-crop-kicker, .nic-crop-preview-meta, .nic-repaint-kicker, .nic-repaint-model-label, .nic-repaint-model-chevron, .nic-repaint-model-popover-head, .nic-repaint-mode-note, .nic-repaint-hint, .nic-repaint-meta, .nic-repaint-model-empty, .nic-highres-kicker, .nic-highres-model-label, .nic-highres-section-title, .nic-highres-empty, .nic-highres-meta, .nic-highres-option span, .nic-expand-kicker, .nic-expand-ratio-title, .nic-expand-ratio > span:last-child, .nic-loading-panel small, .nic-limit-warning-copy p, .nic-node-pending small, .nic-chat-result-state small) {
    color: #bcc8d6 !important;
}

body.xcg-night.infinite-canvas-open :is(.nic-search input, .nic-limit-input, .nic-composer-input) {
    color: #edf2f7 !important;
    caret-color: #ffffff;
}

body.xcg-night.infinite-canvas-open :is(.nic-wallet-cdk-input, .nic-repaint-prompt, .nic-reverse-tool-output) {
    background: #171d25 !important;
    color: #edf2f7 !important;
    border-color: #617184 !important;
    caret-color: #ffffff;
}

body.xcg-night.infinite-canvas-open :is(.nic-search input, .nic-composer-input, .nic-wallet-cdk-input, .nic-repaint-prompt)::placeholder {
    color: #aab8c8 !important;
}

body.xcg-night.infinite-canvas-open :is(.nic-icon-btn, .nic-action-btn, .nic-action-icon-btn, .nic-account-popover-close, .nic-account-popover-button, .nic-wallet-cdk-row button, .nic-wallet-pagination button, .nic-account-menu-list button, .nic-account-logout, .nic-composer-pill, .nic-composer-round, .nic-composer-send, .nic-reverse-btn, .nic-image-action-btn, .nic-crop-close, .nic-crop-secondary, .nic-crop-primary, .nic-crop-ratio, .nic-repaint-close, .nic-repaint-secondary, .nic-repaint-primary, .nic-repaint-tool, .nic-repaint-clear, .nic-repaint-model-current, .nic-repaint-mode, .nic-highres-close, .nic-highres-secondary, .nic-highres-primary, .nic-highres-option, .nic-expand-close, .nic-expand-ratio, .nic-limit-warning-btn, .nic-batchbar button) {
    background: #303944 !important;
    color: #edf2f7 !important;
    border-color: #617184 !important;
}

body.xcg-night.infinite-canvas-open :is(.nic-context-menu button, .nic-node-tool, .nic-tool-btn, .nic-canvas-tool, .nic-limit-step, .nic-corner-close) {
    color: #edf2f7 !important;
}

body.xcg-night.infinite-canvas-open :is(.nic-icon-btn, .nic-action-btn, .nic-action-icon-btn, .nic-context-menu button, .nic-account-chip, .nic-account-menu-list button, .nic-wallet-pagination button, .nic-node-tool, .nic-tool-btn, .nic-canvas-tool, .nic-composer-pill, .nic-crop-ratio, .nic-crop-secondary, .nic-repaint-tool, .nic-repaint-mode, .nic-repaint-model-current, .nic-highres-option, .nic-expand-ratio, .nic-limit-step):hover:not(:disabled) {
    background: #3d4c5e !important;
    color: #ffffff !important;
}

body.xcg-night.infinite-canvas-open :is(.nic-composer-menu, #infinite-canvas-composer-menu) {
    background: #20252b !important;
    border-color: #617184 !important;
    color: #edf2f7 !important;
}

body.xcg-night.infinite-canvas-open :is(.nic-composer-menu-option, .nic-composer-size-tab, .nic-composer-aspect-tile) {
    background: transparent !important;
    color: #edf2f7 !important;
}

body.xcg-night.infinite-canvas-open :is(.nic-composer-menu-label, .nic-composer-menu-check, .nic-composer-aspect-label) {
    color: inherit !important;
}

body.xcg-night.infinite-canvas-open :is(.nic-composer-menu-head, .nic-composer-menu-note, .nic-composer-visual-title, .nic-composer-menu-empty) {
    color: #bcc8d6 !important;
}

body.xcg-night.infinite-canvas-open :is(.nic-composer-menu-option, .nic-composer-size-tab, .nic-composer-aspect-tile):hover:not(:disabled) {
    background: #354357 !important;
}

body.xcg-night.infinite-canvas-open :is(.nic-composer-menu-option, .nic-composer-size-tab, .nic-composer-aspect-tile, .nic-crop-ratio, .nic-repaint-mode, .nic-highres-option, .nic-expand-ratio, .nic-canvas-tool).is-active {
    background: #294563 !important;
    border-color: #8bc4ff !important;
    color: #ffffff !important;
}

body.xcg-night.infinite-canvas-open :is(.nic-composer-aspect-mark .zt-ratio-frame, .nic-composer-menu-mark .zt-ratio-frame, .nic-composer-aspect-fallback) {
    background: #35475c !important;
    border-color: #c4d7ee !important;
}

body.xcg-night.infinite-canvas-open :is(.nic-composer-send, .nic-account-popover-button, .nic-wallet-cdk-row button, .nic-crop-primary, .nic-repaint-primary, .nic-highres-primary, .nic-limit-warning-btn.primary, .nic-reverse-btn.primary, .nic-batch-download) {
    background: #294563 !important;
    border-color: #8bc4ff !important;
    color: #ffffff !important;
}

body.xcg-night.infinite-canvas-open :is(.nic-icon-btn, .nic-action-btn, .nic-context-menu button, .nic-wallet-pagination button, .nic-composer-menu-option, .nic-composer-size-tab, .nic-composer-aspect-tile, .nic-composer-send, .nic-crop-primary, .nic-repaint-primary, .nic-repaint-tool, .nic-highres-primary):disabled {
    background: #252d37 !important;
    color: #aab8c8 !important;
    border-color: #46515f !important;
}

body.xcg-night.infinite-canvas-open :is(.nic-node-pending, .nic-chat-result-state, .nic-crop-loading, .nic-repaint-loading, .nic-expand-loading) {
    background: #272e37 !important;
    color: #edf2f7 !important;
    border-color: #506071 !important;
}

body.xcg-night.infinite-canvas-open :is(.nic-status.is-error, .nic-node-pending.failed, .nic-chat-result-state.failed, .nic-crop-error, .nic-repaint-error, .nic-expand-error, .nic-reverse-tool-state.is-error, .nic-batch-delete) {
    background: #442a32 !important;
    color: #ffc2c7 !important;
    border-color: #c27882 !important;
}

body.xcg-night.infinite-canvas-open :is(.nic-action-btn.danger, .nic-action-icon-btn.danger, .nic-context-menu button.danger, .nic-highres-source.is-error) {
    color: #ffc2c7 !important;
}

body.xcg-night.infinite-canvas-open .nic-status.is-success {
    background: #203d32 !important;
    color: #a9ebc7 !important;
    border-color: #6bad8d !important;
}

body.xcg-night.infinite-canvas-open .nic-wallet-usage-track,
body.xcg-night.infinite-canvas-open .nic-limit-range::-webkit-slider-runnable-track {
    background: #46515f;
}

body.xcg-night.infinite-canvas-open :is(.nic-projects, .nic-project-card, .nic-project-preview, .nic-project-actions-menu, .nic-project-dialog, .nic-project-guide-card, .nic-project-guide-context, .nic-project-guide-compose, .nic-project-guide-target) {
    background: #20252b !important;
    border-color: #506071 !important;
    color: #edf2f7 !important;
}

body.xcg-night.infinite-canvas-open :is(.nic-projects-heading strong, .nic-project-copy strong, .nic-project-preview header strong, .nic-project-dialog-copy strong) {
    color: #edf2f7 !important;
}

body.xcg-night.infinite-canvas-open :is(.nic-projects-heading span, .nic-project-new-card small, .nic-project-loading, .nic-project-empty-copy, .nic-project-preview header span, .nic-project-preview-loading, .nic-project-preview-empty, .nic-project-dialog-copy span, .nic-project-dialog label span, .nic-project-guide-card p) {
    color: #bcc8d6 !important;
}

body.xcg-night.infinite-canvas-open :is(.nic-project-copy small, .nic-project-more, .nic-project-create-compact, .nic-project-new-card, .nic-project-new-card > span, .nic-project-scroll-button, .nic-project-dialog-mark, .nic-project-dialog-actions button, .nic-project-guide-trigger, .nic-project-guide-actions button, .nic-project-preview header button, .nic-project-actions-menu button) {
    background: #303944 !important;
    color: #edf2f7 !important;
    border-color: #617184 !important;
}

body.xcg-night.infinite-canvas-open .nic-project-dialog input {
    background: #171d25 !important;
    color: #edf2f7 !important;
    border-color: #617184 !important;
    caret-color: #ffffff;
}

body.xcg-night.infinite-canvas-open .nic-project-dialog input::placeholder {
    color: #aab8c8 !important;
}

body.xcg-night.infinite-canvas-open :is(.nic-project-more, .nic-project-new-card, .nic-project-actions-menu button, .nic-project-dialog-actions button, .nic-project-guide-actions button):hover {
    background: #3d4c5e !important;
}

body.xcg-night.infinite-canvas-open :is(.nic-project-card.is-active, .nic-project-dialog-actions button[type="submit"], .nic-project-guide-actions button.primary) {
    background: #294563 !important;
    border-color: #8bc4ff !important;
    color: #ffffff !important;
}

body.xcg-night.infinite-canvas-open .nic-project-card.is-active::after {
    background: #8bc4ff !important;
}

body.xcg-night.infinite-canvas-open .nic-project-actions-menu button.danger {
    color: #ffc2c7 !important;
}

body.xcg-night.infinite-canvas-open .nic-project-dialog-backdrop {
    background: rgba(8, 12, 18, .72) !important;
}

body.xcg-night.infinite-canvas-open :is(.nano-recharge-dialog, .nano-pricing-dialog, .nano-invoice-dialog, .reference-compress-panel) {
    background: #20252b !important;
    color: #edf2f7 !important;
    border-color: #506071 !important;
}

body.xcg-night.infinite-canvas-open :is(.nano-sheet-title, .nano-recharge-title, .nano-pricing-model, .nano-recharge-card-title, .nano-recharge-price, .nano-recharge-credit-value, .reference-compress-stat strong) {
    color: #edf2f7 !important;
}

body.xcg-night.infinite-canvas-open :is(.nano-sheet-kicker, .nano-sheet-subtitle, .nano-pricing-note, .nano-recharge-card-sub, .nano-recharge-credit-label, .nano-recharge-meta li, .reference-compress-stat span, .reference-compress-status) {
    color: #bcc8d6 !important;
}

body.xcg-night.infinite-canvas-open :is(.nano-pricing-table, .nano-pricing-head, .nano-pricing-row, .nano-pricing-cost, .nano-recharge-ticker, .nano-recharge-ticker-plan, .reference-compress-stat) {
    background: #303944 !important;
    color: #edf2f7 !important;
    border-color: #617184 !important;
}

body.xcg-night.infinite-canvas-open :is(.nano-pricing-cost > span, .nano-recharge-ticker-item, .nano-recharge-ticker-user) {
    color: #edf2f7 !important;
}

body.xcg-night.infinite-canvas-open :is(.nano-pricing-cost strong, .nano-recharge-ticker-plan) {
    color: #ffe0a7 !important;
}

body.xcg-night.infinite-canvas-open .nano-recharge-ticker-credit {
    color: #a9ebc7 !important;
}

body.xcg-night.infinite-canvas-open .nic-wallet-usage-track div {
    background: #8bc4ff;
}

body.xcg-night.infinite-canvas-open :is(.nic-crop-modal, .nic-repaint-modal, .nic-highres-modal, .nic-expand-modal, .nic-loading, .nic-limit-warning) {
    background: rgba(8, 12, 18, .72) !important;
}

body.xcg-night.infinite-canvas-open :is(.nic-wallet-cdk-input, .nic-repaint-prompt, .nic-reverse-tool-output, .nic-composer-pill, .nic-context-menu button):focus-visible {
    outline: 2px solid #8bc4ff;
    outline-offset: 2px;
}


/* v2: keep every image-tool surface readable in x-cg.cn night canvas. */
body.xcg-night.infinite-canvas-open :is(
    .nic-crop-dialog,
    .nic-repaint-dialog,
    .nic-highres-dialog,
    .nic-expand-dialog,
    .nic-reverse-dialog,
    .nic-crop-body,
    .nic-repaint-body,
    .nic-highres-body,
    .nic-expand-body,
    .nic-reverse-tool-body
) {
    background: #20252b !important;
    color: #edf2f7 !important;
}

body.xcg-night.infinite-canvas-open :is(
    .nic-crop-stage-shell,
    .nic-highres-preview,
    .nic-reverse-tool-preview
) {
    background: #171d25 !important;
    border-color: #46515f !important;
}

body.xcg-night.infinite-canvas-open :is(
    .nic-crop-preview-panel,
    .nic-repaint-side,
    .nic-highres-config,
    .nic-expand-side,
    .nic-reverse-tool-side
) {
    background: #20252b !important;
    border-color: #46515f !important;
    color: #edf2f7 !important;
}

body.xcg-night.infinite-canvas-open :is(
    .nic-repaint-prompt,
    #nic-expand-prompt,
    .nic-reverse-tool-output
) {
    background: #171d25 !important;
    color: #edf2f7 !important;
    border-color: #617184 !important;
    caret-color: #ffffff;
}

body.xcg-night.infinite-canvas-open :is(
    .nic-repaint-prompt,
    #nic-expand-prompt,
    .nic-reverse-tool-output
)::placeholder {
    color: #aab8c8 !important;
}

body.xcg-night.infinite-canvas-open :is(
    .nic-crop-preview-title,
    .nic-crop-preview-meta,
    .nic-highres-model-label,
    .nic-highres-section-title,
    .nic-highres-meta,
    .nic-expand-ratio-title,
    .nic-repaint-model-label,
    .nic-repaint-model-chevron,
    .nic-repaint-model-popover-head,
    .nic-repaint-mode-note,
    .nic-repaint-hint,
    .nic-repaint-meta,
    .nic-reverse-tool-summary,
    .nic-reverse-tool-state small
) {
    color: #bcc8d6 !important;
}

body.xcg-night.infinite-canvas-open :is(
    .nic-highres-source,
    .nic-reverse-tool-state,
    .nic-reverse-tool-summary,
    .nic-expand-target,
    .nic-repaint-tool-group,
    .nic-repaint-model-current
) {
    background: #303944 !important;
    border-color: #506071 !important;
    color: #edf2f7 !important;
}

body.xcg-night.infinite-canvas-open :is(
    .nic-repaint-model-popover,
    .nic-repaint-mode,
    .nic-repaint-model-empty
) {
    background: #20252b !important;
    border-color: #46515f !important;
    color: #edf2f7 !important;
}

body.xcg-night.infinite-canvas-open :is(
    .nic-repaint-mode:hover:not(:disabled),
    .nic-repaint-mode.is-active
) {
    background: #294563 !important;
    border-color: #8bc4ff !important;
    color: #ffffff !important;
}

body.xcg-night.infinite-canvas-open :is(
    .nic-crop-ratio,
    .nic-repaint-tool,
    .nic-repaint-clear,
    .nic-repaint-model-current,
    .nic-highres-option,
    .nic-expand-ratio,
    .nic-highres-secondary,
    .nic-highres-primary,
    .nic-reverse-tool-side button
) {
    color: #edf2f7 !important;
}

body.xcg-night.infinite-canvas-open #nic-repaint-frame-controls {
    color: #edf2f7 !important;
}

body.xcg-night.infinite-canvas-open #nic-repaint-frame-controls :is(button, select) {
    background: #303944 !important;
    color: #edf2f7 !important;
    border-color: #617184 !important;
}

body.xcg-night.infinite-canvas-open #nic-repaint-frame-controls option {
    background: #20252b !important;
    color: #edf2f7 !important;
}

body.xcg-night.infinite-canvas-open :is(
    .nic-crop-body,
    .nic-repaint-body,
    .nic-highres-body,
    .nic-expand-body,
    .nic-reverse-tool-body
) :is(input, textarea, select) {
    color-scheme: dark;
}
