* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', 'Microsoft YaHei', sans-serif;
    background-color: #171B26;
    color: #e8eaed;
    overflow: hidden;
    height: 100vh;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* 顶部工具栏 */
.header {
    background-color: #1c1e27;
    padding: 8px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #363a45;
    flex-shrink: 0;
}

.title h1 {
    font-size: 14px;
    color: #ffffff;
    margin: 0;
    font-weight: 600;
}

.subtitle {
    display: none;
}

.controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 5px;
}

.control-group label {
    font-size: 11px;
    color: #9ca3af;
    white-space: nowrap;
}

.controls {
    flex-wrap: wrap;
    row-gap: 4px;
}

select {
    background-color: #2b2e3b;
    color: #e8eaed;
    border: 1px solid #4a5568;
    border-radius: 3px;
    padding: 4px 8px;
    font-size: 11px;
    cursor: pointer;
}

select:hover {
    border-color: #4a4e5a;
}

select:focus {
    outline: none;
    border-color: #2962ff;
}

.btn {
    padding: 5px 12px;
    border: none;
    border-radius: 3px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-primary {
    background-color: #2962ff;
    color: #ffffff;
}

.btn-primary:hover {
    background-color: #1e53e5;
}

.btn-secondary {
    background-color: #363a45;
    color: #d1d4dc;
}

.btn-secondary:hover {
    background-color: #434651;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 信息栏 */
.info-bar {
    background-color: #1c1e27;
    padding: 6px 15px;
    display: flex;
    gap: 20px;
    border-bottom: 1px solid #363a45;
    flex-shrink: 0;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.info-item .label {
    font-size: 11px;
    color: #9ca3af;
}

.info-item .value {
    font-size: 11px;
    font-weight: 600;
    color: #ffffff;
}

.value.price {
    color: #089981;
    font-size: 13px;
}

.value.status {
    color: #f7931a;
}

/* 图表区域 */
.chart-container {
    background-color: #171B26;  /* 深蓝灰色背景 */
    flex: 1;
    position: relative;
    overflow: hidden;
}

#mainChart {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* 底部指标面板 */
.indicator-container {
    background-color: #1c1e27;
    border-top: 1px solid #363a45;
    height: 210px;
    position: relative;
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.indicator-canvas-wrap {
    flex: 1;
    min-height: 0;
    position: relative;
}

#indicatorChart {
    display: block;
    width: 100%;
    height: 100%;
}

/* 行开关条：固定 20px 高，独立于画布，不遮挡统计表 */
.indicator-toggles {
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    font-size: 10px;
    color: #9ca3af;
    background: #171B26;
    border-top: 1px solid #2a2f3d;
    padding: 0 8px;
}

.indicator-toggles .toggle-sep {
    margin-left: 6px;
    padding-left: 8px;
    border-left: 1px solid #363a45;
}

.indicator-toggles label {
    display: flex;
    align-items: center;
    gap: 3px;
    cursor: pointer;
}

/* 旧的 DOM 数值表格（已由 canvas 面板替代，保留样式以兼容 index.html） */
.values-container {
    background-color: #1c1e27;
    border-top: 1px solid #363a45;
    padding: 8px 15px;
    height: 120px;
    overflow-x: hidden;  /* 隐藏横向溢出 */
    overflow-y: hidden;
    flex-shrink: 0;
    display: flex;
    gap: 10px;
    position: relative;
}

.values-header {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    padding: 8px 0;
    min-width: 50px;
    position: absolute;  /* 绝对定位，固定在容器内 */
    right: 15px;  /* 固定在右侧 */
    top: 8px;  /* 与容器padding对齐 */
    bottom: 8px;
    z-index: 100;  /* 确保在最上层 */
    background-color: #1c1e27;  /* 与容器背景一致 */
    flex-shrink: 0;  /* 不缩小 */
    pointer-events: none;  /* 不阻挡鼠标事件 */
}

.value-label {
    text-align: left;  /* 左对齐文字 */
    font-weight: 600;
    color: #9ca3af;
    font-size: 10px;
    text-transform: uppercase;
    padding: 8px 10px;
    pointer-events: auto;  /* 标签本身可以接收鼠标事件 */
}

.values-grid {
    display: block;  /* 改为block，支持绝对定位的子元素 */
    position: relative;  /* 作为定位上下文 */
    overflow: visible;
    flex: 1;
    will-change: transform;
    margin-left: 0;
    margin-right: 60px;  /* 为右侧标签留出空间 */
    height: 100%;  /* 确保有高度 */
}

.values-grid::-webkit-scrollbar {
    height: 6px;
}

.values-grid::-webkit-scrollbar-track {
    background: #2b2e3b;
}

.values-grid::-webkit-scrollbar-thumb {
    background: #434651;
    border-radius: 3px;
}

.kline-values {
    display: flex;
    flex-direction: column;
    gap: 0;
    justify-content: space-around;
    flex-shrink: 0;
    /* 移除min-width，使用JS动态设置 */
}

.value-cell {
    background-color: #ffffff;  /* 白色背景 */
    border: 1px solid #000000;  /* 黑色边框 */
    border-radius: 0;  /* 移除圆角，让方框更整齐 */
    padding: 6px 8px;
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    font-family: 'Courier New', monospace;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    margin: 0;  /* 确保没有外边距 */
    color: #000000;  /* 黑色文字，在浅色背景上清晰 */
}

.value-cell.vol {
    color: #e8eaed;
}

.value-cell.delta-positive {
    color: #089981;
    background-color: rgba(8, 153, 129, 0.15);
    border-color: rgba(8, 153, 129, 0.3);
}

.value-cell.delta-negative {
    color: #F23645;
    background-color: rgba(242, 54, 69, 0.15);
    border-color: rgba(242, 54, 69, 0.3);
}

.value-cell.cvd-positive {
    color: #089981;
    background-color: rgba(8, 153, 129, 0.2);
    border-color: rgba(8, 153, 129, 0.4);
}

.value-cell.cvd-negative {
    color: #F23645;
    background-color: rgba(242, 54, 69, 0.2);
    border-color: rgba(242, 54, 69, 0.4);
}

.value-cell.current {
    border-width: 2px;
    border-color: #f7931a;
    box-shadow: 0 0 8px rgba(247, 147, 26, 0.3);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header {
        flex-wrap: wrap;
    }

    .controls {
        flex-wrap: wrap;
    }

    .values-container,
    .indicator-container {
        height: 120px;
    }

    .kline-values {
        min-width: 60px;
    }

    .value-cell {
        font-size: 9px;
        padding: 3px 4px;
    }
}


/* 对象管理面板样式 */
.object-manager-panel {
    position: fixed;
    top: 60px;
    right: 20px;
    width: 350px;
    max-height: calc(100vh - 100px);
    background: #1e222d;
    border: 1px solid #363a45;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #2b2e3b;
    border-bottom: 1px solid #363a45;
    border-radius: 6px 6px 0 0;
}

.panel-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #d1d4dc;
}

.close-btn {
    background: none;
    border: none;
    color: #787b86;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #d1d4dc;
}

.panel-toolbar {
    display: flex;
    gap: 6px;
    padding: 10px 12px;
    background: #252830;
    border-bottom: 1px solid #363a45;
}

.toolbar-btn {
    flex: 1;
    padding: 6px 8px;
    font-size: 11px;
    background: #2b2e3b;
    color: #d1d4dc;
    border: 1px solid #363a45;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.toolbar-btn:hover {
    background: #363a45;
    border-color: #4a4e5a;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

/* 分组样式 */
.object-group {
    margin-bottom: 8px;
    background: #252830;
    border: 1px solid #363a45;
    border-radius: 4px;
    overflow: hidden;
}

.group-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    background: #2b2e3b;
    cursor: pointer;
    user-select: none;
}

.group-header:hover {
    background: #363a45;
}

.expand-icon {
    font-size: 10px;
    color: #787b86;
    width: 12px;
    text-align: center;
}

.group-name {
    flex: 1;
    font-size: 12px;
    font-weight: 600;
    color: #d1d4dc;
    outline: none;
}

.group-name[contenteditable="true"]:hover {
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 4px;
    margin: -2px -4px;
    border-radius: 2px;
}

.object-count {
    font-size: 11px;
    color: #787b86;
}

.group-actions {
    display: flex;
    gap: 4px;
}

.group-action-btn {
    background: none;
    border: none;
    color: #787b86;
    font-size: 12px;
    cursor: pointer;
    padding: 2px 4px;
    transition: color 0.2s;
}

.group-action-btn:hover:not(:disabled) {
    color: #d1d4dc;
}

.group-action-btn.batch-delete-btn:hover:not(:disabled) {
    color: #f23645;
}

.group-action-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.group-visibility-toggle {
    cursor: pointer;
    width: 14px;
    height: 14px;
}

.delete-group-btn {
    background: none;
    border: none;
    color: #787b86;
    font-size: 12px;
    cursor: pointer;
    padding: 2px 4px;
    transition: color 0.2s;
}

.delete-group-btn:hover {
    color: #f23645;
}

/* 对象列表样式 */
.object-list {
    padding: 4px;
}

.empty-message {
    padding: 16px;
    text-align: center;
    color: #787b86;
    font-size: 11px;
}

.object-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: #1e222d;
    border: 1px solid #363a45;
    border-radius: 3px;
    margin-bottom: 4px;
    transition: all 0.2s;
    cursor: move;
}

.object-item:hover {
    background: #252830;
    border-color: #4a4e5a;
}

/* 拖拽样式 */
.object-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.object-group.drag-over {
    border-color: #2962ff;
    background: rgba(41, 98, 255, 0.1);
}

.drag-handle {
    color: #787b86;
    font-size: 12px;
    cursor: grab;
    user-select: none;
}

.drag-handle:active {
    cursor: grabbing;
}

.visibility-toggle {
    cursor: pointer;
    width: 14px;
    height: 14px;
}

.object-icon {
    font-size: 14px;
}

.object-name {
    flex: 1;
    font-size: 11px;
    color: #d1d4dc;
}

.object-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.object-item:hover .object-actions {
    opacity: 1;
}

.action-btn {
    background: none;
    border: none;
    color: #787b86;
    font-size: 12px;
    cursor: pointer;
    padding: 2px 4px;
    transition: color 0.2s;
}

.action-btn:hover {
    color: #d1d4dc;
}

.delete-btn:hover {
    color: #f23645;
}

/* 滚动条样式 */
.panel-content::-webkit-scrollbar {
    width: 6px;
}

.panel-content::-webkit-scrollbar-track {
    background: #1e222d;
}

.panel-content::-webkit-scrollbar-thumb {
    background: #363a45;
    border-radius: 3px;
}

.panel-content::-webkit-scrollbar-thumb:hover {
    background: #4a4e5a;
}

/* 分组批量操作按钮 */
.group-visibility-toggle {
    cursor: pointer;
    width: 14px;
    height: 14px;
    margin-right: 4px;
}

.group-actions {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.group-action-btn {
    background: none;
    border: none;
    color: #787b86;
    font-size: 12px;
    cursor: pointer;
    padding: 2px 4px;
    transition: color 0.2s;
}

.group-action-btn:hover:not(:disabled) {
    color: #d1d4dc;
}

.group-action-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.batch-delete-btn:hover:not(:disabled) {
    color: #f23645;
}

.delete-group-btn:hover {
    color: #f23645;
}

/* 移动对话框样式 */
.move-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.2s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.move-dialog {
    background: #1e222d;
    border: 1px solid #363a45;
    border-radius: 8px;
    width: 400px;
    max-width: 90%;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s;
}

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

.move-dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #2b2e3b;
    border-bottom: 1px solid #363a45;
    border-radius: 8px 8px 0 0;
}

.move-dialog-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #d1d4dc;
}

