:root {
  --bg: #f2f5ef;
  --paper: #fbfaf6;
  --paper-strong: #fffef9;
  --ink: #161a1d;
  --muted: #66706c;
  --line: #d8ded4;
  --line-strong: #aeb8ad;
  --good: #18724f;
  --bad: #b93635;
  --blue: #315f9d;
  --teal: #15756b;
  --amber: #a8601f;
  --shadow: 0 18px 45px rgba(29, 35, 32, 0.08);
  color: var(--ink);
  background: var(--bg);
  font-family: Aptos, "SF Pro Display", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
}

button {
  font: inherit;
}

.screen {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 3vw, 36px);
}

.topbar,
.actions,
.chart-toolbar,
.card-head,
.metric-row,
.legend,
.side-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar,
.chart-toolbar,
.card-head,
.metric-row,
.side-heading {
  justify-content: space-between;
}

.topbar {
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 20px;
}

.eyebrow,
.panel-title,
.method-label,
.metric-label,
.control-label {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.eyebrow {
  margin: 0 0 7px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 0.98;
}

h2 {
  font-size: clamp(1.16rem, 1.8vw, 1.75rem);
  line-height: 1.08;
}

.source-pill,
.icon-button,
.summary-card,
.side-panel,
.chart-panel,
.status-strip,
.segmented,
.method-strip,
.memory-detail-panel {
  border: 1px solid var(--line);
  background: color-mix(in oklch, var(--paper) 92%, white);
  box-shadow: var(--shadow);
}

.source-pill {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 13px;
  border-radius: 8px;
  color: var(--ink);
  font-weight: 850;
  white-space: nowrap;
}

.source-pill.official {
  border-color: color-mix(in oklch, var(--good) 34%, var(--line));
  background: color-mix(in oklch, var(--good) 11%, var(--paper));
  color: var(--good);
}

.source-pill.sample {
  border-color: color-mix(in oklch, var(--amber) 36%, var(--line));
  background: color-mix(in oklch, var(--amber) 10%, var(--paper));
  color: #7b4a18;
}

.source-pill.mixed {
  border-color: color-mix(in oklch, var(--blue) 32%, var(--line));
  background: color-mix(in oklch, var(--blue) 9%, var(--paper));
  color: #24446f;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--line-strong);
}

.icon-button:disabled {
  cursor: default;
  opacity: 0.55;
}

.icon-button.spinning {
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.status-strip {
  display: grid;
  grid-template-columns: minmax(190px, 310px) 1fr;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.status-strip div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-strip strong {
  color: var(--ink);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

.method-strip {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 1px;
  overflow: hidden;
  margin-bottom: 16px;
  border-radius: 8px;
  background: var(--line);
}

.method-strip div {
  display: grid;
  gap: 6px;
  min-height: 68px;
  padding: 13px 15px;
  background: var(--paper-strong);
}

.method-strip strong {
  font-size: 0.9rem;
  line-height: 1.35;
}

.coverage-badge {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 4px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in oklch, var(--paper) 72%, white);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.coverage-badge.compact {
  margin-top: 0;
  margin-bottom: 10px;
}

.coverage-badge span,
.coverage-badge strong {
  color: var(--ink);
  font-weight: 850;
}

.coverage-badge em {
  color: var(--muted);
  font-style: normal;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.section-head .panel-title {
  margin-bottom: 7px;
}

.freshness-note {
  max-width: 420px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
  text-align: right;
}

.chart-control-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in oklch, var(--paper) 76%, white);
}

.control-group {
  display: grid;
  gap: 7px;
}

.segmented.compact button {
  min-height: 30px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.series-chip,
.focus-pill {
  min-height: 31px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper-strong);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.series-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  cursor: pointer;
}

.series-chip i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.series-chip.active {
  border-color: color-mix(in oklch, var(--blue) 34%, var(--line));
  background: color-mix(in oklch, var(--blue) 9%, var(--paper));
  color: #24446f;
}

.focus-pill {
  display: inline-flex;
  align-items: center;
  padding: 0 11px;
  white-space: nowrap;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.summary-card {
  position: relative;
  min-height: 174px;
  overflow: hidden;
  border-radius: 8px;
  padding: 16px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.summary-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--line-strong);
}

.summary-card:nth-child(1)::before {
  background: var(--blue);
}

.summary-card:nth-child(2)::before {
  background: var(--teal);
}

.summary-card:hover,
.summary-card.active {
  border-color: var(--line-strong);
  transform: translateY(-1px);
  box-shadow: 0 18px 45px rgba(29, 35, 32, 0.12);
}

.summary-card.active {
  background: color-mix(in oklch, var(--paper) 88%, white);
}

.card-head span {
  font-weight: 850;
}

code {
  color: var(--muted);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 0.76rem;
}

.summary-card .metric-label {
  display: block;
  margin-top: 18px;
}

.summary-card strong {
  display: block;
  margin-top: 6px;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: clamp(1.55rem, 2.5vw, 2.1rem);
  line-height: 1;
}

.metric-row,
.summary-analysis {
  margin-top: 18px;
  color: var(--ink);
  font-size: 0.82rem;
}

.summary-analysis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.analysis-cell {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: color-mix(in oklch, var(--paper) 72%, white);
  font-weight: 800;
}

.analysis-cell small {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
}

.analysis-cell b {
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.1;
}

.analysis-cell em {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.68rem;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analysis-cell.signal {
  border-color: color-mix(in oklch, var(--blue) 18%, var(--line));
  background: color-mix(in oklch, var(--blue) 7%, var(--paper));
}

.analysis-cell.signal b {
  color: #24446f;
}

.card-freshness {
  margin-top: 11px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.4;
}

.delta.positive {
  color: var(--good);
  background: color-mix(in oklch, var(--good) 9%, var(--paper));
}

.delta.negative {
  color: var(--bad);
  background: color-mix(in oklch, var(--bad) 8%, var(--paper));
}

.delta.neutral {
  color: var(--muted);
}

.analysis-cell.delta.positive b {
  color: var(--good);
}

.analysis-cell.delta.negative b {
  color: var(--bad);
}

.analysis-cell.delta.neutral b {
  color: var(--muted);
}

.workbench {
  display: grid;
  grid-template-columns: minmax(280px, 0.36fr) minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}

.side-panel,
.chart-panel,
.memory-detail-panel {
  border-radius: 8px;
  padding: 18px;
}

.side-panel {
  background: color-mix(in oklch, var(--paper) 86%, white);
}

.panel-title {
  margin-bottom: 12px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 4px color-mix(in oklch, var(--teal) 14%, transparent);
}

.note,
.chart-caption,
.method-note {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.note {
  margin-top: 10px;
}

.chart-caption {
  margin: -4px 0 10px;
}

.method-note {
  margin-top: 8px;
}

.detail-list {
  display: grid;
  gap: 10px;
  margin: 22px 0 0;
}

.detail-list div {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px;
  align-items: baseline;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

dt {
  color: var(--muted);
  font-size: 0.82rem;
}

dd {
  margin: 0;
  font-weight: 850;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  padding: 4px;
  border-radius: 8px;
  box-shadow: none;
}

.segmented button {
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.segmented button:hover {
  background: color-mix(in oklch, var(--line) 46%, transparent);
}

.segmented button.selected {
  background: var(--ink);
  color: var(--paper);
}

.axis-pair strong {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper-strong);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.chart-frame {
  width: 100%;
  min-height: 390px;
  padding-top: 0;
}

.chart-frame.small {
  min-height: 286px;
}

.memory-detail-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.memory-detail-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.memory-detail-switch button {
  min-height: 33px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper-strong);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 850;
  padding: 0 12px;
}

.memory-detail-switch button:hover {
  border-color: var(--line-strong);
}

.memory-detail-switch button.selected {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.memory-detail-focus {
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(220px, 0.55fr) minmax(0, 1fr) minmax(220px, 0.6fr);
  margin-top: 2px;
  padding: 14px;
  background: color-mix(in oklch, var(--paper) 82%, white);
}

.memory-focus-main {
  display: grid;
  gap: 6px;
}

.memory-focus-main span,
.memory-focus-kpis small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.memory-focus-main h3 {
  font-size: clamp(1.15rem, 1.8vw, 1.65rem);
  line-height: 1.05;
  margin: 0;
}

.memory-focus-main strong {
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: clamp(1.5rem, 2.7vw, 2.25rem);
  line-height: 1;
}

.memory-focus-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.memory-focus-kpis span {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  border-radius: 7px;
  background: var(--paper-strong);
}

.memory-focus-kpis b {
  color: #24446f;
  font-size: 1rem;
}

.memory-source-link {
  align-content: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  display: grid;
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1.35;
  padding: 10px;
  text-decoration: none;
}

.memory-source-link:hover {
  border-color: var(--line-strong);
  background: var(--paper-strong);
}

.memory-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.memory-detail-card {
  display: grid;
  gap: 10px;
  min-height: 184px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-strong);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.memory-detail-card:hover {
  border-color: var(--line-strong);
  background: color-mix(in oklch, var(--paper) 74%, white);
}

.memory-detail-card.active {
  border-color: color-mix(in oklch, var(--blue) 36%, var(--line));
  background: color-mix(in oklch, var(--blue) 7%, var(--paper));
}

.memory-detail-card > span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.memory-detail-card > strong {
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: clamp(1.2rem, 2vw, 1.65rem);
  line-height: 1;
}

.memory-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.memory-kpis em {
  display: grid;
  gap: 3px;
  padding: 8px;
  border-radius: 7px;
  background: color-mix(in oklch, var(--paper) 72%, white);
  color: #24446f;
  font-style: normal;
  font-size: 0.82rem;
  font-weight: 850;
}

.memory-kpis small {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.memory-detail-card p {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

.lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.76fr);
  gap: 14px;
}

.chart-empty {
  display: grid;
  place-items: center;
  min-height: inherit;
  color: var(--muted);
}

.legend {
  flex-wrap: wrap;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend i {
  display: inline-block;
  width: 16px;
  height: 3px;
  border-radius: 999px;
}

.legend i.dashed {
  background: repeating-linear-gradient(90deg, currentColor 0 7px, transparent 7px 12px) !important;
  color: var(--teal);
}

.amount-bar {
  opacity: 0.92;
}

.source-list {
  display: grid;
  gap: 7px;
  max-height: 116px;
  overflow: auto;
  padding-right: 2px;
}

.source-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 800;
}

.source-list a:hover {
  border-color: var(--line-strong);
  background: var(--paper-strong);
}

svg {
  display: block;
  width: 100%;
}

svg text {
  fill: var(--muted);
  font-size: 12px;
}

.axis {
  stroke: var(--line-strong);
  stroke-width: 1;
}

.gridline {
  stroke: var(--line);
  stroke-width: 1;
}

.axis-label {
  font-weight: 850;
}

.focus-line {
  stroke: var(--line-strong);
  stroke-dasharray: 4 4;
  stroke-width: 1.4;
}

.hit-zone {
  fill: transparent;
  cursor: crosshair;
  pointer-events: all;
}

.bar-mark {
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.15s ease;
  transform-box: fill-box;
  transform-origin: center bottom;
}

.bar-mark.hovered {
  opacity: 0.84;
  transform: scaleY(1.03);
}

.chart-tooltip {
  position: fixed;
  z-index: 40;
  max-width: min(320px, calc(100vw - 28px));
  padding: 10px 12px;
  border: 1px solid #2f3532;
  border-radius: 8px;
  background: #161a1d;
  box-shadow: 0 18px 40px rgba(22, 26, 29, 0.22);
  color: #f7faf4;
  font-size: 0.76rem;
  pointer-events: none;
}

.chart-tooltip strong {
  display: block;
  margin-bottom: 7px;
  color: #ffffff;
  font-size: 0.82rem;
}

.chart-tooltip span {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 5px;
  color: #dce3dc;
  line-height: 1.3;
}

.chart-tooltip i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.monthly-official {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.monthly-official a {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-strong);
  color: var(--ink);
  text-decoration: none;
}

.monthly-official a:hover {
  border-color: var(--line-strong);
}

.monthly-official span,
.monthly-official small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.monthly-official strong {
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 1.35rem;
}

@media (max-width: 960px) {
  .screen {
    padding: 18px;
  }

  .topbar,
  .chart-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .actions {
    justify-content: space-between;
  }

  .status-strip,
  .summary-grid,
  .method-strip,
  .memory-detail-focus,
  .memory-detail-grid,
  .chart-control-strip,
  .workbench,
  .lower-grid {
    grid-template-columns: 1fr;
  }

  .section-head {
    flex-direction: column;
  }

  .freshness-note {
    text-align: left;
  }

  .chart-control-strip {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .screen {
    padding: 14px;
  }

  .summary-card strong {
    font-size: 1.45rem;
  }

  .metric-row,
  .summary-analysis,
  .card-head {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .detail-list div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .monthly-official {
    grid-template-columns: 1fr;
  }

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