@font-face {
    font-family: 'Source Han Sans SC';
    src: url('./SourceHanSans/SourceHanSansSC-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}

/* ============================================
   iPMU Pro - 主题样式 v2.0
   ============================================ */

/* 1. 全局基础 */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--page-loading-bg, #f0f2f6);
}

/* 2. 全页刷新 loading 覆盖层 */
._dash-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    background: var(--page-loading-bg, #0a0a0a);
    font-size: 0;
    color: transparent;
    overflow: hidden;
}

/* 3. 顶部菜单 */
.top-menu-bar {
    backdrop-filter: blur(10px);
}

/* 4. 侧边栏 */
.sidebar-wrapper {
    transition: all 0.3s ease;
}

.sidebar-container {
    overflow-y: hidden;
}

.sidebar-link {
    color: rgba(255, 255, 255, 0.7) !important;
    border-radius: 6px;
    padding: 10px 15px;
    transition: color 0.05s ease;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.sidebar-link:hover {
    color: #fff !important;
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar-link.active {
    color: #fff !important;
    background-color: #0ea5e9 !important;
    font-weight: bold;
}

.sidebar-link-disabled {
    cursor: not-allowed;
}

/* 5. 输入区 */
.input-voltage {
    background-color: #f8fafc;
    border: 1px solid #cbd5e1;
    text-align: right;
    padding-right: 30px;
    transition: all 0.2s ease;
}

.input-voltage:focus {
    background-color: #fff;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.input-voltage.is-invalid {
    border-color: #ef4444;
    background-color: #fef2f2;
}

.input-unit-label {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    font-size: 0.8rem;
    font-weight: bold;
    pointer-events: none;
}

/* 5.1 新输入区样式 */
.input-voltage-new {
    background-color: #f8fafc;
    border: 1px solid #cbd5e1;
    text-align: left;
    padding-right: 4px !important;
    transition: all 0.2s ease;
}

.input-voltage-new:focus {
    background-color: #fff;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.input-voltage-new::placeholder {
    color: #c8d1da;
    font-size: 0.875em;
    font-weight: normal;
}

/* 竖线分隔符 */
.voltage-divider {
    width: 1px;
    background-color: #e2e8f0;
    align-self: stretch;
    margin: 40px 0 20px 0;
}

/* 彩色圆点 */
.color-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.color-dot.phase-a { background-color: #eab308; }
.color-dot.phase-b { background-color: #22c55e; }
.color-dot.phase-c { background-color: #ef4444; }

/* 相电压标签颜色 */
.input-label-phase-a { color: #eab308 !important; }
.input-label-phase-b { color: #22c55e !important; }
.input-label-phase-c { color: #ef4444 !important; }

/* 相电压输入框彩色聚焦 */
.input-voltage-new.phase-a:focus {
    border-color: #eab308 !important;
    box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.2) !important;
}

.input-voltage-new.phase-b:focus {
    border-color: #22c55e !important;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2) !important;
}

.input-voltage-new.phase-c:focus {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2) !important;
}

/* 6. 预设下拉框 */
#preset-dropdown .Select-control {
    background-color: #ffffff !important;
    border-color: #d1d5db !important;
    color: #334155 !important;
    font-size: 14px !important;
}

#preset-dropdown .Select-value-label,
#preset-dropdown .Select-placeholder {
    color: #94a3b8 !important;
    font-size: 14px !important;
}

#preset-dropdown .Select-menu-outer {
    background-color: #ffffff !important;
    border-color: #e2e8f0 !important;
}

#preset-dropdown .Select-option {
    background-color: #ffffff !important;
    color: #334155 !important;
    font-size: 14px !important;
}

#preset-dropdown .Select-option:hover {
    background-color: #f1f5f9 !important;
}

/* 7. 结果区动画 */
.fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 8. 表格样式（铁律7: 居中）*/
.table th,
.table td {
    text-align: center !important;
    vertical-align: middle !important;
}

/* 9. 向量图容器 */
.phasor-chart {
    border-radius: 8px;
    overflow: hidden;
}

/* 10. 卡片悬停效果 */
.card {
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 11. 自定义标签页 */
.custom-tab {
    padding: 10px 20px;
    border: none !important;
    background: transparent !important;
    color: #64748b;
    font-weight: 500;
}

.custom-tab--selected {
    color: #0ea5e9 !important;
    border-bottom: 2px solid #0ea5e9 !important;
    font-weight: bold;
}

/* 12. 响应式调整 */
@media (max-width: 768px) {
    .sidebar-wrapper {
        position: fixed;
        z-index: 999;
    }

    /* P1-1/P1-2: 隐藏右侧栏，主列撑满 */
    #analysis-right-sidebar {
        display: none !important;
    }
    .analysis-main-col {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    /* P1-3: 电压输入区上下堆叠，隐藏竖线 */
    .voltage-input-area {
        flex-direction: column !important;
        gap: 0 !important;
    }
    .voltage-input-area > .voltage-divider {
        display: none !important;
    }

    /* P1-4: 电流输入区上下堆叠，隐藏竖线 */
    .current-input-area {
        flex-direction: column !important;
        gap: 12px !important;
    }
    .current-input-area > .voltage-divider {
        display: none !important;
    }

    /* P1-5: 向量图自适应容器 */
    .phasor-chart {
        min-width: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    /* 序分量图小屏居中 */
    .seq-chart .svg-container {
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* P3-14: 状态栏仅保留引擎状态灯 */
    .status-bar > * {
        display: none !important;
    }
    .status-bar > .status-item:first-child {
        display: flex !important;
    }

    /* 工具栏移动端纵向堆叠 */
    .input-toolbar {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px;
    }
    .input-toolbar > .d-flex {
        flex-direction: column !important;
        width: 100%;
        gap: 8px;
    }
    #preset-dropdown {
        width: 100% !important;
    }
    #btn-reset {
        width: 100%;
    }

    /* Tabs提示伪元素隐藏 */
    #input-tabs::after {
        display: none !important;
    }

    /* P3-13: 电流表格移动端缩放适配 */
    .current-result-table td,
    .current-result-table th {
        font-size: 10px !important;
        padding: 6px 2px !important;
    }

    /* 电压结果表格移动端缩放 */
    .result-data-table td,
    .result-data-table th {
        font-size: 10px !important;
        padding: 6px 2px !important;
    }

    /* 对地参数结果表格移动端缩放 */
    .gnd-result-table th {
        font-size: 10px !important;
        padding: 8px 4px !important;
    }
    .gnd-result-table td {
        font-size: 11px !important;
        padding: 10px 4px !important;
    }
    .gnd-param-value {
        font-size: 13px !important;
    }

    /* 对地参数页iPMU电压输入框：每行3个 */
    .gnd-voltage-row > .col {
        flex: 0 0 33.333% !important;
        max-width: 33.333% !important;
    }

    /* 对地参数：流程步骤条小屏缩放 */
    .gnd-step-pipeline {
        gap: 0 !important;
    }
    .gnd-step-item {
        padding: 6px 8px !important;
        font-size: 11px !important;
    }
    .gnd-step-connector {
        flex: 0 0 16px !important;
    }
    .gnd-step-num {
        width: 20px !important;
        height: 20px !important;
        font-size: 10px !important;
    }

    /* 对地参数：输入模式 Tabs 小屏换行 */
    .gnd-mode-tabs {
        flex-wrap: wrap !important;
        display: flex !important;
    }
    .gnd-mode-tab {
        padding: 8px 12px !important;
        font-size: 12px !important;
    }
    .gnd-mode-tabs > span:last-child {
        display: none !important;
    }
}

/* 13. 打印样式 */
@media print {
    .sidebar-wrapper,
    .top-menu-bar,
    .btn {
        display: none !important;
    }
    
    .page-content-wrapper {
        width: 100% !important;
        margin: 0 !important;
    }
}

/* ==============================================================================
   状态灯样式
   ============================================================================== */
.status-light {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

/* 绿色 - 就绪 */
.status-ready {
    background-color: #22c55e;
    box-shadow: 0 0 6px #22c55e;
}

/* 橙色 - 计算中（闪烁） */
.status-running {
    background-color: #f97316;
    box-shadow: 0 0 6px #f97316;
    animation: pulse-orange 0.8s ease-in-out infinite;
}

@keyframes pulse-orange {
    0%, 100% { opacity: 1; box-shadow: 0 0 6px #f97316; }
    50% { opacity: 0.5; box-shadow: 0 0 12px #f97316; }
}

/* 蓝色 - 计算完成 */
.status-success {
    background-color: #3b82f6;
    box-shadow: 0 0 6px #3b82f6;
}

/* 红色 - 错误 */
.status-error {
    background-color: #ef4444;
    box-shadow: 0 0 6px #ef4444;
}

/* 黄色 - 警告 */
.status-warning {
    background-color: #eab308;
    box-shadow: 0 0 6px #eab308;
}

/* 状态文字 */
.status-text {
    font-size: 14px;
    font-weight: 500;
}


/* ==============================================================================
   预设下拉菜单样式
   ============================================================================== */
#preset-dropdown .Select-control {
    background-color: #ffffff !important;
    border-color: #d1d5db !important;
    font-size: 14px !important;
}

#preset-dropdown .Select-menu-outer {
    background-color: #ffffff !important;
    border-color: #e2e8f0 !important;
}

#preset-dropdown .Select-option {
    background-color: #ffffff !important;
    color: #334155 !important;
    font-size: 14px !important;
}

#preset-dropdown .Select-option:hover,
#preset-dropdown .Select-option.is-focused {
    background-color: #f1f5f9 !important;
    color: #1e293b !important;
}

#preset-dropdown .Select-value-label,
#preset-dropdown .Select-placeholder {
    color: #94a3b8 !important;
    font-size: 14px !important;
}

