:root {
    --primary: rgb(93 79 248 / 95%);
    --primary-soft: rgb(93 79 248 / 7%);
    --primary-soft2: rgb(93 79 248 / 12%);
    --primary-light: rgb(93 79 248 / 15%);
    --primary-border: rgb(93 79 248 / 22%);
    --bg: #ffffff;
    --card-bg: #fff;
    --text-main: #1a1a2e;
    --text-sub: #6b7280;
    --text-faint: #a0a0b0;
    --border: #ececf2;
}

.dashboard {
    padding: 1.2em;
    background: #f7f7fb;
    border-radius: 12px;
}

.main-content {
    padding: 1.2em;
}

.main-content h2 {
    font-size: 16px;
    font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    position: relative;
    margin-bottom: 0.3em;
}

/* ============================================================
   扁平卡片：无阴影、无渐变、细边框
   ============================================================ */
.stats-card {
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 1.2em;
    margin-bottom: 1.2em;
}

/* ============================================================
   实时活跃
   ============================================================ */
.live-card {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 2em;
    flex-wrap: wrap;
}

.live-main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.6em;
    min-width: 180px;
}

.live-top-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    font-size: 0.85em;
    font-weight: 500;
    text-transform: uppercase;
    color: var(--text-sub);
}

.live-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
    animation: pulse 1.8s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.55;
        transform: scale(1.2);
    }
}

.live-number-row {
    display: flex;
    align-items: end;
    gap: 0.4em;
}

.live-big {
    font-size: 3em;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.06em;
    color: var(--primary);
}

.live-unit {
    font-size: 0.95em;
    color: var(--text-sub);
    font-weight: 400;
}

.live-update-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    align-self: flex-start;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 0.75em;
    font-weight: 500;
    padding: 0.28em 0.75em;
    border-radius: 40px;
}

/* 右侧迷你趋势 —— 扁平：只用一条竖线分隔 */
.live-side {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.5em;
    min-width: 220px;
    flex: 1;
    max-width: 360px;
    padding-left: 2em;
}

.live-side-label {
    font-size: 0.72em;
    color: var(--text-faint);
    font-weight: 500;
    letter-spacing: 0.02em;
    display: flex;
    justify-content: space-between;
}

.mini-bars {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 44px;
}

.mini-bars .mb {
    flex: 1;
    background: var(--primary-soft2);
    border-radius: 3px 3px 2px 2px;
    min-height: 4px;
}

.mini-bars .mb.peak {
    background: var(--primary);
}

/* ============================================================
   今日 / 累计 —— 两张扁平卡片
   扁平化下不用色块，靠「顶部主题色细线」区分今日
   ============================================================ */
.stats-pair {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1em;
    align-items: stretch;
    margin-bottom: 1.2em;
}

.pair-card {
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 1.2em 1.2em 1.4em;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.pair-card .label {
    font-size: 0.85em;
    color: var(--text-sub);
    font-weight: 500;
}

.pair-card .value {
    font-size: 1.8em;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    letter-spacing: -.02em;
}

/* ============================================================
   曲线图
   ============================================================ */
.chart-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6em 1.5em;
    margin-bottom: 1em;
}

.chart-legend {
    display: flex;
    align-items: center;
    gap: 1.5em;
    font-size: 0.8em;
    color: var(--text-sub);
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4em;
}

.legend-line {
    width: 14px;
    height: 2.5px;
    border-radius: 2px;
}

.legend-line.pv {
    background: var(--primary);
}

.legend-line.uv {
    background: #0ea5e9;
}

.totals-text {
    font-size: 0.8em;
    color: var(--text-sub);
    font-variant-numeric: tabular-nums;
}

.totals-text strong {
    color: var(--text-main);
    font-weight: 600;
}

.chart-svg-wrapper {
    width: 100%;
    height: 170px;
    position: relative;
}

.chart-svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

