dsh-spend-ledger 1.2.1 → 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 +50 -0
  2. package/README.md +8 -8
  3. package/client.js +1969 -559
  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,272 +218,1393 @@ 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); }
256
- .ts-cell:disabled { cursor: default; }
257
- /* 选中不套外框:outline 画在色块外面,自带一套矩形圆角,和色块自己的 7px 圆角
258
- 对不齐,于是读起来像"斜贴了一个相框",还把这一格的量级切断了。
259
- 改成贴着色块自己的圆角画一圈内描边:形状不变,只是这一格的边界更清楚。
260
- 颜色用 currentColor,跟随主题,浅色主题下也不会变成一圈看不见的白线。 */
261
- .ts-cell-selected { outline: none; }
262
- .ts-cell-selected::after {
263
- content: '';
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 {
264
481
  position: absolute;
265
- inset: 0;
266
- border-radius: inherit;
267
- box-shadow: inset 0 0 0 1.5px currentColor;
268
- opacity: 0.88;
269
- pointer-events: none;
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);
270
489
  }
271
- .ts-cell-selected:focus-visible::after {
272
- box-shadow: inset 0 0 0 2px var(--dsw-alias-brand-primary);
273
- opacity: 1;
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;
274
697
  }
275
- /* Matte nylon-blue: depth comes from restrained edges and shadows, without a gloss layer over every tile. */
276
- /* Hover readout: replaces the unthemeable native title tooltip. JS places it
277
- below the hovered cell and moves it above / clamps it when an edge would clip
278
- it, so the CSS transform only centres it horizontally. */
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: 每日用量热力图 ---------- */
279
933
  .ts-heat-card { position: relative; }
280
- .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; }
281
- .ts-tip-head { font-size: 11px; color: var(--dsw-alias-label-secondary); }
282
- .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; }
283
- .ts-tip-total span { font-size: 10px; font-weight: 500; letter-spacing: 0; color: var(--dsw-alias-label-tertiary); }
284
- .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; }
285
- .ts-tip-muted { font-size: 11px; color: var(--dsw-alias-label-tertiary); }
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); }
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
+ }
1000
+
1001
+ /* ---------- 热力图涂装:按主题分两层 ---------- */
1002
+ .ts-cell-paint { background: var(--ts-heat-fill); border-color: var(--ts-heat-edge); box-shadow: var(--ts-heat-shadow); }
1003
+
1004
+ /* 深色:贴近参考图的冷冽苹果蓝阶(深炭灰 → 深海蓝 → 钴蓝 → 亮苹果蓝 → 冰川天蓝) */
1005
+ .ts-cell-paint,
1006
+ body[data-ds-dark-theme] .ts-cell-paint {
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);
1010
+ }
1011
+ .ts-cell-paint-l1, body[data-ds-dark-theme] .ts-cell-paint-l1 {
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);
1015
+ }
1016
+ .ts-cell-paint-l2, body[data-ds-dark-theme] .ts-cell-paint-l2 {
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);
1020
+ }
1021
+ .ts-cell-paint-l3, body[data-ds-dark-theme] .ts-cell-paint-l3 {
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);
1025
+ }
1026
+ .ts-cell-paint-l4, body[data-ds-dark-theme] .ts-cell-paint-l4 {
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);
1030
+ }
1031
+
1032
+ /* 浅色:延续经过反差验证的清爽浅蓝到实蓝阶 */
1033
+ body:not([data-ds-dark-theme]) .ts-cell-paint {
1034
+ --ts-heat-fill: #eef1f6;
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);
1037
+ }
1038
+ body:not([data-ds-dark-theme]) .ts-cell-paint-l1 {
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);
1042
+ }
1043
+ body:not([data-ds-dark-theme]) .ts-cell-paint-l2 {
1044
+ --ts-heat-fill: #8ebef8;
1045
+ --ts-heat-edge: rgba(29, 95, 209, 0.22);
1046
+ --ts-heat-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 1px 2px rgba(29, 95, 209, 0.14);
1047
+ }
1048
+ body:not([data-ds-dark-theme]) .ts-cell-paint-l3 {
1049
+ --ts-heat-fill: #4a8ee8;
1050
+ --ts-heat-edge: rgba(23, 78, 173, 0.30);
1051
+ --ts-heat-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42), 0 1px 3px rgba(29, 95, 209, 0.20);
1052
+ }
1053
+ body:not([data-ds-dark-theme]) .ts-cell-paint-l4 {
1054
+ --ts-heat-fill: #1d5fd1;
1055
+ --ts-heat-edge: rgba(16, 56, 128, 0.38);
1056
+ --ts-heat-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 1px 4px rgba(23, 78, 173, 0.28);
1057
+ }
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
+ }
286
1140
 
287
- .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; }
1141
+ /* 热力图悬停毛玻璃浮窗 */
1142
+ .ts-tip {
1143
+ position: absolute;
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);
1153
+ pointer-events: none;
1154
+ transform: translateX(-50%);
1155
+ box-sizing: border-box;
1156
+ }
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; }
1162
+ .ts-tip-muted { font-size: 11px; color: var(--dsw-alias-label-tertiary); }
288
1163
 
289
- /* Day detail: header strip, metric strip, then full-width model + session rows. */
290
- .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; }
291
- .ts-status-error { color: var(--dsw-alias-state-error-primary); font-size: 11px; max-width: none; white-space: normal; }
1164
+ /* ---------- Row 4: 当天明细 ---------- */
292
1165
  .ts-muted { color: var(--dsw-alias-label-tertiary); font-size: 12.5px; padding: 14px 0; }
293
- .ts-detail-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 20px 10px; flex-wrap: wrap; }
294
- .ts-detail-title { display: flex; align-items: center; gap: 9px; }
295
- .ts-detail-date { font-size: 17px; font-weight: 600; letter-spacing: -0.015em; font-variant-numeric: tabular-nums; }
296
- .ts-detail-total { display: flex; align-items: baseline; gap: 7px; }
297
- .ts-detail-total strong { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
298
- .ts-detail-total span { font-size: 11.5px; color: var(--dsw-alias-label-secondary); }
299
- .ts-detail-retained { font-size: 10.5px; color: var(--dsw-alias-label-tertiary); margin-right: 6px; }
300
- .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); }
301
- .ts-metric { padding: 12px 20px; min-width: 0; }
302
- .ts-metric + .ts-metric { border-left: 1px solid var(--dsw-alias-border-l1); }
303
- .ts-metric-label { font-size: 11.5px; color: var(--dsw-alias-label-secondary); white-space: nowrap; }
304
- .ts-metric-value { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; margin-top: 3px; }
305
- .ts-metric-value-accent { color: var(--dsw-alias-state-success-primary); }
306
- .ts-body { padding: 14px 20px 18px; }
307
- .ts-subhead { font-size: 12px; font-weight: 600; color: var(--dsw-alias-label-secondary); letter-spacing: -0.005em; margin-bottom: 9px; }
308
-
309
- /* Composition: one stacked bar answers "where did the tokens go". */
310
- .ts-comp { margin: 0 20px; padding: 12px 0 14px; }
311
- .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; }
312
1259
  .ts-comp-title { font-size: 12px; font-weight: 600; color: var(--dsw-alias-label-secondary); }
313
1260
  .ts-comp-total { font-size: 11.5px; color: var(--dsw-alias-label-tertiary); font-variant-numeric: tabular-nums; }
314
- .ts-comp-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--dsw-alias-bg-layer-2); gap: 1px; }
315
- .ts-comp-seg { height: 100%; }
316
- .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; }
317
1266
  .ts-comp-item { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--dsw-alias-label-secondary); }
318
- .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; }
319
1268
  .ts-comp-item b { color: var(--dsw-alias-label-primary); font-weight: 600; font-variant-numeric: tabular-nums; }
320
1269
  .ts-comp-pct { color: var(--dsw-alias-label-tertiary); font-variant-numeric: tabular-nums; }
