:root {
  color-scheme: light;
  --page: #f4f6f3;
  --panel: #ffffff;
  --ink: #17211f;
  --muted: #65716c;
  --line: #d9e1dd;
  --teal: #007c72;
  --teal-soft: #d8eeea;
  --coral: #c84d35;
  --amber: #bd7a18;
  --shadow: 0 18px 45px rgba(30, 43, 39, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-family: "微软雅黑", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

button {
  font: inherit;
}

.shell {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 24px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.topbar > * {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 14px;
  font-weight: 700;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.18;
  font-weight: 800;
}

h2 {
  font-size: 20px;
  line-height: 1.25;
}

.actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 100%;
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(84px, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf2ef;
  max-width: 100%;
  min-width: 0;
}

.range-button,
.icon-button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.range-button {
  padding: 0 12px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.range-button.is-active {
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 1px 4px rgba(23, 33, 31, 0.12);
}

.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.metrics {
  display: grid;
  grid-template-columns: 1.35fr repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.metric-card {
  min-height: 118px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric-card.primary {
  background: #f6fbf9;
  border-color: #a9d6cf;
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.metric-card strong {
  display: block;
  margin-top: 12px;
  font-size: 30px;
  line-height: 1.1;
  font-weight: 800;
  white-space: nowrap;
}

.metric-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.chart-panel {
  min-height: 610px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.chart-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  min-height: 52px;
}

.chart-heading p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 14px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill.is-error {
  background: #f7e1db;
  color: var(--coral);
}

.status-pill svg {
  width: 16px;
  height: 16px;
}

.chart {
  width: 100%;
  height: 520px;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 2px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

@media (max-width: 960px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

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

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

@media (max-width: 640px) {
  .shell {
    width: min(100% - 24px, 1440px);
    padding-top: 18px;
  }

  h1 {
    font-size: 26px;
  }

  .actions,
  .segmented,
  .icon-button {
    width: 100%;
  }

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

  .range-button {
    padding: 0 6px;
    font-size: 13px;
  }

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

  .chart-panel {
    min-height: 520px;
    padding: 16px 8px 12px;
  }

  .chart-heading,
  .footer {
    flex-direction: column;
  }

  .chart {
    height: 440px;
  }
}
