/* Dark/light Element Plus component overrides */

        /* ================================================
           DARK MODE: Element Plus 全局变量覆盖
           ================================================ */
        body:not(.theme-light) {
            --el-bg-color-overlay: var(--bg-surface);
            --el-bg-color: var(--bg-surface);
            --el-text-color-primary: var(--text-primary);
            --el-text-color-regular: var(--text-secondary);
            --el-border-color-light: var(--border-subtle);
            --el-fill-color-light: var(--bg-hover);
        }

        /* ================================================
           DARK MODE: Element Plus 表格 & 输入组件适配
           ================================================ */
        body:not(.theme-light) .el-table {
            --el-table-bg-color: var(--bg-surface) !important;
            --el-table-tr-bg-color: var(--bg-surface) !important;
            --el-table-header-bg-color: var(--bg-elevated) !important;
            --el-table-row-hover-bg-color: var(--bg-hover) !important;
            --el-table-border-color: var(--border-subtle) !important;
            --el-table-text-color: var(--text-primary) !important;
            --el-table-header-text-color: var(--text-secondary) !important;
            color: var(--text-primary) !important;
            background: var(--bg-surface) !important;
        }
        body:not(.theme-light) .el-table th.el-table__cell {
            background: var(--bg-elevated) !important;
            color: var(--text-secondary) !important;
            border-bottom-color: var(--border-default) !important;
        }
        body:not(.theme-light) .el-table td.el-table__cell {
            border-bottom-color: var(--border-subtle) !important;
            border-right-color: var(--border-subtle) !important;
        }
        body:not(.theme-light) .el-table th.el-table__cell.is-leaf {
            border-bottom-color: var(--border-default) !important;
        }
        body:not(.theme-light) .el-table--border .el-table__cell {
            border-right-color: var(--border-subtle) !important;
        }
        body:not(.theme-light) .el-table--border::after,
        body:not(.theme-light) .el-table--group::after,
        body:not(.theme-light) .el-table::before {
            background-color: var(--border-subtle) !important;
        }
        body:not(.theme-light) .el-table__empty-block {
            background: var(--bg-surface) !important;
        }
        body:not(.theme-light) .el-table__empty-text {
            color: var(--text-tertiary) !important;
        }
        body:not(.theme-light) .el-table .el-table__row:hover > td.el-table__cell {
            background: var(--bg-hover) !important;
        }

        /* 表格内输入框 */
        body:not(.theme-light) .el-table .el-input__wrapper {
            background-color: var(--bg-base) !important;
            border: 1px solid var(--border-subtle) !important;
            box-shadow: none !important;
        }
        body:not(.theme-light) .el-table .el-input__wrapper:hover {
            border-color: var(--border-default) !important;
        }
        body:not(.theme-light) .el-table .el-input__wrapper.is-focus {
            border-color: var(--accent) !important;
        }
        body:not(.theme-light) .el-table .el-input__inner {
            color: var(--text-primary) !important;
        }
        body:not(.theme-light) .el-table .el-textarea__inner {
            background-color: var(--bg-base) !important;
            border: 1px solid var(--border-subtle) !important;
            color: var(--text-primary) !important;
            box-shadow: none !important;
        }

        /* 表格内 input-number */
        body:not(.theme-light) .el-table .el-input-number--small {
            background: transparent !important;
        }
        body:not(.theme-light) .el-table .el-input-number .el-input__wrapper {
            background-color: var(--bg-base) !important;
        }

        /* 筛选栏 select */
        body:not(.theme-light) .el-select__wrapper {
            background-color: var(--bg-elevated) !important;
            border: 1px solid var(--border-subtle) !important;
            box-shadow: none !important;
        }
        body:not(.theme-light) .el-select__wrapper:hover {
            border-color: var(--border-default) !important;
        }
        body:not(.theme-light) .el-select__wrapper.is-focused {
            border-color: var(--accent) !important;
        }
        body:not(.theme-light) .el-select__placeholder,
        body:not(.theme-light) .el-cascader__placeholder,
        body:not(.theme-light) .el-select__selected-item span {
            color: var(--text-primary) !important;
        }
        body:not(.theme-light) .el-select__caret {
            color: var(--text-tertiary) !important;
        }
        body:not(.theme-light) .el-select-dropdown,
        body:not(.theme-light) .el-dropdown__popper,
        body:not(.theme-light) .el-dropdown__popper.is-light {
            background: var(--bg-surface) !important;
            border: 1px solid var(--border-default) !important;
            box-shadow: var(--shadow-md) !important;
        }
        body:not(.theme-light) .el-dropdown-menu {
            background: transparent !important;
            border: none !important;
            box-shadow: none !important;
        }
        body:not(.theme-light) .el-select-dropdown__item,
        body:not(.theme-light) .el-dropdown-menu__item {
            color: var(--text-secondary) !important;
        }
        body:not(.theme-light) .el-select-dropdown__item:hover,
        body:not(.theme-light) .el-select-dropdown__item.hover,
        body:not(.theme-light) .el-dropdown-menu__item:hover,
        body:not(.theme-light) .el-dropdown-menu__item:focus {
            background: var(--bg-hover) !important;
        }
        body:not(.theme-light) .el-select-dropdown__item.is-selected {
            color: var(--accent) !important;
            font-weight: 500 !important;
        }
        body:not(.theme-light) .el-select-dropdown__empty {
            color: var(--text-tertiary) !important;
        }

        /* 全局输入框（非表格内） */
        body:not(.theme-light) .el-input__wrapper {
            background-color: var(--bg-elevated) !important;
            border: 1px solid var(--border-subtle) !important;
            box-shadow: none !important;
        }
        body:not(.theme-light) .el-input__wrapper:hover {
            border-color: var(--border-default) !important;
        }
        body:not(.theme-light) .el-input__wrapper.is-focus {
            border-color: var(--accent) !important;
        }
        body:not(.theme-light) .el-input__inner {
            color: var(--text-primary) !important;
        }
        body:not(.theme-light) .el-input__inner::placeholder {
            color: var(--text-tertiary) !important;
        }
        body:not(.theme-light) .el-textarea__inner {
            background-color: var(--bg-elevated) !important;
            border: 1px solid var(--border-subtle) !important;
            color: var(--text-primary) !important;
            box-shadow: none !important;
        }

        /* input-number */
        body:not(.theme-light) .el-input-number .el-input__wrapper {
            background-color: var(--bg-elevated) !important;
        }
        body:not(.theme-light) .el-input-number__decrease,
        body:not(.theme-light) .el-input-number__increase {
            background: var(--bg-hover) !important;
            border-color: var(--border-subtle) !important;
            color: var(--text-secondary) !important;
        }
        body:not(.theme-light) .el-input-number__decrease:hover,
        body:not(.theme-light) .el-input-number__increase:hover {
            color: var(--accent) !important;
        }

        /* checkbox */
        body:not(.theme-light) .el-checkbox__label {
            color: var(--text-secondary) !important;
        }
        body:not(.theme-light) .el-checkbox__input.is-checked + .el-checkbox__label {
            color: var(--accent) !important;
        }

        /* tag */
        body:not(.theme-light) .el-tag {
            border-color: var(--border-subtle) !important;
        }

        /* button */
        body:not(.theme-light) .el-button--default {
            background: var(--bg-elevated) !important;
            border-color: var(--border-default) !important;
            color: var(--text-secondary) !important;
        }
        body:not(.theme-light) .el-button--default:hover {
            background: var(--bg-hover) !important;
            border-color: var(--accent) !important;
            color: var(--accent) !important;
        }
        body:not(.theme-light) .el-button--default.is-disabled,
        body:not(.theme-light) .el-button--default.is-disabled:hover {
            background: var(--bg-elevated) !important;
            border-color: var(--border-subtle) !important;
            color: var(--text-tertiary) !important;
            opacity: 0.5;
        }
        body:not(.theme-light) .el-button--success {
            background: rgba(103, 194, 58, 0.15) !important;
            border-color: rgba(103, 194, 58, 0.4) !important;
            color: #67C23A !important;
        }
        body:not(.theme-light) .el-button--success:hover {
            background: rgba(103, 194, 58, 0.25) !important;
            border-color: rgba(103, 194, 58, 0.6) !important;
            color: #85ce61 !important;
        }
        body:not(.theme-light) .el-button--danger.is-plain {
            background: rgba(245, 108, 108, 0.1) !important;
            border-color: rgba(245, 108, 108, 0.35) !important;
            color: #F56C6C !important;
        }
        body:not(.theme-light) .el-button--danger.is-plain:hover {
            background: rgba(245, 108, 108, 0.2) !important;
            border-color: rgba(245, 108, 108, 0.5) !important;
            color: #f78989 !important;
        }
        body:not(.theme-light) .el-button--danger.is-plain.is-disabled,
        body:not(.theme-light) .el-button--danger.is-plain.is-disabled:hover {
            background: rgba(245, 108, 108, 0.05) !important;
            border-color: rgba(245, 108, 108, 0.15) !important;
            color: rgba(245, 108, 108, 0.4) !important;
        }
        body:not(.theme-light) .el-button--primary {
            background: rgba(64, 158, 255, 0.15) !important;
            border-color: rgba(64, 158, 255, 0.4) !important;
            color: #409EFF !important;
        }
        body:not(.theme-light) .el-button--primary:hover {
            background: rgba(64, 158, 255, 0.25) !important;
            border-color: rgba(64, 158, 255, 0.6) !important;
            color: #66b1ff !important;
        }

        /* tooltip */
        body:not(.theme-light) .el-tooltip__trigger {
            outline: none !important;
        }

        /* dialog */
        body:not(.theme-light) .el-dialog {
            background: var(--bg-elevated) !important;
            border: 1px solid var(--border-default) !important;
            box-shadow: var(--shadow-lg) !important;
        }
        body:not(.theme-light) .el-dialog__header {
            color: var(--text-primary) !important;
        }
        body:not(.theme-light) .el-dialog__title {
            color: var(--text-primary) !important;
        }
        body:not(.theme-light) .el-dialog__body {
            color: var(--text-secondary) !important;
        }
        body:not(.theme-light) .el-dialog__headerbtn .el-dialog__close {
            color: var(--text-tertiary) !important;
        }
        body:not(.theme-light) .el-dialog__headerbtn .el-dialog__close:hover {
            color: var(--text-primary) !important;
        }
        body:not(.theme-light) .el-overlay {
            background-color: rgba(0, 0, 0, 0.55) !important;
        }

        /* drawer */
        body:not(.theme-light) .el-drawer {
            background: var(--bg-surface) !important;
        }
        body:not(.theme-light) .el-drawer__header {
            background: var(--bg-elevated) !important;
            color: var(--text-primary) !important;
            border-bottom: 1px solid var(--border-subtle) !important;
        }
        body:not(.theme-light) .el-drawer__body {
            background: var(--bg-surface) !important;
            color: var(--text-secondary) !important;
        }
        body:not(.theme-light) .el-drawer__headerbtn .el-drawer__close {
            color: var(--text-tertiary) !important;
        }
        body:not(.theme-light) .el-drawer__headerbtn .el-drawer__close:hover {
            color: var(--text-primary) !important;
        }

        /* message-box (confirm dialogs) */
        body:not(.theme-light) .el-message-box {
            background: var(--bg-elevated) !important;
            border: 1px solid var(--border-default) !important;
        }
        body:not(.theme-light) .el-message-box__title {
            color: var(--text-primary) !important;
        }
        body:not(.theme-light) .el-message-box__content {
            color: var(--text-secondary) !important;
        }

        /* popover */
        body:not(.theme-light) .el-popover {
            background: var(--bg-surface) !important;
            border: 1px solid var(--border-default) !important;
            color: var(--text-secondary) !important;
        }

        /* switch */
        body:not(.theme-light) .el-switch__core {
            background: var(--bg-hover) !important;
            border-color: var(--border-default) !important;
        }
        body:not(.theme-light) .el-switch.is-checked .el-switch__core {
            background: var(--accent) !important;
            border-color: var(--accent) !important;
        }

        /* message toast */
        body:not(.theme-light) .el-message {
            background: var(--bg-elevated) !important;
            border-color: var(--border-default) !important;
        }
        body:not(.theme-light) .el-message__content {
            color: var(--text-primary) !important;
        }

        /* loading spinner */
        body:not(.theme-light) .el-loading-mask {
            background-color: rgba(15, 17, 23, 0.7) !important;
        }

        /* Light theme: 修复 Element Plus 组件的白色/深色冲突 */
        body.theme-light .el-input__wrapper,
        body.theme-light .el-textarea__inner {
            background-color: var(--bg-elevated) !important;
            border: 1px solid var(--border-subtle) !important;
        }

        body.theme-light .el-select__wrapper {
            background-color: var(--bg-elevated) !important;
            border: 1px solid var(--border-subtle) !important;
        }

        body.theme-light .el-select-dropdown,
        body.theme-light .el-dropdown__popper,
        body.theme-light .el-dropdown__popper.is-light {
            background: var(--bg-surface) !important;
            border: 1px solid var(--border-default) !important;
            box-shadow: var(--shadow-md) !important;
        }
        body.theme-light .el-dropdown-menu {
            background: transparent !important;
            border: none !important;
            box-shadow: none !important;
        }

        body.theme-light .el-select-dropdown__item:hover,
        body.theme-light .el-dropdown-menu__item:hover {
            background: var(--bg-hover) !important;
        }

        /* 修复下拉选项对齐问题 */
        .el-select-dropdown__item,
        .el-dropdown-menu__item {
            line-height: 1.5 !important;
            padding-top: 8px !important;
            padding-bottom: 8px !important;
            display: flex !important;
            align-items: center !important;
        }

        body.theme-light .el-select-dropdown__item,
        body.theme-light .el-dropdown-menu__item {
            height: auto !important;
            min-height: 36px !important;
        }

        body.theme-light .el-select-dropdown__item.is-selected {
            color: var(--accent) !important;
            font-weight: 500 !important;
        }

        /* 同时修复级联选择器的选项对齐 */
        .el-cascader-node {
            line-height: 1.5 !important;
            padding-top: 6px !important;
            padding-bottom: 6px !important;
            display: flex !important;
            align-items: center !important;
        }

        body.theme-light .el-cascader-node {
            height: auto !important;
            min-height: 32px !important;
        }

        body.theme-light .el-cascader__wrapper {
            background-color: var(--bg-elevated) !important;
            border: 1px solid var(--border-subtle) !important;
        }

        body.theme-light .el-cascader__dropdown {
            background: var(--bg-surface) !important;
            border: 1px solid var(--border-default) !important;
            box-shadow: var(--shadow-md) !important;
        }

        body.theme-light .el-cascader-menu {
            background: var(--bg-surface) !important;
            border-color: var(--border-default) !important;
        }

        body.theme-light .el-cascader-node:hover {
            background: var(--bg-hover) !important;
        }

        body.theme-light .el-tag {
            background: var(--bg-hover) !important;
            border-color: var(--border-default) !important;
            color: var(--text-secondary) !important;
        }

        body.theme-light .el-checkbox__inner {
            background-color: var(--bg-surface) !important;
            border-color: var(--border-default) !important;
        }

        body.theme-light .el-input-number__decrease,
        body.theme-light .el-input-number__increase {
            background: var(--bg-hover) !important;
            border-color: var(--border-subtle) !important;
            color: var(--text-tertiary) !important;
        }

        body.theme-light .el-dialog {
            background: var(--bg-surface) !important;
            border: 1px solid var(--border-default) !important;
            box-shadow: var(--shadow-lg) !important;
        }

        body.theme-light .el-message {
            background: var(--bg-surface) !important;
            border: 1px solid var(--border-default) !important;
            box-shadow: var(--shadow-md) !important;
        }

        body.theme-light .el-tooltip__popper {
            background: var(--bg-surface) !important;
            border: 1px solid var(--border-default) !important;
            box-shadow: var(--shadow-md) !important;
        }

        body.theme-light .el-tabs--border-card {
            background: var(--bg-surface) !important;
            border: 1px solid var(--border-default) !important;
        }

        body.theme-light .el-tabs--border-card > .el-tabs__header {
            background: var(--bg-elevated) !important;
            border-bottom-color: var(--border-default) !important;
        }

        body.theme-light .el-tabs--border-card > .el-tabs__header .el-tabs__item.is-active {
            background: var(--bg-surface) !important;
        }

        body.theme-light .el-switch {
            --el-switch-off-color: var(--border-default);
        }

        body.theme-light .el-switch__label {
            color: var(--text-tertiary) !important;
        }

        body.theme-light .el-switch__label.is-active {
            color: var(--text-secondary) !important;
        }

        /* Light theme: scrollbar */
        body.theme-light ::-webkit-scrollbar-thumb {
            background: rgba(0,0,0,0.15);
        }

        body.theme-light ::-webkit-scrollbar-thumb:hover {
            background: rgba(0,0,0,0.25);
        }
