# App Avalonia 12 Fluent host (D8). Views are built in C# without reflection bindings. View-model properties use CommunityToolkit.Mvvm source generators. Custom charts use DrawingContext. Program owns StoreLock for the engine lifetime. DesktopApp marshals Core events to the UI; Program passes its executable path to RefreshEngine for desktop activation through D9 snapshots. history queries run on worker threads and discard superseded results. Keep all writes atomic (D5). Panel rendering and child views take time from the panel's TimeProvider; never read the system clock directly. Daily charts use local calendar boundaries; never assume a day lasts 24 hours. Stream Deck policy and the real installer come through IPluginInstaller (D11). UsePlatformDetect selects X11 on Linux in the pinned Avalonia version. Keep XWayland support. Run `dotnet test --project tests/FinalToken.App.Tests -c Release` from the root. ## Panel and visual rules - Keep this order: fixed 56 px header; Limits; Week use per day; Tokens (totals, hourly and daily charts); Window charts (current-instance burn-up and past peaks); Resets (one full-width card per provider); Breakdown by model and project; collapsed Diagnostics, hidden when empty. Preserve scroll offset on snapshots. Sections have two columns from 1200 px content width; limit tiles have three from 1400 px. Cards align at the top and size to their content. - Follow the OS light/dark theme through `Ui.Theme` and `Ui.NeutralTheme`. Selection never uses the OS accent. Selected segments use primary ink, semibold and the neutral selection surface; checkboxes use primary ink on that surface. Keep all other Fluent accent states neutral too. - Dark/light tokens: page `#0d0d0d`/`#f9f9f7`; surface `#1a1a19`/`#fcfcfb`; border white/`#0b0b0b` at 10%; primary ink `#f0efec`/`#0b0b0b`; secondary `#c3c2b7`/`#52514e`; muted `#898781` on both; grid `#2c2c2a`/`#e1e0d9`; axis `#383835`/`#c3c2b7`; neutral selection `#383835`/`#e1e0d9`; cache read `#5c5b57`/`#c3c2b7`. - Claude is always orange `#d95926`/`#eb6834`; Codex always blue `#3987e5`/`#2a78d6`. Model breakdown dots use the provider identity returned by the query, never a name heuristic. Filtered model charts sort names into six categorical slots; later names fold into Other. Slots in order: dark `#3987e5 #d95926 #199e70 #c98500 #d55181 #9085e9`; light `#2a78d6 #eb6834 #1baf7a #eda100 #e87ba4 #6250d6`. Other is muted. - Status chips always have icon and label: `#0ca30c` ✓ On track, `#ec835a` ▲ Ahead, `#fab219` ▼ Behind. Forecasts start at 10% elapsed or as soon as Ahead, using the configured pace (D7); until then, tiles and window charts show the Core forecast start time. Dates remain visible for every positive pace delta, but only Ahead gets the critical `#d03b3b` mark and ⚠. Other states say "At this pace 100 % on …" in secondary ink. Text paragraphs stay in ink colours; colour belongs to marks and meters. - Spacing is 8/16/24 px; card radius 10, padding 16–20; system sans. Use about 12 px captions, 13 body, 15 card titles, 20 section titles and 32–36 hero numbers. Tabular figures only in tables and axes. Compact counts use three significant digits; axes omit trailing zeros. Exact values stay in tooltips. - Show one composition legend in the Tokens header. Cache reads are neutral; input/output/cache write use full/65%/40% provider colour. Reasoning is part of output; Codex cache read is part of input. Never add either subset twice. - Week charts show dashed muted even pace and thin solid secondary budget, with labels beside their own right endpoints and separated when close. No known day values means a collecting message. Use CalendarDays, including partial dates at both ends of a window (D7). Use `LimitAnalysis.SameInstance` for reset membership, history gaps and previous-window lookup; resets within 15 minutes belong together, including minute drift in either direction. - Charts use 2 px lines, hit targets at least 8 px, tooltips and recessive grids. Bars normally have a 2 px surface gap; below 6 px width remove gaps and snap shared edges to physical pixels. Breakdowns show eight rows plus expandable Other; keep every detail column sortable and right-aligned. - Estimated day bars use provider outlines and 45-degree hatching; measured days stay solid. Align past days by index and burn-ups by elapsed time. The Resets timeline puts real instances side by side on one time axis without joining their lines; mark observed resets and show skipped time as thin hatched bars below the plot, with overlapping spans in separate lanes (D12). Its axis ends at the latest of now and the early resets' nominal resets, never the running instance's reset. Burn-ups use solid measured and lighter dashed estimated lines, with no point markers. - Use DataTooltip for every data hover: bold title, two-column label/value grid, exact and compact counts, optional series swatches. Future days have no cumulative value. Share one date formatter for resets and forecasts. Recent-rate captions name the actual span. Tall tooltips open beside the pointer through `DataTooltip.BesidePointer`; a tooltip over the pointer takes the hover from its control. Do not clear a chart's tip on pointer exit. - Custom segments and checkboxes must show keyboard focus. NeutralCheckBox owns checked state; templates bind its MarkVisible property and must never register checked handlers. - Cap token estimates at 100%, retain the estimated crossing time and leave measured samples intact. Instances start at reset minus length and end at reset or the next start. Keep gaps unassigned; never infer short windows or overlap a sampled window with an inferred one (D7). Label real dates. Page wheel events must never change a selection: WindowSelector bubbles them to the scroll view. - Resets use the shared detail-table sorting, headers, row placement and expansion. Preserve the selected window, sort and expansion on renders. Money is invariant USD at API list prices; unknown models stay unpriced, and percent-derived values and token estimates carry `≈` (D13).