:root {
  color-scheme: light;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #17231d;
  background: #f5f7f6;
  font-synthesis: none;
  --ink: #17231d;
  --muted: #69756e;
  --line: #dce3df;
  --surface: #ffffff;
  --green: #167a52;
  --green-soft: #e5f3ec;
  --amber: #b56a13;
  --red: #c33f3f;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; background: #f5f7f6; }
button { font: inherit; }
.topbar { background: #13221b; color: #f8fbf9; border-bottom: 3px solid #d4a84e; }
.topbar-inner { max-width: 1240px; height: 76px; margin: auto; padding: 0 28px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center; border: 1px solid #5f7167; color: #f0c66d; font: 700 17px/1 Georgia, serif; }
h1, h2, p { margin: 0; }
h1 { font-size: 18px; line-height: 1.25; letter-spacing: 0; }
.brand p { margin-top: 2px; color: #aebbb4; font-size: 12px; }
.topbar-meta { display: flex; align-items: center; gap: 16px; color: #b9c4be; font-size: 12px; white-space: nowrap; }
.mode-badge { display: inline-flex; align-items: center; gap: 7px; color: #dce6e1; text-transform: uppercase; }
.mode-dot, .status-dot { width: 7px; height: 7px; border-radius: 50%; background: #56c78e; box-shadow: 0 0 0 3px rgba(86,199,142,.13); }
.icon-button { width: 34px; height: 34px; border: 1px solid #42544a; background: transparent; color: #d9e2dd; display: grid; place-items: center; cursor: pointer; }
.icon-button:hover { background: #26382f; }
.icon-button:disabled { opacity: .45; cursor: wait; }
.icon-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-button.loading svg { animation: rotate .8s linear infinite; }

main { max-width: 1240px; margin: auto; padding: 28px 28px 52px; }
.status-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); }
.metric { min-width: 0; padding: 18px 20px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric-label { display: block; color: var(--muted); font-size: 12px; }
.metric strong { display: block; min-height: 31px; margin-top: 7px; overflow-wrap: anywhere; font-size: 21px; line-height: 1.45; font-variant-numeric: tabular-nums; letter-spacing: 0; }
.metric-note { display: block; margin-top: 3px; color: #8a958f; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.source-value { display: flex !important; align-items: center; gap: 9px; }
.source-value.delayed .status-dot { background: #dc932f; box-shadow: 0 0 0 3px rgba(220,147,47,.13); }
.source-value.offline .status-dot { background: #d75555; box-shadow: 0 0 0 3px rgba(215,85,85,.13); }
.source-value.waiting .status-dot { background: #98a39d; box-shadow: none; }

.page-state { min-height: 44px; margin-top: 14px; padding: 10px 14px; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-size: 13px; }
.page-state.ready { visibility: hidden; }
.page-state.error { color: var(--red); background: #fff1f1; border: 1px solid #f1cccc; }
.page-state button { padding: 5px 10px; border: 1px solid #e2b1b1; background: #fff; color: #9b2e2e; cursor: pointer; }
.spinner { width: 14px; height: 14px; border: 2px solid #cbd5d0; border-top-color: var(--green); border-radius: 50%; animation: rotate .8s linear infinite; }
@keyframes rotate { to { transform: rotate(360deg); } }

.section-block { margin-top: 30px; padding-top: 24px; border-top: 1px solid #cfd8d3; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.section-heading.compact { margin-bottom: 14px; }
.eyebrow { margin-bottom: 4px; color: var(--green); font: 700 10px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; }
h2 { font-size: 20px; line-height: 1.35; letter-spacing: 0; }
.segmented { display: inline-grid; grid-template-columns: repeat(3, 1fr); border: 1px solid #bdc9c2; background: #edf1ef; }
.segmented button { min-width: 78px; height: 34px; padding: 0 13px; border: 0; border-right: 1px solid #bdc9c2; background: transparent; color: #59665f; cursor: pointer; font-size: 12px; }
.segmented button:last-child { border-right: 0; }
.segmented button.active { background: #173e2d; color: #fff; }
.chart-wrap, .session-chart-wrap { position: relative; min-width: 0; background: var(--surface); border: 1px solid var(--line); }
.chart { width: 100%; height: 430px; }
.empty-overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 28px; background: rgba(255,255,255,.94); color: var(--muted); text-align: center; font-size: 13px; }
.source-label { color: var(--muted); font-size: 12px; }

.table-scroll { overflow-x: auto; border: 1px solid var(--line); background: var(--surface); }
table { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 13px; }
th, td { height: 52px; padding: 0 18px; border-bottom: 1px solid #e6ebe8; text-align: left; white-space: nowrap; }
th { height: 40px; background: #f0f3f1; color: #67736c; font-size: 11px; font-weight: 600; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcfb; }
td:first-child { font-weight: 600; }
.price-number { font-variant-numeric: tabular-nums; }
.difference.positive { color: var(--red); }
.difference.negative { color: var(--green); }
.table-empty { height: 100px; color: var(--muted); text-align: center; font-weight: 400 !important; }

.session-layout { display: grid; grid-template-columns: minmax(270px, .72fr) minmax(0, 1.55fr); gap: 16px; }
.session-progress-panel { min-height: 280px; padding: 30px 26px; background: var(--surface); border: 1px solid var(--line); }
.progress-header { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; color: var(--muted); font-size: 13px; }
.progress-header strong { color: var(--ink); font-size: 28px; font-variant-numeric: tabular-nums; }
.progress-track { height: 12px; margin-top: 42px; overflow: hidden; background: #e7ece9; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--green); transition: width .45s ease; }
.progress-track.over span { background: var(--amber); }
.progress-scale { display: flex; justify-content: space-between; gap: 14px; margin-top: 10px; color: #7c8881; font-size: 11px; }
.progress-note { margin-top: 50px; padding-top: 16px; border-top: 1px solid #e3e8e5; color: var(--muted); font-size: 12px; line-height: 1.7; }
.session-chart-wrap { min-height: 280px; }
.session-chart { width: 100%; height: 280px; }
footer { max-width: 1240px; margin: auto; padding: 20px 28px 34px; display: flex; justify-content: space-between; border-top: 1px solid #d6deda; color: #87928c; font-size: 11px; }

@media (max-width: 760px) {
  .topbar-inner { height: 68px; padding: 0 16px; }
  .brand p, #generated-at { display: none; }
  .topbar-meta { gap: 10px; }
  main { padding: 18px 14px 36px; }
  .status-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { min-height: 113px; padding: 15px 14px; }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .metric strong { font-size: 17px; }
  .section-block { margin-top: 23px; padding-top: 20px; }
  .section-heading { align-items: stretch; flex-direction: column; gap: 12px; }
  .section-heading.compact { flex-direction: row; align-items: flex-end; }
  .segmented { width: 100%; }
  .segmented button { min-width: 0; }
  .chart { height: 360px; }
  .session-layout { grid-template-columns: 1fr; }
  .session-progress-panel { min-height: 245px; padding: 24px 18px; }
  .progress-track { margin-top: 32px; }
  .progress-note { margin-top: 38px; }
  footer { margin: 0 14px; padding: 18px 0 26px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
