@v11g/agents-rock 1.0.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 (223) hide show
  1. package/README.md +65 -0
  2. package/bin/agents-rock.mjs +4 -0
  3. package/package.json +13 -0
  4. package/plugins/solution-architect/.claude-plugin/plugin.json +9 -0
  5. package/plugins/solution-architect/skills/analyze-requirements/README.md +75 -0
  6. package/plugins/solution-architect/skills/analyze-requirements/SKILL.md +31 -0
  7. package/plugins/solution-architect/skills/analyze-requirements/assets/fonts/OFL.txt +98 -0
  8. package/plugins/solution-architect/skills/analyze-requirements/assets/fonts/ibm-plex-mono-latin-400-normal.woff2 +0 -0
  9. package/plugins/solution-architect/skills/analyze-requirements/assets/fonts/ibm-plex-mono-latin-600-normal.woff2 +0 -0
  10. package/plugins/solution-architect/skills/analyze-requirements/assets/fonts/ibm-plex-sans-latin-400-normal.woff2 +0 -0
  11. package/plugins/solution-architect/skills/analyze-requirements/assets/fonts/ibm-plex-sans-latin-500-normal.woff2 +0 -0
  12. package/plugins/solution-architect/skills/analyze-requirements/assets/fonts/ibm-plex-sans-latin-600-normal.woff2 +0 -0
  13. package/plugins/solution-architect/skills/analyze-requirements/assets/mermaid-theme.json +52 -0
  14. package/plugins/solution-architect/skills/analyze-requirements/assets/section-help.json +101 -0
  15. package/plugins/solution-architect/skills/analyze-requirements/assets/viewer-template.html +2389 -0
  16. package/plugins/solution-architect/skills/analyze-requirements/references/interview.md +53 -0
  17. package/plugins/solution-architect/skills/analyze-requirements/references/likec4.md +157 -0
  18. package/plugins/solution-architect/skills/analyze-requirements/references/project-types.md +60 -0
  19. package/plugins/solution-architect/skills/analyze-requirements/references/research.md +78 -0
  20. package/plugins/solution-architect/skills/analyze-requirements/references/viewer.md +772 -0
  21. package/plugins/solution-architect/skills/analyze-requirements/references/writing.md +206 -0
  22. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/cdp.mjs +74 -0
  23. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/chrome.mjs +66 -0
  24. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/companion-links.mjs +20 -0
  25. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/doc-kinds.mjs +37 -0
  26. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/doc-links.mjs +26 -0
  27. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/doc-routes.mjs +27 -0
  28. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/doc-sections.mjs +78 -0
  29. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/embed.mjs +8 -0
  30. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/er-entities.mjs +16 -0
  31. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/fonts.mjs +39 -0
  32. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/frontmatter.mjs +17 -0
  33. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/inputs.mjs +41 -0
  34. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/likec4-config.mjs +41 -0
  35. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/likec4-extract.mjs +29 -0
  36. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/likec4-steps.mjs +22 -0
  37. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-defs.mjs +20 -0
  38. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-flows.mjs +46 -0
  39. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-inline.mjs +31 -0
  40. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-links.mjs +7 -0
  41. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-list.mjs +64 -0
  42. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-render.mjs +127 -0
  43. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-shape.mjs +19 -0
  44. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-tables.mjs +30 -0
  45. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-views.mjs +48 -0
  46. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-wide.mjs +44 -0
  47. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/nav.mjs +72 -0
  48. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/offline.mjs +19 -0
  49. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/port.mjs +13 -0
  50. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/quality-gate.mjs +113 -0
  51. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/section-help.mjs +49 -0
  52. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/slug-registry.mjs +11 -0
  53. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-clusters.mjs +15 -0
  54. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-deployment.mjs +8 -0
  55. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-elections.mjs +20 -0
  56. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-links.mjs +23 -0
  57. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-model-tables.mjs +24 -0
  58. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-palette.mjs +34 -0
  59. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-provenance.mjs +20 -0
  60. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-tree.mjs +16 -0
  61. package/plugins/solution-architect/skills/analyze-requirements/scripts/likec4-config.mjs +19 -0
  62. package/plugins/solution-architect/skills/analyze-requirements/scripts/likec4-export.mjs +35 -0
  63. package/plugins/solution-architect/skills/analyze-requirements/scripts/likec4-gen.mjs +39 -0
  64. package/plugins/solution-architect/skills/analyze-requirements/scripts/render.mjs +130 -0
  65. package/plugins/solution-architect/skills/analyze-requirements/scripts/serve.mjs +71 -0
  66. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/browser.test.mjs +553 -0
  67. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/companion-links.test.mjs +60 -0
  68. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/doc-kinds.test.mjs +41 -0
  69. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/doc-links.test.mjs +104 -0
  70. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/doc-routes.test.mjs +54 -0
  71. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/doc-sections.test.mjs +197 -0
  72. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/embed.test.mjs +28 -0
  73. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/er-entities.test.mjs +14 -0
  74. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/ARCHITECTURE.md +47 -0
  75. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/c4-src/broken/model.c4 +27 -0
  76. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/c4-src/pass/model.c4 +29 -0
  77. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/docs/adr/0001-sample.md +18 -0
  78. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/docs/estimate.html +2 -0
  79. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/docs/estimation.md +8 -0
  80. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/model-broken.json +1 -0
  81. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/model.json +1 -0
  82. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/threat-model.md +8 -0
  83. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/sample-model.json +1 -0
  84. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/sample.c4 +28 -0
  85. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fonts.test.mjs +38 -0
  86. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/frontmatter.test.mjs +27 -0
  87. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/inputs.test.mjs +72 -0
  88. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/likec4-config-cli.test.mjs +26 -0
  89. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/likec4-config.test.mjs +74 -0
  90. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/likec4-export-cli.test.mjs +61 -0
  91. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/likec4-extract.test.mjs +37 -0
  92. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/likec4-gen-cli.test.mjs +73 -0
  93. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/likec4-steps.test.mjs +32 -0
  94. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-flows.test.mjs +82 -0
  95. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-links.test.mjs +16 -0
  96. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-provenance.test.mjs +42 -0
  97. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-render.test.mjs +226 -0
  98. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-tables.test.mjs +30 -0
  99. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-views.test.mjs +76 -0
  100. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-wide.test.mjs +76 -0
  101. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/nav.test.mjs +236 -0
  102. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/offline.test.mjs +37 -0
  103. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/quality-gate.test.mjs +86 -0
  104. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/quality-gates.test.mjs +20 -0
  105. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/render.test.mjs +171 -0
  106. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/research-workflow.test.mjs +38 -0
  107. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/section-help.test.mjs +101 -0
  108. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/serve.test.mjs +48 -0
  109. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-clusters.test.mjs +46 -0
  110. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-deployment.test.mjs +23 -0
  111. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-elections.test.mjs +30 -0
  112. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-links.test.mjs +38 -0
  113. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-model-tables.test.mjs +51 -0
  114. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-provenance.test.mjs +28 -0
  115. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-tree.test.mjs +43 -0
  116. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/viewer-template.test.mjs +1206 -0
  117. package/plugins/solution-architect/skills/analyze-requirements/scripts/validate.mjs +88 -0
  118. package/plugins/solution-architect/skills/analyze-requirements/workflows/research.js +57 -0
  119. package/plugins/solution-architect/skills/estimate/README.md +67 -0
  120. package/plugins/solution-architect/skills/estimate/SKILL.md +64 -0
  121. package/plugins/solution-architect/skills/estimate/assets/estimate-template.html +1128 -0
  122. package/plugins/solution-architect/skills/estimate/references/ai-multipliers.md +95 -0
  123. package/plugins/solution-architect/skills/estimate/references/interview.md +80 -0
  124. package/plugins/solution-architect/skills/estimate/references/slicing.md +55 -0
  125. package/plugins/solution-architect/skills/estimate/references/techniques.md +111 -0
  126. package/plugins/solution-architect/skills/estimate/references/writing.md +211 -0
  127. package/plugins/solution-architect/skills/estimate/scripts/compute.mjs +23 -0
  128. package/plugins/solution-architect/skills/estimate/scripts/lib/checks.mjs +128 -0
  129. package/plugins/solution-architect/skills/estimate/scripts/lib/components.mjs +19 -0
  130. package/plugins/solution-architect/skills/estimate/scripts/lib/estimate-math.mjs +85 -0
  131. package/plugins/solution-architect/skills/estimate/scripts/lib/inline.mjs +10 -0
  132. package/plugins/solution-architect/skills/estimate/scripts/lib/redact.mjs +30 -0
  133. package/plugins/solution-architect/skills/estimate/scripts/lib/roadmap.mjs +32 -0
  134. package/plugins/solution-architect/skills/estimate/scripts/lib/rollup.mjs +122 -0
  135. package/plugins/solution-architect/skills/estimate/scripts/lib/schema.mjs +128 -0
  136. package/plugins/solution-architect/skills/estimate/scripts/render.mjs +65 -0
  137. package/plugins/solution-architect/skills/estimate/scripts/test/browser.test.mjs +623 -0
  138. package/plugins/solution-architect/skills/estimate/scripts/test/compute.test.mjs +88 -0
  139. package/plugins/solution-architect/skills/estimate/scripts/test/e2e.test.mjs +34 -0
  140. package/plugins/solution-architect/skills/estimate/scripts/test/estimate-math.test.mjs +112 -0
  141. package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/booking-inputs.json +58 -0
  142. package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/estimation-fail.md +30 -0
  143. package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/estimation-pass.md +60 -0
  144. package/plugins/solution-architect/skills/estimate/scripts/test/quality-gates.test.mjs +20 -0
  145. package/plugins/solution-architect/skills/estimate/scripts/test/references.test.mjs +71 -0
  146. package/plugins/solution-architect/skills/estimate/scripts/test/render.test.mjs +121 -0
  147. package/plugins/solution-architect/skills/estimate/scripts/test/schema.test.mjs +129 -0
  148. package/plugins/solution-architect/skills/estimate/scripts/test/validate.test.mjs +72 -0
  149. package/plugins/solution-architect/skills/estimate/scripts/validate.mjs +20 -0
  150. package/plugins/solution-architect/skills/new-lead/README.md +48 -0
  151. package/plugins/solution-architect/skills/new-lead/SKILL.md +113 -0
  152. package/plugins/solution-architect/skills/new-lead/assets/dashboard/detail.html +842 -0
  153. package/plugins/solution-architect/skills/new-lead/assets/dashboard/index.html +655 -0
  154. package/plugins/solution-architect/skills/new-lead/assets/dashboard/start.sh +3 -0
  155. package/plugins/solution-architect/skills/new-lead/assets/dashboard/stats.mjs +98 -0
  156. package/plugins/solution-architect/skills/new-lead/assets/dashboard/vendor/reactflow-bundle.js +473 -0
  157. package/plugins/solution-architect/skills/new-lead/assets/vendor-build/entry.jsx +33 -0
  158. package/plugins/solution-architect/skills/new-lead/assets/vendor-build/package-lock.json +1055 -0
  159. package/plugins/solution-architect/skills/new-lead/assets/vendor-build/package.json +19 -0
  160. package/plugins/solution-architect/skills/new-lead/scripts/init-root.mjs +73 -0
  161. package/plugins/solution-architect/skills/new-lead/scripts/lead-upsert.mjs +31 -0
  162. package/plugins/solution-architect/skills/new-lead/scripts/lib/enrich.mjs +20 -0
  163. package/plugins/solution-architect/skills/new-lead/scripts/lib/map-nodes.mjs +124 -0
  164. package/plugins/solution-architect/skills/new-lead/scripts/lib/map.mjs +117 -0
  165. package/plugins/solution-architect/skills/new-lead/scripts/lib/port.mjs +15 -0
  166. package/plugins/solution-architect/skills/new-lead/scripts/lib/registry.mjs +116 -0
  167. package/plugins/solution-architect/skills/new-lead/scripts/serve.mjs +163 -0
  168. package/plugins/solution-architect/skills/new-lead/scripts/test/e2e-workspace.test.mjs +59 -0
  169. package/plugins/solution-architect/skills/new-lead/scripts/test/enrich.test.mjs +16 -0
  170. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/ARCHITECTURE.md +16 -0
  171. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/brief.md +4 -0
  172. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/dist/index.html +11 -0
  173. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/dist/proposal-non-tech.html +2 -0
  174. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/dist/threat-model.html +2 -0
  175. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/estimation-inputs.json +6 -0
  176. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/estimation.json +10 -0
  177. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/notes.md +3 -0
  178. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/proposal-non-tech.md +3 -0
  179. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/rfp.md +3 -0
  180. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads.json +25 -0
  181. package/plugins/solution-architect/skills/new-lead/scripts/test/init-root.test.mjs +81 -0
  182. package/plugins/solution-architect/skills/new-lead/scripts/test/lead-upsert.test.mjs +67 -0
  183. package/plugins/solution-architect/skills/new-lead/scripts/test/map.test.mjs +72 -0
  184. package/plugins/solution-architect/skills/new-lead/scripts/test/port.test.mjs +31 -0
  185. package/plugins/solution-architect/skills/new-lead/scripts/test/registry-io.test.mjs +57 -0
  186. package/plugins/solution-architect/skills/new-lead/scripts/test/registry.test.mjs +49 -0
  187. package/plugins/solution-architect/skills/new-lead/scripts/test/serve.test.mjs +205 -0
  188. package/plugins/solution-architect/skills/new-lead/scripts/test/stats.test.mjs +92 -0
  189. package/plugins/solution-architect/skills/new-lead/scripts/test/validate-cli.test.mjs +24 -0
  190. package/plugins/solution-architect/skills/new-lead/scripts/test/vendor-bundle.test.mjs +9 -0
  191. package/plugins/solution-architect/skills/new-lead/scripts/validate.mjs +9 -0
  192. package/plugins/solution-architect/skills/proposal/README.md +36 -0
  193. package/plugins/solution-architect/skills/proposal/SKILL.md +58 -0
  194. package/plugins/solution-architect/skills/proposal/assets/proposal-template.html +82 -0
  195. package/plugins/solution-architect/skills/proposal/references/interview.md +63 -0
  196. package/plugins/solution-architect/skills/proposal/references/review.md +28 -0
  197. package/plugins/solution-architect/skills/proposal/references/writing.md +102 -0
  198. package/plugins/solution-architect/skills/proposal/scripts/derive.mjs +22 -0
  199. package/plugins/solution-architect/skills/proposal/scripts/lib/checks-client.mjs +75 -0
  200. package/plugins/solution-architect/skills/proposal/scripts/lib/checks-doc.mjs +54 -0
  201. package/plugins/solution-architect/skills/proposal/scripts/lib/checks.mjs +17 -0
  202. package/plugins/solution-architect/skills/proposal/scripts/lib/figures.mjs +43 -0
  203. package/plugins/solution-architect/skills/proposal/scripts/lib/jargon.mjs +9 -0
  204. package/plugins/solution-architect/skills/proposal/scripts/lib/sections.mjs +32 -0
  205. package/plugins/solution-architect/skills/proposal/scripts/render.mjs +60 -0
  206. package/plugins/solution-architect/skills/proposal/scripts/test/checks-client.test.mjs +144 -0
  207. package/plugins/solution-architect/skills/proposal/scripts/test/checks-doc.test.mjs +93 -0
  208. package/plugins/solution-architect/skills/proposal/scripts/test/docs.test.mjs +51 -0
  209. package/plugins/solution-architect/skills/proposal/scripts/test/e2e.test.mjs +30 -0
  210. package/plugins/solution-architect/skills/proposal/scripts/test/figures.test.mjs +81 -0
  211. package/plugins/solution-architect/skills/proposal/scripts/test/fixtures/proposal-fail.md +22 -0
  212. package/plugins/solution-architect/skills/proposal/scripts/test/fixtures/proposal-pass.md +55 -0
  213. package/plugins/solution-architect/skills/proposal/scripts/test/quality-gates.test.mjs +20 -0
  214. package/plugins/solution-architect/skills/proposal/scripts/test/render.test.mjs +70 -0
  215. package/plugins/solution-architect/skills/proposal/scripts/test/validate.test.mjs +40 -0
  216. package/plugins/solution-architect/skills/proposal/scripts/validate.mjs +20 -0
  217. package/src/cli/agents.mjs +12 -0
  218. package/src/cli/args.mjs +46 -0
  219. package/src/cli/install.mjs +68 -0
  220. package/src/cli/main.mjs +124 -0
  221. package/src/cli/picker.mjs +78 -0
  222. package/src/cli/registry.mjs +26 -0
  223. package/src/cli/uninstall.mjs +38 -0