321
1270
 
322
- /* Trend: compact column chart, no axes to misread. */
323
- .ts-trend { padding: 0 20px 16px; }
324
- .ts-trend-bars { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); align-items: end; gap: 4px; height: 92px; }
325
- .ts-trend-col { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; cursor: default; }
326
- .ts-trend-bar { border-radius: 4px 4px 2px 2px; background: var(--dsw-alias-bg-layer-2); min-height: 3px; transition: filter 120ms ease; }
327
- .ts-trend-col:hover .ts-trend-bar { filter: brightness(1.25); }
328
- .ts-trend-col-on .ts-trend-bar { background: var(--dsw-alias-brand-primary); }
329
- .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; }
330
- .ts-trend-label-on { color: var(--dsw-alias-label-primary); font-weight: 600; }
331
-
332
- /* Model rows: a bar per model is easier to rank than a chip row. */
333
- .ts-models { margin-bottom: 18px; }
334
- .ts-model-row { display: grid; grid-template-columns: minmax(0, 1fr) 96px 54px; align-items: center; gap: 12px; padding: 5px 0; }
335
- .ts-model-name { font-size: 11.5px; color: var(--dsw-alias-label-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
336
- .ts-model-track { height: 7px; border-radius: 999px; background: var(--dsw-alias-bg-layer-2); overflow: hidden; }
337
- .ts-model-fill { height: 100%; border-radius: 999px; background: var(--dsw-alias-brand-primary); }
338
- .ts-model-meta { text-align: right; font-size: 11.5px; font-variant-numeric: tabular-nums; color: var(--dsw-alias-label-primary); }
339
-
340
- .ts-table { display: flex; flex-direction: column; }
341
- .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; }
342
- .ts-row:first-child { border-top: 0; }
343
- .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
+ }
344
1306
  .ts-session-main { min-width: 0; }
345
- .ts-session-title { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.005em; }
346
- .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; }
347
- .ts-session-model { font-size: 10.5px; color: var(--dsw-alias-label-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
348
- .ts-num { text-align: right; font-variant-numeric: tabular-nums; }
349
- .ts-num-muted { color: var(--dsw-alias-label-secondary); }
350
- @media (max-width: 720px) {
351
- .ts-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); }
352
- .ts-hero-cell:nth-child(3) { border-left: 0; }
353
- .ts-hero-cell:nth-child(n + 3) { border-top: 1px solid var(--dsw-alias-border-l1); }
354
- .ts-row { grid-template-columns: minmax(0, 1fr) 64px 64px; }
355
- .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;
356
1372
  }
357
1373
 
358
- /* ---------- 侧栏「余额 + 峰谷」:无卡片外壳,与「已登录 DeepSeek」同一条底栏 ---------- */
359
- .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; }
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;
1391
+ }
1392
+
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; }
360
1395
  .tsb-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
361
- .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; }
362
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; }
363
- .tsb-muted { font-size: 11px; color: var(--dsw-alias-label-tertiary); }
1398
+ .tsb-muted { font-size: 11.5px; color: var(--dsw-alias-label-tertiary); }
364
1399
  .tsb-spacer { flex: 1; min-width: 0; }
365
- /* 状态只靠文字与一个色点表达:没有底色、没有边框,贴在底栏上不抢视线。 */
366
- .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; }
367
- .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; }
368
1402
  .tsb-badge-off { color: var(--dsw-alias-state-success-primary); }
369
1403
  .tsb-badge-peak { color: var(--dsw-alias-state-error-primary); }
370
- .tsb-peak { font-size: 10px; color: var(--dsw-alias-label-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
371
- /* 侧栏当前价一行:小一号、数字比模型名更淡,模型之间只留空格。 */
372
- .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; }
373
- .tsb-prices > span { margin-right: 6px; }
374
- .tsb-prices > span:last-child { margin-right: 0; }
375
- /* 低余额提醒条:贴在卡片内,琥珀色边提示;点「充值」走官方充值页。 */
376
- .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)); }
377
1406
  .tsb-low-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
378
- .tsb-low-title { font-size: 10px; font-weight: 600; color: var(--dsw-alias-state-warn-primary); }
379
- .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; }
380
1409
  .tsb-low-dismiss:hover { color: var(--dsw-alias-label-primary); }
381
- .tsb-low-body { font-size: 9.5px; color: var(--dsw-alias-label-secondary); line-height: 1.4; font-variant-numeric: tabular-nums; }
382
- .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; }
383
1412
  .tsb-low-action:hover { filter: brightness(1.08); }
384
- /* 花费页的余额提醒设置:一个最低余额 + 说明。 */
385
- .ts-low { display: flex; flex-direction: column; gap: 8px; }
386
- .ts-low-title { font-size: 11.5px; color: var(--dsw-alias-label-secondary); }
387
- .ts-low-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
388
- .ts-low-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
389
- .ts-low-label { font-size: 11px; color: var(--dsw-alias-label-secondary); }
390
- .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; }
391
- .ts-low-input:focus { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 1px; }
392
- .ts-low-hint { font-size: 10px; color: var(--dsw-alias-label-tertiary); line-height: 1.4; }
393
- .ts-low-note { font-size: 10px; color: var(--dsw-alias-label-tertiary); line-height: 1.5; }
394
- .ts-low-silent { display: flex; align-items: center; gap: 8px; font-size: 10px; color: var(--dsw-alias-label-tertiary); }
395
- .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; }
396
1466
  .ts-low-resume:hover { text-decoration: underline; }
397
- /* 侧栏「今日花费」:余额旁边的一小块,只在有用量数据时出现。 */
1467
+
398
1468
  .tsb-today { font-size: 9.5px; color: var(--dsw-alias-label-tertiary); white-space: nowrap; font-variant-numeric: tabular-nums; }
399
1469
  .tsb-today b { color: var(--dsw-alias-label-secondary); font-weight: 600; margin-left: 3px; }
400
- /* 余额读不出来时的那一句「前往开放平台查看」仍是真链接;侧栏没有别的按钮。 */
401
1470
  .tsb-link { color: inherit; text-decoration: none; border-bottom: 1px dotted currentColor; }
402
1471
  .tsb-link:hover { color: var(--dsw-alias-label-primary); }
403
1472
  .tsb-rail { align-items: center; justify-content: center; padding: 6px 0; gap: 4px; }
404
1473
  .tsb-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
405
- .tsb-dot-off { background: var(--dsw-alias-state-success-primary); }
406
- .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); }
407
1476
  .tsb-railText { font-size: 9.5px; color: var(--dsw-alias-label-secondary); }
408
1477
  .tsb-error { font-size: 10px; line-height: 1.5; color: var(--dsw-alias-state-error-primary); word-break: break-word; }
409
1478
 
410
- /* 24 小时峰谷格子图:每小时一格,高峰红、其余绿。
411
- 用网格排版而不是一根连续长条——格子位置由布局决定,不依赖像素取整,
412
- 所以对齐天生是齐的,也不会有色块交界的混合像素。
413
- 「此刻」不画框:7–9px 高的格子上,任何描边都会吃掉自己的圆角、挨到邻格,
414
- 整条就多出一个突兀的方框,红绿的形状还被切断。改成一个圆点落在条下方,
415
- 正对着当前这一格,同时那一格比其余亮一档——指示清楚,形状不变。 */
416
- .ts-tl { position: relative; width: 100%; padding-top: 3px; }
417
- .ts-tl-cells { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 1px; height: 9px; }
418
- .ts-tl-compact .ts-tl-cells { height: 7px; }
419
- .ts-tl-cell { border-radius: 2px; min-width: 0; transition: filter 180ms ease; }
420
- .ts-tl-cell-off { background: var(--dsw-alias-state-success-primary); }
421
- .ts-tl-cell-peak { background: var(--dsw-alias-state-error-primary); }
422
- /* 此刻:满色再提亮一档,靠对比被看见,不靠描边。 */
423
- .ts-tl-cell-now { filter: brightness(1.22) saturate(1.06); }
424
- /* 指示点:与格列同宽的网格,未选中的格子占位但不可见,点子居中于当前格。 */
425
- .ts-tl-marks { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 1px; height: 3px; margin-top: 2px; }
426
- .ts-tl-compact .ts-tl-marks { height: 2.5px; margin-top: 2px; }
427
- .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; }
428
1492
  .ts-tl-compact .ts-tl-mark { width: 2.5px; height: 2.5px; }
