/* 红筹洼地 · 破净国资价值策略 样式（深色现代主题） */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --bg: #0b0f1a; --bg2: #0f1420; --card: #161c2c; --card2: #1c2333;
    --line: rgba(255,255,255,0.08); --text: #e6ecf5; --muted: #8b95a5;
    --up: #e15554; --down: #2e9e6b; --accent: #f5a623; --accent2: #4f8cff;
    --shadow: 0 8px 30px rgba(0,0,0,0.35);
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: radial-gradient(1200px 600px at 80% -10%, #16203a 0%, var(--bg) 55%);
    color: var(--text); min-height: 100vh;
}
.up { color: var(--up); }
.down { color: var(--down); }
.muted { color: var(--muted); font-size: 13px; }

/* ---------- 顶栏 ---------- */
.topbar {
    height: 60px; display: flex; align-items: center; justify-content: space-between;
    padding: 0 22px; background: rgba(13,18,30,0.85); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { font-size: 22px; }
.brand-name { font-size: 19px; font-weight: 800; letter-spacing: 1px;
    background: linear-gradient(90deg, #ffd479, #f5a623); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-tag { font-size: 12px; color: var(--muted); border-left: 1px solid var(--line); padding-left: 10px; }
.topbar-right { display: flex; align-items: center; gap: 14px; font-size: 13px; }
.gen-time { color: var(--muted); }
.user-chip { background: var(--card2); padding: 4px 12px; border-radius: 20px; }
.logout-btn { color: var(--muted); text-decoration: none; border: 1px solid var(--line); padding: 5px 12px; border-radius: 8px; transition: .2s; }
.logout-btn:hover { color: var(--text); border-color: var(--accent); }
.btn-export { margin-left: auto; background: var(--card2); color: var(--text); border: 1px solid var(--line);
    padding: 6px 14px; border-radius: 8px; cursor: pointer; font-size: 13px; transition: .2s; white-space: nowrap; }
.btn-export:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: calc(100vh - 60px); }
.sidebar { width: 220px; flex-shrink: 0; background: rgba(13,18,30,0.6); border-right: 1px solid var(--line);
    display: flex; flex-direction: column; padding: 18px 12px; }
.nav { display: flex; flex-direction: column; gap: 6px; }
.nav-item { padding: 12px 14px; border-radius: 10px; cursor: pointer; color: var(--muted);
    font-size: 14px; transition: .2s; border: 1px solid transparent; }
.nav-item:hover { background: var(--card); color: var(--text); }
.nav-item.active { background: linear-gradient(90deg, rgba(245,166,35,0.18), rgba(245,166,35,0.04));
    color: #ffd479; border-color: rgba(245,166,35,0.3); font-weight: 600; }
.sidebar-foot { margin-top: auto; font-size: 11px; color: var(--muted); text-align: center; padding-top: 14px; }
.content { flex: 1; padding: 22px 26px; overflow-x: hidden; }
.sec-title { font-size: 20px; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.tab-panel { display: none; animation: fadeIn .4s ease; }
.tab-panel.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- 卡片 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.card-head h3 { font-size: 15px; font-weight: 700; }
.card-sub { font-size: 12px; color: var(--muted); }
.chart { width: 100%; height: 320px; }
.chart-row { display: grid; grid-template-columns: 1fr; gap: 16px; margin-top: 16px; }
.chart-card.lg .chart { height: 360px; }

/* ---------- KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.kpi-card { background: linear-gradient(160deg, var(--card2), var(--card)); border: 1px solid var(--line);
    border-radius: 14px; padding: 18px 20px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.kpi-card::after { content: ''; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px;
    background: radial-gradient(circle, rgba(245,166,35,0.18), transparent 70%); }
.kpi-label { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.kpi-value { font-size: 30px; font-weight: 800; letter-spacing: .5px; }
.kpi-value .num { font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---------- 规则 ---------- */
.rules-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.rule-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px;
    cursor: pointer; transition: .25s; box-shadow: var(--shadow); }
.rule-card:hover { transform: translateY(-3px); border-color: rgba(245,166,35,0.4); }
.rule-icon { font-size: 24px; margin-bottom: 8px; }
.rule-name { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.rule-desc { font-size: 13px; color: var(--accent); margin-bottom: 0; transition: .25s; }
.rule-detail { font-size: 12.5px; color: var(--muted); line-height: 1.6; max-height: 0; overflow: hidden;
    transition: max-height .3s ease, margin .3s; }
.rule-card.open .rule-detail { max-height: 200px; margin-top: 8px; }
.note-card { margin-top: 18px; line-height: 1.8; font-size: 14px; color: #d4dbe8; }
.note-card h3 { font-size: 15px; margin-bottom: 8px; color: #ffd479; }
.note-card.warn { border-color: rgba(225,85,84,0.4); }

/* ---------- 表格 ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.search { flex: 1; max-width: 320px; padding: 10px 14px; background: var(--card); border: 1px solid var(--line);
    border-radius: 10px; color: var(--text); font-size: 14px; }
.search:focus { outline: none; border-color: var(--accent); }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th { text-align: left; padding: 11px 12px; color: var(--muted); font-weight: 600;
    border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; background: var(--card); }
.data-table td { padding: 10px 12px; border-bottom: 1px solid rgba(255,255,255,0.04); white-space: nowrap; }
.data-table tbody tr { transition: background .15s; }
.data-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.bt-row { cursor: pointer; }
.bt-row:hover { background: rgba(245,166,35,0.06); }
.chev { color: var(--muted); transition: transform .2s; }
.tag { padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.tag-up { background: rgba(225,85,84,0.15); color: var(--up); }
.tag-down { background: rgba(46,158,107,0.15); color: var(--down); }
.tag-cur { background: rgba(79,140,255,0.18); color: var(--accent2); }
.data-table td.why { white-space: normal; vertical-align: top; min-width: 200px; }
.why-tag { display: block; width: fit-content; background: var(--card2); border: 1px solid var(--line); color: #cdd6e4;
    padding: 2px 8px; border-radius: 6px; font-size: 11.5px; margin: 0 0 4px 0; }
.why-sell { color: var(--muted); white-space: normal; }
.period-detail { margin-top: 14px; }
.detail-card { border-color: rgba(245,166,35,0.3); animation: fadeIn .35s ease; }

/* ---------- 当前持仓 banner ---------- */
.banner { display: flex; gap: 14px; align-items: center; background: linear-gradient(120deg, rgba(79,140,255,0.12), rgba(245,166,35,0.06));
    border: 1px solid rgba(79,140,255,0.3); border-radius: 14px; padding: 16px 18px; margin-bottom: 16px; font-size: 14px; line-height: 1.7; }
.banner-icon { font-size: 30px; }
.banner.warn { background: linear-gradient(120deg, rgba(225,85,84,0.14), rgba(225,85,84,0.05));
    border: 1px solid rgba(225,85,84,0.3); color: #ffd9d6; }
.rec-header { font-size: 13px; color: var(--text); line-height: 1.7; margin-bottom: 16px;
    padding: 12px 16px; background: var(--card2); border: 1px solid var(--line); border-radius: 12px; }
.rec-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px,1fr)); gap: 12px; margin-bottom: 14px; }
.rec-kpi { background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; text-align: center; }
.rk-num { font-size: 22px; font-weight: 700; color: var(--accent); }
.rk-lbl { font-size: 12px; color: var(--muted); margin-top: 4px; }
.tag-state { background: rgba(245,166,35,0.15); color: var(--accent); }
#holdSub { font-size: 13px; }

/* ---------- 风险 ---------- */
.risk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.risk-card { background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--up);
    border-radius: 12px; padding: 14px 16px; }
.risk-title { font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.risk-desc { font-size: 13px; color: var(--muted); line-height: 1.7; }
.beta-card { margin-top: 16px; }
.beta-card h3 { font-size: 15px; margin-bottom: 12px; color: #ffd479; }
.beta-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.beta-col { background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 16px; text-align: center; }
.beta-col.up { border-color: rgba(225,85,84,0.4); }
.beta-col.down { border-color: rgba(46,158,107,0.4); }
.bc-num { font-size: 26px; font-weight: 800; }
.beta-col.up .bc-num { color: var(--up); }
.beta-col.down .bc-num { color: var(--down); }
.bc-win { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- reveal 动画 ---------- */
.reveal { animation: reveal .55s ease both; }
@keyframes reveal { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- loading ---------- */
.loading { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 80px; gap: 16px; color: var(--muted); }
.spinner { width: 42px; height: 42px; border: 4px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 登录页 ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; overflow: hidden; position: relative; }
.login-wrap { position: relative; z-index: 2; width: 100%; max-width: 400px; padding: 20px; }
.login-card { background: rgba(22,28,44,0.92); border: 1px solid var(--line); border-radius: 20px; padding: 36px 32px;
    box-shadow: var(--shadow); backdrop-filter: blur(12px); animation: reveal .6s ease; }
.login-brand { text-align: center; margin-bottom: 26px; }
.login-logo { font-size: 44px; }
.login-brand h1 { font-size: 26px; font-weight: 800; margin: 8px 0 4px;
    background: linear-gradient(90deg, #ffd479, #f5a623); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-sub { font-size: 13px; color: var(--muted); }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input { width: 100%; padding: 12px 14px; background: var(--bg2); border: 1px solid var(--line);
    border-radius: 10px; color: var(--text); font-size: 15px; transition: border-color .2s, box-shadow .2s, background .2s; }
.field input:focus { outline: none; border-color: var(--accent); background: #141b2c;
    box-shadow: 0 0 0 3px rgba(245,166,35,0.25); }
.login-error { background: rgba(225,85,84,0.12); color: var(--up); border: 1px solid rgba(225,85,84,0.4);
    padding: 10px 12px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; }
.login-btn { width: 100%; padding: 13px; background: linear-gradient(90deg, #f5a623, #ffd479); color: #1a1205;
    border: none; border-radius: 10px; font-size: 16px; font-weight: 800; cursor: pointer; transition: .2s; letter-spacing: 4px; }
.login-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-spinner { width: 18px; height: 18px; border: 3px solid rgba(26,18,5,0.3); border-top-color: #1a1205; border-radius: 50%; display: inline-block; vertical-align: middle; animation: spin .7s linear infinite; }
.login-tip { text-align: center; font-size: 12px; color: var(--muted); margin-top: 18px; }
.login-bg-orbs { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.login-bg-orbs .orb { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .5; animation: float 9s ease-in-out infinite; }
.orb.o1 { width: 320px; height: 320px; background: #f5a623; top: -80px; left: -60px; }
.orb.o2 { width: 280px; height: 280px; background: #4f8cff; bottom: -60px; right: -40px; animation-delay: 1.5s; }
.orb.o3 { width: 220px; height: 220px; background: #e15554; top: 40%; left: 60%; animation-delay: 3s; }
@keyframes float { 0%,100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-30px) scale(1.08); } }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .beta-grid { grid-template-columns: 1fr; }
    .sidebar { width: 64px; }
    .nav-item { font-size: 0; padding: 14px; text-align: center; }
    .nav-item::before { font-size: 18px; content: attr(data-tab); }
    .sidebar-foot { display: none; }
}
@media (max-width: 600px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .content { padding: 14px; }
}
