:root {
    color-scheme: light;
    --bg: #f6f8fa;
    --panel: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --line: #e5e7eb;
    --blue: #2563eb;
    --green: #138a45;
    --red: #dc2626;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background-color: var(--bg);
    color: var(--text);
    padding: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

a {
    color: var(--blue);
    text-decoration: none;
}

.nav {
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    height: 98px;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

.nav-brand {
    flex: 0 1 auto;
    min-width: 0;
}

.nav-inner > .nav-links {
    margin-left: auto;
}

.nav-brand {
    font-size: 32px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-brand small {
    display: block;
    font-size: 13px;
    font-weight: 400;
    color: var(--muted);
    margin-top: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-links {
    display: flex;
    gap: 6px;
}

.nav-link {
    padding: 8px 18px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    color: var(--muted);
    transition: background .15s, color .15s;
    white-space: nowrap;
}

.nav-link:hover {
    background: var(--bg);
    color: var(--text);
}

.nav-link.active {
    background: var(--blue);
    color: #fff;
}

.nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 20px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    color: var(--text);
    width: 38px;
    height: 38px;
}

@media (max-width: 790px) {
    .nav-inner {
        position: relative;
        gap: 12px;
        height: 82px;
        padding: 0 16px;
    }
    .nav-brand {
        max-width: calc(100% - 50px);
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 24px;
    }
    .nav-toggle {
        display: inline-flex;
        flex: 0 0 38px;
    }
    .nav-links {
        display: flex;
        position: absolute;
        top: 82px;
        left: 0;
        right: 0;
        background: var(--panel);
        flex-direction: column;
        padding: 0 16px;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease, padding 0.3s ease;
        z-index: 10;
        border-top: 1px solid var(--line);
        width: 60%;
        box-shadow: 0 3px 4px -1px rgba(0, 0, 0, 0.05), 0 2px 3px -1px rgba(0, 0, 0, 0.05)
    }
    .nav-links.nav-open {
        max-height: 300px;
        padding: 8px 16px;
    }
}

.page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.toolbar-info,
.filters {
    min-width: 0;
}

.toolbar-info h1 {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
}

.page-desc {
    margin: 6px 0 0;
    font-size: 14px;
    color: var(--muted);
    line-height: 1.5;
}

.filters {
    display: flex;
    gap: 8px;
    align-items: center;
    max-width: 100%;
}

.filters input[type="search"] {
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 14px;
    width: 200px;
}

.filters button {
    padding: 8px 16px;
    background: var(--blue);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
}

.filter-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--muted);
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
}

.filter-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* 隐藏暂停申购按钮 */
.filters button.btn-filter {
    padding: 7px 16px;
    border: 1px solid #eee;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s;
    user-select: none;
    line-height: 1.4;
    color: #999;
    background: #eee;
}

.btn-filter:hover {

}

.filters button.active {
    background: #e7eeff;
    color: var(--blue);
    border: 1px solid var(--blue);
}

/* 手机端基金代码+名称合并 */
.name-code-mobile {
    display: none;
}

/* 价格数字更新动画 */
@keyframes flash-up {
    0% { background-color: transparent; }
    30% { background-color: rgba(220, 38, 38, 0.15); }
    100% { background-color: transparent; }
}
@keyframes flash-down {
    0% { background-color: transparent; }
    30% { background-color: rgba(19, 138, 69, 0.15); }
    100% { background-color: transparent; }
}
.price-num.flash-up {
    animation: flash-up 1s ease;
    border-radius: 2px;
}
.price-num.flash-down {
    animation: flash-down 1s ease;
    border-radius: 2px;
}

.table-wrap {
    background: var(--panel);
    border-radius: 8px;
    border: 1px solid var(--line);
    overflow-x: auto;
    width: 100%;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    /*min-width: 820px;*/
    border-collapse: collapse;
    font-size: 14px;
    table-layout: fixed;
}

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}

th.sortable {
    cursor: pointer;
    user-select: none;
}

