pi-cost 0.1.0 → 0.2.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 (72) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +13 -1
  3. package/extensions/cost.ts +53 -83
  4. package/lib/app.js +113 -0
  5. package/lib/args.js +17 -0
  6. package/lib/cli.js +593 -0
  7. package/lib/cost-dir.js +62 -0
  8. package/lib/costs.js +799 -0
  9. package/lib/net-guard.js +178 -0
  10. package/lib/pi-parsers-cost.js +234 -66
  11. package/lib/pi-pricing.js +35 -8
  12. package/lib/themes.js +90 -0
  13. package/package.json +16 -7
  14. package/public/app.js +2232 -448
  15. package/public/fonts/OFL-IBM-Plex.txt +93 -0
  16. package/public/fonts/OFL-Playfair-Display.txt +93 -0
  17. package/public/fonts/fonts.css +244 -0
  18. package/public/fonts/ibm-plex-mono-cyrillic-400.woff2 +0 -0
  19. package/public/fonts/ibm-plex-mono-cyrillic-500.woff2 +0 -0
  20. package/public/fonts/ibm-plex-mono-cyrillic-600.woff2 +0 -0
  21. package/public/fonts/ibm-plex-mono-cyrillic-ext-400.woff2 +0 -0
  22. package/public/fonts/ibm-plex-mono-cyrillic-ext-500.woff2 +0 -0
  23. package/public/fonts/ibm-plex-mono-cyrillic-ext-600.woff2 +0 -0
  24. package/public/fonts/ibm-plex-mono-latin-400.woff2 +0 -0
  25. package/public/fonts/ibm-plex-mono-latin-500.woff2 +0 -0
  26. package/public/fonts/ibm-plex-mono-latin-600.woff2 +0 -0
  27. package/public/fonts/ibm-plex-mono-latin-ext-400.woff2 +0 -0
  28. package/public/fonts/ibm-plex-mono-latin-ext-500.woff2 +0 -0
  29. package/public/fonts/ibm-plex-mono-latin-ext-600.woff2 +0 -0
  30. package/public/fonts/ibm-plex-mono-vietnamese-400.woff2 +0 -0
  31. package/public/fonts/ibm-plex-mono-vietnamese-500.woff2 +0 -0
  32. package/public/fonts/ibm-plex-mono-vietnamese-600.woff2 +0 -0
  33. package/public/fonts/playfair-display-cyrillic-400.woff2 +0 -0
  34. package/public/fonts/playfair-display-latin-400.woff2 +0 -0
  35. package/public/fonts/playfair-display-latin-ext-400.woff2 +0 -0
  36. package/public/fonts/playfair-display-vietnamese-400.woff2 +0 -0
  37. package/public/index.html +68 -46
  38. package/public/style.css +319 -8
  39. package/public/sw.js +2 -2
  40. package/server.js +58 -659
  41. package/themes/ayu-dark.json +21 -0
  42. package/themes/ayu-light.json +21 -0
  43. package/themes/catppuccin-dark.json +21 -0
  44. package/themes/catppuccin-light.json +21 -0
  45. package/themes/dracula-dark.json +21 -0
  46. package/themes/dracula-light.json +21 -0
  47. package/themes/everforest-dark.json +21 -0
  48. package/themes/everforest-light.json +21 -0
  49. package/themes/github-dark.json +21 -0
  50. package/themes/github-light.json +21 -0
  51. package/themes/gruvbox-dark.json +21 -0
  52. package/themes/gruvbox-light.json +21 -0
  53. package/themes/kanagawa-dark.json +21 -0
  54. package/themes/kanagawa-light.json +21 -0
  55. package/themes/monokai-dark.json +21 -0
  56. package/themes/monokai-light.json +21 -0
  57. package/themes/night-owl-dark.json +21 -0
  58. package/themes/night-owl-light.json +21 -0
  59. package/themes/nord-dark.json +21 -0
  60. package/themes/nord-light.json +21 -0
  61. package/themes/one-dark-dark.json +21 -0
  62. package/themes/one-dark-light.json +21 -0
  63. package/themes/rose-pine-dark.json +21 -0
  64. package/themes/rose-pine-light.json +21 -0
  65. package/themes/solarized-dark.json +21 -0
  66. package/themes/solarized-light.json +21 -0
  67. package/themes/synthwave-dark.json +21 -0
  68. package/themes/synthwave-light.json +21 -0
  69. package/themes/tokyo-night-dark.json +21 -0
  70. package/themes/tokyo-night-light.json +21 -0
  71. package/themes/vitesse-dark.json +21 -0
  72. package/themes/vitesse-light.json +21 -0