.dialog-close-btn {
    background: none;
    border: none;
    color: #787b86;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.dialog-close-btn:hover {
    color: #d1d4dc;
}

.move-dialog-content {
    padding: 20px;
}

.move-dialog-content p {
    margin: 0 0 12px 0;
    color: #787b86;
    font-size: 13px;
}

.group-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.group-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #252830;
    border: 1px solid #363a45;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.group-option:hover {
    background: #2b2e3b;
    border-color: #4a4e5a;
    transform: translateX(4px);
}

.group-option-icon {
    font-size: 16px;
}

.group-option-name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #d1d4dc;
}

.group-option-count {
    font-size: 12px;
    color: #787b86;
}

/* 滚动条样式 - 移动对话框 */
.group-list::-webkit-scrollbar {
    width: 6px;
}

.group-list::-webkit-scrollbar-track {
    background: #1e222d;
}

.group-list::-webkit-scrollbar-thumb {
    background: #363a45;
    border-radius: 3px;
}

.group-list::-webkit-scrollbar-thumb:hover {
    background: #4a4e5a;
}

/* Fib配置对话框样式 */
.fib-config-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    animation: fadeIn 0.2s;
}

.fib-config-content {
    background: #1e222d;
    border: 1px solid #363a45;
    border-radius: 8px;
    width: 500px;
    max-width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s;
}