@@ -0,0 +1,1128 @@
1
+ <!doctype html>
2
+ <!-- data-theme is stated rather than left to the browser: this page opens dark,
3
+ and the toggle flips from a known state so its first click always bites. -->
4
+ <html lang="en" data-theme="dark">
5
+ <head>
6
+ <meta charset="utf-8">
7
+ <meta name="viewport" content="width=device-width, initial-scale=1">
8
+ <meta name="description" content="Interactive project estimate with scenario comparison">
9
+ <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect width='16' height='16' rx='3' fill='%230f766e'/%3E%3C/svg%3E">
10
+ <title><!-- slot:TITLE --> — Estimate</title>
11
+ <style>
12
+ <!-- slot:FONTS -->
13
+ /* color-scheme is declared, not left at `normal`: a page that never states its
14
+ scheme is the page a force-dark browser rewrites, and then the toggle flips
15
+ data-theme with nothing visible changing — the button reads as broken. Stated
16
+ per theme, forced dark is off and the native controls in the what-if rail
17
+ (number, range, select) follow the page instead of fighting it.
18
+
19
+ The light palette is unconditional and the dark one is scoped to @media screen
20
+ below, so this block doubles as the paper palette: the page opens dark on a
21
+ display, and printing it falls back here instead of spending a full-bleed page
22
+ of ink. Written as a fallback rather than as a second copy inside @media print
23
+ — a duplicated palette is a palette that drifts. */
24
+ :root {
25
+ color-scheme:light;
26
+ --bg:#f7f5f0; --ink:#1c1b18; --ink-dim:#6f6a5e;
27
+ --accent:#0f766e; --accent-ink:#0b5a54; --accent-soft:rgba(15,118,110,.08);
28
+ --warn:#b45309; --warn-soft:rgba(180,83,9,.1);
29
+ --bad:#b91c1c; --ok:#15803d; --card:#fffdf9;
30
+ --border:#e6e1d5; --border-strong:#cfc8b8;
31
+ --shadow:0 1px 2px rgba(60,55,40,.05), 0 6px 20px rgba(60,55,40,.05);
32
+ }
33
+ @media screen {
34
+ :root[data-theme="dark"] {
35
+ color-scheme:dark;
36
+ --bg:#101413; --ink:#e8e6e1; --ink-dim:#93a09b;
37
+ --accent:#3ba99f; --accent-ink:#6fd1c7; --accent-soft:rgba(59,169,159,.12);
38
+ --warn:#d98b3d; --warn-soft:rgba(217,139,61,.12);
39
+ --bad:#e5726b; --ok:#5dbb7a; --card:#181d1c;
40
+ --border:#263230; --border-strong:#3a4a46;
41
+ --shadow:0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
42
+ }
43
+ }
44
+ * { box-sizing: border-box; }
45
+ body {
46
+ font-family:'IBM Plex Sans',system-ui,sans-serif; background:var(--bg); color:var(--ink);
47
+ margin:0; line-height:1.5;
48
+ }
49
+ button {
50
+ font-family:inherit; font-size:.8rem; padding:.35rem .75rem; border-radius:.35rem;
51
+ border:1px solid var(--border-strong); background:var(--card); color:var(--ink); cursor:pointer;
52
+ transition:background-color .15s ease, border-color .15s ease, transform .1s ease;
53
+ }
54
+ button:hover { border-color:var(--accent); color:var(--accent-ink); }
55
+ button:active { transform:translateY(1px); }
56
+ /* companion-mode back-link to the arch-docs viewer; dressed as a header button */
57
+ #viewer-link {
58
+ font-size:.8rem; padding:.35rem .75rem; border-radius:.35rem;
59
+ border:1px solid var(--border-strong); color:var(--ink); text-decoration:none;
60
+ }
61
+ #viewer-link:hover { border-color:var(--accent); color:var(--accent-ink); }
62
+ :focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
63
+ /* header bar: constrained to the same column as main via padding math */
64
+ header {
65
+ position:sticky; top:0; z-index:10;
66
+ display:flex; align-items:center; gap:.6rem;
67
+ padding:.8rem max(1.25rem, calc((100% - 1160px) / 2));
68
+ border-bottom:1px solid var(--border); background:var(--card);
69
+ }
70
+ .titles { flex:1; min-width:0; }
71
+ .eyebrow {
72
+ margin:0; font-family:'IBM Plex Mono',monospace; font-size:.62rem;
73
+ letter-spacing:.08em; text-transform:uppercase; color:var(--ink-dim);
74
+ }
75
+ header h1 {
76
+ font-size:1.05rem; font-weight:600; letter-spacing:-.01em; margin:0;
77
+ white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
78
+ }
79
+ #confidence-badge {
80
+ font-family:'IBM Plex Mono',monospace; font-size:.72rem; text-transform:uppercase;
81
+ padding:.18rem .5rem; border-radius:.3rem; border:1px solid var(--border-strong);
82
+ }
83
+ #confidence-badge.high { color:var(--ok); border-color:var(--ok); background:rgba(21,128,61,.08); }
84
+ #confidence-badge.med { color:var(--warn); border-color:var(--warn); background:var(--warn-soft); }
85
+ #confidence-badge.low { color:var(--bad); border-color:var(--bad); background:rgba(185,28,28,.08); }
86
+ #modified-banner {
87
+ margin:0; padding:.5rem max(1.25rem, calc((100% - 1160px) / 2));
88
+ background:var(--warn-soft); color:var(--warn); font-size:.85rem;
89
+ border-bottom:1px solid var(--border);
90
+ }
91
+ #modified-banner button { margin-left:.5rem; }
92
+ main {
93
+ display:grid; grid-template-columns:1fr; gap:1.1rem;
94
+ max-width:1160px; margin:0 auto; padding:1.25rem 1.25rem 3rem;
95
+ }
96
+ .col { display:grid; gap:1.1rem; min-width:0; align-content:start; }
97
+ .col > section:empty { display:none; }
98
+ main section h2, main aside h2 {
99
+ font-size:.82rem; font-weight:600; color:var(--ink-dim);
100
+ margin:0 0 .8rem; letter-spacing:.01em;
101
+ }
102
+ /* panels: every section except the scenario card grid reads as one surface */
103
+ .col > section {
104
+ background:var(--card); border:1px solid var(--border); border-radius:.6rem;
105
+ padding:1.1rem 1.2rem; box-shadow:var(--shadow);
106
+ }
107
+ #scenario-cards { background:none; border:none; box-shadow:none; padding:0; display:flex; flex-direction:column; }
108
+ #scenario-cards .cards {
109
+ flex:1; display:grid; grid-template-columns:repeat(auto-fit, minmax(190px, 1fr)); gap:.9rem;
110
+ }
111
+ .sec-head { display:flex; align-items:center; gap:.45rem; margin:0 0 .8rem; }
112
+ .sec-head h2 { margin:0; }
113
+ details.help { position:relative; display:inline-block; line-height:1; }
114
+ details.help summary {
115
+ list-style:none; cursor:help; width:1.05rem; height:1.05rem; border-radius:50%;
116
+ border:1px solid var(--border-strong); color:var(--ink-dim); background:var(--card);
117
+ font-size:.68rem; font-weight:600; font-family:'IBM Plex Mono',monospace;
118
+ display:inline-flex; align-items:center; justify-content:center;
119
+ }
120
+ details.help summary::-webkit-details-marker { display:none; }
121
+ details.help[open] summary { color:var(--accent-ink); border-color:var(--accent); }
122
+ details.help > p {
123
+ position:absolute; z-index:20; top:1.4rem; left:0; width:270px; margin:0;
124
+ background:var(--card); border:1px solid var(--border-strong); border-radius:.45rem;
125
+ padding:.6rem .75rem; font-size:.76rem; font-weight:400; line-height:1.45;
126
+ color:var(--ink); text-transform:none; letter-spacing:normal; text-align:left;
127
+ box-shadow:var(--shadow);
128
+ }
129
+ #controls details.help > p, td details.help > p, caption details.help > p { left:auto; right:0; }
130
+ #method summary { list-style:none; display:flex; align-items:baseline; gap:.6rem; cursor:pointer; }
131
+ #method summary::-webkit-details-marker { display:none; }
132
+ #method summary h2 { margin:0; }
133
+ #method .tech { font-size:.8rem; color:var(--ink-dim); font-family:'IBM Plex Mono',monospace; }
134
+ #method .chev { margin-left:auto; color:var(--ink-dim); transition:transform .15s ease; }
135
+ #method details[open] .chev { transform:rotate(90deg); }
136
+ #method ul { margin:.8rem 0 .9rem; padding-left:1.1rem; font-size:.85rem; }
137
+ #method li { margin-bottom:.35rem; }
138
+ #method .sources { font-size:.78rem; color:var(--ink-dim); margin:0; }
139
+ #method .sources span { display:block; margin-bottom:.2rem; }
140
+ .card {
141
+ position:relative; background:var(--card); border:1px solid var(--border);
142
+ border-radius:.6rem; padding:1rem 1.1rem; box-shadow:var(--shadow);
143
+ }
144
+ /* card anatomy: header, hero (top-aligned so the months figures sit on the
145
+ same line across cards), facts pinned to the bottom. */
146
+ .scenario { display:flex; flex-direction:column; gap:.7rem; padding:1.2rem; }
147
+ .scenario h3 {
148
+ font-family:'IBM Plex Mono',monospace; font-size:.78rem; font-weight:600;
149
+ color:var(--ink-dim); margin:0; overflow-wrap:anywhere;
150
+ }
151
+ .hero { flex:1; display:flex; flex-direction:column; justify-content:flex-start; gap:.55rem; }
152
+ .hero .num {
153
+ font-size:2.2rem; font-weight:600; line-height:1.05; letter-spacing:-.02em;
154
+ font-variant-numeric:tabular-nums;
155
+ }
156
+ .hero .unit { font-size:.8rem; color:var(--ink-dim); }
157
+ .gauge { height:.45rem; background:var(--border); border-radius:.3rem; overflow:hidden; }
158
+ .gauge span { display:block; height:100%; background:var(--accent); border-radius:.3rem; }
159
+ .delta {
160
+ align-self:flex-start; font-family:'IBM Plex Mono',monospace; font-size:.68rem;
161
+ color:var(--warn); background:var(--warn-soft); padding:.14rem .45rem; border-radius:.25rem;
162
+ }
163
+ .facts {
164
+ display:grid; grid-template-columns:1fr 1fr; gap:.7rem 1.1rem;
165
+ border-top:1px solid var(--border); padding-top:.8rem; margin:0;
166
+ }
167
+ .facts dt { font-size:.66rem; text-transform:uppercase; letter-spacing:.05em; color:var(--ink-dim); }
168
+ .facts dd { margin:.1rem 0 0; font-family:'IBM Plex Mono',monospace; font-size:.86rem; }
169
+ .scenario.recommended { border-color:var(--accent); background:linear-gradient(var(--accent-soft), transparent 55%) var(--card); }
170
+ .flag {
171
+ position:absolute; top:.7rem; right:.8rem; font-size:.62rem; font-weight:600;
172
+ letter-spacing:.04em; color:var(--accent-ink); background:var(--accent-soft);
173
+ padding:.14rem .4rem; border-radius:.25rem;
174
+ }
175
+ .months { margin:.2rem 0 .9rem; font-size:.8rem; color:var(--ink-dim); }
176
+ .months .num {
177
+ display:block; font-size:2.4rem; font-weight:600; line-height:1.15;
178
+ color:var(--ink); font-variant-numeric:tabular-nums; letter-spacing:-.02em;
179
+ }
180
+ #whatif-readout dl { display:flex; gap:1.2rem; margin:0; }
181
+ #whatif-readout dt { font-size:.66rem; text-transform:uppercase; letter-spacing:.05em; color:var(--ink-dim); }
182
+ #whatif-readout dd { margin:0; font-family:'IBM Plex Mono',monospace; font-size:.88rem; }
183
+ #whatif-readout { border-top:1px solid var(--border); padding-top:.7rem; }
184
+ #whatif-readout .months { display:flex; align-items:baseline; gap:.4rem; margin:0 0 .4rem; }
185
+ #whatif-readout .months .num { font-size:1.3rem; color:var(--accent-ink); }
186
+ /* bars are styled divs — width set inline from data, no canvas, printable */
187
+ /* when the section is stretched to match the rail beside it, the bars float
188
+ to the vertical center instead of leaving a dead band at the bottom. */
189
+ #cost-bars { display:flex; flex-direction:column; }
190
+ #cost-bars .bar-group { flex:1; display:flex; flex-direction:column; justify-content:center; }
191
+ .bar-row { display:flex; align-items:center; gap:.6rem; margin-bottom:.85rem; }
192
+ .bar-label {
193
+ flex:0 0 170px; font-size:.78rem; color:var(--ink-dim);
194
+ white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
195
+ }
196
+ .bar-track { flex:1; height:1.05rem; background:var(--border); border-radius:.3rem; overflow:hidden; }
197
+ .bar-fill { display:block; height:100%; background:var(--accent); opacity:.5; border-radius:.3rem; }
198
+ .bar-fill.is-rec { opacity:1; }
199
+ .bar-val {
200
+ flex:0 0 auto; min-width:5.5rem; text-align:right;
201
+ font-family:'IBM Plex Mono',monospace; font-size:.76rem; font-variant-numeric:tabular-nums;
202
+ }
203
+ /* roadmap: Gantt-style shared axis. Every row is a flex triple (label |
204
+ track | months) with the same label/months widths as the axis strip below
205
+ it, so a given month lines up under the same x-position in every row's
206
+ track and in the axis ticks — one shared coordinate system, not a
207
+ per-row axis. */
208
+ .roadmap-chart { display:flex; flex-direction:column; }
209
+ .roadmap-row { display:flex; align-items:center; gap:.7rem; padding:.4rem 0; cursor:pointer; }
210
+ .roadmap-row:hover { background:var(--accent-soft); }
211
+ .roadmap-row + .roadmap-row { border-top:1px solid var(--border); }
212
+ .roadmap-label { flex:0 0 150px; min-width:0; display:flex; flex-direction:column; gap:.15rem; }
213
+ .roadmap-name { font-size:.82rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
214
+ .roadmap-feature-names { font-size:.7rem; color:var(--ink-dim); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
215
+ .roadmap-track {
216
+ position:relative; flex:1; min-width:0; height:.8rem;
217
+ background:var(--border); border-radius:.3rem; overflow:hidden;
218
+ }
219
+ .roadmap-gridline { position:absolute; top:0; bottom:0; width:1px; background:var(--border-strong); opacity:.55; }
220
+ .roadmap-band {
221
+ position:absolute; top:0; height:100%; background:var(--accent); border-radius:.3rem;
222
+ display:flex; overflow:hidden; /* container segments fill it left to right */
223
+ }
224
+ .roadmap-seg { height:100%; }
225
+ .roadmap-months {
226
+ flex:0 0 auto; min-width:4.6rem; text-align:right;
227
+ font-family:'IBM Plex Mono',monospace; font-size:.72rem;
228
+ color:var(--ink-dim); font-variant-numeric:tabular-nums;
229
+ }
230
+ /* the axis mirrors the row's flex geometry (same label/months widths) so its
231
+ ticks land under the matching month position in every track above. */
232
+ .roadmap-axis {
233
+ display:flex; align-items:flex-end; gap:.7rem; height:1rem; margin-top:.6rem;
234
+ padding-top:.4rem; border-top:1px solid var(--border);
235
+ font-family:'IBM Plex Mono',monospace; font-size:.68rem; color:var(--ink-dim);
236
+ }
237
+ .roadmap-axis-spacer { flex:0 0 150px; }
238
+ .roadmap-axis-ticks { position:relative; flex:1; min-width:0; height:100%; }
239
+ .roadmap-axis-ticks span { position:absolute; transform:translateX(-50%); }
240
+ .roadmap-axis-unit { flex:0 0 auto; min-width:4.6rem; text-align:right; }
241
+ table { width:100%; border-collapse:collapse; font-size:.85rem; }
242
+ table th, table td { text-align:left; padding:.45rem .6rem; border-bottom:1px solid var(--border); }
243
+ table th { color:var(--ink-dim); font-weight:600; font-size:.76rem; }
244
+ table caption {
245
+ caption-side:top; text-align:left; font-size:.82rem; font-weight:600;
246
+ color:var(--ink-dim); padding:0 0 .6rem;
247
+ }
248
+ tbody tr { transition:background-color .15s ease; }
249
+ tbody tr:hover { background:var(--accent-soft); }
250
+ td.num, th.num { text-align:right; font-family:'IBM Plex Mono',monospace; font-variant-numeric:tabular-nums; }
251
+ .tag {
252
+ font-size:.68rem; font-weight:600; padding:.12rem .4rem; border-radius:.25rem;
253
+ background:var(--border); color:var(--ink-dim);
254
+ }
255
+ .tag.proposed { background:var(--warn-soft); color:var(--warn); }
256
+ .conf { font-weight:600; font-size:.78rem; }
257
+ tr.conf-high .conf { color:var(--ok); }
258
+ tr.conf-med .conf { color:var(--warn); }
259
+ tr.conf-low .conf { color:var(--bad); }
260
+ /* feature breakdown: filter pills, sortable headers, bar-in-cell, task drill-down */
261
+ /* container stripe on a row's first cell: inset shadow — no gap to the table
262
+ edge. The color arrives per row as --ct-color; the shadow lives here. */
263
+ td.ct-edge { box-shadow:inset 4px 0 0 var(--ct-color); }
264
+ .bd-filters { display:flex; flex-wrap:wrap; gap:.9rem; margin:0 0 .8rem; }
265
+ /* effort-by-container donut: slices are stroked circles (pathLength=100 turns
266
+ stroke-dasharray into percent), legend carries the exact numbers. */
267
+ #containers .pie-wrap { display:flex; flex-wrap:wrap; align-items:center; gap:1.8rem; }
268
+ #containers svg { width:172px; height:172px; flex:0 0 auto; }
269
+ #containers .pie-slice.hot { opacity:.75; }
270
+ #containers .pie-legend { list-style:none; margin:0; padding:0; display:grid; gap:.35rem; flex:1; min-width:230px; align-content:center; }
271
+ #containers .pie-legend li { display:flex; align-items:center; gap:.5rem; font-size:.82rem; }
272
+ .swatch { width:.7rem; height:.7rem; border-radius:.2rem; flex:0 0 auto; }
273
+ #containers .pie-hours { margin-left:auto; }
274
+ #containers .pie-hours, #containers .pie-share {
275
+ font-family:'IBM Plex Mono',monospace; font-size:.76rem; font-variant-numeric:tabular-nums;
276
+ }
277
+ #containers .pie-share { min-width:2.6rem; text-align:right; color:var(--ink-dim); }
278
+ #containers .pie-note { margin:.8rem 0 0; font-size:.76rem; color:var(--ink-dim); }
279
+ #containers .pie-legend li.hot { background:var(--accent-soft); border-radius:.3rem; }
280
+ .bd-filter-group { display:flex; flex-wrap:wrap; gap:.3rem; align-items:center; }
281
+ .bd-filter-group + .bd-filter-group { border-left:1px solid var(--border-strong); padding-left:.9rem; }
282
+ .bd-select { gap:.4rem; font-size:.72rem; color:var(--ink-dim); }
283
+ .bd-select select {
284
+ font-family:inherit; font-size:.74rem; padding:.2rem .4rem; border-radius:.35rem;
285
+ border:1px solid var(--border-strong); background:var(--card); color:var(--ink); max-width:16rem;
286
+ }
287
+ .bd-right { display:flex; flex-wrap:wrap; gap:.9rem; align-items:center; margin-left:auto; }
288
+ /* the expand group is internal-only; without it the source group must not
289
+ keep the divider that separated the two. */
290
+ .view-client .bd-right .bd-filter-group { border-left:none; padding-left:0; }
291
+ .bd-filters button { font-size:.7rem; padding:.2rem .55rem; border-radius:1rem; }
292
+ .bd-filters button[aria-pressed="true"] {
293
+ border-color:var(--accent); color:var(--accent-ink); background:var(--accent-soft);
294
+ }
295
+ .bd-scroll { overflow-x:auto; }
296
+ #feature-table table { min-width:660px; }
297
+ #feature-table th button {
298
+ border:none; background:none; padding:0; font:inherit; color:inherit; cursor:pointer;
299
+ white-space:nowrap;
300
+ }
301
+ #feature-table th button:hover { color:var(--accent-ink); }
302
+ #feature-table th[aria-sort="ascending"] button, #feature-table th[aria-sort="descending"] button {
303
+ color:var(--accent-ink);
304
+ }
305
+ #feature-table td.num { white-space:nowrap; }
306
+ /* hanging indent: the chevron is its own flex item, so 2-line names wrap
307
+ against their own left edge instead of sliding under the button. */
308
+ .feat-cell { display:flex; align-items:baseline; gap:.45rem; }
309
+ .feat-cell > span { min-width:0; }
310
+ /* the bar lives inside the effort cell: solid fill to expected hours, lighter
311
+ tail to the pessimistic bound, both scaled to the global max so filtered
312
+ views never rescale surviving rows. */
313
+ .bd-cell { display:flex; align-items:center; gap:.6rem; }
314
+ .bd-track {
315
+ flex:1; min-width:90px; height:.55rem; display:flex;
316
+ background:var(--border); border-radius:.3rem; overflow:hidden;
317
+ }
318
+ .bd-fill { height:100%; background:var(--accent); opacity:.85; }
319
+ .bd-tail { height:100%; background:var(--accent); opacity:.25; }
320
+ .bd-num {
321
+ flex:0 0 auto; min-width:3.4rem; text-align:right;
322
+ font-family:'IBM Plex Mono',monospace; font-size:.76rem; font-variant-numeric:tabular-nums;
323
+ }
324
+ .expand {
325
+ flex:0 0 auto; width:1.05rem; height:1.05rem; padding:0;
326
+ font-size:.6rem; line-height:1; border:none; background:none; color:var(--ink-dim);
327
+ transition:transform .15s ease, color .15s ease;
328
+ }
329
+ .expand:hover { color:var(--accent-ink); }
330
+ .expand[aria-expanded="true"] { transform:rotate(90deg); }
331
+ tr.task-row { font-size:.8rem; }
332
+ tr.task-row td { background:var(--bg); }
333
+ tr.task-row td:first-child { padding-left:2.1rem; }
334
+ tr.task-row .bd-cell { justify-content:flex-end; }
335
+ .task-assump { font-size:.76rem; color:var(--ink-dim); }
336
+ #register > div + table, #register > table + table { margin-top:1.4rem; }
337
+ /* compact rail: the team roster, the plan select, the sliders, and the
338
+ readout stack full-width. Keeps the rail near the height of the two
339
+ scenario sections beside it. */
340
+ #controls {
341
+ background:var(--card); border:1px solid var(--border); border-radius:.6rem;
342
+ padding:1.1rem 1.2rem; box-shadow:var(--shadow);
343
+ display:grid; grid-template-columns:1fr; gap:.7rem; align-content:start;
344
+ }
345
+ #controls label { display:flex; flex-direction:column; font-size:.76rem; gap:.3rem; color:var(--ink-dim); }
346
+ /* the roster: one row per engineer (seniority + rate + remove), plus add.
347
+ Styled by class — the container id is internal-only page text and must
348
+ never appear in the head CSS a client render keeps. */
349
+ #controls .team { display:flex; flex-direction:column; gap:.4rem; font-size:.76rem; color:var(--ink-dim); }
350
+ #controls .team-row { display:flex; gap:.4rem; align-items:center; }
351
+ #controls .team-row .cur { margin-right:-.15rem; }
352
+ #controls .team-row select { flex:1; min-width:0; }
353
+ #controls .team-row input { width:4.6rem; }
354
+ #controls .team button { font-size:.76rem; padding:.3rem .5rem; background:var(--bg); color:var(--ink-dim); }
355
+ #controls .team button:disabled { opacity:.4; cursor:default; }
356
+ #controls .lab { display:flex; justify-content:space-between; align-items:baseline; }
357
+ #controls output { font-family:'IBM Plex Mono',monospace; font-size:.74rem; color:var(--ink); }
358
+ #controls input, #controls select {
359
+ font:inherit; padding:.35rem .45rem; border:1px solid var(--border-strong);
360
+ border-radius:.35rem; background:var(--bg); color:var(--ink);
361
+ }
362
+ #controls input:hover, #controls select:hover { border-color:var(--accent); }
363
+ #controls input[type="range"] { padding:0; border:none; background:none; accent-color:var(--accent); }
364
+ .view-client [data\2d internal] { display:none !important; }
365
+ @media print {
366
+ header { position:static; }
367
+ header button, #viewer-link, #controls, #modified-banner, details.help, .bd-filters, .expand { display:none; }
368
+ main { grid-template-columns:1fr; }
369
+ main > section, .card { box-shadow:none; }
370
+ }
371
+ </style>
372
+ </head>
373
+ <body>
374
+ <header>
375
+ <div class="titles">
376
+ <p class="eyebrow">Project estimate</p>
377
+ <h1><!-- slot:TITLE --></h1>
378
+ </div>
379
+ <span id="confidence-badge"></span>
380
+ <button id="theme-toggle" type="button">theme</button>
381
+ <!-- internal:start --><!-- slot:VIEWER --><button id="view-toggle" type="button" data-internal>client view</button><!-- internal:end -->
382
+ </header>
383
+ <p id="modified-banner" role="status" hidden>modified from committed estimate — <button id="reset" type="button">reset</button></p>
384
+ <main>
385
+ <div class="col col-wide">
386
+ <section id="method"></section>
387
+ </div>
388
+ <div class="col">
389
+ <section id="scenario-cards"></section>
390
+ <section id="cost-bars"></section>
391
+ </div>
392
+ <!-- internal:start -->
393
+ <style>
394
+ /* internal-only layout: the what-if rail sits beside the scenario sections
395
+ only — its readout (months, cost, effort) is comparable to nothing below
396
+ the cost bars, so the lower sections take the full width instead of
397
+ reserving an empty rail column. Lives in the internal range so the
398
+ client-only render collapses back to one column. @media screen so the
399
+ print rules in the head keep winning on paper. */
400
+ @media screen {
401
+ main { grid-template-columns:minmax(0, 1fr) 300px; }
402
+ .col-wide { grid-column:1 / -1; }
403
+ /* no hole under the cost bars: the scenario-cards row stretches so the
404
+ left column always ends level with the rail beside it, and the cards
405
+ stay the dominant section. */
406
+ .col:not(.col-wide) { grid-template-rows:1fr auto; }
407
+ .view-client main { grid-template-columns:1fr; }
408
+ }
409
+ @media screen and (max-width:900px) {
410
+ main { grid-template-columns:1fr; }
411
+ }
412
+ </style>
413
+ <aside class="rail" data-internal>
414
+ <div class="sec-head"><h2>What-if</h2><details class="help"><summary aria-label="explain this panel">?</summary>
415
+ <p>The levers re-run the exact same formulas as the committed numbers, in your browser. Nothing here changes the committed estimate — it answers "what would it look like if&hellip;". The readout below updates live.</p></details></div>
416
+ <div id="controls" data-internal>
417
+ <div id="ctl-team" class="team" role="group" aria-label="team"></div>
418
+ <label>claude plan <select id="ctl-plan"><option>none</option><option>max5x</option><option>max20x</option></select></label>
419
+ <label><span class="lab">AI multiplier <output></output></span><input id="ctl-ai" type="range" min="0" max="1.5" step="0.05"></label>
420
+ <label><span class="lab">risk buffer <output></output></span><input id="ctl-buffer" type="range" min="0" max="2" step="0.1"></label>
421
+ <label><span class="lab">overhead % <output></output></span><input id="ctl-overhead" type="range" min="0" max="0.6" step="0.05"></label>
422
+ <div id="whatif-readout" aria-live="polite"></div>
423
+ </div>
424
+ </aside>
425
+ <!-- internal:end -->
426
+ <div class="col col-wide">
427
+ <section id="containers"></section>
428
+ <section id="roadmap"></section>
429
+ <section id="feature-table"></section>
430
+ <section id="register"></section>
431
+ </div>
432
+ </main>
433
+ <script type="application/json" id="estimation-data"><!-- slot:DATA --></script>
434
+ <script>
435
+ <!-- slot:MATH -->
436
+ /* boot: parse the data island, stamp the title + confidence badge, then wire
437
+ the sections, what-if controls, and view/theme toggles. */
438
+ const DATA = JSON.parse(document.getElementById('estimation-data').textContent);
439
+ document.querySelector('header h1').textContent = DATA.inputs.project;
440
+ const confLevel = (c) => `conf-${c.toLowerCase()}`;
441
+ const badge = document.getElementById('confidence-badge');
442
+ badge.textContent = DATA.computed.projectConfidence;
443
+ badge.className = `${DATA.computed.projectConfidence.toLowerCase()} ${confLevel(DATA.computed.projectConfidence)}`;
444
+
445
+ // Same math path as the committed numbers: recompute() is both the page's
446
+ // what-if engine and the parity hook the browser tests call directly.
447
+ // p.team is a real roster ([{seniority, rate}, …]) — effort follows the
448
+ // dominant seniority exactly like the committed rollup, cost follows each
449
+ // member's own rate.
450
+ function recompute(p) {
451
+ const tasks = DATA.inputs.features.flatMap((f) => f.tasks);
452
+ const seniority = dominantSeniority(p.team);
453
+ const hoursOf = (t) => taskHours({ e: pert(t).e, seniority, plan: p.plan,
454
+ category: t.category, verificationPct: DATA.inputs.verificationPct, scale: p.aiScale });
455
+ const dev = tasks.reduce((s, t) => s + hoursOf(t), 0);
456
+ const buffers = (riskBufferHours(DATA.inputs.risks)
457
+ + projectBuffer(tasks.map((t) => pert(t).sigma))) * p.bufferScale;
458
+ const hours = dev + dev * p.overheadPct + buffers;
459
+ return { hours, ...scenarioRollup({ hours, team: p.team, plan: p.plan }) };
460
+ }
461
+ window.__recompute = recompute;
462
+
463
+ function defaultsFromRecommended() {
464
+ const rec = DATA.inputs.scenarios.find((s) => s.id === DATA.inputs.recommendedScenario);
465
+ return {
466
+ team: rec.team.map((m) => ({ ...m })),
467
+ plan: rec.plan,
468
+ aiScale: 1,
469
+ bufferScale: 1,
470
+ overheadPct: DATA.inputs.overheadPct,
471
+ };
472
+ }
473
+
474
+ // Control ids are assembled at runtime (never one static "ctl-*" literal)
475
+ // so the client-only render, which keeps this whole script but drops the
476
+ // controls markup, never carries an internal control id as page text.
477
+ const CTL_SUFFIX = { plan: 'plan', aiScale: 'ai', bufferScale: 'buffer', overheadPct: 'overhead' };
478
+ const CTL_KEYS = Object.keys(CTL_SUFFIX);
479
+ const ctlId = (key) => `ctl-${CTL_SUFFIX[key]}`;
480
+ // The roster container is found by its class — its id is internal-only page
481
+ // text, and the class already ships in the head CSS either way.
482
+ const teamBox = () => document.querySelector('#controls .team');
483
+ const TEAM_MAX = 8;
484
+
485
+ function setControls(values) {
486
+ CTL_KEYS.forEach((key) => {
487
+ const el = document.getElementById(ctlId(key));
488
+ if (el) el.value = values[key];
489
+ });
490
+ }
491
+
492
+ function syncOutputs() {
493
+ CTL_KEYS.forEach((key) => {
494
+ const el = document.getElementById(ctlId(key));
495
+ const out = el?.parentElement.querySelector('output');
496
+ if (out) out.textContent = el.value;
497
+ });
498
+ }
499
+
500
+ // The committed scenarios are the page's only rate table: the first rate
501
+ // seen per seniority re-seeds a row's rate when its level changes.
502
+ const RATE_BY_SENIORITY = {};
503
+ for (const s of DATA.inputs.scenarios) {
504
+ for (const m of s.team) if (m.rate != null) RATE_BY_SENIORITY[m.seniority] ??= m.rate;
505
+ }
506
+
507
+ function teamRow({ seniority, rate }) {
508
+ const row = document.createElement('div');
509
+ row.className = 'team-row';
510
+ const sel = document.createElement('select');
511
+ for (const s of Object.keys(SENIORITY_FACTOR)) sel.add(new Option(s, s));
512
+ sel.value = seniority;
513
+ const cur = Object.assign(document.createElement('span'), { className: 'cur', textContent: '$' });
514
+ const rateEl = Object.assign(document.createElement('input'),
515
+ { type: 'number', min: 10, max: 300, step: 5, value: rate });
516
+ rateEl.setAttribute('aria-label', 'hourly rate');
517
+ const del = Object.assign(document.createElement('button'),
518
+ { type: 'button', className: 'team-del', textContent: '×' });
519
+ del.setAttribute('aria-label', 'remove engineer');
520
+ row.append(sel, cur, rateEl, del);
521
+ return row;
522
+ }
523
+
524
+ function syncTeamButtons() {
525
+ const box = teamBox();
526
+ const rows = box.querySelectorAll('.team-row');
527
+ box.querySelector('.team-add').disabled = rows.length >= TEAM_MAX;
528
+ rows.forEach((r) => { r.querySelector('.team-del').disabled = rows.length <= 1; });
529
+ }
530
+
531
+ // Rebuild-from-array is the only write path (boot, reset), so reset can
532
+ // never leave stale rows behind.
533
+ function renderTeam(team) {
534
+ const box = teamBox();
535
+ if (!box) return;
536
+ box.replaceChildren(
537
+ Object.assign(document.createElement('span'), { textContent: 'team' }),
538
+ ...team.map(teamRow),
539
+ Object.assign(document.createElement('button'),
540
+ { type: 'button', className: 'team-add', textContent: '+ engineer' }),
541
+ );
542
+ syncTeamButtons();
543
+ }
544
+
545
+ function currentTeam(defaults) {
546
+ const box = teamBox();
547
+ if (!box) return defaults.team;
548
+ return [...box.querySelectorAll('.team-row')].map((r) => ({
549
+ seniority: r.querySelector('select').value,
550
+ rate: Number(r.querySelector('input').value),
551
+ }));
552
+ }
553
+
554
+ function currentParams(defaults) {
555
+ const p = { team: currentTeam(defaults) };
556
+ CTL_KEYS.forEach((key) => {
557
+ const raw = document.getElementById(ctlId(key))?.value ?? defaults[key];
558
+ p[key] = key === 'plan' ? raw : Number(raw);
559
+ });
560
+ return p;
561
+ }
562
+
563
+ const fmtMoney = (v) => `$${Math.round(v).toLocaleString()}`;
564
+
565
+ const help = (text) => `<details class="help"><summary aria-label="explain this section">?</summary><p>${text}</p></details>`;
566
+ const secHead = (title, text) => `<div class="sec-head"><h2>${title}</h2>${help(text)}</div>`;
567
+
568
+ function barRow({ label, value, max, text, cls }) {
569
+ const pct = max > 0 ? Math.round((value / max) * 100) : 0;
570
+ return `<div class="bar-row"><span class="bar-label" title="${label}">${label}</span>
571
+ <span class="bar-track"><span class="bar-fill${cls ? ` ${cls}` : ''}" style="width:${pct}%"></span></span>
572
+ <span class="bar-val">${text}</span></div>`;
573
+ }
574
+
575
+ function teamSummary(team) {
576
+ const counts = new Map();
577
+ for (const m of team) counts.set(m.seniority, (counts.get(m.seniority) ?? 0) + 1);
578
+ return [...counts].map(([s, n]) => `${n}&times; ${s}`).join(' &middot; ');
579
+ }
580
+
581
+ // Derived in-browser from committed numbers, like every bar width on the
582
+ // page — never written into the JSON.
583
+ function deltaChip(id, s) {
584
+ if (id === DATA.inputs.recommendedScenario) return '';
585
+ const rec = DATA.computed.scenarios[DATA.inputs.recommendedScenario];
586
+ if (!rec) return '';
587
+ const dm = s.months - rec.months;
588
+ const dc = s.totalCost - rec.totalCost;
589
+ return `<span class="delta">${dm >= 0 ? '+' : '-'}${Math.abs(dm).toFixed(2)} mo &middot; `
590
+ + `${dc >= 0 ? '+' : '-'}$${Math.round(Math.abs(dc)).toLocaleString()} vs recommended</span>`;
591
+ }
592
+
593
+ function scenarioCard(id, s) {
594
+ const rec = id === DATA.inputs.recommendedScenario;
595
+ const input = DATA.inputs.scenarios.find((x) => x.id === id);
596
+ const max = Math.max(...Object.values(DATA.computed.scenarios).map((x) => x.months));
597
+ return `<article class="card scenario${rec ? ' recommended' : ''}">
598
+ ${rec ? '<span class="flag">recommended</span>' : ''}<h3>${id}</h3>
599
+ <div class="hero"><div><span class="num">${s.months.toFixed(2)}</span> <span class="unit">months</span></div>
600
+ <div class="gauge"><span style="width:${Math.round((s.months / max) * 100)}%"></span></div>
601
+ ${deltaChip(id, s)}</div>
602
+ <dl class="facts"><div><dt>team</dt><dd>${teamSummary(input.team)}</dd></div>
603
+ <div><dt>claude plan</dt><dd>${input.plan}</dd></div>
604
+ <div><dt>effort</dt><dd>${s.hours.toFixed(1)}h</dd></div>
605
+ <div><dt>total cost</dt><dd>${fmtMoney(s.totalCost)}</dd></div></dl></article>`;
606
+ }
607
+
608
+ function renderCards() {
609
+ const el = document.getElementById('scenario-cards');
610
+ if (!el) return;
611
+ const entries = Object.entries(DATA.computed.scenarios);
612
+ el.innerHTML = secHead('Delivery scenarios',
613
+ 'Each card is one committed way to staff and deliver the same scope. Months and cost are '
614
+ + 'computed from the same task hours; the highlighted card is the recommended estimate. '
615
+ + 'Sandbox variations live in the what-if panel.')
616
+ + `<div class="cards">${entries.map(([id, s]) => scenarioCard(id, s)).join('')}</div>`;
617
+ }
618
+
619
+ function renderBars() {
620
+ const el = document.getElementById('cost-bars');
621
+ if (!el) return;
622
+ const entries = Object.entries(DATA.computed.scenarios);
623
+ const max = Math.max(...entries.map(([, s]) => s.totalCost));
624
+ el.innerHTML = secHead('Total cost by scenario',
625
+ 'Labor (months × team rates) plus Claude plan seats, per scenario. Bar lengths are '
626
+ + 'proportional to the most expensive scenario.')
627
+ + `<div class="bar-group">${entries.map(([id, s]) => barRow({ label: id, value: s.totalCost,
628
+ max, text: fmtMoney(s.totalCost),
629
+ cls: id === DATA.inputs.recommendedScenario ? 'is-rec' : '' })).join('')}</div>`;
630
+ }
631
+
632
+ // One interactive section owns the feature story: bar-in-cell effort (was the
633
+ // effort chart), the sortable feature table, and the per-task drill-down (was
634
+ // the flat task register). Committed numbers only — never the what-if rail's.
635
+ const CONF_RANK = { HIGH: 0, MED: 1, LOW: 2 };
636
+ // Two levels max (schema-enforced), so a component's container is one parent
637
+ // hop at most; a top-level id is its own container.
638
+ const COMP_PARENT = Object.fromEntries((DATA.inputs.components ?? []).map((c) => [c.id, c.parent]));
639
+ const containerOf = (id) => COMP_PARENT[id] ?? id;
640
+ // One color per top-level container, shared by the donut and the roadmap
641
+ // segments so a hue means the same container everywhere on the page.
642
+ const CT_COLORS = ['#5a9fd4', '#d97757', '#3ba99f', '#d9b95e', '#9d86c9',
643
+ '#5dbb7a', '#c47a94', '#7c8f9e', '#c98a4b', '#a8a29e'];
644
+ const CT_TOPS = (DATA.inputs.components ?? []).filter((c) => !c.parent).map((c) => c.id);
645
+ const ctColor = (id) => CT_COLORS[CT_TOPS.indexOf(id) % CT_COLORS.length];
646
+ const CT_NAMES = Object.fromEntries((DATA.inputs.components ?? []).map((c) => [c.id, c.name]));
647
+
648
+ // Attributes for a row's first cell: a full-height container-colored stripe,
649
+ // named on hover. The shadow geometry lives in the td.ct-edge class; only the
650
+ // color travels inline, as a custom property — same pattern as the bar widths.
651
+ // No roster → no stripe, not a grey placeholder.
652
+ function ctEdge(component) {
653
+ if (!DATA.inputs.components) return '';
654
+ const id = containerOf(component);
655
+ return ` class="ct-edge" style="--ct-color:${ctColor(id)}" title="${esc(CT_NAMES[id] ?? id)}"`;
656
+ }
657
+ const bdState = { sortKey: 'hours', dir: -1, milestone: '', component: '', prov: '', group: false, expanded: new Set() };
658
+ const BD_COLS = [
659
+ { key: 'name', label: 'Feature', val: (f) => f.name, hint: 'sort by name' },
660
+ { key: 'hours', label: 'Effort (h)', val: (f) => f.hours, hint: 'sort by expected hours' },
661
+ { key: 'spread', label: 'Range', val: (f) => f.spread, cls: 'num',
662
+ hint: 'sort by spread (pessimistic minus optimistic)' },
663
+ { key: 'conf', label: 'Confidence', val: (f) => CONF_RANK[f.conf], hint: 'sort by confidence' },
664
+ { key: 'provenance', label: 'Source', val: (f) => f.provenance, hint: 'sort by source' },
665
+ ];
666
+
667
+ function breakdownData() {
668
+ return DATA.inputs.features.map((f) => {
669
+ const c = DATA.computed.features[f.id];
670
+ const conf = f.tasks.reduce(
671
+ (w, t) => (CONF_RANK[t.confidence] > CONF_RANK[w] ? t.confidence : w), 'HIGH');
672
+ return { id: f.id, name: f.name, milestone: f.milestone, component: f.component, provenance: f.provenance,
673
+ tasks: f.tasks, conf, hours: c.hours, low: c.low, high: c.high, spread: c.high - c.low };
674
+ });
675
+ }
676
+
677
+ // group is a primary key layered over the column sort: rows cluster by
678
+ // container (roster order — the palette's order) so the stripes read as the
679
+ // same blocks of color as the roadmap band that set the filter.
680
+ function bdSorted(list) {
681
+ const col = BD_COLS.find((c) => c.key === bdState.sortKey);
682
+ const ctRank = (f) => CT_TOPS.indexOf(containerOf(f.component));
683
+ return list.slice().sort((a, b) => {
684
+ const byGroup = bdState.group ? ctRank(a) - ctRank(b) : 0;
685
+ if (byGroup) return byGroup;
686
+ const [x, y] = [col.val(a), col.val(b)];
687
+ return (x < y ? -1 : x > y ? 1 : 0) * bdState.dir;
688
+ });
689
+ }
690
+
691
+ function bdVisible(list) {
692
+ return list.filter((f) => (!bdState.milestone || f.milestone === bdState.milestone)
693
+ && (!bdState.component || containerOf(f.component) === bdState.component)
694
+ && (!bdState.prov || f.provenance === bdState.prov));
695
+ }
696
+
697
+ function pillGroup({ name, pairs, attr, current }) {
698
+ return `<span class="bd-filter-group" role="group" aria-label="${name}">${pairs.map(([v, text]) =>
699
+ `<button type="button" ${attr}="${v}" aria-pressed="${v === current}" title="${v || text}">${text}</button>`).join('')}</span>`;
700
+ }
701
+
702
+ function bdExpandControls() {
703
+ return `<span class="bd-filter-group" ${INTERNAL_ATTR} role="group" aria-label="tasks">
704
+ <button type="button" data-expand="all">expand all</button>
705
+ <button type="button" data-expand="none">collapse all</button></span>`;
706
+ }
707
+
708
+ function selectBox({ name, key, current, pairs }) {
709
+ return `<label class="bd-filter-group bd-select">${name}<select data-select="${key}" aria-label="${name}">
710
+ ${pairs.map(([v, text]) =>
711
+ `<option value="${esc(v)}"${v === current ? ' selected' : ''}>${esc(text)}</option>`).join('')}</select></label>`;
712
+ }
713
+
714
+ function bdFilters(all) {
715
+ let milestones = '';
716
+ if (all.every((f) => f.milestone)) {
717
+ const labels = [...new Set(all.map((f) => f.milestone))];
718
+ milestones = selectBox({ name: 'milestone', key: 'milestone', current: bdState.milestone,
719
+ pairs: [['', 'all milestones'], ...labels.map((l) => [l, l])] });
720
+ }
721
+ let components = '';
722
+ if (DATA.inputs.components) {
723
+ const names = Object.fromEntries(DATA.inputs.components.map((c) => [c.id, c.name]));
724
+ const tops = [...new Set(all.map((f) => containerOf(f.component)))];
725
+ components = selectBox({ name: 'container', key: 'component', current: bdState.component,
726
+ pairs: [['', 'all containers'], ...tops.map((id) => [id, names[id] ?? id])] });
727
+ }
728
+ const source = pillGroup({ name: 'source', attr: 'data-prov', current: bdState.prov,
729
+ pairs: [['', 'all sources'], ['stated', 'stated'], ['proposed', 'proposed']] });
730
+ return `<div class="bd-filters">${milestones}${components}<span class="bd-right">${bdExpandControls()}${source}</span></div>`;
731
+ }
732
+
733
+ function bdHead() {
734
+ return `<thead><tr>${BD_COLS.map((c) => {
735
+ // grouping overrides the column order, so no header may claim its sort
736
+ const active = !bdState.group && bdState.sortKey === c.key;
737
+ const aria = active ? (bdState.dir === 1 ? 'ascending' : 'descending') : 'none';
738
+ const arrow = active ? (bdState.dir === 1 ? ' &#9650;' : ' &#9660;') : '';
739
+ return `<th aria-sort="${aria}"${c.cls ? ` class="${c.cls}"` : ''}>
740
+ <button type="button" data-sort="${c.key}" title="${c.hint}">${c.label}${arrow}</button></th>`;
741
+ }).join('')}</tr></thead>`;
742
+ }
743
+
744
+ function bdBar(f, max) {
745
+ const fill = Math.round((f.hours / max) * 100);
746
+ const tail = Math.round(((f.high - f.hours) / max) * 100);
747
+ return `<span class="bd-track" title="${f.tasks.length} tasks &middot; ${f.low}&ndash;${f.high}h span">
748
+ <span class="bd-fill" style="width:${fill}%"></span><span class="bd-tail" style="width:${tail}%"></span></span>`;
749
+ }
750
+
751
+ function featRow(f, max) {
752
+ const open = bdState.expanded.has(f.id);
753
+ return `<tr class="feat-row ${confLevel(f.conf)}" data-id="${f.id}">
754
+ <td${ctEdge(f.component)}><span class="feat-cell"><button type="button" class="expand" ${INTERNAL_ATTR}
755
+ aria-expanded="${open}" aria-label="show tasks">&#9656;</button>
756
+ <span>${f.name}</span></span></td>
757
+ <td><span class="bd-cell">${bdBar(f, max)}<span class="bd-num">${f.hours}</span></span></td>
758
+ <td class="num">${f.low}&ndash;${f.high}</td>
759
+ <td><span class="conf">${f.conf}</span></td>
760
+ <td><span class="tag ${f.provenance}">${f.provenance}</span></td></tr>`;
761
+ }
762
+
763
+ function taskRows(f) {
764
+ return f.tasks.map((t) => `<tr class="task-row ${confLevel(t.confidence)}" ${INTERNAL_ATTR}>
765
+ <td${ctEdge(f.component)}>${t.name}</td>
766
+ <td><span class="bd-cell"><span class="bd-num">${t.o}/${t.m}/${t.p}</span></span></td>
767
+ <td class="task-assump">${t.assumptions.join('; ') || 'none'}</td>
768
+ <td><span class="conf">${t.confidence}</span></td>
769
+ <td><span class="tag">${t.category}</span></td></tr>`).join('');
770
+ }
771
+
772
+ function renderBreakdown() {
773
+ const el = document.getElementById('feature-table');
774
+ if (!el) return;
775
+ const all = breakdownData();
776
+ const max = Math.max(...all.map((f) => f.high));
777
+ const rows = bdVisible(bdSorted(all))
778
+ .map((f) => featRow(f, max) + (bdState.expanded.has(f.id) ? taskRows(f) : '')).join('');
779
+ el.innerHTML = secHead('Feature breakdown',
780
+ 'Hours is the PERT expected value E = (O + 4M + P) / 6 summed over the feature’s tasks; '
781
+ + 'the bar shows E with a lighter tail to the pessimistic bound, so a long tail means an '
782
+ + 'uncertain feature. Sort any column, filter by milestone or source, and expand a row '
783
+ + 'for the tasks behind its number.')
784
+ + bdFilters(all) + `<div class="bd-scroll"><table>${bdHead()}<tbody>${rows}</tbody></table></div>`;
785
+ }
786
+
787
+ function bdSort(key) {
788
+ // an explicit sort takes control back from the roadmap grouping — and starts
789
+ // fresh at the column's default direction, since no sort was showing.
790
+ const fresh = bdState.group || bdState.sortKey !== key;
791
+ bdState.group = false;
792
+ if (fresh) { bdState.sortKey = key; bdState.dir = key === 'hours' || key === 'spread' ? -1 : 1; }
793
+ else bdState.dir = -bdState.dir;
794
+ renderBreakdown();
795
+ }
796
+
797
+ function bdToggle(id) {
798
+ if (bdState.expanded.has(id)) bdState.expanded.delete(id);
799
+ else bdState.expanded.add(id);
800
+ renderBreakdown();
801
+ }
802
+
803
+ function bdExpandAll(mode) {
804
+ bdState.expanded = mode === 'all'
805
+ ? new Set(DATA.inputs.features.map((f) => f.id)) : new Set();
806
+ renderBreakdown();
807
+ }
808
+
809
+ function onBreakdownClick(e) {
810
+ const btn = e.target.closest('button');
811
+ if (!btn) return;
812
+ if (btn.dataset.sort) bdSort(btn.dataset.sort);
813
+ else if (btn.dataset.expand) bdExpandAll(btn.dataset.expand);
814
+ else if (btn.dataset.prov !== undefined) { bdState.prov = btn.dataset.prov; renderBreakdown(); }
815
+ else if (btn.classList.contains('expand')) bdToggle(btn.closest('tr').dataset.id);
816
+ }
817
+
818
+ function onBreakdownChange(e) {
819
+ const sel = e.target.closest('select[data-select]');
820
+ if (!sel) return;
821
+ bdState[sel.dataset.select] = sel.value;
822
+ renderBreakdown();
823
+ }
824
+
825
+ // Slice ↔ legend row, both directions: a 2% donut slice is unhoverable-thin
826
+ // for reading, so pointing at it lights the row that names it — and pointing
827
+ // at a legend row lights its slice, so a name finds its arc just as easily.
828
+ function onPieHover(e) {
829
+ const id = e.target.closest?.('[data-ct]')?.dataset.ct;
830
+ const on = e.type === 'mouseover';
831
+ for (const el of document.querySelectorAll('#containers [data-ct]')) {
832
+ el.classList.toggle('hot', on && el.dataset.ct === id);
833
+ }
834
+ }
835
+
836
+ // A roadmap row is a shortcut into the breakdown: stale container/source
837
+ // filters would silently hide the milestone's rows, so the click clears them
838
+ // before filtering. Clicking the active row again clears the milestone too.
839
+ function onRoadmapClick(e) {
840
+ const row = e.target.closest('.roadmap-row');
841
+ if (!row) return;
842
+ bdState.milestone = bdState.milestone === row.dataset.milestone ? '' : row.dataset.milestone;
843
+ bdState.component = '';
844
+ bdState.prov = '';
845
+ // group the surviving rows by container so their stripes cluster like the
846
+ // clicked band's segments — same colors, same blocks, one story.
847
+ bdState.group = bdState.milestone !== '';
848
+ renderBreakdown();
849
+ document.getElementById('feature-table')?.scrollIntoView({ behavior: 'smooth', block: 'start' });
850
+ }
851
+
852
+ // Ticks are whole months (0, 1, 2…) once the span is long enough for that to
853
+ // read as a timeline; below that a whole-month grid would be a bare "0", so
854
+ // fall back to each band's own start/end. Either way ticks are computed once
855
+ // and shared by every row's gridlines and the axis strip below them — one
856
+ // coordinate system, not a per-row axis.
857
+ function roadmapTicks(total, roadmap) {
858
+ if (total >= 2) {
859
+ const whole = [];
860
+ for (let m = 0; m <= Math.floor(total); m++) whole.push(m);
861
+ return whole;
862
+ }
863
+ return [...new Set(roadmap.flatMap((b) => [b.startMonths, b.endMonths]))].sort((a, b) => a - b);
864
+ }
865
+
866
+ const tickPct = (m, total) => (total > 0 ? (m / total) * 100 : 0);
867
+
868
+ // Milestone names and feature lists are the only free text the roadmap draws, and
869
+ // they now land in an attribute as well as in the body — so both are escaped
870
+ // rather than the quote being left to break out of the title.
871
+ const esc = (s) => String(s).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/"/g, '&quot;');
872
+
873
+ // Inside a band, each top-level container the milestone touches gets a slice
874
+ // of the bar sized by its share of the milestone's hours — several colors is a
875
+ // vertical slice, one color is the horizontal-slice smell. Same palette as the
876
+ // donut. No roster → empty string, and the band keeps its solid accent fill.
877
+ function bandSegments(band) {
878
+ if (!DATA.computed.components) return '';
879
+ const compOf = Object.fromEntries(DATA.inputs.features.map((f) => [f.id, f.component]));
880
+ const names = Object.fromEntries(DATA.inputs.components.map((c) => [c.id, c.name]));
881
+ const hours = {};
882
+ for (const id of band.features) {
883
+ const c = containerOf(compOf[id]);
884
+ hours[c] = (hours[c] ?? 0) + DATA.computed.features[id].hours;
885
+ }
886
+ const sum = Object.values(hours).reduce((a, b) => a + b, 0);
887
+ return Object.entries(hours).map(([c, h]) =>
888
+ `<span class="roadmap-seg" style="width:${((h / sum) * 100).toFixed(2)}%;background:${ctColor(c)}"
889
+ title="${esc(`${names[c] ?? c} · ${h.toFixed(2)}h (${Math.round((h / sum) * 100)}%)`)}"></span>`).join('');
890
+ }
891
+
892
+ // total, names and ticks are one thing — the chart's scale, shared by every row
893
+ // and by the axis beneath them — so they travel together.
894
+ function roadmapRow(band, scale) {
895
+ const { total, names, ticks } = scale;
896
+ const left = (band.startMonths / total) * 100;
897
+ const width = ((band.endMonths - band.startMonths) / total) * 100;
898
+ const gridlines = ticks.map((m) => {
899
+ const pct = tickPct(m, total);
900
+ const style = pct <= 0 ? 'left:0' : pct >= 100 ? 'right:0' : `left:${pct}%`;
901
+ return `<span class="roadmap-gridline" style="${style}"></span>`;
902
+ }).join('');
903
+ // 150px of label column against "M1 - Foundation: the governed write path": every
904
+ // row clips, and a clipped Gantt label names nothing. Widening the column would
905
+ // cost the axis the span it needs, so each label carries its own full text as a
906
+ // hover title instead.
907
+ const feats = band.features.map((id) => names[id]);
908
+ return `<div class="roadmap-row" data-milestone="${esc(band.milestone)}">
909
+ <div class="roadmap-label"><span class="roadmap-name" title="${esc(band.milestone)}">${esc(band.milestone)}</span>
910
+ <span class="roadmap-feature-names" title="${esc(feats.join(' · '))}">${feats.map(esc).join(' &middot; ')}</span></div>
911
+ <div class="roadmap-track">${gridlines}<span class="roadmap-band" style="left:${left}%;width:${width}%">${bandSegments(band)}</span></div>
912
+ <span class="roadmap-months">${band.startMonths}&ndash;${band.endMonths} mo</span></div>`;
913
+ }
914
+
915
+ // The two edge ticks are pinned to the track's own edges instead of centered,
916
+ // so they never overhang the section.
917
+ function roadmapAxis({ total, ticks }) {
918
+ const tick = (m) => {
919
+ const pct = tickPct(m, total);
920
+ const style = pct <= 0 ? 'left:0;transform:none'
921
+ : pct >= 100 ? 'right:0;transform:none' : `left:${pct}%`;
922
+ return `<span style="${style}">${m}</span>`;
923
+ };
924
+ return `<div class="roadmap-axis"><span class="roadmap-axis-spacer"></span>
925
+ <div class="roadmap-axis-ticks">${ticks.map(tick).join('')}</div>
926
+ <span class="roadmap-axis-unit">months</span></div>`;
927
+ }
928
+
929
+ // Committed numbers only: the roadmap draws the recommended scenario as
930
+ // computed — the what-if rail owns every live number on this page.
931
+ function renderRoadmap() {
932
+ const el = document.getElementById('roadmap');
933
+ if (!el) return;
934
+ const roadmap = DATA.computed.scenarios[DATA.inputs.recommendedScenario]?.roadmap;
935
+ if (!roadmap) { el.remove(); return; }
936
+ const total = roadmap[roadmap.length - 1].endMonths;
937
+ const names = Object.fromEntries(DATA.inputs.features.map((f) => [f.id, f.name]));
938
+ const scale = { total, names, ticks: roadmapTicks(total, roadmap) };
939
+ el.innerHTML = secHead('Roadmap',
940
+ 'Sequential delivery by the recommended scenario team. Bands are relative months from '
941
+ + 'kickoff, not calendar dates; each milestone\'s width is its share of the work. Band '
942
+ + 'colors are the containers the milestone touches (same palette as the chart above). '
943
+ + 'Click a row to filter the breakdown below to that milestone, grouped by container.')
944
+ + `<div class="roadmap-chart">${roadmap.map((b) => roadmapRow(b, scale)).join('')}`
945
+ + `${roadmapAxis(scale)}</div>`;
946
+ }
947
+
948
+ // Committed numbers only, like every section: expected hours summed per
949
+ // top-level container (computed.components), drawn as a donut. A container
950
+ // the roster excused with notEstimated never becomes a zero-width slice —
951
+ // it keeps the honest words in the note under the chart instead.
952
+ function pieSlice([id, h], ctx) {
953
+ const share = (h / ctx.total) * 100;
954
+ const off = 25 - ctx.acc;
955
+ ctx.acc += share;
956
+ return `<circle class="pie-slice" data-ct="${esc(id)}" cx="21" cy="21" r="15.915" fill="none" pathLength="100"
957
+ stroke="${ctColor(id)}" stroke-width="7" stroke-dasharray="${share.toFixed(2)} ${(100 - share).toFixed(2)}"
958
+ stroke-dashoffset="${off.toFixed(2)}"><title>${esc(`${ctx.names[id] ?? id} · ${h}h (${Math.round(share)}%)`)}</title></circle>`;
959
+ }
960
+
961
+ function pieLegendRow([id, h], ctx) {
962
+ return `<li data-ct="${esc(id)}"><span class="swatch" style="background:${ctColor(id)}"></span>
963
+ <span>${esc(ctx.names[id] ?? id)}</span>
964
+ <span class="pie-hours">${h}h</span> <span class="pie-share">${Math.round((h / ctx.total) * 100)}%</span></li>`;
965
+ }
966
+
967
+ function pieNote() {
968
+ const excused = (DATA.inputs.components ?? []).filter((c) => c.notEstimated);
969
+ if (!excused.length) return '';
970
+ return `<p class="pie-note">Not estimated: ${excused.map((c) =>
971
+ `${esc(c.name)} (${esc(c.notEstimated)})`).join('; ')}. In the architecture, no sized work yet.</p>`;
972
+ }
973
+
974
+ function renderContainers() {
975
+ const el = document.getElementById('containers');
976
+ if (!el) return;
977
+ const comp = DATA.computed.components;
978
+ if (!comp) { el.remove(); return; }
979
+ const names = Object.fromEntries(DATA.inputs.components.map((c) => [c.id, c.name]));
980
+ const entries = Object.entries(comp).filter(([, h]) => h > 0).sort(([, a], [, b]) => b - a);
981
+ const ctx = { names, total: entries.reduce((s, [, h]) => s + h, 0), acc: 0 };
982
+ el.innerHTML = secHead('Effort by container',
983
+ 'Share of expected hours per top-level container, from the same task numbers as the '
984
+ + 'breakdown. The colors match the roadmap bands. A container nobody sized is named '
985
+ + 'under the chart, never drawn as a zero slice.')
986
+ + `<div class="pie-wrap"><svg viewBox="0 0 42 42" role="img" aria-label="effort share by container">
987
+ ${entries.map((e) => pieSlice(e, ctx)).join('')}</svg>
988
+ <ul class="pie-legend">${entries.map((e) => pieLegendRow(e, { ...ctx, acc: 0 })).join('')}</ul></div>${pieNote()}`;
989
+ }
990
+
991
+ // Assembled at runtime for the same reason as CTL_SUFFIX above: the task
992
+ // drill-down is per-task WBS detail, not meant for the client view, so its
993
+ // rows and expand buttons carry the internal-hide attribute — but that
994
+ // attribute name must never appear as page text in a --client-only export.
995
+ const INTERNAL_ATTR = ['data', 'internal'].join('-');
996
+
997
+ function renderRegister() {
998
+ const el = document.getElementById('register');
999
+ if (!el) return;
1000
+ const riskRows = DATA.inputs.risks.map((r) => `<tr><td>${r.name}</td><td class="num">${Math.round(r.probability * 100)}%</td><td class="num">${r.impactHours}h</td></tr>`).join('');
1001
+ el.innerHTML = `<table><caption>Risk register ${help(
1002
+ 'Each risk adds probability &times; impact hours to the risk buffer, so unlikely-but-costly '
1003
+ + 'events are priced in without padding every task.')}</caption>
1004
+ <thead><tr><th>Risk</th><th class="num">Probability</th><th class="num">Impact</th></tr></thead>
1005
+ <tbody>${riskRows}</tbody></table>`;
1006
+ }
1007
+
1008
+ // The words are static; every number shown is read from inputs, never derived.
1009
+ // Collapsed by default: the title row names the technique, the fold carries
1010
+ // the full pipeline and sources for whoever wants them.
1011
+ function renderMethod() {
1012
+ const el = document.getElementById('method');
1013
+ if (!el) return;
1014
+ const pct = (v) => `${Math.round(v * 100)}%`;
1015
+ el.innerHTML = `<details class="method-fold" open><summary><h2>Method</h2>
1016
+ <span class="tech">${DATA.inputs.technique} &middot; depth ${DATA.inputs.depth}</span>
1017
+ <span class="chev" aria-hidden="true">&#9656;</span></summary>
1018
+ <ul>
1019
+ <li>Each task is sized with three points (optimistic / most-likely / pessimistic);
1020
+ expected hours use PERT: E = (O + 4M + P) / 6, spread &sigma; = (P &minus; O) / 6.</li>
1021
+ <li>Two buffers are added once, at project level: an estimate-spread buffer
1022
+ (&radic;&Sigma;&sigma;&sup2; across tasks) and a risk buffer (&Sigma; probability &times;
1023
+ impact from the risk register). Overhead adds ${pct(DATA.inputs.overheadPct)} for
1024
+ meetings, review, and coordination.</li>
1025
+ <li>AI-assisted scenarios reduce each task by its category — boilerplate 50&ndash;80%,
1026
+ logic 20&ndash;40%, novel 0&ndash;10% — blended as (AO + 2AR + TR) / 4, plus
1027
+ ${pct(DATA.inputs.verificationPct)} verification overhead on AI output. There is no
1028
+ blanket project-wide multiplier: the reduction is judged per task.</li>
1029
+ <li>Seniority scales base effort (junior +15%, senior &minus;15%); team capacity pays a
1030
+ 10% coordination tax per engineer added.</li>
1031
+ <li>The confidence badge is the worst task confidence on the largest feature —
1032
+ an estimate is only as strong as its critical path.</li>
1033
+ </ul>
1034
+ <p class="sources"><span>PERT and three-point estimation (US Navy, 1958), buffers, ranges,
1035
+ and risk registers — Atomic Object, atomicobject.com/client-resources/better-custom-software-estimates.</span>
1036
+ <span>AI speedup categories and the blended formula — Kmino,
1037
+ kmino.io/blog/software-estimation-with-ai (practitioner observations, not peer-reviewed).</span>
1038
+ <span>Scenario and tier structure — Modular Earth solutions-architecture-agent,
1039
+ github.com/Modular-Earth-LLC/solutions-architecture-agent.</span></p></details>`;
1040
+ }
1041
+
1042
+ // Live feedback at the point of interaction: the sticky rail is usually on
1043
+ // screen while the custom card is not, so the rail repeats the custom rollup.
1044
+ function renderReadout(custom) {
1045
+ const el = document.getElementById('whatif-readout');
1046
+ if (!el) return;
1047
+ el.innerHTML = Number.isFinite(custom.totalCost)
1048
+ ? `<p class="months"><span class="num">${custom.months.toFixed(2)}</span>months</p>
1049
+ <dl><div><dt>total cost</dt><dd>${fmtMoney(custom.totalCost)}</dd></div>
1050
+ <div><dt>effort</dt><dd>${custom.hours.toFixed(1)}h</dd></div></dl>`
1051
+ : '';
1052
+ }
1053
+
1054
+ function renderAll(defaults) {
1055
+ renderCards();
1056
+ renderBars();
1057
+ renderRoadmap();
1058
+ renderContainers();
1059
+ renderBreakdown();
1060
+ renderRegister();
1061
+ renderMethod();
1062
+ renderReadout(recompute(currentParams(defaults)));
1063
+ }
1064
+
1065
+ const defaults = defaultsFromRecommended();
1066
+
1067
+ function applyDefaults() {
1068
+ setControls(defaults);
1069
+ renderTeam(defaults.team);
1070
+ syncOutputs();
1071
+ renderAll(defaults);
1072
+ }
1073
+ applyDefaults();
1074
+
1075
+ function onWhatIfChange() {
1076
+ syncOutputs();
1077
+ renderAll(defaults);
1078
+ const banner = document.getElementById('modified-banner');
1079
+ if (banner) banner.hidden = false;
1080
+ }
1081
+
1082
+ CTL_KEYS.forEach((key) => document.getElementById(ctlId(key))?.addEventListener('input', onWhatIfChange));
1083
+ teamBox()?.addEventListener('input', (e) => {
1084
+ if (e.target.matches('select')) {
1085
+ const rate = RATE_BY_SENIORITY[e.target.value];
1086
+ if (rate != null) e.target.closest('.team-row').querySelector('input').value = rate;
1087
+ }
1088
+ onWhatIfChange();
1089
+ });
1090
+ teamBox()?.addEventListener('click', (e) => {
1091
+ if (e.target.matches('.team-add')) {
1092
+ e.target.before(teamRow(currentTeam(defaults).at(-1)));
1093
+ } else if (e.target.matches('.team-del')) {
1094
+ e.target.closest('.team-row').remove();
1095
+ } else return;
1096
+ syncTeamButtons();
1097
+ onWhatIfChange();
1098
+ });
1099
+
1100
+ document.getElementById('reset')?.addEventListener('click', () => {
1101
+ applyDefaults();
1102
+ const banner = document.getElementById('modified-banner');
1103
+ if (banner) banner.hidden = true;
1104
+ });
1105
+
1106
+ document.getElementById('feature-table')?.addEventListener('click', onBreakdownClick);
1107
+ document.getElementById('feature-table')?.addEventListener('change', onBreakdownChange);
1108
+ document.getElementById('roadmap')?.addEventListener('click', onRoadmapClick);
1109
+ document.getElementById('containers')?.addEventListener('mouseover', onPieHover);
1110
+ document.getElementById('containers')?.addEventListener('mouseout', onPieHover);
1111
+
1112
+ document.getElementById('view-toggle')?.addEventListener('click', () => {
1113
+ document.body.classList.toggle('view-client');
1114
+ });
1115
+
1116
+ document.getElementById('theme-toggle')?.addEventListener('click', () => {
1117
+ const root = document.documentElement;
1118
+ root.dataset.theme = root.dataset.theme === 'dark' ? 'light' : 'dark';
1119
+ });
1120
+
1121
+ // A collapsed <details> prints as its summary line only — force the method
1122
+ // fold open on print so the paper copy still explains itself.
1123
+ window.addEventListener('beforeprint', () => {
1124
+ document.querySelector('#method details.method-fold')?.setAttribute('open', '');
1125
+ });
1126
+ </script>
1127
+ </body>
1128
+ </html>