.chart-svg path.curve {
    fill: none;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chart-svg path.curve.pv {
    stroke: var(--primary);
}

.chart-svg path.curve.uv {
    stroke: #0ea5e9;
}

.chart-svg path.area {
    stroke: none;
}

/* ============================================================
   图表行：左侧 Y 轴 + 右侧曲线区
   ============================================================ */
.chart-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.chart-y-axis {
    width: 38px;
    height: 170px;
    flex-shrink: 0;
    position: relative;
}

.chart-y-axis svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

.chart-y-axis text {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 0.8em;
    fill: var(--text-faint);
    font-variant-numeric: tabular-nums;
}

.chart-y-axis line {
    stroke: var(--border);
    stroke-width: 1;
}

.chart-main {
    flex: 1;
    min-width: 0;
}

.x-axis {
    display: flex;
    justify-content: space-between;
    font-size: 0.8em;
    color: var(--text-faint);
    padding: 0.4em 0;
}

.chart-footer {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-top: 0.9em;
    padding-top: 1em;
    border-top: 1px solid #ececf2;
}

.toggle-table-btn {
    background: #fff;
    border: 1px solid var(--border);
    color: var(--text-sub);
    font-size: 0.8em;
    font-weight: 500;
    padding: 0.42em 1.1em;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
}

.toggle-table-btn:hover {
    border-color: var(--primary-border);
    color: var(--primary);
    background: var(--primary-soft);
}

.data-table-wrapper {
    margin-top: 1.2em;
    display: none;
    max-height: 380px;
    overflow-y: auto;
}

.data-table-wrapper.show {
    display: block;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85em;
}

.data-table th {
    text-align: left;
    font-weight: 600;
    color: var(--text-sub);
    padding: 0.5em 0 0.65em;
    border-bottom: 1px solid var(--border);
    background: #fff;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    position: sticky;
    top: 0;
}

.data-table td {
    padding: 0.7em 0;
    border-bottom: 1px solid #f6f6fa;
    color: #3a3a52;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table .numeric {
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

.data-table .pv-val {
    color: var(--primary);
}

.data-table .uv-val {
    color: #0e94c9;
}

/* ============================================================
   热门工具
   ============================================================ */
.tool-row {
    display: grid;
    grid-template-columns: 1.6rem minmax(0, 1fr) auto;
    align-items: center;
    gap: .6rem;
    padding: .45rem 0;
    border-bottom: 1px solid var(--border);
}

.tool-rank {
    color: #6c7280;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.tool-main {
    min-width: 0;
}

.tool-name {
    display: block;
    color: #1a1a2e;
    font-size: 14px;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tool-num {
    color: #6c7280;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.tool-bar {
    height: 3px;
    margin-top: 4px;
    border-radius: 2px;
    background: var(--primary);
    background: color-mix(in srgb, var(--primary) 45%, transparent);
}

.tool-stats {
    display: flex;
    align-items: center;
    gap: 1em;
    color: var(--text-sub);
    font-size: 0.88em;
    background: #f6f6fa;
    padding: 0.35em 1.1em;
    border-radius: 8px;
}

.tool-stats .dot-sep {
    color: #d0d0dc;
}

.stats-header{
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-caption {
    font-size: 0.82em;
    color: var(--text-sub);
    margin-bottom: 1.2em;
    font-weight: 500;
}

.text-muted {
    color: var(--text-faint);
    font-size: 0.78em;
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 820px) {
    .stats-pair {
        grid-template-columns: 1fr;
    }

    .pair-card.total .pair-metric + .pair-metric {
        padding-left: 0;
        border-left: none;
        padding-top: 0.9em;
    }
}

@media (max-width: 760px) {
    .live-card {
        flex-direction: column;
        gap: 1.2em;
    }

    .live-side {
        max-width: 100%;
        padding-left: 0;
        border-left: none;
        padding-top: 1.1em;
    }
}

@media (max-width: 640px) {
    .stats-card, .pair-card {
        padding: 1.15em 1em;
    }

    .live-big {
        font-size: 2.2em;
    }

    .pair-metric .value {
        font-size: 1.5em;
    }

    .chart-svg-wrapper {
        height: 130px;
    }

    .chart-y-axis {
        height: 130px;
    }

    .chart-top {
        flex-direction: column;
        align-items: flex-start;
    }

    .x-axis {
        font-size: 0.6em;
    }

    .chart-y-axis text {
        font-size: 0.6em;
    }

    .dashboard {
        padding: 0;
        background: #fff;
    }
}