package/public/style.css CHANGED
@@ -31,6 +31,9 @@
31
31
  --chart-2: #4a9eda;
32
32
  --chart-3: #3ecf8e;
33
33
  --chart-4: #f0b429;
34
+ --chart-5: #b784f5;
35
+ --chart-6: #fb7185;
36
+ --compact: var(--chart-5);
34
37
  }
35
38
  /* #endregion */
36
39
 
@@ -92,13 +95,6 @@ a { color: var(--accent-text); }
92
95
  }
93
96
  .topbar-nav-btn:hover { color: var(--text-secondary); }
94
97
  .topbar-nav-btn.active { background: var(--accent-dim); color: var(--accent-text); }
95
- .topbar-select {
96
- background: var(--bg-elevated); border: 1px solid var(--border);
97
- border-radius: 6px; color: var(--text-secondary);
98
- font-family: var(--mono); font-size: 11px; padding: 4px 8px;
99
- outline: none; cursor: pointer;
100
- }
101
- .topbar-select:focus { border-color: var(--accent); }
102
98
  .topbar-btn {
103
99
  display: flex; align-items: center; gap: 5px;
104
100
  padding: 6px 10px; border-radius: 6px;
@@ -108,12 +104,128 @@ a { color: var(--accent-text); }
108
104
  transition: all 0.15s ease;
109
105
  white-space: nowrap; text-transform: uppercase; letter-spacing: 0.03em;
110
106
  }
107
+ .topbar-btn[hidden] { display: none; }
108
+ body.embed #themeBtn, body.embed #themePickerBtn, body.embed #installBtn { display: none; }
109
+ .theme-picker { position: relative; }
110
+ .theme-menu {
111
+ display: none; position: absolute; top: calc(100% + 6px); right: 0; z-index: 100;
112
+ min-width: 190px; max-height: 70vh; overflow-y: auto; padding: 4px;
113
+ background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 8px;
114
+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
115
+ }
116
+ .theme-menu.open { display: block; }
117
+ .theme-menu-item {
118
+ display: flex; align-items: center; gap: 8px; width: 100%;
119
+ padding: 6px 8px; border: 0; border-radius: 6px; background: none;
120
+ color: var(--text-secondary); font-family: inherit; font-size: 11px;
121
+ text-transform: uppercase; letter-spacing: 0.03em; text-align: left; cursor: pointer;
122
+ }
123
+ .theme-menu-item:hover { background: var(--bg-hover); color: var(--text-primary); }
124
+ /* The selected row uses its own theme's accent, so it previews the theme it names. */
125
+ .theme-menu-item.on {
126
+ color: var(--sw-accent, var(--accent-text));
127
+ background: color-mix(in srgb, var(--sw-accent, var(--accent-text)) 16%, transparent);
128
+ }
129
+ .theme-swatch { display: inline-flex; align-items: center; gap: 3px; flex: 0 0 auto; }
130
+ .theme-swatch i { width: 9px; height: 9px; border-radius: 50%; border: 1px solid var(--sw-border, var(--border)); }
131
+ .theme-swatch .sw-bg { background: var(--sw-bg); }
132
+ .theme-swatch .sw-accent { background: var(--sw-accent); }
133
+ .theme-swatch .sw-ink { background: var(--sw-ink); }
111
134
  .topbar-btn:hover { border-color: var(--accent); color: var(--text-secondary); }
112
135
  .topbar-btn svg { color: var(--text-muted); }
113
136
  .topbar-btn.loading svg { animation: spin 1s linear infinite; }
114
137
  @keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
115
138
  /* #endregion */
116
139
 
