:root {
  --bg: #05080c;
  --surface: #0e141b;
  --surface-raised: #151b24;
  --surface-muted: #0a1017;
  --line: #26313d;
  --line-soft: rgba(148, 163, 184, 0.18);
  --text: #eef3f8;
  --muted: #99a8ba;
  --subtle: #6f8094;
  --accent: #ff7043;
  --orange: #ffa502;
  --blue: #60a5fa;
  --green: #38d39f;
  --red: #fb7185;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 50% -10%, rgba(255, 112, 67, 0.14), transparent 34%),
    linear-gradient(180deg, rgba(148, 163, 184, 0.035), rgba(148, 163, 184, 0) 170px),
    var(--bg);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
}

button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

button:hover:not(:disabled),
button:focus-visible {
  border-color: var(--blue);
  color: var(--text);
}

button:focus-visible {
  outline: 3px solid rgba(96, 165, 250, 0.45);
  outline-offset: 2px;
}

button:disabled { cursor: not-allowed; opacity: 0.42; }

h1, h2, h3, p { margin: 0; }

h1 { margin-top: 8px; font-size: clamp(46px, 7vw, 104px); line-height: 0.96; letter-spacing: 0; }
.topbar h1 { white-space: nowrap; }
h2 { font-size: 22px; line-height: 1.25; letter-spacing: 0; }
h3 { font-size: 17px; line-height: 1.3; letter-spacing: 0; }

.app-shell { width: min(1500px, calc(100% - 40px)); margin: 0 auto; padding: 24px 0 52px; }

.page-tabs {
  position: sticky;
  top: 14px;
  z-index: 40;
  display: flex;
  width: max-content;
  max-width: 100%;
  gap: 4px;
  align-items: center;
  margin: 0 auto 56px;
  padding: 7px;
  overflow-x: auto;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 999px;
  background: rgba(5, 8, 12, 0.86);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(18px);
}

.nav-brand {
  flex: 0 0 auto;
  padding: 0 14px 0 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 40px;
  align-items: end;
  min-height: 360px;
  padding: 0 0 36px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.eyebrow,
.section-heading span,
.panel-heading span,
.placeholder-page span,
.control-group > span,
.drill-toolbar span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.source-note { margin-top: 8px; color: var(--muted); font-size: 13px; }

.status-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(142px, 1fr));
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 8px;
  background: rgba(14, 20, 27, 0.72);
}
.status-strip div { min-height: 72px; padding: 14px 18px; }
.status-strip div + div { border-left: 1px solid var(--line); }
.status-strip span, .metric-card span, small, th, td, .drill-card span, .placeholder-page p, .drill-toolbar p { color: var(--muted); font-size: 12px; }
.status-strip strong { display: block; margin-top: 8px; font-size: 14px; font-variant-numeric: tabular-nums; }

.tab-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 64px;
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
}
.tab-button.active {
  background: linear-gradient(135deg, rgba(255, 112, 67, 0.22), rgba(148, 163, 184, 0.12));
  color: var(--text);
  font-weight: 800;
}

.tab-button:hover {
  color: var(--text);
  background: rgba(148, 163, 184, 0.12);
}

.home-body {
  overflow-x: hidden;
  background: #02070b;
}

.home-shell {
  padding-bottom: 64px;
}

.home-tabs {
  position: fixed;
  top: 22px;
  left: 50%;
  z-index: 60;
  width: min(1620px, calc(100% - 148px));
  justify-content: center;
  margin: 0;
  transform: translateX(-50%);
}

.nav-brand-home {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  font-size: 17px;
}

.nav-brand-home span {
  color: #eef3f8;
  font-size: 24px;
  line-height: 1;
}

.home-live-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding: 0 12px;
  color: #99a8ba;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.home-live-status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #38d39f;
  box-shadow: 0 0 18px rgba(56, 211, 159, 0.72);
}

.home-hero {
  position: relative;
  display: grid;
  min-height: 100svh;
  overflow: hidden;
  place-items: center;
  padding: 118px 24px 76px;
}

.home-hero-bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.2), rgba(2, 7, 11, 0.58) 70%, #02070b),
    radial-gradient(circle at 50% 55%, rgba(255, 112, 67, 0.1), transparent 28%),
    url("./assets/home-ai-cockpit-bg.png") center / cover no-repeat;
}

.home-hero::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(2, 7, 11, 0.62), transparent 28%, transparent 72%, rgba(2, 7, 11, 0.62)),
    linear-gradient(180deg, rgba(2, 7, 11, 0.55), transparent 22%, rgba(2, 7, 11, 0.72));
  content: "";
}