#preset-dropdown input {
    color: #334155 !important;
}

/* Dash 新版 Dropdown 样式 */
#preset-dropdown .VirtualizedSelectOption {
    background-color: #ffffff !important;
    color: #334155 !important;
    font-size: 14px !important;
}

#preset-dropdown .VirtualizedSelectFocusedOption {
    background-color: #f1f5f9 !important;
    color: #1e293b !important;
    font-size: 14px !important;
}

/* ==============================================================================
   顶部导航链接悬停
   ============================================================================== */
.nav-link-hover:hover {
    color: #0ea5e9 !important;
    transition: color 0.2s ease;
}

/* ==============================================================================
   输入区Tabs样式
   ============================================================================== */
.custom-tab {
    background-color: #f1f5f9 !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px 8px 0 0 !important;
    margin-right: 4px;
    color: #64748b !important;
    font-weight: 500;
    padding: 10px 20px !important;
}

.tab--selected.custom-tab {
    background-color: #ffffff !important;
    border: 2px solid #0ea5e9 !important;
    border-bottom: 2px solid #ffffff !important;
    color: #0ea5e9 !important;
    font-weight: bold !important;
}

#input-tabs > .custom-tab {
    width: auto !important;
}

#input-tabs {
    background-color: #f1f5f9;
    border-radius: 8px 8px 0 0;
}

