/* CryptoKolBot Dashboard CSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f7fa;
    min-height: 100vh;
    color: #333;
}

/* 仪表板容器 */
.dashboard-container {
    min-height: 100vh;
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

/* 头部样式 */
.dashboard-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
}

.header-content h1 {
    color: #2c3e50;
    font-size: 1.8rem;
    font-weight: 600;
}

.header-content h1 i {
    color: #4a5568;
    margin-right: 10px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    justify-content: flex-end;
}

.header-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.connection-status {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 500;
}

.connection-status.connected i {
    color: #27ae60;
}

.connection-status.disconnected i {
    color: #e74c3c;
}

.connection-status.connecting i {
    color: #f39c12;
    animation: pulse 2s infinite;
}

.header-login-btn {
    text-decoration: none;
}

/* 状态网格 */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
    overflow: visible;
    position: relative;
}

/* 卡片通用样式 */
.card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
    border: 1px solid rgba(255, 255, 255, 0.18);
    overflow: visible;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(31, 38, 135, 0.5);
}

.card-header {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.card-header i {
    margin-right: 8px;
}

.card-body {
    padding: 20px;
    overflow: visible;
}

/* 系统状态卡片 */
.status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #ecf0f1;
}

.status-row:last-child {
    border-bottom: none;
}

.status-indicator {
    display: flex;
    align-items: center;
    font-weight: 500;
    font-size: 0.9rem;
}

.status-indicator i {
    font-size: 8px;
    margin-right: 8px;
}

.status-indicator.online i {
    color: #27ae60;
}

.status-indicator.offline i {
    color: #e74c3c;
}

.status-indicator.unknown i {
    color: #95a5a6;
}

/* 账户信息卡片 */
.balance-display {
    text-align: center;
    margin-bottom: 20px;
}

.balance-main {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.balance-label {
    font-size: 0.9rem;
    color: #7f8c8d;
}

.balance-amount {
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
}

.balance-cny {
    font-size: 0.9rem;
    color: #95a5a6;
    font-weight: 400;
    margin-top: 2px;
}

.balance-cny-small {
    font-size: 0.85rem;
    color: #95a5a6;
    font-weight: 400;
    margin-left: 4px;
}

/* 余额指标展示 */
.balance-metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #ecf0f1;
}

.metric-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.metric-label {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-bottom: 5px;
}

.metric-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #2c3e50;
}

.metric-cny {
    font-size: 0.85rem;
    color: #95a5a6;
    font-weight: 400;
    margin-top: 3px;
}

.balance-sub {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #7f8c8d;
}

.pnl.positive {
    color: #27ae60;
}

.pnl.negative {
    color: #e74c3c;
}

.pnl.positive + .metric-cny {
    color: #27ae60;
}

.pnl.negative + .metric-cny {
    color: #e74c3c;
}

.account-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    text-align: center;
}

.stat-label {
    font-size: 0.8rem;
    color: #7f8c8d;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
}

.stat-value.highlight {
    color: #f39c12;
    font-weight: 700;
    font-size: 1.3rem;
}

/* 可点击的stat-value链接 */
.stat-value.stat-link {
    color: #3b82f6;  /* 蓝色表示可点击 */
    text-decoration: underline;  /* 下划线提示 */
    text-decoration-style: dotted;  /* 虚线下划线 */
    text-underline-offset: 3px;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 2px 6px;
    border-radius: 4px;
}

.stat-value.stat-link:hover {
    color: #2563eb;
    text-decoration-style: solid;  /* hover时变实线 */
    background: rgba(59, 130, 246, 0.1);
    transform: translateY(-1px);
}

/* 交易统计卡片 */
.trading-stats {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.trade-metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.trade-metric-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.trade-metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.trade-metric-card .metric-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
}

