:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
  background: #ffffff;
  color: #2b140d;
  --text: #2b140d;
  --muted: #7a5a4a;
  --line: #f0d8ca;
  --surface: #fffefe;
  --surface-warm: #fff8f3;
  --orange: #f97316;
  --red: #ef4444;
  --deep-red: #b91c1c;
  --brown: #3a170d;
  --good: #15803d;
  --bad: #d92d20;
  --shadow: 0 18px 42px rgba(124, 45, 18, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #ffffff;
}

.page {
  width: min(1280px, calc(100% - 80px));
  margin: 0 auto;
  padding: 68px 0 68px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 25px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  color: var(--text);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.25;
}

.subtitle {
  margin-top: 10px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 198px);
  gap: 15px;
  margin-bottom: 22px;
}

.kpi-card,
.panel,
.product-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.kpi-card {
  min-height: 126px;
  padding: 18px 18px 16px;
}

.kpi-label {
  display: block;
  color: #6b4d43;
  font-size: 13px;
  font-weight: 600;
}

.kpi-value {
  display: block;
  margin-top: 12px;
  color: var(--text);
  font-size: 27px;
  font-weight: 800;
  line-height: 1.05;
  word-break: keep-all;
}

.kpi-note,
.kpi-trend {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-top: 13px;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  background: #fff1e7;
}

.kpi-note {
  color: #7c2d12;
}

.kpi-trend.good {
  color: var(--good);
  background: #edf8ef;
}

.kpi-trend.bad {
  color: var(--bad);
  background: #fff0ed;
}

.kpi-trend.neutral {
  color: #7c2d12;
  background: #fff1e7;
}

.charts {
  display: grid;
  grid-template-columns: 470px 773px;
  gap: 20px;
  margin-bottom: 24px;
}

.panel {
  min-height: 294px;
  padding: 0;
}

.panel-header {
  margin: 0;
}

.panel-header h2,
.product-card h2 {
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
}

.donut-layout {
  display: block;
  min-height: 0;
}

.donut-panel {
  position: relative;
  height: 294px;
}

.donut-panel .panel-header {
  position: absolute;
  top: 20px;
  left: 20px;
}

.donut-chart {
  position: absolute;
  top: 67px;
  left: 46px;
  width: 193px;
  height: 193px;
}

.donut-chart svg,
.roi-chart svg {
  display: block;
}

.donut-chart svg {
  width: 193px;
  height: 193px;
}

.donut-segment {
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

.donut-total-label {
  fill: #8a5a44;
  font-size: 2.4px;
  font-weight: 600;
}

.donut-total-value {
  fill: #9a3412;
  font-size: 4.2px;
  font-weight: 800;
}

.legend {
  display: grid;
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.legend li {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 7px 14px;
  align-items: start;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.legend-name {
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.legend-value {
  grid-column: 2;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.donut-panel .legend {
  position: absolute;
  top: 85px;
  left: 277px;
  width: 150px;
}

.roi-chart {
  position: absolute;
  inset: 0;
  min-height: 0;
}

.roi-panel {
  position: relative;
  height: 294px;
}

.roi-panel .panel-header {
  position: absolute;
  top: 18px;
  left: 20px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  margin: 0;
  color: #6b4d43;
  font-size: 12px;
  font-weight: 700;
}

.chart-legend:not(.average-legend) {
  position: absolute;
  top: 22px;
  left: 286px;
  gap: 138px;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-legend:not(.average-legend) span {
  background: transparent;
  padding: 0;
}

.average-legend span {
  border-radius: 999px;
  border: 1px solid #f4d8c7;
  background: #fff8f3;
  min-height: 24px;
  padding: 4px 11px;
  line-height: 1.2;
  white-space: nowrap;
}

.average-legend .roi-baseline {
  color: var(--orange);
}

.average-legend .roi-after-baseline {
  color: #9a3412;
}

.chart-legend i {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.average-legend {
  position: absolute;
  top: 17px;
  left: 348px;
  gap: 110px;
}

.average-legend i {
  width: 20px;
  height: 0;
  border-top: 2px dashed var(--line-color);
  border-radius: 0;
}

.roi-chart svg {
  position: absolute;
  inset: 0;
  width: 773px;
  height: 294px;
}

.bar-value,
.axis-label,
.axis-tick,
.line-label {
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
}

.bar-value {
  fill: #3f2a20;
  font-size: 12px;
  font-weight: 800;
}

.axis-label {
  fill: #5b4032;
  font-size: 13px;
  font-weight: 700;
}

.axis-tick {
  fill: #8a5a44;
  font-size: 11px;
  font-weight: 600;
}

.line-label {
  fill: #9a3412;
  font-size: 11px;
  font-weight: 800;
}

.line-label.after {
  fill: #5a2416;
}

.product-grid {
  display: grid;
  grid-template-columns: 400px 400px 403px;
  gap: 30px;
}

.product-card {
  position: relative;
  display: flex;
  min-height: 267px;
  flex-direction: column;
  overflow: hidden;
  padding: 20px;
}

.product-accent {
  position: absolute;
  top: 14px;
  left: 20px;
  width: 4px;
  height: 44px;
  border-radius: 999px;
  background: var(--accent);
}

.product-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 1px 10px 25px 14px;
}

.product-card-header span {
  flex: 0 0 auto;
  color: #8a5a44;
  font-size: 12px;
  font-weight: 600;
}

.product-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px 15px;
  margin: 0;
}

.product-metrics div {
  grid-column: span 2;
  height: 52px;
  border: 1px solid #f2d6c8;
  border-radius: 7px;
  background: var(--surface-warm);
  padding: 7px 10px;
}

.product-metrics .metric-wide {
  grid-column: span 3;
  height: 62px;
  padding: 10px 12px;
}

.product-metrics dt {
  color: #8a5a44;
  font-size: 12px;
  font-weight: 600;
}

.product-metrics dd {
  margin: 6px 0 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.1;
}

.detail-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  margin: 14px 0 0;
  border-radius: 7px;
  background: var(--brown);
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  transition: background-color 180ms ease, transform 180ms ease;
}

.detail-link:hover,
.detail-link:focus-visible {
  background: #5a2416;
  outline: 2px solid #fdba74;
  outline-offset: 2px;
  transform: translateY(-1px);
}

.unavailable {
  color: var(--muted);
}

.empty-state {
  display: grid;
  min-height: 220px;
  place-items: center;
  border: 1px dashed #f0b99f;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.empty-state.wide {
  grid-column: 1 / -1;
}

@media (max-width: 1120px) {
  .page {
    width: min(100% - 48px, 1040px);
  }

  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .charts {
    grid-template-columns: 1fr;
  }

  .product-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .page {
    width: min(100% - 28px, 520px);
    padding: 28px 0;
  }

  h1 {
    font-size: 26px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi-value {
    font-size: 22px;
  }

  .donut-layout {
    grid-template-columns: 1fr;
  }
}
