/* 资金拥挤 · 独立样式（对齐雷达/驾驶舱暗色终端风，不依赖其他业务 CSS）
 * V2.9.8：视觉层级 L1–L5 + 克制语义色（非数据大屏）
 * M3-B：结构色 → 全局 Theme Contract；拥挤/涨跌业务色冻结
 */
:root,
html[data-theme="dark-default"] {
  /* Structure → Global Contract（fallback = 生产 Dark 无损） */
  --cr-bg: var(--color-bg-page-deep, #050a12);
  --cr-panel: var(--color-bg-panel, #091523);
  --cr-panel2: var(--color-bg-panel-2, #0b1828);
  --cr-line: var(--color-border-card, rgba(90, 160, 210, 0.22));
  --cr-text: var(--color-text-primary, #e8f0fa);
  --cr-name: var(--color-text-body, #d7e8f8);
  --cr-sub: var(--color-text-muted, #8da1bc);
  --cr-muted: var(--color-text-muted, #5d6e86);
  --cr-dim: var(--color-text-disabled, #4a5c74);
  --cr-cyan: var(--color-accent, #00d1c1);
  --cr-cyan-soft: var(--color-accent-hover, #7ee8df);
  --cr-blue: var(--color-brand-secondary, #5aa8ff);
  --cr-blue-soft: var(--color-text-link, #9ec4e8);
  /* —— Business / crowding state FROZEN —— */
  --cr-warn: #ff9a3d;
  --cr-hot: #ff5a5a;
  --cr-ok: #2dbd6e;
  --cr-purple: #b49cff;
  --cr-purple-soft: #c8b8ff;
  --cr-slate: #7d93ab;
  /* 涨跌语义冻结（红涨绿跌；勿映射驾驶舱 --v2d-up/down） */
  --cr-up: #ff5a5a;
  --cr-down: #2dbd6e;
  --cr-flat: #8da1bc;
  --cr-radius: 12px;
  --cr-font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

html[data-theme="light"] {
  --cr-bg: var(--color-bg-page);
  --cr-panel: var(--color-bg-panel);
  --cr-panel2: var(--color-bg-panel-2);
  --cr-line: var(--color-border-default);
  --cr-text: var(--color-text-primary);
  --cr-name: var(--color-text-body);
  --cr-sub: var(--color-text-secondary);
  --cr-muted: var(--color-text-muted);
  --cr-dim: var(--color-text-disabled);
  --cr-cyan: var(--color-accent);
  --cr-cyan-soft: var(--color-accent-hover);
  --cr-blue: var(--color-brand-secondary);
  --cr-blue-soft: var(--color-text-link);
  --cr-slate: var(--color-text-muted);
  --cr-flat: var(--color-text-muted);
  /* keep business hue */
  --cr-warn: #ff9a3d;
  --cr-hot: #ff5a5a;
  --cr-ok: #2dbd6e;
  --cr-purple: #b49cff;
  --cr-purple-soft: #c8b8ff;
  --cr-up: #ff5a5a;
  --cr-down: #2dbd6e;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--cr-bg);
  color: var(--cr-text);
  overflow-x: hidden;
  max-width: 100%;
}

body {
  font-family: var(--cr-font);
  background:
    radial-gradient(circle at 22% -6%, var(--color-bg-canvas-glow-1, rgba(47, 140, 255, 0.14)), transparent 32%),
    radial-gradient(circle at 90% 108%, var(--color-bg-canvas-glow-2, rgba(0, 209, 193, 0.09)), transparent 28%),
    linear-gradient(180deg, var(--color-bg-page, #03070d), var(--color-bg-page-mid, #061525) 56%, var(--cr-bg));
}

.v2-mobile-back {
  display: none;
  position: fixed;
  left: 12px;
  top: calc(10px + env(safe-area-inset-top, 0px));
  z-index: 90;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--color-bg-panel, rgba(15, 35, 58, 0.92));
  border: 1px solid var(--color-border-control, rgba(120, 180, 255, 0.28));
  color: var(--color-text-primary, #dcecff);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

@media (max-width: 919px) {
  .v2-mobile-back { display: inline-flex !important; }
}
@media (min-width: 920px) {
  body.has-desktop-shell .v2-mobile-back { display: none !important; }
}

.crowding-app {
  min-height: 100vh;
  padding: 0 24px 36px;
  max-width: 1280px;
  margin: 0 auto;
}

.crowding-chrome {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  padding-top: 4px;
}

/* 桌面壳已有侧栏导航：隐藏重复 page-head，只保留页面内一套主标题 */
body.has-desktop-shell .desktop-main:has(.crowding-app) .desktop-page-head {
  display: none !important;
}

.data-status-line {
  display: flex;
  align-items: center;
  min-height: 28px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--color-border-subtle);
  background: var(--cr-panel);
  color: var(--cr-sub);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.4;
}

.data-status-line b {
  color: var(--cr-text);
  font-weight: 800;
}

/* Drawer 打开时禁止背景滚动（仅 crowding 页 class；不用 position:fixed，避免 scrollY 归零跳动） */
html.crowding-drawer-scroll-lock,
html.crowding-drawer-scroll-lock body {
  overflow: hidden !important;
  overscroll-behavior: none;
}
html.crowding-drawer-scroll-lock body {
  padding-right: var(--cr-drawer-sb, 0px);
}

.metric-band[hidden],
.score-panel .metric-band[hidden] {
  display: none !important;
}

.crowding-title-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.crowding-page-title {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  font-weight: 900;
}

.crowding-page-sub {
  margin: 6px 0 0;
  color: var(--cr-muted);
  font-size: 12px;
  line-height: 1.5;
}

.crowding-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.btn {
  height: 40px;
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid var(--color-border-control);
  background: var(--cr-panel2);
  color: var(--color-text-primary);
  padding: 0 14px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.btn:hover {
  background: var(--cr-panel2);
  border-color: rgba(68, 145, 255, 0.7);
}

.crowding-status-bar {
  padding: 7px 12px;
  border-radius: 6px;
  border: 1px solid var(--cr-line);
  background: var(--color-bg-inset, rgba(5, 12, 22, 0.42));
  color: var(--cr-muted);
  font-size: 11px;
  line-height: 1.55;
}

.crowding-status-bar b {
  color: var(--cr-sub);
  font-weight: 800;
}

/* V1.1 数据状态面板 */
.data-status-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border-radius: var(--cr-radius);
  border: 1px solid var(--cr-line);
  background: var(--cr-panel);
}

.data-status-item {
  min-width: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--color-bg-inset, rgba(5, 12, 22, 0.55));
  border: 1px solid var(--cr-line);
}

.data-status-k {
  color: var(--cr-muted);
  font-size: 11px;
  font-weight: 700;
}

.data-status-v {
  margin-top: 6px;
  color: var(--cr-text);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  word-break: break-word;
}

.data-status-panel[data-quality="normal"] .data-status-item:nth-child(3) .data-status-v {
  color: var(--cr-ok);
}
.data-status-panel[data-quality="soft_stale"] .data-status-item:nth-child(3) .data-status-v {
  color: #ffc400;
}
.data-status-panel[data-quality="stale"] .data-status-item:nth-child(3) .data-status-v,
.data-status-panel[data-quality="missing"] .data-status-item:nth-child(3) .data-status-v {
  color: var(--cr-warn);
}

.data-status-panel[data-mode="mock"] .data-status-item:nth-child(4) .data-status-v {
  color: var(--cr-sub);
}
.data-status-panel[data-mode="snapshot"] .data-status-item:nth-child(4) .data-status-v {
  color: var(--cr-cyan);
}
.data-status-panel[data-mode="degraded"] .data-status-item:nth-child(4) .data-status-v {
  color: var(--cr-warn);
}

.model-status-banner {
  margin-top: 2px;
  padding: 12px 14px;
  border-radius: var(--cr-radius);
  border: 1px solid rgba(0, 209, 193, 0.28);
  background: linear-gradient(135deg, rgba(0, 209, 193, 0.1), rgba(9, 21, 35, 0.92));
}

.model-status-title {
  font-size: 13px;
  font-weight: 900;
  color: var(--color-accent-hover);
}

.model-status-msg {
  margin-top: 6px;
  color: var(--cr-text);
  font-size: 12px;
  line-height: 1.55;
  font-weight: 650;
}

.model-status-note {
  margin-top: 4px;
  color: var(--cr-muted);
  font-size: 11px;
  line-height: 1.45;
}

.degrade-banner {
  margin-top: 2px;
  padding: 10px 12px;
  border-radius: var(--cr-radius);
  border: 1px solid rgba(255, 122, 26, 0.28);
  background: rgba(255, 122, 26, 0.08);
}

.degrade-msg {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: #ffd2b0;
  font-weight: 650;
}

.degrade-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.degrade-grid > div {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--color-bg-inset, rgba(5, 12, 22, 0.55));
  border: 1px solid var(--color-border-control);
  font-size: 12px;
}

.degrade-grid span {
  display: block;
  color: var(--cr-muted);
  margin-bottom: 4px;
}

.degrade-grid b {
  color: var(--cr-text);
  font-weight: 800;
  line-height: 1.4;
  word-break: break-word;
}

.chart-empty {
  padding: 0 12px 12px;
  color: var(--cr-muted);
  font-size: 12px;
}

.crowding-section {
  margin-bottom: 20px;
  padding-top: 2px;
  border-top: 1px solid var(--color-border-subtle);
}

.crowding-section:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.section-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--cr-name);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.section-head h2::before {
  content: "";
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: rgba(0, 209, 193, 0.65);
  flex: 0 0 auto;
}

.section-hint {
  color: var(--cr-muted);
  font-size: 12px;
  font-weight: 500;
}

.history-summary {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  color: var(--cr-slate);
  letter-spacing: 0.01em;
}

.history-summary .hs-score {
  color: var(--cr-cyan-soft);
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.history-summary .hs-delta.up {
  color: var(--cr-warn);
}

.history-summary .hs-delta.down {
  color: var(--cr-ok);
}

.history-summary .hs-delta.flat {
  color: var(--cr-slate);
}

.overview-hero {
  display: grid;
  grid-template-columns: minmax(200px, 260px) minmax(220px, 300px) 1fr;
  gap: 12px;
  align-items: stretch;
}

.score-panel {
  border: 1px solid var(--cr-line);
  background:
    linear-gradient(160deg, var(--color-bg-canvas-glow-1), transparent 55%),
    var(--cr-panel);
  border-radius: var(--cr-radius);
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 148px;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  position: relative;
}

.score-panel:hover,
.score-panel:focus-visible {
  border-color: var(--color-border-selected);
  box-shadow: 0 0 0 1px rgba(61, 224, 208, 0.12);
  outline: none;
}

.score-panel.is-expanded {
  border-color: var(--color-border-selected);
  box-shadow: 0 0 0 1px rgba(61, 224, 208, 0.18);
}

.score-panel.tone-extreme {
  box-shadow: 0 0 28px rgba(255, 90, 90, 0.08);
  border-color: rgba(255, 90, 90, 0.28);
}

.score-panel.tone-crowded {
  box-shadow: 0 0 22px rgba(255, 154, 61, 0.07);
  border-color: rgba(255, 154, 61, 0.26);
}

.metric-expand-hint {
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--color-border-subtle);
  color: var(--cr-dim);
  font-size: 10px;
  font-weight: 700;
}

.score-label {
  color: var(--cr-sub);
  font-size: 12px;
  font-weight: 700;
}

.score-value {
  margin-top: 6px;
  font-size: 54px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--color-text-bright);
  text-shadow: 0 0 24px rgba(61, 224, 208, 0.18);
  font-variant-numeric: tabular-nums;
}

.score-panel.tone-extreme .score-value {
  color: #ffe8e6;
  text-shadow: 0 0 26px rgba(255, 90, 90, 0.22);
}

.score-panel.tone-crowded .score-value {
  color: #fff1e4;
  text-shadow: 0 0 22px rgba(255, 154, 61, 0.18);
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.quick-action-btn {
  height: 40px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--color-border-subtle);
  background: var(--cr-panel2);
  color: var(--color-text-secondary);
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.quick-action-btn:hover {
  border-color: rgba(0, 209, 193, 0.45);
  color: #fff;
}

.metric-band {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  padding: 0;
  border: 0;
  border-radius: 0;
  font-size: 11px;
  font-weight: 650;
  background: transparent;
  color: var(--cr-muted);
}

.metric-band::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cr-slate);
  flex: 0 0 auto;
}

.score-panel .metric-band {
  margin-top: 10px;
}

.metric-band.high {
  color: #e8b4a8;
}

.metric-band.high::before {
  background: var(--cr-hot);
}

.metric-band.mid {
  color: #e0c090;
}

.metric-band.mid::before {
  background: var(--cr-warn);
}

.metric-band.low {
  color: var(--cr-slate);
}

.metric-band.low::before {
  background: var(--cr-blue-soft);
}

.history-range {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
}

.history-range-btn {
  height: 36px;
  min-height: 36px;
  min-width: 52px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--cr-line);
  background: var(--cr-panel);
  color: var(--cr-sub);
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.history-range-btn.is-active {
  color: var(--cr-text);
  border-color: var(--color-border-selected, rgba(0, 209, 193, 0.5));
  background: var(--color-accent-soft, rgba(0, 209, 193, 0.14));
}

.history-range-btn:disabled,
.history-range-btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}

.scroll-flash {
  box-shadow: 0 0 0 1px rgba(0, 209, 193, 0.45);
  transition: box-shadow 0.35s ease;
}

.share-band {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
  border: 1px solid var(--color-border-control);
  background: var(--color-bg-inset, rgba(6, 14, 25, 0.55));
  color: var(--cr-sub);
  white-space: nowrap;
}

.share-band::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.9;
}

.share-band.high {
  color: #ffb0a4;
  border-color: rgba(255, 90, 90, 0.32);
  background: rgba(255, 90, 90, 0.08);
}

.share-band.mid {
  color: #ffc878;
  border-color: rgba(255, 154, 61, 0.32);
  background: rgba(255, 154, 61, 0.08);
}

.share-band.low {
  color: #8fa8c0;
  border-color: rgba(90, 160, 210, 0.22);
  background: var(--color-bg-control, rgba(15, 35, 58, 0.4));
}

/* 页面侧注入到 Drawer，不改 Host 核心模板 */
.crowding-drawer-source-hint {
  margin: 0 0 12px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(0, 209, 193, 0.28);
  background: rgba(0, 209, 193, 0.1);
  color: var(--color-accent-hover);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.score-status {
  margin-top: 0;
  display: inline-flex;
  align-self: flex-start;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid rgba(62, 87, 122, 0.6);
  background: var(--color-bg-inset, rgba(6, 14, 25, 0.7));
  color: var(--cr-text);
}

.score-status-row {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.score-change-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(90, 160, 210, 0.2);
  background: var(--color-bg-inset, rgba(8, 18, 32, 0.55));
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--cr-slate);
}

.score-change-tag.heat {
  color: #ffc078;
  border-color: rgba(255, 154, 61, 0.35);
  background: rgba(255, 154, 61, 0.08);
}

.score-change-tag.stable {
  color: var(--cr-slate);
  border-color: rgba(125, 147, 171, 0.28);
  background: var(--color-bg-control, rgba(15, 28, 44, 0.55));
}

.score-change-tag.ease {
  color: #7dd9a5;
  border-color: rgba(45, 189, 110, 0.3);
  background: rgba(45, 189, 110, 0.08);
}

.score-status.level-low { color: var(--cr-ok); border-color: rgba(30, 215, 96, 0.35); }
.score-status.level-mild { color: var(--cr-cyan); border-color: rgba(0, 209, 193, 0.35); }
.score-status.level-elevated { color: #ffc400; border-color: rgba(255, 196, 0, 0.35); }
.score-status.level-crowded { color: var(--cr-warn); border-color: rgba(255, 122, 26, 0.4); }
.score-status.level-extreme { color: var(--cr-hot); border-color: rgba(255, 59, 48, 0.45); }

.score-risk-note {
  margin-top: 8px;
  max-width: 280px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--cr-muted);
  text-align: left;
  font-weight: 500;
}

.score-delta {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--cr-sub);
  font-weight: 650;
}

.score-delta b {
  font-weight: 850;
  color: var(--cr-text);
}

.score-delta.up b:last-child {
  color: var(--cr-warn);
}

.score-delta.down b:last-child {
  color: var(--cr-ok);
}

.score-delta.flat b:last-child {
  color: var(--cr-sub);
}

.focus-panel {
  border: 1px solid var(--cr-line);
  background: var(--cr-panel);
  border-radius: var(--cr-radius);
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  min-height: 148px;
}

.focus-title {
  font-size: 13px;
  font-weight: 850;
  color: var(--cr-cyan-soft);
  letter-spacing: 0.02em;
}

.focus-hint {
  margin: 0;
  color: var(--cr-muted);
  font-size: 11px;
  line-height: 1.45;
  font-weight: 500;
}

.focus-row {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 8px;
  align-items: center;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(5, 12, 22, 0.45);
  border: 1px solid rgba(37, 55, 80, 0.4);
  border-left-width: 3px;
}

.focus-row--industry {
  border-left-color: rgba(90, 168, 255, 0.75);
}

.focus-row--theme {
  border-left-color: rgba(180, 156, 255, 0.75);
}

.focus-row--stock {
  border-left-color: rgba(0, 209, 193, 0.75);
}

.focus-k {
  color: var(--cr-muted);
  font-size: 11px;
  font-weight: 650;
}

.focus-v {
  color: var(--cr-name);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.35;
  word-break: break-word;
  min-width: 0;
}

.focus-v .focus-name {
  font-weight: 750;
  color: var(--cr-name);
}

.focus-v .focus-pct {
  margin-left: 6px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.focus-row--industry .focus-pct {
  color: var(--cr-blue);
}

.focus-row--theme .focus-pct {
  color: var(--cr-purple-soft);
}

.focus-row--stock .focus-pct,
.focus-row--stock .focus-name {
  color: var(--cr-cyan-soft);
}

.focus-v .focus-code {
  margin-left: 4px;
  color: var(--cr-muted);
  font-weight: 600;
  font-size: 11px;
}

.market-summary[hidden] {
  display: none !important;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.metric-card {
  border: 1px solid var(--cr-line);
  background: var(--cr-panel);
  border-radius: var(--cr-radius);
  padding: 14px 12px;
  min-height: 96px;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.metric-card:hover,
.metric-card:focus-visible {
  border-color: rgba(47, 140, 255, 0.5);
  box-shadow: 0 0 0 1px rgba(47, 140, 255, 0.12);
  outline: none;
}

.metric-card.is-expanded {
  border-color: rgba(61, 224, 208, 0.5);
  background: rgba(12, 28, 44, 0.95);
  box-shadow: 0 0 0 1px rgba(61, 224, 208, 0.16);
}

.metric-detail-panel {
  margin-top: 10px;
  border: 1px solid rgba(61, 224, 208, 0.28);
  background:
    linear-gradient(180deg, rgba(12, 32, 48, 0.95), rgba(8, 18, 30, 0.98));
  border-radius: var(--cr-radius);
  padding: 14px 16px 16px;
  animation: cr-detail-in 0.2s ease;
}

@keyframes cr-detail-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.metric-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.metric-detail-title {
  font-size: 14px;
  font-weight: 900;
  color: var(--cr-text);
}

.metric-detail-close {
  border: 1px solid rgba(90, 160, 210, 0.35);
  background: rgba(8, 18, 30, 0.85);
  color: #cfe0f3;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.metric-detail-close:hover {
  border-color: var(--color-border-selected);
  color: #fff;
}

.metric-detail-score {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(37, 55, 80, 0.55);
}

.metric-detail-score-label {
  color: var(--cr-muted);
  font-size: 12px;
  font-weight: 700;
}

.metric-detail-score-value {
  font-size: 28px;
  font-weight: 900;
  color: #3de0d0;
  letter-spacing: -0.02em;
}

.metric-detail-block + .metric-detail-block {
  margin-top: 12px;
}

.metric-detail-block-title {
  color: var(--cr-sub);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 6px;
}

.metric-detail-block-text {
  color: #c5d5e8;
  font-size: 13px;
  line-height: 1.55;
}

.metric-detail-rows {
  display: grid;
  gap: 6px;
}

.metric-detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--color-bg-inset, rgba(6, 14, 25, 0.55));
  border: 1px solid var(--cr-line);
}

.metric-detail-k {
  color: var(--cr-muted);
  font-size: 12px;
  font-weight: 700;
  word-break: break-all;
}

.metric-detail-v {
  color: var(--cr-text);
  font-size: 13px;
  font-weight: 800;
  text-align: right;
  flex-shrink: 0;
}

.metric-detail-hint {
  margin: 8px 0 10px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--cr-sub);
}

.metric-detail-empty {
  margin-top: 8px;
  font-size: 13px;
  color: var(--cr-muted);
}

.metric-contrib-scroll {
  margin-top: 8px;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.metric-contrib-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 13px;
}

.metric-contrib-table--activity {
  min-width: 480px;
}

.metric-contrib-table th,
.metric-contrib-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--cr-line);
  text-align: left;
  white-space: nowrap;
}

.metric-contrib-table th {
  color: var(--cr-sub);
  font-weight: 600;
  font-size: 12px;
}

.metric-contrib-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.metric-contrib-table .name-cell {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-detail-more {
  margin-top: 10px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--cr-line);
  background: var(--cr-panel);
  color: var(--cr-text);
  font-size: 13px;
  cursor: pointer;
}

.metric-detail-more:hover {
  border-color: var(--color-border-selected, rgba(0, 209, 193, 0.45));
  color: var(--color-text-bright, #fff);
}

.metric-detail-hint--sub {
  opacity: 0.88;
}

.contrib-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(120, 180, 255, 0.28);
  background: rgba(15, 35, 58, 0.65);
  color: #b9d4f5;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  opacity: 0.92;
}

.contrib-link-btn:hover {
  border-color: rgba(0, 209, 193, 0.45);
  background: rgba(0, 209, 193, 0.1);
  color: #dff7f4;
}

.contrib-link-btn--stock:hover {
  cursor: pointer;
}

.contrib-link-btn--sector:hover {
  cursor: pointer;
  border-color: rgba(0, 209, 193, 0.5);
  background: rgba(0, 209, 193, 0.1);
  color: #dff7f4;
}

.contrib-link-btn[aria-disabled="true"],
.contrib-link-btn:disabled,
.contrib-link-btn--soon {
  cursor: default;
  opacity: 0.72;
  border-color: rgba(120, 140, 160, 0.22);
  color: #8fa3b8;
}

.contrib-link-btn--soon:hover {
  border-color: rgba(120, 140, 160, 0.22);
  color: #8fa3b8;
}

.metric-calc-fold {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--color-border-subtle);
  background: rgba(8, 18, 32, 0.45);
}

.metric-calc-fold > summary {
  cursor: pointer;
  color: #9ec4e8;
  font-size: 13px;
  font-weight: 600;
  list-style: none;
  user-select: none;
}

.metric-calc-fold > summary::-webkit-details-marker {
  display: none;
}

.metric-calc-fold > summary::before {
  content: "▸ ";
  color: #6fa8d6;
}

.metric-calc-fold[open] > summary::before {
  content: "▾ ";
}

.metric-calc-fold-body {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(90, 160, 210, 0.12);
}

.metric-contrib-table--stock {
  min-width: 520px;
}

.metric-contrib-table--stock .contrib-stock-name {
  font-weight: 800;
  color: var(--cr-text);
}

.metric-contrib-table--stock .contrib-share {
  color: var(--color-accent-hover);
  font-weight: 800;
}

.metric-contrib-table--sector {
  min-width: 560px;
}

.metric-name {
  color: var(--cr-muted);
  font-size: 11px;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 6px;
}

.metric-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(90, 160, 210, 0.35);
  color: var(--cr-dim);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  cursor: help;
}

.metric-value {
  margin-top: 8px;
  font-size: 26px;
  font-weight: 900;
  color: var(--color-text-bright, var(--cr-text));
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.metric-hint {
  margin-top: 6px;
  color: var(--cr-dim);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.35;
  opacity: 0.85;
}

.chart-panel {
  border: 1px solid var(--cr-line);
  background: var(--cr-panel);
  border-radius: var(--cr-radius);
  padding: 8px 6px 4px;
}

.history-chart {
  width: 100%;
  height: 280px;
}

.crowding-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
}

.table-wrap {
  border: 1px solid var(--cr-line);
  background: var(--cr-panel);
  border-radius: var(--cr-radius);
  overflow: auto;
  max-height: 420px;
}

.crowding-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.crowding-table th,
.crowding-table td {
  padding: 10px 12px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid rgba(37, 55, 80, 0.45);
}

.crowding-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--cr-panel2);
  color: var(--cr-sub);
  font-size: 12px;
  font-weight: 800;
}

.crowding-table th.sortable {
  padding: 0;
  user-select: none;
}

.crowding-table th.sortable .sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}