th.sortable:hover {
    background: #e9ecef;
}

th.sortable::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 2px;
    vertical-align: middle;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 4px solid #ccc;
    border-top: 4px solid #ccc;
}

th.sortable.asc::after {
    border-bottom: 5px solid #333;
    border-top: none;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
}

th.sortable.desc::after {
    border-top: 5px solid #333;
    border-bottom: none;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
}

tr:hover {
    background: #f8f9fa;
}

td.name {
    font-weight: 500;
}

td.empty {
    text-align: center;
    color: var(--muted);
    padding: 40px 16px;
}

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

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

.muted {
    color: var(--muted);
}

.home-quotes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.hq-pair {
    background: var(--panel);
    border-radius: 8px;
    border: 1px solid var(--line);
    padding: 20px;
}

.hq-card {
    margin-bottom: 12px;
}

.hq-card:last-child {
    margin-bottom: 0;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.hq-future {
    font-size: 13px;
    color: var(--muted);
}

.qi-header {
    margin-bottom: 8px;
}

.qi-name {
    font-size: 14px;
    color: var(--text);
    font-weight: 500;
}

.qi-main {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.qi-price {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
}

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

.module {
    background: var(--panel);
    border-radius: 8px;
    border: 1px solid var(--line);
    padding: 20px;
}

.module-header {
    margin-bottom: 12px;
}

.module-symbol {
    font-size: 13px;
    font-weight: 600;
    color: var(--blue);
    margin-right: 8px;
}

.module-name {
    font-size: 13px;
    color: var(--muted);
}

.module-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

/* 数据更新状态 */
.update-status {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 24px;
    padding: 12px 20px;
    background: var(--panel);
    border-radius: 8px;
    border: 1px solid var(--line);
    font-size: 13px;
}

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

.status-label {
    color: var(--muted);
}

.status-value {
    font-weight: 500;
    color: var(--text);
}

.status-fresh {
    color: var(--green);
}

.status-stale {
    color: var(--muted);
}

.footer {
    text-align: center;
    padding: 24px;
    color: var(--muted);
    font-size: 13px;
}
.bottom-bar{
    background: var(--panel);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}
.bottom-bar-b {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 16px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 10px 32px;
    font-size: 12px;
    color: var(--muted);
}

.bottom-bar-left,
.bottom-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    max-width: 100%;
}

/* ========== 首页仪表盘样式 ========== */

/* 顶部时间栏 */
.time-header {
    width: 100%;
    max-width: 800px;
    margin: 28px auto;
    background-color: var(--panel);
    border: 1px solid var(--line);
    border-radius: 30px;
    padding: 10px 24px;
    display: flex;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.time-item {
    font-size: 11pt;
    color: #4b5563;
    font-variant-numeric: tabular-nums;
    font-family: "Courier New", Courier, monospace;
}

/* 首页基金统计卡片 */
.stats-row {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    flex: 1;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 20px 24px;
    text-align: center;
    box-shadow: 0 3px 5px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.05);
}

.stat-num {
    font-size: 32px;
    font-weight: 700;
    color: var(--blue);
    line-height: 1.2;
}

.stat-label {
    font-size: 14px;
    color: var(--muted);
    margin-top: 8px;
}

/* 双栏仪表盘容器 */
.dashboard-container {
    display: flex;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    gap: 24px;
}

/* 单个卡片 */
.card {
    flex: 1;
    min-width: 0;
    background-color: var(--panel);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--line);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.card .bg-logo {
    position: absolute;
    top: 0;
    right: -5%;
    opacity: .05;
}

/* 区块层级划分 */
.section-block {
    margin-bottom: 16px;
}

.section-block.last {
    margin-bottom: 0;
}

/* 纤细分割线 */
.divider {
    height: 1px;
    background-color: #f3f4f6;
    margin: 18px 0;
}

/* 灰色二级辅助标题标签 */
.title-label {
    font-size: 16pt;
    /* color: #9ca3af; */
    font-weight: 500;
    margin-bottom: 8px;
}

/* ETF 标题行 */
.etf-title-row {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
}

.etf-name {
    font-size: 12pt;
    font-weight: 600;
    color: #111827;
}

.etf-code {
    font-size: 10pt;
    color: #9ca3af;
    font-weight: bold;
    margin-left: 6px;
    text-transform: uppercase;
}

/* 数据对齐排版 */
.data-row {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px 0;
}

/* 核心行情价格数字 */
.price-num {
    font-size: 28pt;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.5px;
    font-variant-numeric: tabular-nums;
}

.price-num.small {
    font-size: 22pt;
}

/* 涨跌幅百分比 */
.change-percent {
    font-size: 12pt;
    font-weight: 600;
    margin-left: 12px;
    font-variant-numeric: tabular-nums;
}

/* 涨跌颜色 */
.up {
    color: var(--red);
}

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

/* 状态徽章标签 */
.status-badge {
    font-size: 9.5pt;
    background-color: #f3f4f6;
    color: #4b5563;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 12px;
    font-weight: 500;
    /* align-self: center; */
}

/* PE估值特定样式 */
.pe-value {
    font-size: 22pt;
    font-weight: 700;
    color: #111827;
    font-variant-numeric: tabular-nums;
}

.pe-unit {
    font-size: 12pt;
    color: #9ca3af;
    font-weight: normal;
}

.pe-label {
    font-size: 9pt;
    font-weight: 500;
    margin-left: 6px;
    vertical-align: middle;
}

.pe-range {
    font-size: 8pt;
    color: #9ca3af;
    vertical-align: middle;
    font-weight: 500;
}

/* ========== 全局状态栏 ========== */
.status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-bottom: 24px;
    padding: 10px 20px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 12px;
    color: var(--muted);
}