.home-hero-content {
  width: min(1360px, 100%);
  margin-top: 42px;
  text-align: center;
}

.home-super-title {
  color: rgba(238, 243, 248, 0.58);
  font-size: clamp(11px, 1.2vw, 18px);
  font-weight: 800;
  letter-spacing: 0.42em;
}

.home-hero h1 {
  margin-top: 32px;
  color: rgba(255, 255, 255, 0.96);
  font-size: clamp(72px, 8.6vw, 132px);
  font-weight: 700;
  line-height: 0.98;
  white-space: nowrap;
  text-shadow: 0 18px 62px rgba(0, 0, 0, 0.6);
}

.home-search {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  width: min(1100px, calc(100% - 80px));
  min-height: 62px;
  align-items: center;
  gap: 14px;
  margin: 34px auto 0;
  padding: 0 16px 0 22px;
  border: 1px solid rgba(192, 203, 216, 0.34);
  border-radius: 999px;
  background: rgba(6, 12, 18, 0.72);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.44), inset 0 1px 0 rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(18px);
}

.home-search span {
  color: #a9b7c7;
  font-size: 28px;
}

.home-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #eef3f8;
  font: inherit;
  font-size: clamp(15px, 1.6vw, 21px);
}

.home-search input::placeholder {
  color: rgba(195, 207, 221, 0.56);
}

.home-search kbd {
  display: inline-flex;
  min-width: 48px;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  color: rgba(238, 243, 248, 0.62);
  background: rgba(148, 163, 184, 0.13);
  font: inherit;
  font-weight: 800;
}

.home-lead {
  max-width: 960px;
  margin: 22px auto 0;
  color: rgba(219, 228, 239, 0.8);
  font-size: clamp(15px, 1.6vw, 20px);
  font-weight: 700;
  line-height: 1.7;
}

.home-scroll-hint {
  position: absolute;
  bottom: 34px;
  left: 50%;
  display: grid;
  gap: 9px;
  color: rgba(219, 228, 239, 0.58);
  font-size: 14px;
  text-align: center;
  transform: translateX(-50%);
}

.home-scroll-hint b {
  color: rgba(219, 228, 239, 0.72);
  font-size: 22px;
}

.home-core-card,
.home-module-card {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(148, 163, 184, 0.105), rgba(14, 20, 27, 0.86)),
    #0e141b;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.home-core-card span,
.home-module-card p,
.home-module-card small {
  color: var(--muted);
  font-size: 12px;
}

.home-section {
  width: min(1500px, calc(100% - 40px));
  margin: 28px auto 0;
}

.home-heading {
  margin-top: 0;
}

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