.crowding-table th.sortable .sort-btn:hover,
.crowding-table th.sortable .sort-btn:focus-visible {
  color: #dcecff;
  outline: none;
}

.crowding-table th.sortable.is-sorted .sort-btn {
  color: #3de0d0;
}

.crowding-table .sort-arrow {
  display: inline-block;
  min-width: 0.9em;
  color: #3de0d0;
  font-size: 10px;
  line-height: 1;
}

.crowding-table th.sortable:not(.is-sorted) .sort-arrow:empty::after {
  content: "↕";
  opacity: 0.35;
  color: var(--cr-muted);
}

.crowding-table tbody tr:nth-child(even) {
  background: rgba(8, 18, 32, 0.28);
}

.crowding-table tbody tr:hover {
  background: rgba(47, 140, 255, 0.08);
}

.crowding-table tbody tr:hover .name-cell {
  color: #f2f8ff;
}

.crowding-table tbody tr:hover .num-amount,
.crowding-table tbody tr:hover .num-share {
  filter: brightness(1.08);
}

.crowding-table .num {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.crowding-table .num-amount {
  color: var(--cr-cyan-soft);
  font-weight: 800;
}

.crowding-table .num-share {
  color: #8fd4ff;
  font-weight: 800;
}

.crowding-table .num-turnover {
  color: var(--cr-blue-soft);
  font-weight: 750;
}

.crowding-table .num-chg.up {
  color: var(--cr-up);
  font-weight: 850;
}

.crowding-table .num-chg.down {
  color: var(--cr-down);
  font-weight: 850;
}

.crowding-table .num-chg.flat {
  color: var(--cr-flat);
  font-weight: 700;
}

.crowding-table .num-chg.na,
.crowding-table .num-na {
  color: var(--cr-muted);
  font-weight: 600;
}

.crowding-table .num-limit.is-hot {
  color: #ffb08a;
  font-weight: 850;
}

.crowding-table .num-limit.is-zero {
  color: var(--cr-dim);
  font-weight: 650;
}

.crowding-table .num-limit.is-na {
  color: var(--cr-muted);
  font-weight: 600;
}

.crowding-table .rank {
  color: var(--cr-dim);
  font-weight: 700;
  width: 36px;
  font-size: 12px;
}

.crowding-table .name-cell {
  color: var(--cr-name);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.crowding-table .name-cell .stock-code {
  display: block;
  margin-top: 2px;
  color: var(--cr-muted);
  font-size: 11px;
  font-weight: 600;
}

.sector-chip {
  display: inline-flex;
  align-items: center;
  max-width: 120px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid transparent;
}

.sector-chip--industry {
  color: #9ecfff;
  background: rgba(47, 140, 255, 0.1);
  border-color: rgba(90, 168, 255, 0.28);
}

.sector-chip--theme {
  color: #d0c4ff;
  background: rgba(180, 156, 255, 0.1);
  border-color: rgba(180, 156, 255, 0.28);
}

.sector-chip--na {
  color: var(--cr-muted);
  background: rgba(15, 28, 44, 0.5);
  border-color: rgba(90, 120, 150, 0.2);
  font-weight: 600;
}

.score-pill {
  display: inline-flex;
  min-width: 42px;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 12px;
  background: rgba(47, 140, 255, 0.12);
  color: #cfe4ff;
}

.score-pill.hot {
  background: rgba(255, 90, 90, 0.14);
  color: #ffb4ae;
}

.score-pill.warm {
  background: rgba(255, 154, 61, 0.14);
  color: #ffc39a;
}

.score-pill.mid {
  background: rgba(47, 140, 255, 0.12);
  color: #b9d4f5;
}

.score-pill.cool {
  background: rgba(90, 120, 150, 0.12);
  color: #8fa3b8;
}

.reason-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.reason-card {
  border: 1px solid var(--cr-line);
  background: var(--cr-panel);
  border-radius: var(--cr-radius);
  padding: 12px 14px 14px;
  position: relative;
}

.reason-card.active {
  border-color: rgba(0, 209, 193, 0.32);
  box-shadow: inset 3px 0 0 rgba(0, 209, 193, 0.55);
}

.reason-idx {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-right: 6px;
  border-radius: 5px;
  background: rgba(90, 160, 210, 0.12);
  color: var(--cr-slate);
  font-size: 11px;
  font-weight: 800;
  vertical-align: middle;
}

.reason-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--cr-name);
  line-height: 1.35;
}

