magpie-multi-usage 0.1.2 → 0.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.
package/README.md CHANGED
@@ -53,7 +53,7 @@ Create a GitHub **fine-grained personal access token** scoped strictly to **Only
53
53
  ## How it works
54
54
 
55
55
  1. Each device incrementally pulls its own usage from Magpie's loopback API and publishes sanitized monthly snapshots into its own `<prefix>/<device-id>/` folder — one atomic commit per device, no cross-machine conflicts.
56
- 2. Any machine aggregates on read: combined and per-device totals, two-tone daily bars, clickable device filters, and tabbed **Agents / Models / Providers** breakdowns. Offline devices keep their last hash-verified cached snapshot, flagged as cached.
56
+ 2. Any machine aggregates on read: combined and per-device totals, two-tone token bars (hourly slots for **Today**, consecutive daily slots for **7d/30d**, active days for **All**), clickable device filters, and tabbed **Agents / Models / Providers** breakdowns. Today's local usage is bucketed by civil hour in the reporting timezone; remote devices only publish daily totals, so their contribution appears as a separate daily-only total instead of invented hours. Today keeps all 24 hourly bars while the axis labels every two hours (compact on narrow screens). Hover a bar, or focus the chart and use the arrow keys, for the same per-bucket detail. Offline devices keep their last hash-verified cached snapshot, flagged as cached, and unavailable sources never render as false zeros. Recognized models and providers also show their real vendor logo in the breakdown lists — bundled with the plugin and served offline, with no external requests — and fall back to a neutral glyph otherwise.
57
57
 
58
58
  ## Configuration reference
59
59
 
@@ -128,4 +128,6 @@ HOME=$(mktemp -d) bun test test/
128
128
 
129
129
  ## License
130
130
 
131
+ Bundled vendor logos are trademarks of their respective owners, included for identification only.
132
+
131
133
  MIT License — see [LICENSE](LICENSE).
package/README.zh-CN.md CHANGED
@@ -53,7 +53,7 @@ magpie plugin add /path/to/magpie-multi-usage
53
53
  ## 工作原理
54
54
 
55
55
  1. 每台设备增量拉取自身用量(Magpie 回环 API),并将脱敏后的每月快照发布到仓库中自己的 `<prefix>/<device-id>/` 目录——每设备一次原子提交,互不冲突。
56
- 2. 任意机器按读取聚合:合并与按设备总量、双色每日条形图、可点击的设备筛选、**Agents / Models / Providers** 标签页明细;离线设备保留最后一次通过哈希校验的缓存快照并标记为缓存。
56
+ 2. 任意机器按读取聚合:合并与按设备总量、双色 Token 柱状图(**今日**按实际小时分桶,**7/30 天**为连续日期槽位,**全部**按有数据的日期)、可点击的设备筛选、**Agents / Models / Providers** 标签页明细。今日的本机用量按上报时区的自然小时分桶;远端设备只上报每日合计,因此其数据单独显示为“无小时明细的当日合计”,不会伪造小时分布。今日保留全部 24 个小时柱,横轴每两小时标注一次(窄屏使用紧凑标签)。悬停柱体,或聚焦图表后使用方向键,可查看相同的单桶明细。离线设备保留最后一次通过哈希校验的缓存快照并标记为缓存,不可用来源绝不会显示成错误的零值。已识别的模型与供应商还会在明细列表中显示真实的厂商 Logo——随插件内置、离线提供,不发起任何外部请求——其余则回退为中性图标。
57
57
 
58
58
  ## 配置参考
59
59
 
@@ -128,4 +128,6 @@ HOME=$(mktemp -d) bun test test/
128
128
 
129
129
  ## 许可证
130
130
 
131
+ 内置的厂商 Logo 为各自所有者的商标,仅用于识别。
132
+
131
133
  MIT 许可证——见 [LICENSE](LICENSE)。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "magpie-multi-usage",
3
- "version": "0.1.2",
3
+ "version": "0.3.0",
4
4
  "description": "Multi-device token usage dashboard plugin for Magpie using a dedicated private GitHub repository relay (no decryption passphrase required).",
5
5
  "type": "module",
