:root {
  --bg: #f7f8fa;
  --panel: #ffffff;
  --text: #111827;
  --muted: #667085;
  --line: #d9dee7;
  --accent: #1f6feb;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: inherit; text-decoration: none; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.brand { font-weight: 700; }

nav { display: flex; gap: 18px; color: var(--muted); font-size: 14px; }

.page {
  width: min(1180px, calc(100vw - 32px));
  margin: 28px auto 56px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  padding: 28px 0;
}

.hero-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
}

.hero-action-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
}

.search-form {
  display: flex;
  gap: 8px;
  width: 360px;
}

.search-form input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
}

.search-form input:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(31, 111, 235, 0.12);
}

.search-form button {
  height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

h1 { margin: 0 0 10px; font-size: clamp(32px, 4vw, 56px); line-height: 1.02; }
h2 { margin: 0 0 14px; font-size: 20px; }
h3 { margin: 20px 0 8px; font-size: 15px; color: var(--muted); }
p { margin: 0; color: var(--muted); line-height: 1.6; }

.crumb-title {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: baseline;
  font-size: clamp(24px, 3vw, 40px);
  line-height: 1.12;
}

.crumb-title a {
  color: var(--accent);
}

.crumb-title span {
  color: var(--muted);
}

.crumb-title strong {
  color: var(--text);
}

.hero-date {
  color: var(--muted);
  font-size: 22px;
  font-weight: 700;
}

.button {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 16px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  white-space: nowrap;
}

.market-tabs {
  display: inline-flex;
  gap: 4px;
  margin: 0 0 22px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.hero-market-tabs { margin: 0; }

.market-tabs a {
  min-width: 96px;
  padding: 10px 18px;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.market-tabs a.active {
  background: var(--accent);
  color: white;
}

.sub-tabs {
  display: inline-flex;
  gap: 4px;
  margin: 0 0 22px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.sub-tabs a {
  min-width: 96px;
  padding: 10px 18px;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.sub-tabs a.active {
  background: var(--accent);
  color: white;
}

.grid {
  display: grid;
  gap: 24px;
  margin-top: 24px;
}

.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.market-first { margin-top: 4px; }

.market-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.market-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 14px;
}

.market-head > div { min-width: 0; }
.market-head h2 { margin: 0; font-size: 26px; }
.market-head strong { color: var(--accent); font-size: 22px; }
.market-panel .list { border: 0; border-top: 1px solid var(--line); border-radius: 0; }

.panel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.sort-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.sort-tabs a {
  min-width: 56px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  font-weight: 700;
  text-align: center;
}

.sort-tabs a.active {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.search-note {
  margin-top: 8px;
  font-size: 13px;
}

.search-note a { color: var(--accent); font-weight: 700; }

.list {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-top: 1px solid var(--line);
}

.row:first-child { border-top: 0; }
.compact .row { padding: 12px 14px; }
.row:hover { background: #f1f5fb; }
.row span { min-width: 0; }
.row strong { display: block; overflow-wrap: anywhere; }
.ticker-code { color: #d92d20; }
.company-name-zh { font-weight: 700; }
.quote-up { color: #d92d20; font-weight: 700; }
.quote-down { color: #039855; font-weight: 700; }
.row small { display: block; margin-top: 6px; color: var(--muted); line-height: 1.4; }
.row em { color: var(--muted); font-style: normal; white-space: nowrap; }
.row em.quote-up { color: #d92d20; }
.row em.quote-down { color: #039855; }
.news-list {
  display: grid;
  gap: 0;
}

.news-row {
  align-items: flex-start;
  padding: 18px 18px 16px;
}

.news-row:hover {
  background: #f8fbff;
}

.news-body {
  display: grid;
  gap: 8px;
}

.news-title {
  font-size: 16px;
  line-height: 1.45;
}

.news-summary {
  max-width: 980px;
  margin-top: 0;
  color: #475467;
  line-height: 1.65;
}

.news-summary time {
  margin-right: 8px;
  color: var(--muted);
  font-weight: 700;
}

.news-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 0;
}

.news-meta span {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: #475467;
  font-size: 12px;
  line-height: 1.2;
}

.news-meta span.news-company-tag {
  border-color: rgba(31, 111, 235, 0.22);
  background: #eef4ff;
  color: var(--accent);
  font-weight: 800;
}

.news-score {
  min-width: 64px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--accent);
  text-align: center;
  font-weight: 800;
}

.pagination-tabs {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding: 14px 18px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.pagination-tabs a,
.pagination-tabs span {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  font-weight: 700;
}

.pagination-tabs a {
  color: var(--accent);
}

.macro-signal {
  display: grid;
  gap: 18px;
  padding: 18px;
  border-top: 1px solid var(--line);
}

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

.macro-summary div,
.macro-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 14px;
}

.macro-summary span,
.macro-card small {
  display: block;
  color: var(--muted);
  line-height: 1.5;
}

.macro-summary strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
}

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

.mood-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.macro-card strong {
  display: block;
  margin-bottom: 6px;
}

.macro-tags {
  margin-top: 0;
}
.quote-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
}
.quote-stack small { color: var(--muted); font-size: 13px; }

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 280px);
  gap: 24px;
  align-items: start;
}

.detail-main,
.detail-side {
  display: grid;
  gap: 24px;
  min-width: 0;
}

.detail-grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.detail-section {
  margin-top: 24px;
}

.detail-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
  min-width: 0;
}

.detail-panel h2 {
  margin: 0 0 12px;
}

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

.detail-panel-head small,
.history-range {
  color: var(--muted);
  font-size: 13px;
}

.detail-copy {
  color: var(--text);
  line-height: 1.7;
}

.side-info-table {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.side-info-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.5;
}

.side-info-row:first-child { border-top: 0; }

.side-info-row > span {
  color: var(--muted);
  font-weight: 700;
}

.side-info-row strong {
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.side-info-row em {
  font-style: normal;
}

.side-info-row-stack {
  grid-template-columns: 1fr;
}

.side-info-link {
  display: block;
  color: var(--text);
}

.side-info-link + .side-info-link {
  margin-top: 10px;
}

.side-info-link small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.history-scroll {
  max-width: 100%;
  overflow-x: visible;
}

.history-scroll-inner {
  width: 100%;
}

.history-chart-card {
  display: grid;
  grid-template-columns: var(--history-grid-columns);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  padding: 12px;
}

.history-plot {
  grid-column: 2 / -1;
  min-width: 0;
}

.history-range {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.history-chart {
  width: 100%;
  height: 220px;
  display: block;
}

.history-axis {
  display: grid;
  grid-template-columns: var(--history-date-columns);
  gap: 0;
  margin-top: 10px;
}

.history-axis span {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.history-chart-bg {
  fill: #f8fbff;
}

.history-chart-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.history-chart-dot {
  fill: var(--accent);
  stroke: white;
  stroke-width: 2;
}

.history-matrix {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.history-matrix-row {
  display: grid;
  grid-template-columns: var(--history-grid-columns);
  font-size: 14px;
}

.history-matrix-row + .history-matrix-row {
  border-top: 1px solid var(--line);
}

.history-matrix-head,
.history-matrix-cell {
  min-width: 0;
  padding: 10px 6px;
  text-align: center;
  white-space: nowrap;
}

.history-matrix-head {
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  z-index: 1;
}

.empty { padding: 16px; }

@media (max-width: 760px) {
  .topbar { padding: 14px 16px; }
  .hero { display: block; }
  .hero-actions { margin-top: 18px; }
  .hero-action-row { justify-content: flex-start; flex-wrap: wrap; }
  .search-form { width: 100%; }
  .button { margin-top: 18px; }
  .hero-actions .button { margin-top: 0; }
  .grid.two { grid-template-columns: 1fr; }
  .grid.three { grid-template-columns: 1fr; }
  .grid.four { grid-template-columns: 1fr; }
  .macro-summary,
  .macro-grid { grid-template-columns: 1fr; }
  .row { align-items: flex-start; }
  .panel-head { display: block; }
  .detail-layout,
  .detail-grid-two { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .detail-layout { grid-template-columns: 1fr; }
}