.home-module-card {
  display: grid;
  min-height: 192px;
  align-content: space-between;
  gap: 22px;
  padding: 17px;
  color: var(--text);
  text-decoration: none;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.home-module-card:hover,
.home-module-card:focus-visible {
  border-color: rgba(255, 112, 67, 0.5);
  background:
    linear-gradient(135deg, rgba(255, 112, 67, 0.16), rgba(14, 20, 27, 0.86)),
    #0e141b;
  transform: translateY(-2px);
  outline: none;
}

.home-module-card.featured {
  border-color: rgba(255, 112, 67, 0.34);
}

.module-index {
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: #ffb69e;
  background: rgba(255, 112, 67, 0.13);
  font-weight: 900;
}

.home-module-card strong {
  display: block;
  margin: 8px 0;
  font-size: 28px;
  line-height: 1;
}

.home-module-card b {
  color: #ffb69e;
  font-size: 13px;
}

.home-dashboard-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.home-core-card {
  min-height: 132px;
  padding: 16px;
}

.home-core-card strong {
  display: block;
  margin: 11px 0 8px;
  color: var(--text);
  font-size: clamp(25px, 2.8vw, 38px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.control-bar {
  position: sticky;
  top: 76px;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(300px, 1fr) auto;
  gap: 18px;
  align-items: end;
  margin: 16px 0 0;
  padding: 12px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(5, 8, 12, 0.95);
}

.control-group { display: grid; gap: 7px; }
.button-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tab-button, .time-button, .jump-button, .export-actions button, .back-button { padding: 0 12px; }
.time-button, .jump-button { min-height: 34px; font-size: 13px; }
.time-button.active { border-color: rgba(255, 112, 67, 0.8); background: rgba(255, 112, 67, 0.12); color: var(--text); font-weight: 800; }
.jump-button:hover { background: var(--surface-raised); }
.export-actions { justify-self: end; }
.export-actions button { min-height: 34px; color: var(--text); }
.export-actions button:first-child { border-color: rgba(96, 165, 250, 0.65); }
.export-actions button:last-child { border-color: rgba(255, 112, 67, 0.7); }

.page-view { display: none; }
.page-view.active { display: block; }
.board-section { scroll-margin-top: 92px; }

.section-heading, .panel-heading { display: flex; justify-content: space-between; gap: 16px; align-items: end; }
.section-heading { margin: 32px 0 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.section-heading > div { display: flex; gap: 10px; align-items: baseline; }
.section-heading span { display: inline-flex; align-items: center; }
.section-heading span::before { width: 3px; height: 17px; margin-right: 7px; border-radius: 99px; background: var(--accent); content: ""; }

.metric-grid { display: grid; grid-template-columns: minmax(260px, 1.35fr) repeat(3, minmax(170px, 1fr)); gap: 8px; }
.metric-card { min-height: 132px; padding: 16px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.metric-card.hero { border-left: 3px solid var(--accent); background: var(--surface-raised); }
.metric-card strong { display: block; margin: 10px 0 7px; font-size: clamp(27px, 3vw, 42px); line-height: 1; font-variant-numeric: tabular-nums; }
.progress-track { height: 5px; overflow: hidden; margin-top: 17px; border-radius: 99px; background: rgba(148, 163, 184, 0.16); }
.progress-track div { width: 0; height: 100%; border-radius: inherit; background: var(--accent); }

.chart-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.75fr); gap: 8px; margin-top: 8px; }
.chart-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.panel { padding: 16px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.chart-panel { min-height: 315px; }
.combo-chart, .mini-trend { display: block; width: 100%; margin-top: 10px; }
.combo-chart { min-height: 340px; }
.mini-trend { min-height: 205px; }

.donut-wrap { display: grid; min-height: 185px; place-items: center; }
.donut-chart { width: 182px; height: 182px; border-radius: 50%; }
.legend-list { display: grid; gap: 7px; margin-top: 8px; }
.legend-item, .rank-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; }
.legend-item b { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; }

.table-panel { margin-top: 8px; }
.table-scroll { overflow-x: auto; margin-top: 12px; }
.data-table { width: 100%; min-width: 880px; border-collapse: collapse; }
.data-table th, .data-table td { padding: 11px 10px; border-bottom: 1px solid var(--line-soft); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.data-table th:first-child, .data-table td:first-child, .data-table th:nth-child(2), .data-table td:nth-child(2) { text-align: left; }
.data-table th { color: #c7d2df; font-weight: 700; }
.positive { color: var(--green) !important; }
.negative { color: var(--red) !important; }

.ownership-grid, .drill-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ownership-card, .drill-card { min-height: 168px; padding: 15px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.ownership-card strong, .drill-card strong { display: block; margin-top: 8px; font-size: 29px; line-height: 1; font-variant-numeric: tabular-nums; }
.card-meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 13px; }
.meta-chip { padding: 7px; border-left: 2px solid rgba(148, 163, 184, 0.3); color: var(--muted); font-size: 12px; }
.meta-chip b { display: block; margin-top: 3px; color: var(--text); font-variant-numeric: tabular-nums; }
.ownership-rank { display: grid; gap: 5px; margin-top: 12px; }
.ownership-rank div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; color: var(--muted); font-size: 11px; }
.ownership-rank b { color: var(--text); font-weight: 700; }

.ownership-analysis-panel { margin-top: 8px; }
.ownership-analysis-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 12px; margin-top: 12px; }
.matrix-scroll { overflow-x: auto; }
.ownership-matrix { display: grid; grid-template-columns: 118px repeat(3, minmax(126px, 1fr)); min-width: 560px; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; }
.matrix-head, .matrix-label, .matrix-cell { min-height: 74px; padding: 10px; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); border-radius: 0; text-align: left; }
.matrix-head { min-height: 42px; background: var(--surface-muted); color: var(--muted); font-size: 12px; font-weight: 800; text-align: center; }
.matrix-label { display: flex; align-items: center; background: var(--surface-muted); color: var(--text); font-size: 13px; font-weight: 800; }
.matrix-cell { display: block; color: var(--text); }
.matrix-cell:hover, .matrix-cell:focus-visible, .matrix-cell.active { border-color: var(--blue); background-color: rgba(96, 165, 250, 0.13) !important; }
.matrix-cell strong { display: block; font-size: 18px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.matrix-cell small { display: block; margin-top: 7px; }
.matrix-cell.empty { display: flex; align-items: center; color: var(--subtle); cursor: default; }
.matrix-cell.empty:hover { border-color: var(--line); background-color: var(--surface) !important; }
.heat-1 { background: #151210; }
.heat-2 { background: #211610; }
.heat-3 { background: #321a12; }
.heat-4 { background: #452014; }
.matrix-cell.heat-3,
.matrix-cell.heat-4 { color: #fff; }
.matrix-cell.heat-3 small,
.matrix-cell.heat-4 small { color: #ffe1d5; }
.ownership-detail { min-height: 100%; padding: 15px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-muted); }
.ownership-detail h4 { margin: 4px 0 0; font-size: 19px; }
.detail-kpi { display: flex; justify-content: space-between; align-items: end; margin: 16px 0; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.detail-kpi strong { font-size: 30px; line-height: 1; font-variant-numeric: tabular-nums; }
.detail-kpi span { color: var(--muted); font-size: 12px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.detail-grid div { padding: 8px 0; border-bottom: 1px solid var(--line-soft); color: var(--muted); font-size: 11px; }
.detail-grid b { display: block; margin-top: 4px; color: var(--text); font-size: 14px; font-variant-numeric: tabular-nums; }
.detail-trend { display: flex; gap: 4px; align-items: end; height: 46px; margin-top: 15px; padding: 0 2px; border-bottom: 1px solid var(--line); }
.detail-trend i { width: 100%; min-height: 4px; background: var(--orange); opacity: 0.76; }
.detail-note { margin-top: 7px; color: var(--muted); font-size: 11px; }

.drill-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.drill-card { min-height: 174px; }
.drill-card:hover, .drill-card:focus-within { border-color: rgba(96, 165, 250, 0.72); background: var(--surface-raised); }
.drill-card button { width: 100%; margin-top: 12px; }
.back-button { border-color: rgba(96, 165, 250, 0.55); }

.placeholder-page { display: grid; min-height: 360px; align-content: center; gap: 10px; padding: 32px; border: 1px dashed var(--line); }
.placeholder-page p { max-width: 720px; line-height: 1.6; }

@media (max-width: 1200px) {
  .topbar { grid-template-columns: 1fr; min-height: 270px; align-items: start; }
  .status-strip { width: min(440px, 100%); }
}

@media (max-width: 1080px) {
  .topbar, .control-bar, .metric-grid, .chart-grid, .chart-grid.three, .ownership-grid, .drill-grid, .ownership-analysis-layout { grid-template-columns: 1fr; }
  .home-hero, .home-dashboard-strip { grid-template-columns: 1fr; }
  .home-module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-tabs { width: min(100% - 28px, 920px); justify-content: start; }
  .home-live-status { display: none; }
  .nav-brand-home { margin-right: 0; }
  .topbar { min-height: 270px; align-items: start; }
  .status-strip { width: 100%; }
  .export-actions { justify-self: start; }
}

@media (max-width: 640px) {
  /* 小屏让长标题自然换行，避免挤压数据周期和快捷操作。 */
  .topbar h1 { white-space: normal; }

  .app-shell { width: min(100% - 20px, 1500px); padding-top: 18px; }
  h1 { font-size: clamp(34px, 10.5vw, 46px); }
  .page-tabs { top: 8px; margin-bottom: 34px; }
  .nav-brand:not(.nav-brand-home) { display: none; }
  .nav-brand-home { display: none; }
  .status-strip { grid-template-columns: 1fr; border-left: 0; }
  .status-strip div { padding-left: 0; }
  .status-strip div + div { margin: 10px 0 0; padding-top: 10px; border-left: 0; border-top: 1px solid var(--line); }
  .control-bar { position: static; }
  .home-hero { min-height: 100svh; padding: 104px 20px 78px; }
  .home-module-grid { grid-template-columns: 1fr; }
  .home-hero h1 { margin-top: 24px; font-size: 62px; white-space: normal; }
  .home-super-title { letter-spacing: 0.22em; }
  .home-search { width: 100%; min-height: 58px; padding-left: 16px; }
  .home-search kbd { display: none; }
  .home-lead { font-size: 15px; }
  .section-heading, .panel-heading, .drill-toolbar { align-items: start; flex-direction: column; }
  .metric-card { min-height: 118px; }
  .chart-panel { min-height: 280px; }
  .combo-chart { min-height: 285px; }
  .ownership-detail { min-height: 260px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