.reason-desc {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--cr-sub);
  font-weight: 550;
}

.reason-desc .reason-accent {
  color: var(--cr-cyan-soft);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.reason-meta {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--cr-muted);
  font-size: 11px;
  font-weight: 650;
}

.reason-meta .num {
  color: var(--cr-blue-soft);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.reason-bar {
  margin-top: 10px;
  height: 4px;
  border-radius: 999px;
  background: rgba(37, 55, 80, 0.7);
  overflow: hidden;
}

.reason-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(47, 140, 255, 0.7), rgba(0, 209, 193, 0.75));
  width: 0;
}

.empty-row td {
  color: var(--cr-muted);
  text-align: center;
  padding: 28px 12px;
}

.th-mobi {
  display: none;
}

.th-desk {
  display: inline;
}

.name-amount-sub,
.name-tap-chevron,
.stock-sector-sub {
  display: none;
}

.rank-name-btn {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  text-align: left;
  cursor: default;
}

.rank-name-btn:disabled {
  opacity: 1;
  cursor: default;
}

.rank-name-btn .name-text {
  color: inherit;
  font-weight: inherit;
}

.stock-code-line {
  display: block;
}

.rank-name-btn .stock-code {
  display: block;
}

@media (max-width: 980px) {
  .overview-hero {
    grid-template-columns: 1fr 1fr;
  }
  .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-column: 1 / -1;
  }
  .crowding-split {
    grid-template-columns: 1fr;
  }
  .reason-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .data-status-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .degrade-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .crowding-app {
    padding: 40px 12px 24px;
    max-width: 100%;
    overflow-x: hidden;
  }
  .crowding-chrome {
    gap: 4px;
    margin-bottom: 8px;
    padding-top: 0;
  }
  .crowding-page-title {
    font-size: 17px;
  }
  .crowding-page-sub {
    font-size: 11px;
  }
  .crowding-title-bar {
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }
  .crowding-head-actions {
    align-self: center;
  }
  .btn,
  .quick-action-btn {
    min-height: 40px;
    height: 40px;
  }
  .history-range-btn {
    min-height: 36px;
    height: 36px;
  }
  .data-status-line {
    font-size: 11px;
    padding: 4px 8px;
    min-height: 24px;
  }
  .quick-actions {
    gap: 6px;
    margin-bottom: 8px;
  }
  .quick-action-btn {
    flex: 1 1 calc(33.33% - 6px);
    padding: 0 8px;
    font-size: 11px;
  }
  .section-head {
    margin-bottom: 8px;
  }
  .section-hint {
    font-size: 11px;
    line-height: 1.4;
  }
  .crowding-section {
    margin-bottom: 14px;
  }
  .data-status-panel {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 8px;
  }
  .data-status-item {
    padding: 8px;
  }
  .data-status-v {
    font-size: 12px;
  }
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .metric-card {
    min-height: 64px;
    padding: 10px 10px;
  }
  .metric-hint {
    display: none;
  }
  .metric-value {
    font-size: 20px;
  }
  .reason-grid {
    grid-template-columns: 1fr;
  }
  .history-chart {
    height: 168px;
  }
  .score-panel {
    min-height: 96px;
    padding: 12px 12px;
  }
  .score-value {
    font-size: 40px;
  }
  .history-summary {
    margin-left: 0;
    width: 100%;
    font-size: 11px;
  }
  .focus-row {
    grid-template-columns: 72px 1fr;
    padding: 6px 8px;
  }
  .sector-chip {
    max-width: 88px;
  }
  .metric-value {
    font-size: 22px;
  }
  /* 移动端减少同时 accent：弱化斑马，保留 hover */
  .crowding-table tbody tr:nth-child(even) {
    background: transparent;
  }
  .score-risk-note {
    max-width: 100%;
    font-size: 11px;
    text-align: left;
  }
  .focus-panel {
    min-height: 0;
    padding: 12px;
  }
  .focus-hint {
    font-size: 11px;
    line-height: 1.45;
  }
  .focus-row {
    grid-template-columns: 72px 1fr;
  }
  .overview-hero {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .metric-grid {
    grid-column: auto;
  }
  .metric-detail-panel {
    padding: 12px;
  }
  .metric-detail-score-value {
    font-size: 24px;
  }
  .metric-detail-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .metric-detail-v {
    text-align: left;
  }
  .metric-contrib-table {
    min-width: 560px;
    font-size: 12px;
  }
  .contrib-link-btn {
    min-height: 40px;
    font-size: 12px;
    padding: 8px 10px;
  }
  .table-wrap {
    max-height: 360px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .crowding-table {
    font-size: 12px;
  }
  .crowding-table th.sortable .sort-btn {
    min-height: 40px;
    padding: 10px 10px;
  }
  .crowding-table th,
  .crowding-table td {
    padding: 8px 10px;
  }
  .empty-row td {
    white-space: normal;
    line-height: 1.45;
  }
}

/* V2.9.8-R2.1：手机端核心字段精简表（仅 <=768px；撤销 R2 超宽横滑/sticky） */
@media (max-width: 768px) {
  .crowding-app {
    overflow-x: hidden;
    max-width: 100%;
  }

  .th-desk {
    display: none;
  }

  .th-mobi {
    display: inline;
  }

  .table-wrap {
    overflow-x: hidden;
    max-height: 360px;
  }

  #sectorTable,
  #stockTable {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    table-layout: fixed;
    font-size: 12px;
  }

  .crowding-table th,
  .crowding-table td {
    padding: 8px 4px;
    white-space: nowrap;
  }

  .crowding-table th.sortable {
    padding: 0;
  }

  .crowding-table th.sortable .sort-btn {
    min-height: 36px;
    padding: 8px 4px;
    font-size: 12px;
    gap: 2px;
  }

  .crowding-table .sort-arrow {
    min-width: 0.7em;
    font-size: 9px;
  }

  /* 板块：隐藏 # / 成交金额列 / 联动列 */
  #sectorTable th:nth-child(1),
  #sectorTable td:nth-child(1),
  #sectorTable th:nth-child(4),
  #sectorTable td:nth-child(4),
  #sectorTable th:nth-child(8),
  #sectorTable td:nth-child(8) {
    display: none;
  }

  /* 个股：隐藏 # / 所属板块列 / 联动列 */
  #stockTable th:nth-child(1),
  #stockTable td:nth-child(1),
  #stockTable th:nth-child(7),
  #stockTable td:nth-child(7),
  #stockTable th:nth-child(8),
  #stockTable td:nth-child(8) {
    display: none;
  }

  /* 板块可见列宽：名称 / 评分 / 占比 / 集中度 / 涨停 */
  #sectorTable th:nth-child(2),
  #sectorTable td:nth-child(2) {
    width: 30%;
  }

  #sectorTable th:nth-child(3),
  #sectorTable td:nth-child(3) {
    width: 16%;
  }

  #sectorTable th:nth-child(5),
  #sectorTable td:nth-child(5) {
    width: 18%;
  }

  #sectorTable th:nth-child(6),
  #sectorTable td:nth-child(6) {
    width: 18%;
  }

  #sectorTable th:nth-child(7),
  #sectorTable td:nth-child(7) {
    width: 14%;
  }

  /* 个股可见列宽：名称 / 评分 / 占比 / 换手 / 涨幅 */
  #stockTable th:nth-child(2),
  #stockTable td:nth-child(2) {
    width: 32%;
  }

  #stockTable th:nth-child(3),
  #stockTable td:nth-child(3) {
    width: 15%;
  }

  #stockTable th:nth-child(4),
  #stockTable td:nth-child(4) {
    width: 18%;
  }

  #stockTable th:nth-child(5),
  #stockTable td:nth-child(5) {
    width: 18%;
  }

  #stockTable th:nth-child(6),
  #stockTable td:nth-child(6) {
    width: 17%;
  }

  #sectorTable .name-cell,
  #stockTable .name-cell {
    max-width: none;
    overflow: hidden;
    white-space: normal;
  }

  .rank-name-btn {
    cursor: pointer;
    min-height: 36px;
    padding: 2px 0;
  }

  .rank-name-btn:not(:disabled) .name-text {
    color: #d7eefc;
    font-size: 13px;
    font-weight: 700;
  }

  .rank-name-btn:not(:disabled):active .name-text {
    color: var(--cr-cyan-soft);
  }

  .name-tap-chevron {
    display: inline;
    margin-left: 2px;
    color: rgba(0, 209, 193, 0.55);
    font-size: 12px;
    font-weight: 600;
  }

  .name-amount-sub {
    display: block;
    margin-top: 2px;
    color: var(--cr-muted);
    font-size: 11px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .stock-code-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 2px;
  }

  .rank-name-btn .stock-code {
    display: inline;
    margin-top: 0;
  }

  .stock-sector-sub {
    display: inline;
    color: #a8b8d0;
    font-size: 10px;
    font-weight: 600;
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .stock-sector-sub::before {
    content: "· ";
    color: var(--cr-dim);
  }

  .score-pill {
    min-width: 36px;
    padding: 2px 6px;
    font-size: 12px;
  }
}