#input-tabs-parent > .tab-content {
    display: none !important;
}

#input-tabs::after {
    content: "\f431  电流重构输入区默认隐藏，需手动开启";
    font-family: bootstrap-icons, -apple-system, BlinkMacSystemFont, sans-serif;
    margin-left: 16px;
    color: #94a3b8;
    font-size: 12px;
    max-width: 155px;
    line-height: 1.3;
    padding-left: 18px;
    text-indent: -18px;
}
[data-locale="en_US"] #input-tabs::after {
    content: "\f431  Current input hidden by default; enable manually";
}

/* 页面切换防抖动 */
#app-container {
    min-height: 100vh;
}

body {
    overflow-x: hidden;
}


/* 桌面端：向量图精确锁定400px */
@media (min-width: 769px) {
    .phasor-chart {
        min-width: 400px !important;
        max-width: 400px !important;
    }
}

/* 序分量小图固定尺寸 */
.seq-chart {
    min-width: 200px !important;
    min-height: 250px !important;
}



/* ============================================
   侧边栏折叠功能（严格按照示例代码）
   ============================================ */

/* 侧边栏wrapper */
.sidebar-wrapper {
    position: relative;
    z-index: 100;
    transition: width 0.3s ease;
    overflow: visible !important;
}

/* 侧边栏容器 */
.sidebar-container {
    background-color: #1e293b;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden !important;
}

