/* 全球市场监测 · 深色盯盘终端 */
:root {
    --bg: #0b0d12;
    --bg-card: #12151d;
    --bg-hover: #1a1f2b;
    --border: #1f2530;
    --text: #e8ebf2;
    --text-dim: #7d8698;
    --up: #f04a4a;
    --down: #22b573;
    --flat: #7d8698;
    --accent: #4f8cff;
    --gold: #d9a441;
    --oil: #6f7d8c;
    --radius: 12px;
}

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

html, body { height: 100%; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1280px; margin: 0 auto; padding: 16px 20px 40px; }

/* 颜色工具 */
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--flat); }

/* 顶栏 */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 6px 2px 18px; }
.brand { font-size: 18px; font-weight: 700; letter-spacing: .5px; }
.brand small { display: block; font-size: 12px; font-weight: 400; color: var(--text-dim); margin-top: 2px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.market-state { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-dim); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--flat); display: inline-block; }
.dot.up-dot { background: var(--up); box-shadow: 0 0 8px rgba(240,74,74,.7); }
.dot.down-dot { background: var(--down); box-shadow: 0 0 8px rgba(34,181,115,.7); }
.update { font-size: 13px; color: var(--text-dim); font-variant-numeric: tabular-nums; }

/* 脉搏卡（重点指数） */
.pulse {
    display: flex; gap: 24px; align-items: stretch;
    background: linear-gradient(180deg, #151926 0%, #12151d 100%);
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px 22px; margin-bottom: 18px;
}
.pulse-main { flex: 0 0 240px; display: flex; flex-direction: column; justify-content: center; }
.pulse-label { font-size: 13px; color: var(--text-dim); }
.pulse-value { font-size: 44px; font-weight: 800; line-height: 1.1; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.pulse-sub { font-size: 14px; color: var(--text-dim); margin-top: 4px; font-variant-numeric: tabular-nums; }
.pulse-side { flex: 1; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 18px; align-content: center; }
.focus-item { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 6px 8px; border-radius: 6px; cursor: pointer; transition: background .12s; }
.focus-item:hover { background: var(--bg-hover); }
.focus-name { font-size: 13px; color: var(--text-dim); }
.focus-pct { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* 通用区块 */
section { margin-bottom: 18px; }
.section-head, .flow-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.section-head h2, .flow-head h2 { font-size: 16px; font-weight: 700; }
.section-hint { font-size: 12px; color: var(--text-dim); }
.spacer { flex: 1; }

.tabs { display: inline-flex; background: var(--bg-hover); border: 1px solid var(--border); border-radius: 8px; padding: 3px; gap: 2px; }
.tab { border: none; background: transparent; color: var(--text-dim); padding: 5px 14px; border-radius: 6px; cursor: pointer; font-size: 13px; transition: all .15s; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--accent); color: #fff; }

.search { background: var(--bg-hover); border: 1px solid var(--border); border-radius: 8px; color: var(--text); padding: 7px 12px; font-size: 13px; width: 180px; outline: none; }
.search:focus { border-color: var(--accent); }
.search::placeholder { color: var(--text-dim); }

/* 指数网格 */
.indices-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.idx {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
    padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; transition: border-color .12s;
}
.idx:hover { border-color: var(--accent); }
.idx-name { font-size: 12px; color: var(--text-dim); }
.idx-price { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.idx-pct { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* 大宗商品 */
.comm-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.comm-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.comm-card.gold { border-left: 3px solid var(--gold); }
.comm-card.oil { border-left: 3px solid var(--oil); }
.comm-card.silver { border-left: 3px solid #aab4c2; }
.comm-card.dxy { border-left: 3px solid var(--accent); }
.comm-title { font-size: 13px; color: var(--text-dim); margin-bottom: 10px; }
.comm-item { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 4px 0; cursor: pointer; }
.comm-item:hover .comm-name { color: var(--text); }
.comm-name { font-size: 13px; color: var(--text-dim); transition: color .12s; }
.comm-price { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.comm-pct { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* 资金流双栏 */
.flow-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.flow-col { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.flow-col-head { padding: 10px 14px; font-size: 13px; font-weight: 700; border-bottom: 1px solid var(--border); background: var(--bg-hover); }
.flow-col-head.up { color: var(--up); }
.flow-col-head.down { color: var(--down); }
.table-wrap { max-height: 520px; overflow-y: auto; }

.brow { display: grid; grid-template-columns: 28px 1fr 82px 92px; align-items: center; gap: 8px; padding: 9px 14px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .12s; }
.brow:last-child { border-bottom: none; }
.brow:hover { background: var(--bg-hover); }
.rank { font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; text-align: center; }
.bname { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead { font-size: 11px; color: var(--text-dim); margin-left: 6px; }
.bpct, .bnet { font-size: 13px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 24px; text-align: center; color: var(--text-dim); font-size: 13px; }

/* 底部：个股异动 + 行业事件 */
.bottom-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.movers-list { display: flex; flex-direction: column; gap: 2px; }
.mover { display: grid; grid-template-columns: 1fr 80px 80px; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; cursor: pointer; transition: background .12s; }
.mover:hover { background: var(--bg-hover); }
.mname { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mprice, .mpct { font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.mpct { font-weight: 600; }

.news-item { border-bottom: 1px solid var(--border); padding: 10px 0; cursor: pointer; }
.news-item:last-child { border-bottom: none; }
.news-line { display: flex; align-items: baseline; gap: 10px; }
.news-time { font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.news-title { font-size: 13px; flex: 1; }
.news-caret { color: var(--text-dim); font-size: 12px; transition: transform .2s; }
.news-item.open .news-caret { transform: rotate(180deg); }
.news-summary { display: none; font-size: 12px; color: var(--text-dim); margin-top: 6px; }
.news-item.open .news-summary { display: block; }

/* footer */
.footer { text-align: center; color: var(--text-dim); font-size: 12px; padding: 10px 0 4px; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(20px); background: #1a1f2b; color: var(--text); border: 1px solid var(--border); padding: 10px 18px; border-radius: 8px; font-size: 13px; opacity: 0; transition: all .25s; pointer-events: none; z-index: 200; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 走势图弹层 */
.chart-modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.chart-modal.hidden { display: none; }
.chart-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.65); }
.chart-panel { position: relative; width: min(760px, 92vw); background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.chart-close { position: absolute; top: 12px; right: 14px; background: none; border: none; color: var(--text-dim); font-size: 18px; cursor: pointer; }
.chart-close:hover { color: var(--text); }
.chart-title { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.chart-container { width: 100%; height: 420px; }

/* 响应式 */
@media (max-width: 900px) {
    .pulse { flex-direction: column; }
    .pulse-main { flex: none; }
    .pulse-side { grid-template-columns: 1fr; }
    .indices-grid { grid-template-columns: repeat(2, 1fr); }
    .comm-grid { grid-template-columns: repeat(2, 1fr); }
    .flow-grid { grid-template-columns: 1fr; }
    .bottom-grid { grid-template-columns: 1fr; }
    .brow { grid-template-columns: 24px 1fr 72px 86px; }
    .pulse-value { font-size: 36px; }
}