.fib-config-content h3 {
    margin: 0;
    padding: 16px 20px;
    background: #2b2e3b;
    border-bottom: 1px solid #363a45;
    border-radius: 8px 8px 0 0;
    font-size: 16px;
    font-weight: 600;
    color: #d1d4dc;
}

.fib-levels-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    max-height: 400px;
}

.fib-level-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #252830;
    border: 1px solid #363a45;
    border-radius: 6px;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.fib-level-item:hover {
    background: #2b2e3b;
    border-color: #4a4e5a;
}

.fib-level-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.fib-level-item input[type="number"] {
    width: 100px;
    padding: 6px 8px;
    background: #1e222d;
    border: 1px solid #363a45;
    border-radius: 4px;
    color: #d1d4dc;
    font-size: 13px;
}

.fib-level-item input[type="number"]:focus {
    outline: none;
    border-color: #2962ff;
}

.fib-level-item input[type="color"] {
    width: 50px;
    height: 30px;
    border: 1px solid #363a45;
    border-radius: 4px;
    cursor: pointer;
    background: transparent;
}

.fib-level-item span {
    flex: 1;
    font-size: 13px;
    color: #787b86;
    font-weight: 500;
}

.fib-level-item button {
    background: none;
    border: none;
    color: #787b86;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    transition: color 0.2s;
}