.sidebar-header {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}

.sidebar-section {
    padding: 10px;
}

.sidebar-footer {
    margin-top: auto;
    padding: 10px 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* 边界吸附式折叠按钮 */
.sidebar-toggle-btn {
    position: absolute;
    top: 50%;
    right: -12px;
    transform: translateY(-50%);
    width: 24px;
    height: 48px;
    background-color: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: none;
    border-radius: 0 12px 12px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
    z-index: 9999;
}

.sidebar-toggle-btn:hover {
    background-color: #0ea5e9;
    color: white;
    width: 28px;
}

.sidebar-toggle-btn i {
    font-size: 12px;
    transition: transform 0.3s ease;
}

/* 收缩状态 - 按钮图标旋转 */
.sidebar-wrapper.collapsed .sidebar-toggle-btn i {
    transform: rotate(180deg);
}

.sidebar-inner-wrapper {
    position: relative;
    height: 100%;
    overflow: visible;
}
/* 导航项基础样式（与示例代码一致） */
.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    white-space: nowrap;
    overflow: hidden;
}

.nav-icon {
    font-size: 1.1rem;
    min-width: 24px;
    text-align: center;
    flex-shrink: 0;
}

/* 展开状态 - 图标有右边距 */
.sidebar-wrapper:not(.collapsed) .nav-icon {
    margin-right: 15px;
}

/* 收缩状态 - 隐藏文字和徽章 */
.sidebar-wrapper.collapsed .nav-text,
.sidebar-wrapper.collapsed .nav-badge {
    display: none;
}

/* 收缩状态 - 分类标签隐藏不占位 */
.sidebar-wrapper.collapsed .nav-label {
    display: none;
}

/* 收缩状态 - 图标居中，无右边距 */
.sidebar-wrapper.collapsed .nav-icon {
    margin-right: 0;
}

/* 收缩状态 - 升级按钮：保留原始样式，只隐藏文字 */
.sidebar-wrapper.collapsed .sidebar-header .btn {
    padding: 6px 10px;
    width: auto;
}

.sidebar-wrapper.collapsed .sidebar-header .btn .nav-text {
    display: none !important;
}

.sidebar-wrapper.collapsed .sidebar-header .btn .nav-icon {
    display: inline-block !important;
    visibility: visible !important;
    margin-right: 0 !important;
}

