:root {
    --bg-color: #f5f6f8;
    --panel-bg: #ffffff;
    --text-main: #17202a;
    --text-muted: #687382;
    --line-soft: #e4e8ee;
    --color-up: #d94f45;
    --color-down: #229b65;
    --color-primary: #2f6fed;
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    background: var(--bg-color);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

.dashboard-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 36px;
}

.header-banner {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(280px, 1.4fr);
    gap: 24px;
    align-items: center;
    margin-bottom: 18px;
    padding: 22px 24px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    background: var(--panel-bg);
    box-shadow: 0 10px 30px rgba(18, 30, 48, 0.06);
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--color-primary);
    font-size: 13px;
    font-weight: 700;
}

.header-banner h1 {
    margin: 0;
    font-size: 28px;
    line-height: 1.2;
    font-weight: 750;
}

.total-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.summary-item {
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    background: #fafbfc;
}

.label,
.meta,
.fund-code,
.fund-range,
.fund-profit span {
    color: var(--text-muted);
}

.label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
}

.value {
    display: block;
    font-size: 30px;
    line-height: 1;
    font-weight: 780;
}

.meta {
    display: block;
    margin-top: 8px;
    font-size: 12px;
}

.range-toolbar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 0 0 18px;
    padding: 6px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    background: var(--panel-bg);
    box-shadow: 0 8px 24px rgba(18, 30, 48, 0.04);
}

.range-button {
    min-height: 42px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.range-button.active {
    background: var(--color-primary);
    color: #ffffff;
    box-shadow: 0 6px 14px rgba(47, 111, 237, 0.22);
}

.range-button:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.fund-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 16px;
}

.fund-card {
    min-width: 0;
    overflow: hidden;
    padding: 18px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    background: var(--panel-bg);
    box-shadow: 0 8px 24px rgba(18, 30, 48, 0.05);
}

.fund-header {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 14px;
}

.fund-title {
    margin: 0 0 6px;
    font-size: 17px;
    line-height: 1.35;
    font-weight: 720;
}

.fund-code {
    margin: 0;
    font-size: 12px;
}

.fund-range {
    margin: 4px 0 0;
    font-size: 12px;
}

.fund-profit {
    display: grid;
    grid-template-columns: repeat(2, max-content);
    gap: 12px;
    text-align: right;
    white-space: nowrap;
}

.fund-profit span {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
}

.fund-profit strong {
    display: block;
    font-size: 16px;
    line-height: 1;
}

.chart-container {
    width: 100%;
    height: 300px;
}

.profit-up {
    color: var(--color-up);
}

.profit-down {
    color: var(--color-down);
}

.error-card {
    min-height: 160px;
}

.error-message {
    margin: 20px 0 0;
    color: var(--text-muted);
}

@media (max-width: 760px) {
    .dashboard-shell {
        width: min(100% - 20px, 1180px);
        padding-top: 10px;
    }

    .header-banner {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 18px;
    }

    .total-summary {
        grid-template-columns: 1fr;
    }

    .range-toolbar {
        position: sticky;
        top: 0;
        z-index: 2;
        margin-bottom: 12px;
    }

    .range-button {
        min-height: 44px;
        font-size: 13px;
    }

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

    .fund-header {
        display: block;
    }

    .fund-profit {
        margin-top: 12px;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        text-align: left;
    }

    .chart-container {
        height: 280px;
    }
}
