:root {
  color-scheme: light;
  --page: #f5f7f6;
  --surface: #ffffff;
  --surface-soft: #eef2f0;
  --surface-hover: #e9efec;
  --text: #18201c;
  --muted: #637069;
  --border: #d7dfda;
  --border-strong: #bfcac4;
  --positive: #087a50;
  --positive-soft: #e0f3e9;
  --negative: #c83f34;
  --negative-soft: #fae7e4;
  --paper: #9b641b;
  --paper-soft: #faefd9;
  --focus: #216b8b;
  --series-1: #087a50;
  --series-2: #277aa5;
  --series-3: #a46718;
  --series-4: #76579b;
  --series-5: #cb493d;
  --series-6: #4b746b;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: var(--page); }
body { margin: 0; min-width: 320px; background: var(--page); color: var(--text); }
button, input { font: inherit; line-height: 1.25; letter-spacing: 0; }
button:focus-visible, input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 32%, transparent);
  outline-offset: 2px;
}

.shell {
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: 26px 32px 34px;
}

.topbar {
  min-height: 112px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  padding: 2px 0 24px;
  border-bottom: 1px solid var(--border-strong);
}

.brand-block { min-width: 0; }
.product-row, .system-line, .header-controls, .section-heading, .segmented,
.chart-legend, .event-topline, .campaign-meta, footer {
  display: flex;
  align-items: center;
}

.product-row { gap: 9px; }
.product-name { color: var(--muted); font-size: 13px; font-weight: 500; }
.scope-badge, .status-badge, .stage-badge {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
}
.scope-badge { color: #744a0e; background: var(--paper-soft); }

h1, h2, h3, p { margin: 0; }
h1 {
  margin: 5px 0 7px;
  font-size: 27px;
  line-height: 1.28;
  font-weight: 500;
}
h2 { font-size: 18px; line-height: 1.35; font-weight: 500; }
h3 { font-size: 16px; line-height: 1.35; font-weight: 500; }

.system-line {
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--positive);
  flex: 0 0 auto;
}
.system-separator { width: 1px; height: 13px; background: var(--border-strong); }

.header-controls {
  flex: 0 0 auto;
  align-items: flex-end;
  gap: 9px;
}
.date-field {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}
.date-field > span { white-space: nowrap; }
input[type="date"], button {
  min-height: 40px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}
input[type="date"] { min-width: 150px; padding: 8px 10px; }
button { padding: 8px 14px; cursor: pointer; }
button:hover { background: var(--surface-soft); }
button:disabled { cursor: wait; opacity: 0.6; }

