:root {
  --bg: #0c0e13;
  --panel: #14171f;
  --panel-2: #1a1e28;
  --line: #262b37;
  --text: #e7e9ee;
  --muted: #878d9e;
  --gold: #e6b450;
  --gold-soft: rgba(230, 180, 80, 0.16);
  --up: #f6465d;   /* 中国习惯：涨=红 */
  --down: #22c08b; /* 中国习惯：跌=绿 */
  --blue: #4c8dff;
  --radius: 14px;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background:
    radial-gradient(1100px 560px at 82% -12%, rgba(230, 180, 80, 0.08), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(76, 141, 255, 0.06), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------------- 顶栏 ---------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 26px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(12, 14, 19, 0.82);
  backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 13px; }
.brand .logo {
  font-size: 26px;
  color: var(--gold);
  text-shadow: 0 0 18px rgba(230, 180, 80, 0.6);
}
.brand h1 { font-size: 18px; margin: 0; letter-spacing: 0.5px; }
.brand .sub { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.actions { display: flex; align-items: center; gap: 14px; }
.status { font-size: 12px; color: var(--muted); }
#refresh {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: 0.15s;
}
#refresh:hover { border-color: var(--gold); color: var(--gold); }
#refresh:active { transform: scale(0.97); }

/* ---------------- 页签 ---------------- */
.tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;
}
.tabs button {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 14px;
  padding: 7px 20px;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.15s;
}
.tabs button:hover { color: var(--text); }
.tabs button.on {
  background: linear-gradient(180deg, #232834, #1b1f29);
  color: var(--gold);
  box-shadow: inset 0 0 0 1px rgba(230, 180, 80, 0.35);
}

/* ---------------- 页签面板 ---------------- */
.tab-panel { display: none; }
.tab-panel.on { display: block; animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------------- 布局 ---------------- */
main { padding: 22px; max-width: 1440px; margin: 0 auto; }
.card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
/* 网格卡片：顶部高光描边 + hover 抬起 */
.grid .card::before {
  content: "";
  position: absolute;
  top: 0; left: 18px; right: 18px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(230, 180, 80, 0.55), transparent);
  opacity: 0.45;
}
.grid .card:hover {
  transform: translateY(-3px);
  border-color: #3a4150;
  box-shadow: 0 16px 36px -16px rgba(0, 0, 0, 0.7);
}

/* 分组标题 */
.section-title {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 2px 0;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--muted);
}
.section-title::before {
  content: "";
  width: 16px; height: 2px;
  border-radius: 2px;
  background: var(--gold);
  box-shadow: 0 0 10px rgba(230, 180, 80, 0.7);
}
.section-title::after {
  content: "";
  flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--line), transparent);
}