.trade-metric-card.total .metric-icon {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.trade-metric-card.success .metric-icon {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
}

.trade-metric-card.failed .metric-icon {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.trade-metric-card.rate .metric-icon {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
}

.trade-metric-card .metric-content {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.trade-metric-card .metric-label {
    font-size: 0.75rem;
    color: #7f8c8d;
    margin-bottom: 2px;
}

.trade-metric-card .metric-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #2c3e50;
}

.trade-metric-card.success .metric-value {
    color: #27ae60;
}

.trade-metric-card.failed .metric-value {
    color: #e74c3c;
}

.trade-metric-card.rate .metric-value {
    color: #f39c12;
}

.win-rate {
    color: #f39c12;
}

/* 消息监听卡片 */
.message-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    overflow: visible;
}

.monitored-topics h4 {
    margin-bottom: 10px;
    color: #2c3e50;
    font-size: 0.9rem;
}

.topics-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.topic-tag {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}


.message-card {
    position: relative;
    z-index: 1000;
}

.message-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
}

.topic-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    font-size: 0.9rem;
    color: #2c3e50;
}

.topic-info-label {
    font-weight: 600;
    color: #7f8c8d;
}

.topic-info-value {
    font-weight: 600;
}


.topics-select {
    width: 100%;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #ccd6dd;
    background: rgba(236, 240, 241, 0.4);
    font-size: 0.85rem;
    color: #2c3e50;
    resize: vertical;
}

.topic-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    background: white;
    border: 1px solid rgba(149, 165, 166, 0.2);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.topic-item:hover {
    border-color: #4a5568;
    box-shadow: 0 4px 12px rgba(74, 85, 104, 0.15);
}

.topic-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.topic-item-label {
    display: flex;
    flex-direction: column;
}

.topic-item-label .topic-title {
    font-weight: 600;
    color: #2c3e50;
}

.topic-item-label .topic-meta {
    font-size: 0.75rem;
    color: #95a5a6;
}

.topic-hint {
    margin-top: 12px;
    font-size: 0.75rem;
    color: #95a5a6;
}

.topics-config {
    margin-top: 20px;
    overflow: visible;
}

.topic-selector-simple {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: visible;
}

.topic-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.topic-select-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    overflow: visible;
}

.topic-dropdown-wrapper {
    flex: 1;
    position: relative;
    z-index: 10000;
}

.topic-dropdown-toggle {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #d0d7de;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    min-height: 42px;
}

.topic-dropdown-toggle:hover {
    border-color: #4a5568;
    box-shadow: 0 4px 12px rgba(74, 85, 104, 0.15);
}

.topic-dropdown-toggle.active {
    border-color: #4a5568;
    box-shadow: 0 0 0 4px rgba(74, 85, 104, 0.15);
}

.topic-dropdown-toggle i {
    transition: transform 0.3s ease;
    color: #7f8c8d;
}

.topic-dropdown-toggle.active i {
    transform: rotate(180deg);
}

#topicSelectedText {
    color: #2c3e50;
    font-size: 0.95rem;
}

.topic-dropdown-menu {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #d0d7de;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    max-height: 300px;
    overflow-y: auto;
    z-index: 9999;
    display: none;
}

.topic-dropdown-menu::-webkit-scrollbar {
    width: 8px;
}

.topic-dropdown-menu::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.topic-dropdown-menu::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.topic-dropdown-menu::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.topic-dropdown-menu.show {
    display: block;
}

.topic-checkbox-list {
    padding: 8px;
}

.topic-checkbox-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s;
    gap: 10px;
}

.topic-checkbox-item:hover {
    background: #f8f9fa;
}

.topic-checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #4a5568;
}

.topic-checkbox-item span {
    flex: 1;
    font-size: 0.95rem;
    color: #2c3e50;
}

.topic-checkbox-item input:checked + span {
    font-weight: 600;
    color: #4a5568;
}

.topic-actions-btn {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* PC端保存按钮样式 - 更大更醒目 */
.topic-actions-btn .btn {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    min-height: 44px;
    box-shadow: 0 4px 12px rgba(74, 85, 104, 0.3);
}

.topic-actions-btn .btn:hover {
    box-shadow: 0 6px 16px rgba(74, 85, 104, 0.4);
    transform: translateY(-2px);
}

.topic-hint {
    font-size: 0.8rem;
    color: #7f8c8d;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

.message-card .card-header .btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
    min-width: auto;
}

.topic-selector-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.topic-selector-header h4 {
    margin: 0;
}

.btn.btn-compact {
    padding: 6px 12px;
    font-size: 0.8rem;
    line-height: 1.1;
}

/* 全宽区域 */
.full-width-section {
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

/* 控制面板 */
.control-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
}

/* 按钮样式 */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
}