/* M3-B Light：消除深色孤岛（容器走 panel/control token；业务红绿橙不变） */
html[data-theme="light"] .focus-row {
  background: var(--color-bg-control);
  border-color: var(--color-border-subtle);
}
html[data-theme="light"] .metric-card.is-expanded {
  background: var(--color-bg-panel-2);
  border-color: var(--color-border-selected);
  box-shadow: var(--shadow-selected-inset);
}
html[data-theme="light"] .metric-detail-panel {
  background: var(--color-bg-panel);
  border-color: var(--color-border-strong);
}
html[data-theme="light"] .metric-detail-close {
  background: var(--color-bg-control);
  border-color: var(--color-border-control);
  color: var(--color-text-primary);
}
html[data-theme="light"] .metric-detail-close:hover {
  color: var(--color-text-bright);
  border-color: var(--color-border-selected);
}
html[data-theme="light"] .metric-detail-score {
  border-bottom-color: var(--color-border-subtle);
}
html[data-theme="light"] .metric-detail-score-value {
  color: var(--color-accent);
}
html[data-theme="light"] .contrib-link-btn {
  background: var(--color-bg-control);
  border-color: var(--color-border-control);
  color: var(--color-text-secondary);
}
html[data-theme="light"] .contrib-link-btn:hover {
  background: var(--color-bg-control-hover);
  border-color: var(--color-border-selected);
  color: var(--color-text-primary);
}
html[data-theme="light"] .stock-sector-sub {
  color: var(--color-text-muted);
}
html[data-theme="light"] .metric-value {
  color: var(--color-text-primary);
}
html[data-theme="light"] .score-panel.tone-extreme .score-value {
  color: var(--cr-hot);
  text-shadow: none;
}
html[data-theme="light"] .score-panel.tone-crowded .score-value {
  color: var(--cr-warn);
  text-shadow: none;
}
html[data-theme="light"] .score-value {
  text-shadow: none;
}
html[data-theme="light"] .crowding-table tbody tr:nth-child(even) {
  background: var(--color-bg-elevated-soft);
}
html[data-theme="light"] .crowding-table tbody tr:hover {
  background: var(--color-bg-hover-soft);
}
html[data-theme="light"] .crowding-table tbody tr:hover .name-cell {
  color: var(--color-text-primary);
}
html[data-theme="light"] .crowding-table .num-share {
  color: var(--color-accent);
}
html[data-theme="light"] .crowding-table .num-amount {
  color: var(--color-accent);
}
html[data-theme="light"] .crowding-table .num-turnover {
  color: var(--color-text-link);
}
html[data-theme="light"] .crowding-table th.sortable .sort-btn:hover,
html[data-theme="light"] .crowding-table th.sortable .sort-btn:focus-visible {
  color: var(--color-text-primary);
}
html[data-theme="light"] .crowding-table tbody tr:hover .name-cell {
  color: var(--color-text-primary);
}
html[data-theme="light"] .metric-card {
  background: var(--color-bg-panel);
  border-color: var(--color-border-card);
}
html[data-theme="light"] .metric-card:hover,
html[data-theme="light"] .metric-card:focus-visible {
  border-color: var(--color-border-selected);
  box-shadow: var(--shadow-selected-inset, 0 0 0 1px rgba(37, 99, 235, 0.12));
}
html[data-theme="light"] .focus-panel {
  background: var(--color-bg-panel);
  border-color: var(--color-border-card);
}
html[data-theme="light"] .focus-title {
  color: var(--color-accent);
}
html[data-theme="light"] .metric-detail-block-text {
  color: var(--color-text-body);
}
html[data-theme="light"] .metric-detail-row {
  background: var(--color-bg-inset);
  border-color: var(--color-border-subtle);
}
html[data-theme="light"] .metric-calc-fold {
  background: var(--color-bg-elevated-soft);
  border-color: var(--color-border-subtle);
}
html[data-theme="light"] .metric-calc-fold > summary {
  color: var(--color-text-secondary);
}
html[data-theme="light"] .metric-calc-fold > summary::before {
  color: var(--color-text-link);
}
html[data-theme="light"] body {
  background:
    radial-gradient(circle at 22% -6%, var(--color-bg-canvas-glow-1, transparent), transparent 32%),
    radial-gradient(circle at 90% 108%, var(--color-bg-canvas-glow-2, transparent), transparent 28%),
    linear-gradient(180deg, var(--color-bg-page), var(--color-bg-page-mid) 56%, var(--cr-bg));
}