.fib-level-item button:hover {
    color: #f23645;
}

.fib-config-actions {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    background: #252830;
    border-top: 1px solid #363a45;
    border-radius: 0 0 8px 8px;
}

.fib-config-actions button {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

#addFibLevel {
    background: #2b2e3b;
    color: #d1d4dc;
    border: 1px solid #363a45;
}

#addFibLevel:hover {
    background: #363a45;
    border-color: #4a4e5a;
}

#saveFibConfig {
    background: #089981;
    color: #ffffff;
}

#saveFibConfig:hover {
    background: #0a7d6e;
}

#cancelFibConfig {
    background: #f23645;
    color: #ffffff;
}

#cancelFibConfig:hover {
    background: #d32f3e;
}

/* 滚动条样式 - Fib配置 */
.fib-levels-list::-webkit-scrollbar {
    width: 6px;
}

.fib-levels-list::-webkit-scrollbar-track {
    background: #1e222d;
}

.fib-levels-list::-webkit-scrollbar-thumb {
    background: #363a45;
    border-radius: 3px;
}

.fib-levels-list::-webkit-scrollbar-thumb:hover {
    background: #4a4e5a;
}

/* 浮动工具栏样式 */
.floating-toolbar {
    position: fixed;
    display: flex;
    gap: 4px;
    background: #1e222d;
    border: 1px solid #363a45;
    border-radius: 6px;
    padding: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    z-index: 2500;
    animation: fadeIn 0.2s;
}

.floating-toolbar .toolbar-item {
    background: #2b2e3b;
    border: 1px solid #363a45;
    border-radius: 4px;
    color: #d1d4dc;
    font-size: 16px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}

.floating-toolbar .toolbar-item:hover {
    background: #363a45;
    border-color: #4a4e5a;
    transform: scale(1.1);
}

.floating-toolbar .toolbar-item:active {
    transform: scale(0.95);
}