/* 收缩状态 - header固定高度，显示居中用户图标+升级图标 */
.sidebar-wrapper.collapsed .sidebar-header {
    padding: 16px 5px;
    text-align: center;
    height: 92px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

/* 收缩状态 - header内直接子元素不被压缩 */
.sidebar-wrapper.collapsed .sidebar-header > * {
    flex-shrink: 0;
}

.sidebar-wrapper.collapsed .sidebar-section {
    padding: 10px 5px;
}

.sidebar-wrapper.collapsed .sidebar-footer {
    padding: 10px 5px;
}

/* 收缩状态 - 链接居中 */
.sidebar-wrapper.collapsed .sidebar-link {
    justify-content: center;
    padding: 10px 0;
}

/* 收缩状态 - 确保图标可见（visibility防御性覆盖） */
.sidebar-wrapper.collapsed .nav-icon {
    display: inline-block !important;
    visibility: visible !important;
    margin-right: 0 !important;
    font-size: 1.2rem;
}

/* 确保内容区不遮挡按钮 */
.page-content-wrapper {
    position: relative;
    z-index: 1;
}

.sidebar-wrapper {
    z-index: 100;
}

.sidebar-toggle-btn {
    z-index: 200;
}

/* 收缩状态 - header内文字直接隐藏不占位（由固定高度保证对齐） */
.sidebar-wrapper.collapsed .sidebar-header .nav-text {
    display: none !important;
}

/* 收缩状态 - 用户名行icon居中，去掉底部间距 */
.sidebar-wrapper.collapsed .sidebar-header .d-flex {
    justify-content: center;
    width: 100%;
    margin-bottom: 0 !important;
}

/* 收缩状态 - 退出登录图标可见 */
.sidebar-wrapper.collapsed .sidebar-footer .nav-icon {
    display: inline-block !important;
}

.sidebar-wrapper.collapsed .sidebar-footer .nav-text {
    display: none;
}

/* ==============================================================================
   状态栏样式（像素级还原）
   ============================================================================== */

/* 状态栏容器 */
.status-bar {
    display: inline-flex;
    align-items: center;
    background-color: #0f172a;
    border: 1px solid #475569;
    border-radius: 9999px;
    padding: 10px 18px;
    height: 45px;
}

/* 分隔符 */
.status-divider {
    color: #64748b;
    margin: 0 12px;
    font-size: 14px;
    font-weight: 300;
}

/* 状态项容器 */
.status-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    line-height: 1;
}

/* 引擎状态灯 */
.engine-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #22c55e;
    box-shadow: 0 0 6px #22c55e;
    animation: heartbeat 2s ease-in-out infinite;
}

@keyframes heartbeat {
    0%, 100% { box-shadow: 0 0 4px rgba(34, 197, 94, 0.5); }
    50% { box-shadow: 0 0 8px rgba(34, 197, 94, 0.8); }
}

.engine-text {
    color: #cbd5e1;
    font-size: 13px;
}

/* 计算中状态 */
.engine-dot.computing {
    background-color: #f97316;
    box-shadow: 0 0 6px #f97316;
    animation: heartbeat-orange 0.8s ease-in-out infinite;
}

@keyframes heartbeat-orange {
    0%, 100% { box-shadow: 0 0 4px rgba(249, 115, 22, 0.5); opacity: 1; }
    50% { box-shadow: 0 0 8px rgba(249, 115, 22, 0.8); opacity: 0.5; }
}

/* 计算完成状态 */
.engine-dot.completed {
    background-color: #3b82f6;
    box-shadow: 0 0 6px #3b82f6;
    animation: heartbeat-blue 2s ease-in-out infinite;
}

@keyframes heartbeat-blue {
    0%, 100% { box-shadow: 0 0 4px rgba(59, 130, 246, 0.5); }
    50% { box-shadow: 0 0 8px rgba(59, 130, 246, 0.8); }
}

.engine-text.completed {
    color: #60a5fa;
    font-weight: 500;
}

/* 队列样式 */
.queue-icon {
    color: #94a3b8;
    font-size: 14px;
}

.queue-label {
    color: #cbd5e1;
    font-size: 13px;
}

.queue-value {
    color: #fbbf24;
    font-size: 13px;
    font-weight: 500;
}

/* API样式 */
.api-icon {
    color: #94a3b8;
    font-size: 14px;
}

.api-label {
    color: #cbd5e1;
    font-size: 13px;
}

.api-status-online {
    color: #4ade80;
    font-size: 13px;
    font-weight: 500;
}

.api-status-degraded {
    color: #fbbf24;
    font-size: 13px;
    font-weight: 500;
}

/* 用户徽章 */
.user-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid #0ea5e9;
    border-radius: 9999px;
    background-color: rgba(14, 165, 233, 0.1);
}

.user-icon {
    color: #0ea5e9;
    font-size: 13px;
}