140
+ /* #region DATE_PICKER */
141
+ .range-picker { position: relative; display: inline-flex; }
142
+ .range-trigger .range-label { min-width: 84px; text-align: left; }
143
+ .range-trigger .chev { transition: transform 0.15s ease; }
144
+ .range-trigger.on { border-color: var(--accent); background: var(--accent-dim); color: var(--accent-text); }
145
+ .range-trigger.on svg { color: var(--accent-text); }
146
+ .range-trigger.on .chev { transform: rotate(180deg); }
147
+ .range-pop {
148
+ display: none; position: absolute; top: calc(100% + 6px); right: 0; z-index: 100;
149
+ max-width: calc(100vw - 24px);
150
+ background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 8px;
151
+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35); overflow: hidden;
152
+ }
153
+ .range-pop.open { display: flex; }
154
+ .range-presets {
155
+ display: flex; flex-direction: column; gap: 2px; padding: 8px;
156
+ border-right: 1px solid var(--border); background: var(--bg-surface); min-width: 116px;
157
+ }
158
+ .range-head-label {
159
+ display: block; font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase;
160
+ color: var(--text-muted); padding: 2px 6px 6px;
161
+ }
162
+ .range-preset {
163
+ border: 0; background: none; color: var(--text-secondary);
164
+ font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em;
165
+ text-align: left; padding: 5px 8px; border-radius: 5px; cursor: pointer;
166
+ }
167
+ .range-preset:hover { background: var(--bg-hover); color: var(--text-primary); }
168
+ .range-preset.on { background: var(--accent-dim); color: var(--accent-text); }
169
+ .range-cal-side { padding: 8px 10px 10px; }
170
+ .range-fields { display: flex; align-items: flex-end; gap: 8px; padding: 0 2px 8px; }
171
+ .range-field { flex: 1; }
172
+ .range-field .range-head-label { padding: 0 0 3px; }
173
+ .range-field-box {
174
+ border: 1px solid var(--border); border-radius: 5px; background: var(--bg-surface);
175
+ color: var(--text-secondary); font-family: var(--mono); font-size: 11px; letter-spacing: 0.03em;
176
+ padding: 5px 8px; width: 100%; text-align: left; cursor: pointer;
177
+ }
178
+ .range-field-box.active { border-color: var(--accent); color: var(--accent-text); }
179
+ .range-field-box.empty { color: var(--text-muted); }
180
+ .range-field-dash { color: var(--text-muted); padding-bottom: 6px; }
181
+ .range-months { display: flex; gap: 14px; }
182
+ .range-cal { width: 196px; }
183
+ .range-cal-head { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 6px; }
184
+ .range-cal-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-secondary); }
185
+ .range-nav {
186
+ border: 1px solid var(--border); background: var(--bg-surface); color: var(--text-tertiary);
187
+ border-radius: 4px; width: 20px; height: 20px;
188
+ display: flex; align-items: center; justify-content: center; cursor: pointer;
189
+ }
190
+ .range-nav:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-text); }
191
+ .range-nav:disabled { opacity: 0.3; cursor: default; }
192
+ .range-nav svg { width: 9px; height: 9px; }
193
+ .range-nav-gap { width: 20px; }
194
+ .range-dow, .range-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
195
+ .range-dow span { font-size: 9px; text-align: center; color: var(--text-muted); letter-spacing: 0.06em; padding-bottom: 3px; }
196
+ .range-day {
197
+ height: 24px; border: 0; background: none;
198
+ font-family: var(--mono); font-size: 11px; color: var(--text-secondary);
199
+ cursor: pointer; position: relative;
200
+ }
201
+ .range-day.pad { visibility: hidden; }
202
+ .range-day.off { color: var(--text-muted); opacity: 0.4; cursor: default; }
203
+ .range-day.today::after {
204
+ content: ''; position: absolute; left: 50%; bottom: 3px;
205
+ width: 3px; height: 3px; margin-left: -1.5px; border-radius: 50%; background: var(--accent);
206
+ }
207
+ .range-day:hover:not(.off) { color: var(--text-primary); }
208
+ .range-day.in { background: var(--accent-dim); color: var(--accent-text); }
209
+ .range-day.edge { background: var(--accent); color: #fff; border-radius: 4px; font-weight: 500; }
210
+ .range-day.edge.today::after { background: #fff; }
211
+ .range-day.in.start { border-radius: 4px 0 0 4px; }
212
+ .range-day.in.end { border-radius: 0 4px 4px 0; }
213
+ .range-foot {
214
+ display: flex; align-items: center; gap: 8px;
215
+ padding-top: 9px; margin-top: 8px; border-top: 1px solid var(--border);
216
+ }
217
+ .range-summary { flex: 1; font-size: 10px; color: var(--text-muted); letter-spacing: 0.04em; text-transform: uppercase; }
218
+ .range-btn {
219
+ font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em;
220
+ padding: 5px 12px; border-radius: 5px; cursor: pointer;
221
+ border: 1px solid var(--border); background: var(--bg-surface); color: var(--text-tertiary);
222
+ }
223
+ .range-btn:hover { border-color: var(--accent); color: var(--text-secondary); }
224
+ .range-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
225
+ .range-btn.primary:hover { filter: brightness(1.08); color: #fff; }
226
+ .range-btn.primary:disabled { opacity: 0.4; cursor: default; filter: none; }
227
+ /* #endregion */
228
+
117
229
  /* #region LAYOUT */
118
230
  .dashboard { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 20px 24px; }
119
231
  .dashboard-content { max-width: 1400px; margin: 0 auto; }
@@ -143,6 +255,15 @@ a { color: var(--accent-text); }
143
255
  }
144
256
  .stat-card .card-value.cost { color: var(--accent-text); }
145
257
  .stat-card .card-sub { font-size: 10px; color: var(--text-muted); margin-top: 4px; }
258
+ .stat-card .card-sub strong { color: var(--text-primary); font-weight: 600; }
259
+ .meter { display: flex; align-items: center; gap: 6px; }
260
+ .stat-card .meter { margin-top: 8px; }
261
+ .meter-track {
262
+ flex: 1; min-width: 0; height: 3px;
263
+ background: var(--meter-dim, var(--accent-dim)); border-radius: 2px; overflow: hidden;
264
+ }
265
+ .meter-track > i { display: block; height: 100%; background: var(--meter, var(--accent)); border-radius: 2px; }
266
+ .meter-value { flex: none; font-family: var(--mono); font-size: 10px; font-weight: 600; color: var(--meter, var(--text-primary)); }
146
267
  /* #endregion */
147
268
 
148
269
  /* #region CHARTS */
@@ -160,6 +281,114 @@ a { color: var(--accent-text); }
160
281
  color: var(--text-muted); margin-bottom: 12px;
161
282
  }
162
283
  .chart-box canvas { max-width: 100%; max-height: 180px; }
284
+ .chart-title-note { color: var(--text-muted); font-weight: 400; float: right; text-transform: none; }
285
+ .charts-row.with-share { grid-template-columns: 3fr 2fr 2fr; }
286
+ .charts-row.with-aside { grid-template-columns: 3fr 2fr auto; }
287
+ .charts-row.single { grid-template-columns: 1fr; }
288
+ .share-body { display: flex; justify-content: center; align-items: center; gap: 16px; height: 150px; }
289
+ .share-pie { position: relative; flex: 0 0 150px; height: 100%; }
290
+ .share-legend {
291
+ display: grid; grid-template-columns: 10px minmax(0, max-content) auto auto;
292
+ align-content: start; justify-content: start; column-gap: 8px;
293
+ min-width: 0; max-height: 100%; margin: 0; padding: 0 8px 0 0; list-style: none;
294
+ overflow-x: hidden; overflow-y: auto;
295
+ font-family: var(--mono); font-size: 10px; color: var(--text-secondary);
296
+ }
297
+ .share-legend li {
298
+ display: grid; grid-column: 1 / -1; grid-template-columns: subgrid;
299
+ align-items: center; padding: 2px 0; border-radius: 3px;
300
+ }
301
+ .share-legend li.share-agent { cursor: pointer; }
302
+ .share-legend li.share-agent:hover { background: var(--bg-hover); }
303
+ .share-swatch { width: 10px; height: 10px; border: 1px solid; border-radius: 2px; }
304
+ .share-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
305
+ .share-cost { color: var(--text-primary); }
306
+ .share-pct { text-align: right; color: var(--text-muted); }
307
+ /* #endregion */
308
+
309
+ /* #region RANGE_BRUSH */
310
+ .range-brush {
311
+ background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 8px;
312
+ padding: 10px 16px 12px; margin: -8px 0 20px;
313
+ }
314
+ .rb-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
315
+ .rb-label {
316
+ font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em;
317
+ white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
318
+ }
319
+ .rb-burst-count { margin-left: 10px; color: var(--warning); }
320
+ .rb-burst-count i {
321
+ display: inline-block; width: 6px; height: 6px; border-radius: 50%;
322
+ background: var(--warning); margin-right: 5px; vertical-align: middle;
323
+ }
324
+ .rb-burst-count .compact { color: var(--compact); }
325
+ .rb-burst-count .compact i,
326
+ .rb-burst.compact::after { border-radius: 1px; transform: rotate(45deg); background: var(--compact); }
327
+ .rb-burst-count .rb-sep { margin: 0 6px; color: var(--text-muted); }
328
+ .rb-presets { display: flex; gap: 4px; }
329
+ .rb-preset {
330
+ font: inherit; font-size: 10px; letter-spacing: 0.03em; color: var(--text-tertiary);
331
+ background: transparent; border: 1px solid var(--border); border-radius: 4px;
332
+ padding: 2px 8px; cursor: pointer;
333
+ }
334
+ .rb-preset:hover { color: var(--text-primary); border-color: var(--text-muted); }
335
+ .rb-preset.on { color: var(--accent-text); border-color: var(--accent); background: var(--accent-dim); }
336
+ .rb-track {
337
+ position: relative; height: 44px; border-radius: 4px;
338
+ background: var(--bg-deep); border: 1px solid var(--border);
339
+ overflow: hidden; cursor: crosshair; user-select: none; touch-action: none; outline: none;
340
+ }
341
+ .rb-track:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-dim); }
342
+ .rb-overview { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
343
+ .rb-overview polygon { fill: var(--chart-fill); }
344
+ .rb-overview polyline { fill: none; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
345
+ .rb-bursts { position: absolute; inset: 0; pointer-events: none; }
346
+ .rb-burst {
347
+ position: absolute; top: 0; bottom: 0; width: 7px; margin-left: -3.5px;
348
+ padding: 0; border: 0; background: transparent; cursor: pointer; pointer-events: auto;
349
+ }
350
+ .rb-burst::before {
351
+ content: ''; position: absolute; top: 0; bottom: 0; left: 3px; width: 1px;
352
+ background: var(--warning); opacity: 0.55;
353
+ }
354
+ .rb-burst::after {
355
+ content: ''; position: absolute; top: 3px; left: 1px; width: 5px; height: 5px;
356
+ border-radius: 50%; background: var(--warning);
357
+ }
358
+ .rb-burst.in::before,
359
+ .rb-burst:hover::before { opacity: 1; width: 2px; left: 2.5px; }
360
+ .rb-burst.compact::before { background: var(--compact); }
361
+ .rb-burst.agent::before,
362
+ .rb-burst.agent::after { background: var(--text-tertiary); }
363
+ .rb-burst.agent::after { top: auto; bottom: 3px; border-radius: 1px; }
364
+ .rb-burst.costly::before,
365
+ .rb-burst.costly::after { background: var(--error); }
366
+ .rb-burst-count .agent { color: var(--text-tertiary); }
367
+ .rb-burst-count .agent i { border-radius: 1px; background: var(--text-tertiary); }
368
+ .rb-burst-count .costly { color: var(--error); }
369
+ .rb-burst-count .costly i { background: var(--error); }
370
+ /* The shade outside the window is the window's own shadow, clipped by the track. */
371
+ .rb-window {
372
+ position: absolute; top: 0; bottom: 0;
373
+ border: 1px solid var(--accent); border-radius: 3px; background: var(--accent-dim);
374
+ box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45);
375
+ cursor: grab; box-sizing: border-box; min-width: 8px;
376
+ }
377
+ body.light .rb-window { box-shadow: 0 0 0 9999px rgba(255, 255, 255, 0.55); }
378
+ @media (prefers-color-scheme: light) {
379
+ body:not(.dark-forced) .rb-window { box-shadow: 0 0 0 9999px rgba(255, 255, 255, 0.55); }
380
+ }
381
+ .rb-track.dragging,
382
+ .rb-track.dragging .rb-window { cursor: grabbing; }
383
+ .rb-handle { position: absolute; top: 0; bottom: 0; width: 10px; cursor: ew-resize; }
384
+ .rb-handle::after {
385
+ content: ''; position: absolute; top: 50%; width: 3px; height: 14px; margin-top: -7px;
386
+ border-radius: 2px; background: var(--accent);
387
+ }
388
+ .rb-handle-left { left: -5px; }
389
+ .rb-handle-left::after { left: 3px; }
390
+ .rb-handle-right { right: -5px; }
391
+ .rb-handle-right::after { right: 3px; }
163
392
  /* #endregion */
164
393
 
165
394
  /* #region TABLE */
@@ -237,6 +466,23 @@ a { color: var(--accent-text); }
237
466
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em;
238
467
  margin-right: 4px;
239
468
  }