.status-bar-left,
.status-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-bar-item {
    white-space: nowrap;
}

.status-bar-item b {
    color: var(--text);
}

.status-bar-sep {
    width: 1px;
    height: 12px;
    background: var(--line);
}

/* ========== 基金详情页 ========== */
.detail-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--blue);
    font-size: 14px;
    margin-bottom: 20px;
}
.detail-back:hover { text-decoration: underline; }

.detail-header {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
}
.detail-header h1 { font-size: 24px; color: var(--text); margin: 0 0 16px 0; }
.detail-header .subtitle {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--muted);
    font-size: 16px;
    margin: 0;
}
.detail-header .subtitle .sep {
    width: 1px;
    height: 12px;
    background: var(--line);
}
.detail-header .official-link {
    display: inline-block;
    margin-top: 12px;
    padding: 6px 16px;
    background: var(--blue);
    color: #fff;
    border-radius: 6px;
    font-size: 13px;
}
.detail-header .official-link:hover { background: #2563eb; }

.meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}
.meta-item { text-align: center; }
.meta-item .label { display: block; color: var(--muted); font-size: 14px; margin-bottom: 4px;font-weight:500; }
.meta-item .value { display: block; color: var(--text); font-size: 20px; font-weight: 600;font-weight:500; }

.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.nav-table-section, .holdings-section {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 20px;
}
.nav-table-section h2, .holdings-section h2 {
    font-size: 18px;
    color: var(--text);
    margin: 0 0 16px 0;
}

