:root {
  color-scheme: light;
  --bg: #f3f7f8;
  --panel: #ffffff;
  --panel-2: #f8fbfc;
  --ink: #10201b;
  --muted: #64736d;
  --line: #dce7e4;
  --up: #dc2626;
  --down: #16a34a;
  --blue: #0ea5e9;
  --amber: #d97706;
  --shadow: 0 18px 45px rgba(18, 38, 32, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(14, 165, 233, 0.16), transparent 32%),
    linear-gradient(135deg, #f7fbfc 0%, #eef6f4 55%, #f6faf7 100%);
  color: var(--ink);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 28px clamp(18px, 4vw, 48px) 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.05;
}

main,
footer {
  width: min(1500px, calc(100% - 32px));
  margin: 0 auto;
}

.refresh-button,
.edit-data-link,
.tab {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.refresh-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.edit-data-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 8px;
  background: #e0f2fe;
  color: #0369a1;
  font-weight: 900;
  text-decoration: none;
  box-shadow: var(--shadow);
}

.refresh-button:disabled { cursor: progress; opacity: 0.65; }

.hero-dashboard {
  display: grid;
  grid-template-columns: 1.35fr repeat(3, 1fr);
  gap: 12px;
}

.hero-metric,
.trend-panel,
.status-band,
.market-card,
.table-wrap,
.recommendations {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.hero-metric {
  min-height: 124px;
  padding: 18px;
}

.hero-metric.primary {
  grid-row: span 2;
  min-height: 260px;
  background: linear-gradient(150deg, rgba(14, 165, 233, 0.14), rgba(255, 255, 255, 0.98));
}

.hero-metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}

.hero-metric .metric-note {
  margin: 8px 0 0;
  font-size: 12px;
}

.hero-metric strong {
  display: block;
  font-size: clamp(22px, 3vw, 38px);
  line-height: 1.05;
  word-break: break-word;
}

.hero-metric.primary strong { font-size: clamp(42px, 6vw, 72px); }

.hero-metric small {
  display: inline-block;
  margin-top: 10px;
  font-size: 16px;
  font-weight: 900;
}

.positive { color: var(--up); }
.negative { color: var(--down); }
.neutral { color: var(--muted); }

.trend-panel,
.recommendations {
  margin-top: 14px;
  padding: 20px;
}

.section-heading,
.chart-meta,
.market-card-head,
.market-money,
.recommend-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-heading {
  align-items: end;
  margin-bottom: 14px;
}

.section-heading h2 {
  margin: 0;
  font-size: 24px;
}

.section-heading > span,
.chart-meta span,
.market-card-head span:last-child {
  color: var(--muted);
  font-size: 13px;
}

.chart-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.intraday-card { margin-top: 12px; }
.chart-meta strong { font-size: 22px; }

.sparkline {
  position: relative;
  width: 100%;
  min-height: 120px;
}

.sparkline.large { min-height: 220px; margin-top: 12px; }
.sparkline.intraday { min-height: 160px; margin-top: 12px; }
.sparkline.compact { min-height: 150px; margin-top: 8px; }

.sparkline svg {
  display: block;
  width: 100%;
  height: calc(100% - 4px);
  min-height: inherit;
}

.candle-up line,
.candle-up rect {
  stroke: var(--up);
  fill: rgba(220, 38, 38, 0.72);
}

.candle-down line,
.candle-down rect {
  stroke: var(--down);
  fill: rgba(22, 163, 74, 0.72);
}

.trend-line {
  fill: none;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-up { stroke: var(--up); fill: var(--up); }
.chart-down { stroke: var(--down); fill: var(--down); }

.axis-grid {
  stroke: rgba(100, 115, 109, 0.2);
  stroke-width: 1;
}

.axis-line {
  stroke: rgba(100, 115, 109, 0.55);
  stroke-width: 1.2;
}

.zero-axis {
  stroke: #111827;
  stroke-width: 1.8;
  stroke-dasharray: 6 5;
}

.zero-axis.subtle {
  stroke: rgba(17, 24, 39, 0.45);
  stroke-width: 1.2;
}

.axis-label {
  fill: var(--muted);
  font-size: 12px;
}

.hour-label {
  font-size: 10px;
  text-anchor: middle;
}

.zero-label {
  fill: #111827;
  font-size: 12px;
  font-weight: 900;
}

.chart-empty {
  display: grid;
  min-height: 120px;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}

.status-band {
  margin-top: 14px;
  padding: 14px 16px;
  color: var(--muted);
  font-size: 14px;
}

.status-link {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  margin-left: 8px;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--blue);
  color: #ffffff;
  font-weight: 900;
  text-decoration: none;
}

.market-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 0;
}