469
+ .subagent-desc { font-size: 11px; color: var(--text-secondary); margin-left: 4px; }
470
+ .subagent-row.clickable:hover .subagent-desc { color: var(--accent-text); text-decoration: underline; }
471
+ .tool-tag,
472
+ .compaction-tag {
473
+ display: inline-block; font-size: 9px; letter-spacing: 0.03em;
474
+ padding: 1px 5px; border-radius: 3px; margin-left: 4px; vertical-align: middle;
475
+ }
476
+ .tool-tag {
477
+ text-transform: lowercase; color: var(--chart-2);
478
+ background: color-mix(in srgb, var(--chart-2) 12%, transparent);
479
+ }
480
+ .compaction-tag {
481
+ text-transform: uppercase; color: var(--compact); white-space: nowrap;
482
+ background: color-mix(in srgb, var(--compact) 14%, transparent);
483
+ }
484
+ .compaction-row td { background: color-mix(in srgb, var(--compact) 6%, transparent); color: var(--text-muted); }
485
+ .compaction-row td:first-child { border-left: 2px solid var(--compact); }
240
486
  /* #endregion */
241
487
 
242
488
  /* #region BREADCRUMB */
@@ -247,6 +493,7 @@ a { color: var(--accent-text); }
247
493
  .breadcrumb a { color: var(--accent-text); text-decoration: none; cursor: pointer; }