429
- .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; }
430
- .ts-bal-timeline { padding: 4px 20px 10px; }
431
-
432
- /* 官方价文字表(花费页):两模型两列,当前时段那一侧加粗,另一侧淡显。
433
- 侧栏不放假表,只放当前时段的一行小字(.tsb-prices)。 */
434
- .ts-pt { display: flex; flex-direction: column; gap: 2px; }
435
- .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; }
436
- .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; }
437
1500
  .ts-pt-model { color: var(--dsw-alias-label-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
438
1501
  .ts-pt-price { text-align: right; color: var(--dsw-alias-label-primary); white-space: nowrap; }
439
- .ts-pt-on { color: var(--dsw-alias-label-primary); font-weight: 600; }
440
- /* 价表里"高峰"那一列统一红字:贵 = 红的语义延伸到数字本身。 */
1502
+ .ts-pt-on { color: var(--dsw-alias-label-primary); font-weight: 650; }
441
1503
  .ts-pt-on.is-peak { color: var(--dsw-alias-state-error-primary); }
442
1504
  .ts-pt-muted { color: var(--dsw-alias-label-tertiary); }
443
- .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; }
444
- .ts-bal-unit { white-space: nowrap; }
445
- @media (max-width: 720px) {
446
- .ts-pt-row { grid-template-columns: minmax(72px, 1.2fr) repeat(2, minmax(58px, 1fr)); font-size: 11px; }
447
- }
448
1505
 
449
- /* 全插件唯一的浮窗:顶层(Popover)浮层,内容短、贴边翻转,不被侧栏窄列切掉。
450
- 样式同时写在内联上(见 createTipLayer),这里是字体与内容的排版;
451
- border/padding/background 也在内联里再写一遍,压掉 popover 的 UA 默认值。 */
452
- .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
+ }
453
1541
  .tstip:popover-open { display: block; }
454
1542
  .tstip::before, .tstip::after { content: none !important; display: none !important; }
455
- .tstip-head { font-size: 10.5px; color: var(--dsw-alias-label-secondary); margin-bottom: 2px; }
456
- .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; }
457
1548
  .tstip-row b { font-weight: 600; }
458
- .tstip-note { font-size: 10px; color: var(--dsw-alias-label-tertiary); margin-top: 3px; }
459
-
460
- /* ---------- 花费页:余额 + 完整官方价格表 ---------- */
461
- .ts-bal-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; padding: 14px 20px 8px; flex-wrap: wrap; }
462
- .ts-bal-title { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
463
- .ts-bal-cells { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border-top: 1px solid var(--dsw-alias-border-l1); }
464
- .ts-bal-cell { padding: 12px 20px; min-width: 0; }
465
- .ts-bal-cell + .ts-bal-cell { border-left: 1px solid var(--dsw-alias-border-l1); }
466
- .ts-bal-label { font-size: 11.5px; color: var(--dsw-alias-label-secondary); white-space: nowrap; }
467
- .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; }
468
- .ts-bal-sub { font-size: 11px; color: var(--dsw-alias-label-tertiary); margin-top: 5px; font-variant-numeric: tabular-nums; }
469
- .ts-bal-table { padding: 10px 20px 12px; border-top: 1px solid var(--dsw-alias-border-l1); }
470
- .ts-bal-table-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
471
- .ts-bal-table-title { font-size: 11.5px; color: var(--dsw-alias-label-secondary); }
472
- .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; }
473
- @media (max-width: 720px) {
474
- .ts-pt-row { grid-template-columns: minmax(72px, 1.2fr) repeat(2, minmax(58px, 1fr)); font-size: 11px; }
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; }
475
1608
  }
476
1609
  `;
477
1610
 
@@ -489,13 +1622,14 @@ window.__ModuleLoader__.load({
489
1622
  return body;
490
1623
  }
491
1624
 
492
- /** 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. */
493
1626
  function fmtTokens(value) {
494
1627
  const n = Number.isFinite(value) ? value : 0;
495
1628
  if (n <= 0) return '0';
496
1629
  if (n < 1000) return String(Math.round(n));
497
- if (n < 1000 * 1000) return `${trim(n / 1000)}K`;
498
- 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`;
499
1633
  }
500
1634
 