.rankings-section {
  margin-top: 22px;
  border-top: 1px solid var(--border-strong);
  border-bottom: 1px solid var(--border-strong);
  background: var(--surface);
}
.rankings-heading,
.ranking-column-heading,
.ranking-name-row,
.overview-strip,
.overview-item {
  display: flex;
  align-items: center;
}
.rankings-heading {
  justify-content: space-between;
  gap: 20px;
  padding: 17px 20px;
}
.rankings-heading p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}
.ranking-date {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.ranking-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--border);
}
.ranking-column {
  min-width: 0;
  padding: 18px 20px 8px;
}
.ranking-column + .ranking-column { border-left: 1px solid var(--border); }
.ranking-column-heading {
  justify-content: space-between;
  gap: 16px;
  min-height: 41px;
  margin-bottom: 5px;
}
.ranking-kicker {
  display: block;
  margin-bottom: 2px;
  color: var(--positive);
  font-size: 11px;
  font-weight: 600;
}
.ranking-basis {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
}
.ranking-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.ranking-item {
  min-width: 0;
  min-height: 86px;
  display: grid;
  grid-template-columns: 27px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.ranking-item:last-child { border-bottom: 0; }
.ranking-index {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.ranking-item:first-child .ranking-index {
  border-color: var(--positive);
  color: var(--positive);
  background: var(--positive-soft);
}
.ranking-identity { min-width: 0; }
.ranking-name-row {
  min-width: 0;
  flex-wrap: wrap;
  gap: 5px 8px;
}
.ranking-name {
  min-width: 0;
  font-size: 13px;
  font-weight: 500;
  overflow-wrap: anywhere;
}
.signal-status {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}
.signal-status.real { color: var(--positive); background: var(--positive-soft); }
.signal-status.paper,
.signal-status.monitor { color: var(--paper); background: var(--paper-soft); }
.signal-status.idle { color: var(--muted); background: var(--surface-soft); }
.ranking-signal {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.ranking-metric {
  min-width: 105px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}
.ranking-metric strong {
  font-size: 18px;
  line-height: 1.25;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.ranking-metric span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
.ranking-empty {
  min-height: 86px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}
.overview-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--border);
  background: var(--surface-soft);
}
.overview-item {
  justify-content: center;
  gap: 5px;
  min-width: 0;
  min-height: 42px;
  border-right: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.overview-item:last-child { border-right: 0; }
.overview-item strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.positive { color: var(--positive); }
.negative { color: var(--negative); }
.paper-value { color: var(--paper); }

.section-block {
  min-width: 0;
  padding: 30px 0;
  border-top: 1px solid var(--border);
}
.chart-section { border-top: 0; }
.section-heading {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}
.section-heading p { margin-top: 4px; color: var(--muted); font-size: 13px; }
.segmented {
  flex: 0 0 auto;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-soft);
}
.segment {
  min-height: 32px;
  padding: 4px 11px;
  border: 0;
  background: transparent;
  font-size: 13px;
}
.segment.is-active { background: var(--text); color: var(--surface); }

.chart { position: relative; width: 100%; min-height: 340px; }
.chart svg { display: block; width: 100%; height: 340px; overflow: visible; }
.chart-plot-background { fill: color-mix(in srgb, var(--surface) 72%, transparent); }
.chart-grid, .chart-axis {
  stroke: var(--border);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.chart-zero {
  stroke: color-mix(in srgb, var(--muted) 58%, transparent);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.chart-line {
  fill: none;
  stroke-width: 2.2;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.chart-dot { stroke: var(--surface); stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart-label-link { stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-label { fill: var(--muted); font-size: 12px; }
.chart-end-label { fill: var(--text); font-size: 12px; font-weight: 500; }
.chart-hover-line {
  stroke: var(--border-strong);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}
.chart-hover-dot {
  stroke: var(--surface);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}
.chart-overlay { fill: transparent; pointer-events: all; cursor: crosshair; touch-action: pan-y; }
.chart-tooltip {
  position: absolute;
  z-index: 2;
  width: min(300px, calc(100% - 16px));
  padding: 11px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 10px 28px color-mix(in srgb, var(--text) 13%, transparent);
  pointer-events: none;
}
.chart-tooltip-time {
  margin-bottom: 7px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}
.chart-tooltip-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 25px;
  font-size: 12px;
}
.chart-tooltip-label {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.chart-tooltip-swatch { width: 9px; height: 9px; border-radius: 2px; flex: 0 0 auto; }
.chart-detail {
  min-height: 23px;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.chart-empty, .empty-state {
  min-height: 190px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 14px;
}
.chart-legend {
  min-height: 28px;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 31px;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}
.legend-item:hover { border-color: var(--border); background: var(--surface-soft); }
.legend-item[aria-pressed="true"] { color: var(--text); }
.legend-item.is-hidden { opacity: 0.45; }
.legend-line { width: 20px; height: 3px; border-radius: 2px; }

.strategy-table-wrap {
  width: 100%;
  border-top: 1px solid var(--border-strong);
  border-bottom: 1px solid var(--border-strong);
}
.strategy-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.strategy-table th, .strategy-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  vertical-align: middle;
  font-size: 13px;
  line-height: 1.4;
}
.strategy-table tr:last-child td { border-bottom: 0; }
.strategy-table th {
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 400;
}
.strategy-table tbody tr:hover { background: var(--surface-hover); }
.strategy-table th:first-child, .strategy-table td:first-child,
.strategy-table th:last-child, .strategy-table td:last-child { text-align: left; }
.strategy-table th:first-child { width: 24%; }
.strategy-table th:last-child { width: 9%; }
.strategy-name { display: block; font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.strategy-runtime {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.status-badge.online { color: var(--positive); background: var(--positive-soft); }
.status-badge.monitor { color: var(--paper); background: var(--paper-soft); }
.status-badge.offline { color: var(--muted); background: var(--surface-soft); }

.lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 42px;
}
.campaign-list, .event-list { display: grid; gap: 0; }
.campaign-item, .event-item {
  min-width: 0;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.campaign-title, .event-title { font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.campaign-meta {
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}
.stage-badge { color: #744a0e; background: var(--paper-soft); }
.stage-badge.real { color: var(--positive); background: var(--positive-soft); }
.event-topline { justify-content: space-between; gap: 14px; }
.event-time, .event-detail { color: var(--muted); font-size: 12px; }
.event-detail { margin-top: 5px; }
.event-net { white-space: nowrap; font-weight: 500; }

.history-section { padding-bottom: 26px; }
.history-count {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.today-history-list { border-top: 1px solid var(--border-strong); }
.history-strategy { border-bottom: 1px solid var(--border); }
.history-strategy > summary {
  padding: 17px 4px;
  cursor: pointer;
}
.history-strategy > summary::marker { color: var(--muted); }
.history-strategy[open] > summary { border-bottom: 1px solid var(--border); }
.history-summary-layout {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  margin-left: 7px;
}
.history-identity { min-width: 0; }
.history-name-row {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}
.history-name {
  font-size: 14px;
  font-weight: 500;
  overflow-wrap: anywhere;
}
.history-trigger {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}
.history-trigger.actual { color: var(--positive); background: var(--positive-soft); }
.history-trigger.paper { color: var(--paper); background: var(--paper-soft); }
.history-trigger-time {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}
.history-current {
  display: grid;
  grid-template-columns: auto auto;
  gap: 2px 12px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.history-current span { color: var(--muted); font-size: 11px; }
.history-current strong { font-size: 14px; font-weight: 600; }
.history-body { padding: 0 4px 20px 24px; }
.history-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border-bottom: 1px solid var(--border);
}
.history-stat {
  min-width: 0;
  padding: 14px 12px 14px 0;
}
.history-stat span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}
.history-stat strong {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.history-event-list {
  max-height: 430px;
  overflow: auto;
  scrollbar-gutter: stable;
}
.history-event {
  display: grid;
  grid-template-columns: 125px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 48px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.history-event:last-child { border-bottom: 0; }
.history-event-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.history-event-detail { min-width: 0; overflow-wrap: anywhere; }
.history-event-net { white-space: nowrap; font-weight: 500; }
.history-empty {
  min-height: 112px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

footer {
  justify-content: space-between;
  gap: 18px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 980px) {
  .shell { padding-inline: 20px; }
  .lower-grid { grid-template-columns: 1fr; gap: 0; }
  .strategy-table th:nth-child(3), .strategy-table td:nth-child(3),
  .strategy-table th:nth-child(5), .strategy-table td:nth-child(5),
  .strategy-table th:nth-child(8), .strategy-table td:nth-child(8) { display: none; }
}

@media (max-width: 1120px) {
  .ranking-grid { grid-template-columns: 1fr; }
  .ranking-column + .ranking-column {
    border-top: 1px solid var(--border);
    border-left: 0;
  }
}

@media (max-width: 700px) {
  .shell { padding: 18px 14px 26px; }
  .topbar { min-height: 0; align-items: stretch; flex-direction: column; gap: 18px; padding-bottom: 20px; }
  h1 { font-size: 24px; }
  .system-separator { display: none; }
  .system-line { row-gap: 3px; }
  .header-controls { width: 100%; }
  .date-field { flex: 1; }
  input[type="date"] { width: 100%; min-width: 0; }
  .rankings-section { margin-top: 16px; }
  .rankings-heading { align-items: flex-start; padding: 15px 16px; }
  .ranking-column { padding: 16px 16px 7px; }
  .ranking-column-heading { align-items: flex-start; }
  .overview-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-item:nth-child(2) { border-right: 0; }
  .overview-item:nth-child(-n + 2) { border-bottom: 1px solid var(--border); }
  .section-block { padding-block: 25px; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
  .history-count { align-self: flex-start; }
  .chart { min-height: 275px; }
  .chart svg { height: 275px; }
  .strategy-table-wrap { border-top: 0; }
  .strategy-table, .strategy-table tbody, .strategy-table tr, .strategy-table td {
    display: block;
    width: 100%;
  }
  .strategy-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .strategy-table tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
  }
  .strategy-table td, .strategy-table td:first-child, .strategy-table td:last-child {
    padding: 0;
    border: 0;
    text-align: left;
  }
  .strategy-table td:first-child, .strategy-table td:last-child { grid-column: 1 / -1; }
  .strategy-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 11px;
  }
  .strategy-table td:first-child::before, .strategy-table td:last-child::before { display: none; }
  .strategy-table td:nth-child(3), .strategy-table td:nth-child(5),
  .strategy-table td:nth-child(8) { display: block; }
  .history-summary-layout { grid-template-columns: 1fr; gap: 10px; }
  .history-current { justify-self: start; text-align: left; }
  .history-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .history-event { grid-template-columns: 1fr auto; gap: 4px 12px; }
  .history-event-detail { grid-column: 1 / -1; grid-row: 2; }
  .history-event-net { grid-column: 2; grid-row: 1; }
  footer { align-items: flex-start; flex-direction: column; gap: 5px; }
}

@media (max-width: 480px) {
  .ranking-item {
    grid-template-columns: 25px minmax(0, 1fr);
    align-items: start;
  }
  .ranking-index { margin-top: 1px; }
  .ranking-metric {
    grid-column: 2;
    min-width: 0;
    align-items: baseline;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 2px 8px;
    text-align: left;
  }
  .ranking-metric span { margin-top: 0; white-space: normal; }
  .ranking-basis { max-width: 92px; text-align: right; white-space: normal; }
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #111714;
    --surface: #18201c;
    --surface-soft: #202a25;
    --surface-hover: #24312b;
    --text: #edf3ef;
    --muted: #a5b1aa;
    --border: #34413a;
    --border-strong: #4a5951;
    --positive: #55ca94;
    --positive-soft: #173c2b;
    --negative: #f18477;
    --negative-soft: #472723;
    --paper: #e8b565;
    --paper-soft: #45351d;
    --focus: #68b5df;
    --series-1: #55ca94;
    --series-2: #6db4df;
    --series-3: #e8b565;
    --series-4: #c69bd7;
    --series-5: #f18477;
    --series-6: #84b8ac;
  }
}

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