.detail-table { width: 100%; border-collapse: collapse; }
.detail-table th {
    background: #f9fafb;
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    color: var(--muted);
    font-weight: 500;
    border-bottom: 1px solid var(--line);
}
.detail-table td {
    padding: 12px 16px;
    font-size: 14px;
    color: var(--text);
    border-bottom: 1px solid #f3f4f6;
    white-space: normal;
    overflow: visible;
}
.detail-table tr:hover { background: #f9fafb; }
.detail-table .positive { color: var(--red); }
.detail-table .negative { color: var(--green); }
.meta-item .positive { color: var(--red); }
.meta-item .negative { color: var(--green); }
.detail-table .empty-row td { text-align: center; color: var(--muted); padding: 40px; }

.holdings-date { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.holdings-warning { color: #d97706; margin-top: 8px; }
.detail-no-data { text-align: center; color: var(--muted); padding: 40px; }
.detail-loading { text-align: center; padding: 60px; color: var(--muted); }
.detail-error { text-align: center; padding: 40px; color: var(--red); }

/* 手机版卡片列表 */
.mobile-cards { display: none; }

/* 移动端适配 */
@media (max-width: 768px) {
    /* 桌面表格隐藏，手机版卡片显示 */
    .table-wrap { display: none; }
    .mobile-cards { display: block; }

    /* filters 单行显示 */
    .toolbar { flex-direction: column; align-items: stretch; }
    .filters {
        width: 100%;
        flex-wrap: nowrap;
        gap: 6px;
    }
    .filters .btn-filter {
        flex: 0 0 auto;
        font-size: 13px;
        padding: 7px 10px;
    }
    .filters input[type="search"] {
        flex: 1 1 0;
        width: 0;
        min-width: 0;
        font-size: 13px;
        padding: 7px 10px;
    }
    .filters button[type="submit"] {
        flex: 0 0 auto;
        font-size: 13px;
        padding: 7px 14px;
    }

    .stats-row {
        flex-wrap: wrap;
        gap: 10px;
    }
    .stat-card {
        flex: 1 1 calc(50% - 10px);
        min-width: 0;
        padding: 14px 12px;
    }
    .stat-num {
        font-size: 22px;
    }
    .stat-label {
        font-size: 12px;
    }
    .dashboard-container {
        flex-direction: column;
        gap: 16px;
    }
    .card {
        padding: 18px;
        border-radius: 12px;
    }
    .card .bg-logo {
        max-width: 70%;
        height: auto;
    }
    .title-label {
        font-size: 18px;
    }
    .price-num {
        font-size: 32px;
    }
    .price-num.small,
    .pe-value {
        font-size: 26px;
    }
    .change-percent,
    .status-badge {
        margin-left: 8px;
    }
    .status-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    .status-bar-left,
    .status-bar-right,
    .bottom-bar-left,
    .bottom-bar-right {
        flex-wrap: wrap;
        gap: 6px 10px;
    }
    .bottom-bar-b {
        padding: 8px 16px;
    }
    .status-bar-sep {
        display: none;
    }
    .page {
        padding: 16px;
    }
    .footer {
        padding: 20px 16px;
        line-height: 1.6;
    }
    /* 详情页移动端 */
    .detail-header h1 { font-size: 18px; }
    .content-grid { grid-template-columns: 1fr; }
    .detail-table th, .detail-table td { padding: 8px 6px; font-size: 12px; }

    /* 手机版基金卡片样式 */
    .fund-card {
        background: var(--panel);
        border: 1px solid var(--line);
        border-radius: 10px;
        padding: 14px 16px;
        margin-bottom: 10px;
    }
    .fund-card-header {
        margin-bottom: 10px;
    }
    .fund-card-name {
        display: block;
        font-size: 15px;
        font-weight: 600;
        color: var(--text);
        line-height: 1.4;
        margin-bottom: 2px;
    }
    .fund-card-name:hover { color: var(--blue); }
    .fund-card-code {
        font-size: 12px;
        color: var(--muted);
    }
    .fund-card-body {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }
    .fund-card-body .chip {
        display: flex;
        align-items: center;
        gap: 4px;
        padding: 4px 10px;
        background: var(--bg);
        border-radius: 6px;
        font-size: 12px;
        white-space: nowrap;
    }
    .fund-card-body .chip-label {
        color: var(--muted);
    }
    .fund-card-body .chip-value {
        color: var(--text);
        font-weight: 500;
    }
    .fund-card-body .chip.up .chip-value { color: var(--red); }
    .fund-card-body .chip.down .chip-value { color: var(--green); }
}