#deleteLineBtn:hover {
    background: #f23645;
    border-color: #f23645;
    color: #ffffff;
}

#configLineBtn:hover {
    background: #2962ff;
    border-color: #2962ff;
    color: #ffffff;
}

/* 浮动工具栏子菜单样式 */
.toolbar-submenu {
    background: #1e222d;
    border: 1px solid #363a45;
    border-radius: 6px;
    padding: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    z-index: 2600;
    min-width: 150px;
    animation: fadeIn 0.15s;
}

.submenu-item {
    padding: 8px 12px;
    background: #252830;
    border: 1px solid transparent;
    border-radius: 4px;
    color: #d1d4dc;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
}

.submenu-item:last-child {
    margin-bottom: 0;
}

.submenu-item:hover {
    background: #2b2e3b;
    border-color: #4a4e5a;
}

.submenu-item.active {
    background: #2962ff;
    color: #ffffff;
    border-color: #2962ff;
}

/* 颜色选择器矩阵样式 */
.color-picker-menu {
    min-width: auto;
    padding: 8px;
}

.color-grid {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.color-row {
    display: flex;
    gap: 2px;
}

.color-cell {
    width: 20px;
    height: 20px;
    border: 1px solid #363a45;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
}

.color-cell:hover {
    transform: scale(1.2);
    border-color: #ffffff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
    z-index: 10;
}

.color-cell.selected {
    border: 2px solid #ffffff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.color-cell.selected::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ffffff;
    font-size: 12px;
    font-weight: bold;
    text-shadow: 0 0 2px #000000;
}

.custom-color-section {
    margin-top: 4px;
}

/* 颜色菜单特殊样式 */
.color-menu {
    min-width: 180px;
}

.color-item {
    display: flex;
    align-items: center;
}

/* 模板菜单特殊样式 */
.template-menu {
    min-width: 200px;
}

.template-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.template-default-btn {
    background: none;
    border: none;
    color: #787b86;
    font-size: 16px;
    cursor: pointer;
    padding: 0 4px;
    margin-left: 4px;
    transition: color 0.2s;
    line-height: 1;
}

.template-default-btn:hover {
    color: #ffd700;
}

.template-delete-btn {
    background: none;
    border: none;
    color: #787b86;
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    margin-left: 4px;
    transition: color 0.2s;
    line-height: 1;
}

.template-delete-btn:hover {
    color: #f23645;
}

/* 绘图工具按钮样式 */
.drawing-tools {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-tool {
    padding: 6px 12px;
    background: #2b2e3b;
    color: #d1d4dc;
    border: 1px solid #363a45;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-tool:hover {
    background: #363a45;
    border-color: #4a4e5a;
}

.btn-tool.active {
    background: #2962ff;
    color: #ffffff;
    border-color: #2962ff;
}

/* 向下的斜线图标（-45度，从左上到右下）\\ */
.line-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    position: relative;
    vertical-align: middle;
    margin-right: 4px;
}

.line-icon::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 2px;
    background: currentColor;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
    border-radius: 1px;
}

/* 激活状态下的斜线图标 */
.btn-tool.active .line-icon::before {
    background: #ffffff;
}


/* 下载进度条样式 */
.download-progress-container {
    background: linear-gradient(135deg, #2962ff 0%, #1e4db7 100%);
    padding: 8px 15px;
    border-bottom: 1px solid #363a45;
    animation: slideDown 0.3s ease;
}

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

.download-progress-content {
    max-width: 600px;
    margin: 0 auto;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.progress-text {
    font-size: 12px;
    color: #ffffff;
    font-weight: 500;
}

.progress-percent {
    font-size: 13px;
    color: #ffffff;
    font-weight: 600;
    min-width: 40px;
    text-align: right;
}

.progress-bar-bg {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #ffffff 0%, #e3f2fd 100%);
    border-radius: 3px;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* 画图数据管理对话框样式 */
.drawings-manager-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    animation: fadeIn 0.2s;
}

.drawings-manager-content {
    background: #1e222d;
    border: 1px solid #363a45;
    border-radius: 8px;
    width: 600px;
    max-width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s;
}

.drawings-manager-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #2b2e3b;
    border-bottom: 1px solid #363a45;
    border-radius: 8px 8px 0 0;
}

.drawings-manager-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #d1d4dc;
}

