/* The parts particular to pages: sign-in, stat tiles, charts, rankings,
   the request inspector, the transcript, settings and the account. */

.strong { font-weight: 600; }
.small { font-size: var(--fs-sm); }
.mono-ish { font-family: var(--font-mono); font-size: 12.5px; }
.align-start { align-items: start; }

/* ---- sign in: one card on a quiet, softly lit page */
.login-page {
  position: relative; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: var(--sp-8) var(--sp-5); background: var(--page); overflow: hidden; isolation: isolate;
}
.login-glow { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.login-glow i { position: absolute; display: block; border-radius: 50%; filter: blur(60px); opacity: 0.55; }
.login-glow i:nth-child(1) { width: 46vmax; height: 46vmax; left: -10vmax; top: -16vmax; background: radial-gradient(circle, rgba(0, 122, 255, 0.34), transparent 66%); }
.login-glow i:nth-child(2) { width: 40vmax; height: 40vmax; right: -12vmax; bottom: -16vmax; background: radial-gradient(circle, rgba(175, 82, 222, 0.28), transparent 66%); }
.login-glow i:nth-child(3) { width: 30vmax; height: 30vmax; right: 8vmax; top: -12vmax; background: radial-gradient(circle, rgba(0, 199, 190, 0.22), transparent 66%); }
.login-card {
  width: min(400px, 100%); padding: 36px 32px 26px; text-align: center;
  background: var(--material-strong); -webkit-backdrop-filter: saturate(180%) blur(30px); backdrop-filter: saturate(180%) blur(30px);
  border: 1px solid var(--material-edge); border-radius: 28px; box-shadow: var(--shadow-2), var(--highlight);
  animation: modal-in 520ms var(--spring);
}
.login-icon {
  width: 72px; height: 72px; margin: 0 auto 18px; border-radius: 18px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(160deg, var(--brand-a), var(--brand-b));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), inset 0 0 0 0.5px rgba(0, 0, 0, 0.12), 0 12px 24px -10px rgba(0, 88, 214, 0.7);
}
.login-icon .icon { width: 38px; height: 38px; stroke-width: 1.5; }
.login-card h1 { font-family: var(--font-display); font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.login-card .lead { color: var(--ink-3); margin: 8px 0 26px; font-size: 15px; }
.login-form { display: flex; flex-direction: column; gap: var(--sp-4); text-align: left; }
.login-form input { height: 44px; border-radius: 12px; font-size: 15px; padding: 0 14px; }
.login-form .input-affix > input.has-reveal { padding-right: 46px; }
.login-form .input-affix > .reveal { right: 6px; }
.login-form .btn { width: 100%; margin-top: var(--sp-1); }
.login-foot { margin-top: 22px; color: var(--ink-3); font-size: var(--fs-xs); display: flex; align-items: center; gap: 6px; justify-content: center; }
/* The quiet switch between the members' sign-in and the service provider's. */
.login-switch { margin-top: var(--sp-3); display: flex; justify-content: center; flex-wrap: wrap; gap: var(--sp-1) var(--sp-4); }
.link-button {
  border: 0; background: none; padding: 2px 4px; color: var(--ink-3); font-size: var(--fs-xs); cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; border-radius: var(--r-xs);
}
.link-button:hover { color: var(--accent-ink); }
.link-button:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.login-form .ticket-input { height: auto; min-height: 96px; padding: 10px 14px; border-radius: 12px; font-size: 12.5px; line-height: 1.5; word-break: break-all; }
.login-points {
  list-style: none; display: flex; gap: var(--sp-5) var(--sp-7); margin-top: var(--sp-7); justify-content: center; flex-wrap: wrap; max-width: 960px;
}
.login-points li { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: var(--fs-sm); }
.login-points strong { display: block; color: var(--ink-2); font-weight: 600; }
.login-points .nav-icon { width: 30px; height: 30px; border-radius: 8px; }
.login-points .nav-icon .icon { width: 17px; height: 17px; }

/* ---- stat tiles */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-4); }
.tiles.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.tile {
  position: relative; background: var(--surface); border: 1px solid var(--card-edge); border-radius: var(--r-xl); box-shadow: var(--shadow-card);
  padding: var(--sp-4) 18px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; min-height: 150px;
}
.tile-label { display: flex; align-items: center; gap: var(--sp-2); color: var(--ink-2); font-size: var(--fs-sm); font-weight: 600; min-width: 0; }
.tile-label > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-icon {
  width: 22px; height: 22px; border-radius: 6px; flex: none; display: grid; place-items: center; color: #fff;
  background: linear-gradient(180deg, color-mix(in srgb, var(--tone) 76%, #fff), var(--tone));
}
.tile-icon .icon { width: 13px; height: 13px; stroke-width: 2.3; }
.tile-value {
  font-family: var(--font-display); font-size: var(--fs-3xl); font-weight: 650; letter-spacing: -0.02em; line-height: 1.15;
  min-height: 36px; display: flex; align-items: baseline; gap: 2px 8px; flex-wrap: wrap; margin-top: 8px;
}
.tile-value .status { font-family: var(--font-sans); font-size: 15px; padding: 3px 12px 3px 7px; letter-spacing: 0; align-self: center; }
.tile-value .status .sym { width: 16px; height: 16px; }
.figure { display: inline-flex; align-items: baseline; gap: 4px; white-space: nowrap; }
.figure-unit { font-size: 0.52em; font-weight: 600; color: var(--ink-3); letter-spacing: 0; }
.tile-note { color: var(--ink-3); font-size: var(--fs-xs); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.tile-trend { margin-top: auto; padding-top: var(--sp-2); }
.tile-trend .spark-holder { height: 34px; }
.tile.with-meter .meter { margin-top: auto; }
.upstream-tile .tile-value { min-height: 36px; }
.delta {
  display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-size: var(--fs-xs); white-space: nowrap;
  padding: 1px 7px 1px 4px; border-radius: var(--r-full); font-variant-numeric: tabular-nums;
}
.delta .icon { width: 12px; height: 12px; stroke-width: 2.4; }
.delta.neutral, .delta.flat { color: var(--ink-2); background: var(--fill); }
.delta.flat { padding-left: 7px; }
.delta.better { color: var(--good-ink); background: var(--good-wash); }
.delta.worse { color: var(--bad-ink); background: var(--bad-wash); }
.skeleton.line-sm { height: 12px; width: 45%; }
.skeleton.line-md { height: 22px; width: 50%; }
.skeleton.line-lg { height: 30px; width: 60%; margin: 8px 0; }

/* Sparklines are drawn at the size they are given. */
.spark-holder { position: relative; width: 100%; }
.spark { display: block; width: 100%; height: 100%; overflow: visible; }
.spark .spark-area { fill: var(--series-1); opacity: 0.12; }
.spark .spark-before { fill: none; stroke: var(--series-muted); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.spark .spark-now { fill: none; stroke: var(--series-1); stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; }
.spark .spark-dot { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }
.spark .spark-dot.partial { fill: var(--surface); stroke: var(--series-1); stroke-width: 1.75; }

/* ---- charts */
.kind-input { --c: var(--kind-input); }
.kind-cache-read { --c: var(--kind-cache-read); }
.kind-cache-write { --c: var(--kind-cache-write); }
.kind-output { --c: var(--kind-output); }
.slot-1 { --c: var(--slot-1); }
.slot-2 { --c: var(--slot-2); }
.slot-3 { --c: var(--slot-3); }
.slot-4 { --c: var(--slot-4); }
.slot-5 { --c: var(--slot-5); }
.slot-6 { --c: var(--slot-6); }
.slot-other { --c: var(--series-other); }
.series-1, .series-ok { --c: var(--series-1); }
.series-failed { --c: var(--bad); }
.series-muted { --c: var(--series-muted); }

.chart-block { display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; }
.chart-summary { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-2) var(--sp-7); }
.chart-figure .label { color: var(--ink-3); font-size: var(--fs-xs); font-weight: 600; }
.chart-figure .value { font-family: var(--font-display); font-size: var(--fs-2xl); font-weight: 650; letter-spacing: -0.02em; line-height: 1.2; }
.chart-figure .value .figure-unit { font-size: 0.6em; }
.legend { display: flex; flex-wrap: wrap; gap: 6px; }
.legend-item {
  display: inline-flex; align-items: center; gap: 7px; min-height: 30px; padding: 0 12px 0 10px; border-radius: var(--r-full);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-1); font-size: var(--fs-sm); cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.legend-item:hover { background: var(--hover); }
.legend-item:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.legend-item .swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; transition: background var(--t-fast) var(--ease); }
.legend-item .value { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.legend-item[aria-pressed="false"] { color: var(--ink-3); border-style: dashed; }
.legend-item[aria-pressed="false"] .swatch { background: transparent; box-shadow: inset 0 0 0 1.5px var(--c); }
.legend.static .legend-item { cursor: default; background: none; border-color: transparent; padding: 0 4px; min-height: 0; }
.legend.static .legend-item:hover { background: none; }

.chart { position: relative; min-width: 0; }
.chart svg { display: block; max-width: 100%; overflow: visible; touch-action: pan-y; -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; }
.chart svg:focus-visible { outline: 3px solid var(--accent); outline-offset: 6px; border-radius: var(--r-sm); }
.chart .grid line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart text { fill: var(--ink-3); font-size: 11px; font-variant-numeric: tabular-nums; font-family: var(--font-sans); }
.chart .x-labels .today { fill: var(--ink-1); font-weight: 600; }
.chart .mark { fill: var(--c, var(--series-1)); }
.chart .col { transition: opacity 180ms var(--ease); }
.chart.intro .col .mark { transform-box: fill-box; transform-origin: 50% 100%; animation: rise 640ms var(--spring) both; }
@keyframes rise { from { transform: scaleY(0); } }
.chart .col.partial .mark { opacity: 0.55; }
.chart.selecting .col:not(.active) { opacity: 0.3; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .avg { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 4 3; shape-rendering: crispEdges; }
.chart .avg-pill { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1; }
.chart .avg-label { fill: var(--ink-2); font-weight: 600; }
.chart .peak { fill: var(--ink-2); font-weight: 600; }
.chart .line { fill: none; stroke: var(--c, var(--series-1)); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--c, var(--series-1)); opacity: 0.1; }
.chart .dot { fill: var(--c, var(--series-1)); stroke: var(--surface); stroke-width: 2; }
.chart .dot.partial { fill: var(--surface); stroke: var(--c, var(--series-1)); }
.chart .focus-dot { fill: var(--c, var(--series-1)); stroke: var(--surface); stroke-width: 2.5; pointer-events: none; }
.chart .crosshair { stroke: var(--axis); stroke-width: 1; pointer-events: none; shape-rendering: crispEdges; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 5; min-width: 176px; max-width: 290px; padding: 10px 12px 10px;
  background: var(--material-strong); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--material-edge); border-radius: var(--r-lg); box-shadow: var(--shadow-2); font-size: var(--fs-xs);
}
.tip-when { color: var(--ink-2); font-weight: 600; }
.tip-total { display: flex; align-items: baseline; gap: 5px; margin: 2px 0 6px; color: var(--ink-3); }
.tip-total strong { color: var(--ink-1); font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.tip-rows { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto auto; gap: 4px 8px; align-items: center; }
.tip-rows .name { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tip-rows .value { color: var(--ink-1); font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.tip-rows .pct { color: var(--ink-3); font-variant-numeric: tabular-nums; text-align: right; min-width: 38px; }
.tip-sub { color: var(--ink-3); margin-top: 7px; padding-top: 7px; border-top: 1px solid var(--line); }
.tip-row { display: flex; align-items: center; gap: 6px; color: var(--ink-2); }
.tip-row strong { color: var(--ink-1); font-size: var(--fs-md); font-variant-numeric: tabular-nums; }
.line-key { display: inline-block; width: 12px; height: 3px; border-radius: 2px; background: var(--c, var(--series-1)); }

/* Small multiples: one measure each, on its own axis. */
.multiples { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-5); }
.multiples.stacked { grid-template-columns: minmax(0, 1fr); }
.multiple { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.multiple-head { display: flex; align-items: baseline; gap: var(--sp-2); flex-wrap: wrap; }
.multiple-title { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }
.multiple-value { margin-left: auto; font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 650; font-variant-numeric: tabular-nums; }
.multiple-note { color: var(--ink-3); font-size: var(--fs-xs); }

/* Ranked rows: a name, its figures and a bar on one baseline. */
.rank { list-style: none; display: flex; flex-direction: column; gap: var(--sp-4); container-type: inline-size; }
.rank-row { display: grid; grid-template-columns: minmax(96px, 1fr) auto auto; align-items: center; column-gap: var(--sp-3); row-gap: 7px; }
/* A narrow list keeps the names and drops the trends. */
@container (max-width: 440px) { .rank-spark { display: none; } }
.rank-label { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rank-text { min-width: 0; }
.rank-name { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-sub { display: block; color: var(--ink-3); font-size: var(--fs-xs); }
.rank-spark { width: 88px; height: 26px; }
.rank-figures { text-align: right; white-space: nowrap; }
.rank-value { font-weight: 650; font-variant-numeric: tabular-nums; }
.rank-share { display: inline-block; min-width: 46px; color: var(--ink-3); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.rank-track { grid-column: 1 / -1; display: flex; height: 8px; border-radius: var(--r-full); background: var(--fill); overflow: hidden; }
.rank-track > i { display: block; height: 100%; background: var(--c, var(--series-1)); flex: none; }
.rank-track > i:last-child { border-radius: 0 4px 4px 0; }
.rank-row.muted .rank-name { color: var(--ink-2); }
.rank-row.muted .rank-track > i { --c: var(--series-other); }
.rank-glyph { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--fill); color: var(--ink-2); flex: none; }
.rank-glyph .icon { width: 16px; height: 16px; }

/* One whole split into its parts, as the storage bar does it. */
.segbar { display: flex; gap: 2px; height: 26px; border-radius: var(--r-sm); overflow: hidden; background: var(--fill); }
.segbar > i { display: block; height: 100%; background: var(--c); min-width: 3px; transition: opacity var(--t-fast) var(--ease); }
.segbar > i.rest { background: transparent; flex: 1; min-width: 0; }
@media (hover: hover) { .segbar:hover > i:not(:hover):not(.rest) { opacity: 0.45; } }
.segbar.thin { height: 10px; border-radius: var(--r-full); }
.seg-legend { list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px var(--sp-6); margin-top: var(--sp-4); }
.seg-legend.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.seg-legend li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; column-gap: var(--sp-2); row-gap: 1px; align-items: center; min-width: 0; }
.seg-legend .swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.seg-legend .name { color: var(--ink-2); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seg-legend .pct { color: var(--ink-3); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.seg-legend .value { grid-column: 2 / -1; font-weight: 650; font-size: 15px; font-variant-numeric: tabular-nums; }
.composition-head { display: flex; align-items: baseline; gap: var(--sp-2); flex-wrap: wrap; margin-bottom: var(--sp-3); }
.composition-head .figure { font-family: var(--font-display); font-size: var(--fs-2xl); font-weight: 650; letter-spacing: -0.02em; }
.composition-head .note { color: var(--ink-3); font-size: var(--fs-sm); }
.cache-rate { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px var(--sp-3); align-items: center; margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px solid var(--line); }
.cache-rate .label { color: var(--ink-2); font-size: var(--fs-sm); font-weight: 600; }
.cache-rate .value { font-weight: 650; font-variant-numeric: tabular-nums; }
.cache-rate .meter { grid-column: 1 / -1; }
.cache-rate .meter > i { background: var(--kind-cache-read); }
.cache-rate .help { grid-column: 1 / -1; color: var(--ink-3); font-size: var(--fs-xs); }

/* ---- lists */
.key-glyph { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--fill); color: var(--ink-2); flex: none; }
table.data td .sub.mono { font-size: 11.5px; }
table.data tr.failed-row td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
@media (max-width: 760px) { table.data tr.failed-row { box-shadow: inset 3px 0 0 var(--bad); } table.data tr.failed-row td:first-child { box-shadow: none; } }
.cell-key { display: inline-block; max-width: 200px; }
.usage-cell { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.meter.mini { width: 88px; height: 5px; }
.share-cell { display: inline-flex; align-items: center; gap: var(--sp-2); justify-content: flex-end; }
.share-cell .meter { display: inline-block; width: 48px; height: 5px; }
/* Where the usage table has no room to spare, the share is its figure alone. */
@media (max-width: 1500px) { .share-cell .meter { display: none; } }
.share-cell .meter > i { background: var(--series-1); }
.limits { display: flex; flex-direction: column; font-size: var(--fs-sm); white-space: nowrap; }
.tag.content-full, .tag.content-prompt { color: var(--accent-ink); background: var(--accent-wash); }
.tag.content-expired { color: var(--warn-ink); background: var(--warn-wash); }
.action { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.action-icon { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; background: var(--fill); color: var(--ink-2); flex: none; }
.action-icon .icon { width: 14px; height: 14px; }
.detail-text { display: inline-block; max-width: 420px; }
.address { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; padding: 10px 12px; background: var(--sunken); border-radius: var(--r-lg); }
.address code { font-size: 13px; }
.password-row .input-affix { flex: 1; min-width: 0; }
/* The balance before and after a change, side by side. */
.balance-preview { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); background: var(--fill); }
.balance-preview > .icon { color: var(--ink-3); flex: none; }
.balance-now { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.balance-now strong { font-size: var(--fs-lg); font-variant-numeric: tabular-nums; }
.level-help strong { color: var(--ink-1); font-weight: 600; margin-right: 4px; }
.key-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2) var(--sp-4); padding: 12px var(--sp-4); border-radius: var(--r-lg); background: var(--sunken); font-size: var(--fs-sm); }
.readable { color: var(--ink-1); font-weight: 600; }
.strength { margin-top: -8px; }
.strength:empty { display: none; }

/* ---- the request inspector */
.detail { display: flex; flex-direction: column; gap: var(--sp-6); }
.detail-hero { display: flex; flex-direction: column; gap: var(--sp-4); }
.detail-top { display: flex; align-items: center; gap: var(--sp-2) var(--sp-3); flex-wrap: wrap; }
.detail-top .status { font-size: var(--fs-sm); min-height: 26px; padding-right: 11px; }
.detail-top .status .sym { width: 16px; height: 16px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--sunken); border-radius: var(--r-lg); }
.metric { padding: 12px var(--sp-4); min-width: 0; }
.metric + .metric { box-shadow: inset 1px 0 0 var(--line); }
.metric-label { color: var(--ink-3); font-size: var(--fs-xs); font-weight: 600; }
.metric-value { font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 650; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.metric-value .figure-unit { font-size: 0.62em; }
.metric-note { color: var(--ink-3); font-size: var(--fs-xs); }
.detail-section > h3 { font-size: var(--fs-sm); color: var(--ink-2); margin-bottom: var(--sp-3); font-weight: 600; }
.token-total { font-size: var(--fs-md); color: var(--ink-2); }
.token-total strong { font-size: var(--fs-xl); color: var(--ink-1); }
.timing { display: flex; flex-direction: column; gap: var(--sp-2); }
.timing-track { display: flex; gap: 2px; height: 12px; border-radius: var(--r-full); overflow: hidden; background: var(--fill); }
.timing-track i { display: block; height: 100%; min-width: 3px; }
.timing-track .wait, .timing-legend .wait { background: var(--series-muted); }
.timing-track .stream, .timing-legend .stream { background: var(--series-1); }
.timing-axis { display: flex; justify-content: space-between; color: var(--ink-3); font-size: var(--fs-2xs); font-variant-numeric: tabular-nums; }
.timing-legend { display: flex; gap: var(--sp-2) var(--sp-5); flex-wrap: wrap; font-size: var(--fs-sm); color: var(--ink-2); }
.timing-legend .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---- the transcript */
.transcript { display: flex; flex-direction: column; gap: var(--sp-3); }
.raw-links { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: flex-start; }
.raw-links .fold { flex-basis: 100%; }
.turn { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; }
.turn-avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--fill); color: var(--ink-2); margin-top: 4px; }
.turn.assistant .turn-avatar { background: linear-gradient(160deg, var(--brand-a), var(--brand-b)); color: #fff; }
.turn.user:not(.results) .turn-avatar { background: linear-gradient(180deg, #a5abb8, #858994); color: #fff; }
.turn-main { min-width: 0; border-radius: var(--r-xl); background: var(--sunken); }
.turn.assistant .turn-main { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
dialog .turn.assistant .turn-main { background: var(--raised); }
.turn.user:not(.results) .turn-main { background: var(--accent-wash); }
.turn.highlight .turn-main { box-shadow: inset 0 0 0 1.5px var(--accent), 0 0 0 4px var(--accent-wash); }
.turn.results .turn-main { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.turn-head { display: flex; align-items: center; gap: var(--sp-2); padding: 6px 6px 0 var(--sp-4); font-size: var(--fs-xs); min-height: 34px; }
.turn-role { font-weight: 600; color: var(--ink-2); }
.turn-head .copy { opacity: 0.6; }
.turn:hover .turn-head .copy, .turn-head .copy:focus-visible { opacity: 1; }
.turn-body { padding: 2px var(--sp-4) var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-2); }
.prose { display: flex; flex-direction: column; gap: var(--sp-2); }
.prose p { white-space: pre-wrap; word-break: break-word; line-height: 1.7; }
.code-block {
  margin: 0; padding: 12px var(--sp-4); border-radius: var(--r-md); background: var(--sunken); box-shadow: inset 0 0 0 1px var(--line);
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; max-height: 520px; overflow: auto;
}
.fold-toggle { align-self: flex-start; margin-top: var(--sp-1); }
.fold { border-radius: var(--r-md); background: var(--fill); }
.fold > summary {
  list-style: none; display: flex; align-items: center; gap: var(--sp-2); padding: 7px var(--sp-3); cursor: pointer;
  font-size: var(--fs-sm); border-radius: var(--r-md); min-width: 0;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary:hover { background: var(--hover); }
.fold > summary:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.fold .chevron { transition: transform var(--t-fast) var(--ease); color: var(--ink-3); }
.fold[open] > summary .chevron { transform: rotate(90deg); }
.fold-title { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; min-width: 0; }
.fold-title code { font-size: 12px; padding: 1px 6px; border-radius: var(--r-xs); background: var(--fill); }
.fold-title .icon { color: var(--ink-3); }
.fold .gist { color: var(--ink-3); font-family: var(--font-mono); font-size: 12px; font-weight: 400; margin-left: 4px; max-width: 420px; }
.fold-body { padding: 0 var(--sp-3) var(--sp-3); }
.fold.quiet { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.fold.thinking .fold-body .prose p { color: var(--ink-2); font-style: italic; }
.fold.tool-result.error { box-shadow: inset 0 0 0 1px var(--bad); }
.fold.inline { display: inline-block; flex-basis: auto !important; }
/* Closed beside the two capsule buttons, the headers fold is a capsule of
   their height and fill; open, it takes the whole row. */
.fold.inline:not([open]) { background: var(--fill); box-shadow: none; border-radius: var(--r-full); }
.fold.inline:not([open]) > summary { height: 28px; padding: 0 12px 0 9px; border-radius: inherit; }
.fold.inline[open] { display: block; flex-basis: 100% !important; }
.chip-line { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--ink-2); }

/* ---- the conversation viewer */
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(0, 2fr); background: var(--sunken); border-radius: var(--r-lg); }
.fact { padding: 12px var(--sp-4); min-width: 0; }
.fact + .fact { box-shadow: inset 1px 0 0 var(--line); }
.fact-label { color: var(--ink-3); font-size: var(--fs-xs); font-weight: 600; }
.fact-value { font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 650; font-variant-numeric: tabular-nums; }
.fact-note { color: var(--ink-3); font-size: var(--fs-xs); }
.thread-meta { display: flex; gap: var(--sp-4); flex-wrap: wrap; font-size: var(--fs-sm); color: var(--ink-2); align-items: center; }
.thread-meta > * { display: inline-flex; align-items: center; gap: 5px; }
.thread-meta .icon { color: var(--ink-3); }

/* ---- settings */
.level-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--sp-3); }
.level-card {
  position: relative; display: flex; flex-direction: column; gap: var(--sp-2); text-align: left; padding: var(--sp-4); border-radius: var(--r-xl);
  border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; color: var(--ink-1); font: inherit;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), background var(--t-fast) var(--ease), transform 120ms var(--ease);
}
.level-card:hover { border-color: var(--ink-3); }
.level-card:active { transform: scale(0.99); }
.level-card:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.level-card.selected { border-color: var(--accent); background: var(--accent-wash); box-shadow: inset 0 0 0 1px var(--accent); }
.level-top { display: flex; align-items: center; gap: var(--sp-2); min-height: 28px; }
.level-glyph { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--fill); color: var(--ink-2); }
.level-card.selected .level-glyph { background: var(--accent-fill); color: #fff; }
.level-step { color: var(--ink-3); font-size: var(--fs-xs); white-space: nowrap; }
/* A radio mark in the corner, filled for the chosen card. */
.level-radio {
  margin-left: auto; width: 20px; height: 20px; border-radius: 50%; flex: none; display: grid; place-items: center;
  box-shadow: inset 0 0 0 1.5px var(--control-border); color: #fff;
}
.level-radio .icon { width: 12px; height: 12px; stroke-width: 3; visibility: hidden; }
.level-card.selected .level-radio { background: var(--accent-fill); box-shadow: none; }
.level-card.selected .level-radio .icon { visibility: visible; }
/* The current default is marked on the card's edge, out of the way of the
   step: five cards side by side leave no room for both on one line. */
.level-top .tag { position: absolute; top: -11px; left: 14px; background: var(--accent-fill); color: var(--ink-on-accent); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12); }
.level-name { font-weight: 600; line-height: 1.35; }
.level-text { color: var(--ink-2); font-size: var(--fs-xs); line-height: 1.6; flex: 1; }
.level-keeps { list-style: none; display: flex; flex-direction: column; gap: 3px; font-size: var(--fs-xs); border-top: 1px solid var(--line); padding-top: var(--sp-2); }
.level-keeps li { display: flex; gap: 6px; align-items: center; }
.level-keeps .mark { width: 14px; height: 14px; display: grid; place-items: center; flex: none; }
.level-keeps .mark .sym { width: 13px; height: 13px; }
.level-keeps .kept { color: var(--ink-1); }
.level-keeps .kept .mark { color: var(--good); }
.level-keeps .dropped { color: var(--ink-3); }
.level-keeps .dropped .mark { color: var(--off); }
.save-bar { display: flex; align-items: center; gap: var(--sp-3); padding: 12px 12px 12px var(--sp-4); border-radius: var(--r-lg); background: var(--accent-wash); flex-wrap: wrap; }
.save-bar > .icon { color: var(--accent-ink); }
.order { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.order-step { display: flex; gap: var(--sp-3); align-items: center; padding: 12px var(--sp-4); border-radius: var(--r-lg); background: var(--sunken); flex: 1; min-width: 180px; }
.order-glyph { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-wash); color: var(--accent-ink); flex: none; }
.order-arrow { color: var(--ink-3); }
.retention-row { display: flex; align-items: flex-end; gap: var(--sp-3); flex-wrap: wrap; }
.retention-row .field { width: 160px; }
/* The presets and the button stand as tall as the field beside them. */
.retention-row > .seg button { height: 32px; }
.retention-row > .btn { height: 36px; }
.runtime-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3); }
.runtime { padding: var(--sp-4); border-radius: var(--r-lg); background: var(--sunken); display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.runtime.disk { grid-column: span 2; }
.runtime.alert { box-shadow: inset 0 0 0 1.5px var(--bad); }
.runtime-label { display: flex; align-items: center; gap: var(--sp-2); color: var(--ink-2); font-size: var(--fs-sm); font-weight: 600; }
.runtime-label .icon { color: var(--ink-3); }
.runtime-value { font-size: var(--fs-lg); font-weight: 650; min-width: 0; }
.runtime-note { color: var(--ink-3); font-size: var(--fs-xs); }
.runtime .seg-legend { margin-top: var(--sp-2); grid-template-columns: repeat(3, minmax(0, 1fr)); }
.runtime .seg-legend .value { font-size: var(--fs-md); }
.disk-used { --c: var(--slot-4); }
.disk-capture { --c: var(--slot-1); }
.disk-free { --c: var(--fill); }
.seg-legend .disk-free .swatch { box-shadow: inset 0 0 0 1px var(--line-strong); }

/* ---- account */
.profile-body { display: flex; align-items: center; gap: var(--sp-5); flex-wrap: wrap; }
.profile-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.profile-name { font-family: var(--font-display); font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -0.02em; }

@media (max-width: 1280px) {
  .tiles.five { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* Three tiles to a row leave a figure with a unit, such as 7.8 万 Token, no
   room for one line once the window is narrower than this. */
@media (max-width: 900px) {
  .tiles.five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1200px) {
  .level-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .multiples { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1100px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .runtime-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .runtime.disk { grid-column: span 2; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts .fact.id { grid-column: span 2; }
  .facts .fact:nth-child(odd) { box-shadow: none; }
  .facts .fact:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .seg-legend.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  /* On a phone the tooltip is compact, so it leaves the columns in view. */
  .chart-tip { min-width: 0; max-width: 210px; padding: 8px 10px; }
  .tip-rows { grid-template-columns: 12px minmax(0, 1fr) auto; }
  .tip-rows .pct { display: none; }
  .login-page { justify-content: flex-start; padding-top: var(--sp-9); }
  .login-card { padding: 30px 22px 22px; border-radius: 24px; }
  .login-points { display: none; }
  .tiles, .tiles.five { gap: var(--sp-3); grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile { padding: var(--sp-3) 14px 12px; min-height: 128px; border-radius: var(--r-lg); }
  .tile-value { font-size: 24px; margin-top: 6px; }
  .tile-value .status { font-size: var(--fs-sm); }
  .tile-label { font-size: var(--fs-xs); }
  .tile-trend .spark-holder { height: 26px; }
  .level-cards, .runtime-grid { grid-template-columns: minmax(0, 1fr); }
  .runtime.disk { grid-column: auto; }
  .runtime .seg-legend { grid-template-columns: minmax(0, 1fr); }
  .seg-legend, .seg-legend.four { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px var(--sp-4); }
  .order-arrow { display: none; }
  .turn { grid-template-columns: minmax(0, 1fr); }
  .turn-avatar { display: none; }
  .key-facts { grid-template-columns: minmax(0, 1fr); }
  .usage-cell { align-items: flex-end; }
  table.data.reflow .limits { align-items: flex-end; text-align: right; }
  table.data.reflow .limits .sub { margin: 0; }
  /* The six presets take a line of their own and share it; with the
     usual padding they would not fit on one. */
  .retention-row > .seg { display: flex; width: 100%; }
  .retention-row > .seg button { height: 36px; flex: 1 1 auto; padding: 0 8px; }
  .retention-row > .btn { height: 40px; }
  .rank-spark { display: none; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric:nth-child(3) { box-shadow: none; }
  .metric:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .legend-item { min-height: 36px; }
  .chart-summary { gap: var(--sp-2) var(--sp-5); }
  .link-button { min-height: 36px; padding: 0 var(--sp-2); }
}

/* 上游服务: the address of the upstream's own view breaks anywhere on a phone. */
.view-address { overflow-wrap: anywhere; }

/* The price table: one row per model, a price field per kind of token. It
   scrolls sideways rather than squeezing the fields on a narrow screen. */
.price-table { overflow-x: auto; margin: 0 calc(-1 * var(--sp-2)); }
.price-table table.data { min-width: 680px; }
.price-table .price-input { width: 100%; min-width: 180px; }
.price-cell { display: inline-flex; width: 112px; vertical-align: middle; }
.price-cell > input.price-input { width: 100%; min-width: 0; padding-right: 10px; text-align: right; font-variant-numeric: tabular-nums; }
.limits .balance-line { display: block; margin-top: 2px; font-size: var(--fs-sm); white-space: nowrap; }
.limits .balance-line .status { font-size: inherit; }

/* ---- the key's own page (/key): one column, no navigation */
.key-page { min-height: 100vh; min-height: 100dvh; background: var(--page); }
.key-top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) max(var(--sp-5), calc((100% - 1120px) / 2 + var(--sp-5)));
  background: var(--material); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.key-main { max-width: 1120px; margin: 0 auto; padding: var(--sp-6) var(--sp-5) var(--sp-8); }
.key-glyph {
  width: 52px; height: 52px; border-radius: 13px; flex: none; display: grid; place-items: center; color: #fff;
  background: linear-gradient(180deg, color-mix(in srgb, var(--tone-orange) 76%, #fff), var(--tone-orange));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 8px 18px -10px var(--tone-orange);
}
.key-glyph .icon { width: 28px; height: 28px; stroke-width: 1.8; }
.key-meta { display: flex; flex-direction: column; gap: 2px; text-align: right; }
.key-foot { text-align: center; }
@media (max-width: 700px) {
  .key-meta { text-align: left; flex-basis: 100%; }
  .key-page .profile-name { font-size: var(--fs-xl); }
  .key-top .btn { padding-left: 10px; padding-right: 10px; }
}