501
1635
  function trim(value) {
@@ -916,10 +2050,10 @@ window.__ModuleLoader__.load({
916
2050
  * come from the theme so the bar matches the surrounding panel.
917
2051
  */
918
2052
  const COMPOSITION = [
919
- { key: 'cacheRead', color: 'var(--dsw-alias-brand-primary)' },
920
- { key: 'input', color: '#4b93c8' },
921
- { key: 'output', color: '#6f8fb0' },
922
- { 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)' },
923
2057
  ];
924
2058
 
925
2059
  function dateKey(date) {
@@ -962,38 +2096,25 @@ window.__ModuleLoader__.load({
962
2096
  }
963
2097
 
964
2098
  /**
965
- * Matte nylon blue: low saturation, a cool steel base, and a compact cobalt
966
- * ramp. The depth comes from contrast between the tile and its edge, never
967
- * from a glossy gradient or neon highlight.
2099
+ * 热力图的档位:0 = 无用量,1–4 = intensity() 的四档。
2100
+ *
2101
+ * 色值只写在 CSS 里,按主题分两层:
2102
+ * .ts-cell-paint … -l4 深色(宿主默认层)
2103
+ * body:not([data-ds-dark-theme]) … 浅色
2104
+ *
2105
+ * 为什么不再由 JS 给颜色:宿主切主题靠 `body[data-ds-dark-theme]`,
2106
+ * 而内联 style 压在上面,换到浅色时深色值原样留在白底上——看起来就是一片黑。
2107
+ * 这里只负责级别 → 类名的映射,一处色值只维护一份。
968
2108
  */
969
- const BLUE_RAMP = [
970
- { fill: '#323943', edge: 'rgba(194, 214, 232, 0.08)', shadow: 'rgba(0, 0, 0, 0.24)' },
971
- { fill: '#3c566f', edge: 'rgba(164, 210, 239, 0.16)', shadow: 'rgba(0, 28, 56, 0.30)' },
972
- { fill: '#3d7197', edge: 'rgba(162, 222, 246, 0.23)', shadow: 'rgba(0, 30, 68, 0.36)' },
973
- { fill: '#3c82b8', edge: 'rgba(177, 228, 246, 0.28)', shadow: 'rgba(0, 32, 84, 0.42)' },
974
- { fill: '#4b93c8', edge: 'rgba(201, 238, 250, 0.34)', shadow: 'rgba(0, 38, 94, 0.46)' },
975
- ];
976
-
977
- function cellPaint(level) {
978
- return BLUE_RAMP[Math.max(0, Math.min(BLUE_RAMP.length - 1, level | 0))];
979
- }
980
-
981
- function cellStyle(level) {
982
- if (level <= 0) {
983
- return { background: '#252a31', borderColor: 'rgba(185, 205, 224, 0.09)', boxShadow: 'inset 0 1px 0 rgba(255, 255, 255, 0.035), inset 0 -1px 0 rgba(0, 0, 0, 0.28)' };
984
- }
985
- const step = cellPaint(level);
986
- return {
987
- background: step.fill,
988
- borderColor: step.edge,
989
- boxShadow: `inset 0 1px 0 ${step.edge}, inset 0 -1px 0 rgba(0, 0, 0, 0.25), 0 1px 3px ${step.shadow}`,
990
- };
991
- }
2109
+ const HEAT_LEVELS = 4;
992
2110
 
993
- function gradeTone(grade) {
994
- if (grade === 'A' || grade === 'B') return 'var(--dsw-alias-state-success-primary)';
995
- if (grade === 'C') return 'var(--dsw-alias-state-warn-primary)';
996
- return 'var(--dsw-alias-state-error-primary)';
2111
+ /**
2112
+ * 级别 → 涂装类名。0 是空格子,1–4 是四档热度。
2113
+ * 越界一律夹到两端,避免画出不存在的档。
2114
+ */
2115
+ function cellPaintClass(level) {
2116
+ const clamped = Math.max(0, Math.min(HEAT_LEVELS, level | 0));
2117
+ return `ts-cell-paint ts-cell-paint-l${clamped}`;
997
2118
  }
998
2119
 
999
2120
  /** Peak-relative intensity: 0 empty, 1..3 quartiles of the busiest day, 4 the peak. */
@@ -1057,6 +2178,10 @@ window.__ModuleLoader__.load({
1057
2178
  }
1058
2179
  columns.push(cells);
1059
2180
  }
2181
+ // 第 0 列与第 1 列若紧挨着换月,隐藏第 0 列的残月标签,避免月份字重叠。
2182
+ if (months.length >= 2 && months[0].index === 0 && months[1].index === 1) {
2183
+ months.shift();
2184
+ }
1060
2185
  return { columns, months, weeks };
1061
2186
  }
1062
2187
 
@@ -1267,12 +2392,49 @@ window.__ModuleLoader__.load({
1267
2392
  const TIP_GAP = 6;
1268
2393
 
1269
2394
  function build(content, host) {
1270
- 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) {
1271
2409
  const head = document.createElement('div');
1272
2410
  head.className = 'tstip-head';
1273
2411
  head.textContent = content.head;
1274
2412
  host.appendChild(head);
1275
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
+ }
1276
2438
  for (const row of content.rows ?? []) {
1277
2439
  const line = document.createElement('div');
1278
2440
  line.className = 'tstip-row';
@@ -1283,6 +2445,16 @@ window.__ModuleLoader__.load({
1283
2445
  line.append(label, value);
1284
2446
  host.appendChild(line);
1285
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
+ }
1286
2458
  if (typeof content.note === 'string' && content.note.length > 0) {
1287
2459
  const note = document.createElement('div');
1288
2460
  note.className = 'tstip-note';
@@ -1318,9 +2490,13 @@ window.__ModuleLoader__.load({
1318
2490
  element.style.right = 'auto';
1319
2491
  element.style.bottom = 'auto';
1320
2492
  element.style.margin = '0';
1321
- element.style.border = '1px solid var(--dsw-alias-border-l2)';
1322
- element.style.background = 'var(--dsw-alias-bg-overlay, var(--dsw-alias-bg-layer-2))';
1323
- 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';
1324
2500
  element.style.overflow = 'visible';
1325
2501
  document.body.appendChild(element);
1326
2502
  return element;
@@ -1399,10 +2575,9 @@ window.__ModuleLoader__.load({
1399
2575
  }
1400
2576
 
1401
2577
  /**
1402
- * 24 小时峰谷格子图(今天,北京时间):每小时一格,高峰红、其余绿。
1403
- * 当前小时不描边——7–9px 的格子上描边会吃掉自己的圆角、挨到邻格,
1404
- * 整条读出多出一个方框;改为这一格提亮一档、条下正对它落一个圆点。
1405
- * 用网格排版,格子位置由布局决定,不依赖像素取整,所以对齐天生是齐的。
2578
+ * 24 小时峰谷微胶囊条(今天,北京时间):每小时一格,高峰红、其余绿。
2579
+ * 已过小时柔和压暗、未来清透、当前小时高亮微光并在条下正对落圆点。
2580
+ * 仅在传入 tip 时绑定悬停浮窗(侧栏紧凑态保持静默,不弹浮窗)。
1406
2581
  */
1407
2582
  function PeakTimeline(props) {
1408
2583
  const t = props.t;
@@ -1416,33 +2591,34 @@ window.__ModuleLoader__.load({
1416
2591
  // 下一次切换若在明天,超出本条范围:只在浮窗里说明方向。
1417
2592
  const switchClipped = !(Number.isFinite(peak.until) && peak.until < origin + DAY_MS)
1418
2593
  && Number.isFinite(peak.until);
1419
- const content = {
2594
+ const content = tip ? {
1420
2595
  head: t('peakStripHead'),
1421
2596
  rows: [
1422
2597
  { label: t('peakNowLabel'), value: peak.kind === 'off' ? t('offPeak') : t('peak') },
1423
2598
  { label: t('peakWindowsLabel'), value: spans.length === 0 ? t('peakNoneToday') : t('peakEachWindow') },
1424
2599
  ...(switchClipped ? [{ label: t('peakNextLabel'), value: peak.nextKind === 'peak' ? t('peak') : t('offPeak') }] : []),
1425
2600
  ],
1426
- };
1427
- // 24 个格子:高峰小时红、其余绿。用网格而不是连续长条——
1428
- // 格子位置由布局决定,不依赖像素取整,所以不会有交界混色,看起来是齐的。
2601
+ } : null;
2602
+ // 24 个微胶囊:已过小时柔和压暗、未来清透、当前格高亮微光 + 底部落圆点。
1429
2603
  const cells = hourCells(now);
1430
2604
  const nowHour = beijingParts(now).hour;
1431
- // 「此刻」不描边:当前格提亮一档,条下正对它落一个圆点。
1432
- // 整条始终是一条连续的进度带,不会多出一个打断形状的方框。
1433
- 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
+ };
1434
2609
  return h('div', { className: `ts-tl${props.compact ? ' ts-tl-compact' : ''}` },
1435
2610
  h('div', {
1436
2611
  className: 'ts-tl-cells',
1437
2612
  role: 'img',
1438
2613
  'aria-label': t('peakStripHead'),
1439
- onMouseEnter: (event) => tip.show(event.currentTarget, content),
1440
- onMouseLeave: () => tip.hide(),
2614
+ ...(content !== null ? {
2615
+ onMouseEnter: (event) => tip.show(event.currentTarget, content),
2616
+ onMouseLeave: () => tip.hide(),
2617
+ } : {}),
1441
2618
  },
1442
2619
  ...cells.map((cell) => h('span', {
1443
2620
  key: cell.hour,
1444
2621
  className: classOf(cell.hour),
1445
- title: `${pad2(cell.hour)}:00 · ${cell.kind === 'peak' ? t('peak') : t('offPeak')}`,
1446
2622
  })),
1447
2623
  ),
1448
2624
  h('div', { className: 'ts-tl-marks', 'aria-hidden': 'true' },
@@ -1460,22 +2636,7 @@ window.__ModuleLoader__.load({
1460
2636
  );
1461
2637
  }
1462
2638
 
1463
- /** 侧栏一行价:**三个口径都给**(命中·未命中·输出),只给当前时段的价。
1464
- 模型之间用空格分隔,口径之间用 · 分隔。 */
1465
- function priceLine(peak) {
1466
- const slot = peak?.kind === 'off' ? 'offPeak' : 'peak';
1467
- const items = [];
1468
- PRICING.models.forEach((model, index) => {
1469
- if (index > 0) items.push(' ');
1470
- items.push(h('span', { key: model.id }, `${shortModel(model.id)} ${model[slot].hit}·${model[slot].miss}·${model[slot].out}`));
1471
- });
1472
- return items;
1473
- }
1474
-
1475
- /**
1476
- * 官方价文字表:两模型 × 三项(命中 / 未命中 / 输出),当前时段一列加粗。
1477
- * 条形版换回文字版——数字本身就是要看的信息。
1478
- */
2639
+ /** 官方价文字表:两模型 × 三项(命中 / 未命中 / 输出),当前时段加粗、高峰列红字。 */
1479
2640
  function PriceTable(props) {
1480
2641
  const t = props.t;
1481
2642
  const peak = props.peak;
@@ -1505,19 +2666,6 @@ window.__ModuleLoader__.load({
1505
2666
  );
1506
2667
  }
1507
2668
 
1508
- function peakBadge(peak, t, tip) {
1509
- const off = peak.kind === 'off';
1510
- const content = {
1511
- head: off ? t('peakDiscount') : t('peak'),
1512
- note: off ? t('peakOffRule') : t('peakWindowsHint'),
1513
- };
1514
- return h('span', {
1515
- className: `tsb-badge ${off ? 'tsb-badge-off' : 'tsb-badge-peak'}`,
1516
- onMouseEnter: (event) => tip.show(event.currentTarget, content),
1517
- onMouseLeave: () => tip.hide(),
1518
- }, off ? t('peakDiscount') : t('peak'));
1519
- }
1520
-
1521
2669
  /* ---------------------- 低余额充值提醒 ---------------------- */
1522
2670
 
1523
2671
  const LOW_BALANCE_KEY = 'dsh-spend-ledger/low-balance';
@@ -1551,7 +2699,7 @@ window.__ModuleLoader__.load({
1551
2699
  }
1552
2700
 
1553
2701
  /**
1554
- * 充值提醒设置的唯一来源。侧栏卡片和花费页的输入框都订阅它——
2702
+ * 充值提醒设置的唯一来源。侧栏与花费页输入框都订阅它——
1555
2703
  * 否则两处各自 useState,在设置页改完阈值侧栏根本不知道。
1556
2704
  */
1557
2705
  const lowBalanceStore = (() => {
@@ -1641,6 +2789,33 @@ window.__ModuleLoader__.load({
1641
2789
  );
1642
2790
  }
1643
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
+
1644
2819
  /** 花费页的余额提醒:只留最低余额,0 表示关闭提醒。 */
1645
2820
  function LowBalanceSettings(props) {
1646
2821
  const t = props.t;
@@ -1662,11 +2837,12 @@ window.__ModuleLoader__.load({
1662
2837
  && settings.dismissedAt > 0
1663
2838
  && Date.now() - settings.dismissedAt < LOW_DISMISS_TTL_MS;
1664
2839
  return h('div', { className: 'ts-low' },
1665
- h('div', { className: 'ts-low-title' }, t('lowSettingsTitle')),
1666
- h('div', { className: 'ts-low-fields' },
1667
- h('label', { className: 'ts-low-field' },
1668
- 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' }, '¥'),
1669
2844
  h('input', {
2845
+ ref: props.inputRef,
1670
2846
  className: 'ts-low-input',
1671
2847
  type: 'number',
1672
2848
  min: 0,
@@ -1677,8 +2853,8 @@ window.__ModuleLoader__.load({
1677
2853
  onBlur: commit,
1678
2854
  onKeyDown: (event) => { if (event.key === 'Enter') commit(); },
1679
2855
  }),
1680
- h('span', { className: 'ts-low-hint' }, t('lowThresholdHint')),
1681
2856
  ),
2857
+ h('span', { className: 'ts-low-hint' }, t('lowThresholdHint')),
1682
2858
  ),
1683
2859
  silenced
1684
2860
  ? h('div', { className: 'ts-low-silent' },
@@ -1690,7 +2866,6 @@ window.__ModuleLoader__.load({
1690
2866
  }, t('lowResume')),
1691
2867
  )
1692
2868
  : null,
1693
- h('div', { className: 'ts-low-note' }, t('lowSettingsNote')),
1694
2869
  );
1695
2870
  }
1696
2871
 
@@ -1745,10 +2920,34 @@ window.__ModuleLoader__.load({
1745
2920
  }
1746
2921
  }
1747
2922
 
1748
- /** 侧栏底部的那张卡:余额 + 峰谷 + 今日花费 + 官方价,收起时只留色点与状态字。 */
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
+ /** 侧栏底部「余额 + 峰谷」无外壳流式行:静默展示不弹浮窗,收起时只留微光色点与状态字。 */
1749
2949
  function SidebarBalanceCard(props) {
1750
2950
  const t = typeof props.t === 'function' ? props.t : (key) => key;
1751
- const tip = props.tip;
1752
2951
  const store = props.store;
1753
2952
  const account = useAccountStore(store);
1754
2953
  const now = useNow(35_000);
@@ -1761,7 +2960,6 @@ window.__ModuleLoader__.load({
1761
2960
  const lowSettings = useLowBalanceSettings();
1762
2961
  const lowAmount = walletAmount(account.balance?.status === 'ready' ? account.balance.value : undefined);
1763
2962
  const lowBalance = needsTopUp(lowAmount, lowSettings) ? lowAmount : null;
1764
- // 读屏只需要一句:这张卡是什么、现在什么价段、余额多少。细节在悬停浮窗里。
1765
2963
  const label = [
1766
2964
  t('balanceTitle'),
1767
2965
  period,
@@ -1793,13 +2991,14 @@ window.__ModuleLoader__.load({
1793
2991
  : null,
1794
2992
  h('span', { className: 'tsb-spacer' }),
1795
2993
  today !== null && today.total > 0
1796
- ? 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)))
1797
2995
  : null,
1798
- 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
+ ),
1799
2999
  ),
1800
3000
  h('div', { className: 'tsb-peak' }, line),
1801
- h(PeakTimeline, { t, tip, now, peak, compact: true }),
1802
- h('div', { className: 'tsb-prices' }, priceLine(peak)),
3001
+ h(PeakTimeline, { t, now, peak, compact: true }),
1803
3002
  lowBalance !== null
1804
3003
  ? h(LowBalanceBanner, {
1805
3004
  t,
@@ -1818,82 +3017,97 @@ window.__ModuleLoader__.load({
1818
3017
  );
1819
3018
  }
1820
3019
 
1821
- /**「花费」页顶部:余额、峰谷与官方价格(文字表:两模型 × 三项 × 峰/谷两列)。 */
1822
- function BalancesCard(props) {
3020
+ /**「花费」页右上方 Bento 卡:账户余额、赠金、徽章与 24 小时峰谷状态。 */
3021
+ function AccountBentoCard(props) {
1823
3022
  const t = props.t;
1824
3023
  const tip = props.tip;
1825
3024
  const store = props.store;
3025
+ const now = props.now;
3026
+ const peak = props.peak;
1826
3027
  const account = useAccountStore(store);
1827
- const now = useNow(15_000);
1828
- const peak = React.useMemo(() => peakState(now), [now]);
1829
3028
  const view = balanceView(account, t);
1830
3029
  const line = peakLine(peak, now, t);
1831
- const today = props.today && typeof props.today === 'object'
1832
- ? { total: Number(props.today.total) || 0, calls: Number(props.today.calls) || 0 }
1833
- : null;
1834
- const cells = [
1835
- {
1836
- key: 'recharge',
1837
- label: t('rechargeBalance'),
1838
- value: view.signedIn ? (view.amount.length > 0 ? view.amount : t('balanceLoading')) : t('balanceSignedOut'),
1839
- sub: account.stale ? t('balanceStale') : '',
1840
- },
1841
- {
1842
- key: 'bonus',
1843
- label: t('bonusBalance'),
1844
- value: view.signedIn ? (view.bonusAmount.length > 0 ? view.bonusAmount : '—') : '—',
1845
- sub: '',
1846
- },
1847
- {
1848
- key: 'peak',
1849
- label: peak.kind === 'off' ? t('offPeak') : t('peak'),
1850
- value: peak.kind === 'off' ? t('peakDiscount') : t('peak'),
1851
- sub: line,
1852
- },
1853
- ...(today !== null
1854
- ? [{
1855
- key: 'todaySpend',
1856
- label: t('today'),
1857
- value: fmtTokens(today.total),
1858
- sub: today.calls > 0 ? t('calls').replace('{n}', '') + fmtInt(today.calls) : '',
1859
- }]
1860
- : []),
1861
- ];
1862
- // 价格给数字:两模型 × 三项,当前时段那一侧加粗,另一侧淡显。
1863
- return h('div', { className: 'ts-card' },
1864
- h('div', { className: 'ts-bal-head' },
1865
- h('div', null,
1866
- 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')),
1867
3067
  ),
1868
- h('div', { className: 'ts-legend' }, peakBadge(peak, t, tip)),
1869
3068
  ),
1870
- h('div', { className: 'ts-bal-cells' },
1871
- ...cells.map((cell) => h('div', { key: cell.key, className: 'ts-bal-cell' },
1872
- h('div', { className: 'ts-bal-label' }, cell.label),
1873
- h('div', { className: 'ts-bal-value' }, cell.value),
1874
- cell.sub.length > 0 ? h('div', { className: 'ts-bal-sub' }, cell.sub) : null,
1875
- )),
3069
+ h('div', { className: 'ts-account-timeline' },
3070
+ h('div', { className: 'ts-account-countdown' }, line),
3071
+ h(PeakTimeline, { t, tip, now, peak }),
1876
3072
  ),
1877
- h('div', { className: 'ts-bal-timeline' }, h(PeakTimeline, { t, tip, now, peak })),
1878
- h('div', { className: 'ts-bal-table' },
1879
- h('div', { className: 'ts-bal-table-head' },
1880
- h('span', { className: 'ts-bal-table-title' }, t('priceTitle')),
1881
- 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')),
1882
3085
  ),
1883
3086
  h(PriceTable, { t, peak }),
1884
- h('div', { className: 'ts-bal-legend' },
1885
- h('span', { className: 'ts-bal-unit' }, t('priceUnit')),
1886
- ),
1887
3087
  ),
1888
- h('div', { className: 'ts-bal-foot' },
1889
- h('span', null,
1890
- t('priceSource').replace('{date}', PRICING.retrieved),
1891
- peak.coverageYear === null ? ` · ${t('holidayUncovered')}` : '',
1892
- ),
3088
+ h('div', { className: 'ts-util-foot' },
3089
+ t('priceSource').replace('{date}', PRICING.retrieved),
3090
+ peak.coverageYear === null ? ` · ${t('holidayUncovered')}` : '',
1893
3091
  ),
1894
- h('div', { className: 'ts-bal-table' },
1895
- 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 }),
1896
3109
  ),
3110
+ h('div', { className: 'ts-util-foot' }, t('lowSettingsNote')),
1897
3111
  );
1898
3112
  }
1899
3113
 
@@ -1902,9 +3116,21 @@ window.__ModuleLoader__.load({
1902
3116
  const [loading, setLoading] = React.useState(false);
1903
3117
  const [error, setError] = React.useState(null);
1904
3118
  const [selected, setSelected] = React.useState(null);
3119
+ const [heatFocused, setHeatFocused] = React.useState(false);
1905
3120
  const [hover, setHover] = React.useState(null);
3121
+ const [heatMetric, setHeatMetric] = React.useState('total');
3122
+ const [pulseUtil, setPulseUtil] = React.useState(false);
1906
3123
  const lowSettings = useLowBalanceSettings();
3124
+ const now = useNow(15_000);
3125
+ const peak = React.useMemo(() => peakState(now), [now]);
1907
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
+ }, []);
1908
3134
 
1909
3135
  // 页面上所有悬停说明都走同一只浮窗(原生 title 不能设计、也不跟主题)。
1910
3136
  const hoverTip = (content) => ({
@@ -1951,6 +3177,15 @@ window.__ModuleLoader__.load({
1951
3177
  load(false);
1952
3178
  }, [load]);
1953
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
+
1954
3189
  const days = React.useMemo(() => (Array.isArray(data?.days) ? data.days : []), [data]);
1955
3190
  const totals = React.useMemo(() => countersOf(data?.totals), [data]);
1956
3191
 
@@ -1970,7 +3205,12 @@ window.__ModuleLoader__.load({
1970
3205
  ].filter((part) => part.length > 0).join(' · ');
1971
3206
  const statusText = data === null
1972
3207
  ? null
1973
- : (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;
1974
3214
 
1975
3215
  const budget = data?.budget && typeof data.budget === 'object' ? data.budget : { tokens: 0, source: 'auto' };
1976
3216
  const budgetTokens = Number.isFinite(budget.tokens) ? budget.tokens : 0;
@@ -1979,18 +3219,38 @@ window.__ModuleLoader__.load({
1979
3219
  : { total: 0, previous: 0, calls: 0 };
1980
3220
  const todayDelta = fmtDelta(todayBlock.total, todayBlock.previous);
1981
3221
  // The budget is a day budget, so the bar tracks today rather than all time.
1982
- 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';
1983
3228
  const cacheHitRate = Number.isFinite(data?.cacheHitRate) ? data.cacheHitRate : 0;
1984
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
+ };
1985
3241
 
1986
- const peak = React.useMemo(() => {
3242
+ const heatPeak = React.useMemo(() => {
1987
3243
  let max = 0;
1988
3244
  for (const day of days) {
1989
- 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;
1990
3250
  if (value > max) max = value;
1991
3251
  }
1992
3252
  return max;
1993
- }, [days]);
3253
+ }, [days, heatMetric]);
1994
3254
 
1995
3255
  const window = React.useMemo(() => heatWindow(days), [days]);
1996
3256
  const grid = React.useMemo(() => buildGrid(window), [window]);
@@ -2072,6 +3332,12 @@ window.__ModuleLoader__.load({
2072
3332
  return max;
2073
3333
  }, [trend]);
2074
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
+
2075
3341
  const selectedSessions = React.useMemo(() => {
2076
3342
  if (selected === null) return [];
2077
3343
  const list = Array.isArray(data?.sessions) ? data.sessions : [];
@@ -2135,16 +3401,8 @@ window.__ModuleLoader__.load({
2135
3401
  if (next !== selected) setSelected(next);
2136
3402
  };
2137
3403
 
2138
- /**
2139
- * Anchor the hover card next to the cell and keep it inside the card on all
2140
- * four sides:
2141
- * - horizontal: the readout is centred on the cell, so its centre is
2142
- * clamped by half its width (edge cells would otherwise spill out);
2143
- * - vertical: preferred below the cell, moved above when the bottom would
2144
- * overflow, and clamped into the card when neither side has full room.
2145
- */
2146
- const TIP_WIDTH = 196;
2147
- const TIP_HEIGHT = 108;
3404
+ const TIP_WIDTH = 204;
3405
+ const TIP_HEIGHT = 114;
2148
3406
  const TIP_GAP = 6;
2149
3407
  const TIP_MARGIN = 6;
2150
3408
 
@@ -2176,55 +3434,90 @@ window.__ModuleLoader__.load({
2176
3434
  setHover({ label: cellState.label, counters: countersOf(cellState.day), anchor: { x, y } });
2177
3435
  };
2178
3436
 
3437
+ const gridHasSelected = heatFocused
3438
+ && selected !== null
3439
+ && grid.columns.some((col) => col.some((cellState) => !cellState.future && cellState.key === selected));
3440
+
2179
3441
  const heatCell = (cellState) => {
2180
3442
  const counters = cellState.day === undefined ? undefined : countersOf(cellState.day);
2181
- const total = counters?.total ?? 0;
2182
- const level = cellState.future ? 0 : intensity(total, peak);
2183
- const className = `ts-cell${cellState.key === selected ? ' ts-cell-selected' : ''}`;
2184
- // The browser's native `title` tooltip cannot be themed, so the cell
2185
- // carries no title: hovering reports into the card's own tooltip.
3443
+ const value = heatValueOf(counters);
3444
+ const level = cellState.future ? 0 : intensity(value, heatPeak);
3445
+ const isFocusedCell = heatFocused && cellState.key === selected;
3446
+ // 颜色走类名而不是内联 style:内联会压过主题,浅色下就成了一片黑方块。
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')}`;
2186
3449
  return h('button', {
2187
3450
  key: cellState.key,
2188
3451
  type: 'button',
2189
3452
  className,
2190
- style: cellState.future ? { opacity: 0.35 } : cellStyle(level),
2191
3453
  disabled: cellState.future,
2192
- 'aria-label': `${cellState.key} · ${fmtTokens(total)} tokens`,
3454
+ 'aria-pressed': isFocusedCell,
3455
+ 'aria-label': `${cellState.key} · ${ariaValue}`,
2193
3456
  onMouseEnter: cellState.future ? undefined : (event) => showHover(cellState, event.currentTarget),
2194
3457
  onMouseLeave: cellState.future ? undefined : () => setHover(null),
2195
3458
  onFocus: cellState.future ? undefined : (event) => showHover(cellState, event.currentTarget),
2196
3459
  onBlur: cellState.future ? undefined : () => setHover(null),
2197
- onClick: () => {
2198
- 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
+ }
2199
3469
  },
2200
3470
  });
2201
3471
  };
2202
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
+
2203
3485
  const heatmap = h(
2204
3486
  'div',
2205
- { 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
+ },
2206
3495
  h(
2207
3496
  'div',
2208
3497
  { className: 'ts-section-head' },
2209
3498
  h(
2210
3499
  'div',
2211
- null,
2212
- h('div', { className: 'ts-section-title' }, t('heatmap')),
2213
- 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')),
2214
3503
  ),
2215
3504
  h(
2216
3505
  'div',
2217
- { className: 'ts-legend' },
2218
- ...[
2219
- { label: t('legendLow'), level: 1 },
2220
- { label: t('legendMid'), level: 2 },
2221
- { label: t('legendHigh'), level: 3 },
2222
- { label: t('legendPeak'), level: 4 },
2223
- ].map((entry) => h(
2224
- 'div',
2225
- { key: entry.label, className: 'ts-legend-item' },
2226
- h('span', { className: 'ts-legend-swatch', style: cellStyle(entry.level) }),
2227
- 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,
2228
3521
  )),
2229
3522
  ),
2230
3523
  ),
@@ -2234,13 +3527,12 @@ window.__ModuleLoader__.load({
2234
3527
  'div',
2235
3528
  {
2236
3529
  className: 'ts-tip',
2237
- role: 'tooltip',
2238
3530
  style: hover.anchor === null || hover.anchor === undefined
2239
3531
  ? undefined
2240
3532
  : { left: `${hover.anchor.x}px`, top: `${hover.anchor.y}px` },
2241
3533
  },
2242
3534
  h('div', { className: 'ts-tip-head' }, hover.label),
2243
- 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)),
2244
3536
  hover.counters.total > 0
2245
3537
  ? h(
2246
3538
  'div',
@@ -2255,14 +3547,6 @@ window.__ModuleLoader__.load({
2255
3547
  h(
2256
3548
  'div',
2257
3549
  { className: 'ts-heat-body' },
2258
- h(
2259
- 'div',
2260
- { className: 'ts-months', style: { gridTemplateColumns: `repeat(${grid.weeks}, minmax(0, 1fr))` } },
2261
- ...grid.columns.map((column, index) => {
2262
- const month = grid.months.find((entry) => entry.index === index);
2263
- return h('span', { key: `m${index}`, className: 'ts-month' }, month ? month.label : '');
2264
- }),
2265
- ),
2266
3550
  h(
2267
3551
  'div',
2268
3552
  { className: 'ts-heat' },
@@ -2277,7 +3561,7 @@ window.__ModuleLoader__.load({
2277
3561
  ),
2278
3562
  h(
2279
3563
  'div',
2280
- { className: 'ts-grid' },
3564
+ { className: gridHasSelected ? 'ts-grid ts-grid-has-sel' : 'ts-grid' },
2281
3565
  ...grid.columns.map((column, index) => h(
2282
3566
  'div',
2283
3567
  { key: `c${index}`, className: 'ts-col' },
@@ -2285,11 +3569,35 @@ window.__ModuleLoader__.load({
2285
3569
  )),
2286
3570
  ),
2287
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' }),
2288
3581
  ),
2289
3582
  h(
2290
3583
  'div',
2291
- { className: 'ts-meta' },
2292
- 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,
2293
3601
  ),
2294
3602
  );
2295
3603
 
@@ -2301,21 +3609,25 @@ window.__ModuleLoader__.load({
2301
3609
  { className: 'ts-detail-title' },
2302
3610
  h('span', { className: 'ts-detail-date' }, selected === null ? t('noSelection') : keyLabel(selected)),
2303
3611
  h(
2304
- 'button',
2305
- { type: 'button', className: 'ts-btn ts-icon-btn', title: t('prevDay'), 'aria-label': t('prevDay'), disabled: !canPrev, onClick: () => moveDay(-1) },
2306
- '‹',
2307
- ),
2308
- h(
2309
- 'button',
2310
- { type: 'button', className: 'ts-btn ts-icon-btn', title: t('nextDay'), 'aria-label': t('nextDay'), disabled: !canNext, onClick: () => moveDay(1) },
2311
- '›',
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
+ ),
2312
3624
  ),
2313
3625
  h(
2314
3626
  'button',
2315
3627
  {
2316
3628
  type: 'button',
2317
3629
  className: 'ts-btn',
2318
- disabled: latestUsedKey === null,
3630
+ disabled: latestUsedKey === null || latestUsedKey === selected,
2319
3631
  onClick: () => {
2320
3632
  if (latestUsedKey !== null) setSelected(latestUsedKey);
2321
3633
  },
@@ -2380,7 +3692,7 @@ window.__ModuleLoader__.load({
2380
3692
  'div',
2381
3693
  { key: name, className: 'ts-model-row' },
2382
3694
  h('span', { className: 'ts-model-name', ...hoverTip({ head: name }) }, name),
2383
- 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)}%` } })),
2384
3696
  h('span', { className: 'ts-model-meta' }, `${fmtTokens(entry.total)} · ${fmtPercent(share)}`),
2385
3697
  );
2386
3698
  }),
@@ -2453,7 +3765,7 @@ window.__ModuleLoader__.load({
2453
3765
  ...composition.map((entry) => h('div', {
2454
3766
  key: entry.key,
2455
3767
  className: 'ts-comp-seg',
2456
- style: { width: `${Math.max(0.5, entry.share * 100)}%`, backgroundColor: entry.color },
3768
+ style: { width: `${Math.max(1, entry.share * 100)}%`, backgroundColor: entry.color },
2457
3769
  })),
2458
3770
  ),
2459
3771
  h(
@@ -2481,139 +3793,158 @@ window.__ModuleLoader__.load({
2481
3793
 
2482
3794
  const trendCard = h(
2483
3795
  'div',
2484
- { className: 'ts-card' },
3796
+ { className: 'ts-card ts-trend-card' },
2485
3797
  h(
2486
3798
  'div',
2487
- { className: 'ts-section-head' },
3799
+ { className: 'ts-trend-strip' },
2488
3800
  h(
2489
3801
  'div',
2490
- null,
2491
- 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))),
2492
3806
  ),
2493
- ),
2494
- h(
2495
- 'div',
2496
- { className: 'ts-trend' },
2497
3807
  h(
2498
3808
  'div',
2499
- { className: 'ts-trend-bars' },
2500
- ...trend.map((entry) => {
2501
- const ratio = trendPeak > 0 ? entry.total / trendPeak : 0;
2502
- return h(
2503
- 'div',
2504
- {
2505
- key: entry.key,
2506
- className: `ts-trend-col${entry.key === selected ? ' ts-trend-col-on' : ''}`,
2507
- ...hoverTip({
2508
- head: entry.label,
2509
- rows: [{ label: t('tokens'), value: fmtTokens(entry.total) }],
2510
- }),
2511
- },
2512
- h('div', {
2513
- className: 'ts-trend-bar',
2514
- style: {
2515
- height: `${Math.max(2, ratio * 100)}%`,
2516
- backgroundColor: entry.key === selected ? undefined : 'var(--dsw-alias-brand-primary)',
2517
- 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
+ }),
2518
3830
  },
2519
- }),
2520
- );
2521
- }),
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' }),
2522
3844
  ),
2523
3845
  h(
2524
- 'div',
2525
- { className: 'ts-trend-labels' },
2526
- ...trend.map((entry) => h(
2527
- 'span',
2528
- { key: entry.key, className: entry.key === selected ? 'ts-trend-label-on' : '' },
2529
- entry.label,
2530
- )),
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) : '—'),
2531
3864
  ),
2532
3865
  ),
2533
3866
  );
2534
3867
 
2535
- const hero = h(
3868
+ const heroCard = h(
2536
3869
  'div',
2537
- { className: 'ts-card ts-hero' },
3870
+ { className: 'ts-card ts-hero-main' },
2538
3871
  h(
2539
3872
  'div',
2540
- { className: 'ts-hero-cell' },
2541
- h('div', { className: 'ts-hero-label' }, t('totalAllIn')),
2542
- h('div', { className: 'ts-hero-value' }, fmtTokens(totals.total)),
2543
- // One short fact per card: the full split lives in the cell tooltip so
2544
- // a narrow column never truncates the line.
3873
+ { className: 'ts-hero-top' },
2545
3874
  h(
2546
3875
  'div',
2547
- {
2548
- className: 'ts-hero-note',
2549
- ...hoverTip({
2550
- head: t('totalAllInHint'),
2551
- rows: [
2552
- { label: t('inputTokens'), value: fmtTokens(totals.input) },
2553
- { label: t('outputTokens'), value: fmtTokens(totals.output) },
2554
- { label: t('cacheRead'), value: fmtTokens(totals.cacheRead) },
2555
- { label: t('cacheWrite'), value: fmtTokens(totals.cacheWrite) },
2556
- ],
2557
- }),
2558
- },
2559
- `${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,
2560
3916
  ),
2561
- ),
2562
- h(
2563
- 'div',
2564
- { className: 'ts-hero-cell' },
2565
- h('div', { className: 'ts-hero-label' }, t('today')),
2566
- h('div', { className: 'ts-hero-value' }, fmtTokens(todayBlock.total)),
2567
- h('div', { className: 'ts-bar' }, h('div', { className: 'ts-bar-fill', style: { width: `${Math.round(budgetRatio * 100)}%` } })),
2568
3917
  h(
2569
3918
  'div',
2570
3919
  {
2571
- className: 'ts-hero-note',
3920
+ className: 'ts-bar',
2572
3921
  ...(budgetTokens > 0
2573
3922
  ? hoverTip({
2574
- head: t('budget'),
3923
+ head: t('dailyBudget'),
2575
3924
  rows: [
2576
- { label: t('budget'), value: fmtTokens(budgetTokens) },
3925
+ { label: t('today'), value: fmtTokens(todayBlock.total) },
3926
+ { label: t('dailyBudget'), value: fmtTokens(budgetTokens) },
2577
3927
  { label: t('share'), value: fmtPercent(budgetRatio) },
2578
3928
  ],
2579
3929
  })
2580
3930
  : {}),
2581
3931
  },
2582
- h(
2583
- 'span',
2584
- {
2585
- className: 'ts-hero-delta',
2586
- style: {
2587
- color: todayDelta === null
2588
- ? 'var(--dsw-alias-label-tertiary)'
2589
- : (todayDelta.startsWith('-') ? 'var(--dsw-alias-state-success-primary)' : 'var(--dsw-alias-state-warn-primary)'),
2590
- },
2591
- },
2592
- todayDelta === null ? t('yesterdayNone') : `${t('vsYesterday')} ${todayDelta}`,
2593
- ),
3932
+ h('div', { className: budgetFillClass, style: { width: `${budgetBarWidth}%` } }),
2594
3933
  ),
2595
- ),
2596
- h(
2597
- 'div',
2598
- { className: 'ts-hero-cell' },
2599
- h('div', { className: 'ts-hero-label' }, t('cacheHit')),
2600
3934
  h(
2601
3935
  'div',
2602
- { className: 'ts-grade-line' },
2603
- h('div', { className: 'ts-grade-badge', style: { backgroundColor: gradeTone(grade) } }, grade),
2604
- 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))),
2605
3939
  ),
2606
- h('div', { className: 'ts-hero-note' }, `${t('cacheRead')} ${fmtTokens(totals.cacheRead)}`),
2607
3940
  ),
2608
3941
  h(
2609
3942
  'div',
2610
- { className: 'ts-hero-cell' },
2611
- h('div', { className: 'ts-hero-label' }, t('avg7')),
2612
- h('div', { className: 'ts-hero-value' }, fmtTokens(avg7)),
3943
+ { className: 'ts-hero-subgrid' },
2613
3944
  h(
2614
3945
  'div',
2615
3946
  {
2616
- className: 'ts-hero-note',
3947
+ className: 'ts-hero-stat',
2617
3948
  ...(peakDay
2618
3949
  ? hoverTip({
2619
3950
  head: t('peakDay'),
@@ -2621,30 +3952,90 @@ window.__ModuleLoader__.load({
2621
3952
  })
2622
3953
  : {}),
2623
3954
  },
2624
- 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)),
2625
3991
  ),
2626
3992
  ),
2627
3993
  );
2628
3994
 
2629
- // 余额与峰谷与用量数据无关:日志读不出来时它依然应该出现。
2630
- // 「今日花费」是用量数据,但从侧栏看不到,所以也传给余额卡展示。
2631
- const balances = store === undefined ? null : h(BalancesCard, {
3995
+ const accountCard = store === undefined ? null : h(AccountBentoCard, {
2632
3996
  t,
2633
3997
  store,
2634
3998
  tip,
2635
- lowSettings,
3999
+ now,
4000
+ peak,
2636
4001
  today: todayBlock,
2637
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
+
2638
4020
  const body = data === null
2639
- ? (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
+ )
2640
4030
  : totals.total <= 0
2641
4031
  ? h(
2642
4032
  React.Fragment,
2643
4033
  null,
2644
- balances,
2645
- 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,
2646
4037
  )
2647
- : h(React.Fragment, null, balances, hero, heatmap, trendCard, detail);
4038
+ : h(React.Fragment, null, topBento, trendCard, heatmap, detail, utilityRow);
2648
4039
 
2649
4040
  return h(
2650
4041
  'div',
@@ -2652,23 +4043,42 @@ window.__ModuleLoader__.load({
2652
4043
  h(
2653
4044
  'div',
2654
4045
  { className: 'ts-head' },
2655
- h(
2656
- 'div',
2657
- null,
2658
- h('div', { className: 'ts-title' }, t('title')),
2659
- ),
4046
+ h('div', { className: 'ts-title' }, t('title')),
2660
4047
  h(
2661
4048
  'div',
2662
4049
  { className: 'ts-toolbar' },
2663
- 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,
2664
4055
  h(
2665
4056
  'button',
2666
- { type: 'button', className: 'ts-btn', disabled: loading, onClick: () => load(true) },
2667
- t('refresh'),
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
+ ),
4067
+ h(
4068
+ 'button',
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,
2668
4078
  ),
2669
4079
  ),
2670
4080
  ),
2671
- 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,
2672
4082
  body,
2673
4083
  );
2674
4084
  }
@@ -2723,7 +4133,7 @@ window.__ModuleLoader__.load({
2723
4133
  id: 'token-spend-balance',
2724
4134
  order: 30,
2725
4135
  locale: NS,
2726
- inject: () => ({ store: account, tip }),
4136
+ inject: () => ({ store: account }),
2727
4137
  }, (props) => h(PluginBoundary, null, h(SidebarBalanceCard, props))));
2728
4138
 
2729
4139
  ctx.slots.inject('settings.section', () => ctx.slots.register({