.tab {
  min-width: 92px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 8px;
}

.tab.active {
  border-color: var(--blue);
  background: #e0f2fe;
  color: #0369a1;
  font-weight: 900;
}

.market-overview {
  display: block;
  margin: 14px 0;
}

.market-card { padding: 18px; }

.market-card.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 1px rgba(14, 165, 233, 0.2), var(--shadow);
}

.market-card > strong {
  display: block;
  margin-top: 12px;
  font-size: 32px;
  line-height: 1;
  word-break: break-word;
}

.market-card > small {
  display: inline-block;
  margin-top: 8px;
  font-size: 14px;
  font-weight: 900;
}

.market-money {
  align-items: flex-start;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.market-money strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 16px;
}

.market-today {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbfc;
}

.market-today span {
  color: var(--muted);
  font-size: 13px;
}

.market-today strong {
  font-size: 22px;
  text-align: right;
}

.market-today small {
  font-size: 14px;
  font-weight: 900;
}

.mini-title {
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  min-width: 1620px;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  font-size: 14px;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: #f7fbfc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  z-index: 1;
}

th:first-child,
td:first-child,
th:nth-child(2),
td:nth-child(2),
th:last-child,
td:last-child { text-align: left; }

td:last-child {
  width: 360px;
  color: var(--muted);
  line-height: 1.45;
}

.stock-name {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.stock-name strong { font-size: 15px; }
.stock-name span { color: var(--muted); font-size: 12px; }

.price-cell {
  display: inline-block;
  font-size: 18px;
  font-weight: 950;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 12px;
  font-weight: 900;
}

.action,
.conclusion {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  margin-right: 6px;
  margin-bottom: 6px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 950;
}

.action.buy,
.conclusion.up { background: rgba(220, 38, 38, 0.12); color: var(--up); }
.action.hold,
.conclusion.flat { background: rgba(14, 165, 233, 0.12); color: #0369a1; }
.action.stop,
.conclusion.down { background: rgba(22, 163, 74, 0.12); color: var(--down); }

.buy-zone,
.sell-zone {
  display: grid;
  gap: 4px;
  min-width: 150px;
}

.buy-zone strong,
.sell-zone strong { font-size: 15px; }

.buy-zone span,
.sell-zone span,
.advice-detail {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

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

.recommend-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel-2);
}

.recommend-card h3 {
  margin: 14px 0 4px;
  font-size: 20px;
}

.recommend-code,
.recommend-card dd {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.recommend-code { margin: 0; }

.recommend-price {
  margin: 14px 0;
  font-size: 26px;
  font-weight: 950;
}

.heat {
  color: var(--amber);
  font-size: 13px;
  font-weight: 950;
}

.recommend-card dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.recommend-card dt {
  color: var(--ink);
  font-size: 12px;
  font-weight: 950;
}

.recommend-card dd { margin: 3px 0 0; }

footer {
  margin: 18px auto 30px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

@media (max-width: 920px) {
  .topbar,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-dashboard,
  .recommend-grid {
    grid-template-columns: 1fr;
  }

  .hero-metric.primary {
    grid-row: auto;
    min-height: 190px;
  }

  .market-money {
    flex-direction: column;
  }
}

@media (min-width: 921px) and (max-width: 1180px) {
  .hero-dashboard,
  .recommend-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