6
6
  "main": "./index.mjs",
@@ -129,6 +129,113 @@ export function formatLocalDateParts(timestamp, timeZone) {
129
129
  };
130
130
  }
131
131
 
132
+ /**
133
+ * Build a single cached civil-hour formatter for one chart request.
134
+ */
135
+ function createHourFormatter(timeZone) {
136
+ return new Intl.DateTimeFormat("en-CA", {
137
+ timeZone,
138
+ year: "numeric",
139
+ month: "2-digit",
140
+ day: "2-digit",
141
+ hour: "2-digit",
142
+ hourCycle: "h23",
143
+ });
144
+ }
145
+
146
+ function formatHourPartsWith(formatter, timestamp) {
147
+ const date = timestamp instanceof Date ? timestamp : new Date(timestamp);
148
+ if (Number.isNaN(date.getTime())) {
149
+ throw new AggregatorError("INVALID_TIMESTAMP", `Invalid timestamp: ${String(timestamp)}`);
150
+ }
151
+
152
+ const parts = formatter.formatToParts(date);
153
+ const pick = (type) => parts.find((p) => p.type === type)?.value;
154
+ const year = pick("year");
155
+ const month = pick("month");
156
+ const day = pick("day");
157
+ const hourValue = pick("hour");
158
+
159
+ if (!year || !month || !day || hourValue === undefined) {
160
+ throw new AggregatorError("INVALID_TIMESTAMP", `Unable to format time parts for ${date.toISOString()}`);
161
+ }
162
+
163
+ // Some ICU builds render midnight as "24" even with hourCycle h23.
164
+ return {
165
+ iso: date.toISOString(),
166
+ day: `${year}-${month}-${day}`,
167
+ month: `${year}-${month}`,
168
+ hour: Number(hourValue) % 24,
169
+ };
170
+ }
171
+
172
+ /**
173
+ * Format an ISO timestamp (or Date / epoch ms) into a civil wall-clock hour in
174
+ * the requested timezone. Hours use the 00..23 range so repeated DST hours can
175
+ * be combined into one named slot.
176
+ */
177
+ export function formatLocalHourParts(timestamp, timeZone) {
178
+ return formatHourPartsWith(createHourFormatter(timeZone), timestamp);
179
+ }
180
+
181
+ function padHour(hour) {
182
+ return String(hour).padStart(2, "0");
183
+ }
184
+
185
+ /**
186
+ * Bucket normalized local ledger rows into the fixed 24 named wall-clock hours
187
+ * of one civil day. Repeated DST hours combine; a nonexistent hour simply
188
+ * stays empty. Rows whose calculated local date disagrees with the
189
+ * authoritative feed day are deliberately left out; the caller exposes them as
190
+ * a daily-only remainder so totals still reconcile.
191
+ */
192
+ export function buildHourlyTrendPoints(rows = [], { day, timeZone, filterForwarded = true } = {}) {
193
+ if (!isValidCalendarDay(day)) {
194
+ throw new AggregatorError("INVALID_DAY", `Invalid YYYY-MM-DD date: ${day}`);
195
+ }
196
+
197
+ const formatter = createHourFormatter(timeZone);
198
+ const buckets = new Map();
199
+ for (const row of rows) {
200
+ if (!row || row.day !== day) {
201
+ continue;
202
+ }
203
+ if (filterForwarded && row.via !== "") {
204
+ continue;
205
+ }
206
+ const parts = formatHourPartsWith(formatter, row.t);
207
+ if (parts.day !== row.day) {
208
+ continue;
209
+ }
210
+ if (!buckets.has(parts.hour)) {
211
+ buckets.set(parts.hour, createEmptyBucket());
212
+ }
213
+ addMetrics(buckets.get(parts.hour), {
214
+ calls: 1,
215
+ errors: isErrorRow(row) ? 1 : 0,
216
+ input: Number(row.in) || 0,
217
+ output: Number(row.out) || 0,
218
+ cacheRead: Number(row.cacheRead) || 0,
219
+ cacheWrite: Number(row.cacheWrite) || 0,
220
+ cost: Number(row.cost) || 0,
221
+ });
222
+ }
223
+
224
+ const points = [];
225
+ for (let hour = 0; hour < 24; hour += 1) {
226
+ const metrics = buckets.get(hour) || createEmptyBucket();
227
+ points.push({
228
+ key: `${day}T${padHour(hour)}`,
229
+ day,
230
+ hour,
231
+ label: `${padHour(hour)}:00`,
232
+ ...metrics,
233
+ totalTokens: computeTotalTokens(metrics),
234
+ });
235
+ }
236
+ return points;
237
+ }
238
+
132
239
  /**
133
240
  * Normalize a raw Magpie feed row into a strictly non-sensitive ledger record.
134
241
  * Strips all unapproved fields and validates calendar date/month consistency.
@@ -361,7 +468,7 @@ export function buildDeviceManifest({
361
468
  deviceId,
362
469
  displayName,
363
470
  platform = process.platform,
364
- pluginVersion = "0.1.2",
471
+ pluginVersion = "0.3.0",
365
472
  revision = 1,
366
473
  updatedAt = new Date().toISOString(),
367
474
  snapshots = [],
@@ -500,6 +607,118 @@ function sortBreakdownEntries(map) {
500
607
  .sort((a, b) => b.totalTokens - a.totalTokens || b.cost - a.cost || a.name.localeCompare(b.name));
501
608
  }
502
609
 
610
+ function computeTrendAvailability({ verifiedDeviceCount, staleDeviceCount, unknownDeviceCount }) {
611
+ if (verifiedDeviceCount === 0) {
612
+ return "unavailable";
613
+ }
614
+ if (staleDeviceCount > 0 || unknownDeviceCount > 0) {
615
+ return "partial";
616
+ }
617
+ return "ok";
618
+ }
619
+
620
+ const TREND_METRIC_KEYS = ["calls", "errors", "input", "output", "cacheRead", "cacheWrite"];
621
+
622
+ function sumPointMetrics(points) {
623
+ const totals = createEmptyBucket();
624
+ for (const point of points) {
625
+ for (const key of TREND_METRIC_KEYS) {
626
+ totals[key] += Number(point[key]) || 0;
627
+ }
628
+ totals.cost += Number(point.cost) || 0;
629
+ }
630
+ totals.cost = roundCost(totals.cost);
631
+ return totals;
632
+ }
633
+
634
+ function hasAnyMetric(metrics) {
635
+ return TREND_METRIC_KEYS.some((key) => Boolean(metrics[key])) || Boolean(metrics.cost);
636
+ }
637
+
638
+ function subtractMetrics(source, deducted) {
639
+ const remainder = createEmptyBucket();
640
+ for (const key of TREND_METRIC_KEYS) {
641
+ remainder[key] = Math.max(0, (Number(source[key]) || 0) - (Number(deducted[key]) || 0));
642
+ }
643
+ remainder.cost = roundCost(Math.max(0, (Number(source.cost) || 0) - (Number(deducted.cost) || 0)));
644
+ return remainder;
645
+ }
646
+
647
+ function buildDayTrendPoint(day, bucket) {
648
+ return {
649
+ key: day,
650
+ day,
651
+ label: day.slice(5),
652
+ ...bucket,
653
+ totalTokens: computeTotalTokens(bucket),
654
+ };
655
+ }
656
+
657
+ function buildTrendSeries({
658
+ range,
659
+ bounds,
660
+ timeZone,
661
+ filterForwarded,
662
+ daily,
663
+ dailyMap,
664
+ hourlyRows,
665
+ hasHourlySource,
666
+ availability,
667
+ }) {
668
+ const points = [];
669
+ let dailyOnly = null;
670
+
671
+ if (range === "today") {
672
+ if (hasHourlySource && availability !== "unavailable") {
673
+ for (const point of buildHourlyTrendPoints(hourlyRows, {
674
+ day: bounds.startDay,
675
+ timeZone,
676
+ filterForwarded,
677
+ })) {
678
+ points.push(point);
679
+ }
680
+ }
681
+ const dayBucket = dailyMap[bounds.startDay];
682
+ if (dayBucket) {
683
+ const remainder = subtractMetrics(dayBucket, sumPointMetrics(points));
684
+ if (hasAnyMetric(remainder)) {
685
+ dailyOnly = {
686
+ day: bounds.startDay,
687
+ ...remainder,
688
+ totalTokens: computeTotalTokens(remainder),
689
+ };
690
+ }
691
+ }
692
+ } else if (availability !== "unavailable") {
693
+ if (range === "7d" || range === "30d") {
694
+ const slotCount = range === "7d" ? 7 : 30;
695
+ for (let offset = 0; offset < slotCount; offset += 1) {
696
+ const day = shiftCalendarDay(bounds.startDay, offset);
697
+ points.push(buildDayTrendPoint(day, dailyMap[day] || createEmptyBucket()));
698
+ }
699
+ } else {
700
+ for (const entry of daily) {
701
+ points.push({
702
+ key: entry.day,
703
+ day: entry.day,
704
+ label: entry.day.slice(5),
705
+ ...entry,
706
+ });
707
+ }
708
+ }
709
+ }
710
+
711
+ return {
712
+ bucket: range === "today" ? "hour" : "day",
713
+ timeZone: range === "today" ? (timeZone || null) : null,
714
+ startDay: bounds.startDay,
715
+ endDay: bounds.endDay,
716
+ points,
717
+ dailyOnly,
718
+ availability,
719
+ };
720
+ }
721
+
503
722
  /**
504
723
  * Aggregate local and cached remote device snapshots across a date range and
505
724
  * optional device filter.
@@ -509,6 +728,8 @@ export function aggregateDevices({
509
728
  range = "7d",
510
729
  deviceFilter = "all",
511
730
  todayDay = formatLocalDateParts(new Date()).day,
731
+ timeZone,
732
+ filterForwarded = true,
512
733
  } = {}) {
513
734
  const bounds = getDateRangeBounds(range, todayDay);
514
735
 
@@ -521,6 +742,11 @@ export function aggregateDevices({
521
742
  const agentMap = Object.create(null);
522
743
  const providerMap = Object.create(null);
523
744
  const deviceSummaries = [];
745
+ const hourlyRows = [];
746
+ let hasHourlySource = false;
747
+ let verifiedDeviceCount = 0;
748
+ let staleDeviceCount = 0;
749
+ let unknownDeviceCount = 0;
524
750
 
525
751
  for (const device of devices) {
526
752
  const deviceTotals = {
@@ -531,8 +757,26 @@ export function aggregateDevices({
531
757
  let coverageLastDay = null;
532
758
 
533
759
  const included = deviceFilter === "all" || deviceFilter === device.deviceId;
760
+ const verified = device.verified !== false;
761
+
762
+ if (included) {
763
+ if (verified) {
764
+ verifiedDeviceCount += 1;
765
+ if (device.status === "stale" || device.status === "error") {
766
+ staleDeviceCount += 1;
767
+ }
768
+ if (range === "today" && Array.isArray(device.hourRows)) {
769
+ hasHourlySource = true;
770
+ for (const row of device.hourRows) {
771
+ hourlyRows.push(row);
772
+ }
773
+ }
774
+ } else {
775
+ unknownDeviceCount += 1;
776
+ }
777
+ }
534
778
 
535
- for (const snapshot of device.months || []) {
779
+ for (const snapshot of (verified ? device.months || [] : [])) {
536
780
  const days = snapshot?.days || {};
537
781
  for (const dayKey of Object.keys(days)) {
538
782
  if (!isValidCalendarDay(dayKey)) {
@@ -625,6 +869,23 @@ export function aggregateDevices({
625
869
  totalTokens: computeTotalTokens(dailyMap[day]),
626
870
  }));
627
871
 
872
+ const availability = computeTrendAvailability({
873
+ verifiedDeviceCount,
874
+ staleDeviceCount,
875
+ unknownDeviceCount,
876
+ });
877
+ const trend = buildTrendSeries({
878
+ range,
879
+ bounds,
880
+ timeZone,
881
+ filterForwarded,
882
+ daily,
883
+ dailyMap,
884
+ hourlyRows,
885
+ hasHourlySource,
886
+ availability,
887
+ });
888
+
628
889
  return {
629
890
  range,
630
891
  deviceFilter,
@@ -636,6 +897,14 @@ export function aggregateDevices({
636
897
  },
637
898
  devices: deviceSummaries,
638
899
  daily,
900
+ trend: {
901
+ ...trend,
902
+ sources: {
903
+ verified: verifiedDeviceCount,
904
+ stale: staleDeviceCount,
905
+ unknown: unknownDeviceCount,
906
+ },
907
+ },
639
908
  topModels: sortBreakdownEntries(modelMap),
640
909
  topAgents: sortBreakdownEntries(agentMap),
641
910
  topProviders: sortBreakdownEntries(providerMap),
@@ -224,7 +224,7 @@ export function createGitHubRelayStore({
224
224
  apiBaseUrl = DEFAULT_API_BASE_URL,
225
225
  fetchImpl = globalThis.fetch,
226
226
  timeoutMs = 15000,
227
- pluginVersion = "0.1.2",
227
+ pluginVersion = "0.3.0",
228
228
  } = {}) {
229
229
  const normalizedRepo = normalizeRepo(repo);
230
230
  if (!normalizedRepo) {
@@ -19,7 +19,7 @@ import { createSyncEngine } from "./sync-engine.mjs";
19
19
 
20
20
  export const TOKEN_HEADER = "x-multi-usage-token";
21
21
  export const DEFAULT_PORT = DEFAULT_CONFIG.port;
22
- export const PLUGIN_VERSION = "0.1.2";
22
+ export const PLUGIN_VERSION = "0.3.0";
23
23
 
24
24
  const MAX_JSON_BODY_BYTES = 256 * 1024;
25
25
  const ALLOWED_RANGES = new Set(["today", "7d", "30d", "all"]);
@@ -29,6 +29,7 @@ const UI_DIR = path.join(SERVER_DIR, "ui");
29
29
  const STATIC_ASSETS = Object.freeze({
30
30
  "/app.css": { file: "app.css", contentType: "text/css; charset=utf-8", cors: false },
31
31
  "/app.js": { file: "app.js", contentType: "application/javascript; charset=utf-8", cors: true },
32
+ "/dashboard-state.mjs": { file: "dashboard-state.mjs", contentType: "application/javascript; charset=utf-8", cors: true },
32
33
  "/view-model.mjs": { file: "view-model.mjs", contentType: "application/javascript; charset=utf-8", cors: true },
33
34
  });
34
35
 
@@ -413,6 +414,25 @@ export async function startHttpServer({
413
414
  return;
414
415
  }
415
416
 
417
+ // The dashboard requests ./icons/<key>.svg (src/ui/app.js vendorIcon);
418
+ // the strict pattern rules out other extensions, traversal, and encoded paths.
419
+ const iconMatch = /^\/icons\/([a-z0-9-]+)\.svg$/.exec(pathname);
420
+ if (method === "GET" && iconMatch) {
421
+ let content;
422
+ try {
423
+ content = await fs.readFile(path.join(uiDir, "icons", `${iconMatch[1]}.svg`));
424
+ } catch {
425
+ // Same response as any other unknown static path; the strict key
426
+ // pattern already rules out traversal or non-SVG extensions.
427
+ sendResponse(res, 404, "text/plain; charset=utf-8", "Not Found");
428
+ return;
429
+ }
430
+ sendResponse(res, 200, "image/svg+xml", content, {
431
+ "Cache-Control": "public, max-age=31536000, immutable",
432
+ });
433
+ return;
434
+ }
435
+
416
436
  sendResponse(res, 404, "text/plain; charset=utf-8", "Not Found");
417
437
  } catch (error) {
418
438
  sendJson(res, 500, { error: error?.message || "Internal server error" });
@@ -160,7 +160,7 @@ export function createSyncEngine({
160
160
  fetchImpl = globalThis.fetch,
161
161
  apiBaseUrl,
162
162
  gatewayBaseUrl,
163
- pluginVersion = "0.1.2",
163
+ pluginVersion = "0.3.0",
164
164
  timeZone,
165
165
  now = () => Date.now(),
166
166
  storeFactory = createGitHubRelayStore,
@@ -188,13 +188,18 @@ export function createSyncEngine({
188
188
  });
189
189
  }
190
190
 
191
- async function buildLocalSnapshots({ config, identity, revision }) {
191
+ async function buildLocalSnapshots({ config, identity, revision, todayDay }) {
192
192
  const months = await listLocalMonths(resolvedDataDir);
193
193
  const snapshots = [];
194
194
  const monthHashes = {};
195
+ const hourMonth = typeof todayDay === "string" && todayDay.length >= 7 ? todayDay.slice(0, 7) : null;
196
+ let hourRows = null;
195
197
 
196
198
  for (const month of months) {
197
199
  const rows = await loadLocalMonthRows(resolvedDataDir, month);
200
+ if (hourMonth && month === hourMonth) {
201
+ hourRows = rows;
202
+ }
198
203
  const { snapshot, sha256 } = buildMonthlySnapshot({
199
204
  deviceId: identity.deviceId,
200
205
  month,
@@ -219,7 +224,7 @@ export function createSyncEngine({
219
224
  snapshots,
220
225
  });
221
226
 
222
- return { snapshots, monthHashes, manifest };
227
+ return { snapshots, monthHashes, manifest, hourRows };
223
228
  }
224
229
 
225
230
  async function runIngestLocal() {
@@ -755,14 +760,21 @@ export function createSyncEngine({
755
760
  const committed = await readCommittedDeviceGeneration(deviceDir);
756
761
 
757
762
  if (committed.status !== "ok") {
763
+ const hadPreviousData = Boolean(
764
+ meta.lastSyncedAt
765
+ || meta.status === "ok"
766
+ || meta.status === "stale"
767
+ || (meta.monthHashes && Object.keys(meta.monthHashes).length > 0),
768
+ );
758
769
  remoteDevices.push({
759
770
  deviceId,
760
771
  displayName: typeof meta.displayName === "string" && meta.displayName ? meta.displayName : deviceId,
761
772
  isLocal: false,
762
- status: meta.status || (committed.status === "corrupt" ? "error" : "empty"),
773
+ status: committed.status === "corrupt" || hadPreviousData ? "error" : (meta.status || "empty"),
763
774
  lastSyncedAt: meta.lastSyncedAt || null,
764
775
  lastError: meta.lastError || (committed.status === "corrupt" ? committed.error : null),
765
776
  months: [],
777
+ verified: false,
766
778
  });
767
779
  continue;
768
780
  }
@@ -778,6 +790,7 @@ export function createSyncEngine({
778
790
  lastSyncedAt: meta.lastSyncedAt || manifest.updatedAt || null,
779
791
  lastError: meta.lastError || null,
780
792
  months: committed.snapshots,
793
+ verified: true,
781
794
  });
782
795
  }
783
796
 
@@ -866,10 +879,13 @@ export function createSyncEngine({
866
879
  ? state.pushedTargets[activeTargetKey].revision
867
880
  : 0;
868
881
 
882
+ const reportingTimeZone = timeZone || Intl.DateTimeFormat().resolvedOptions().timeZone || null;
883
+ const effectiveToday = todayDay || formatLocalDateParts(new Date(now()), reportingTimeZone).day;
869
884
  const localBuilt = await buildLocalSnapshots({
870
885
  config,
871
886
  identity,
872
887
  revision: pushRev,
888
+ todayDay: effectiveToday,
873
889
  });
874
890
 
875
891
  const localDevice = {
@@ -882,20 +898,25 @@ export function createSyncEngine({
882
898
  lastSyncedAt: localSyncStatus.lastSyncedAt || state.lastLocalSyncAt || null,
883
899
  lastError: localSyncStatus.lastError,
884
900
  months: localBuilt.snapshots,
901
+ hourRows: localBuilt.hourRows || [],
902
+ verified: localSyncStatus.status !== "error",
885
903
  };
886
904
 
887
905
  const remoteDevices = await loadCachedRemoteDevices(identity.deviceId, config, state);
888
906
 
889
- const effectiveToday = todayDay || formatLocalDateParts(new Date(now()), timeZone).day;
890
907
  const aggregated = aggregateDevices({
891
908
  devices: [localDevice, ...remoteDevices],
892
909
  range,
893
910
  deviceFilter,
894
911
  todayDay: effectiveToday,
912
+ timeZone: reportingTimeZone,
913
+ filterForwarded: config.filterForwarded,
895
914
  });
896
915
 
897
916
  return {
898
917
  ...aggregated,
918
+ todayDay: effectiveToday,
919
+ reportingTimeZone,
899
920
  sync: {
900
921
  pushEnabled: config.pushEnabled,
901
922
  repoConfigured: Boolean(config.repo),
package/src/ui/app.css CHANGED
@@ -446,6 +446,12 @@ select:focus-visible {
446
446
  background: var(--pill);
447
447
  }
448
448
 
449
+ .chart .bar:focus-visible {
450
+ background: var(--pill);
451
+ outline: 2px solid var(--accent);
452
+ outline-offset: 2px;
453
+ }
454
+
449
455
  .chart .bar i {
450
456
  display: block;
451
457
  background: var(--accent);
@@ -464,18 +470,42 @@ select:focus-visible {
464
470
  font-variant-numeric: tabular-nums;
465
471
  }
466
472
 
467
- .chart .labels span {
473
+ .chart .labels > span {
468
474
  flex: 1 1 0;
469
475
  min-width: 0;
470
476
  text-align: center;
471
477
  white-space: nowrap;
472
478
  }
473
479
 
474
- .chart .labels span:last-child {
480
+ .chart .labels > span:last-child {
475
481
  display: flex;
476
482
  justify-content: flex-end;
477
483
  }
478
484
 
485
+ .chart .labels .axis-compact {
486
+ display: none;
487
+ }
488
+
489
+ @media (max-width: 560px) {
490
+ .chart .labels .axis-full {
491
+ display: none;
492
+ }
493
+
494
+ .chart .labels .axis-compact {
495
+ display: inline;
496
+ }
497
+ }
498
+
499
+ .chart .trend-note {
500
+ margin-top: 5px;
501
+ font-size: 10.5px;
502
+ color: var(--muted);
503
+ font-variant-numeric: tabular-nums;
504
+ overflow: hidden;
505
+ text-overflow: ellipsis;
506
+ white-space: nowrap;
507
+ }
508
+
479
509
  /* Section header & Finder-style .list cards */