.user-count {
    color: #0ea5e9;
    font-size: 13px;
    font-weight: 600;
}

/* 用户徽章降级状态 */
.user-badge.degraded {
    border-color: #64748b;
    background: transparent;
}

.user-badge.degraded .user-icon,
.user-badge.degraded .user-count {
    color: #94a3b8;
}

/* ==============================================================================
   相量计算器弹窗样式
   ============================================================================== */

/* 弹窗容器 */
.phasor-calc-modal .modal-dialog {
    max-width: 1100px;
    width: 80%;
    min-width: 900px;
}

.phasor-calc-modal .modal-content {
    background-color: transparent;
    border: none;
    box-shadow: none;
}

.phasor-calc-modal .modal-body {
    padding: 0;
}

/* 关闭按钮悬停 */
.pcm-close-btn:hover {
    background-color: #f1f5f9 !important;
}

.pcm-close-btn:hover i {
    color: #64748b !important;
}

/* 计算按钮悬停 */
#pcm-calc-btn:hover {
    background-color: #334155 !important;
}

#pcm-calc-btn:active {
    transform: scale(0.95);
}

/* 输入框样式 */
.pcm-input:focus {
    border-color: #0ea5e9 !important;
}

.pcm-input::placeholder {
    color: #cbd5e1;
}

/* 下拉选择器样式 */
.pcm-dropdown .Select-control {
    border: 1px solid #e2e8f0 !important;
    border-radius: 10px !important;
    min-height: 48px !important;
    display: flex !important;
    align-items: center !important;
}

.pcm-dropdown .Select-value,
.pcm-dropdown .Select-placeholder {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    padding: 0 !important;
    text-align: center !important;
}

.pcm-dropdown .Select-value-label {
    font-size: 16px !important;
    color: #334155 !important;
    text-align: center !important;
    width: 100% !important;
}

.pcm-dropdown .Select-menu-outer {
    border-radius: 10px !important;
    margin-top: 4px !important;
}

.pcm-dropdown .Select-option {
    padding: 12px 18px !important;
    font-size: 16px !important;
    text-align: center !important;
}

/* 侧边栏放大按钮悬停 */
#pc-expand-btn:hover {
    color: #0ea5e9 !important;
}

/* 结果区线电压/相电压表格字体 */
.result-data-table {
    font-family: 'Source Han Sans SC', sans-serif;
    font-size: 14px;
}
.result-data-table td,
.result-data-table th {
    padding: 10px 6px;
}

/* 向量图工具栏 — 方案B 玻璃态悬浮胶囊 */
.chart-toolbar {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 1px;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(226, 232, 240, 0.6);
    border-radius: 6px;
    padding: 3px 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    z-index: 10;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.phasor-chart:hover .chart-toolbar,
.seq-chart:hover .chart-toolbar {
    opacity: 1;
}
.chart-toolbar .tb-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 13px;
    cursor: pointer;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
    padding: 0;
    outline: none;
}
.chart-toolbar .tb-btn:hover {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
}
/* 序分量小图适配 */
.seq-chart .chart-toolbar {
    top: 4px;
    right: 4px;
    padding: 2px 3px;
    border-radius: 5px;
}
.seq-chart .chart-toolbar .tb-btn {
    width: 20px;
    height: 20px;
    font-size: 10px;
}

/* 弹窗放大 Modal overlay */
.chart-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.45);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.chart-modal-container {
    width: 60vw;
    height: 80vh;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.chart-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}
.chart-modal-title {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
}
.chart-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 16px;
    cursor: pointer;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}
.chart-modal-close:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
}
.chart-modal-body {
    flex: 1;
    min-height: 0;
    padding: 8px;
    position: relative;
}
.chart-modal-toolbar {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    gap: 1px;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(226, 232, 240, 0.6);
    border-radius: 6px;
    padding: 3px 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    z-index: 10;
}
.chart-modal-toolbar .tb-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 14px;
    cursor: pointer;
    border-radius: 5px;
    transition: color 0.15s, background 0.15s;
    padding: 0;
    outline: none;
}
.chart-modal-toolbar .tb-btn:hover {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
}
.chart-modal-toolbar .tb-btn.active {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.12);
}