.drawings-manager-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.current-info {
    background: #252830;
    border: 1px solid #363a45;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 20px;
}

.current-info p {
    margin: 6px 0;
    font-size: 13px;
    color: #d1d4dc;
}

.current-info strong {
    color: #787b86;
    font-weight: 500;
}

.saved-data-list h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #d1d4dc;
}

.saved-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.saved-data-table thead {
    background: #252830;
}

.saved-data-table th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: #787b86;
    border-bottom: 1px solid #363a45;
}

.saved-data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #363a45;
    color: #d1d4dc;
}

.saved-data-table tr:hover {
    background: #252830;
}

.saved-data-table .current-row {
    background: rgba(41, 98, 255, 0.1);
}

.saved-data-table .current-row:hover {
    background: rgba(41, 98, 255, 0.15);
}

.drawings-manager-footer {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    background: #252830;
    border-top: 1px solid #363a45;
    border-radius: 0 0 8px 8px;
}

.btn-danger {
    padding: 8px 16px;
    background: #f23645;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: #d32f2f;
}

.btn-secondary {
    padding: 8px 16px;
    background: #363a45;
    color: #d1d4dc;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #4a4e5a;
}

.btn-small {
    padding: 4px 10px;
    background: #363a45;
    color: #d1d4dc;
    border: none;
    border-radius: 3px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-small:hover {
    background: #4a4e5a;
}

.empty-message {
    text-align: center;
    padding: 40px 20px;
    color: #787b86;
    font-size: 13px;
}

.scope-btn.active {
    color: #2962ff;
}

/* 绘图工具下拉菜单 */
.tool-menu-wrap {
    position: relative;
}

.tool-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 140px;
    background: #1e222d;
    border: 1px solid #363a45;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 2000;
    padding: 4px 0;
}