248
494
  .breadcrumb a:hover { text-decoration: underline; }
249
495
  .breadcrumb .sep { color: var(--text-muted); }
496
+ .breadcrumb .truncate { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
250
497
  .breadcrumb .current { color: var(--text-secondary); }
251
498
  /* #endregion */
252
499
 
@@ -259,6 +506,12 @@ a { color: var(--accent-text); }
259
506
  }
260
507
  .detail-stat .detail-value { font-size: 16px; font-weight: 500; color: var(--text-secondary); }
261
508
  .detail-stat .detail-value.cost { color: var(--accent-text); }
509
+ .detail-stat .detail-scope { margin-left: 5px; font-weight: 400; }
510
+ .detail-header:has(+ .detail-range-note) { margin-bottom: 8px; }
511
+ .detail-range-note { margin: 0 0 18px; font-size: 10px; color: var(--text-muted); }
512
+ .detail-range-note + .detail-range-note { margin-top: -12px; }
513
+ .detail-range-note .scope-label { text-transform: uppercase; letter-spacing: 0.03em; }
514
+ .detail-range-note strong { color: var(--text-secondary); font-weight: 500; }
262
515
 
263
516
  .messages-table { width: 100%; border-collapse: collapse; font-size: 11px; }
264
517
  .messages-table th {
@@ -293,6 +546,59 @@ a { color: var(--accent-text); }
293
546
  color: var(--text-muted); font-size: 12px; text-align: center;
294
547
  }
