dsh-spend-ledger 1.2.2 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +8 -8
  3. package/client.js +1924 -584
  4. package/package.json +1 -1
package/client.js CHANGED
@@ -22,7 +22,6 @@ window.__ModuleLoader__.load({
22
22
  retained: '含已删除会话 {n} 个 · 已保留 {tokens}',
23
23
  dayRetained: '其中已删除会话 {n} 个 · {tokens}',
24
24
  tokens: 'tokens',
25
- budget: '预算',
26
25
  heatmap: '每日用量热力图',
27
26
  heatmapHint: '点击色块查看当天明细',
28
27
  legendLow: '低',
@@ -60,7 +59,6 @@ window.__ModuleLoader__.load({
60
59
  nextDay: '后一天',
61
60
  latestDay: '最近一天',
62
61
  balanceTitle: '余额与峰谷',
63
- rechargeBalance: '充值余额',
64
62
  bonusBalance: '赠金',
65
63
  balanceLoading: '加载中…',
66
64
  balanceSignedOut: '登录后显示余额',
@@ -82,7 +80,6 @@ window.__ModuleLoader__.load({
82
80
  peakNowLabel: '现在',
83
81
  peakWindowsLabel: '高峰',
84
82
  peakNextLabel: '下一次切换',
85
- todayHint: '今天(本地日历日)所有会话的全部 token 用量;与「花费」页同源',
86
83
  lowBalanceTitle: '余额偏低',
87
84
  lowBalanceBody: '当前 {balance},低于设定的 {threshold}。',
88
85
  lowBalanceTopUp: '充值',
@@ -106,6 +103,24 @@ window.__ModuleLoader__.load({
106
103
  priceOutput: '输出',
107
104
  priceSource: '官方价 {date}',
108
105
  holidayUncovered: '节假日表未覆盖当前年份',
106
+ accountTitle: '账户',
107
+ dailyBudget: '日预算',
108
+ budgetUsed: '已用 {pct}',
109
+ trendAvg: '日均 {tokens}',
110
+ metricTotal: '总用量',
111
+ metricOutput: '输出',
112
+ metricCache: '缓存',
113
+ metricCalls: '请求',
114
+ settingsTip: '查看官方价格与低余额提醒',
115
+ lowAlertOn: '低于 ¥{n} 提醒',
116
+ lowAlertOff: '未开启',
117
+ peakPeriodLabel: '当前时段',
118
+ refreshingShort: '后台更新中…',
119
+ todayCallsCount: '今日 {n} 次请求',
120
+ priceHitShort: '命中',
121
+ priceMissShort: '未命中',
122
+ peakWindowShort: '09–12 / 14–18 高峰',
123
+ todayUsedShort: '今日已用 {tokens}',
109
124
  },
110
125
  en: {
111
126
  nav: 'Spend',
@@ -122,7 +137,6 @@ window.__ModuleLoader__.load({
122
137
  retained: 'includes {n} deleted sessions · {tokens} retained',
123
138
  dayRetained: '{n} deleted sessions · {tokens}',
124
139
  tokens: 'tokens',
125
- budget: 'Budget',
126
140
  heatmap: 'Daily usage heatmap',
127
141
  heatmapHint: 'Click a cell for its detail',
128
142
  legendLow: 'Low',
@@ -160,7 +174,6 @@ window.__ModuleLoader__.load({
160
174
  nextDay: 'Next day',
161
175
  latestDay: 'Latest day',
162
176
  balanceTitle: 'Balance & peak hours',
163
- rechargeBalance: 'Topped-up balance',
164
177
  bonusBalance: 'Granted',
165
178
  balanceLoading: 'Loading…',
166
179
  balanceSignedOut: 'Sign in to view balance',
@@ -182,7 +195,6 @@ window.__ModuleLoader__.load({
182
195
  peakNowLabel: 'Now',
183
196
  peakWindowsLabel: 'Peak',
184
197
  peakNextLabel: 'Next switch',
185
- todayHint: 'All tokens used today (local calendar day) across every session; same source as the Spend page',
186
198
  lowBalanceTitle: 'Low balance',
187
199
  lowBalanceBody: 'Currently {balance}, below your {threshold} threshold.',
188
200
  lowBalanceTopUp: 'Top up',
@@ -206,349 +218,1394 @@ window.__ModuleLoader__.load({
206
218
  priceOutput: 'Output',
207
219
  priceSource: 'Official pricing {date}',
208
220
  holidayUncovered: 'holiday table does not cover the current year',
221
+ accountTitle: 'Account',
222
+ dailyBudget: 'Daily budget',
223
+ budgetUsed: '{pct} used',
224
+ trendAvg: 'Avg {tokens}/d',
225
+ metricTotal: 'All',
226
+ metricOutput: 'Output',
227
+ metricCache: 'Cache',
228
+ metricCalls: 'Calls',
229
+ settingsTip: 'Official pricing & low-balance alert',
230
+ lowAlertOn: 'Below ¥{n}',
231
+ lowAlertOff: 'Off',
232
+ peakPeriodLabel: 'Current tariff',
233
+ refreshingShort: 'Refreshing…',
234
+ todayCallsCount: '{n} requests today',
235
+ priceHitShort: 'Hit',
236
+ priceMissShort: 'Miss',
237
+ peakWindowShort: 'Peak 09–12 / 14–18',
238
+ todayUsedShort: 'Today {tokens}',
209
239
  },
210
240
  };
211
241
 
212
242
  const css = `
213
- .ts-page { display: flex; flex-direction: column; gap: 16px; padding: 4px 4px 28px; color: var(--dsw-alias-label-primary); font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
214
- .ts-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 0 2px; }
215
- .ts-title { font-size: 21px; font-weight: 600; letter-spacing: -0.015em; }
216
- .ts-toolbar { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
217
- .ts-btn { height: 30px; padding: 0 13px; border-radius: 9px; border: 1px solid var(--dsw-alias-border-l1); background: var(--dsw-alias-bg-layer-1); color: var(--dsw-alias-label-primary); font-size: 12.5px; font-family: inherit; cursor: pointer; transition: background 120ms ease, border-color 120ms ease; }
218
- .ts-btn:hover:not(:disabled) { background: var(--dsw-alias-bg-layer-2); }
219
- .ts-btn:active:not(:disabled) { transform: scale(0.98); }
220
- .ts-btn:disabled { opacity: 0.4; cursor: default; }
221
- .ts-icon-btn { width: 28px; height: 28px; padding: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; line-height: 1; border-radius: 9px; }
222
- .ts-card { border: 1px solid var(--dsw-alias-border-l1); border-radius: 16px; background: var(--dsw-alias-bg-layer-1); overflow: hidden; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06); }
223
-
224
- /* Hero: four equal cells on one row; they never wrap into a lonely second row. */
225
- .ts-hero { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
226
- .ts-hero-cell { padding: 16px 18px; min-width: 0; overflow: hidden; }
227
- .ts-hero-cell + .ts-hero-cell { border-left: 1px solid var(--dsw-alias-border-l1); }
228
- .ts-hero-label { font-size: 11.5px; color: var(--dsw-alias-label-secondary); letter-spacing: 0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
229
- .ts-hero-value { font-size: 25px; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; margin-top: 6px; white-space: nowrap; }
230
- .ts-hero-note { font-size: 11px; color: var(--dsw-alias-label-tertiary); margin-top: 6px; white-space: normal; line-height: 1.4; font-variant-numeric: tabular-nums; }
231
- .ts-hero-delta { font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
232
- .ts-bar { height: 6px; border-radius: 999px; background: var(--dsw-alias-bg-layer-2); margin-top: 10px; overflow: hidden; }
233
- .ts-bar-fill { height: 100%; border-radius: 999px; background: var(--dsw-alias-brand-primary); transition: width 320ms cubic-bezier(0.25, 0.1, 0.25, 1); }
234
- .ts-grade-line { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
235
- .ts-grade-badge { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 600; letter-spacing: -0.02em; color: var(--dsw-alias-label-primary-inverted, #fff); }
236
- .ts-grade-text { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
237
-
238
- /* Section headers keep the actions on the same line, so no vertical slack. */
239
- .ts-section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; padding: 16px 20px 6px; flex-wrap: wrap; }
240
- .ts-section-title { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
241
- .ts-section-hint { font-size: 11.5px; color: var(--dsw-alias-label-secondary); margin-top: 4px; }
242
- .ts-legend { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
243
- .ts-legend-item { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--dsw-alias-label-secondary); white-space: nowrap; }
244
- .ts-legend-swatch { width: 12px; height: 12px; border-radius: 4px; flex: none; }
245
-
246
- .ts-heat-body { padding: 6px 20px 14px; }
247
- .ts-months { display: grid; gap: 4px; margin-left: 26px; height: 15px; font-size: 10px; color: var(--dsw-alias-label-tertiary); }
248
- .ts-month { white-space: nowrap; }
249
- .ts-heat { position: relative; display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 6px; align-items: start; }
250
- .ts-weekdays { display: grid; grid-template-rows: repeat(7, minmax(0, 1fr)); gap: 4px; font-size: 10px; color: var(--dsw-alias-label-tertiary); align-items: center; }
251
- .ts-grid { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; }
252
- .ts-col { display: grid; grid-template-rows: repeat(7, auto); gap: 4px; }
253
- .ts-cell { position: relative; color: var(--dsw-alias-label-primary); width: 100%; aspect-ratio: 1 / 1; border-radius: 7px; border: 1px solid transparent; padding: 0; cursor: pointer; transition: transform 140ms cubic-bezier(0.25, 0.1, 0.25, 1), box-shadow 140ms ease, filter 140ms ease; will-change: transform; }
254
- .ts-cell:hover:not(:disabled) { transform: translateY(-1px) scale(1.05); filter: brightness(1.08); z-index: 2; }
255
- .ts-cell:active:not(:disabled) { transform: translateY(0) scale(0.97); }
243
+ /* ==========================================================================
244
+ 花费 · Apple Liquid Glass Bento UI (双主题自适应:深色 / 浅色)
245
+ 宿主切主题靠 body[data-ds-dark-theme]:
246
+ - 深色写在 .ts-page / body[data-ds-dark-theme] .ts-page
247
+ - 浅色写在 body:not([data-ds-dark-theme]) .ts-page
248
+ ========================================================================== */
249
+ .ts-page,
250
+ body[data-ds-dark-theme] .ts-page {
251
+ --ts-card-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.058) 0%, rgba(255, 255, 255, 0.02) 100%), color-mix(in srgb, var(--dsw-alias-bg-layer-1) 86%, #0b0c10);
252
+ --ts-card-border: rgba(255, 255, 255, 0.11);
253
+ --ts-card-sheen: inset 0 1px 0 rgba(255, 255, 255, 0.12), inset 0 -1px 0 rgba(0, 0, 0, 0.24);
254
+ --ts-card-shadow: 0 10px 30px rgba(0, 0, 0, 0.24), 0 1px 2px rgba(0, 0, 0, 0.22);
255
+ --ts-divider: rgba(255, 255, 255, 0.085);
256
+ --ts-surface-subtle: rgba(255, 255, 255, 0.045);
257
+ --ts-surface-hover: rgba(255, 255, 255, 0.08);
258
+ --ts-pill-bg: rgba(255, 255, 255, 0.075);
259
+ --ts-pill-bg-hover: rgba(255, 255, 255, 0.14);
260
+ --ts-pill-active-bg: rgba(255, 255, 255, 0.22);
261
+ --ts-pill-border: rgba(255, 255, 255, 0.13);
262
+ --ts-pill-active-border: rgba(255, 255, 255, 0.25);
263
+ --ts-pill-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 2px 8px rgba(0, 0, 0, 0.20);
264
+ --ts-track-bg: rgba(255, 255, 255, 0.11);
265
+ --ts-rail-bg: rgba(255, 255, 255, 0.13);
266
+ --ts-bar-idle: rgba(255, 255, 255, 0.15);
267
+ --ts-bar-hi: rgba(255, 255, 255, 0.90);
268
+ --ts-bar-on: #54a6ff;
269
+ --ts-bar-on-glow: rgba(84, 166, 255, 0.42);
270
+ --ts-green: #30d158;
271
+ --ts-green-hi: #42e868;
272
+ --ts-green-soft: rgba(48, 209, 88, 0.15);
273
+ --ts-green-glow: rgba(48, 209, 88, 0.36);
274
+ --ts-blue: #4da3ff;
275
+ --ts-blue-soft: rgba(77, 163, 255, 0.16);
276
+ --ts-cyan: #5ac8fa;
277
+ --ts-indigo: #7d7aff;
278
+ --ts-amber: #ff9f0a;
279
+ --ts-amber-soft: rgba(255, 159, 10, 0.16);
280
+ --ts-red: #ff453a;
281
+ --ts-red-soft: rgba(255, 69, 58, 0.16);
282
+ --ts-emblem-bg: linear-gradient(145deg, rgba(255, 255, 255, 0.94) 0%, rgba(215, 223, 235, 0.86) 100%);
283
+ --ts-emblem-fg: #1d222c;
284
+ --ts-emblem-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), 0 4px 14px rgba(0, 0, 0, 0.32);
285
+ --ts-tip-bg: color-mix(in srgb, var(--dsw-alias-bg-overlay, #1b1d23) 90%, #0d0e12);
286
+ --ts-tip-border: rgba(255, 255, 255, 0.14);
287
+ --ts-tip-shadow: 0 14px 34px rgba(0, 0, 0, 0.44), inset 0 1px 0 rgba(255, 255, 255, 0.12);
288
+ --ts-input-bg: rgba(255, 255, 255, 0.055);
289
+ --ts-input-bg-focus: rgba(255, 255, 255, 0.085);
290
+ }
291
+
292
+ body:not([data-ds-dark-theme]) .ts-page {
293
+ --ts-card-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(248, 250, 253, 0.88) 100%), var(--dsw-alias-bg-layer-1);
294
+ --ts-card-border: rgba(15, 23, 42, 0.085);
295
+ --ts-card-sheen: inset 0 1px 0 rgba(255, 255, 255, 0.96);
296
+ --ts-card-shadow: 0 6px 22px rgba(15, 23, 42, 0.045), 0 1px 3px rgba(15, 23, 42, 0.04);
297
+ --ts-divider: rgba(15, 23, 42, 0.075);
298
+ --ts-surface-subtle: rgba(15, 23, 42, 0.032);
299
+ --ts-surface-hover: rgba(15, 23, 42, 0.055);
300
+ --ts-pill-bg: rgba(15, 23, 42, 0.048);
301
+ --ts-pill-bg-hover: rgba(15, 23, 42, 0.085);
302
+ --ts-pill-active-bg: #ffffff;
303
+ --ts-pill-border: rgba(15, 23, 42, 0.085);
304
+ --ts-pill-active-border: rgba(15, 23, 42, 0.13);
305
+ --ts-pill-shadow: 0 2px 7px rgba(15, 23, 42, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.95);
306
+ --ts-track-bg: rgba(15, 23, 42, 0.085);
307
+ --ts-rail-bg: rgba(15, 23, 42, 0.09);
308
+ --ts-bar-idle: rgba(15, 23, 42, 0.10);
309
+ --ts-bar-hi: rgba(15, 23, 42, 0.68);
310
+ --ts-bar-on: #007aff;
311
+ --ts-bar-on-glow: rgba(0, 122, 255, 0.25);
312
+ --ts-green: #28cd41;
313
+ --ts-green-hi: #34d94d;
314
+ --ts-green-soft: rgba(40, 205, 65, 0.12);
315
+ --ts-green-glow: rgba(40, 205, 65, 0.24);
316
+ --ts-blue: #007aff;
317
+ --ts-blue-soft: rgba(0, 122, 255, 0.11);
318
+ --ts-cyan: #32ade6;
319
+ --ts-indigo: #5856d6;
320
+ --ts-amber: #ff9500;
321
+ --ts-amber-soft: rgba(255, 149, 0, 0.13);
322
+ --ts-red: #ff3b30;
323
+ --ts-red-soft: rgba(255, 59, 48, 0.11);
324
+ --ts-emblem-bg: linear-gradient(145deg, #f5f7fb 0%, #e5eaf3 100%);
325
+ --ts-emblem-fg: #1d2433;
326
+ --ts-emblem-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), 0 2px 8px rgba(15, 23, 42, 0.08);
327
+ --ts-tip-bg: rgba(255, 255, 255, 0.94);
328
+ --ts-tip-border: rgba(15, 23, 42, 0.10);
329
+ --ts-tip-shadow: 0 12px 30px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.06);
330
+ --ts-input-bg: rgba(15, 23, 42, 0.036);
331
+ --ts-input-bg-focus: #ffffff;
332
+ }
333
+
334
+ @keyframes ts-spin {
335
+ from { transform: rotate(0deg); }
336
+ to { transform: rotate(360deg); }
337
+ }
338
+
339
+ @keyframes ts-pulse-ring {
340
+ 0% { box-shadow: var(--ts-card-sheen), var(--ts-card-shadow), 0 0 0 0 rgba(77, 163, 255, 0.45); }
341
+ 65% { box-shadow: var(--ts-card-sheen), var(--ts-card-shadow), 0 0 0 4px rgba(77, 163, 255, 0.18); }
342
+ 100% { box-shadow: var(--ts-card-sheen), var(--ts-card-shadow), 0 0 0 0 rgba(77, 163, 255, 0); }
343
+ }
344
+
345
+ .ts-page {
346
+ container-type: inline-size;
347
+ container-name: ts-page;
348
+ display: flex;
349
+ flex-direction: column;
350
+ gap: 14px;
351
+ padding: 6px 4px 32px;
352
+ color: var(--dsw-alias-label-primary);
353
+ font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
354
+ -webkit-font-smoothing: antialiased;
355
+ }
356
+
357
+ /* 宿主主题若全局设了 corner-shape: squircle,显式保住真圆形和真胶囊形 */
358
+ .ts-btn,
359
+ .ts-circle-btn,
360
+ .ts-circle-dot,
361
+ .ts-bar,
362
+ .ts-bar-fill,
363
+ .ts-grade-pill,
364
+ .ts-account-stale,
365
+ .ts-trend-col,
366
+ .ts-trend-bar,
367
+ .ts-trend-rail,
368
+ .ts-heat-rail,
369
+ .ts-seg,
370
+ .ts-seg-btn,
371
+ .ts-stepper,
372
+ .ts-step-btn,
373
+ .ts-detail-retained,
374
+ .ts-comp-bar,
375
+ .ts-comp-dot,
376
+ .ts-model-track,
377
+ .ts-model-fill,
378
+ .ts-session-model,
379
+ .ts-util-chip,
380
+ .ts-low-silent,
381
+ .ts-spinner,
382
+ .ts-tl-cell,
383
+ .ts-tl-mark,
384
+ .tsb-badge::before,
385
+ .tsb-dot,
386
+ .tsb-low-action {
387
+ corner-shape: round;
388
+ }
389
+
390
+ /* ---------- 顶部栏:极简标题 + 圆形毛玻璃操作键 ---------- */
391
+ .ts-head {
392
+ display: flex;
393
+ align-items: center;
394
+ justify-content: space-between;
395
+ gap: 12px;
396
+ padding: 2px 2px 4px;
397
+ flex-wrap: wrap;
398
+ }
399
+ .ts-title {
400
+ font-size: 22px;
401
+ font-weight: 650;
402
+ letter-spacing: -0.025em;
403
+ line-height: 1.2;
404
+ }
405
+
406
+ .ts-toolbar {
407
+ display: flex;
408
+ align-items: center;
409
+ gap: 8px;
410
+ flex-shrink: 0;
411
+ }
412
+ .ts-status {
413
+ font-size: 11.5px;
414
+ color: var(--dsw-alias-label-tertiary);
415
+ text-align: right;
416
+ line-height: 1.35;
417
+ font-variant-numeric: tabular-nums;
418
+ white-space: nowrap;
419
+ }
420
+ .ts-status-banner {
421
+ padding: 10px 14px;
422
+ border-radius: 14px;
423
+ border: 1px solid color-mix(in srgb, var(--ts-red) 32%, transparent);
424
+ background: var(--ts-red-soft);
425
+ color: var(--ts-red);
426
+ font-size: 12px;
427
+ line-height: 1.45;
428
+ }
429
+
430
+ /* 圆形与胶囊玻璃按钮 */
431
+ .ts-btn {
432
+ display: inline-flex;
433
+ align-items: center;
434
+ justify-content: center;
435
+ gap: 5px;
436
+ height: 30px;
437
+ padding: 0 13px;
438
+ border-radius: 999px;
439
+ border: 1px solid var(--ts-pill-border);
440
+ background: var(--ts-pill-bg);
441
+ color: var(--dsw-alias-label-primary);
442
+ font-size: 12px;
443
+ font-weight: 500;
444
+ font-family: inherit;
445
+ cursor: pointer;
446
+ box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
447
+ transition: background 140ms ease, border-color 140ms ease, transform 120ms cubic-bezier(0.25, 0.1, 0.25, 1);
448
+ }
449
+ .ts-btn:hover:not(:disabled) {
450
+ background: var(--ts-pill-bg-hover);
451
+ border-color: var(--ts-pill-active-border);
452
+ }
453
+ .ts-btn:active:not(:disabled) { transform: scale(0.96); }
454
+ .ts-btn:disabled { opacity: 0.36; cursor: default; }
455
+
456
+ .ts-circle-btn {
457
+ position: relative;
458
+ width: 32px;
459
+ height: 32px;
460
+ padding: 0;
461
+ border-radius: 999px;
462
+ border: 1px solid var(--ts-pill-border);
463
+ background: var(--ts-pill-bg);
464
+ color: var(--dsw-alias-label-primary);
465
+ display: inline-flex;
466
+ align-items: center;
467
+ justify-content: center;
468
+ cursor: pointer;
469
+ box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10);
470
+ transition: background 140ms ease, border-color 140ms ease, transform 120ms ease;
471
+ }
472
+ .ts-circle-btn:hover:not(:disabled) {
473
+ background: var(--ts-pill-bg-hover);
474
+ border-color: var(--ts-pill-active-border);
475
+ }
476
+ .ts-circle-btn:active:not(:disabled) { transform: scale(0.94); }
477
+ .ts-circle-btn:disabled { opacity: 0.4; cursor: default; }
478
+ .ts-circle-btn svg { width: 15px; height: 15px; display: block; }
479
+ .ts-circle-btn-spin svg { animation: ts-spin 0.85s linear infinite; }
480
+ .ts-circle-dot {
481
+ position: absolute;
482
+ top: 5px;
483
+ right: 5px;
484
+ width: 6px;
485
+ height: 6px;
486
+ border-radius: 50%;
487
+ background: var(--ts-amber);
488
+ box-shadow: 0 0 0 1.5px var(--dsw-alias-bg-layer-1);
489
+ }
490
+
491
+ /* ---------- Bento 毛玻璃圆角卡片 ---------- */
492
+ .ts-card {
493
+ border: 1px solid var(--ts-card-border);
494
+ border-radius: 22px;
495
+ background: var(--ts-card-bg);
496
+ backdrop-filter: blur(22px) saturate(150%);
497
+ -webkit-backdrop-filter: blur(22px) saturate(150%);
498
+ box-shadow: var(--ts-card-sheen), var(--ts-card-shadow);
499
+ overflow: hidden;
500
+ transition: border-color 180ms ease;
501
+ }
502
+ .ts-card-pulse {
503
+ animation: ts-pulse-ring 1.1s ease-out;
504
+ }
505
+
506
+ /* ---------- Row 1: 非对称双列 Bento(左:今日与用量概览 / 右:账户与峰谷) ---------- */
507
+ .ts-bento-top {
508
+ display: grid;
509
+ grid-template-columns: minmax(0, 1.46fr) minmax(0, 1fr);
510
+ gap: 12px;
511
+ align-items: stretch;
512
+ }
513
+ .ts-bento-top-solo {
514
+ grid-template-columns: minmax(0, 1fr);
515
+ }
516
+
517
+ .ts-hero-main {
518
+ display: flex;
519
+ flex-direction: column;
520
+ justify-content: space-between;
521
+ padding: 18px 20px 16px;
522
+ gap: 14px;
523
+ }
524
+ .ts-hero-top {
525
+ display: flex;
526
+ flex-direction: column;
527
+ gap: 9px;
528
+ }
529
+ .ts-hero-kicker {
530
+ display: flex;
531
+ align-items: center;
532
+ justify-content: space-between;
533
+ gap: 10px;
534
+ font-size: 12.5px;
535
+ color: var(--dsw-alias-label-secondary);
536
+ }
537
+ .ts-hero-headline {
538
+ display: flex;
539
+ align-items: baseline;
540
+ justify-content: space-between;
541
+ gap: 8px 12px;
542
+ flex-wrap: wrap;
543
+ }
544
+ .ts-hero-big {
545
+ display: flex;
546
+ align-items: baseline;
547
+ gap: 6px;
548
+ min-width: 0;
549
+ }
550
+ .ts-hero-big strong {
551
+ font-size: 31px;
552
+ font-weight: 700;
553
+ letter-spacing: -0.035em;
554
+ line-height: 1.05;
555
+ font-variant-numeric: tabular-nums;
556
+ }
557
+ .ts-hero-big span {
558
+ font-size: 12.5px;
559
+ font-weight: 500;
560
+ color: var(--dsw-alias-label-secondary);
561
+ }
562
+ .ts-hero-right-meta {
563
+ font-size: 11.5px;
564
+ color: var(--dsw-alias-label-secondary);
565
+ font-variant-numeric: tabular-nums;
566
+ white-space: nowrap;
567
+ }
568
+ .ts-hero-delta {
569
+ font-size: 12px;
570
+ font-weight: 600;
571
+ font-variant-numeric: tabular-nums;
572
+ white-space: nowrap;
573
+ }
574
+
575
+ /* 苹果风亮绿胶囊进度条 */
576
+ .ts-bar {
577
+ height: 8px;
578
+ border-radius: 999px;
579
+ background: var(--ts-track-bg);
580
+ overflow: hidden;
581
+ padding: 0;
582
+ }
583
+ .ts-bar-fill {
584
+ height: 100%;
585
+ border-radius: 999px;
586
+ background: linear-gradient(90deg, var(--ts-green) 0%, var(--ts-green-hi) 100%);
587
+ box-shadow: 0 0 12px var(--ts-green-glow);
588
+ transition: width 360ms cubic-bezier(0.22, 1, 0.36, 1), background 200ms ease;
589
+ }
590
+ .ts-bar-fill-warn {
591
+ background: linear-gradient(90deg, var(--ts-amber) 0%, #ffb340 100%);
592
+ box-shadow: 0 0 12px color-mix(in srgb, var(--ts-amber) 34%, transparent);
593
+ }
594
+ .ts-bar-fill-over {
595
+ background: linear-gradient(90deg, var(--ts-red) 0%, #ff6961 100%);
596
+ box-shadow: 0 0 12px color-mix(in srgb, var(--ts-red) 36%, transparent);
597
+ }
598
+ .ts-bar-meta {
599
+ display: flex;
600
+ align-items: center;
601
+ justify-content: space-between;
602
+ gap: 10px;
603
+ font-size: 11px;
604
+ color: var(--dsw-alias-label-tertiary);
605
+ font-variant-numeric: tabular-nums;
606
+ }
607
+
608
+ /* 底部三栏核心数字(中栏略宽保证「缓存命中率」完整展示,等级胶囊轻巧贴合数字旁) */
609
+ .ts-hero-subgrid {
610
+ display: grid;
611
+ grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, 1fr);
612
+ padding-top: 13px;
613
+ border-top: 1px solid var(--ts-divider);
614
+ }
615
+ .ts-hero-stat {
616
+ min-width: 0;
617
+ padding-right: 10px;
618
+ cursor: default;
619
+ }
620
+ .ts-hero-stat + .ts-hero-stat {
621
+ padding-left: 12px;
622
+ border-left: 1px solid var(--ts-divider);
623
+ }
624
+ .ts-hero-stat:last-child { padding-right: 0; }
625
+ .ts-hero-stat-label {
626
+ font-size: 11.5px;
627
+ color: var(--dsw-alias-label-secondary);
628
+ white-space: nowrap;
629
+ }
630
+ .ts-hero-stat-val {
631
+ display: flex;
632
+ align-items: center;
633
+ gap: 5px;
634
+ margin-top: 6px;
635
+ font-size: 19px;
636
+ font-weight: 650;
637
+ letter-spacing: -0.025em;
638
+ line-height: 1.15;
639
+ font-variant-numeric: tabular-nums;
640
+ white-space: nowrap;
641
+ }
642
+ .ts-grade-pill {
643
+ display: inline-flex;
644
+ align-items: center;
645
+ justify-content: center;
646
+ height: 16px;
647
+ min-width: 17px;
648
+ padding: 0 5px;
649
+ border-radius: 999px;
650
+ font-size: 10px;
651
+ font-weight: 700;
652
+ letter-spacing: 0;
653
+ line-height: 1;
654
+ flex: none;
655
+ }
656
+ .ts-grade-pill-good { background: var(--ts-green-soft); color: var(--ts-green); }
657
+ .ts-grade-pill-mid { background: var(--ts-amber-soft); color: var(--ts-amber); }
658
+ .ts-grade-pill-low { background: var(--ts-red-soft); color: var(--ts-red); }
659
+
660
+ /* 右卡:DeepSeek 账户与峰谷 */
661
+ .ts-account-card {
662
+ display: flex;
663
+ flex-direction: column;
664
+ justify-content: space-between;
665
+ padding: 18px 20px 15px;
666
+ gap: 10px;
667
+ }
668
+ .ts-account-top {
669
+ display: flex;
670
+ flex-direction: column;
671
+ gap: 5px;
672
+ }
673
+ .ts-account-kicker {
674
+ display: flex;
675
+ align-items: center;
676
+ justify-content: space-between;
677
+ gap: 8px;
678
+ font-size: 12.5px;
679
+ color: var(--dsw-alias-label-secondary);
680
+ }
681
+ .ts-account-stale {
682
+ font-size: 10.5px;
683
+ color: var(--ts-amber);
684
+ padding: 2px 8px;
685
+ border-radius: 999px;
686
+ background: var(--ts-amber-soft);
687
+ }
688
+ .ts-account-balance {
689
+ font-size: 27px;
690
+ font-weight: 700;
691
+ letter-spacing: -0.03em;
692
+ line-height: 1.15;
693
+ font-variant-numeric: tabular-nums;
694
+ white-space: nowrap;
695
+ overflow: hidden;
696
+ text-overflow: ellipsis;
697
+ }
698
+ .ts-account-balance-muted {
699
+ font-size: 15px;
700
+ font-weight: 550;
701
+ color: var(--dsw-alias-label-secondary);
702
+ letter-spacing: -0.01em;
703
+ }
704
+ .ts-account-kv {
705
+ display: flex;
706
+ align-items: center;
707
+ justify-content: space-between;
708
+ gap: 10px;
709
+ margin-top: 2px;
710
+ font-size: 12px;
711
+ color: var(--dsw-alias-label-secondary);
712
+ }
713
+ .ts-account-kv b {
714
+ color: var(--dsw-alias-label-primary);
715
+ font-weight: 600;
716
+ font-variant-numeric: tabular-nums;
717
+ }
718
+ .ts-account-mid {
719
+ display: flex;
720
+ align-items: center;
721
+ justify-content: space-between;
722
+ gap: 12px;
723
+ padding-top: 11px;
724
+ border-top: 1px solid var(--ts-divider);
725
+ }
726
+ .ts-emblem-tile {
727
+ width: 46px;
728
+ height: 30px;
729
+ border-radius: 9px;
730
+ background: var(--ts-emblem-bg);
731
+ color: var(--ts-emblem-fg);
732
+ box-shadow: var(--ts-emblem-shadow);
733
+ display: inline-flex;
734
+ align-items: center;
735
+ justify-content: center;
736
+ flex: none;
737
+ cursor: default;
738
+ }
739
+ .ts-emblem-tile svg { width: 17px; height: 17px; display: block; }
740
+ .ts-account-peak-info {
741
+ text-align: right;
742
+ min-width: 0;
743
+ }
744
+ .ts-account-peak-kicker {
745
+ font-size: 11px;
746
+ color: var(--dsw-alias-label-secondary);
747
+ }
748
+ .ts-account-peak-val {
749
+ margin-top: 2px;
750
+ font-size: 13px;
751
+ font-weight: 650;
752
+ letter-spacing: -0.01em;
753
+ white-space: nowrap;
754
+ }
755
+ .ts-account-peak-val-off { color: var(--ts-green); }
756
+ .ts-account-peak-val-peak { color: var(--ts-red); }
757
+ /* 倒计时独占整行,窄卡下自然换行不截断 */
758
+ .ts-account-countdown {
759
+ font-size: 11.5px;
760
+ color: var(--dsw-alias-label-secondary);
761
+ line-height: 1.4;
762
+ font-variant-numeric: tabular-nums;
763
+ }
764
+ .ts-account-timeline {
765
+ display: flex;
766
+ flex-direction: column;
767
+ gap: 5px;
768
+ }
769
+
770
+ /* ---------- Row 2: 14 天横向趋势条卡(左指标 · 中圆润胶囊柱图 · 右峰值日) ---------- */
771
+ .ts-trend-card {
772
+ padding: 16px 20px 15px;
773
+ }
774
+ .ts-trend-strip {
775
+ display: grid;
776
+ grid-template-columns: minmax(96px, auto) minmax(0, 1fr) minmax(90px, auto);
777
+ align-items: center;
778
+ gap: 18px;
779
+ }
780
+ .ts-trend-side {
781
+ display: flex;
782
+ flex-direction: column;
783
+ gap: 4px;
784
+ min-width: 0;
785
+ }
786
+ .ts-trend-side-right {
787
+ text-align: right;
788
+ align-items: flex-end;
789
+ }
790
+ .ts-trend-side-btn {
791
+ padding: 4px 6px;
792
+ margin: -4px -6px;
793
+ border: 0;
794
+ border-radius: 12px;
795
+ background: transparent;
796
+ color: inherit;
797
+ font: inherit;
798
+ text-align: right;
799
+ cursor: pointer;
800
+ transition: background 140ms ease;
801
+ }
802
+ .ts-trend-side-btn:hover:not(:disabled) { background: var(--ts-surface-hover); }
803
+ .ts-trend-side-btn:disabled { cursor: default; }
804
+ .ts-trend-kicker {
805
+ font-size: 12px;
806
+ color: var(--dsw-alias-label-secondary);
807
+ white-space: nowrap;
808
+ }
809
+ .ts-trend-figure {
810
+ font-size: 24px;
811
+ font-weight: 700;
812
+ letter-spacing: -0.03em;
813
+ line-height: 1.15;
814
+ font-variant-numeric: tabular-nums;
815
+ white-space: nowrap;
816
+ }
817
+ .ts-trend-sub {
818
+ font-size: 11.5px;
819
+ color: var(--dsw-alias-label-tertiary);
820
+ font-variant-numeric: tabular-nums;
821
+ white-space: nowrap;
822
+ }
823
+ .ts-trend-center {
824
+ display: flex;
825
+ flex-direction: column;
826
+ gap: 8px;
827
+ min-width: 0;
828
+ }
829
+ .ts-trend-bars {
830
+ display: grid;
831
+ grid-template-columns: repeat(14, minmax(0, 1fr));
832
+ align-items: end;
833
+ gap: 5px;
834
+ height: 66px;
835
+ }
836
+ .ts-trend-col {
837
+ display: flex;
838
+ align-items: flex-end;
839
+ justify-content: center;
840
+ height: 100%;
841
+ padding: 0;
842
+ border: 0;
843
+ background: transparent;
844
+ cursor: pointer;
845
+ border-radius: 999px;
846
+ }
847
+ .ts-trend-col:focus-visible {
848
+ outline: 2px solid var(--ts-blue);
849
+ outline-offset: 2px;
850
+ }
851
+ .ts-trend-bar {
852
+ width: 100%;
853
+ max-width: 11px;
854
+ min-height: 6px;
855
+ border-radius: 999px;
856
+ background: var(--ts-bar-idle);
857
+ transition: transform 150ms cubic-bezier(0.25, 0.1, 0.25, 1), background 160ms ease, filter 140ms ease, box-shadow 160ms ease;
858
+ }
859
+ .ts-trend-col:hover .ts-trend-bar {
860
+ transform: scaleY(1.06);
861
+ filter: brightness(1.16);
862
+ }
863
+ .ts-trend-col-on .ts-trend-bar {
864
+ background: var(--ts-bar-on) !important;
865
+ box-shadow: 0 0 12px var(--ts-bar-on-glow);
866
+ }
867
+ .ts-trend-rail {
868
+ height: 3.5px;
869
+ width: 78%;
870
+ margin: 0 auto;
871
+ border-radius: 999px;
872
+ background: var(--ts-rail-bg);
873
+ }
874
+
875
+ /* ---------- 通用卡片头与苹果分段胶囊 ---------- */
876
+ .ts-section-head {
877
+ display: flex;
878
+ align-items: center;
879
+ justify-content: space-between;
880
+ gap: 12px;
881
+ padding: 18px 22px 10px;
882
+ flex-wrap: wrap;
883
+ }
884
+ .ts-section-title-wrap {
885
+ display: flex;
886
+ align-items: baseline;
887
+ gap: 9px;
888
+ flex-wrap: wrap;
889
+ min-width: 0;
890
+ }
891
+ .ts-section-title {
892
+ font-size: 14.5px;
893
+ font-weight: 600;
894
+ letter-spacing: -0.015em;
895
+ }
896
+ .ts-section-hint {
897
+ font-size: 11.5px;
898
+ color: var(--dsw-alias-label-tertiary);
899
+ }
900
+
901
+ .ts-seg {
902
+ display: inline-flex;
903
+ align-items: center;
904
+ gap: 4px;
905
+ padding: 3px;
906
+ border-radius: 999px;
907
+ background: var(--ts-surface-subtle);
908
+ border: 1px solid var(--ts-divider);
909
+ }
910
+ .ts-seg-btn {
911
+ height: 24px;
912
+ padding: 0 11px;
913
+ border-radius: 999px;
914
+ border: 1px solid transparent;
915
+ background: transparent;
916
+ color: var(--dsw-alias-label-secondary);
917
+ font-family: inherit;
918
+ font-size: 11.5px;
919
+ font-weight: 500;
920
+ cursor: pointer;
921
+ transition: background 140ms ease, color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
922
+ }
923
+ .ts-seg-btn:hover { color: var(--dsw-alias-label-primary); }
924
+ .ts-seg-btn-on {
925
+ background: var(--ts-pill-active-bg);
926
+ border-color: var(--ts-pill-active-border);
927
+ color: var(--dsw-alias-label-primary);
928
+ font-weight: 600;
929
+ box-shadow: var(--ts-pill-shadow);
930
+ }
931
+
932
+ /* ---------- Row 3: 每日用量热力图 ---------- */
933
+ .ts-heat-card { position: relative; }
934
+ .ts-heat-body { padding: 6px 22px 12px; }
935
+ .ts-heat {
936
+ position: relative;
937
+ display: grid;
938
+ grid-template-columns: 18px minmax(0, 1fr);
939
+ gap: 8px;
940
+ align-items: stretch;
941
+ }
942
+ .ts-weekdays {
943
+ display: grid;
944
+ grid-template-rows: repeat(7, minmax(0, 1fr));
945
+ gap: 5px;
946
+ font-size: 10px;
947
+ color: var(--dsw-alias-label-tertiary);
948
+ align-items: center;
949
+ height: 100%;
950
+ }
951
+ .ts-grid {
952
+ display: grid;
953
+ grid-auto-flow: column;
954
+ grid-auto-columns: minmax(0, 1fr);
955
+ gap: 5px;
956
+ }
957
+ .ts-col {
958
+ display: grid;
959
+ grid-template-rows: repeat(7, auto);
960
+ gap: 5px;
961
+ }
962
+ .ts-cell {
963
+ position: relative;
964
+ color: var(--dsw-alias-label-primary);
965
+ width: 100%;
966
+ aspect-ratio: 1 / 1;
967
+ border-radius: 6px;
968
+ border: 1px solid transparent;
969
+ padding: 0;
970
+ cursor: pointer;
971
+ transition: transform 150ms cubic-bezier(0.25, 0.1, 0.25, 1), opacity 160ms ease, box-shadow 150ms ease, filter 160ms ease;
972
+ will-change: transform, opacity;
973
+ }
974
+ .ts-cell:hover:not(:disabled) {
975
+ transform: translateY(-1px) scale(1.06);
976
+ filter: brightness(1.08);
977
+ z-index: 2;
978
+ }
979
+ .ts-cell:active:not(:disabled) { transform: scale(0.95); }
256
980
  .ts-cell:disabled { cursor: default; }
981
+ .ts-cell-future { opacity: 0.28; }
982
+
983
+ .ts-months {
984
+ display: grid;
985
+ gap: 5px;
986
+ margin-left: 26px;
987
+ margin-top: 9px;
988
+ height: 15px;
989
+ font-size: 10.5px;
990
+ color: var(--dsw-alias-label-tertiary);
991
+ }
992
+ .ts-month { white-space: nowrap; }
993
+ .ts-heat-rail {
994
+ height: 3.5px;
995
+ width: 68%;
996
+ margin: 10px auto 2px;
997
+ border-radius: 999px;
998
+ background: var(--ts-rail-bg);
999
+ }
257
1000
 
258
- /* ---------- 热力图涂装:颜色只在这里,按主题分两层 ----------
259
- 宿主的主题开关是 body[data-ds-dark-theme]:浅色走 body 默认值,深色才挂这个属性。
260
- 所以「深色 = 不带属性的那一层」写不了,只能反过来:先在 .ts-cell-paint 上写
261
- **深色**(原值逐字节照搬),再用 body:not([data-ds-dark-theme]) 覆盖成浅色。
262
- 这样深色模式与改动前完全一致,浅色不再出现黑方块。 */
1001
+ /* ---------- 热力图涂装:按主题分两层 ---------- */
263
1002
  .ts-cell-paint { background: var(--ts-heat-fill); border-color: var(--ts-heat-edge); box-shadow: var(--ts-heat-shadow); }
264
1003
 
265
- /* 深色(默认 = 无属性时也要对),故两层都显式给出: */
1004
+ /* 深色:贴近参考图的冷冽苹果蓝阶(深炭灰 → 深海蓝 → 钴蓝 → 亮苹果蓝 → 冰川天蓝) */
266
1005
  .ts-cell-paint,
267
1006
  body[data-ds-dark-theme] .ts-cell-paint {
268
- --ts-heat-fill: #252a31;
269
- --ts-heat-edge: rgba(185, 205, 224, 0.09);
270
- --ts-heat-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035), inset 0 -1px 0 rgba(0, 0, 0, 0.28);
1007
+ --ts-heat-fill: rgba(255, 255, 255, 0.055);
1008
+ --ts-heat-edge: rgba(255, 255, 255, 0.045);
1009
+ --ts-heat-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
271
1010
  }
272
1011
  .ts-cell-paint-l1, body[data-ds-dark-theme] .ts-cell-paint-l1 {
273
- --ts-heat-fill: #323943; --ts-heat-edge: rgba(194, 214, 232, 0.08);
274
- --ts-heat-shadow: inset 0 1px 0 rgba(194, 214, 232, 0.08), inset 0 -1px 0 rgba(0, 0, 0, 0.25), 0 1px 3px rgba(0, 0, 0, 0.24);
1012
+ --ts-heat-fill: #17345e;
1013
+ --ts-heat-edge: rgba(120, 178, 255, 0.16);
1014
+ --ts-heat-shadow: inset 0 1px 0 rgba(140, 194, 255, 0.12), 0 1px 2px rgba(0, 0, 0, 0.22);
275
1015
  }
276
1016
  .ts-cell-paint-l2, body[data-ds-dark-theme] .ts-cell-paint-l2 {
277
- --ts-heat-fill: #3c566f; --ts-heat-edge: rgba(164, 210, 239, 0.16);
278
- --ts-heat-shadow: inset 0 1px 0 rgba(164, 210, 239, 0.16), inset 0 -1px 0 rgba(0, 0, 0, 0.25), 0 1px 3px rgba(0, 28, 56, 0.30);
1017
+ --ts-heat-fill: #1f5399;
1018
+ --ts-heat-edge: rgba(130, 190, 255, 0.22);
1019
+ --ts-heat-shadow: inset 0 1px 0 rgba(155, 208, 255, 0.18), 0 1px 3px rgba(0, 20, 56, 0.30);
279
1020
  }
280
1021
  .ts-cell-paint-l3, body[data-ds-dark-theme] .ts-cell-paint-l3 {
281
- --ts-heat-fill: #3d7197; --ts-heat-edge: rgba(162, 222, 246, 0.23);
282
- --ts-heat-shadow: inset 0 1px 0 rgba(162, 222, 246, 0.23), inset 0 -1px 0 rgba(0, 0, 0, 0.25), 0 1px 3px rgba(0, 30, 68, 0.36);
1022
+ --ts-heat-fill: #2d7be8;
1023
+ --ts-heat-edge: rgba(162, 212, 255, 0.30);
1024
+ --ts-heat-shadow: inset 0 1px 0 rgba(196, 228, 255, 0.24), 0 2px 6px rgba(18, 86, 198, 0.34);
283
1025
  }
284
1026
  .ts-cell-paint-l4, body[data-ds-dark-theme] .ts-cell-paint-l4 {
285
- --ts-heat-fill: #3c82b8; --ts-heat-edge: rgba(177, 228, 246, 0.28);
286
- --ts-heat-shadow: inset 0 1px 0 rgba(177, 228, 246, 0.28), inset 0 -1px 0 rgba(0, 0, 0, 0.25), 0 1px 3px rgba(0, 32, 84, 0.42);
1027
+ --ts-heat-fill: #64b5ff;
1028
+ --ts-heat-edge: rgba(210, 238, 255, 0.48);
1029
+ --ts-heat-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 0 10px rgba(100, 181, 255, 0.38);
287
1030
  }
288
1031
 
289
- /* 浅色:同一套蓝,方向反过来——空格子贴近卡片白底,有量的从浅蓝加深到实蓝。
290
- 档位取值按反差挑过:相邻两档至少差 1.22:1,最深一档对白底 5.8:1,
291
- 既能一眼分出四档,又不会深到在浅底上像个洞。
292
- 边缘用半透明深蓝,内阴影只在顶部留一道极淡高光。 */
1032
+ /* 浅色:延续经过反差验证的清爽浅蓝到实蓝阶 */
293
1033
  body:not([data-ds-dark-theme]) .ts-cell-paint {
294
1034
  --ts-heat-fill: #eef1f6;
295
- --ts-heat-edge: rgba(15, 23, 42, 0.07);
296
- --ts-heat-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), inset 0 -1px 0 rgba(15, 23, 42, 0.05);
1035
+ --ts-heat-edge: rgba(15, 23, 42, 0.06);
1036
+ --ts-heat-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72), inset 0 -1px 0 rgba(15, 23, 42, 0.04);
297
1037
  }
298
1038
  body:not([data-ds-dark-theme]) .ts-cell-paint-l1 {
299
- --ts-heat-fill: #c7ddfb; --ts-heat-edge: rgba(29, 95, 209, 0.18);
300
- --ts-heat-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 1px 2px rgba(29, 95, 209, 0.10);
1039
+ --ts-heat-fill: #c7ddfb;
1040
+ --ts-heat-edge: rgba(29, 95, 209, 0.16);
1041
+ --ts-heat-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.58), 0 1px 2px rgba(29, 95, 209, 0.09);
301
1042
  }
302
1043
  body:not([data-ds-dark-theme]) .ts-cell-paint-l2 {
303
- --ts-heat-fill: #8ebef8; --ts-heat-edge: rgba(29, 95, 209, 0.24);
1044
+ --ts-heat-fill: #8ebef8;
1045
+ --ts-heat-edge: rgba(29, 95, 209, 0.22);
304
1046
  --ts-heat-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 1px 2px rgba(29, 95, 209, 0.14);
305
1047
  }
306
1048
  body:not([data-ds-dark-theme]) .ts-cell-paint-l3 {
307
- --ts-heat-fill: #4a8ee8; --ts-heat-edge: rgba(23, 78, 173, 0.32);
1049
+ --ts-heat-fill: #4a8ee8;
1050
+ --ts-heat-edge: rgba(23, 78, 173, 0.30);
308
1051
  --ts-heat-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42), 0 1px 3px rgba(29, 95, 209, 0.20);
309
1052
  }
310
1053
  body:not([data-ds-dark-theme]) .ts-cell-paint-l4 {
311
- --ts-heat-fill: #1d5fd1; --ts-heat-edge: rgba(16, 56, 128, 0.40);
1054
+ --ts-heat-fill: #1d5fd1;
1055
+ --ts-heat-edge: rgba(16, 56, 128, 0.38);
312
1056
  --ts-heat-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 1px 4px rgba(23, 78, 173, 0.28);
313
1057
  }
314
- /* 选中不套外框:outline 画在色块外面,自带一套矩形圆角,和色块自己的 7px 圆角
315
- 对不齐,于是读起来像"斜贴了一个相框",还把这一格的量级切断了。
316
- 改成贴着色块自己的圆角画一圈内描边:形状不变,只是这一格的边界更清楚。
317
-
318
- 描边颜色不能是一个固定值:它压在 5 档底色上,档位从近白跨到实蓝、从深灰跨到亮蓝。
319
- 一个颜色必然在某一档上翻车——纯黑在浅色 l4 只剩 3.3:1,纯白在浅色 l0 只有 1.1:1;
320
- 深色主题里纯白压在 l0 上是 14:1,就是那道扎眼的硬白边。
321
- 所以按档位各自解一个目标反差:深色统一 5.2:1、浅色浅档 4.5:1,
322
- 越浅的底给越深的环、越深的底给越亮的环,整排看过去力度才是一致的。 */
323
- .ts-cell-selected { outline: none; }
324
- .ts-cell-selected::after {
325
- content: '';
1058
+
1059
+ /* 选中态:无任何方框,仅在用户主动点选色块后柔和压暗其余色块突出当前格(聚光灯聚焦) */
1060
+ .ts-grid-has-sel .ts-cell:not(.ts-cell-selected) {
1061
+ opacity: 0.38;
1062
+ filter: saturate(0.75);
1063
+ }
1064
+ .ts-grid-has-sel .ts-cell-future {
1065
+ opacity: 0.14;
1066
+ }
1067
+ .ts-grid-has-sel .ts-cell:not(.ts-cell-selected):hover:not(:disabled) {
1068
+ opacity: 0.94;
1069
+ filter: brightness(1.06);
1070
+ transform: translateY(-1px) scale(1.06);
1071
+ z-index: 2;
1072
+ }
1073
+ .ts-cell.ts-cell-selected {
1074
+ outline: none;
1075
+ opacity: 1;
1076
+ z-index: 3;
1077
+ transform: scale(1.08);
1078
+ filter: brightness(1.08) saturate(1.08);
1079
+ box-shadow: var(--ts-heat-shadow), 0 4px 14px rgba(0, 0, 0, 0.36);
1080
+ }
1081
+ body:not([data-ds-dark-theme]) .ts-cell.ts-cell-selected {
1082
+ filter: saturate(1.08);
1083
+ box-shadow: var(--ts-heat-shadow), 0 4px 12px rgba(15, 23, 42, 0.18);
1084
+ }
1085
+ /* 选中无用量的空格子时微提底色,确保无边框也能一眼认出 */
1086
+ .ts-cell.ts-cell-paint-l0.ts-cell-selected,
1087
+ body[data-ds-dark-theme] .ts-cell.ts-cell-paint-l0.ts-cell-selected {
1088
+ --ts-heat-fill: rgba(255, 255, 255, 0.19);
1089
+ --ts-heat-edge: rgba(255, 255, 255, 0.14);
1090
+ }
1091
+ body:not([data-ds-dark-theme]) .ts-cell.ts-cell-paint-l0.ts-cell-selected {
1092
+ --ts-heat-fill: #d8e1ee;
1093
+ --ts-heat-edge: rgba(15, 23, 42, 0.12);
1094
+ }
1095
+ .ts-cell.ts-cell-selected:hover:not(:disabled) {
1096
+ transform: translateY(-1px) scale(1.1);
1097
+ z-index: 4;
1098
+ }
1099
+ .ts-cell:focus-visible {
1100
+ outline: 2px solid var(--ts-blue);
1101
+ outline-offset: 2px;
1102
+ }
1103
+
1104
+ .ts-heat-foot {
1105
+ display: flex;
1106
+ align-items: center;
1107
+ justify-content: space-between;
1108
+ gap: 12px;
1109
+ padding: 10px 22px 14px;
1110
+ border-top: 1px solid var(--ts-divider);
1111
+ flex-wrap: wrap;
1112
+ }
1113
+ .ts-legend {
1114
+ display: flex;
1115
+ align-items: center;
1116
+ gap: 10px;
1117
+ flex-wrap: wrap;
1118
+ }
1119
+ .ts-legend-item {
1120
+ display: inline-flex;
1121
+ align-items: center;
1122
+ gap: 5px;
1123
+ font-size: 11px;
1124
+ color: var(--dsw-alias-label-secondary);
1125
+ white-space: nowrap;
1126
+ }
1127
+ .ts-legend-swatch {
1128
+ width: 11px;
1129
+ height: 11px;
1130
+ border-radius: 3.5px;
1131
+ border: 1px solid transparent;
1132
+ flex: none;
1133
+ }
1134
+ .ts-meta-inline {
1135
+ font-size: 10.5px;
1136
+ color: var(--dsw-alias-label-tertiary);
1137
+ line-height: 1.45;
1138
+ text-align: right;
1139
+ }
1140
+
1141
+ /* 热力图悬停毛玻璃浮窗 */
1142
+ .ts-tip {
326
1143
  position: absolute;
327
- inset: 0;
328
- border-radius: inherit;
329
- box-shadow: inset 0 0 0 1.5px var(--ts-ring);
1144
+ z-index: 6;
1145
+ width: 204px;
1146
+ padding: 10px 12px;
1147
+ border-radius: 14px;
1148
+ border: 1px solid var(--ts-tip-border);
1149
+ background: var(--ts-tip-bg);
1150
+ backdrop-filter: blur(20px) saturate(180%);
1151
+ -webkit-backdrop-filter: blur(20px) saturate(180%);
1152
+ box-shadow: var(--ts-tip-shadow);
330
1153
  pointer-events: none;
1154
+ transform: translateX(-50%);
1155
+ box-sizing: border-box;
331
1156
  }
332
- /* 深色:每档都对自己底色约 5.2:1。深档收在近白而不是纯白,避免硬边。 */
333
- .ts-cell-selected,
334
- body[data-ds-dark-theme] .ts-cell-selected { --ts-ring: #999b9f; }
335
- .ts-cell-paint-l1.ts-cell-selected,
336
- body[data-ds-dark-theme] .ts-cell-paint-l1.ts-cell-selected { --ts-ring: #abadb2; }
337
- .ts-cell-paint-l2.ts-cell-selected,
338
- body[data-ds-dark-theme] .ts-cell-paint-l2.ts-cell-selected { --ts-ring: #d0d6dc; }
339
- .ts-cell-paint-l3.ts-cell-selected,
340
- body[data-ds-dark-theme] .ts-cell-paint-l3.ts-cell-selected { --ts-ring: #fefefe; }
341
- .ts-cell-paint-l4.ts-cell-selected,
342
- body[data-ds-dark-theme] .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #ffffff; }
343
-
344
- /* 浅色:浅档给深蓝(约 4.5:1),深档给白(3.3–5.8:1)。 */
345
- body:not([data-ds-dark-theme]) .ts-cell-selected { --ts-ring: #546ea2; }
346
- body:not([data-ds-dark-theme]) .ts-cell-paint-l1.ts-cell-selected { --ts-ring: #40609e; }
347
- body:not([data-ds-dark-theme]) .ts-cell-paint-l2.ts-cell-selected { --ts-ring: #224990; }
348
- body:not([data-ds-dark-theme]) .ts-cell-paint-l3.ts-cell-selected { --ts-ring: #ffffff; }
349
- body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #ffffff; }
350
- /* 键盘聚焦:加粗到 2px 并改用品牌色,与鼠标点击的选中区分开。 */
351
- .ts-cell-selected:focus-visible::after {
352
- box-shadow: inset 0 0 0 2px var(--dsw-alias-brand-primary);
353
- }
354
- /* Matte nylon-blue: depth comes from restrained edges and shadows, without a gloss layer over every tile. */
355
- /* Hover readout: replaces the unthemeable native title tooltip. JS places it
356
- below the hovered cell and moves it above / clamps it when an edge would clip
357
- it, so the CSS transform only centres it horizontally. */
358
- .ts-heat-card { position: relative; }
359
- .ts-tip { position: absolute; z-index: 5; width: 196px; padding: 9px 11px; border-radius: 9px; border: 1px solid var(--dsw-alias-border-l2); background: var(--dsw-alias-bg-overlay, var(--dsw-alias-bg-layer-2)); box-shadow: var(--dsw-shadow-lv2, 0 6px 18px rgba(0, 0, 0, 0.28)); pointer-events: none; transform: translateX(-50%); box-sizing: border-box; }
360
- .ts-tip-head { font-size: 11px; color: var(--dsw-alias-label-secondary); }
361
- .ts-tip-total { display: flex; align-items: baseline; gap: 5px; font-size: 18px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin: 3px 0 7px; }
362
- .ts-tip-total span { font-size: 10px; font-weight: 500; letter-spacing: 0; color: var(--dsw-alias-label-tertiary); }
363
- .ts-tip-rows { display: grid; grid-template-columns: 1fr; gap: 3px; font-size: 11px; color: var(--dsw-alias-label-secondary); font-variant-numeric: tabular-nums; }
1157
+ .ts-tip::before, .ts-tip::after { content: none !important; display: none !important; }
1158
+ .ts-tip-head { font-size: 11px; color: var(--dsw-alias-label-secondary); font-variant-numeric: tabular-nums; }
1159
+ .ts-tip-total { display: flex; align-items: baseline; gap: 5px; font-size: 19px; font-weight: 650; letter-spacing: -0.025em; font-variant-numeric: tabular-nums; margin: 3px 0 7px; }
1160
+ .ts-tip-total span { font-size: 10.5px; font-weight: 500; letter-spacing: 0; color: var(--dsw-alias-label-tertiary); }
1161
+ .ts-tip-rows { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 10px; font-size: 11px; color: var(--dsw-alias-label-secondary); font-variant-numeric: tabular-nums; }
364
1162
  .ts-tip-muted { font-size: 11px; color: var(--dsw-alias-label-tertiary); }
365
1163
 
366
- .ts-meta { padding: 10px 20px 14px; border-top: 1px solid var(--dsw-alias-border-l1); font-size: 10.5px; color: var(--dsw-alias-label-tertiary); line-height: 1.5; }
367
-
368
- /* Day detail: header strip, metric strip, then full-width model + session rows. */
369
- .ts-status { font-size: 10.5px; color: var(--dsw-alias-label-tertiary); max-width: 30ch; text-align: right; line-height: 1.4; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
370
- .ts-status-error { color: var(--dsw-alias-state-error-primary); font-size: 11px; max-width: none; white-space: normal; }
1164
+ /* ---------- Row 4: 当天明细 ---------- */
371
1165
  .ts-muted { color: var(--dsw-alias-label-tertiary); font-size: 12.5px; padding: 14px 0; }
372
- .ts-detail-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 20px 10px; flex-wrap: wrap; }
373
- .ts-detail-title { display: flex; align-items: center; gap: 9px; }
374
- .ts-detail-date { font-size: 17px; font-weight: 600; letter-spacing: -0.015em; font-variant-numeric: tabular-nums; }
375
- .ts-detail-total { display: flex; align-items: baseline; gap: 7px; }
376
- .ts-detail-total strong { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
377
- .ts-detail-total span { font-size: 11.5px; color: var(--dsw-alias-label-secondary); }
378
- .ts-detail-retained { font-size: 10.5px; color: var(--dsw-alias-label-tertiary); margin-right: 6px; }
379
- .ts-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); border-top: 1px solid var(--dsw-alias-border-l1); border-bottom: 1px solid var(--dsw-alias-border-l1); }
380
- .ts-metric { padding: 12px 20px; min-width: 0; }
381
- .ts-metric + .ts-metric { border-left: 1px solid var(--dsw-alias-border-l1); }
382
- .ts-metric-label { font-size: 11.5px; color: var(--dsw-alias-label-secondary); white-space: nowrap; }
383
- .ts-metric-value { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; margin-top: 3px; }
384
- .ts-metric-value-accent { color: var(--dsw-alias-state-success-primary); }
385
- .ts-body { padding: 14px 20px 18px; }
386
- .ts-subhead { font-size: 12px; font-weight: 600; color: var(--dsw-alias-label-secondary); letter-spacing: -0.005em; margin-bottom: 9px; }
387
-
388
- /* Composition: one stacked bar answers "where did the tokens go". */
389
- .ts-comp { margin: 0 20px; padding: 12px 0 14px; }
390
- .ts-comp-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
1166
+ .ts-detail-head {
1167
+ display: flex;
1168
+ align-items: center;
1169
+ justify-content: space-between;
1170
+ gap: 14px;
1171
+ padding: 18px 22px 14px;
1172
+ flex-wrap: wrap;
1173
+ }
1174
+ .ts-detail-title {
1175
+ display: flex;
1176
+ align-items: center;
1177
+ gap: 9px;
1178
+ flex-wrap: wrap;
1179
+ }
1180
+ .ts-detail-date {
1181
+ font-size: 18px;
1182
+ font-weight: 650;
1183
+ letter-spacing: -0.02em;
1184
+ font-variant-numeric: tabular-nums;
1185
+ }
1186
+ .ts-stepper {
1187
+ display: inline-flex;
1188
+ align-items: center;
1189
+ padding: 2px;
1190
+ border-radius: 999px;
1191
+ background: var(--ts-pill-bg);
1192
+ border: 1px solid var(--ts-pill-border);
1193
+ }
1194
+ .ts-step-btn {
1195
+ width: 26px;
1196
+ height: 24px;
1197
+ padding: 0;
1198
+ border: 0;
1199
+ border-radius: 999px;
1200
+ background: transparent;
1201
+ color: var(--dsw-alias-label-primary);
1202
+ display: inline-flex;
1203
+ align-items: center;
1204
+ justify-content: center;
1205
+ cursor: pointer;
1206
+ transition: background 120ms ease;
1207
+ }
1208
+ .ts-step-btn:hover:not(:disabled) { background: var(--ts-pill-bg-hover); }
1209
+ .ts-step-btn:disabled { opacity: 0.3; cursor: default; }
1210
+ .ts-step-btn svg { width: 13px; height: 13px; display: block; }
1211
+
1212
+ .ts-detail-total {
1213
+ display: flex;
1214
+ align-items: baseline;
1215
+ gap: 7px;
1216
+ flex-wrap: wrap;
1217
+ }
1218
+ .ts-detail-total strong {
1219
+ font-size: 25px;
1220
+ font-weight: 700;
1221
+ letter-spacing: -0.03em;
1222
+ font-variant-numeric: tabular-nums;
1223
+ }
1224
+ .ts-detail-total span {
1225
+ font-size: 12px;
1226
+ color: var(--dsw-alias-label-secondary);
1227
+ }
1228
+ .ts-detail-retained {
1229
+ font-size: 11px;
1230
+ color: var(--dsw-alias-label-tertiary);
1231
+ padding: 2px 9px;
1232
+ border-radius: 999px;
1233
+ background: var(--ts-surface-subtle);
1234
+ margin-right: 4px;
1235
+ }
1236
+
1237
+ .ts-metrics {
1238
+ display: grid;
1239
+ grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
1240
+ gap: 8px;
1241
+ padding: 14px 20px;
1242
+ border-top: 1px solid var(--ts-divider);
1243
+ border-bottom: 1px solid var(--ts-divider);
1244
+ }
1245
+ .ts-metric {
1246
+ padding: 10px 13px;
1247
+ min-width: 0;
1248
+ border-radius: 13px;
1249
+ background: var(--ts-surface-subtle);
1250
+ border: 1px solid var(--ts-divider);
1251
+ }
1252
+ .ts-metric-label { font-size: 11px; color: var(--dsw-alias-label-secondary); white-space: nowrap; }
1253
+ .ts-metric-value { font-size: 15px; font-weight: 650; letter-spacing: -0.015em; font-variant-numeric: tabular-nums; margin-top: 4px; white-space: nowrap; }
1254
+ .ts-metric-value-accent { color: var(--ts-green); }
1255
+
1256
+ /* 用量构成:iOS 存储条风格胶囊分段条 */
1257
+ .ts-comp { padding: 14px 22px 14px; border-bottom: 1px solid var(--ts-divider); }
1258
+ .ts-comp-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
391
1259
  .ts-comp-title { font-size: 12px; font-weight: 600; color: var(--dsw-alias-label-secondary); }
392
1260
  .ts-comp-total { font-size: 11.5px; color: var(--dsw-alias-label-tertiary); font-variant-numeric: tabular-nums; }
393
- .ts-comp-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--dsw-alias-bg-layer-2); gap: 1px; }
394
- .ts-comp-seg { height: 100%; }
395
- .ts-comp-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 9px; }
1261
+ .ts-comp-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--ts-track-bg); gap: 2px; }
1262
+ .ts-comp-seg { height: 100%; border-radius: 3px; }
1263
+ .ts-comp-seg:first-child { border-top-left-radius: 999px; border-bottom-left-radius: 999px; }
1264
+ .ts-comp-seg:last-child { border-top-right-radius: 999px; border-bottom-right-radius: 999px; }
1265
+ .ts-comp-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 10px; }
396
1266
  .ts-comp-item { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--dsw-alias-label-secondary); }
397
- .ts-comp-dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
1267
+ .ts-comp-dot { width: 8px; height: 8px; border-radius: 999px; flex: none; }
398
1268
  .ts-comp-item b { color: var(--dsw-alias-label-primary); font-weight: 600; font-variant-numeric: tabular-nums; }
399
1269
  .ts-comp-pct { color: var(--dsw-alias-label-tertiary); font-variant-numeric: tabular-nums; }
400
1270
 
401
- /* Trend: compact column chart, no axes to misread. */
402
- .ts-trend { padding: 0 20px 16px; }
403
- .ts-trend-bars { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); align-items: end; gap: 4px; height: 92px; }
404
- .ts-trend-col { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; cursor: default; }
405
- .ts-trend-bar { border-radius: 4px 4px 2px 2px; background: var(--dsw-alias-bg-layer-2); min-height: 3px; transition: filter 120ms ease; }
406
- .ts-trend-col:hover .ts-trend-bar { filter: brightness(1.25); }
407
- .ts-trend-col-on .ts-trend-bar { background: var(--dsw-alias-brand-primary); }
408
- .ts-trend-labels { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 4px; margin-top: 6px; font-size: 9.5px; color: var(--dsw-alias-label-tertiary); text-align: center; font-variant-numeric: tabular-nums; }
409
- .ts-trend-label-on { color: var(--dsw-alias-label-primary); font-weight: 600; }
410
-
411
- /* Model rows: a bar per model is easier to rank than a chip row. */
412
- .ts-models { margin-bottom: 18px; }
413
- .ts-model-row { display: grid; grid-template-columns: minmax(0, 1fr) 96px 54px; align-items: center; gap: 12px; padding: 5px 0; }
414
- .ts-model-name { font-size: 11.5px; color: var(--dsw-alias-label-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
415
- .ts-model-track { height: 7px; border-radius: 999px; background: var(--dsw-alias-bg-layer-2); overflow: hidden; }
416
- .ts-model-fill { height: 100%; border-radius: 999px; background: var(--dsw-alias-brand-primary); }
417
- .ts-model-meta { text-align: right; font-size: 11.5px; font-variant-numeric: tabular-nums; color: var(--dsw-alias-label-primary); }
418
-
419
- .ts-table { display: flex; flex-direction: column; }
420
- .ts-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(90px, 150px) 78px 68px; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--dsw-alias-border-l1); font-size: 12.5px; }
421
- .ts-row:first-child { border-top: 0; }
422
- .ts-row-head { color: var(--dsw-alias-label-tertiary); font-size: 10.5px; letter-spacing: 0.02em; padding-top: 0; padding-bottom: 6px; }
1271
+ .ts-body { padding: 16px 22px 18px; }
1272
+ .ts-subhead { font-size: 12px; font-weight: 600; color: var(--dsw-alias-label-secondary); letter-spacing: -0.005em; margin-bottom: 10px; }
1273
+
1274
+ /* 模型分布 */
1275
+ .ts-models { margin-bottom: 20px; }
1276
+ .ts-model-row { display: grid; grid-template-columns: minmax(0, 1fr) 96px minmax(88px, auto); align-items: center; gap: 12px; padding: 6px 0; }
1277
+ .ts-model-name { font-size: 12px; color: var(--dsw-alias-label-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
1278
+ .ts-model-track { height: 6px; border-radius: 999px; background: var(--ts-track-bg); overflow: hidden; }
1279
+ .ts-model-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--ts-blue) 0%, var(--ts-cyan) 100%); }
1280
+ .ts-model-meta { text-align: right; font-size: 11.5px; font-variant-numeric: tabular-nums; color: var(--dsw-alias-label-secondary); white-space: nowrap; }
1281
+
1282
+ /* 当天会话列表 */
1283
+ .ts-table { display: flex; flex-direction: column; gap: 2px; }
1284
+ .ts-row {
1285
+ display: grid;
1286
+ grid-template-columns: minmax(0, 1fr) minmax(90px, 148px) 78px 60px;
1287
+ align-items: center;
1288
+ gap: 12px;
1289
+ padding: 9px 10px;
1290
+ margin: 0 -10px;
1291
+ border-radius: 12px;
1292
+ font-size: 12.5px;
1293
+ transition: background 120ms ease;
1294
+ }
1295
+ .ts-row:not(.ts-row-head):hover { background: var(--ts-surface-hover); }
1296
+ .ts-row-head {
1297
+ color: var(--dsw-alias-label-tertiary);
1298
+ font-size: 10.5px;
1299
+ letter-spacing: 0.02em;
1300
+ padding-top: 2px;
1301
+ padding-bottom: 6px;
1302
+ border-bottom: 1px solid var(--ts-divider);
1303
+ border-radius: 0;
1304
+ margin-bottom: 4px;
1305
+ }
423
1306
  .ts-session-main { min-width: 0; }
424
- .ts-session-title { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.005em; }
425
- .ts-session-cwd { display: block; color: var(--dsw-alias-label-tertiary); font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
426
- .ts-session-model { font-size: 10.5px; color: var(--dsw-alias-label-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
427
- .ts-num { text-align: right; font-variant-numeric: tabular-nums; }
428
- .ts-num-muted { color: var(--dsw-alias-label-secondary); }
429
- @media (max-width: 720px) {
430
- .ts-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); }
431
- .ts-hero-cell:nth-child(3) { border-left: 0; }
432
- .ts-hero-cell:nth-child(n + 3) { border-top: 1px solid var(--dsw-alias-border-l1); }
433
- .ts-row { grid-template-columns: minmax(0, 1fr) 64px 64px; }
434
- .ts-row-model { display: none; }
1307
+ .ts-session-title { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.005em; }
1308
+ .ts-session-cwd { display: block; color: var(--dsw-alias-label-tertiary); font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
1309
+ .ts-session-model {
1310
+ justify-self: start;
1311
+ max-width: 100%;
1312
+ padding: 2px 9px;
1313
+ border-radius: 999px;
1314
+ background: var(--ts-surface-subtle);
1315
+ border: 1px solid var(--ts-divider);
1316
+ font-size: 10.5px;
1317
+ color: var(--dsw-alias-label-secondary);
1318
+ white-space: nowrap;
1319
+ overflow: hidden;
1320
+ text-overflow: ellipsis;
1321
+ }
1322
+ .ts-num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
1323
+ .ts-num-muted { color: var(--dsw-alias-label-secondary); font-weight: 400; }
1324
+
1325
+ /* ---------- Row 5: 底部双列实用卡(官方价格 + 低余额提醒) ---------- */
1326
+ .ts-bento-utility {
1327
+ display: grid;
1328
+ grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
1329
+ gap: 12px;
1330
+ align-items: stretch;
1331
+ }
1332
+ .ts-util-card {
1333
+ display: flex;
1334
+ flex-direction: column;
1335
+ justify-content: space-between;
1336
+ padding: 18px 22px 16px;
1337
+ gap: 12px;
1338
+ }
1339
+ .ts-util-head {
1340
+ display: flex;
1341
+ align-items: center;
1342
+ justify-content: space-between;
1343
+ gap: 10px;
1344
+ flex-wrap: wrap;
1345
+ }
1346
+ .ts-util-title {
1347
+ font-size: 14px;
1348
+ font-weight: 600;
1349
+ letter-spacing: -0.015em;
1350
+ }
1351
+ .ts-util-chip {
1352
+ font-size: 11px;
1353
+ color: var(--dsw-alias-label-secondary);
1354
+ padding: 3px 9px;
1355
+ border-radius: 999px;
1356
+ background: var(--ts-surface-subtle);
1357
+ border: 1px solid var(--ts-divider);
1358
+ font-variant-numeric: tabular-nums;
1359
+ white-space: nowrap;
1360
+ }
1361
+ .ts-util-chip-on {
1362
+ color: var(--ts-amber);
1363
+ background: var(--ts-amber-soft);
1364
+ border-color: color-mix(in srgb, var(--ts-amber) 28%, transparent);
1365
+ }
1366
+ .ts-util-foot {
1367
+ padding-top: 10px;
1368
+ border-top: 1px solid var(--ts-divider);
1369
+ font-size: 10.5px;
1370
+ color: var(--dsw-alias-label-tertiary);
1371
+ line-height: 1.5;
1372
+ }
1373
+
1374
+ /* 加载态卡片 */
1375
+ .ts-loading-card {
1376
+ display: flex;
1377
+ align-items: center;
1378
+ gap: 10px;
1379
+ padding: 20px 22px;
1380
+ font-size: 13px;
1381
+ color: var(--dsw-alias-label-secondary);
1382
+ }
1383
+ .ts-spinner {
1384
+ width: 15px;
1385
+ height: 15px;
1386
+ border-radius: 50%;
1387
+ border: 2px solid var(--ts-track-bg);
1388
+ border-top-color: var(--ts-blue);
1389
+ animation: ts-spin 0.8s linear infinite;
1390
+ flex: none;
435
1391
  }
436
1392
 
437
- /* ---------- 侧栏「余额 + 峰谷」:无卡片外壳,与「已登录 DeepSeek」同一条底栏 ---------- */
438
- .tsb { display: flex; flex-direction: column; gap: 2px; width: 100%; box-sizing: border-box; padding: 4px 8px 6px; background: transparent; border: 0; border-radius: 0; font-family: inherit; -webkit-font-smoothing: antialiased; }
1393
+ /* ---------- 侧栏「余额 + 峰谷」:无外壳极简流式 ---------- */
1394
+ .tsb { display: flex; flex-direction: column; gap: 3px; width: 100%; box-sizing: border-box; padding: 6px 8px 6px; background: transparent; border: 0; border-radius: 0; font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
439
1395
  .tsb-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
440
- .tsb-amount { font-size: 12.5px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; color: var(--dsw-alias-label-primary); white-space: nowrap; }
1396
+ .tsb-amount { font-size: 15px; font-weight: 650; letter-spacing: -0.025em; line-height: 1.15; font-variant-numeric: tabular-nums; color: var(--dsw-alias-label-primary); white-space: nowrap; }
441
1397
  .tsb-bonus { font-size: 9.5px; color: var(--dsw-alias-label-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
442
- .tsb-muted { font-size: 11px; color: var(--dsw-alias-label-tertiary); }
1398
+ .tsb-muted { font-size: 11.5px; color: var(--dsw-alias-label-tertiary); }
443
1399
  .tsb-spacer { flex: 1; min-width: 0; }
444
- /* 状态只靠文字与一个色点表达:没有底色、没有边框,贴在底栏上不抢视线。 */
445
- .tsb-badge { display: inline-flex; align-items: center; gap: 4px; flex: none; font-size: 9.5px; font-weight: 600; line-height: 1; padding: 0; background: transparent; white-space: nowrap; }
446
- .tsb-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
1400
+ .tsb-badge { display: inline-flex; align-items: center; gap: 4.5px; flex: none; font-size: 10.5px; font-weight: 600; line-height: 1; padding: 0; background: transparent; white-space: nowrap; }
1401
+ .tsb-badge::before { content: ''; width: 5.5px; height: 5.5px; border-radius: 50%; background: currentColor; box-shadow: 0 0 6px currentColor; flex: none; }
447
1402
  .tsb-badge-off { color: var(--dsw-alias-state-success-primary); }
448
1403
  .tsb-badge-peak { color: var(--dsw-alias-state-error-primary); }
449
- .tsb-peak { font-size: 10px; color: var(--dsw-alias-label-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
450
- /* 侧栏当前价一行:小一号、数字比模型名更淡,模型之间只留空格。 */
451
- .tsb-prices { font-size: 9px; color: var(--dsw-alias-label-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
452
- .tsb-prices > span { margin-right: 6px; }
453
- .tsb-prices > span:last-child { margin-right: 0; }
454
- /* 低余额提醒条:贴在卡片内,琥珀色边提示;点「充值」走官方充值页。 */
455
- .tsb-low { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; padding: 6px 7px; border: 1px solid var(--dsw-alias-state-warn-primary); border-radius: 8px; background: var(--dsw-alias-bg-layer-2); }
1404
+ .tsb-peak { font-size: 10px; color: var(--dsw-alias-label-tertiary); line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
1405
+ .tsb-low { display: flex; flex-direction: column; gap: 5px; margin-top: 6px; padding: 8px 10px; border: 1px solid color-mix(in srgb, var(--dsw-alias-state-warn-primary) 34%, transparent); border-radius: 12px; background: color-mix(in srgb, var(--dsw-alias-state-warn-primary) 12%, var(--dsw-alias-bg-layer-2)); }
456
1406
  .tsb-low-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
457
- .tsb-low-title { font-size: 10px; font-weight: 600; color: var(--dsw-alias-state-warn-primary); }
458
- .tsb-low-dismiss { flex: none; padding: 0 2px; border: 0; background: transparent; color: var(--dsw-alias-label-tertiary); font: inherit; font-size: 12px; line-height: 1; cursor: pointer; }
1407
+ .tsb-low-title { font-size: 10.5px; font-weight: 600; color: var(--dsw-alias-state-warn-primary); }
1408
+ .tsb-low-dismiss { flex: none; padding: 0 2px; border: 0; background: transparent; color: var(--dsw-alias-label-tertiary); font: inherit; font-size: 13px; line-height: 1; cursor: pointer; }
459
1409
  .tsb-low-dismiss:hover { color: var(--dsw-alias-label-primary); }
460
- .tsb-low-body { font-size: 9.5px; color: var(--dsw-alias-label-secondary); line-height: 1.4; font-variant-numeric: tabular-nums; }
461
- .tsb-low-action { margin-top: 2px; padding: 4px 0; border: 0; border-radius: 6px; background: var(--dsw-alias-state-warn-primary); color: var(--dsw-alias-label-primary-inverted, #fff); font: inherit; font-size: 10px; font-weight: 600; cursor: pointer; }
1410
+ .tsb-low-body { font-size: 9.5px; color: var(--dsw-alias-label-secondary); line-height: 1.45; font-variant-numeric: tabular-nums; }
1411
+ .tsb-low-action { margin-top: 2px; padding: 5px 0; border: 0; border-radius: 999px; background: var(--dsw-alias-state-warn-primary); color: var(--dsw-alias-label-primary-inverted, #fff); font: inherit; font-size: 10.5px; font-weight: 600; cursor: pointer; transition: filter 120ms ease, transform 100ms ease; }
462
1412
  .tsb-low-action:hover { filter: brightness(1.08); }
463
- /* 花费页的余额提醒设置:一个最低余额 + 说明。 */
464
- .ts-low { display: flex; flex-direction: column; gap: 8px; }
465
- .ts-low-title { font-size: 11.5px; color: var(--dsw-alias-label-secondary); }
466
- .ts-low-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
467
- .ts-low-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
468
- .ts-low-label { font-size: 11px; color: var(--dsw-alias-label-secondary); }
469
- .ts-low-input { width: 100%; box-sizing: border-box; height: 28px; padding: 0 8px; border: 1px solid var(--dsw-alias-border-l1); border-radius: 8px; background: var(--dsw-alias-bg-layer-1); color: var(--dsw-alias-label-primary); font: inherit; font-size: 12px; font-variant-numeric: tabular-nums; }
470
- .ts-low-input:focus { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 1px; }
471
- .ts-low-hint { font-size: 10px; color: var(--dsw-alias-label-tertiary); line-height: 1.4; }
472
- .ts-low-note { font-size: 10px; color: var(--dsw-alias-label-tertiary); line-height: 1.5; }
473
- .ts-low-silent { display: flex; align-items: center; gap: 8px; font-size: 10px; color: var(--dsw-alias-label-tertiary); }
474
- .ts-low-resume { padding: 0; border: 0; background: transparent; color: var(--dsw-alias-brand-primary); font: inherit; font-size: 10px; cursor: pointer; }
1413
+ .tsb-low-action:active { transform: scale(0.98); }
1414
+
1415
+ /* 花费页的低余额提醒设置 */
1416
+ .ts-low { display: flex; flex-direction: column; gap: 10px; }
1417
+ .ts-low-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
1418
+ .ts-low-label { font-size: 11.5px; color: var(--dsw-alias-label-secondary); }
1419
+ .ts-low-input-wrap {
1420
+ position: relative;
1421
+ display: flex;
1422
+ align-items: center;
1423
+ }
1424
+ .ts-low-prefix {
1425
+ position: absolute;
1426
+ left: 12px;
1427
+ font-size: 13px;
1428
+ font-weight: 600;
1429
+ color: var(--dsw-alias-label-tertiary);
1430
+ pointer-events: none;
1431
+ }
1432
+ .ts-low-input {
1433
+ width: 100%;
1434
+ box-sizing: border-box;
1435
+ height: 36px;
1436
+ padding: 0 12px 0 27px;
1437
+ border: 1px solid var(--ts-pill-border);
1438
+ border-radius: 12px;
1439
+ background: var(--ts-input-bg);
1440
+ color: var(--dsw-alias-label-primary);
1441
+ font: inherit;
1442
+ font-size: 13.5px;
1443
+ font-weight: 500;
1444
+ font-variant-numeric: tabular-nums;
1445
+ transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
1446
+ }
1447
+ .ts-low-input:focus {
1448
+ outline: none;
1449
+ background: var(--ts-input-bg-focus);
1450
+ border-color: var(--ts-blue);
1451
+ box-shadow: 0 0 0 3px var(--ts-blue-soft);
1452
+ }
1453
+ .ts-low-hint { font-size: 11px; color: var(--dsw-alias-label-tertiary); line-height: 1.45; }
1454
+ .ts-low-silent {
1455
+ display: inline-flex;
1456
+ align-items: center;
1457
+ gap: 8px;
1458
+ align-self: flex-start;
1459
+ padding: 4px 10px;
1460
+ border-radius: 999px;
1461
+ background: var(--ts-surface-subtle);
1462
+ font-size: 11px;
1463
+ color: var(--dsw-alias-label-secondary);
1464
+ }
1465
+ .ts-low-resume { padding: 0; border: 0; background: transparent; color: var(--ts-blue); font: inherit; font-size: 11px; font-weight: 600; cursor: pointer; }
475
1466
  .ts-low-resume:hover { text-decoration: underline; }
476
- /* 侧栏「今日花费」:余额旁边的一小块,只在有用量数据时出现。 */
1467
+
477
1468
  .tsb-today { font-size: 9.5px; color: var(--dsw-alias-label-tertiary); white-space: nowrap; font-variant-numeric: tabular-nums; }
478
1469
  .tsb-today b { color: var(--dsw-alias-label-secondary); font-weight: 600; margin-left: 3px; }
479
- /* 余额读不出来时的那一句「前往开放平台查看」仍是真链接;侧栏没有别的按钮。 */
480
1470
  .tsb-link { color: inherit; text-decoration: none; border-bottom: 1px dotted currentColor; }
481
1471
  .tsb-link:hover { color: var(--dsw-alias-label-primary); }
482
1472
  .tsb-rail { align-items: center; justify-content: center; padding: 6px 0; gap: 4px; }
483
1473
  .tsb-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
484
- .tsb-dot-off { background: var(--dsw-alias-state-success-primary); }
485
- .tsb-dot-peak { background: var(--dsw-alias-state-error-primary); }
1474
+ .tsb-dot-off { background: var(--dsw-alias-state-success-primary); box-shadow: 0 0 6px var(--dsw-alias-state-success-primary); }
1475
+ .tsb-dot-peak { background: var(--dsw-alias-state-error-primary); box-shadow: 0 0 6px var(--dsw-alias-state-error-primary); }
486
1476
  .tsb-railText { font-size: 9.5px; color: var(--dsw-alias-label-secondary); }
487
1477
  .tsb-error { font-size: 10px; line-height: 1.5; color: var(--dsw-alias-state-error-primary); word-break: break-word; }
488
1478
 
489
- /* 24 小时峰谷格子图:每小时一格,高峰红、其余绿。
490
- 用网格排版而不是一根连续长条——格子位置由布局决定,不依赖像素取整,
491
- 所以对齐天生是齐的,也不会有色块交界的混合像素。
492
- 「此刻」不画框:7–9px 高的格子上,任何描边都会吃掉自己的圆角、挨到邻格,
493
- 整条就多出一个突兀的方框,红绿的形状还被切断。改成一个圆点落在条下方,
494
- 正对着当前这一格,同时那一格比其余亮一档——指示清楚,形状不变。 */
495
- .ts-tl { position: relative; width: 100%; padding-top: 3px; }
496
- .ts-tl-cells { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 1px; height: 9px; }
497
- .ts-tl-compact .ts-tl-cells { height: 7px; }
498
- .ts-tl-cell { border-radius: 2px; min-width: 0; transition: filter 180ms ease; }
499
- .ts-tl-cell-off { background: var(--dsw-alias-state-success-primary); }
500
- .ts-tl-cell-peak { background: var(--dsw-alias-state-error-primary); }
501
- /* 此刻:满色再提亮一档,靠对比被看见,不靠描边。 */
502
- .ts-tl-cell-now { filter: brightness(1.22) saturate(1.06); }
503
- /* 指示点:与格列同宽的网格,未选中的格子占位但不可见,点子居中于当前格。 */
504
- .ts-tl-marks { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 1px; height: 3px; margin-top: 2px; }
505
- .ts-tl-compact .ts-tl-marks { height: 2.5px; margin-top: 2px; }
506
- .ts-tl-mark { justify-self: center; align-self: center; width: 3px; height: 3px; border-radius: 50%; background: var(--dsw-alias-label-primary); }
1479
+ /* 24 小时峰谷微胶囊条:已过小时柔和压暗、未来小时清透、当前小时高亮微光 + 底部小圆点 */
1480
+ .ts-tl { position: relative; width: 100%; padding-top: 4px; }
1481
+ .ts-tl-cells { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 2px; height: 6px; align-items: center; }
1482
+ .ts-tl-compact .ts-tl-cells { height: 5px; gap: 2px; }
1483
+ .ts-tl-cell { height: 100%; border-radius: 999px; min-width: 0; transition: opacity 180ms ease, filter 180ms ease, transform 180ms ease; }
1484
+ .ts-tl-cell-off { background: var(--dsw-alias-state-success-primary); color: var(--dsw-alias-state-success-primary); }
1485
+ .ts-tl-cell-peak { background: var(--dsw-alias-state-error-primary); color: var(--dsw-alias-state-error-primary); }
1486
+ .ts-tl-cell-past { opacity: 0.24; }
1487
+ .ts-tl-cell-future { opacity: 0.62; }
1488
+ .ts-tl-cell-now { opacity: 1; transform: scaleY(1.28); filter: brightness(1.18) saturate(1.08); box-shadow: 0 0 7px currentColor; }
1489
+ .ts-tl-marks { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 2px; height: 3.5px; margin-top: 3px; }
1490
+ .ts-tl-compact .ts-tl-marks { gap: 2px; height: 3px; margin-top: 2.5px; }
1491
+ .ts-tl-mark { justify-self: center; align-self: center; width: 3px; height: 3px; border-radius: 50%; background: var(--dsw-alias-label-primary); opacity: 0.85; }
507
1492
  .ts-tl-compact .ts-tl-mark { width: 2.5px; height: 2.5px; }
508
- .ts-tl-hours { display: flex; justify-content: space-between; margin-top: 3px; font-size: 8.5px; line-height: 1.2; color: var(--dsw-alias-label-tertiary); font-variant-numeric: tabular-nums; }
509
- .ts-bal-timeline { padding: 4px 20px 10px; }
510
-
511
- /* 官方价文字表(花费页):两模型两列,当前时段那一侧加粗,另一侧淡显。
512
- 侧栏不放假表,只放当前时段的一行小字(.tsb-prices)。 */
513
- .ts-pt { display: flex; flex-direction: column; gap: 2px; }
514
- .ts-pt-row { display: grid; grid-template-columns: minmax(88px, 1.2fr) repeat(2, minmax(72px, 1fr)); gap: 10px; padding: 2px 0; font-size: 11.5px; font-variant-numeric: tabular-nums; }
515
- .ts-pt-head { color: var(--dsw-alias-label-tertiary); font-size: 10.5px; padding-bottom: 2px; }
1493
+ .ts-tl-hours { display: flex; justify-content: space-between; margin-top: 2px; font-size: 9px; line-height: 1.2; color: var(--dsw-alias-label-tertiary); font-variant-numeric: tabular-nums; }
1494
+
1495
+ /* 官方价文字表:两模型两列,当前时段加粗,高峰列红字 */
1496
+ .ts-pt { display: flex; flex-direction: column; gap: 3px; }
1497
+ .ts-pt-row { display: grid; grid-template-columns: minmax(64px, 1fr) auto auto; gap: 12px; padding: 4px 0; font-size: 11.5px; font-variant-numeric: tabular-nums; align-items: baseline; }
1498
+ .ts-pt-row + .ts-pt-row { border-top: 1px solid var(--ts-divider); }
1499
+ .ts-pt-head { color: var(--dsw-alias-label-tertiary); font-size: 10.5px; padding-top: 0; padding-bottom: 5px; }
516
1500
  .ts-pt-model { color: var(--dsw-alias-label-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
517
1501
  .ts-pt-price { text-align: right; color: var(--dsw-alias-label-primary); white-space: nowrap; }
518
- .ts-pt-on { color: var(--dsw-alias-label-primary); font-weight: 600; }
519
- /* 价表里"高峰"那一列统一红字:贵 = 红的语义延伸到数字本身。 */
1502
+ .ts-pt-on { color: var(--dsw-alias-label-primary); font-weight: 650; }
520
1503
  .ts-pt-on.is-peak { color: var(--dsw-alias-state-error-primary); }
521
1504
  .ts-pt-muted { color: var(--dsw-alias-label-tertiary); }
522
- .ts-bal-legend { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 8px; font-size: 10.5px; color: var(--dsw-alias-label-tertiary); line-height: 1.5; flex-wrap: wrap; }
523
- .ts-bal-unit { white-space: nowrap; }
524
- @media (max-width: 720px) {
525
- .ts-pt-row { grid-template-columns: minmax(72px, 1.2fr) repeat(2, minmax(58px, 1fr)); font-size: 11px; }
526
- }
527
1505
 
528
- /* 全插件唯一的浮窗:顶层(Popover)浮层,内容短、贴边翻转,不被侧栏窄列切掉。
529
- 样式同时写在内联上(见 createTipLayer),这里是字体与内容的排版;
530
- border/padding/background 也在内联里再写一遍,压掉 popover 的 UA 默认值。 */
531
- .tstip { position: fixed; inset: auto auto auto auto; margin: 0; width: max-content; max-width: 264px; z-index: 2147483000; border-radius: 9px; box-shadow: var(--dsw-shadow-lv2, 0 6px 18px rgba(0, 0, 0, 0.28)); color: var(--dsw-alias-label-primary); font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; font-size: 11px; line-height: 1.45; overflow: visible; pointer-events: none; font-variant-numeric: tabular-nums; }
1506
+ /* 全插件唯一的顶层 Popover 浮窗(深/浅双主题毛玻璃) */
1507
+ .tstip,
1508
+ body[data-ds-dark-theme] .tstip {
1509
+ --tstip-bg: rgba(24, 26, 33, 0.93);
1510
+ --tstip-border: rgba(255, 255, 255, 0.14);
1511
+ --tstip-shadow: 0 14px 34px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.12);
1512
+ --tstip-div: rgba(255, 255, 255, 0.09);
1513
+ --tstip-off: #30d158;
1514
+ --tstip-peak: #ff453a;
1515
+ }
1516
+ body:not([data-ds-dark-theme]) .tstip {
1517
+ --tstip-bg: rgba(255, 255, 255, 0.96);
1518
+ --tstip-border: rgba(15, 23, 42, 0.11);
1519
+ --tstip-shadow: 0 14px 32px rgba(15, 23, 42, 0.14), 0 2px 6px rgba(15, 23, 42, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.96);
1520
+ --tstip-div: rgba(15, 23, 42, 0.08);
1521
+ --tstip-off: #24b83c;
1522
+ --tstip-peak: #e53935;
1523
+ }
1524
+ .tstip {
1525
+ position: fixed;
1526
+ inset: auto auto auto auto;
1527
+ margin: 0;
1528
+ width: max-content;
1529
+ max-width: 288px;
1530
+ z-index: 2147483000;
1531
+ border-radius: 14px;
1532
+ box-shadow: var(--tstip-shadow);
1533
+ color: var(--dsw-alias-label-primary);
1534
+ font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
1535
+ font-size: 11px;
1536
+ line-height: 1.45;
1537
+ overflow: visible;
1538
+ pointer-events: none;
1539
+ font-variant-numeric: tabular-nums;
1540
+ }
532
1541
  .tstip:popover-open { display: block; }
533
1542
  .tstip::before, .tstip::after { content: none !important; display: none !important; }
534
- .tstip-head { font-size: 10.5px; color: var(--dsw-alias-label-secondary); margin-bottom: 2px; }
535
- .tstip-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
1543
+ .tstip-head-bar { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 7px; }
1544
+ .tstip-head { font-size: 11px; font-weight: 600; color: var(--dsw-alias-label-secondary); margin-bottom: 3px; }
1545
+ .tstip-head-bar .tstip-head { margin-bottom: 0; }
1546
+ .tstip-head-sub { font-size: 9.5px; color: var(--dsw-alias-label-tertiary); white-space: nowrap; }
1547
+ .tstip-row { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
536
1548
  .tstip-row b { font-weight: 600; }
537
- .tstip-note { font-size: 10px; color: var(--dsw-alias-label-tertiary); margin-top: 3px; }
538
-
539
- /* ---------- 花费页:余额 + 完整官方价格表 ---------- */
540
- .ts-bal-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; padding: 14px 20px 8px; flex-wrap: wrap; }
541
- .ts-bal-title { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
542
- .ts-bal-cells { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border-top: 1px solid var(--dsw-alias-border-l1); }
543
- .ts-bal-cell { padding: 12px 20px; min-width: 0; }
544
- .ts-bal-cell + .ts-bal-cell { border-left: 1px solid var(--dsw-alias-border-l1); }
545
- .ts-bal-label { font-size: 11.5px; color: var(--dsw-alias-label-secondary); white-space: nowrap; }
546
- .ts-bal-value { font-size: 19px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
547
- .ts-bal-sub { font-size: 11px; color: var(--dsw-alias-label-tertiary); margin-top: 5px; font-variant-numeric: tabular-nums; }
548
- .ts-bal-table { padding: 10px 20px 12px; border-top: 1px solid var(--dsw-alias-border-l1); }
549
- .ts-bal-table-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
550
- .ts-bal-table-title { font-size: 11.5px; color: var(--dsw-alias-label-secondary); }
551
- .ts-bal-foot { padding: 8px 20px 12px; border-top: 1px solid var(--dsw-alias-border-l1); font-size: 10.5px; color: var(--dsw-alias-label-tertiary); line-height: 1.5; }
1549
+ .tstip-grid {
1550
+ display: grid;
1551
+ grid-template-columns: minmax(42px, 1fr) repeat(3, auto);
1552
+ gap: 4px 12px;
1553
+ align-items: baseline;
1554
+ font-size: 11px;
1555
+ }
1556
+ .tstip-grid-th { font-size: 9.5px; color: var(--dsw-alias-label-tertiary); text-align: right; }
1557
+ .tstip-grid-th:first-child { text-align: left; }
1558
+ .tstip-grid-model { color: var(--dsw-alias-label-secondary); }
1559
+ .tstip-grid-val { text-align: right; font-weight: 650; }
1560
+ .tstip-grid-off .tstip-grid-val { color: var(--tstip-off); }
1561
+ .tstip-grid-peak .tstip-grid-val { color: var(--tstip-peak); }
1562
+ .tstip-foot {
1563
+ margin-top: 8px;
1564
+ padding-top: 7px;
1565
+ border-top: 1px solid var(--tstip-div);
1566
+ display: flex;
1567
+ align-items: baseline;
1568
+ justify-content: space-between;
1569
+ gap: 12px;
1570
+ font-size: 9.5px;
1571
+ color: var(--dsw-alias-label-tertiary);
1572
+ white-space: nowrap;
1573
+ }
1574
+ .tstip-note { font-size: 10px; color: var(--dsw-alias-label-tertiary); margin-top: 4px; }
1575
+
1576
+ /* ---------- 响应式适配:优先按设置面板自身宽度(@container),兼顾窄窗兜底 ---------- */
1577
+ @container ts-page (max-width: 580px) {
1578
+ .ts-bento-utility { grid-template-columns: minmax(0, 1fr); }
1579
+ .ts-hero-stat-val { font-size: 18px; }
1580
+ .ts-trend-figure { font-size: 21px; }
1581
+ .ts-trend-strip { gap: 14px; }
1582
+ }
1583
+ @container ts-page (max-width: 520px) {
1584
+ .ts-bento-top { grid-template-columns: minmax(0, 1fr); }
1585
+ .ts-trend-strip {
1586
+ grid-template-columns: repeat(2, minmax(0, 1fr));
1587
+ gap: 12px 14px;
1588
+ }
1589
+ .ts-trend-center { grid-column: 1 / -1; order: 3; }
1590
+ .ts-row { grid-template-columns: minmax(0, 1fr) 68px 54px; }
1591
+ .ts-row-model { display: none; }
1592
+ .ts-model-row { grid-template-columns: minmax(0, 1fr) 72px minmax(84px, auto); }
1593
+ }
1594
+ @container ts-page (max-width: 400px) {
1595
+ .ts-hero-subgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 0; }
1596
+ .ts-hero-stat:nth-child(3) { padding-left: 0; border-left: 0; grid-column: 1 / -1; padding-top: 10px; border-top: 1px solid var(--ts-divider); }
1597
+ }
1598
+ @media (max-width: 660px) {
1599
+ .ts-bento-top { grid-template-columns: minmax(0, 1fr); }
1600
+ .ts-bento-utility { grid-template-columns: minmax(0, 1fr); }
1601
+ .ts-trend-strip {
1602
+ grid-template-columns: repeat(2, minmax(0, 1fr));
1603
+ gap: 12px 14px;
1604
+ }
1605
+ .ts-trend-center { grid-column: 1 / -1; order: 3; }
1606
+ .ts-row { grid-template-columns: minmax(0, 1fr) 68px 54px; }
1607
+ .ts-row-model { display: none; }
1608
+ }
552
1609
  `;
553
1610
 
554
1611
  function apiUrl(routePath) {
@@ -565,13 +1622,14 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
565
1622
  return body;
566
1623
  }
567
1624
 
568
- /** 284.6K / 1.2M: compact numbers, one decimal under 100 units. */
1625
+ /** 284.6K / 1.2M / 14.3B: compact numbers, one decimal under 100 units. */
569
1626
  function fmtTokens(value) {
570
1627
  const n = Number.isFinite(value) ? value : 0;
571
1628
  if (n <= 0) return '0';
572
1629
  if (n < 1000) return String(Math.round(n));
573
- if (n < 1000 * 1000) return `${trim(n / 1000)}K`;
574
- return `${trim(n / 1e6)}M`;
1630
+ if (n < 1e6) return `${trim(n / 1000)}K`;
1631
+ if (n < 1e9) return `${trim(n / 1e6)}M`;
1632
+ return `${trim(n / 1e9)}B`;
575
1633
  }
576
1634
 
577
1635
  function trim(value) {
@@ -992,10 +2050,10 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
992
2050
  * come from the theme so the bar matches the surrounding panel.
993
2051
  */
994
2052
  const COMPOSITION = [
995
- { key: 'cacheRead', color: 'var(--dsw-alias-brand-primary)' },
996
- { key: 'input', color: '#4b93c8' },
997
- { key: 'output', color: '#6f8fb0' },
998
- { key: 'cacheWrite', color: '#3d7197' },
2053
+ { key: 'cacheRead', color: 'var(--ts-blue)' },
2054
+ { key: 'input', color: 'var(--ts-cyan)' },
2055
+ { key: 'output', color: 'var(--ts-indigo)' },
2056
+ { key: 'cacheWrite', color: 'var(--ts-green)' },
999
2057
  ];
1000
2058
 
1001
2059
  function dateKey(date) {
@@ -1051,7 +2109,7 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
1051
2109
  const HEAT_LEVELS = 4;
1052
2110
 
1053
2111
  /**
1054
- * 级别 → 涂装类名。0 是空格子,1–5 是五档热度。
2112
+ * 级别 → 涂装类名。0 是空格子,1–4 是四档热度。
1055
2113
  * 越界一律夹到两端,避免画出不存在的档。
1056
2114
  */
1057
2115
  function cellPaintClass(level) {
@@ -1059,12 +2117,6 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
1059
2117
  return `ts-cell-paint ts-cell-paint-l${clamped}`;
1060
2118
  }
1061
2119
 
1062
- function gradeTone(grade) {
1063
- if (grade === 'A' || grade === 'B') return 'var(--dsw-alias-state-success-primary)';
1064
- if (grade === 'C') return 'var(--dsw-alias-state-warn-primary)';
1065
- return 'var(--dsw-alias-state-error-primary)';
1066
- }
1067
-
1068
2120
  /** Peak-relative intensity: 0 empty, 1..3 quartiles of the busiest day, 4 the peak. */
1069
2121
  function intensity(total, peak) {
1070
2122
  if (!(total > 0) || !(peak > 0)) return 0;
@@ -1126,6 +2178,10 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
1126
2178
  }
1127
2179
  columns.push(cells);
1128
2180
  }
2181
+ // 第 0 列与第 1 列若紧挨着换月,隐藏第 0 列的残月标签,避免月份字重叠。
2182
+ if (months.length >= 2 && months[0].index === 0 && months[1].index === 1) {
2183
+ months.shift();
2184
+ }
1129
2185
  return { columns, months, weeks };
1130
2186
  }
1131
2187
 
@@ -1336,12 +2392,49 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
1336
2392
  const TIP_GAP = 6;
1337
2393
 
1338
2394
  function build(content, host) {
1339
- if (typeof content.head === 'string' && content.head.length > 0) {
2395
+ const hasHead = typeof content.head === 'string' && content.head.length > 0;
2396
+ const hasHeadSub = typeof content.headRight === 'string' && content.headRight.length > 0;
2397
+ if (hasHead && hasHeadSub) {
2398
+ const bar = document.createElement('div');
2399
+ bar.className = 'tstip-head-bar';
2400
+ const head = document.createElement('span');
2401
+ head.className = 'tstip-head';
2402
+ head.textContent = content.head;
2403
+ const sub = document.createElement('span');
2404
+ sub.className = 'tstip-head-sub';
2405
+ sub.textContent = content.headRight;
2406
+ bar.append(head, sub);
2407
+ host.appendChild(bar);
2408
+ } else if (hasHead) {
1340
2409
  const head = document.createElement('div');
1341
2410
  head.className = 'tstip-head';
1342
2411
  head.textContent = content.head;
1343
2412
  host.appendChild(head);
1344
2413
  }
2414
+ if (content.table && Array.isArray(content.table.columns) && Array.isArray(content.table.rows)) {
2415
+ const grid = document.createElement('div');
2416
+ const tone = content.table.tone === 'peak' ? ' tstip-grid-peak' : content.table.tone === 'off' ? ' tstip-grid-off' : '';
2417
+ grid.className = `tstip-grid${tone}`;
2418
+ for (const col of content.table.columns) {
2419
+ const th = document.createElement('span');
2420
+ th.className = 'tstip-grid-th';
2421
+ th.textContent = col;
2422
+ grid.appendChild(th);
2423
+ }
2424
+ for (const row of content.table.rows) {
2425
+ const model = document.createElement('span');
2426
+ model.className = 'tstip-grid-model';
2427
+ model.textContent = row.label;
2428
+ grid.appendChild(model);
2429
+ for (const val of row.values ?? []) {
2430
+ const cell = document.createElement('b');
2431
+ cell.className = 'tstip-grid-val';
2432
+ cell.textContent = String(val);
2433
+ grid.appendChild(cell);
2434
+ }
2435
+ }
2436
+ host.appendChild(grid);
2437
+ }
1345
2438
  for (const row of content.rows ?? []) {
1346
2439
  const line = document.createElement('div');
1347
2440
  line.className = 'tstip-row';
@@ -1352,6 +2445,16 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
1352
2445
  line.append(label, value);
1353
2446
  host.appendChild(line);
1354
2447
  }
2448
+ if (content.footer && (content.footer.left || content.footer.right)) {
2449
+ const foot = document.createElement('div');
2450
+ foot.className = 'tstip-foot';
2451
+ const left = document.createElement('span');
2452
+ left.textContent = content.footer.left ?? '';
2453
+ const right = document.createElement('span');
2454
+ right.textContent = content.footer.right ?? '';
2455
+ foot.append(left, right);
2456
+ host.appendChild(foot);
2457
+ }
1355
2458
  if (typeof content.note === 'string' && content.note.length > 0) {
1356
2459
  const note = document.createElement('div');
1357
2460
  note.className = 'tstip-note';
@@ -1387,9 +2490,13 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
1387
2490
  element.style.right = 'auto';
1388
2491
  element.style.bottom = 'auto';
1389
2492
  element.style.margin = '0';
1390
- element.style.border = '1px solid var(--dsw-alias-border-l2)';
1391
- element.style.background = 'var(--dsw-alias-bg-overlay, var(--dsw-alias-bg-layer-2))';
1392
- element.style.padding = '8px 10px';
2493
+ element.style.border = '1px solid var(--tstip-border)';
2494
+ element.style.borderRadius = '14px';
2495
+ element.style.background = 'var(--tstip-bg)';
2496
+ element.style.boxShadow = 'var(--tstip-shadow)';
2497
+ element.style.backdropFilter = 'blur(22px) saturate(180%)';
2498
+ element.style.webkitBackdropFilter = 'blur(22px) saturate(180%)';
2499
+ element.style.padding = '10px 13px';
1393
2500
  element.style.overflow = 'visible';
1394
2501
  document.body.appendChild(element);
1395
2502
  return element;
@@ -1468,10 +2575,9 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
1468
2575
  }
1469
2576
 
1470
2577
  /**
1471
- * 24 小时峰谷格子图(今天,北京时间):每小时一格,高峰红、其余绿。
1472
- * 当前小时不描边——7–9px 的格子上描边会吃掉自己的圆角、挨到邻格,
1473
- * 整条读出多出一个方框;改为这一格提亮一档、条下正对它落一个圆点。
1474
- * 用网格排版,格子位置由布局决定,不依赖像素取整,所以对齐天生是齐的。
2578
+ * 24 小时峰谷微胶囊条(今天,北京时间):每小时一格,高峰红、其余绿。
2579
+ * 已过小时柔和压暗、未来清透、当前小时高亮微光并在条下正对落圆点。
2580
+ * 仅在传入 tip 时绑定悬停浮窗(侧栏紧凑态保持静默,不弹浮窗)。
1475
2581
  */
1476
2582
  function PeakTimeline(props) {
1477
2583
  const t = props.t;
@@ -1485,33 +2591,34 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
1485
2591
  // 下一次切换若在明天,超出本条范围:只在浮窗里说明方向。
1486
2592
  const switchClipped = !(Number.isFinite(peak.until) && peak.until < origin + DAY_MS)
1487
2593
  && Number.isFinite(peak.until);
1488
- const content = {
2594
+ const content = tip ? {
1489
2595
  head: t('peakStripHead'),
1490
2596
  rows: [
1491
2597
  { label: t('peakNowLabel'), value: peak.kind === 'off' ? t('offPeak') : t('peak') },
1492
2598
  { label: t('peakWindowsLabel'), value: spans.length === 0 ? t('peakNoneToday') : t('peakEachWindow') },
1493
2599
  ...(switchClipped ? [{ label: t('peakNextLabel'), value: peak.nextKind === 'peak' ? t('peak') : t('offPeak') }] : []),
1494
2600
  ],
1495
- };
1496
- // 24 个格子:高峰小时红、其余绿。用网格而不是连续长条——
1497
- // 格子位置由布局决定,不依赖像素取整,所以不会有交界混色,看起来是齐的。
2601
+ } : null;
2602
+ // 24 个微胶囊:已过小时柔和压暗、未来清透、当前格高亮微光 + 底部落圆点。
1498
2603
  const cells = hourCells(now);
1499
2604
  const nowHour = beijingParts(now).hour;
1500
- // 「此刻」不描边:当前格提亮一档,条下正对它落一个圆点。
1501
- // 整条始终是一条连续的进度带,不会多出一个打断形状的方框。
1502
- const classOf = (hour) => `ts-tl-cell ts-tl-cell-${cells[hour].kind}${hour === nowHour ? ' ts-tl-cell-now' : ''}`;
2605
+ const classOf = (hour) => {
2606
+ const timeCls = hour < nowHour ? 'ts-tl-cell-past' : hour === nowHour ? 'ts-tl-cell-now' : 'ts-tl-cell-future';
2607
+ return `ts-tl-cell ts-tl-cell-${cells[hour].kind} ${timeCls}`;
2608
+ };
1503
2609
  return h('div', { className: `ts-tl${props.compact ? ' ts-tl-compact' : ''}` },
1504
2610
  h('div', {
1505
2611
  className: 'ts-tl-cells',
1506
2612
  role: 'img',
1507
2613
  'aria-label': t('peakStripHead'),
1508
- onMouseEnter: (event) => tip.show(event.currentTarget, content),
1509
- onMouseLeave: () => tip.hide(),
2614
+ ...(content !== null ? {
2615
+ onMouseEnter: (event) => tip.show(event.currentTarget, content),
2616
+ onMouseLeave: () => tip.hide(),
2617
+ } : {}),
1510
2618
  },
1511
2619
  ...cells.map((cell) => h('span', {
1512
2620
  key: cell.hour,
1513
2621
  className: classOf(cell.hour),
1514
- title: `${pad2(cell.hour)}:00 · ${cell.kind === 'peak' ? t('peak') : t('offPeak')}`,
1515
2622
  })),
1516
2623
  ),
1517
2624
  h('div', { className: 'ts-tl-marks', 'aria-hidden': 'true' },
@@ -1529,22 +2636,7 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
1529
2636
  );
1530
2637
  }
1531
2638
 
1532
- /** 侧栏一行价:**三个口径都给**(命中·未命中·输出),只给当前时段的价。
1533
- 模型之间用空格分隔,口径之间用 · 分隔。 */
1534
- function priceLine(peak) {
1535
- const slot = peak?.kind === 'off' ? 'offPeak' : 'peak';
1536
- const items = [];
1537
- PRICING.models.forEach((model, index) => {
1538
- if (index > 0) items.push(' ');
1539
- items.push(h('span', { key: model.id }, `${shortModel(model.id)} ${model[slot].hit}·${model[slot].miss}·${model[slot].out}`));
1540
- });
1541
- return items;
1542
- }
1543
-
1544
- /**
1545
- * 官方价文字表:两模型 × 三项(命中 / 未命中 / 输出),当前时段一列加粗。
1546
- * 条形版换回文字版——数字本身就是要看的信息。
1547
- */
2639
+ /** 官方价文字表:两模型 × 三项(命中 / 未命中 / 输出),当前时段加粗、高峰列红字。 */
1548
2640
  function PriceTable(props) {
1549
2641
  const t = props.t;
1550
2642
  const peak = props.peak;
@@ -1574,19 +2666,6 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
1574
2666
  );
1575
2667
  }
1576
2668
 
1577
- function peakBadge(peak, t, tip) {
1578
- const off = peak.kind === 'off';
1579
- const content = {
1580
- head: off ? t('peakDiscount') : t('peak'),
1581
- note: off ? t('peakOffRule') : t('peakWindowsHint'),
1582
- };
1583
- return h('span', {
1584
- className: `tsb-badge ${off ? 'tsb-badge-off' : 'tsb-badge-peak'}`,
1585
- onMouseEnter: (event) => tip.show(event.currentTarget, content),
1586
- onMouseLeave: () => tip.hide(),
1587
- }, off ? t('peakDiscount') : t('peak'));
1588
- }
1589
-
1590
2669
  /* ---------------------- 低余额充值提醒 ---------------------- */
1591
2670
 
1592
2671
  const LOW_BALANCE_KEY = 'dsh-spend-ledger/low-balance';
@@ -1620,7 +2699,7 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
1620
2699
  }
1621
2700
 
1622
2701
  /**
1623
- * 充值提醒设置的唯一来源。侧栏卡片和花费页的输入框都订阅它——
2702
+ * 充值提醒设置的唯一来源。侧栏与花费页输入框都订阅它——
1624
2703
  * 否则两处各自 useState,在设置页改完阈值侧栏根本不知道。
1625
2704
  */
1626
2705
  const lowBalanceStore = (() => {
@@ -1710,6 +2789,33 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
1710
2789
  );
1711
2790
  }
1712
2791
 
2792
+ function IconRefresh() {
2793
+ return h('svg', { viewBox: '0 0 16 16', fill: 'none', stroke: 'currentColor', strokeWidth: '1.5', strokeLinecap: 'round', strokeLinejoin: 'round', 'aria-hidden': 'true' },
2794
+ h('path', { d: 'M13.5 8a5.5 5.5 0 1 1-1.35-3.6' }),
2795
+ h('path', { d: 'M13.5 2.75v2.9h-2.9' }),
2796
+ );
2797
+ }
2798
+
2799
+ function IconSettings() {
2800
+ return h('svg', { viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '1.85', strokeLinecap: 'round', strokeLinejoin: 'round', 'aria-hidden': 'true' },
2801
+ h('circle', { cx: '12', cy: '12', r: '3' }),
2802
+ h('path', { d: 'M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 1 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 1 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33h.08a1.65 1.65 0 0 0 .92-1.51V3a2 2 0 1 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82v.08a1.65 1.65 0 0 0 1.51.92H21a2 2 0 1 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1Z' }),
2803
+ );
2804
+ }
2805
+
2806
+ function IconChevron(props) {
2807
+ return h('svg', { viewBox: '0 0 16 16', fill: 'none', stroke: 'currentColor', strokeWidth: '1.7', strokeLinecap: 'round', strokeLinejoin: 'round', 'aria-hidden': 'true' },
2808
+ h('path', { d: props.dir === 'left' ? 'M9.75 3.75 5.5 8l4.25 4.25' : 'M6.25 3.75 10.5 8l-4.25 4.25' }),
2809
+ );
2810
+ }
2811
+
2812
+ function IconLedgerMark() {
2813
+ return h('svg', { viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '1.85', strokeLinecap: 'round', strokeLinejoin: 'round', 'aria-hidden': 'true' },
2814
+ h('circle', { cx: '12', cy: '12', r: '8.5', opacity: '0.26' }),
2815
+ h('path', { d: 'M8.5 7.4 12 12l3.5-4.6M12 12v5.4M9.1 14.5h5.8' }),
2816
+ );
2817
+ }
2818
+
1713
2819
  /** 花费页的余额提醒:只留最低余额,0 表示关闭提醒。 */
1714
2820
  function LowBalanceSettings(props) {
1715
2821
  const t = props.t;
@@ -1731,11 +2837,12 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
1731
2837
  && settings.dismissedAt > 0
1732
2838
  && Date.now() - settings.dismissedAt < LOW_DISMISS_TTL_MS;
1733
2839
  return h('div', { className: 'ts-low' },
1734
- h('div', { className: 'ts-low-title' }, t('lowSettingsTitle')),
1735
- h('div', { className: 'ts-low-fields' },
1736
- h('label', { className: 'ts-low-field' },
1737
- h('span', { className: 'ts-low-label' }, t('lowThresholdLabel')),
2840
+ h('label', { className: 'ts-low-field' },
2841
+ h('span', { className: 'ts-low-label' }, t('lowThresholdLabel')),
2842
+ h('div', { className: 'ts-low-input-wrap' },
2843
+ h('span', { className: 'ts-low-prefix', 'aria-hidden': 'true' }, '¥'),
1738
2844
  h('input', {
2845
+ ref: props.inputRef,
1739
2846
  className: 'ts-low-input',
1740
2847
  type: 'number',
1741
2848
  min: 0,
@@ -1746,8 +2853,8 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
1746
2853
  onBlur: commit,
1747
2854
  onKeyDown: (event) => { if (event.key === 'Enter') commit(); },
1748
2855
  }),
1749
- h('span', { className: 'ts-low-hint' }, t('lowThresholdHint')),
1750
2856
  ),
2857
+ h('span', { className: 'ts-low-hint' }, t('lowThresholdHint')),
1751
2858
  ),
1752
2859
  silenced
1753
2860
  ? h('div', { className: 'ts-low-silent' },
@@ -1759,7 +2866,6 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
1759
2866
  }, t('lowResume')),
1760
2867
  )
1761
2868
  : null,
1762
- h('div', { className: 'ts-low-note' }, t('lowSettingsNote')),
1763
2869
  );
1764
2870
  }
1765
2871
 
@@ -1814,10 +2920,34 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
1814
2920
  }
1815
2921
  }
1816
2922
 
1817
- /** 侧栏底部的那张卡:余额 + 峰谷 + 今日花费 + 官方价,收起时只留色点与状态字。 */
2923
+ /** 统一的苹果风 4 列官方价目毛玻璃浮窗内容(花费页账户徽章悬停展示)。 */
2924
+ function buildPricePopover(peak, today, t) {
2925
+ const off = peak.kind === 'off';
2926
+ const slot = off ? 'offPeak' : 'peak';
2927
+ const leftFoot = today !== null && today !== undefined && today.total > 0
2928
+ ? t('todayUsedShort').replace('{tokens}', `${fmtTokens(today.total)} ${t('tokens')}`)
2929
+ : (off ? t('peakOffRule') : t('peak'));
2930
+ return {
2931
+ head: `${t('priceTitle')} · ${off ? t('peakDiscount') : t('peak')}`,
2932
+ headRight: t('priceUnit'),
2933
+ table: {
2934
+ tone: off ? 'off' : 'peak',
2935
+ columns: [t('priceModel'), t('priceHitShort'), t('priceMissShort'), t('priceOutput')],
2936
+ rows: PRICING.models.map((model) => ({
2937
+ label: shortModel(model.id),
2938
+ values: [model[slot].hit, model[slot].miss, model[slot].out],
2939
+ })),
2940
+ },
2941
+ footer: {
2942
+ left: leftFoot,
2943
+ right: t('peakWindowShort'),
2944
+ },
2945
+ };
2946
+ }
2947
+
2948
+ /** 侧栏底部「余额 + 峰谷」无外壳流式行:静默展示不弹浮窗,收起时只留微光色点与状态字。 */
1818
2949
  function SidebarBalanceCard(props) {
1819
2950
  const t = typeof props.t === 'function' ? props.t : (key) => key;
1820
- const tip = props.tip;
1821
2951
  const store = props.store;
1822
2952
  const account = useAccountStore(store);
1823
2953
  const now = useNow(35_000);
@@ -1830,7 +2960,6 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
1830
2960
  const lowSettings = useLowBalanceSettings();
1831
2961
  const lowAmount = walletAmount(account.balance?.status === 'ready' ? account.balance.value : undefined);
1832
2962
  const lowBalance = needsTopUp(lowAmount, lowSettings) ? lowAmount : null;
1833
- // 读屏只需要一句:这张卡是什么、现在什么价段、余额多少。细节在悬停浮窗里。
1834
2963
  const label = [
1835
2964
  t('balanceTitle'),
1836
2965
  period,
@@ -1862,13 +2991,14 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
1862
2991
  : null,
1863
2992
  h('span', { className: 'tsb-spacer' }),
1864
2993
  today !== null && today.total > 0
1865
- ? h('span', { className: 'tsb-today', title: t('todayHint') }, `${t('today')} `, h('b', {}, fmtTokens(today.total)))
2994
+ ? h('span', { className: 'tsb-today' }, `${t('today')} `, h('b', {}, fmtTokens(today.total)))
1866
2995
  : null,
1867
- peakBadge(peak, t, tip),
2996
+ h('span', { className: `tsb-badge ${peak.kind === 'off' ? 'tsb-badge-off' : 'tsb-badge-peak'}` },
2997
+ peak.kind === 'off' ? t('peakDiscount') : t('peak'),
2998
+ ),
1868
2999
  ),
1869
3000
  h('div', { className: 'tsb-peak' }, line),
1870
- h(PeakTimeline, { t, tip, now, peak, compact: true }),
1871
- h('div', { className: 'tsb-prices' }, priceLine(peak)),
3001
+ h(PeakTimeline, { t, now, peak, compact: true }),
1872
3002
  lowBalance !== null
1873
3003
  ? h(LowBalanceBanner, {
1874
3004
  t,
@@ -1887,82 +3017,97 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
1887
3017
  );
1888
3018
  }
1889
3019
 
1890
- /**「花费」页顶部:余额、峰谷与官方价格(文字表:两模型 × 三项 × 峰/谷两列)。 */
1891
- function BalancesCard(props) {
3020
+ /**「花费」页右上方 Bento 卡:账户余额、赠金、徽章与 24 小时峰谷状态。 */
3021
+ function AccountBentoCard(props) {
1892
3022
  const t = props.t;
1893
3023
  const tip = props.tip;
1894
3024
  const store = props.store;
3025
+ const now = props.now;
3026
+ const peak = props.peak;
1895
3027
  const account = useAccountStore(store);
1896
- const now = useNow(15_000);
1897
- const peak = React.useMemo(() => peakState(now), [now]);
1898
3028
  const view = balanceView(account, t);
1899
3029
  const line = peakLine(peak, now, t);
1900
- const today = props.today && typeof props.today === 'object'
1901
- ? { total: Number(props.today.total) || 0, calls: Number(props.today.calls) || 0 }
1902
- : null;
1903
- const cells = [
1904
- {
1905
- key: 'recharge',
1906
- label: t('rechargeBalance'),
1907
- value: view.signedIn ? (view.amount.length > 0 ? view.amount : t('balanceLoading')) : t('balanceSignedOut'),
1908
- sub: account.stale ? t('balanceStale') : '',
1909
- },
1910
- {
1911
- key: 'bonus',
1912
- label: t('bonusBalance'),
1913
- value: view.signedIn ? (view.bonusAmount.length > 0 ? view.bonusAmount : '—') : '—',
1914
- sub: '',
1915
- },
1916
- {
1917
- key: 'peak',
1918
- label: peak.kind === 'off' ? t('offPeak') : t('peak'),
1919
- value: peak.kind === 'off' ? t('peakDiscount') : t('peak'),
1920
- sub: line,
1921
- },
1922
- ...(today !== null
1923
- ? [{
1924
- key: 'todaySpend',
1925
- label: t('today'),
1926
- value: fmtTokens(today.total),
1927
- sub: today.calls > 0 ? t('calls').replace('{n}', '') + fmtInt(today.calls) : '',
1928
- }]
1929
- : []),
1930
- ];
1931
- // 价格给数字:两模型 × 三项,当前时段那一侧加粗,另一侧淡显。
1932
- return h('div', { className: 'ts-card' },
1933
- h('div', { className: 'ts-bal-head' },
1934
- h('div', null,
1935
- h('div', { className: 'ts-bal-title' }, t('balanceTitle')),
3030
+ const priceSummaryTip = buildPricePopover(peak, props.today, t);
3031
+
3032
+ const renderBalance = () => {
3033
+ if (!view.signedIn) return h('div', { className: 'ts-account-balance ts-account-balance-muted' }, t('balanceSignedOut'));
3034
+ if (view.wallets !== undefined) return h('div', { className: 'ts-account-balance' }, view.amount);
3035
+ if (view.loading) return h('div', { className: 'ts-account-balance ts-account-balance-muted' }, t('balanceLoading'));
3036
+ const label = t('balanceUnavailable');
3037
+ return h('div', { className: 'ts-account-balance ts-account-balance-muted' },
3038
+ view.usageUrl === undefined
3039
+ ? label
3040
+ : h('a', { className: 'tsb-link', href: view.usageUrl, target: '_blank', rel: 'noreferrer' }, label),
3041
+ );
3042
+ };
3043
+
3044
+ return h('div', { className: 'ts-card ts-account-card' },
3045
+ h('div', { className: 'ts-account-top' },
3046
+ h('div', { className: 'ts-account-kicker' },
3047
+ h('span', null, t('accountTitle')),
3048
+ account.stale ? h('span', { className: 'ts-account-stale' }, t('balanceStale')) : null,
3049
+ ),
3050
+ renderBalance(),
3051
+ h('div', { className: 'ts-account-kv' },
3052
+ h('span', null, t('bonusBalance')),
3053
+ h('b', null, view.signedIn && view.bonusAmount.length > 0 ? view.bonusAmount : '—'),
3054
+ ),
3055
+ ),
3056
+ h('div', { className: 'ts-account-mid' },
3057
+ h('div', {
3058
+ className: 'ts-emblem-tile',
3059
+ onMouseEnter: (event) => tip.show(event.currentTarget, priceSummaryTip),
3060
+ onMouseLeave: () => tip.hide(),
3061
+ }, h(IconLedgerMark)),
3062
+ h('div', { className: 'ts-account-peak-info' },
3063
+ h('div', { className: 'ts-account-peak-kicker' }, t('peakPeriodLabel')),
3064
+ h('div', {
3065
+ className: `ts-account-peak-val ${peak.kind === 'off' ? 'ts-account-peak-val-off' : 'ts-account-peak-val-peak'}`,
3066
+ }, peak.kind === 'off' ? t('peakDiscount') : t('peak')),
1936
3067
  ),
1937
- h('div', { className: 'ts-legend' }, peakBadge(peak, t, tip)),
1938
3068
  ),
1939
- h('div', { className: 'ts-bal-cells' },
1940
- ...cells.map((cell) => h('div', { key: cell.key, className: 'ts-bal-cell' },
1941
- h('div', { className: 'ts-bal-label' }, cell.label),
1942
- h('div', { className: 'ts-bal-value' }, cell.value),
1943
- cell.sub.length > 0 ? h('div', { className: 'ts-bal-sub' }, cell.sub) : null,
1944
- )),
3069
+ h('div', { className: 'ts-account-timeline' },
3070
+ h('div', { className: 'ts-account-countdown' }, line),
3071
+ h(PeakTimeline, { t, tip, now, peak }),
1945
3072
  ),
1946
- h('div', { className: 'ts-bal-timeline' }, h(PeakTimeline, { t, tip, now, peak })),
1947
- h('div', { className: 'ts-bal-table' },
1948
- h('div', { className: 'ts-bal-table-head' },
1949
- h('span', { className: 'ts-bal-table-title' }, t('priceTitle')),
1950
- h('span', { className: 'ts-bal-table-title' }, peak.kind === 'off' ? t('offPeak') : t('peak')),
3073
+ );
3074
+ }
3075
+
3076
+ /** 官方价目 Bento 卡:两模型 × 三项 × 峰/谷两列。 */
3077
+ function TariffPricingCard(props) {
3078
+ const t = props.t;
3079
+ const peak = props.peak;
3080
+ return h('div', { className: `ts-card ts-util-card${props.pulse ? ' ts-card-pulse' : ''}` },
3081
+ h('div', null,
3082
+ h('div', { className: 'ts-util-head', style: { marginBottom: '12px' } },
3083
+ h('span', { className: 'ts-util-title' }, t('priceTitle')),
3084
+ h('span', { className: 'ts-util-chip' }, t('priceUnit')),
1951
3085
  ),
1952
3086
  h(PriceTable, { t, peak }),
1953
- h('div', { className: 'ts-bal-legend' },
1954
- h('span', { className: 'ts-bal-unit' }, t('priceUnit')),
1955
- ),
1956
3087
  ),
1957
- h('div', { className: 'ts-bal-foot' },
1958
- h('span', null,
1959
- t('priceSource').replace('{date}', PRICING.retrieved),
1960
- peak.coverageYear === null ? ` · ${t('holidayUncovered')}` : '',
1961
- ),
3088
+ h('div', { className: 'ts-util-foot' },
3089
+ t('priceSource').replace('{date}', PRICING.retrieved),
3090
+ peak.coverageYear === null ? ` · ${t('holidayUncovered')}` : '',
1962
3091
  ),
1963
- h('div', { className: 'ts-bal-table' },
1964
- h(LowBalanceSettings, { t, settings: props.lowSettings }),
3092
+ );
3093
+ }
3094
+
3095
+ /** 低余额提醒 Bento 卡:最低余额阈值配置与状态。 */
3096
+ function LowBalanceCard(props) {
3097
+ const t = props.t;
3098
+ const settings = props.settings ?? { threshold: 0, dismissed: '' };
3099
+ const active = settings.threshold > 0;
3100
+ return h('div', { className: `ts-card ts-util-card${props.pulse ? ' ts-card-pulse' : ''}` },
3101
+ h('div', null,
3102
+ h('div', { className: 'ts-util-head', style: { marginBottom: '12px' } },
3103
+ h('span', { className: 'ts-util-title' }, t('lowSettingsTitle')),
3104
+ h('span', { className: `ts-util-chip${active ? ' ts-util-chip-on' : ''}` },
3105
+ active ? t('lowAlertOn').replace('{n}', String(settings.threshold)) : t('lowAlertOff'),
3106
+ ),
3107
+ ),
3108
+ h(LowBalanceSettings, { t, settings, inputRef: props.inputRef }),
1965
3109
  ),
3110
+ h('div', { className: 'ts-util-foot' }, t('lowSettingsNote')),
1966
3111
  );
1967
3112
  }
1968
3113
 
@@ -1971,9 +3116,21 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
1971
3116
  const [loading, setLoading] = React.useState(false);
1972
3117
  const [error, setError] = React.useState(null);
1973
3118
  const [selected, setSelected] = React.useState(null);
3119
+ const [heatFocused, setHeatFocused] = React.useState(false);
1974
3120
  const [hover, setHover] = React.useState(null);
3121
+ const [heatMetric, setHeatMetric] = React.useState('total');
3122
+ const [pulseUtil, setPulseUtil] = React.useState(false);
1975
3123
  const lowSettings = useLowBalanceSettings();
3124
+ const now = useNow(15_000);
3125
+ const peak = React.useMemo(() => peakState(now), [now]);
1976
3126
  const cardRef = React.useRef(null);
3127
+ const utilityRef = React.useRef(null);
3128
+ const thresholdInputRef = React.useRef(null);
3129
+ const pulseTimerRef = React.useRef(null);
3130
+
3131
+ React.useEffect(() => () => {
3132
+ if (pulseTimerRef.current !== null) window.clearTimeout(pulseTimerRef.current);
3133
+ }, []);
1977
3134
 
1978
3135
  // 页面上所有悬停说明都走同一只浮窗(原生 title 不能设计、也不跟主题)。
1979
3136
  const hoverTip = (content) => ({
@@ -2020,6 +3177,15 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
2020
3177
  load(false);
2021
3178
  }, [load]);
2022
3179
 
3180
+ const jumpToUtility = () => {
3181
+ utilityRef.current?.scrollIntoView?.({ behavior: 'smooth', block: 'nearest' });
3182
+ setPulseUtil(false);
3183
+ queueMicrotask(() => setPulseUtil(true));
3184
+ if (pulseTimerRef.current !== null) window.clearTimeout(pulseTimerRef.current);
3185
+ pulseTimerRef.current = window.setTimeout(() => setPulseUtil(false), 1200);
3186
+ window.setTimeout(() => thresholdInputRef.current?.focus?.({ preventScroll: true }), 260);
3187
+ };
3188
+
2023
3189
  const days = React.useMemo(() => (Array.isArray(data?.days) ? data.days : []), [data]);
2024
3190
  const totals = React.useMemo(() => countersOf(data?.totals), [data]);
2025
3191
 
@@ -2039,7 +3205,12 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
2039
3205
  ].filter((part) => part.length > 0).join(' · ');
2040
3206
  const statusText = data === null
2041
3207
  ? null
2042
- : (data.stale === true ? t('revalidating') : t('lastUpdated')).replace('{time}', fmtTime(data.generatedAt));
3208
+ : data.stale === true
3209
+ ? t('refreshingShort')
3210
+ : t('lastUpdated').replace('{time}', fmtTime(data.generatedAt));
3211
+ const statusDetailTip = data !== null && data.stale === true
3212
+ ? { head: t('revalidating').replace('{time}', fmtTime(data.generatedAt)) }
3213
+ : null;
2043
3214
 
2044
3215
  const budget = data?.budget && typeof data.budget === 'object' ? data.budget : { tokens: 0, source: 'auto' };
2045
3216
  const budgetTokens = Number.isFinite(budget.tokens) ? budget.tokens : 0;
@@ -2048,18 +3219,38 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
2048
3219
  : { total: 0, previous: 0, calls: 0 };
2049
3220
  const todayDelta = fmtDelta(todayBlock.total, todayBlock.previous);
2050
3221
  // The budget is a day budget, so the bar tracks today rather than all time.
2051
- const budgetRatio = budgetTokens > 0 ? Math.min(1, todayBlock.total / budgetTokens) : 0;
3222
+ const rawBudgetRatio = budgetTokens > 0 ? todayBlock.total / budgetTokens : 0;
3223
+ const budgetRatio = Math.min(1, rawBudgetRatio);
3224
+ const budgetBarWidth = todayBlock.total > 0 ? Math.max(2, Math.round(budgetRatio * 100)) : 0;
3225
+ const budgetFillClass = rawBudgetRatio >= 1 ? 'ts-bar-fill ts-bar-fill-over'
3226
+ : rawBudgetRatio >= 0.85 ? 'ts-bar-fill ts-bar-fill-warn'
3227
+ : 'ts-bar-fill';
2052
3228
  const cacheHitRate = Number.isFinite(data?.cacheHitRate) ? data.cacheHitRate : 0;
2053
3229
  const grade = cacheHitRate >= 0.7 ? 'A' : cacheHitRate >= 0.5 ? 'B' : cacheHitRate >= 0.3 ? 'C' : 'D';
3230
+ const gradeClass = grade === 'A' || grade === 'B' ? 'ts-grade-pill-good'
3231
+ : grade === 'C' ? 'ts-grade-pill-mid'
3232
+ : 'ts-grade-pill-low';
3233
+
3234
+ const heatValueOf = (counters) => {
3235
+ if (!counters) return 0;
3236
+ if (heatMetric === 'output') return counters.output;
3237
+ if (heatMetric === 'cacheRead') return counters.cacheRead;
3238
+ if (heatMetric === 'calls') return counters.calls;
3239
+ return counters.total;
3240
+ };
2054
3241
 
2055
- const peak = React.useMemo(() => {
3242
+ const heatPeak = React.useMemo(() => {
2056
3243
  let max = 0;
2057
3244
  for (const day of days) {
2058
- const value = countersOf(day).total;
3245
+ const counters = countersOf(day);
3246
+ const value = heatMetric === 'output' ? counters.output
3247
+ : heatMetric === 'cacheRead' ? counters.cacheRead
3248
+ : heatMetric === 'calls' ? counters.calls
3249
+ : counters.total;
2059
3250
  if (value > max) max = value;
2060
3251
  }
2061
3252
  return max;
2062
- }, [days]);
3253
+ }, [days, heatMetric]);
2063
3254
 
2064
3255
  const window = React.useMemo(() => heatWindow(days), [days]);
2065
3256
  const grid = React.useMemo(() => buildGrid(window), [window]);
@@ -2141,6 +3332,12 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
2141
3332
  return max;
2142
3333
  }, [trend]);
2143
3334
 
3335
+ const trendTotal = React.useMemo(() => {
3336
+ let sum = 0;
3337
+ for (const entry of trend) sum += entry.total;
3338
+ return sum;
3339
+ }, [trend]);
3340
+
2144
3341
  const selectedSessions = React.useMemo(() => {
2145
3342
  if (selected === null) return [];
2146
3343
  const list = Array.isArray(data?.sessions) ? data.sessions : [];
@@ -2204,16 +3401,8 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
2204
3401
  if (next !== selected) setSelected(next);
2205
3402
  };
2206
3403
 
2207
- /**
2208
- * Anchor the hover card next to the cell and keep it inside the card on all
2209
- * four sides:
2210
- * - horizontal: the readout is centred on the cell, so its centre is
2211
- * clamped by half its width (edge cells would otherwise spill out);
2212
- * - vertical: preferred below the cell, moved above when the bottom would
2213
- * overflow, and clamped into the card when neither side has full room.
2214
- */
2215
- const TIP_WIDTH = 196;
2216
- const TIP_HEIGHT = 108;
3404
+ const TIP_WIDTH = 204;
3405
+ const TIP_HEIGHT = 114;
2217
3406
  const TIP_GAP = 6;
2218
3407
  const TIP_MARGIN = 6;
2219
3408
 
@@ -2245,56 +3434,90 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
2245
3434
  setHover({ label: cellState.label, counters: countersOf(cellState.day), anchor: { x, y } });
2246
3435
  };
2247
3436
 
3437
+ const gridHasSelected = heatFocused
3438
+ && selected !== null
3439
+ && grid.columns.some((col) => col.some((cellState) => !cellState.future && cellState.key === selected));
3440
+
2248
3441
  const heatCell = (cellState) => {
2249
3442
  const counters = cellState.day === undefined ? undefined : countersOf(cellState.day);
2250
- const total = counters?.total ?? 0;
2251
- const level = cellState.future ? 0 : intensity(total, peak);
3443
+ const value = heatValueOf(counters);
3444
+ const level = cellState.future ? 0 : intensity(value, heatPeak);
3445
+ const isFocusedCell = heatFocused && cellState.key === selected;
2252
3446
  // 颜色走类名而不是内联 style:内联会压过主题,浅色下就成了一片黑方块。
2253
- const className = `ts-cell ${cellPaintClass(level)}${cellState.key === selected ? ' ts-cell-selected' : ''}`;
2254
- // The browser's native `title` tooltip cannot be themed, so the cell
2255
- // carries no title: hovering reports into the card's own tooltip.
3447
+ const className = `ts-cell ${cellPaintClass(level)}${cellState.future ? ' ts-cell-future' : ''}${isFocusedCell ? ' ts-cell-selected' : ''}`;
3448
+ const ariaValue = heatMetric === 'calls' ? `${fmtInt(value)} ${t('calls')}` : `${fmtTokens(value)} ${t('tokens')}`;
2256
3449
  return h('button', {
2257
3450
  key: cellState.key,
2258
3451
  type: 'button',
2259
3452
  className,
2260
- style: cellState.future ? { opacity: 0.35 } : undefined,
2261
3453
  disabled: cellState.future,
2262
- 'aria-label': `${cellState.key} · ${fmtTokens(total)} tokens`,
3454
+ 'aria-pressed': isFocusedCell,
3455
+ 'aria-label': `${cellState.key} · ${ariaValue}`,
2263
3456
  onMouseEnter: cellState.future ? undefined : (event) => showHover(cellState, event.currentTarget),
2264
3457
  onMouseLeave: cellState.future ? undefined : () => setHover(null),
2265
3458
  onFocus: cellState.future ? undefined : (event) => showHover(cellState, event.currentTarget),
2266
3459
  onBlur: cellState.future ? undefined : () => setHover(null),
2267
- onClick: () => {
2268
- if (!cellState.future) setSelected(cellState.key);
3460
+ onClick: (event) => {
3461
+ if (cellState.future) return;
3462
+ event.stopPropagation();
3463
+ if (heatFocused && selected === cellState.key) {
3464
+ setHeatFocused(false);
3465
+ } else {
3466
+ setSelected(cellState.key);
3467
+ setHeatFocused(true);
3468
+ }
2269
3469
  },
2270
3470
  });
2271
3471
  };
2272
3472
 
3473
+ const heatMetrics = [
3474
+ { id: 'total', label: t('metricTotal') },
3475
+ { id: 'output', label: t('metricOutput') },
3476
+ { id: 'cacheRead', label: t('metricCache') },
3477
+ { id: 'calls', label: t('metricCalls') },
3478
+ ];
3479
+
3480
+ const hoverPrimaryValue = hover === null ? ''
3481
+ : heatMetric === 'calls' ? fmtInt(hover.counters.calls)
3482
+ : fmtTokens(heatValueOf(hover.counters));
3483
+ const hoverPrimaryUnit = heatMetric === 'calls' ? t('calls') : t('tokens');
3484
+
2273
3485
  const heatmap = h(
2274
3486
  'div',
2275
- { className: 'ts-card ts-heat-card', ref: cardRef, onMouseLeave: () => setHover(null) },
3487
+ {
3488
+ className: 'ts-card ts-heat-card',
3489
+ ref: cardRef,
3490
+ onMouseLeave: () => setHover(null),
3491
+ onClick: (event) => {
3492
+ if (heatFocused && !event.target?.closest?.('button')) setHeatFocused(false);
3493
+ },
3494
+ },
2276
3495
  h(
2277
3496
  'div',
2278
3497
  { className: 'ts-section-head' },
2279
3498
  h(
2280
3499
  'div',
2281
- null,
2282
- h('div', { className: 'ts-section-title' }, t('heatmap')),
2283
- h('div', { className: 'ts-section-hint' }, t('heatmapHint')),
3500
+ { className: 'ts-section-title-wrap' },
3501
+ h('span', { className: 'ts-section-title' }, t('heatmap')),
3502
+ h('span', { className: 'ts-section-hint' }, t('heatmapHint')),
2284
3503
  ),
2285
3504
  h(
2286
3505
  'div',
2287
- { className: 'ts-legend' },
2288
- ...[
2289
- { label: t('legendLow'), level: 1 },
2290
- { label: t('legendMid'), level: 2 },
2291
- { label: t('legendHigh'), level: 3 },
2292
- { label: t('legendPeak'), level: 4 },
2293
- ].map((entry) => h(
2294
- 'div',
2295
- { key: entry.label, className: 'ts-legend-item' },
2296
- h('span', { className: `ts-legend-swatch ${cellPaintClass(entry.level)}` }),
2297
- h('span', {}, entry.label),
3506
+ { className: 'ts-seg', role: 'tablist', 'aria-label': t('heatmap') },
3507
+ ...heatMetrics.map((item) => h(
3508
+ 'button',
3509
+ {
3510
+ key: item.id,
3511
+ type: 'button',
3512
+ role: 'tab',
3513
+ 'aria-selected': heatMetric === item.id,
3514
+ className: `ts-seg-btn${heatMetric === item.id ? ' ts-seg-btn-on' : ''}`,
3515
+ onClick: () => {
3516
+ setHeatMetric(item.id);
3517
+ setHeatFocused(false);
3518
+ },
3519
+ },
3520
+ item.label,
2298
3521
  )),
2299
3522
  ),
2300
3523
  ),
@@ -2304,13 +3527,12 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
2304
3527
  'div',
2305
3528
  {
2306
3529
  className: 'ts-tip',
2307
- role: 'tooltip',
2308
3530
  style: hover.anchor === null || hover.anchor === undefined
2309
3531
  ? undefined
2310
3532
  : { left: `${hover.anchor.x}px`, top: `${hover.anchor.y}px` },
2311
3533
  },
2312
3534
  h('div', { className: 'ts-tip-head' }, hover.label),
2313
- h('div', { className: 'ts-tip-total' }, fmtTokens(hover.counters.total), h('span', {}, t('tokens'))),
3535
+ h('div', { className: 'ts-tip-total' }, hoverPrimaryValue, h('span', {}, hoverPrimaryUnit)),
2314
3536
  hover.counters.total > 0
2315
3537
  ? h(
2316
3538
  'div',
@@ -2325,14 +3547,6 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
2325
3547
  h(
2326
3548
  'div',
2327
3549
  { className: 'ts-heat-body' },
2328
- h(
2329
- 'div',
2330
- { className: 'ts-months', style: { gridTemplateColumns: `repeat(${grid.weeks}, minmax(0, 1fr))` } },
2331
- ...grid.columns.map((column, index) => {
2332
- const month = grid.months.find((entry) => entry.index === index);
2333
- return h('span', { key: `m${index}`, className: 'ts-month' }, month ? month.label : '');
2334
- }),
2335
- ),
2336
3550
  h(
2337
3551
  'div',
2338
3552
  { className: 'ts-heat' },
@@ -2347,7 +3561,7 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
2347
3561
  ),
2348
3562
  h(
2349
3563
  'div',
2350
- { className: 'ts-grid' },
3564
+ { className: gridHasSelected ? 'ts-grid ts-grid-has-sel' : 'ts-grid' },
2351
3565
  ...grid.columns.map((column, index) => h(
2352
3566
  'div',
2353
3567
  { key: `c${index}`, className: 'ts-col' },
@@ -2355,11 +3569,35 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
2355
3569
  )),
2356
3570
  ),
2357
3571
  ),
3572
+ h(
3573
+ 'div',
3574
+ { className: 'ts-months', style: { gridTemplateColumns: `repeat(${grid.weeks}, minmax(0, 1fr))` } },
3575
+ ...grid.columns.map((column, index) => {
3576
+ const month = grid.months.find((entry) => entry.index === index);
3577
+ return h('span', { key: `m${index}`, className: 'ts-month' }, month ? month.label : '');
3578
+ }),
3579
+ ),
3580
+ h('div', { className: 'ts-heat-rail', 'aria-hidden': 'true' }),
2358
3581
  ),
2359
3582
  h(
2360
3583
  'div',
2361
- { className: 'ts-meta' },
2362
- sourceNote.length > 0 ? sourceNote : null,
3584
+ { className: 'ts-heat-foot' },
3585
+ h(
3586
+ 'div',
3587
+ { className: 'ts-legend' },
3588
+ ...[
3589
+ { label: t('legendLow'), level: 1 },
3590
+ { label: t('legendMid'), level: 2 },
3591
+ { label: t('legendHigh'), level: 3 },
3592
+ { label: t('legendPeak'), level: 4 },
3593
+ ].map((entry) => h(
3594
+ 'div',
3595
+ { key: entry.label, className: 'ts-legend-item' },
3596
+ h('span', { className: `ts-legend-swatch ${cellPaintClass(entry.level)}` }),
3597
+ h('span', {}, entry.label),
3598
+ )),
3599
+ ),
3600
+ sourceNote.length > 0 ? h('div', { className: 'ts-meta-inline' }, sourceNote) : null,
2363
3601
  ),
2364
3602
  );
2365
3603
 
@@ -2371,21 +3609,25 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
2371
3609
  { className: 'ts-detail-title' },
2372
3610
  h('span', { className: 'ts-detail-date' }, selected === null ? t('noSelection') : keyLabel(selected)),
2373
3611
  h(
2374
- 'button',
2375
- { type: 'button', className: 'ts-btn ts-icon-btn', title: t('prevDay'), 'aria-label': t('prevDay'), disabled: !canPrev, onClick: () => moveDay(-1) },
2376
- '‹',
2377
- ),
2378
- h(
2379
- 'button',
2380
- { type: 'button', className: 'ts-btn ts-icon-btn', title: t('nextDay'), 'aria-label': t('nextDay'), disabled: !canNext, onClick: () => moveDay(1) },
2381
- '›',
3612
+ 'div',
3613
+ { className: 'ts-stepper' },
3614
+ h(
3615
+ 'button',
3616
+ { type: 'button', className: 'ts-step-btn', 'aria-label': t('prevDay'), disabled: !canPrev, onClick: () => moveDay(-1), ...hoverTip({ head: t('prevDay') }) },
3617
+ h(IconChevron, { dir: 'left' }),
3618
+ ),
3619
+ h(
3620
+ 'button',
3621
+ { type: 'button', className: 'ts-step-btn', 'aria-label': t('nextDay'), disabled: !canNext, onClick: () => moveDay(1), ...hoverTip({ head: t('nextDay') }) },
3622
+ h(IconChevron, { dir: 'right' }),
3623
+ ),
2382
3624
  ),
2383
3625
  h(
2384
3626
  'button',
2385
3627
  {
2386
3628
  type: 'button',
2387
3629
  className: 'ts-btn',
2388
- disabled: latestUsedKey === null,
3630
+ disabled: latestUsedKey === null || latestUsedKey === selected,
2389
3631
  onClick: () => {
2390
3632
  if (latestUsedKey !== null) setSelected(latestUsedKey);
2391
3633
  },
@@ -2450,7 +3692,7 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
2450
3692
  'div',
2451
3693
  { key: name, className: 'ts-model-row' },
2452
3694
  h('span', { className: 'ts-model-name', ...hoverTip({ head: name }) }, name),
2453
- h('div', { className: 'ts-model-track' }, h('div', { className: 'ts-model-fill', style: { width: `${Math.max(1, share * 100)}%` } })),
3695
+ h('div', { className: 'ts-model-track' }, h('div', { className: 'ts-model-fill', style: { width: `${Math.max(2, share * 100)}%` } })),
2454
3696
  h('span', { className: 'ts-model-meta' }, `${fmtTokens(entry.total)} · ${fmtPercent(share)}`),
2455
3697
  );
2456
3698
  }),
@@ -2523,7 +3765,7 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
2523
3765
  ...composition.map((entry) => h('div', {
2524
3766
  key: entry.key,
2525
3767
  className: 'ts-comp-seg',
2526
- style: { width: `${Math.max(0.5, entry.share * 100)}%`, backgroundColor: entry.color },
3768
+ style: { width: `${Math.max(1, entry.share * 100)}%`, backgroundColor: entry.color },
2527
3769
  })),
2528
3770
  ),
2529
3771
  h(
@@ -2551,139 +3793,158 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
2551
3793
 
2552
3794
  const trendCard = h(
2553
3795
  'div',
2554
- { className: 'ts-card' },
3796
+ { className: 'ts-card ts-trend-card' },
2555
3797
  h(
2556
3798
  'div',
2557
- { className: 'ts-section-head' },
3799
+ { className: 'ts-trend-strip' },
2558
3800
  h(
2559
3801
  'div',
2560
- null,
2561
- h('div', { className: 'ts-section-title' }, t('trend')),
3802
+ { className: 'ts-trend-side' },
3803
+ h('span', { className: 'ts-trend-kicker' }, t('trend')),
3804
+ h('span', { className: 'ts-trend-figure' }, fmtTokens(trendTotal)),
3805
+ h('span', { className: 'ts-trend-sub' }, t('trendAvg').replace('{tokens}', fmtTokens(trendTotal / 14))),
2562
3806
  ),
2563
- ),
2564
- h(
2565
- 'div',
2566
- { className: 'ts-trend' },
2567
3807
  h(
2568
3808
  'div',
2569
- { className: 'ts-trend-bars' },
2570
- ...trend.map((entry) => {
2571
- const ratio = trendPeak > 0 ? entry.total / trendPeak : 0;
2572
- return h(
2573
- 'div',
2574
- {
2575
- key: entry.key,
2576
- className: `ts-trend-col${entry.key === selected ? ' ts-trend-col-on' : ''}`,
2577
- ...hoverTip({
2578
- head: entry.label,
2579
- rows: [{ label: t('tokens'), value: fmtTokens(entry.total) }],
2580
- }),
2581
- },
2582
- h('div', {
2583
- className: 'ts-trend-bar',
2584
- style: {
2585
- height: `${Math.max(2, ratio * 100)}%`,
2586
- backgroundColor: entry.key === selected ? undefined : 'var(--dsw-alias-brand-primary)',
2587
- opacity: entry.key === selected ? undefined : (0.32 + ratio * 0.5),
3809
+ { className: 'ts-trend-center' },
3810
+ h(
3811
+ 'div',
3812
+ { className: 'ts-trend-bars' },
3813
+ ...trend.map((entry) => {
3814
+ const ratio = trendPeak > 0 ? entry.total / trendPeak : 0;
3815
+ const isSelected = entry.key === selected;
3816
+ const barHeight = entry.total > 0 ? `${Math.max(14, Math.round(ratio * 100))}%` : '7px';
3817
+ const barMix = Math.round(28 + ratio * 72);
3818
+ return h(
3819
+ 'button',
3820
+ {
3821
+ key: entry.key,
3822
+ type: 'button',
3823
+ className: `ts-trend-col${isSelected ? ' ts-trend-col-on' : ''}`,
3824
+ 'aria-label': `${entry.label} · ${fmtTokens(entry.total)} ${t('tokens')}`,
3825
+ onClick: () => setSelected(entry.key),
3826
+ ...hoverTip({
3827
+ head: entry.label,
3828
+ rows: [{ label: t('tokens'), value: fmtTokens(entry.total) }],
3829
+ }),
2588
3830
  },
2589
- }),
2590
- );
2591
- }),
3831
+ h('span', {
3832
+ className: 'ts-trend-bar',
3833
+ style: {
3834
+ height: barHeight,
3835
+ background: isSelected || entry.total <= 0
3836
+ ? undefined
3837
+ : `color-mix(in srgb, var(--ts-bar-hi) ${barMix}%, transparent)`,
3838
+ },
3839
+ }),
3840
+ );
3841
+ }),
3842
+ ),
3843
+ h('div', { className: 'ts-trend-rail', 'aria-hidden': 'true' }),
2592
3844
  ),
2593
3845
  h(
2594
- 'div',
2595
- { className: 'ts-trend-labels' },
2596
- ...trend.map((entry) => h(
2597
- 'span',
2598
- { key: entry.key, className: entry.key === selected ? 'ts-trend-label-on' : '' },
2599
- entry.label,
2600
- )),
3846
+ 'button',
3847
+ {
3848
+ type: 'button',
3849
+ className: 'ts-trend-side ts-trend-side-right ts-trend-side-btn',
3850
+ disabled: peakDay === null,
3851
+ onClick: () => {
3852
+ if (peakDay !== null) setSelected(peakDay.date);
3853
+ },
3854
+ ...(peakDay
3855
+ ? hoverTip({
3856
+ head: t('peakDay'),
3857
+ rows: [{ label: keyLabel(peakDay.date), value: fmtTokens(countersOf(peakDay).total) }],
3858
+ })
3859
+ : {}),
3860
+ },
3861
+ h('span', { className: 'ts-trend-kicker' }, t('peakDay')),
3862
+ h('span', { className: 'ts-trend-figure' }, peakDay ? fmtTokens(countersOf(peakDay).total) : '—'),
3863
+ h('span', { className: 'ts-trend-sub' }, peakDay ? keyLabel(peakDay.date) : '—'),
2601
3864
  ),
2602
3865
  ),
2603
3866
  );
2604
3867
 
2605
- const hero = h(
3868
+ const heroCard = h(
2606
3869
  'div',
2607
- { className: 'ts-card ts-hero' },
3870
+ { className: 'ts-card ts-hero-main' },
2608
3871
  h(
2609
3872
  'div',
2610
- { className: 'ts-hero-cell' },
2611
- h('div', { className: 'ts-hero-label' }, t('totalAllIn')),
2612
- h('div', { className: 'ts-hero-value' }, fmtTokens(totals.total)),
2613
- // One short fact per card: the full split lives in the cell tooltip so
2614
- // a narrow column never truncates the line.
3873
+ { className: 'ts-hero-top' },
2615
3874
  h(
2616
3875
  'div',
2617
- {
2618
- className: 'ts-hero-note',
2619
- ...hoverTip({
2620
- head: t('totalAllInHint'),
2621
- rows: [
2622
- { label: t('inputTokens'), value: fmtTokens(totals.input) },
2623
- { label: t('outputTokens'), value: fmtTokens(totals.output) },
2624
- { label: t('cacheRead'), value: fmtTokens(totals.cacheRead) },
2625
- { label: t('cacheWrite'), value: fmtTokens(totals.cacheWrite) },
2626
- ],
2627
- }),
2628
- },
2629
- `${t('inputTokens')} ${fmtTokens(totals.input)}`,
3876
+ { className: 'ts-hero-kicker' },
3877
+ h('span', null, t('today')),
3878
+ h(
3879
+ 'span',
3880
+ {
3881
+ className: 'ts-hero-delta',
3882
+ style: {
3883
+ color: todayDelta === null
3884
+ ? 'var(--dsw-alias-label-tertiary)'
3885
+ : (todayDelta.startsWith('-') ? 'var(--ts-green)' : 'var(--ts-amber)'),
3886
+ },
3887
+ },
3888
+ todayDelta === null ? t('yesterdayNone') : `${t('vsYesterday')} ${todayDelta}`,
3889
+ ),
3890
+ ),
3891
+ h(
3892
+ 'div',
3893
+ { className: 'ts-hero-headline' },
3894
+ h(
3895
+ 'div',
3896
+ { className: 'ts-hero-big' },
3897
+ h('strong', null, fmtTokens(todayBlock.total)),
3898
+ h('span', null, t('tokens')),
3899
+ ),
3900
+ budgetTokens > 0
3901
+ ? h(
3902
+ 'span',
3903
+ {
3904
+ className: 'ts-hero-right-meta',
3905
+ ...hoverTip({
3906
+ head: t('dailyBudget'),
3907
+ rows: [
3908
+ { label: t('dailyBudget'), value: fmtTokens(budgetTokens) },
3909
+ { label: t('share'), value: fmtPercent(budgetRatio) },
3910
+ ],
3911
+ }),
3912
+ },
3913
+ t('budgetUsed').replace('{pct}', fmtPercent(budgetRatio)),
3914
+ )
3915
+ : null,
2630
3916
  ),
2631
- ),
2632
- h(
2633
- 'div',
2634
- { className: 'ts-hero-cell' },
2635
- h('div', { className: 'ts-hero-label' }, t('today')),
2636
- h('div', { className: 'ts-hero-value' }, fmtTokens(todayBlock.total)),
2637
- h('div', { className: 'ts-bar' }, h('div', { className: 'ts-bar-fill', style: { width: `${Math.round(budgetRatio * 100)}%` } })),
2638
3917
  h(
2639
3918
  'div',
2640
3919
  {
2641
- className: 'ts-hero-note',
3920
+ className: 'ts-bar',
2642
3921
  ...(budgetTokens > 0
2643
3922
  ? hoverTip({
2644
- head: t('budget'),
3923
+ head: t('dailyBudget'),
2645
3924
  rows: [
2646
- { label: t('budget'), value: fmtTokens(budgetTokens) },
3925
+ { label: t('today'), value: fmtTokens(todayBlock.total) },
3926
+ { label: t('dailyBudget'), value: fmtTokens(budgetTokens) },
2647
3927
  { label: t('share'), value: fmtPercent(budgetRatio) },
2648
3928
  ],
2649
3929
  })
2650
3930
  : {}),
2651
3931
  },
2652
- h(
2653
- 'span',
2654
- {
2655
- className: 'ts-hero-delta',
2656
- style: {
2657
- color: todayDelta === null
2658
- ? 'var(--dsw-alias-label-tertiary)'
2659
- : (todayDelta.startsWith('-') ? 'var(--dsw-alias-state-success-primary)' : 'var(--dsw-alias-state-warn-primary)'),
2660
- },
2661
- },
2662
- todayDelta === null ? t('yesterdayNone') : `${t('vsYesterday')} ${todayDelta}`,
2663
- ),
3932
+ h('div', { className: budgetFillClass, style: { width: `${budgetBarWidth}%` } }),
2664
3933
  ),
2665
- ),
2666
- h(
2667
- 'div',
2668
- { className: 'ts-hero-cell' },
2669
- h('div', { className: 'ts-hero-label' }, t('cacheHit')),
2670
3934
  h(
2671
3935
  'div',
2672
- { className: 'ts-grade-line' },
2673
- h('div', { className: 'ts-grade-badge', style: { backgroundColor: gradeTone(grade) } }, grade),
2674
- h('div', { className: 'ts-grade-text' }, fmtPercent(cacheHitRate)),
3936
+ { className: 'ts-bar-meta' },
3937
+ h('span', null, budgetTokens > 0 ? `${t('dailyBudget')} ${fmtTokens(budgetTokens)}` : ''),
3938
+ h('span', null, t('todayCallsCount').replace('{n}', fmtInt(todayBlock.calls))),
2675
3939
  ),
2676
- h('div', { className: 'ts-hero-note' }, `${t('cacheRead')} ${fmtTokens(totals.cacheRead)}`),
2677
3940
  ),
2678
3941
  h(
2679
3942
  'div',
2680
- { className: 'ts-hero-cell' },
2681
- h('div', { className: 'ts-hero-label' }, t('avg7')),
2682
- h('div', { className: 'ts-hero-value' }, fmtTokens(avg7)),
3943
+ { className: 'ts-hero-subgrid' },
2683
3944
  h(
2684
3945
  'div',
2685
3946
  {
2686
- className: 'ts-hero-note',
3947
+ className: 'ts-hero-stat',
2687
3948
  ...(peakDay
2688
3949
  ? hoverTip({
2689
3950
  head: t('peakDay'),
@@ -2691,30 +3952,90 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
2691
3952
  })
2692
3953
  : {}),
2693
3954
  },
2694
- peakDay ? `${t('peakDay')} ${keyLabel(peakDay.date)}` : '—',
3955
+ h('div', { className: 'ts-hero-stat-label' }, t('avg7')),
3956
+ h('div', { className: 'ts-hero-stat-val' }, fmtTokens(avg7)),
3957
+ ),
3958
+ h(
3959
+ 'div',
3960
+ {
3961
+ className: 'ts-hero-stat',
3962
+ ...hoverTip({
3963
+ head: t('cacheHit'),
3964
+ rows: [{ label: t('cacheRead'), value: fmtTokens(totals.cacheRead) }],
3965
+ }),
3966
+ },
3967
+ h('div', { className: 'ts-hero-stat-label' }, t('cacheHit')),
3968
+ h(
3969
+ 'div',
3970
+ { className: 'ts-hero-stat-val' },
3971
+ h('span', null, fmtPercent(cacheHitRate)),
3972
+ h('span', { className: `ts-grade-pill ${gradeClass}` }, grade),
3973
+ ),
3974
+ ),
3975
+ h(
3976
+ 'div',
3977
+ {
3978
+ className: 'ts-hero-stat',
3979
+ ...hoverTip({
3980
+ head: t('totalAllInHint'),
3981
+ rows: [
3982
+ { label: t('inputTokens'), value: fmtTokens(totals.input) },
3983
+ { label: t('outputTokens'), value: fmtTokens(totals.output) },
3984
+ { label: t('cacheRead'), value: fmtTokens(totals.cacheRead) },
3985
+ { label: t('cacheWrite'), value: fmtTokens(totals.cacheWrite) },
3986
+ ],
3987
+ }),
3988
+ },
3989
+ h('div', { className: 'ts-hero-stat-label' }, t('totalAllIn')),
3990
+ h('div', { className: 'ts-hero-stat-val' }, fmtTokens(totals.total)),
2695
3991
  ),
2696
3992
  ),
2697
3993
  );
2698
3994
 
2699
- // 余额与峰谷与用量数据无关:日志读不出来时它依然应该出现。
2700
- // 「今日花费」是用量数据,但从侧栏看不到,所以也传给余额卡展示。
2701
- const balances = store === undefined ? null : h(BalancesCard, {
3995
+ const accountCard = store === undefined ? null : h(AccountBentoCard, {
2702
3996
  t,
2703
3997
  store,
2704
3998
  tip,
2705
- lowSettings,
3999
+ now,
4000
+ peak,
2706
4001
  today: todayBlock,
2707
4002
  });
4003
+
4004
+ const utilityRow = h(
4005
+ 'div',
4006
+ { className: 'ts-bento-utility', ref: utilityRef },
4007
+ h(TariffPricingCard, { t, peak, pulse: pulseUtil }),
4008
+ h(LowBalanceCard, { t, settings: lowSettings, pulse: pulseUtil, inputRef: thresholdInputRef }),
4009
+ );
4010
+
4011
+ const topBento = data !== null && totals.total > 0
4012
+ ? h(
4013
+ 'div',
4014
+ { className: `ts-bento-top${accountCard === null ? ' ts-bento-top-solo' : ''}` },
4015
+ heroCard,
4016
+ accountCard,
4017
+ )
4018
+ : accountCard;
4019
+
2708
4020
  const body = data === null
2709
- ? (error === null ? h('div', { className: 'ts-muted' }, t('loading')) : balances)
4021
+ ? h(
4022
+ React.Fragment,
4023
+ null,
4024
+ error === null
4025
+ ? h('div', { className: 'ts-card ts-loading-card' }, h('span', { className: 'ts-spinner', 'aria-hidden': 'true' }), h('span', null, t('loading')))
4026
+ : null,
4027
+ accountCard,
4028
+ utilityRow,
4029
+ )
2710
4030
  : totals.total <= 0
2711
4031
  ? h(
2712
4032
  React.Fragment,
2713
4033
  null,
2714
- balances,
2715
- h('div', { className: 'ts-card' }, h('div', { className: 'ts-muted', style: { padding: '20px 16px' } }, t('empty'))),
4034
+ accountCard,
4035
+ h('div', { className: 'ts-card' }, h('div', { className: 'ts-muted', style: { padding: '22px' } }, t('empty'))),
4036
+ utilityRow,
2716
4037
  )
2717
- : h(React.Fragment, null, balances, hero, heatmap, trendCard, detail);
4038
+ : h(React.Fragment, null, topBento, trendCard, heatmap, detail, utilityRow);
2718
4039
 
2719
4040
  return h(
2720
4041
  'div',
@@ -2722,23 +4043,42 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
2722
4043
  h(
2723
4044
  'div',
2724
4045
  { className: 'ts-head' },
2725
- h(
2726
- 'div',
2727
- null,
2728
- h('div', { className: 'ts-title' }, t('title')),
2729
- ),
4046
+ h('div', { className: 'ts-title' }, t('title')),
2730
4047
  h(
2731
4048
  'div',
2732
4049
  { className: 'ts-toolbar' },
2733
- loading ? h('span', { className: 'ts-status' }, t('loading')) : statusText !== null ? h('span', { className: 'ts-status' }, statusText) : null,
4050
+ loading
4051
+ ? h('span', { className: 'ts-status' }, t('refreshingShort'))
4052
+ : statusText !== null
4053
+ ? h('span', { className: 'ts-status', ...(statusDetailTip !== null ? hoverTip(statusDetailTip) : {}) }, statusText)
4054
+ : null,
4055
+ h(
4056
+ 'button',
4057
+ {
4058
+ type: 'button',
4059
+ className: `ts-circle-btn${loading ? ' ts-circle-btn-spin' : ''}`,
4060
+ 'aria-label': t('refresh'),
4061
+ disabled: loading,
4062
+ onClick: () => load(true),
4063
+ ...hoverTip({ head: t('refresh') }),
4064
+ },
4065
+ h(IconRefresh),
4066
+ ),
2734
4067
  h(
2735
4068
  'button',
2736
- { type: 'button', className: 'ts-btn', disabled: loading, onClick: () => load(true) },
2737
- t('refresh'),
4069
+ {
4070
+ type: 'button',
4071
+ className: 'ts-circle-btn',
4072
+ 'aria-label': t('settingsTip'),
4073
+ onClick: jumpToUtility,
4074
+ ...hoverTip({ head: t('settingsTip') }),
4075
+ },
4076
+ h(IconSettings),
4077
+ lowSettings.threshold > 0 ? h('span', { className: 'ts-circle-dot', 'aria-hidden': 'true' }) : null,
2738
4078
  ),
2739
4079
  ),
2740
4080
  ),
2741
- error !== null ? h('div', { className: 'ts-status ts-status-error' }, `${t('loadFailed')}${error}`) : null,
4081
+ error !== null ? h('div', { className: 'ts-status-banner' }, `${t('loadFailed')}${error}`) : null,
2742
4082
  body,
2743
4083
  );
2744
4084
  }
@@ -2793,7 +4133,7 @@ body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #
2793
4133
  id: 'token-spend-balance',
2794
4134
  order: 30,
2795
4135
  locale: NS,
2796
- inject: () => ({ store: account, tip }),
4136
+ inject: () => ({ store: account }),
2797
4137
  }, (props) => h(PluginBoundary, null, h(SidebarBalanceCard, props))));
2798
4138
 
2799
4139
  ctx.slots.inject('settings.section', () => ctx.slots.register({