.btn.btn-success {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    color: white;
}

.btn.btn-danger {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.btn.btn-warning {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
}

.btn.btn-info {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.btn.btn-secondary {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    color: white;
}

.btn.btn-small {
    padding: 8px 15px;
    font-size: 0.8rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 交易表格 */
.trades-table-container {
    overflow-x: auto;
}

.trades-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.trades-table th,
.trades-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ecf0f1;
}

.trades-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
}

.trades-table tbody tr:hover {
    background: #f8f9fa;
}

.no-data {
    text-align: center;
    color: #7f8c8d;
    font-style: italic;
}

/* 日志区域 */
.logs-container {
    background: #2c3e50;
    border-radius: 8px;
    padding: 15px;
    height: 300px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
}

.log-entry {
    display: flex;
    gap: 10px;
    padding: 5px 0;
    font-size: 0.85rem;
}

.log-time {
    color: #7f8c8d;
    min-width: 80px;
}

.log-level {
    min-width: 60px;
    font-weight: 600;
}

.log-entry.info .log-level {
    color: #3498db;
}

.log-entry.warn .log-level {
    color: #f39c12;
}

.log-entry.error .log-level {
    color: #e74c3c;
}

.log-entry.success .log-level {
    color: #27ae60;
}

.log-message {
    color: #ecf0f1;
    flex: 1;
}

/* 加载覆盖层 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-overlay.hidden {
    display: none;
}

.loading-spinner {
    text-align: center;
    color: white;
}

.loading-spinner i {
    font-size: 3rem;
    margin-bottom: 20px;
}

.loading-spinner p {
    font-size: 1.1rem;
}

/* 动画 */
@keyframes pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
    100% {
        opacity: 1;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .dashboard-container {
        padding: 10px;
    }

    .header-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .header-content h1 {
        font-size: 1.5rem;
    }

    .status-grid {
        grid-template-columns: 1fr;
    }

    .control-buttons {
        grid-template-columns: 1fr;
    }

    .balance-sub {
        flex-direction: column;
        gap: 5px;
    }

    .stat-group {
        grid-template-columns: 1fr;
    }

    .trade-breakdown {
        flex-direction: column;
        gap: 10px;
    }

    .account-stats {
        grid-template-columns: 1fr;
    }

    .message-stats {
        grid-template-columns: 1fr;
    }

    .topics-select {
        min-height: 160px;
    }

    .topics-columns {
        flex-direction: column;
    }

    .topic-selector-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* 页脚样式 */
.dashboard-footer {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    margin-top: 20px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.footer-content p {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin: 5px 0;
}

.footer-content p:first-child {
    font-weight: 600;
    color: #2c3e50;
}

/* 持仓统计栏 */
.positions-stats {
    display: flex;
    justify-content: space-around;
    gap: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
}

.pos-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.pos-stat-item.long {
    color: #27ae60;
}

.pos-stat-item.short {
    color: #e74c3c;
}

.pos-stat-item.net {
    color: #3498db;
}

.pos-stat-label {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-bottom: 5px;
}

.pos-stat-item.long .pos-stat-label,
.pos-stat-item.short .pos-stat-label,
.pos-stat-item.net .pos-stat-label {
    color: inherit;
    opacity: 0.8;
}

.pos-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
}

.pos-stat-item.long .pos-stat-value {
    color: #27ae60;
}

.pos-stat-item.short .pos-stat-value {
    color: #e74c3c;
}

.pos-stat-item.net .pos-stat-value {
    color: #3498db;
}

.pos-stat-detail {
    margin-top: 4px;
    font-size: 0.8rem;
    color: #7f8c8d;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pos-stat-item.long .pos-stat-detail,
.pos-stat-item.short .pos-stat-detail,
.pos-stat-item.net .pos-stat-detail {
    color: inherit;
    opacity: 0.85;
}

.pos-stat-percent {
    font-size: 0.8rem;
    margin-left: 5px;
    opacity: 0.8;
}

/* 持仓表格样式 */
.positions-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.positions-table thead {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    color: white;
}

.positions-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
}

.positions-table th:hover {
    background: rgba(255, 255, 255, 0.1);
}

.positions-table th i {
    margin-left: 5px;
    font-size: 0.8em;
    opacity: 0.7;
}

.positions-table th.sorted-asc,
.positions-table th.sorted-desc {
    background: rgba(255, 255, 255, 0.15);
}

.positions-table th.sorted-asc i,
.positions-table th.sorted-desc i {
    opacity: 1;
}

.positions-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #ecf0f1;
}

.positions-table tbody tr:hover {
    background: #f8f9fa;
}

.positions-table .long {
    color: #27ae60;
    font-weight: 600;
}

.positions-table .short {
    color: #e74c3c;
    font-weight: 600;
}

.positions-table .profit {
    color: #27ae60;
    font-weight: 600;
}

.positions-table .loss {
    color: #e74c3c;
    font-weight: 600;
}

.positions-table .no-data {
    text-align: center;
    color: #95a5a6;
    padding: 30px;
    font-style: italic;
}

/* ========================================
   移动端响应式设计
   ======================================== */

/* 平板设备 (768px - 1024px) */
@media (max-width: 1024px) {
    .dashboard-container {
        padding: 15px;
    }

    .status-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .header-content h1 {
        font-size: 1.5rem;
    }
}

/* 手机设备 (最大宽度 768px) */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }

    .dashboard-container {
        padding: 8px;
    }

    /* 头部紧凑化 */
    .header-content {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: center;
        padding: 12px 15px;
        gap: 10px;
    }

    .header-content h1 {
        font-size: 1.1rem;
        flex: 1 1 auto;
        white-space: nowrap;
    }

    .header-content h1 i {
        font-size: 0.9rem;
    }

    .header-actions {
        display: flex;
        gap: 10px;
        align-items: center;
        justify-content: center;
        flex-wrap: wrap;
        width: 100%;
    }

    /* 状态网格紧凑2列 */
    .status-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        margin-bottom: 12px;
    }

    /* 卡片紧凑化 */
    .card {
        margin-bottom: 8px;
        border-radius: 10px;
    }

    .card-header {
        padding: 8px 10px;
        border-radius: 10px 10px 0 0;
    }

    .card-header h3 {
        font-size: 0.85rem;
    }

    .card-body {
        padding: 8px 10px;
    }

    /* 系统状态卡片 - 更紧凑 */
    .status-card .card-body {
        padding: 6px 10px;
    }

    .status-row {
        padding: 4px 0;
        font-size: 0.8rem;
    }

    /* 余额显示紧凑 */
    .balance-display {
        padding: 6px;
    }

    .balance-main {
        margin-bottom: 6px;
    }

    .balance-label {
        font-size: 0.75rem;
    }

    .balance-amount {
        font-size: 1.3rem;
    }

    .balance-cny {
        font-size: 0.75rem;
    }

    .balance-cny-small {
        font-size: 0.7rem;
    }

    /* 余额指标移动端 */
    .balance-metrics {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-top: 12px;
        padding-top: 10px;
    }

    .metric-label {
        font-size: 0.75rem;
    }

    .metric-value {
        font-size: 1.1rem;
    }

    .metric-cny {
        font-size: 0.75rem;
    }

    /* 持仓统计移动端 */
    .positions-stats {
        flex-wrap: wrap;
        gap: 10px;
        padding: 10px;
        margin-bottom: 12px;
    }

    .pos-stat-item {
        flex: 1 1 40%;
        min-width: 100px;
    }

    .pos-stat-label {
        font-size: 0.75rem;
    }

    .pos-stat-value {
        font-size: 1.2rem;
    }

    .pos-stat-percent {
        font-size: 0.7rem;
    }

    .balance-sub {
        flex-direction: row;
        justify-content: space-between;
        font-size: 0.75rem;
        gap: 8px;
    }

    /* 账户统计紧凑 */
    .account-stats {
        gap: 6px;
        padding: 6px 0 0;
        border-top: 1px solid #ecf0f1;
    }

    .stat-item {
        min-width: auto;
        flex: 1;
    }

    .stat-label {
        font-size: 0.7rem;
        margin-bottom: 3px;
    }

    .stat-value {
        font-size: 0.9rem;
    }

    .stat-value.highlight {
        font-size: 1.1rem;
    }

    /* 交易统计紧凑 */
    .trading-stats {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .trade-metrics-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .trade-metric-card {
        padding: 8px 10px;
    }

    .trade-metric-card .metric-icon {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    .trade-metric-card .metric-label {
        font-size: 0.7rem;
    }

    .trade-metric-card .metric-value {
        font-size: 1.1rem;
    }

    /* 消息统计紧凑 */
    .message-stats {
        gap: 6px;
    }

    .monitored-topics {
        margin-top: 8px;
        padding-top: 8px;
        border-top: 1px solid #ecf0f1;
    }

    .monitored-topics h4 {
        font-size: 0.8rem;
        margin-bottom: 5px;
    }

    .topics-list {
        gap: 4px;
    }

    .topic-tag {
        font-size: 0.65rem;
        padding: 2px 5px;
    }

    /* 移动端话题选择优化 */
    .topic-select-row {
        flex-direction: column;
        gap: 8px;
    }

    .topic-dropdown-toggle {
        padding: 8px 10px;
        min-height: 38px;
        font-size: 0.85rem;
    }

    #topicSelectedText {
        font-size: 0.85rem;
    }

    .topic-dropdown-menu {
        max-height: 250px;
        font-size: 0.85rem;
    }

    .topic-checkbox-list {
        padding: 6px;
    }

    .topic-checkbox-item {
        padding: 8px 10px;
        gap: 8px;
    }

    .topic-checkbox-item span {
        font-size: 0.85rem;
    }

    .topic-checkbox-item input[type="checkbox"] {
        width: 16px;
        height: 16px;
    }

    .topic-actions-btn {
        flex-direction: row;
        width: 100%;
        gap: 8px;
    }

    /* 移动端保存按钮样式 - 适中大小 */
    .topic-actions-btn .btn {
        flex: 1;
        padding: 10px 16px;
        font-size: 0.95rem;
        font-weight: 600;
        min-height: 44px;
    }

    .topic-label {
        font-size: 0.85rem;
    }

    /* 持仓表格隐藏，改用卡片 */
    .positions-table {
        display: none;
    }

    /* 持仓卡片列表 */
    .positions-table-container::after {
        content: '';
        display: block;
    }

    /* 交易表格紧凑滚动 */
    .trades-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .trades-table {
        min-width: 550px;
        font-size: 0.8rem;
    }

    .trades-table th,
    .trades-table td {
        padding: 6px 4px;
        white-space: nowrap;
    }

    /* 日志容器紧凑 */
    .logs-container {
        max-height: 200px;
        font-size: 0.75rem;
    }

    .log-entry {
        padding: 6px 8px;
        margin-bottom: 4px;
    }

    .log-time {
        font-size: 0.7rem;
    }

    .log-level {
        font-size: 0.7rem;
        padding: 2px 5px;
    }

    .log-message {
        font-size: 0.75rem;
    }

    /* 按钮紧凑 */
    .btn {
        padding: 6px 10px;
        font-size: 0.8rem;
        min-height: 36px;
    }

    .btn-small {
        padding: 4px 8px;
        font-size: 0.75rem;
        min-height: 32px;
    }

    /* 页脚紧凑 */
    .dashboard-footer {
        padding: 12px;
        font-size: 0.75rem;
        margin-top: 12px;
    }

    .footer-content p {
        margin: 3px 0;
    }

    /* 连接状态紧凑 */
    .connection-status {
        font-size: 0.75rem;
        padding: 4px 8px;
    }

    .status-indicator {
        font-size: 0.8rem;
    }
}