480
510
  .sec-head {
481
511
  display: flex;
@@ -551,6 +581,13 @@ select:focus-visible {
551
581
  margin-top: 3px;
552
582
  }
553
583
 
584
+ .vendor-logo {
585
+ width: 16px;
586
+ height: 16px;
587
+ border-radius: 3px;
588
+ display: block;
589
+ }
590
+
554
591
  .row.stat .who {
555
592
  flex: 0 0 285px;
556
593
  min-width: 0;
@@ -662,6 +699,18 @@ select:focus-visible {
662
699
  font-size: 12.5px;
663
700
  }
664
701
 
702
+ .sr-only {
703
+ position: absolute;
704
+ width: 1px;
705
+ height: 1px;
706
+ padding: 0;
707
+ margin: -1px;
708
+ overflow: hidden;
709
+ clip: rect(0, 0, 0, 0);
710
+ white-space: nowrap;
711
+ border: 0;
712
+ }
713
+
665
714
  /* Subtle relay status footer */
666
715
  .sync-footer {
667
716
  margin-top: 14px;
@@ -829,7 +878,7 @@ select:focus-visible {
829
878
  transition: background-color .12s;
830
879
  }
831
880
 
832
- .pill-btn:hover {
881
+ .pill-btn:hover:not(:disabled) {
833
882
  background: var(--pill-hover);
834
883
  }
835
884
 
@@ -838,7 +887,8 @@ select:focus-visible {
838
887
  color: var(--accent-fg);
839
888
  }
840
889
 
841
- .pill-btn-primary:hover {
890
+ .pill-btn-primary:hover:not(:disabled) {
891
+ background: var(--accent);
842
892
  filter: brightness(1.06);
843
893
  }
844
894