295
548
  .empty-state .empty-icon { font-size: 32px; opacity: 0.5; margin-bottom: 8px; }
549
+ .skeleton-fade { animation: boot-fade 0.3s ease-out 0.15s both; }
550
+ .skeleton .breadcrumb .skel { width: 220px; }
551
+ .skel {
552
+ display: block; height: 9px; width: 60%; border-radius: 4px;
553
+ background: var(--border); animation: skel-breathe 1.4s ease-in-out infinite;
554
+ }
555
+ .skeleton .card-label.skel { width: 40%; }
556
+ .skeleton .card-value.skel { height: 22px; width: 55%; }
557
+ .skeleton .card-sub.skel { width: 70%; margin-top: 14px; }
558
+ .skeleton .chart-title.skel { width: 30%; }
559
+ .skel-plot { position: relative; display: flex; align-items: flex-end; gap: 6px; height: 150px; }
560
+ .skel-plot > .skel { flex: 1; height: var(--h); width: auto; border-radius: 3px 3px 0 0; }
561
+ .skel-donut {
562
+ width: 130px; height: 130px; margin: 10px auto; border-radius: 50%;
563
+ border: 18px solid var(--border); animation: skel-breathe 1.4s ease-in-out infinite;
564
+ }
565
+ .skel-table { display: flex; flex-direction: column; }
566
+ .skel-table > div { display: flex; gap: 24px; padding: 16px 12px; border-bottom: 1px solid var(--border); }
567
+ .skel-table .skel { width: 12%; }
568
+ .skel-table .skel:first-child { width: 40%; }
569
+ @keyframes skel-breathe { 50% { opacity: 0.55; } }
570
+ @keyframes boot-fade { from { opacity: 0; } }
571
+ @media (prefers-reduced-motion: reduce) {
572
+ .skel, .skel-donut { animation: none; }
573
+ }
574
+ /* #endregion */
575
+
576
+ /* #region INSIGHTS */
577
+ .heatmap { display: flex; flex-direction: column; gap: 3px; }
578
+ .hm-row { display: grid; grid-template-columns: 48px repeat(24, 1fr); gap: 3px; align-items: center; }
579
+ .hm-row.hm-today .hm-day { color: var(--accent); font-weight: 700; }
580
+ .hm-row.hm-today .hm-cell { outline: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
581
+ .hm-day, .hm-hour { font-size: 9px; color: var(--text-muted); font-family: var(--mono); }
582
+ .hm-hour { text-align: center; }
583
+ .hm-cell {
584
+ position: relative; aspect-ratio: 2.4; min-height: 10px; border-radius: 2px;
585
+ background: var(--bg-hover); overflow: hidden;
586
+ }
587
+ .hm-cell i { position: absolute; inset: 0; background: var(--accent); border-radius: 2px; }
588
+ .hm-cell:hover { outline: 1px solid var(--accent); outline-offset: 1px; }
589
+ .hm-tip {
590
+ position: fixed; z-index: 100; display: none; flex-direction: column; gap: 1px;
591
+ padding: 5px 8px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 4px;
592
+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35); font-family: var(--mono); pointer-events: none;
593
+ }
594
+ .hm-tip.on { display: flex; }
595
+ .hm-tip b { font-size: 13px; color: var(--text-primary); }
596
+ .hm-tip span { font-size: 10px; color: var(--text-muted); }
597
+ .block-badge {
598
+ display: inline-block; font-size: 10px; font-family: var(--mono); color: var(--text-tertiary);
599
+ background: var(--bg-hover); border-radius: 3px; padding: 2px 6px; white-space: nowrap;
600
+ }
601
+ .block-badge.active { color: var(--success); background: var(--success-dim); }
296
602
  /* #endregion */
