/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* CSS变量 - 深色主题配色 */
:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    background: linear-gradient(to right, #fff, #e0e7ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.1rem;
    color: #e0e7ff;
    opacity: 0.9;
}

/* 主内容布局 */
.main-content {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 24px;
}

/* 卡片样式 */
.card {
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.card h2 {
    font-size: 1.4rem;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.card h3 {
    font-size: 1.1rem;
    margin: 20px 0 12px;
    color: var(--text-secondary);
}

/* 搜索框 */
.search-box {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.search-box input {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.2s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-box button {
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.search-box button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

/* 公司列表 */
.company-list {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.company-item {
    padding: 12px;
    margin-bottom: 8px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.company-item:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--primary-color);
    transform: translateX(4px);
}

.company-item.selected {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--primary-color);
}

.company-code {
    font-weight: 600;
    color: var(--primary-color);
}

.company-name {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* 已选公司列表 */
.selected-list {
    min-height: 60px;
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.selected-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 6px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    border-left: 3px solid var(--primary-color);
}

.selected-item button {
    background: var(--danger-color);
    color: white;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.selected-item button:hover {
    background: #dc2626;
}

.company-label {
    cursor: pointer;
    transition: all 0.2s;
    padding: 2px 6px;
    border-radius: 4px;
}

.company-label:hover {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary-color);
}

/* 按钮样式 */
.btn-primary,
.btn-secondary {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-secondary);
    border-color: var(--primary-color);
}

.btn-primary:disabled,
.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 欢迎屏幕 */
.welcome-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 500px;
}

.welcome-card {
    max-width: 600px;
    text-align: center;
}

.welcome-card h2 {
    font-size: 2rem;
    margin-bottom: 24px;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-card ul {
    text-align: left;
    margin: 24px 0;
    padding-left: 24px;
}

.welcome-card li {
    margin: 12px 0;
    color: var(--text-secondary);
    font-size: 1.05rem;
}

.tip {
    margin-top: 24px;
    padding: 16px;
    background: rgba(99, 102, 241, 0.1);
    border-left: 4px solid var(--primary-color);
    border-radius: 6px;
    color: var(--text-secondary);
}

/* Tabs样式 */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 10px 20px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 指标网格 */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.metric-card {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    transition: all 0.2s;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.metric-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.metric-trend-btn {
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.metric-trend-btn:hover {
    border-color: var(--primary-color);
    color: var(--text-primary);
}

.metric-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.metric-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.metric-unit {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-left: 4px;
}

.metric-value.positive {
    color: var(--success-color);
}

.metric-value.negative {
    color: var(--danger-color);
}

/* 图表容器 */
.chart-container {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.chart-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.chart-container.half {
    margin-bottom: 0;
}

/* 加载动画 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--bg-tertiary);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

#loadingText {
    margin-top: 16px;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Toast提示 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--primary-color);
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 10000;
    max-width: 400px;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    border-left-color: var(--success-color);
}

.toast.error {
    border-left-color: var(--danger-color);
}

.metric-trend-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 10000;
}

.metric-trend-modal.show {
    opacity: 1;
    visibility: visible;
}

.metric-trend-content {
    width: min(900px, 90vw);
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    padding: 20px;
}

.metric-trend-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.metric-trend-header h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
}

.metric-trend-close {
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.metric-trend-close:hover {
    color: var(--text-primary);
    background: var(--primary-dark);
}

.metric-trend-body {
    background: var(--bg-tertiary);
    border-radius: 10px;
    padding: 16px;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-color);
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .sidebar {
        order: 2;
    }

    .chart-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8rem;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
    }
}

/* ========== 指标提示框样式 ========== */
.metric-card {
    position: relative;
}

.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.metric-help-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: 50%;
    font-size: 11px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
    flex-shrink: 0;
}

.metric-help-icon:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

/* 提示框容器 */
.metric-tooltip-wrapper {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    z-index: 9999;
    padding-bottom: 8px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    pointer-events: none;
}

.metric-card:hover .metric-tooltip-wrapper,
.metric-help-icon:hover+.metric-tooltip-wrapper,
.metric-tooltip-wrapper:hover {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.metric-card:hover {
    z-index: 10;
}

.metric-tooltip {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid var(--primary-color);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(99, 102, 241, 0.3);
    min-width: 300px;
    max-width: 380px;
}

.tooltip-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--primary-color);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.tooltip-section {
    margin-bottom: 10px;
}

.tooltip-icon {
    margin-right: 6px;
}

.tooltip-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    display: block;
    margin-bottom: 4px;
}

.tooltip-value {
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.tooltip-standards {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.std-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.std-badge.excellent {
    background: rgba(0, 200, 83, 0.2);
    color: #00c853;
}

.std-badge.good {
    background: rgba(76, 175, 80, 0.2);
    color: #4caf50;
}

.std-badge.normal {
    background: rgba(255, 152, 0, 0.2);
    color: #ff9800;
}

.std-badge.poor {
    background: rgba(244, 67, 54, 0.2);
    color: #f44336;
}

.tooltip-note {
    margin-top: 10px;
    padding: 8px;
    background: rgba(255, 193, 7, 0.1);
    border-radius: 6px;
    font-size: 0.8rem;
    color: #ffc107;
}

/* ========== 数据管理区域样式 ========== */
.data-manager-area {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.data-manager-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 24px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
}

.data-manager-header h2 {
    color: white;
    font-size: 2rem;
    margin: 0;
}

.data-manager-layout {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* 统计卡片网格 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.stat-icon {
    font-size: 3rem;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    border-radius: 12px;
}

.stat-content {
    flex: 1;
}

.stat-content h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0 0 8px 0;
    font-weight: 500;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

/* 进度条 */
.progress-container {
    margin-top: 16px;
}

.progress-bar {
    height: 24px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 12px;
    transition: width 0.5s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.progress-text {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.batch-progress-detail {
    margin-top: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.batch-input-group input[readonly] {
    opacity: 0.7;
    cursor: not-allowed;
}

.failure-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.failure-summary {
    margin-top: 10px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.failure-list {
    margin-top: 12px;
    max-height: 260px;
    overflow-y: auto;
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 12px;
    font-size: 0.85rem;
}

.failure-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
    border-radius: 6px;
    background: rgba(239, 68, 68, 0.08);
    border-left: 3px solid var(--danger-color);
    margin-bottom: 8px;
}

.failure-code {
    color: var(--primary-color);
    font-weight: 600;
}

.failure-meta {
    color: var(--text-muted);
}

/* 批量控制面板 */
.batch-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.batch-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.batch-input-group label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.batch-input-group input[type="number"] {
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.2s;
}

.batch-input-group input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.batch-checkbox {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.batch-checkbox label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.batch-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.batch-checkbox span {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* 快速操作按钮 */
.batch-quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.batch-quick-actions button {
    padding: 12px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.batch-quick-actions .btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.batch-quick-actions .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(99, 102, 241, 0.4);
}

.batch-quick-actions .btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.batch-quick-actions .btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-color);
}

/* 获取日志 */
.fetch-log {
    max-height: 400px;
    overflow-y: auto;
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 16px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.log-empty {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 40px 20px;
}

.log-entry {
    display: flex;
    gap: 12px;
    padding: 8px 12px;
    margin-bottom: 4px;
    border-radius: 6px;
    font-size: 0.85rem;
    line-height: 1.5;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.log-entry.log-success {
    background: rgba(16, 185, 129, 0.1);
    border-left: 3px solid var(--success-color);
}

.log-entry.log-error {
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid var(--danger-color);
}

.log-entry.log-info {
    background: rgba(99, 102, 241, 0.1);
    border-left: 3px solid var(--primary-color);
}

.log-entry.log-warning {
    background: rgba(245, 158, 11, 0.1);
    border-left: 3px solid var(--warning-color);
}

.log-time {
    color: var(--text-muted);
    font-weight: 500;
    flex-shrink: 0;
}

.log-message {
    color: var(--text-secondary);
    flex: 1;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .batch-controls {
        grid-template-columns: 1fr;
    }

    .batch-quick-actions {
        grid-template-columns: 1fr;
    }

    .data-manager-header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
}


/* ========== 行业对比样式 ========== */
.benchmark-container {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border-color);
}

.benchmark-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.benchmark-bar {
    position: relative;
    height: 20px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    overflow: hidden;
}

.benchmark-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s ease;
}

.benchmark-fill.excellent {
    background: linear-gradient(90deg, #00c853, #69f0ae);
}

.benchmark-fill.good {
    background: linear-gradient(90deg, #4caf50, #81c784);
}

.benchmark-fill.normal {
    background: linear-gradient(90deg, #ff9800, #ffb74d);
}

.benchmark-fill.poor {
    background: linear-gradient(90deg, #f44336, #e57373);
}

.benchmark-marker {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 3px;
    background: white;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

.benchmark-marker::after {
    content: '▼';
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: white;
}

.benchmark-stats {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 0.75rem;
}

.benchmark-current {
    color: var(--primary-color);
    font-weight: 600;
}

.benchmark-avg {
    color: var(--text-muted);
}

.benchmark-diff {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.benchmark-diff.positive {
    background: rgba(0, 200, 83, 0.2);
    color: #00c853;
}

.benchmark-diff.negative {
    background: rgba(244, 67, 54, 0.2);
    color: #f44336;
}

/* ========== 评级徽章 ========== */
.rating-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 8px;
}

.rating-badge.excellent {
    background: rgba(0, 200, 83, 0.15);
    color: #00c853;
}

.rating-badge.good {
    background: rgba(76, 175, 80, 0.15);
    color: #4caf50;
}

.rating-badge.normal {
    background: rgba(255, 152, 0, 0.15);
    color: #ff9800;
}

.rating-badge.poor {
    background: rgba(244, 67, 54, 0.15);
    color: #f44336;
}

/* 原始数据Tab样式 */
.sub-tabs-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.sub-tab-btn {
    padding: 8px 16px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.3s ease;
    border-radius: 6px;
}

.sub-tab-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.sub-tab-btn.active {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.raw-data-container {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 20px;
}

.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.raw-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    white-space: nowrap;
}

.raw-data-table th,
.raw-data-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    text-align: right;
}

.raw-data-table th {
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 600;
}

/* 固定首列 */
.raw-data-table .sticky-col {
    position: sticky;
    left: 0;
    background-color: var(--bg-card);
    z-index: 1;
    border-right: 2px solid var(--border-color);
    text-align: left;
    font-weight: 500;
    min-width: 150px;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.raw-data-table th.sticky-col {
    background-color: var(--bg-secondary);
    z-index: 2;
}

.raw-data-table tr:hover td {
    background-color: var(--bg-hover);
}

/* 保持固定列在hover时背景色一致 */
.raw-data-table tr:hover .sticky-col {
    background-color: var(--bg-hover);
}

/* ========== 选股器样式 ========== */
.header-nav {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin: 20px 0;
}

.nav-btn {
    padding: 8px 24px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    color: white;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.nav-btn.active {
    background: white;
    color: var(--primary-color);
    font-weight: 600;
}

.screener-area {
    animation: fadeIn 0.3s ease;
}

.screener-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.screener-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 24px;
    align-items: start;
}

.filter-group {
    margin-bottom: 20px;
}

.filter-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.range-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.range-inputs input {
    width: 100%;
    padding: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.range-inputs span {
    color: var(--text-muted);
}

.screener-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 30px;
}

.screener-table {
    width: 100%;
    border-collapse: collapse;
}

.screener-table th,
.screener-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.screener-table th {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 600;
}

.screener-table tr:hover {
    background: var(--bg-hover);
}

.text-success {
    color: var(--success-color);
}

.text-danger {
    color: var(--danger-color);
}

.stock-code {
    font-family: monospace;
    font-weight: 600;
    color: var(--primary-color);
}

.btn-sm {
    padding: 4px 12px;
    font-size: 0.85rem;
    border-radius: 4px;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-view {
    background: var(--primary-color);
    color: white;
}

.btn-view:hover {
    background: var(--primary-dark);
}

@media (max-width: 1000px) {
    .screener-layout {
        grid-template-columns: 1fr;
    }
}

/* ========== 移动端优化样式 ========== */

/* 768px以下 - 平板/大屏手机 */
@media (max-width: 768px) {

    /* 容器padding优化 */
    .container {
        padding: 12px;
    }

    /* 头部优化 */
    .header {
        padding: 20px 16px;
        margin-bottom: 20px;
        border-radius: 12px;
    }

    .header h1 {
        font-size: 1.5rem;
        margin-bottom: 8px;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    /* 导航按钮优化 - 增大触摸区域 */
    .header-nav {
        gap: 10px;
        margin: 16px 0;
    }

    .nav-btn {
        padding: 12px 20px;
        min-height: 44px;
        font-size: 0.9rem;
    }

    /* Tab优化 - 水平滚动 */
    .tabs {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding-bottom: 8px;
        margin-bottom: 16px;
        gap: 6px;
    }

    .tabs::-webkit-scrollbar {
        display: none;
    }

    .tab-btn {
        flex-shrink: 0;
        padding: 12px 16px;
        min-height: 44px;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    /* 卡片优化 */
    .card {
        padding: 16px;
        border-radius: 10px;
    }

    .card h2 {
        font-size: 1.2rem;
        margin-bottom: 12px;
    }

    /* 搜索框优化 */
    .search-box {
        flex-direction: column;
        gap: 10px;
    }

    .search-box input {
        padding: 14px;
        font-size: 16px;
        /* 防止iOS自动缩放 */
    }

    .search-box button {
        padding: 14px;
        min-height: 44px;
        width: 100%;
    }

    /* 按钮通用优化 */
    .btn-primary,
    .btn-secondary {
        padding: 14px;
        min-height: 48px;
        font-size: 1rem;
    }

    /* 公司列表优化 */
    .company-list {
        max-height: 300px;
    }

    .company-item {
        padding: 14px;
        margin-bottom: 10px;
    }

    /* 指标网格优化 */
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .metric-card {
        padding: 14px;
    }

    .metric-value {
        font-size: 1.3rem;
    }

    .metric-label {
        font-size: 0.8rem;
    }

    /* 图表容器优化 */
    .chart-container {
        padding: 14px;
        margin-bottom: 16px;
    }

    .chart-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    /* 欢迎屏幕优化 */
    .welcome-screen {
        min-height: 400px;
    }

    .welcome-card {
        padding: 0 10px;
    }

    .welcome-card h2 {
        font-size: 1.5rem;
    }

    .welcome-card li {
        font-size: 0.95rem;
        margin: 10px 0;
    }

    /* 提示框移动端适配 */
    .metric-tooltip-wrapper {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        transform: translateY(100%);
        padding-bottom: 0;
        z-index: 9999;
    }

    .metric-card:hover .metric-tooltip-wrapper,
    .metric-tooltip-wrapper.active {
        transform: translateY(0);
    }

    .metric-tooltip {
        border-radius: 16px 16px 0 0;
        min-width: 100%;
        max-width: 100%;
        max-height: 60vh;
        overflow-y: auto;
        padding: 20px;
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }

    /* 选股器优化 */
    .screener-header {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .screener-header button {
        width: 100%;
    }

    .filter-group label {
        font-size: 0.85rem;
    }

    .range-inputs input {
        padding: 12px;
        font-size: 16px;
        /* 防止iOS自动缩放 */
    }

    .screener-actions {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    /* 表格优化 */
    .screener-table th,
    .screener-table td {
        padding: 10px 8px;
        font-size: 0.85rem;
    }

    .raw-data-table th,
    .raw-data-table td {
        padding: 10px 8px;
        font-size: 12px;
    }

    /* Toast优化 */
    .toast {
        left: 12px;
        right: 12px;
        max-width: none;
    }
}

/* 480px以下 - 小屏手机 */
@media (max-width: 480px) {
    .container {
        padding: 8px;
    }

    .header {
        padding: 16px 12px;
        border-radius: 10px;
    }

    .header h1 {
        font-size: 1.3rem;
    }

    .subtitle {
        font-size: 0.8rem;
    }

    .nav-btn {
        padding: 10px 14px;
        font-size: 0.85rem;
    }

    .card {
        padding: 12px;
    }

    .card h2 {
        font-size: 1.1rem;
    }

    /* 指标单列显示 */
    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .metric-card {
        padding: 12px;
    }

    .metric-value {
        font-size: 1.2rem;
    }

    /* Tab按钮更紧凑 */
    .tab-btn {
        padding: 10px 12px;
        font-size: 0.8rem;
    }

    /* 欢迎卡片 */
    .welcome-card h2 {
        font-size: 1.3rem;
    }

    .welcome-card li {
        font-size: 0.9rem;
    }

    .tip {
        padding: 12px;
        font-size: 0.9rem;
    }

    /* 图表容器 */
    .chart-container {
        padding: 10px;
    }

    /* 评分卡片 */
    .score-card h3 {
        font-size: 1rem;
    }
}

/* iPhone安全区域支持 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .container {
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }

    .loading-overlay {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* 禁用hover效果在触摸设备上 */
@media (hover: none) and (pointer: coarse) {
    .company-item:hover {
        transform: none;
    }

    .btn-primary:hover:not(:disabled),
    .btn-secondary:hover:not(:disabled) {
        transform: none;
    }

    .metric-card:hover {
        transform: none;
    }

    /* 触摸设备上点击显示提示框 */
    .metric-card:active .metric-tooltip-wrapper {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
}

/* 横屏优化 */
@media (max-height: 500px) and (orientation: landscape) {
    .header {
        padding: 12px;
        margin-bottom: 12px;
    }

    .header h1 {
        font-size: 1.3rem;
    }

    .welcome-screen {
        min-height: 300px;
    }

    .metric-tooltip {
        max-height: 80vh;
    }
}