/* 加载骨架 */
.skel {
  display: inline-block;
  min-width: 92px; height: 24px;
  border-radius: 7px;
  color: transparent !important;
  background: linear-gradient(90deg, #1b1f29, #283042, #1b1f29);
  background-size: 200% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------------- 黄金 hero ---------------- */
.hero {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  margin-bottom: 22px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(420px 220px at 0% 0%, var(--gold-soft), transparent 70%);
  pointer-events: none;
}
.hero-info { position: relative; z-index: 1; }
.hero-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.hero-head h2 { margin: 0; font-size: 20px; }
.hero-head small { color: var(--muted); font-size: 12px; }
.live {
  margin-left: auto;
  font-size: 11px;
  color: var(--up);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--up);
  box-shadow: 0 0 0 0 rgba(246, 70, 93, 0.6);
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(246, 70, 93, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(246, 70, 93, 0); }
  100% { box-shadow: 0 0 0 0 rgba(246, 70, 93, 0); }
}
.price {
  font-size: 46px;
  font-weight: 700;
  letter-spacing: -1px;
  margin: 14px 0 4px;
  font-variant-numeric: tabular-nums;
}
.change { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stats {
  margin-top: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 18px;
  font-size: 13px;
}
.stats .k { color: var(--muted); margin-right: 8px; }
.stats .v { font-variant-numeric: tabular-nums; }
.updated { margin-top: 18px; font-size: 11px; color: var(--muted); }

/* ---------------- 指标网格 ---------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 22px;
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-head h3 { margin: 0; font-size: 15px; }
.metric-sub { margin: 3px 0 0; font-size: 12px; color: var(--muted); }
.latest { text-align: right; white-space: nowrap; }
.latest-val { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.latest-time { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ---------------- 时间区间切换 ---------------- */
.ranges { display: flex; gap: 6px; margin: 14px 0 8px; flex-wrap: wrap; }
.ranges button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 7px;
  padding: 5px 11px;
  font-size: 12px;
  cursor: pointer;
  transition: 0.12s;
}
.ranges button:hover { color: var(--text); }
.ranges button.on {
  background: var(--gold-soft);
  border-color: var(--gold);
  color: var(--gold);
}

/* ---------------- 图表容器 ---------------- */
.chart { width: 100%; height: 240px; }
.chart-lg { height: 320px; }

/* ---------------- 页脚 ---------------- */
footer {
  max-width: 1440px;
  margin: 10px auto 40px;
  padding: 0 26px;
}
footer p { font-size: 12px; color: var(--muted); line-height: 1.7; margin: 0; }

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

/* 刷新按钮旋转 */
#refresh .ic { display: inline-block; }
#refresh.spin .ic { animation: rotate 0.8s linear infinite; }
@keyframes rotate { to { transform: rotate(360deg); } }

/* 金属质感大字报价 */
.price {
  background: linear-gradient(180deg, #ffffff 0%, #c7ccd8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ---------------- 黄金今日分析 ---------------- */
.analysis {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #1a1d26, #15171e);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 22px;
}
.analysis::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(230, 180, 80, 0.7), transparent);
}
.analysis-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.analysis-head h3 { margin: 0; font-size: 16px; }
.muted-sm { color: var(--muted); font-size: 12px; font-weight: 400; margin-left: 6px; }
.stance {
  font-size: 14px; font-weight: 700; padding: 6px 16px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); color: var(--text);
}
.stance.up { color: var(--up); border-color: rgba(34, 192, 139, 0.5); background: rgba(34, 192, 139, 0.12); }
.stance.down { color: var(--down); border-color: rgba(255, 99, 99, 0.5); background: rgba(255, 99, 99, 0.12); }
.stance.warn { color: var(--gold); border-color: rgba(230, 180, 80, 0.5); background: var(--gold-soft); }
.achips { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 4px; }
.achip {
  display: flex; flex-direction: column; gap: 3px;
  min-width: 92px; padding: 9px 13px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
}
.achip .ak { font-size: 11px; color: var(--muted); }
.achip .av { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.advice { font-size: 13.5px; line-height: 1.7; color: var(--text); margin: 12px 0 6px; }
.advice b { color: var(--gold); }
.trend-tag {
  display: inline-block; margin-left: 6px; padding: 2px 9px; border-radius: 6px;
  font-size: 12px; color: var(--muted); background: rgba(255, 255, 255, 0.05);
}
.disclaimer { font-size: 12px; color: var(--muted); margin: 4px 0 0; }
.gold-review { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.gold-review h4 { margin: 0; font-size: 14.5px; }
.gold-review h5 { margin: 14px 0 7px; color: var(--muted); font-size: 12px; font-weight: 600; }
.gold-swing-summary { margin: 9px 0 0; font-size: 13.5px; line-height: 1.65; }
.gold-news-list { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.gold-news-list li {
  display: grid; grid-template-columns: 132px 1fr; gap: 10px; align-items: baseline;
  padding: 7px 9px; border: 1px solid rgba(255, 255, 255, 0.045); border-radius: 8px;
  background: rgba(255, 255, 255, 0.018); font-size: 12.5px; line-height: 1.55;
}
.gold-news-list time { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.gold-news-empty { margin: 0; color: var(--muted); font-size: 12.5px; }
.gold-interpretation { margin: 12px 0 8px; font-size: 13px; line-height: 1.7; }
.gold-interpretation b { color: var(--gold); }

/* 卡片内分析块（美股每只股票） */
.card-analysis { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.card-analysis h4 { margin: 0; font-size: 13.5px; font-weight: 600; color: var(--text); }
.card-analysis .stance { font-size: 12.5px; padding: 4px 12px; }
.card-analysis .yest { color: var(--muted); font-size: 12.5px; line-height: 1.65; margin: 9px 0 2px; }
.card-analysis .achips { margin: 12px 0 4px; gap: 8px; }
.card-analysis .achip { min-width: 76px; padding: 7px 11px; }
.card-analysis .achip .av { font-size: 14.5px; }
.card-analysis .advice { font-size: 13px; line-height: 1.65; margin: 10px 0 6px; }

/* ---------------- 黄金页 / 价格卡 ---------------- */
.gold-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(440px, 1fr));
  gap: 22px;
}
.quote-card .quote-line {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin: 4px 0 2px;
}
.quote-card .price { font-size: 34px; font-weight: 700; letter-spacing: -0.5px; }
.quote-card .change { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.quote-card .chart { height: 260px; }
.ministats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 10px 0 2px;
  font-size: 12.5px;
}
.ministats .k { color: var(--muted); margin-right: 6px; }
.ministats .v { font-variant-numeric: tabular-nums; }
.card-x {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  width: 26px; height: 26px;
  line-height: 1;
  border-radius: 7px;
  font-size: 16px;
  cursor: pointer;
  transition: 0.15s;
}
.card-x:hover { color: var(--up); border-color: var(--up); }

/* ---------------- 沪伦金溢价 ---------------- */
.premium-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.premium-kpi {
  min-height: 142px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}
.premium-kpi::before {
  content: "";
  position: absolute;
  top: 0; left: 18px; right: 18px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(230,180,80,.62), transparent);
}
.premium-kpi-label { color: var(--muted); font-size: 11.5px; letter-spacing: .5px; }
.premium-kpi-value {
  display: block;
  font-size: 24px;
  line-height: 1.15;
  font-weight: 720;
  font-variant-numeric: tabular-nums;
}
.premium-kpi .stance { align-self: flex-start; display: inline-block; }
.premium-kpi small { min-height: 30px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.premium-driver { font-size: 19px; }
.premium-chart-card { margin-bottom: 20px; }
.premium-chart-card .chart { height: 390px; }
.premium-reading { overflow: visible; }
.premium-interpretation { margin: 16px 0 14px; font-size: 14px; line-height: 1.8; }
.premium-method {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 14px;
}
.premium-method span {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: rgba(255,255,255,.025);
  font-size: 11px;
}

/* ---------------- 美股页：自选栏 ---------------- */
.stocks-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
#tickerInput {
  flex: 0 1 360px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 9px;
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
#tickerInput:focus { border-color: var(--gold); }
#tickerInput::placeholder { color: #5b6273; }
#addTicker {
  background: var(--gold-soft);
  border: 1px solid var(--gold);
  color: var(--gold);
  border-radius: 9px;
  padding: 10px 18px;
  font-size: 14px;
  cursor: pointer;
  transition: 0.15s;
}
#addTicker:hover { background: rgba(230, 180, 80, 0.26); }
.stock-msg { font-size: 13px; color: var(--muted); }
.intraday-meta {
  display: none; min-height: 18px; margin: -2px 0 2px; color: #737b8d; font-size: 10.5px; line-height: 1.45;
}
.intraday-meta.on { display: block; }

/* ---------------- AI 榜单导航 ---------------- */
.ai-page-head { margin-bottom: 20px; }
.ai-ranking-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ai-ranking-card {
  min-height: 210px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}
.ai-ranking-card:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(230, 180, 80, 0.16), 0 16px 36px -16px rgba(0, 0, 0, 0.7);
}
.ai-ranking-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ai-ranking-title h3 { margin: 0; font-size: 18px; }
.ai-ranking-arrow {
  color: var(--gold);
  font-size: 20px;
  line-height: 1;
  transition: transform 0.18s ease;
}
.ai-ranking-card:hover .ai-ranking-arrow { transform: translate(2px, -2px); }
.ai-ranking-description { margin-top: 10px; font-size: 13px; line-height: 1.7; }
.ai-ranking-meta {
  display: grid;
  gap: 7px;
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.ai-ranking-label { color: var(--muted); font-size: 11px; }
.ai-ranking-primary,
.ai-ranking-reference a {
  color: var(--gold);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.ai-ranking-primary { font-size: 12.5px; line-height: 1.55; }
.ai-ranking-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}
.ai-ranking-reference {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 2px 0 0;
  font-size: 11.5px;
  line-height: 1.55;
}
.ai-ranking-reference span { flex: 0 0 auto; color: var(--muted); }
.ai-ranking-reference a { position: relative; z-index: 2; }
.ai-ranking-reference a:hover { text-decoration: underline; }
.ai-ranking-reference a:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 2px; }

/* ---------------- 个人资产 ---------------- */
.pf-page-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 18px;
}
.pf-page-head h2 { margin: 0; font-size: 22px; }
.pf-page-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.pf-head-actions, .pf-import-actions, .pf-dialog-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pf-primary, .pf-secondary {
  border-radius: 9px; padding: 9px 16px; font-size: 13px; cursor: pointer; transition: .15s;
}
.pf-primary { color: #15120a; background: var(--gold); border: 1px solid var(--gold); font-weight: 650; }
.pf-primary:hover { filter: brightness(1.08); }
.pf-primary:disabled { opacity: .45; cursor: not-allowed; }
.pf-secondary { color: var(--text); background: var(--panel-2); border: 1px solid var(--line); }
.pf-secondary:hover { color: var(--gold); border-color: var(--gold); }
.pf-issues { display: grid; gap: 8px; margin-bottom: 14px; }
.pf-issue {
  padding: 9px 12px; border: 1px solid rgba(230,180,80,.35); border-radius: 9px;
  color: #d7bd83; background: rgba(230,180,80,.08); font-size: 12.5px;
}
.pf-overview { display: grid; grid-template-columns: minmax(280px, .8fr) minmax(460px, 1.2fr); gap: 20px; }
.pf-total-card {
  min-height: 260px; display: flex; flex-direction: column; justify-content: center;
  background: radial-gradient(440px 260px at 10% 5%, rgba(230,180,80,.16), transparent 65%), linear-gradient(180deg, var(--panel), var(--panel-2));
}
.pf-eyebrow { margin: 0; color: var(--muted); font-size: 12px; letter-spacing: 1px; }
.pf-total { margin-top: 12px; font-size: 42px; font-weight: 750; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.pf-total.skel { width: 230px; }
.pf-change { margin-top: 12px; font-size: 15px; font-weight: 600; }
.pf-asof { margin-top: 8px; font-size: 12px; color: var(--muted); }
.pf-allocation-body { display: grid; grid-template-columns: minmax(220px, .8fr) minmax(300px, 1.2fr); align-items: center; gap: 8px; }
.pf-donut { height: 225px; }
.pf-allocation-details { display: grid; gap: 7px; }
.pf-allocation-row {
  display: grid; grid-template-columns: minmax(120px, 1fr) auto auto; align-items: center; gap: 12px;
  padding: 9px 10px; border: 1px solid rgba(255,255,255,.055); border-radius: 9px; background: rgba(255,255,255,.018);
}
.pf-allocation-name { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--muted); font-size: 11.5px; }
.pf-allocation-dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: var(--cat-color); box-shadow: 0 0 8px color-mix(in srgb, var(--cat-color), transparent 35%); }
.pf-allocation-value { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pf-allocation-ratio { min-width: 48px; text-align: right; color: var(--cat-color); font-size: 12px; font-weight: 650; }
.pf-accounts-card { margin-bottom: 18px; padding: 0; }
.pf-accounts-card summary { padding: 15px 18px; cursor: pointer; font-size: 14px; font-weight: 600; }
.pf-accounts-card summary span { color: var(--muted); font-weight: 400; margin-left: 6px; }
.pf-table-wrap { overflow-x: auto; border-top: 1px solid var(--line); }
.pf-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.pf-table th, .pf-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid rgba(255,255,255,.05); white-space: nowrap; }
.pf-table th { color: var(--muted); font-size: 11px; font-weight: 500; }
.pf-table td:nth-last-child(2), .pf-table th:nth-last-child(2) { text-align: right; }
.pf-table .pf-account-name { display: block; font-weight: 600; color: var(--text); }
.pf-table .pf-account-inst { display: block; color: var(--muted); margin-top: 2px; font-size: 11px; }
.pf-stale { color: var(--gold); }
.pf-chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.pf-chart-grid .chart-lg { height: 350px; }
.pf-chart-grid-single { grid-template-columns: 1fr; }
.pf-chart-grid-single .chart-lg { height: 440px; }
.pf-trend-controls { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.pf-trend-controls > div { display: flex; align-items: center; gap: 10px; }
.pf-trend-controls > div > span { color: var(--muted); font-size: 11px; white-space: nowrap; }
.pf-trend-controls .ranges { margin: 14px 0 8px; }
.pf-forecast-query {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 42px; margin: 3px 0 4px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: rgba(255,255,255,.018);
}
.pf-forecast-query label { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.pf-forecast-query select {
  min-width: 118px; padding: 7px 28px 7px 9px; border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); background: #10131a; color-scheme: dark; outline: none; font-size: 12px;
}
.pf-forecast-query select:focus { border-color: var(--gold); }
.pf-forecast-query select:disabled { opacity: .55; }
.pf-forecast-result { margin: 0; color: var(--text); font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; }
.pf-import-card { margin-top: 4px; }
.pf-import-head { align-items: center; }
.pf-date-label { color: var(--muted); font-size: 12px; white-space: nowrap; }
.pf-date-label input, .pf-dialog input, .pf-draft-table input, .pf-draft-table select {
  background: #10131a; border: 1px solid var(--line); color: var(--text); border-radius: 8px;
  padding: 8px 10px; outline: none;
}
.pf-date-label input { margin-left: 7px; color-scheme: dark; }
.pf-date-label input:focus, .pf-dialog input:focus, .pf-draft-table input:focus, .pf-draft-table select:focus { border-color: var(--gold); }
.pf-dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  min-height: 150px; margin-top: 16px; border: 1px dashed #424a5c; border-radius: 12px;
  background: rgba(255,255,255,.015); cursor: pointer; transition: .15s;
}
.pf-dropzone:hover, .pf-dropzone.drag { border-color: var(--gold); background: var(--gold-soft); }
.pf-dropzone input { display: none; }
.pf-drop-icon { color: var(--gold); font-size: 28px; line-height: 1; }
.pf-dropzone strong { font-size: 14px; }
.pf-dropzone small { color: var(--muted); font-size: 11px; text-align: center; padding: 0 14px; }
.pf-file-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.pf-file-chip { padding: 6px 9px; border-radius: 7px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.pf-file-chip button { margin-left: 5px; padding: 0; border: 0; color: var(--muted); background: transparent; cursor: pointer; font-size: 15px; line-height: 1; }
.pf-file-chip button:hover { color: var(--up); }
.pf-inline-status { color: var(--muted); font-size: 12px; }
.pf-inline-status.error { color: var(--up); }
.pf-draft { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.pf-draft h4 { margin: 0 0 5px; font-size: 15px; }
.pf-draft-note { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 0 0 12px; }
.pf-draft-warnings { color: #e3bd6d; font-size: 12px; line-height: 1.7; margin: 8px 0 12px; }
.pf-draft-table { min-width: 1000px; }
.pf-draft-table th, .pf-draft-table td { padding: 7px; }
.pf-draft-table input, .pf-draft-table select { width: 125px; font-size: 12px; padding: 7px; }
.pf-draft-table .wide { width: 170px; }
.pf-draft-remove { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 18px; }
.pf-draft-remove:hover { color: var(--up); }
.pf-dialog {
  width: min(620px, calc(100vw - 28px)); max-height: calc(100vh - 28px); padding: 0;
  color: var(--text); background: transparent; border: 0;
}
.pf-dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(3px); }
.pf-dialog-card { display: grid; gap: 14px; padding: 22px; border-radius: 14px; border: 1px solid var(--line); background: #151820; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.pf-dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.pf-dialog-head h3 { margin: 0; font-size: 18px; }
.pf-dialog-head p { margin: 4px 0 0; color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.pf-dialog-x { border: 0; background: transparent; color: var(--muted); font-size: 24px; cursor: pointer; }
.pf-dialog label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.pf-dialog input { width: 100%; font-size: 13px; }
.pf-config-state { min-height: 18px; margin: 0; color: var(--muted); font-size: 12px; }
.pf-dialog-actions { justify-content: flex-end; }
.pf-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.pf-ledger-dialog { width: min(1000px, calc(100vw - 28px)); }
.pf-ledger-layout {
  display: grid; grid-template-columns: minmax(220px, .34fr) minmax(0, 1fr); min-height: 500px;
  overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: #10131a;
}
.pf-ledger-list { overflow-y: auto; padding: 8px; border-right: 1px solid var(--line); }
.pf-ledger-file {
  display: block; width: 100%; padding: 9px 10px; border: 0; border-radius: 7px;
  color: var(--muted); background: transparent; text-align: left; font-size: 11.5px; cursor: pointer;
}
.pf-ledger-file:hover { color: var(--text); background: rgba(255,255,255,.04); }
.pf-ledger-file.on { color: var(--gold); background: var(--gold-soft); }
.pf-ledger-view { display: grid; grid-template-rows: auto minmax(0, 1fr); min-width: 0; }
.pf-ledger-path { padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--gold); font-size: 11.5px; }
.pf-ledger-view pre {
  max-width: 100%; margin: 0; padding: 16px; overflow: auto; color: #cbd0dc; font: 11.5px/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.pf-update-dialog { width: min(1180px, calc(100vw - 28px)); }
.pf-update-dialog .pf-dialog-card { max-height: calc(100vh - 28px); overflow-y: auto; }
.pf-update-input, .pf-update-review { display: grid; gap: 14px; }
.pf-update-input[hidden], .pf-update-review[hidden] { display: none; }
.pf-update-meta { display: flex; align-items: center; justify-content: space-between; gap: 14px; color: var(--muted); font-size: 11.5px; }
.pf-update-text-label { margin-bottom: -7px; color: var(--muted); font-size: 12px; }
.pf-update-dialog textarea {
  width: 100%; min-height: 122px; resize: vertical; padding: 12px 13px; border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); background: #10131a; outline: none; font-family: inherit; font-size: 13px; line-height: 1.65;
}
.pf-update-dialog textarea:focus { border-color: var(--gold); }
.pf-update-dialog .pf-dropzone { min-height: 118px; margin-top: 0; }
.pf-update-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.pf-update-summary > div { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.018); }
.pf-update-summary span { display: block; color: var(--muted); font-size: 10.5px; }
.pf-update-summary strong { display: block; margin-top: 5px; font-size: 18px; font-variant-numeric: tabular-nums; }
.pf-draft-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.pf-draft-toolbar .pf-draft-note { margin: 0; }
.pf-update-current, .pf-update-delta { font-variant-numeric: tabular-nums; }
.pf-update-current { color: var(--muted); }
.pf-update-delta { font-weight: 650; }
.pf-update-delta.flat { color: var(--muted); }
.pf-duplicate-check { display: flex !important; grid-template-columns: auto 1fr; align-items: center; gap: 8px; margin-top: 8px; color: #e3bd6d !important; }
.pf-duplicate-check input { width: auto; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 820px) {
  .grid { grid-template-columns: 1fr; }
  .gold-grid { grid-template-columns: 1fr; }
  .gold-news-list li { grid-template-columns: 1fr; gap: 2px; }
  .premium-summary { grid-template-columns: 1fr 1fr; }
  .premium-chart-card .chart { height: 320px; }
  .quote-card .price { font-size: 30px; }
  main { padding: 16px; }
  .topbar { padding: 12px 16px; }
  .tabs { order: 3; width: 100%; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { flex: 0 0 auto; padding-left: 11px; padding-right: 11px; white-space: nowrap; }
  .pf-page-head { align-items: flex-start; }
  .pf-overview, .pf-chart-grid { grid-template-columns: 1fr; }
  .pf-allocation-body { grid-template-columns: 1fr; }
  .pf-donut { height: 210px; }
  .pf-total-card { min-height: 210px; }
  .pf-chart-grid .chart-lg { height: 310px; }
  .pf-import-head { align-items: flex-start; flex-direction: column; }
  .pf-form-grid { grid-template-columns: 1fr; }
  .pf-ledger-layout { grid-template-columns: 1fr; grid-template-rows: minmax(120px, 34vh) minmax(260px, 1fr); min-height: 620px; }
  .pf-ledger-list { border-right: 0; border-bottom: 1px solid var(--line); }
  .pf-update-meta { align-items: flex-start; flex-direction: column; }
  .pf-update-summary { grid-template-columns: 1fr; }
  .pf-draft-toolbar { align-items: stretch; flex-direction: column; }
  .pf-trend-controls { align-items: flex-start; flex-direction: column; gap: 0; }
  .pf-forecast-query { align-items: flex-start; flex-direction: column; gap: 8px; }
  .pf-forecast-result { text-align: left; }
}
@media (max-width: 480px) {
  .ai-ranking-grid { grid-template-columns: 1fr; }
  .premium-summary { grid-template-columns: 1fr; }
  .premium-kpi { min-height: 124px; }
  .pf-page-head { flex-direction: column; }
  .pf-total { font-size: 34px; }
}