/* ==============================================================================
   电流重构模块样式
   ============================================================================== */
.current-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 10px 0;
    color: #64748b;
    font-size: 13px;
    user-select: none;
    border-top: 1px dashed #e2e8f0;
    margin-top: 8px;
    border-left: none;
    border-right: none;
    border-bottom: none;
    background: transparent;
    width: 100%;
}
.current-toggle:hover {
    color: #0ea5e9;
}
.current-toggle .toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.2s;
}
.current-toggle:hover .toggle-icon {
    background: #e0f2fe;
    border-color: #0ea5e9;
    color: #0ea5e9;
}
.current-result-table {
    font-family: 'Source Han Sans SC', sans-serif;
    font-size: 14px;
    margin-bottom: 0 !important;
}
.current-result-table th {
    background: #f8fafc;
    font-weight: 600;
    font-size: 14px;
    color: #64748b;
    text-align: center !important;
    vertical-align: middle !important;
    padding: 10px 6px !important;
    line-height: 1.5;
}
.current-result-table td {
    text-align: center !important;
    vertical-align: middle !important;
    padding: 10px 6px !important;
    line-height: 1.5;
    font-weight: 500;
}
.current-result-table .seq-sub-header th {
    font-size: 10px;
    color: #94a3b8;
    font-weight: 500;
    padding: 8px 6px !important;
}
.current-section-title {
    font-size: 0.875rem;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 20px;
}
.text-current {
    color: #7c3aed;
}
.border-current {
    border-color: #c4b5fd !important;
}
.seq-values {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    color: #64748b;
    line-height: 1.8;
    margin-top: 8px;
}
.seq-values .phase-label {
    font-weight: 600;
    display: inline-block;
    min-width: 28px;
}
.current-seq-table td {
    font-size: 12px !important;
}

/* ── Tier 权限遮罩 ── */
.tier-lock-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
}

/* ─────────────── Analysis Title Bar ─────────────── */
.analysis-title-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px;
}
.analysis-title-left { display: flex; align-items: center; gap: 14px; }
.analysis-title-icon {
  width: 44px; height: 44px; border-radius: 10px;
  background: #1e40af;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 20px;
  box-shadow: 0 4px 12px rgba(30,64,175,0.3);
}

/* ==============================================================================
   AI 智能诊断面板
   ============================================================================== */

/* AI Tab Beta 标记 */
.custom-tab-ai-diag.tab--selected::after,
.custom-tab-ai-diag::after {
    content: "Beta";
    font-size: 9px;
    font-weight: 600;
    background: #0071E3;
    color: white;
    padding: 1px 5px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: super;
    line-height: 1;
}

/* 聊天容器 */
.ai-diag-chat-container {
    background: #F9F9FA;
    border-radius: 12px;
    padding: 20px;
    height: 400px;
    overflow-y: auto;
    border: 1px solid #E5E5EA;
}

/* 区域标题 */
.ai-diag-section-header {
    font-size: 12px;
    font-weight: 600;
    color: #86868B;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
}

/* 气泡通用 */
.ai-diag-bubble {
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.6;
    max-width: 85%;
    white-space: pre-wrap;
    word-break: break-word;
}

