:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #151922;
  --muted: #68707d;
  --line: #dfe3e8;
  --soft: #eef2f5;
  --teal: #117c75;
  --teal-soft: #dff3f0;
  --blue: #2358a5;
  --orange: #b66216;
  --red: #b42318;
  --green: #087443;
  --gray-chip: #e8eaed;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  letter-spacing: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 22px 32px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}

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

h1 {
  font-size: 24px;
  line-height: 1.2;
  font-weight: 720;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
  font-weight: 700;
}

h3 {
  font-size: 14px;
  line-height: 1.35;
  font-weight: 700;
}

.eyebrow,
.section-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 700;
}

.asof {
  min-width: 168px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.asof span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.asof strong {
  display: block;
  font-size: 16px;
  margin-top: 2px;
}

main {
  width: min(1480px, calc(100% - 40px));
  margin: 20px auto 40px;
}

.demo-hero,
.panel,
.kpi-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.demo-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 22px;
}

.demo-hero p {
  margin-top: 8px;
  color: #344054;
  line-height: 1.65;
  max-width: 1120px;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(118px, 1fr));
  gap: 8px;
  min-width: 420px;
}

.hero-metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 12px;
}

.hero-metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.hero-metric strong {
  display: block;
  margin-top: 7px;
  font-size: 20px;
  line-height: 1.15;
  white-space: nowrap;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.kpi-card {
  padding: 14px;
  min-height: 104px;
}

.kpi-card .label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.kpi-card .value {
  font-size: 24px;
  font-weight: 760;
  margin-top: 10px;
  white-space: nowrap;
}

.kpi-card .note {
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
}

.positive {
  color: var(--green);
}

.negative {
  color: var(--red);
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 14px;
  margin-bottom: 14px;
}

.panel {
  padding: 18px;
  margin-bottom: 14px;
}

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

.panel-head.split {
  align-items: center;
}

.rule-list {
  padding-left: 20px;
  margin: 0;
  color: #29313d;
  line-height: 1.62;
  font-size: 14px;
}

.rule-list li + li {
  margin-top: 4px;
}

.position-group + .position-group {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

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

.position-table th,
.position-table td,
table th,
table td {
  text-align: left;
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.position-table th,
table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  background: #fbfcfd;
}

.table-wrap {
  overflow: auto;
}

.subsection-head {
  margin: 18px 0 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 760px;
}

.chart-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.chart-title {
  color: #29313d;
  font-size: 13px;
  font-weight: 700;
  margin: 2px 0 8px;
}

.chart {
  height: 310px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  overflow: hidden;
}

.chart.is-history {
  height: 460px;
}

.chart.is-forward {
  height: 280px;
}

.chart svg {
  display: block;
  width: 100%;
  height: 100%;
}

.axis text {
  fill: var(--muted);
  font-size: 11px;
}

.axis line,
.grid line {
  stroke: #d8dde3;
  stroke-width: 1;
}

.crosshair line {
  stroke: #475467;
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.crosshair-dot {
  fill: #ffffff;
  stroke: #117c75;
  stroke-width: 2;
}

.chart-tip rect {
  fill: #ffffff;
  stroke: #cfd6dd;
  filter: drop-shadow(0 4px 8px rgba(16, 24, 40, 0.14));
}

.chart-tip text {
  fill: #1f2937;
  font-size: 12px;
  font-weight: 700;
}

.chart-hitbox {
  cursor: crosshair;
}

.wave-visual-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(380px, 0.85fr);
  gap: 16px;
  margin-bottom: 16px;
}

.wave-map,
.wave-dist {
  height: 390px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  overflow: hidden;
}

.wave-map svg,
.wave-dist svg {
  display: block;
  width: 100%;
  height: 100%;
}

.wave-bands rect {
  fill: #ffffff;
}

.wave-bands rect:nth-of-type(even) {
  fill: #f4f6f8;
}

.wave-bands text {
  fill: #344054;
  font-size: 12px;
  font-weight: 760;
}

.wave-lines polyline {
  stroke: #9aa3ae;
  stroke-width: 1.1;
  stroke-opacity: 0.28;
}

.wave-points circle {
  cursor: crosshair;
}

.extreme-ring {
  fill: none;
  stroke: #151922;
  stroke-width: 1.2;
  stroke-dasharray: 2 3;
}

.forward-line {
  stroke: #2358a5;
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
  stroke-opacity: 0.8;
}

.zero-line {
  stroke: #151922;
  stroke-width: 1.2;
  stroke-opacity: 0.55;
}

.dist-boxes line {
  stroke: #475467;
  stroke-width: 1.4;
  stroke-opacity: 0.72;
}

.dist-boxes rect {
  fill: #e9edf3;
  stroke: #697386;
  stroke-width: 1;
}

.dist-boxes .median {
  stroke: #151922;
  stroke-width: 2;
}

.wave-tip rect {
  fill: #ffffff;
  stroke: #cfd6dd;
  filter: drop-shadow(0 4px 8px rgba(16, 24, 40, 0.14));
}

.wave-tip text {
  fill: #1f2937;
  font-size: 12px;
  font-weight: 700;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.segmented button,
.list-actions button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: #2f3845;
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 13px;
  cursor: pointer;
}

.segmented button.active {
  background: var(--teal);
  border-color: var(--teal);
  color: #ffffff;
}

.signal-list {
  display: grid;
  gap: 10px;
}

.signal-day {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

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

.signal-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.date {
  font-weight: 760;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 760;
  white-space: nowrap;
}

.tag.d1 {
  color: #0b5c56;
  background: var(--teal-soft);
}

.tag.d2 {
  color: #244f8f;
  background: #e3ecfb;
}

.tag.d3 {
  color: #865007;
  background: #fff0d6;
}

.tag.d4 {
  color: #5f6670;
  background: #edf0f2;
}

.tag.opened {
  color: #08633b;
  background: #dcf4e9;
}

.tag.blocked,
.tag.pre_live {
  color: #5e6570;
  background: #eef0f2;
}

.stock-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 8px;
}

.stock {
  min-height: 84px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  background: #ffffff;
}

.stock.blocked,
.stock.pre_live {
  background: #f2f3f5;
  color: #6b7280;
}

.stock.opened {
  border-color: #9dd8c4;
  background: #f4fbf8;
}

.stock-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 730;
}

.stock-code {
  color: var(--muted);
  font-weight: 650;
  font-size: 12px;
}

.stock-bottom {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 9px;
  font-size: 11px;
  color: var(--muted);
}

.stock-bottom strong {
  display: block;
  color: #29313d;
  font-size: 12px;
  margin-top: 2px;
}

.empty {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 16px;
}

.list-actions {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}

@media (max-width: 1180px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .two-col,
  .demo-hero,
  .chart-grid,
  .wave-visual-grid {
    grid-template-columns: 1fr;
  }

  .hero-metrics {
    min-width: 0;
  }
}

@media (max-width: 720px) {
  .topbar {
    position: static;
    flex-direction: column;
    align-items: stretch;
    padding: 18px;
  }

  main {
    width: min(calc(100% - 20px), 1480px);
    margin-top: 10px;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .panel-head,
  .panel-head.split,
  .signal-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .segmented {
    justify-content: flex-start;
  }

  .chart {
    height: 260px;
  }

  .wave-map,
  .wave-dist {
    height: 330px;
  }

  .hero-metrics {
    grid-template-columns: 1fr;
  }
}