/* 指标管理面板 */
.ind-panel {
    position: fixed;            /* 位置由 JS 按按钮位置与视口裁剪计算，避免被挤出屏幕 */
    left: auto;
    right: auto;
    top: auto;
    width: 420px;
    max-width: calc(100vw - 16px);
    max-height: 70vh;
    overflow-y: auto;
    padding: 8px 10px;
    font-size: 12px;
    color: #d1d4dc;
    cursor: default;
}
.ind-section { margin-bottom: 10px; }
.ind-title { font-weight: bold; color: #9ca3af; margin: 4px 0 6px; display: flex; align-items: center; gap: 8px; }
.ind-empty { color: #6b7280; font-size: 11px; padding: 4px 0; }
.ind-row { display: flex; flex-wrap: wrap; align-items: center; padding: 3px 4px; border-radius: 3px; }
.ind-row:hover { background: #2b2e3b; }
.ind-name { flex: 1; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.ind-tag { font-size: 10px; color: #6b7280; border: 1px solid #363a45; border-radius: 3px; padding: 0 4px; }
.ind-actions button, .ind-chip button {
    background: none; border: none; color: #9ca3af; cursor: pointer; font-size: 11px; padding: 2px 4px;
}
.ind-actions button:hover, .ind-chip button:hover { color: #fff; }
.ind-error { flex-basis: 100%; color: #f23645; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ind-inputs { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px 12px; padding: 6px 4px 4px 22px; }
.ind-stats { flex-basis: 100%; display: flex; flex-direction: column; gap: 3px; padding: 6px 4px 4px 22px; font-size: 11px; color: #9ca3af; }
.ind-input { display: flex; align-items: center; gap: 6px; font-size: 11px; color: #9ca3af; }
.ind-input input[type="number"], .ind-input input[type="text"], .ind-input select {
    width: 80px; background: #131722; border: 1px solid #363a45; color: #d1d4dc; border-radius: 3px; padding: 2px 4px; font-size: 11px;
}
.ind-input input[type="color"] { width: 28px; height: 20px; padding: 0; border: 1px solid #363a45; background: none; }
.ind-input-actions { flex-basis: 100%; }
.ind-input-actions button { background: none; border: 1px solid #363a45; color: #9ca3af; border-radius: 3px; font-size: 10px; padding: 1px 6px; cursor: pointer; }
.ind-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.ind-chip {
    display: inline-flex; align-items: center; gap: 2px;
    background: #2b2e3b; border: 1px solid #363a45; color: #d1d4dc; border-radius: 3px; padding: 2px 8px; font-size: 11px; cursor: pointer;
}
.ind-chip:hover { background: #363a45; }
.ind-chip.ind-new { border-color: #2962ff; color: #8ab4ff; }
.ind-chip.ind-user > span { cursor: pointer; }

/* 脚本编辑器 */
.script-editor {
    position: fixed; inset: 0; z-index: 3000;
    background: rgba(0, 0, 0, 0.55);
    display: flex; align-items: center; justify-content: center;
}
.script-editor[hidden] { display: none; }
.script-editor-box {
    width: 760px; max-width: 95vw; height: 80vh;
    background: #1e222d; border: 1px solid #363a45; border-radius: 8px;
    display: flex; flex-direction: column; padding: 12px; gap: 8px;
}
.script-editor-head { display: flex; align-items: center; gap: 8px; }
.script-name { flex: 1; background: #131722; border: 1px solid #363a45; color: #d1d4dc; border-radius: 4px; padding: 5px 8px; font-size: 13px; }
.script-editor-actions { display: flex; gap: 6px; }
#scriptLang { background: #131722; border: 1px solid #363a45; color: #d1d4dc; border-radius: 4px; padding: 4px 6px; font-size: 12px; }
#scriptSource {
    flex: 1; resize: none; background: #131722; color: #d1d4dc; border: 1px solid #363a45; border-radius: 4px;
    font: 12px/1.5 "Roboto Mono", Consolas, monospace; padding: 8px; tab-size: 4; white-space: pre; overflow: auto;
}
.script-status { font-size: 12px; color: #9ca3af; min-height: 16px; }
.script-status.err { color: #f23645; }
.script-status.ok { color: #089981; }
.script-help { font-size: 11px; color: #9ca3af; line-height: 1.6; max-height: 30vh; overflow-y: auto; border-top: 1px solid #363a45; padding-top: 6px; }
.script-help code { background: #131722; padding: 0 3px; border-radius: 2px; color: #d1d4dc; }

/* 告警面板 */
.alert-panel { width: 460px; }
.alert-section { margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid #263042; }
.alert-section:last-child { border-bottom: none; margin-bottom: 0; }
.alert-title { font-weight: bold; color: #9ca3af; margin: 4px 0 6px; display: flex; align-items: center; gap: 8px; }
.alert-form { display: flex; flex-direction: column; gap: 6px; }
.alert-form-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.alert-select, .alert-form-row input[type="number"], .alert-form-row input[type="text"], .alert-form-row input[type="password"] {
    background: #131722; border: 1px solid #363a45; color: #d1d4dc; border-radius: 3px; padding: 4px 6px; font-size: 11px;
}
.alert-form-row input[type="text"], .alert-form-row input[type="password"] { flex: 1; min-width: 120px; }
.alert-form-row input[type="number"] { width: 90px; }
#alertCooldown { width: 60px; }
.alert-inline { display: flex; align-items: center; gap: 4px; font-size: 11px; color: #9ca3af; white-space: nowrap; }
.alert-symbol-group { font-size: 11px; color: #6b7280; margin: 6px 0 2px; }
.alert-row { flex-wrap: wrap; }
.alert-meta { font-size: 10px; color: #6b7280; white-space: nowrap; }
.alert-note { flex-basis: 100%; font-size: 10px; color: #9ca3af; padding-left: 22px; }
.alert-events { max-height: 140px; overflow-y: auto; font-size: 11px; }
.alert-event { padding: 3px 2px; color: #9ca3af; border-bottom: 1px solid #1e222d; }
.alert-event.err { color: #f23645; }

.tool-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 12px;
    background: none;
    border: none;
    color: #d1d4dc;
    font-size: 12px;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
}

.tool-menu-item:hover {
    background: #2b2e3b;
}

.tool-menu-icon {
    width: 18px;
    text-align: center;
}