/* AI 气泡 */
.bubble-ai {
    background: white;
    border-radius: 2px 16px 16px 16px;
    border: 1px solid #E5E5EA;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

/* 用户气泡 */
.bubble-user {
    background: #0071E3;
    color: white;
    border-radius: 16px 2px 16px 16px;
    margin-left: auto;
    display: inline-block;
    box-shadow: 0 4px 12px rgba(0, 113, 227, 0.2);
}

/* 输入区 */
.ai-diag-input-area {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.ai-diag-input {
    flex: 1;
    border: 1px solid #E5E5EA;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    background: #F9F9FA;
}

.ai-diag-input:focus {
    background: #fff;
    border-color: #0071E3;
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
    outline: none;
}

.ai-diag-send-btn {
    border-radius: 10px;
    padding: 10px 16px;
}

/* 快捷指令 Chip */
.ai-diag-chips {
    display: flex;
    flex-wrap: wrap;
}

.ai-diag-chip {
    background: white;
    border: 1px solid #E5E5EA;
    color: #1D1D1F;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    margin-right: 8px;
    margin-bottom: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.2s, border-color 0.2s;
}

.ai-diag-chip:hover {
    background: #F2F2F7;
    border-color: #D1D1D6;
}

/* 分隔线 */
.ai-diag-separator {
    text-align: center;
    margin: 16px 0;
}

.ai-diag-separator hr {
    border-top: 1px dashed #d1d5db;
}

/* 免责声明 */
.ai-diag-disclaimer {
    background: #f8f9fa;
    border: 1px solid #E5E5EA;
    border-radius: 8px;
    padding: 12px;
    margin-top: 16px;
    font-size: 12px;
    color: #86868B;
    line-height: 1.5;
}

/* 聊天列 */
.ai-diag-chat-col {
    border-right: 1px solid #E5E5EA;
    padding-right: 20px !important;
}

/* 侧栏列 */
.ai-diag-side-col {
    padding-left: 20px !important;
    padding-top: 4px;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .ai-diag-chat-col {
        border-right: none;
        padding-right: 12px !important;
        margin-bottom: 16px;
    }
    .ai-diag-side-col {
        padding-left: 12px !important;
    }
    .ai-diag-chat-container {
        height: 300px;
    }
}

/* ═══════ i18n: table header nowrap for English locale ═══════ */
.result-data-table th,
.current-result-table th,
.current-seq-table th {
    white-space: nowrap;
}
.result-data-table td:first-child,
.current-result-table td:first-child {
    white-space: nowrap;
}

/* ═══════ 向量图旋转工具栏 ═══════ */
.rotation-toolbar {
    position: sticky;
    bottom: 0;
    z-index: 10;
    margin-top: 12px;
    padding: 10px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.04);
}
.rotate-main-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.btn-rotate {
    width: 32px;
    height: 32px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    color: #475569;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    user-select: none;
    padding: 0;
    line-height: 1;
}
.btn-rotate:hover {
    border-color: #0ea5e9;
    color: #0ea5e9;
    background: rgba(14,165,233,0.04);
}
.btn-rotate:active {
    transform: scale(0.95);
    background: rgba(14,165,233,0.1);
}
.angle-display {
    min-width: 150px;
    text-align: center;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px;
    font-weight: 600;
    color: #334155;
    padding: 4px 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}
.angle-display.rotated {
    color: #0ea5e9;
    border-color: rgba(14,165,233,0.3);
    background: rgba(14,165,233,0.04);
    box-shadow: 0 0 6px rgba(14,165,233,0.15);
}
.rotate-sub-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.resolution-group {
    display: flex;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    overflow: hidden;
}
.res-btn {
    padding: 4px 12px;
    font-size: 12px;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    border: none;
    border-right: 1px solid #cbd5e1;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s;
}
.res-btn:last-child { border-right: none; }
.res-btn:hover { background: #f1f5f9; color: #334155; }
.res-btn.active {
    background: #0ea5e9;
    color: #fff;
    font-weight: 700;
}
.btn-rotate-reset {
    padding: 4px 10px;
    font-size: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s;
}
.btn-rotate-reset:hover { border-color: #f59e0b; color: #f59e0b; }

/* ═══════ 表格旋转态相角发光 ═══════ */
.phase-rotated {
    background-color: rgba(14,165,233,0.08) !important;
    box-shadow: inset 0 0 8px rgba(14,165,233,0.15),
                0 0 4px rgba(14,165,233,0.12);
    color: #0284c7 !important;
    font-weight: 600;
}