:root {
  color-scheme: light;
  --ink: #1a2c31;
  --muted: #53676e;
  --edge: #d9e5e6;
  --teal: #06675b;
  --blue: #2462ae;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: var(--ink);
  background: #f1f6f5;
}
* { box-sizing: border-box; }
body { margin: 0; }
.wrap { width: min(1120px, calc(100% - 40px)); margin-inline: auto; }
.top { background: #113238; color: #f2fbfa; }
.top-inner { display: flex; justify-content: space-between; align-items: center; min-height: 64px; gap: 12px; }
.brand { font-weight: 700; }
.mark { color: #87e6ca; font-size: 1.25em; margin-right: 4px; }
.top a { color: #c3e9df; font-size: .86rem; }
.top-links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 16px; }
.intro { padding: 42px 0 18px; }
main { padding-bottom: 28px; }
h1 { font-size: clamp(1.75rem, 4vw, 2.65rem); margin: 8px 0; letter-spacing: -.03em; }
h2 { font-size: 1.12rem; margin: 0 0 6px; }
p { margin: 8px 0; line-height: 1.65; }
.intro > p, .muted, .panel-head p, small { color: var(--muted); }
.intro .notice { display: inline-block; background: #fdf0d2; color: #65461b; padding: 6px 12px; border-radius: 6px; margin-top: 10px; font-size: .85rem; overflow-wrap: anywhere; }
.intro .imported { background: #dcefe7; color: #185f50; }
.quote-source { display: inline-block; margin-inline-start: 8px; font-size: .85rem; }
.controls { display: flex; flex-wrap: wrap; gap: 12px 24px; margin-bottom: 18px; }
.controls label { display: flex; gap: 8px; align-items: center; font-size: .86rem; font-weight: 650; }
select, button, #price-date { font: inherit; background: white; color: var(--ink); border: 1px solid #b4cacb; padding: 8px 10px; border-radius: 6px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.card { background: #fff; border: 1px solid var(--edge); border-radius: 10px; padding: 19px; min-width: 0; }
.metrics span, .metrics small { display: block; font-size: .8rem; }
.metrics strong { display: block; font-variant-numeric: tabular-nums; font-size: clamp(1.35rem, 3vw, 2rem); margin-block: 6px; overflow-wrap: anywhere; }
.up { color: #9b4336; }
.down { color: var(--teal); }
.chart-panel { margin-bottom: 14px; }
.panel-head { display: flex; justify-content: space-between; gap: 8px 18px; flex-wrap: wrap; }
.panel-head p, .legend, .muted { font-size: .83rem; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; align-items: baseline; }
.legend span::before { content: ""; display: inline-block; width: 16px; margin-right: 5px; vertical-align: middle; border-top: 2px solid var(--teal); }
.legend span:nth-child(2)::before { border-top: 2px dashed var(--blue); }
.legend span:nth-child(3)::before { border-color: #8061a3; }
.price-lookup { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 10px 12px; background: #f1f6f5; border-radius: 6px; font-size: .9rem; }
.price-lookup label, .price-lookup output { font-weight: 650; }
#price-date { max-width: 100%; }
#price-on-date { font-variant-numeric: tabular-nums; }
#chart { position: relative; margin-top: 6px; }
#chart svg { display: block; width: 100%; font: 11px system-ui, sans-serif; fill: var(--muted); }
.chart-hit-area { fill: transparent; cursor: crosshair; }
.date-marker { stroke: #fff; stroke-width: 2.5; filter: drop-shadow(0 1px 2px #1a2c3155); }
.chart-tooltip {
  position: absolute;
  width: max-content;
  max-width: 100%;
  pointer-events: none;
  background: #113238;
  color: #f2fbfa;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: .82rem;
  font-variant-numeric: tabular-nums;
}
.future-area { fill: #f0f5fc; }
.gridline { stroke: #e0e9eb; }
.observed-line, .forecast-line, .error-bar { fill: none; stroke-width: 2.2; stroke-linejoin: round; }
.observed-line { stroke: var(--teal); }
.forecast-line { stroke: var(--blue); stroke-dasharray: 6 4; }
.error-bar { stroke: #8061a3; }
.observed-dot { fill: var(--teal); }
.forecast-dot { fill: var(--blue); }
details { border-top: 1px solid var(--edge); margin-top: 12px; padding-top: 12px; }
summary { color: var(--teal); cursor: pointer; font-size: .9rem; }
.table-wrap { max-height: 260px; overflow: auto; margin-top: 8px; }
table { border-collapse: collapse; width: 100%; font-size: .85rem; }
th, td { padding: 7px; text-align: left; border-bottom: 1px solid var(--edge); }
th { background: #f5f8f8; position: sticky; top: 0; }
.date-button { color: var(--teal); background: transparent; border: 0; padding: 5px 0; text-decoration: underline; text-underline-offset: 3px; font-variant-numeric: tabular-nums; }
tr:has(.date-button[aria-pressed="true"]) { background: #e2f1ed; }
.lower { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cost-panel { margin-bottom: 14px; }
.cost-table { overflow-x: auto; }
.cost-panel .panel-head a { font-size: .85rem; }
.cost-panel input { width: 100%; padding: 8px; font: inherit; color: var(--ink); border: 1px solid #b4cacb; border-radius: 6px; }
.cost-table input { width: 7.5rem; }
.cost-fields { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 14px; margin-block: 12px; font-size: .85rem; }
.cost-fields label { display: grid; gap: 4px; width: min(100%, 10rem); }
.cost-fields select { width: 100%; text-overflow: ellipsis; }
.cost-results { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 8px; margin-top: 14px; }
.cost-results > div { background: #f1f6f5; padding: 12px; border-radius: 6px; }
.cost-results span { display: block; color: var(--muted); font-size: .82rem; }
.cost-results output { display: block; margin-top: 4px; font-size: 1.16rem; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.lower p { font-size: .89rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 15px; margin-top: 13px; font-size: .85rem; }
#csv { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; }
.upload { background: var(--teal); color: white; padding: 8px 12px; border-radius: 6px; cursor: pointer; }
.actions:has(#csv:focus-visible) .upload, :focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
a { color: var(--teal); text-underline-offset: 3px; }
button { cursor: pointer; }
.error { color: #a22f24; }
[hidden] { display: none !important; }
@media (max-width: 720px) {
  .wrap { width: calc(100% - 26px); }
  .intro { padding-top: 26px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { padding: 14px; }
  .lower { grid-template-columns: 1fr; }
}
