@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400..700&family=Geist+Mono:wght@400..600&display=swap');

:root {
  color-scheme: light;
  --workspace: #fafafa;
  --paper: #fff;
  --ink: #171717;
  --muted: #666;
  --line: #e5e5e5;
  --strong-line: #a1a1a1;
  --soft: #f5f5f5;
  --link: #0070f3;
  --chart-baseline: #b8b8b8;
  --chart-selection: #edf5ff;
  --radius: 8px;
  --font: Geist, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --mono: 'Geist Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--workspace); color: var(--ink); font: 1rem/1.5 var(--font); -webkit-font-smoothing: antialiased; }
:where(h1, h2, p, dl, dt, dd) { margin: 0; }
a { color: inherit; text-decoration: none; }
button { color: inherit; font: inherit; cursor: pointer; }
button:disabled { cursor: wait; opacity: .68; }
:where(button, a):focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.skip { position: fixed; z-index: 20; inset: .5rem auto auto .5rem; padding: .6rem; background: var(--paper); transform: translateY(-200%); }
.skip:focus { transform: translateY(0); }

.shell { width: min(1216px, calc(100% - 72px)); margin-inline: auto; }
.topbar { border-bottom: 1px solid var(--line); background: var(--paper); }
.header-layout { min-height: 3.75rem; display: flex; align-items: center; gap: clamp(1.1rem, 3.5vw, 2.7rem); }
.wordmark { display: flex; align-items: center; gap: .65rem; white-space: nowrap; font-weight: 600; font-size: .95rem; }
.brand-icon { display: flex; align-items: end; justify-content: center; gap: 2px; width: 1.75rem; height: 1.75rem; padding-bottom: .42rem; border-radius: 5px; background: var(--ink); }
.brand-icon i { width: 3px; height: 6px; background: var(--paper); border-radius: 1px; }
.brand-icon i:nth-child(2) { height: 12px; }
.brand-icon i:nth-child(3) { height: 9px; }
.view-nav { display: flex; align-items: stretch; align-self: stretch; gap: clamp(.7rem, 2.4vw, 1.6rem); }
.view-nav a { display: flex; align-items: center; position: relative; white-space: nowrap; color: var(--muted); font-size: .875rem; padding-inline: .14rem; }
.view-nav a:hover, .view-nav a[aria-current] { color: var(--ink); }
.view-nav a[aria-current] { font-weight: 550; }
.view-nav a[aria-current]::after { content: ''; position: absolute; bottom: -1px; inset-inline: 0; height: 2px; background: var(--ink); }
.home-link { margin-left: auto; color: var(--muted); font-size: .875rem; font-weight: 500; }
.home-link:hover { color: var(--ink); }

.main { padding-block: clamp(1.6rem, 3.5vw, 2.8rem) 1.4rem; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.3rem; }
h1 { font-size: clamp(1.9rem, 3.4vw, 2.65rem); letter-spacing: -.043em; font-weight: 600; line-height: 1.16; }
.date-range { margin-top: .52rem; color: var(--muted); font: 400 .8125rem/1.5 var(--mono); }
.date-controls { display: flex; align-items: center; gap: .5rem; }
.segment { display: inline-flex; align-items: center; padding: 2px; gap: 2px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.segment button, .refresh { min-height: 2rem; white-space: nowrap; padding: .27rem .72rem; font-size: .875rem; font-weight: 500; border-radius: 5px; }
.segment button { border: none; color: var(--muted); background: transparent; }
.segment button:hover { background: var(--soft); color: var(--ink); }
.segment button[aria-pressed=true] { background: var(--ink); color: var(--paper); }
.refresh { display: inline-flex; align-items: center; gap: .39rem; height: calc(2rem + 6px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.refresh:hover { background: var(--soft); border-color: var(--strong-line); }
.refresh [aria-hidden] { font-size: 1.1rem; line-height: 1; }
.load-notice { padding: .6rem .85rem; border: 1px solid #f0cd94; border-radius: var(--radius); background: #fff8eb; color: #774815; margin-bottom: .8rem; font-size: .875rem; }

.analysis { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(21rem, 1fr); gap: 1rem; align-items: start; }
.plot-panel, .detail-panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.plot-panel { --plot-padding: 1.5rem; padding: 0 var(--plot-padding) 1.12rem; }
.metric-picker, .account-numbers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; margin-inline: calc(-1 * var(--plot-padding)); border-bottom: 1px solid var(--line); }
.account-numbers { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.headline-stat { min-width: 0; position: relative; display: block; border: 0; padding: 1.08rem var(--plot-padding) 1.21rem; text-align: left; background: transparent; }
.headline-stat + .headline-stat { border-left: 1px solid var(--line); }
button.headline-stat:first-child { border-top-left-radius: 7px; }
button.headline-stat:last-child { border-top-right-radius: 7px; }
button.headline-stat:hover, button.headline-stat[aria-pressed=true] { background: var(--workspace); }
button.headline-stat[aria-pressed=true]::after { content: ''; position: absolute; height: 2px; bottom: -1px; inset-inline: 0; background: var(--ink); }
button.headline-stat:focus-visible { outline-offset: -3px; }
.stat-label { display: block; color: var(--muted); font-size: .875rem; font-weight: 500; }
.stat-label small { font: 400 .6875rem var(--mono); margin-left: .24rem; }
.number { display: block; margin-top: .29rem; color: var(--ink); font-size: clamp(1.72rem, 3.1vw, 2.65rem); font-weight: 600; line-height: 1.12; letter-spacing: -.047em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.account-numbers .number { font-size: clamp(1.38rem, 2.5vw, 2.12rem); }

.trend-heading { display: flex; align-items: end; justify-content: space-between; gap: .5rem 1rem; margin-top: 1.3rem; }
.trend-heading h2, .detail-heading h2 { font-size: 1.06rem; font-weight: 600; line-height: 1.38; letter-spacing: -.02em; }
.trend-heading p, .plot-hint { color: var(--muted); font-size: .8125rem; }
.trend-heading p { margin-top: .24rem; }
.official-selection { text-align: right; }
.chart { position: relative; width: 100%; height: clamp(220px, 22vw, 300px); margin-top: .75rem; }
.plot-canvas { display: block; width: 100%; height: 100%; }
.chart-targets { position: absolute; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.chart-target { width: 100%; min-width: 0; min-height: 100%; border: none; background: transparent; padding: 0; }
.chart-target:focus-visible { outline-offset: 0; border-radius: 3px; z-index: 1; }
.chart-empty { display: grid; place-items: center; min-height: 100%; border: 1px dashed var(--line); border-radius: 6px; color: var(--muted); text-align: center; padding: .7rem; }

.detail-panel { padding: 1.12rem 1.15rem 1rem; }
.detail-heading { display: flex; align-items: start; justify-content: space-between; min-height: 2.75rem; gap: .5rem; }
.detail-heading p { margin-top: .13rem; color: var(--muted); font-size: .8125rem; }
.text-button { border: 0; padding: .2rem 0; white-space: nowrap; font-size: .8125rem; background: none; color: var(--link); }
:is(.text-button, .official-note a, .home-link):hover { text-decoration: underline; text-underline-offset: 3px; }
.all-sources { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: .45rem; min-height: 2.5rem; padding: .43rem .65rem; margin: .5rem 0 .8rem; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); font-size: .875rem; font-weight: 550; }
.all-sources:hover { border-color: var(--strong-line); background: var(--soft); }
.all-sources[aria-pressed=true] { color: var(--paper); border-color: var(--ink); background: var(--ink); }
#detail-total { font: 400 .8125rem/1.5 var(--mono); }
.column-labels, .source-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(4.2rem, auto) minmax(5.6rem, auto); align-items: center; gap: .5rem; }
.column-labels { color: var(--muted); padding: .3rem .65rem; font-size: .8125rem; border-bottom: 1px solid var(--line); }
.column-labels :not(:first-child), :is(.source-token, .source-value) { text-align: right; }
.source-row { width: 100%; min-height: 3rem; border: 0; border-bottom: 1px solid var(--line); padding: .47rem .65rem; background: none; text-align: left; font-size: .875rem; }
.source-row:last-child { border-bottom: 0; }
.source-row:hover, .source-row[aria-pressed=true] { background: var(--soft); }
.source-row[aria-pressed=true] { box-shadow: inset 2px 0 var(--ink); }
.source-row.is-muted { color: var(--muted); }
.source-row.is-muted .source-swatch { opacity: .58; }
.source-name { display: flex; align-items: center; gap: .44rem; font-weight: 550; line-height: 1.25; }
.source-swatch { flex: none; display: block; width: .48rem; height: .48rem; border-radius: 2px; background: var(--source-color); }
:is(.source-token, .source-value) { font: 400 .8125rem/1.5 var(--mono); white-space: nowrap; }
[data-active-metric=tokens] .source-token, [data-active-metric=valueMicros] .source-value { font-weight: 600; }
.detail-note { margin-top: .75rem; font-size: .8125rem; color: var(--muted); }

.plan-label { color: var(--ink); border: 1px solid var(--line); background: var(--soft); padding: .1rem .4rem; border-radius: 4px; font-size: .8125rem; }
.quota-window { padding: .55rem 0 .85rem; }
.quota-window + .quota-window { border-top: 1px solid var(--line); padding-top: .85rem; }
.quota-label, .quota-note, .quota-reset { font-size: .875rem; color: var(--muted); }
.quota-value { display: flex; align-items: baseline; gap: .45rem; margin: .13rem 0 .5rem; }
.quota-number { font-size: clamp(1.85rem, 3.1vw, 2.35rem); font-weight: 600; line-height: 1.05; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.quota-track { display: block; height: 5px; overflow: hidden; background: var(--soft); border-radius: 4px; }
.quota-track i { display: block; height: 100%; background: var(--ink); border-radius: inherit; }
.quota-reset { margin-top: .45rem; }
.official-note, .site-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .35rem 1rem; margin-top: 1rem; color: var(--muted); font-size: .8125rem; }
.official-note a { color: var(--link); }
.sync-caption { display: flex; gap: .43rem; align-items: center; }
.sync-caption i { width: .42rem; height: .42rem; border-radius: 50%; background: #a76c21; }
.sync-fresh i { background: #24854f; }

@media (max-width: 1000px) {
  .shell { width: calc(100% - 48px); }
  .analysis { grid-template-columns: minmax(0, 1.4fr) minmax(19.75rem, 1fr); gap: .75rem; }
  .plot-panel { --plot-padding: 1rem; }
  .detail-panel { padding-inline: .85rem; }
}

@media (max-width: 760px) {
  .shell { width: calc(100% - 32px); }
  .analysis { grid-template-columns: 1fr; }
  .chart { height: clamp(220px, 38vw, 280px); }
}

@media (max-width: 500px) {
  .header-layout { min-height: 3.5rem; gap: .67rem; }
  .wordmark { gap: .35rem; font-size: .85rem; }
  .brand-icon { width: 1.45rem; height: 1.45rem; padding-bottom: .29rem; }
  .brand-icon i { width: 2px; }
  .view-nav { gap: .52rem; }
  .view-nav a, .home-link { font-size: .8125rem; }
  .page-heading { align-items: start; flex-direction: column; margin-bottom: 1rem; }
  .date-controls { width: 100%; justify-content: space-between; }
  .segment button, .refresh { padding-inline: .56rem; }
  .plot-panel { --plot-padding: .8rem; }
  .headline-stat { padding-block: .78rem .85rem; }
  .number { font-size: clamp(1.33rem, 6.5vw, 2.12rem); }
  .account-numbers .number { font-size: clamp(1rem, 5vw, 1.65rem); }
  .account-numbers .stat-label { font-size: .8125rem; line-height: 1.35; }
  .plot-hint { font-size: .75rem; }
  .column-labels, .source-row { grid-template-columns: minmax(0, 1fr) minmax(3.6rem, auto) minmax(4.9rem, auto); padding-inline: .4rem; }
}