/* 移动端持仓卡片样式 - 默认隐藏 */
.position-cards-mobile {
    display: none;
}

@media (max-width: 768px) {
    .position-cards-mobile {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .position-card-mobile {
        background: white;
        border-radius: 8px;
        padding: 8px 10px;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
        border-left: 3px solid;
    }

    .position-card-mobile.long-position {
        border-left-color: #27ae60;
    }

    .position-card-mobile.short-position {
        border-left-color: #e74c3c;
    }

    .position-card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 6px;
    }

    .position-symbol {
        font-size: 0.9rem;
        font-weight: 700;
        color: #2c3e50;
    }

    .position-side-badge {
        font-size: 0.7rem;
        padding: 2px 6px;
        border-radius: 10px;
        font-weight: 600;
        color: white;
    }

    .position-side-badge.long {
        background: #27ae60;
    }

    .position-side-badge.short {
        background: #e74c3c;
    }

    .position-card-body {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 6px 12px;
        font-size: 0.8rem;
    }

    .position-info-item {
        display: flex;
        flex-direction: column;
    }

    .position-info-label {
        font-size: 0.65rem;
        color: #7f8c8d;
        margin-bottom: 1px;
    }

    .position-info-value {
        font-size: 0.85rem;
        font-weight: 600;
        color: #2c3e50;
    }

    .position-info-value.profit {
        color: #27ae60;
    }

    .position-info-value.loss {
        color: #e74c3c;
    }

    .position-card-footer {
        margin-top: 6px;
        padding-top: 6px;
        border-top: 1px solid #ecf0f1;
        display: flex;
        justify-content: space-between;
        font-size: 0.75rem;
    }

    .position-leverage {
        color: #3498db;
        font-weight: 600;
    }

    .position-pnl-percent {
        font-weight: 700;
        font-size: 0.85rem;
    }

    .position-pnl-percent.profit {
        color: #27ae60;
    }

    .position-pnl-percent.loss {
        color: #e74c3c;
    }
}