297
603
 
298
604
  /* #region MODAL */
@@ -406,10 +712,15 @@ body.light {
406
712
 
407
713
  /* #region RESPONSIVE */
408
714
  @media (max-width: 900px) {
409
- .charts-row { grid-template-columns: 1fr; }
715
+ .charts-row, .charts-row.with-share, .charts-row.with-aside { grid-template-columns: 1fr; }
410
716
  .cards-row { grid-template-columns: repeat(2, 1fr); }
411
717
  .shortcut-grid { grid-template-columns: 1fr; }
412
718
  }
719
+ /* renderRangePicker() watches the same breakpoint and draws a single month. */
720
+ @media (max-width: 760px) {
721
+ .range-presets { min-width: 100px; }
722
+ .range-cal { width: 182px; }
723
+ }
413
724
  @media (max-width: 600px) {
414
725
  .topbar { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
415
726
  .topbar-nav { order: 10; width: 100%; }
package/public/sw.js CHANGED
@@ -1,5 +1,5 @@
1
- const CACHE_NAME = 'pi-cost-v3';
2
- const PRECACHE_URLS = ['/', '/style.css', '/app.js'];
1
+ const CACHE_NAME = 'pi-cost-v4';
2
+ const PRECACHE_URLS = ['/', '/style.css', '/app.js', '/fonts/fonts.css', '/vendor/chart.umd.min.js'];
3
3
 
4
4
  let cachePromise = null;
5
5
  function getCache() {