/* 小屏手机设备 (最大宽度 480px) */
@media (max-width: 480px) {
    .header-content h1 {
        font-size: 1.1rem;
    }

    .header-content h1 i {
        font-size: 0.9rem;
    }

    .balance-amount {
        font-size: 1.5rem;
    }

    .balance-label {
        font-size: 0.85rem;
    }

    .balance-cny {
        font-size: 0.85rem;
    }

    .balance-cny-small {
        font-size: 0.75rem;
    }

    /* 余额指标小屏 */
    .metric-value {
        font-size: 1rem;
    }

    .metric-cny {
        font-size: 0.7rem;
    }

    .balance-metrics {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .metric-item {
        align-items: center;
        text-align: center;
    }

    /* 持仓统计小屏 */
    .pos-stat-value {
        font-size: 1.1rem;
    }

    .pos-stat-detail {
        flex-direction: column;
        gap: 2px;
        font-size: 0.7rem;
    }

    /* 进一步减小表格尺寸 */
    .positions-table,
    .trades-table {
        font-size: 0.75rem;
    }

    .positions-table th,
    .positions-table td,
    .trades-table th,
    .trades-table td {
        padding: 6px 4px;
    }

    /* 统计项更紧凑 */
    .stat-group {
        flex-direction: column;
        gap: 8px;
    }

    .trade-breakdown,
    .message-stats {
        grid-template-columns: 1fr;
    }

    /* 监听话题标签换行 */
    .topics-list {
        gap: 5px;
    }

    .topics-select {
        min-height: 140px;
    }

    .topic-item {
        padding: 6px 8px;
    }

    .topics-columns > div {
        flex: 1 1 100%;
    }

    .topic-selector-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .topic-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .topic-tag {
        font-size: 0.7rem;
        padding: 3px 6px;
    }

    /* 日志更紧凑 */
    .logs-container {
        max-height: 200px;
    }

    .log-entry {
        padding: 6px;
        flex-direction: column;
        align-items: flex-start;
    }

    .log-time,
    .log-level {
        margin-bottom: 2px;
    }
}

/* 横屏手机优化 */
@media (max-width: 768px) and (orientation: landscape) {
    .status-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .logs-container {
        max-height: 200px;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    /* 增大可点击区域 */
    .btn {
        min-height: 44px;
        min-width: 44px;
    }

    .positions-table th {
        padding: 12px 8px;
    }

    /* 移除hover效果 */
    .positions-table tbody tr:hover,
    .trades-table tbody tr:hover {
        background: transparent;
    }

    /* 添加点击反馈 */
    .positions-table tbody tr:active,
    .trades-table tbody tr:active {
        background: #f0f0f0;
    }

    .btn:active {
        transform: scale(0.98);
    }
}

/* ========================================
   KOL排行榜样式
   ======================================== */

/* KOL控制栏 */
.kol-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.kol-select {
    padding: 6px 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.kol-select:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.kol-select option {
    background: #2c3e50;
    color: white;
}

/* KOL排行榜容器 */
.kol-rankings-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* KOL卡片 */
.kol-card {
    display: flex;
    gap: 15px;
    align-items: stretch;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.kol-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* KOL排名 */
.kol-rank {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    min-width: 60px;
    color: #2c3e50;
}

/* KOL内容区 */
.kol-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* KOL头部 */
.kol-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    padding-bottom: 12px;
    border-bottom: 2px solid #ecf0f1;
}

.kol-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 0;
}

.kol-pnl {
    font-size: 1.2rem;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 8px;
    background: #f8f9fa;
}

.kol-pnl.profit {
    color: #27ae60;
    background: rgba(39, 174, 96, 0.1);
}

.kol-pnl.loss {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

/* KOL统计网格 */
.kol-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.kol-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    background: white;
    border-radius: 8px;
    border: 1px solid #ecf0f1;
}

.kol-stat-label {
    font-size: 0.75rem;
    color: #7f8c8d;
    font-weight: 500;
}

.kol-stat-value {
    font-size: 1rem;
    font-weight: 700;
    color: #2c3e50;
}

.kol-stat-value.profit {
    color: #27ae60;
}

.kol-stat-value.loss {
    color: #e74c3c;
}

.kol-stat-detail {
    font-size: 0.7rem;
    color: #95a5a6;
}

/* KOL加载/错误状态 */
.kol-loading,
.kol-error,
.kol-no-data {
    text-align: center;
    padding: 40px 20px;
    color: #7f8c8d;
    font-size: 1rem;
}

.kol-loading i {
    font-size: 2rem;
    margin-bottom: 10px;
    color: #3498db;
}

.kol-error {
    color: #e74c3c;
}

.kol-error i {
    font-size: 2rem;
    margin-bottom: 10px;
}

/* KOL排行榜响应式 - 平板 */
@media (max-width: 1024px) {
    .kol-stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .kol-rank {
        min-width: 50px;
        font-size: 1.5rem;
    }
}

/* KOL排行榜响应式 - 手机 */
@media (max-width: 768px) {
    .kol-card {
        flex-direction: column;
        gap: 12px;
        padding: 12px;
    }

    .kol-rank {
        min-width: auto;
        font-size: 1.8rem;
        padding: 8px 0;
        border-bottom: 1px solid #ecf0f1;
    }

    .kol-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .kol-name {
        font-size: 1rem;
    }

    .kol-pnl {
        font-size: 1.1rem;
        align-self: stretch;
        text-align: center;
    }

    .kol-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .kol-stat {
        padding: 6px;
    }

    .kol-stat-label {
        font-size: 0.7rem;
    }

    .kol-stat-value {
        font-size: 0.9rem;
    }

    .kol-stat-detail {
        font-size: 0.65rem;
    }

    .kol-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        width: 100%;
    }

    .kol-select {
        width: 100%;
    }
}

/* KOL排行榜响应式 - 小屏手机 */
@media (max-width: 480px) {
    .kol-stats-grid {
        grid-template-columns: 1fr;
    }

    .kol-card {
        padding: 10px;
    }

    .kol-rank {
        font-size: 1.5rem;
    }

    .kol-name {
        font-size: 0.95rem;
    }

    .kol-pnl {
        font-size: 1rem;
        padding: 5px 10px;
    }
}

/* ========================================
   KOL排行榜入口按钮（消息监听卡片内）
   ======================================== */

.kol-entry-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #ecf0f1;
}

.kol-entry-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    color: white;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(74, 85, 104, 0.3);
}

.kol-entry-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 85, 104, 0.4);
}

.kol-entry-btn i:first-child {
    font-size: 1.2rem;
    margin-right: 10px;
}

.kol-entry-btn span {
    flex: 1;
    font-size: 1rem;
}

.kol-entry-btn i:last-child {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* 响应式 */
@media (max-width: 768px) {
    .kol-entry-btn {
        padding: 10px 14px;
    }

    .kol-entry-btn span {
        font-size: 0.95rem;
    }
}
