@v11g/agents-rock 1.0.9 → 1.0.10

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 (246) hide show
  1. package/README.md +1 -0
  2. package/package.json +2 -2
  3. package/plugins/business-analyst/.claude-plugin/plugin.json +1 -1
  4. package/plugins/business-analyst/evals/ba-interview-conflict/graders/conflict-quoted.md +15 -0
  5. package/plugins/business-analyst/evals/ba-interview-conflict/graders/no-internal-ids.md +9 -0
  6. package/plugins/business-analyst/evals/ba-interview-conflict/graders/one-question.md +15 -0
  7. package/plugins/business-analyst/evals/ba-interview-conflict/graders/skill-fired.md +7 -0
  8. package/plugins/business-analyst/evals/ba-interview-conflict/prompt.md +31 -0
  9. package/plugins/business-analyst/evals/ba-interview-first-turn/graders/no-internal-ids.md +9 -0
  10. package/plugins/business-analyst/evals/ba-interview-first-turn/graders/no-setup-questions.md +16 -0
  11. package/plugins/business-analyst/evals/ba-interview-first-turn/graders/one-scope-question.md +19 -0
  12. package/plugins/business-analyst/evals/ba-interview-first-turn/graders/skill-fired.md +7 -0
  13. package/plugins/business-analyst/evals/ba-interview-first-turn/prompt.md +31 -0
  14. package/plugins/business-analyst/evals/ba-review-page/case.yaml +4 -0
  15. package/plugins/business-analyst/evals/ba-review-page/fixture.sh +12 -0
  16. package/plugins/business-analyst/evals/ba-review-page/graders/decide-in-interview.md +26 -0
  17. package/plugins/business-analyst/evals/ba-review-page/graders/skill-fired.md +7 -0
  18. package/plugins/business-analyst/evals/ba-review-page/prompt.md +9 -0
  19. package/plugins/business-analyst/skills/business-analyst/README.md +8 -0
  20. package/plugins/business-analyst/skills/business-analyst/SKILL.md +47 -16
  21. package/plugins/business-analyst/skills/business-analyst/assets/review-page.html +68 -0
  22. package/plugins/business-analyst/skills/business-analyst/evals/evals.json +1 -1
  23. package/plugins/business-analyst/skills/business-analyst/references/frameworks.md +3 -2
  24. package/plugins/business-analyst/skills/business-analyst/references/interview.md +156 -8
  25. package/plugins/business-analyst/skills/business-analyst/references/review.md +18 -4
  26. package/plugins/business-analyst/skills/business-analyst/references/writing.md +49 -8
  27. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/review_data.cpython-312.pyc +0 -0
  28. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/review_layout.cpython-312.pyc +0 -0
  29. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/review_page.cpython-312.pyc +0 -0
  30. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/scope_checks.cpython-312.pyc +0 -0
  31. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/scope_render.cpython-312.pyc +0 -0
  32. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/validate.cpython-312.pyc +0 -0
  33. package/plugins/business-analyst/skills/business-analyst/scripts/lib/checks.mjs +12 -6
  34. package/plugins/business-analyst/skills/business-analyst/scripts/lib/review-data.mjs +66 -0
  35. package/plugins/business-analyst/skills/business-analyst/scripts/lib/review-layout.mjs +53 -0
  36. package/plugins/business-analyst/skills/business-analyst/scripts/lib/review-page.mjs +78 -0
  37. package/plugins/business-analyst/skills/business-analyst/scripts/lib/scope-checks.mjs +73 -0
  38. package/plugins/business-analyst/skills/business-analyst/scripts/lib/scope-md.mjs +53 -0
  39. package/plugins/business-analyst/skills/business-analyst/scripts/lib/scope-render.mjs +72 -0
  40. package/plugins/business-analyst/skills/business-analyst/scripts/lib/scope-rules.mjs +90 -0
  41. package/plugins/business-analyst/skills/business-analyst/scripts/review.mjs +48 -0
  42. package/plugins/business-analyst/skills/business-analyst/scripts/review.py +60 -0
  43. package/plugins/business-analyst/skills/business-analyst/scripts/review_data.py +81 -0
  44. package/plugins/business-analyst/skills/business-analyst/scripts/review_layout.py +50 -0
  45. package/plugins/business-analyst/skills/business-analyst/scripts/review_page.py +115 -0
  46. package/plugins/business-analyst/skills/business-analyst/scripts/scope.mjs +24 -0
  47. package/plugins/business-analyst/skills/business-analyst/scripts/scope.py +35 -0
  48. package/plugins/business-analyst/skills/business-analyst/scripts/scope_checks.py +168 -0
  49. package/plugins/business-analyst/skills/business-analyst/scripts/scope_render.py +140 -0
  50. package/plugins/business-analyst/skills/business-analyst/scripts/test/checks.test.mjs +27 -0
  51. package/plugins/business-analyst/skills/business-analyst/scripts/test/fixtures/requirements-workflow-pass.json +78 -0
  52. package/plugins/business-analyst/skills/business-analyst/scripts/test/fixtures/requirements-workflow-pass.md +136 -0
  53. package/plugins/business-analyst/skills/business-analyst/scripts/test/python-parity.test.mjs +88 -0
  54. package/plugins/business-analyst/skills/business-analyst/scripts/test/quality-gates.test.mjs +26 -0
  55. package/plugins/business-analyst/skills/business-analyst/scripts/test/review-browser.test.mjs +106 -0
  56. package/plugins/business-analyst/skills/business-analyst/scripts/test/review-fixture.mjs +32 -0
  57. package/plugins/business-analyst/skills/business-analyst/scripts/test/review-page.test.mjs +340 -0
  58. package/plugins/business-analyst/skills/business-analyst/scripts/test/review-parity.test.mjs +79 -0
  59. package/plugins/business-analyst/skills/business-analyst/scripts/test/scope-cases.mjs +58 -0
  60. package/plugins/business-analyst/skills/business-analyst/scripts/test/scope-checks.test.mjs +31 -0
  61. package/plugins/business-analyst/skills/business-analyst/scripts/test/scope-md.test.mjs +140 -0
  62. package/plugins/business-analyst/skills/business-analyst/scripts/validate.mjs +1 -1
  63. package/plugins/business-analyst/skills/business-analyst/scripts/validate.py +17 -8
  64. package/plugins/solution-architect/evals/proposal-workflow/case.yaml +6 -0
  65. package/plugins/solution-architect/evals/proposal-workflow/fixture.sh +6 -0
  66. package/plugins/solution-architect/evals/proposal-workflow/graders/inputs-written.md +23 -0
  67. package/plugins/solution-architect/evals/proposal-workflow/graders/no-proposal-md.md +7 -0
  68. package/plugins/solution-architect/evals/proposal-workflow/graders/skill-fired.md +7 -0
  69. package/plugins/solution-architect/evals/proposal-workflow/graders/validate-then-render.md +16 -0
  70. package/plugins/solution-architect/evals/proposal-workflow/prompt.md +10 -0
  71. package/plugins/solution-architect/evals/workflow-gate-no-architecture/case.yaml +4 -0
  72. package/plugins/solution-architect/evals/workflow-gate-no-architecture/fixture.sh +6 -0
  73. package/plugins/solution-architect/evals/workflow-gate-no-architecture/graders/no-classic-fallback.md +10 -0
  74. package/plugins/solution-architect/evals/workflow-gate-no-architecture/graders/nothing-written.md +7 -0
  75. package/plugins/solution-architect/evals/workflow-gate-no-architecture/graders/skill-fired.md +7 -0
  76. package/plugins/solution-architect/evals/workflow-gate-no-architecture/graders/stops-at-gate.md +11 -0
  77. package/plugins/solution-architect/evals/workflow-gate-no-architecture/prompt.md +7 -0
  78. package/plugins/solution-architect/evals/workflow-happy-path/case.yaml +4 -0
  79. package/plugins/solution-architect/evals/workflow-happy-path/fixture.sh +6 -0
  80. package/plugins/solution-architect/evals/workflow-happy-path/graders/no-estimation-md.md +7 -0
  81. package/plugins/solution-architect/evals/workflow-happy-path/graders/pages-or-stop.md +16 -0
  82. package/plugins/solution-architect/evals/workflow-happy-path/graders/routed-to-workflow.md +12 -0
  83. package/plugins/solution-architect/evals/workflow-happy-path/graders/skill-fired.md +7 -0
  84. package/plugins/solution-architect/evals/workflow-happy-path/graders/three-questions-max.md +14 -0
  85. package/plugins/solution-architect/evals/workflow-happy-path/graders/workflow-or-exact-stop.md +15 -0
  86. package/plugins/solution-architect/evals/workflow-happy-path/prompt.md +9 -0
  87. package/plugins/solution-architect/skills/analyze-requirements/assets/viewer-template.html +11 -1
  88. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/browser.test.mjs +27 -0
  89. package/plugins/solution-architect/skills/estimate/README.md +18 -3
  90. package/plugins/solution-architect/skills/estimate/SKILL.md +18 -75
  91. package/plugins/solution-architect/skills/estimate/classic/FLOW.md +77 -0
  92. package/plugins/solution-architect/skills/estimate/classic/assets/estimate-template.html +1337 -0
  93. package/plugins/solution-architect/skills/estimate/{references → classic/references}/task-shapes.md +1 -1
  94. package/plugins/solution-architect/skills/estimate/{references → classic/references}/writing.md +2 -2
  95. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/compute.mjs +1 -1
  96. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/checks.mjs +1 -1
  97. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/roadmap.mjs +1 -1
  98. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/rollup.mjs +5 -5
  99. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/schema.mjs +4 -26
  100. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/score-csv.mjs +2 -2
  101. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/score-html.mjs +2 -2
  102. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/render.mjs +8 -7
  103. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/score-review.mjs +3 -3
  104. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/baselines.test.mjs +3 -3
  105. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/browser-agentic.test.mjs +2 -2
  106. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/browser.test.mjs +2 -2
  107. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/compute.test.mjs +1 -1
  108. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/e2e.test.mjs +6 -6
  109. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/estimate-math.test.mjs +3 -3
  110. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/measurements.test.mjs +1 -1
  111. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/pricing.test.mjs +1 -1
  112. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/project-price.test.mjs +1 -1
  113. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/quality-gates.test.mjs +7 -1
  114. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/references.test.mjs +6 -6
  115. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/render.test.mjs +3 -3
  116. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/schema.test.mjs +1 -1
  117. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/score-review.test.mjs +6 -6
  118. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/scoring.test.mjs +1 -1
  119. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/url-state.test.mjs +2 -2
  120. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/validate.test.mjs +1 -1
  121. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/xlsx-export.test.mjs +3 -3
  122. package/plugins/solution-architect/skills/estimate/classic/scripts/test/zip-store.test.mjs +26 -0
  123. package/plugins/solution-architect/skills/estimate/evals/evals.json +37 -2
  124. package/plugins/solution-architect/skills/estimate/evals/fixtures/workflow-sin-kowa-mini/ARCHITECTURE.md +28 -0
  125. package/plugins/solution-architect/skills/estimate/evals/fixtures/workflow-sin-kowa-mini/requirements.json +79 -0
  126. package/plugins/solution-architect/skills/estimate/evals/fixtures/workflow-sin-kowa-mini/requirements.md +141 -0
  127. package/plugins/solution-architect/skills/estimate/shared/assets/xlsx-export.js +336 -0
  128. package/plugins/solution-architect/skills/estimate/shared/lib/agentic-task-schema.mjs +24 -0
  129. package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/context-schema.mjs +2 -2
  130. package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/inline.mjs +8 -0
  131. package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/scoring-schema.mjs +1 -1
  132. package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/scoring.mjs +1 -1
  133. package/plugins/solution-architect/skills/estimate/shared/lib/zip.mjs +60 -0
  134. package/plugins/solution-architect/skills/estimate/workflow-based/FLOW.md +91 -0
  135. package/plugins/solution-architect/skills/estimate/workflow-based/assets/estimate-components.html +994 -0
  136. package/plugins/solution-architect/skills/estimate/workflow-based/assets/estimate-template.html +440 -0
  137. package/plugins/solution-architect/skills/estimate/workflow-based/assets/estimator-system.xlsx +0 -0
  138. package/plugins/solution-architect/skills/estimate/workflow-based/assets/score-review.html +838 -0
  139. package/plugins/solution-architect/skills/estimate/workflow-based/references/hidden-work-by-type.md +429 -0
  140. package/plugins/solution-architect/skills/estimate/workflow-based/references/linking.md +59 -0
  141. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/build-components-template.mjs +80 -0
  142. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/build-template.mjs +60 -0
  143. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/build-workflow-template.mjs +51 -0
  144. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/build-xlsx-template.py +144 -0
  145. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/compute.mjs +32 -0
  146. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/page-html.mjs +44 -0
  147. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/page-view.mjs +71 -0
  148. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/pair-findings.mjs +19 -0
  149. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/requirements.mjs +33 -0
  150. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/rollup.mjs +66 -0
  151. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/schema-components.mjs +69 -0
  152. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/schema.mjs +70 -0
  153. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/score-diff.mjs +54 -0
  154. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/score-html.mjs +52 -0
  155. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/xlsx-rows.mjs +51 -0
  156. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/render.mjs +42 -0
  157. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/score-review.mjs +46 -0
  158. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/template/arch-link.js +9 -0
  159. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/template/click.js +28 -0
  160. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/template/prelude.js +4 -0
  161. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/template/view.js +63 -0
  162. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/browser.test.mjs +127 -0
  163. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/build-pages.test.mjs +43 -0
  164. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/build-template.test.mjs +18 -0
  165. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/cli.test.mjs +48 -0
  166. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/estimator-system.test.mjs +66 -0
  167. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/fixtures/ARCHITECTURE-mini.md +31 -0
  168. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/fixtures/feedback.json +19 -0
  169. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/fixtures/inputs-pass.json +80 -0
  170. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/fixtures/measurements.jsonl +0 -0
  171. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/fixtures/requirements.json +79 -0
  172. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/page-view.test.mjs +54 -0
  173. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/pages-browser.test.mjs +209 -0
  174. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/quality-gates.test.mjs +25 -0
  175. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/render.test.mjs +54 -0
  176. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/requirements.test.mjs +33 -0
  177. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/rollup.test.mjs +80 -0
  178. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/schema.test.mjs +61 -0
  179. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/score-review.test.mjs +108 -0
  180. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/stage.mjs +32 -0
  181. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/workflow-script.test.mjs +24 -0
  182. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/xlsx-rows.test.mjs +58 -0
  183. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/validate.mjs +19 -0
  184. package/plugins/solution-architect/skills/proposal/README.md +13 -0
  185. package/plugins/solution-architect/skills/proposal/SKILL.md +8 -0
  186. package/plugins/solution-architect/skills/proposal/assets/proposal-workflow.html +143 -0
  187. package/plugins/solution-architect/skills/proposal/evals/fixtures/workflow-sin-kowa-mini/ARCHITECTURE.md +31 -0
  188. package/plugins/solution-architect/skills/proposal/evals/fixtures/workflow-sin-kowa-mini/estimation-inputs.json +468 -0
  189. package/plugins/solution-architect/skills/proposal/evals/fixtures/workflow-sin-kowa-mini/estimation.json +773 -0
  190. package/plugins/solution-architect/skills/proposal/evals/fixtures/workflow-sin-kowa-mini/measurements.jsonl +0 -0
  191. package/plugins/solution-architect/skills/proposal/evals/fixtures/workflow-sin-kowa-mini/requirements.json +79 -0
  192. package/plugins/solution-architect/skills/proposal/references/review.md +11 -0
  193. package/plugins/solution-architect/skills/proposal/references/workflow.md +88 -0
  194. package/plugins/solution-architect/skills/proposal/scripts/lib/docx-body.mjs +42 -0
  195. package/plugins/solution-architect/skills/proposal/scripts/lib/docx-package.mjs +56 -0
  196. package/plugins/solution-architect/skills/proposal/scripts/lib/docx-xml.mjs +44 -0
  197. package/plugins/solution-architect/skills/proposal/scripts/lib/workflow-checks.mjs +71 -0
  198. package/plugins/solution-architect/skills/proposal/scripts/lib/workflow-cli.mjs +46 -0
  199. package/plugins/solution-architect/skills/proposal/scripts/lib/workflow-html.mjs +39 -0
  200. package/plugins/solution-architect/skills/proposal/scripts/lib/workflow-lead.mjs +45 -0
  201. package/plugins/solution-architect/skills/proposal/scripts/lib/workflow-page.mjs +30 -0
  202. package/plugins/solution-architect/skills/proposal/scripts/lib/workflow-view.mjs +80 -0
  203. package/plugins/solution-architect/skills/proposal/scripts/render.mjs +5 -1
  204. package/plugins/solution-architect/skills/proposal/scripts/test/docx.test.mjs +68 -0
  205. package/plugins/solution-architect/skills/proposal/scripts/test/e2e.test.mjs +2 -2
  206. package/plugins/solution-architect/skills/proposal/scripts/test/evals-fixtures.test.mjs +9 -2
  207. package/plugins/solution-architect/skills/proposal/scripts/test/fixtures/proposal-inputs-pass.json +17 -0
  208. package/plugins/solution-architect/skills/proposal/scripts/test/render.test.mjs +2 -2
  209. package/plugins/solution-architect/skills/proposal/scripts/test/validate.test.mjs +2 -2
  210. package/plugins/solution-architect/skills/proposal/scripts/test/workflow-browser.test.mjs +96 -0
  211. package/plugins/solution-architect/skills/proposal/scripts/test/workflow-checks.test.mjs +98 -0
  212. package/plugins/solution-architect/skills/proposal/scripts/test/workflow-docs.test.mjs +25 -0
  213. package/plugins/solution-architect/skills/proposal/scripts/test/workflow-render.test.mjs +75 -0
  214. package/plugins/solution-architect/skills/proposal/scripts/test/workflow-stage.mjs +15 -0
  215. package/plugins/solution-architect/skills/proposal/scripts/test/workflow-view.test.mjs +78 -0
  216. package/plugins/solution-architect/skills/proposal/scripts/validate.mjs +4 -1
  217. package/plugins/solution-architect/workflows/review-links.js +61 -0
  218. package/plugins/solution-architect/skills/estimate/assets/estimate-template.html +0 -1677
  219. /package/plugins/solution-architect/skills/estimate/{assets → classic/assets}/estimate-template-agentic.html +0 -0
  220. /package/plugins/solution-architect/skills/estimate/{assets → classic/assets}/scores-review-template.html +0 -0
  221. /package/plugins/solution-architect/skills/estimate/{references → classic/references}/agentic-estimation.md +0 -0
  222. /package/plugins/solution-architect/skills/estimate/{references → classic/references}/ai-multipliers.md +0 -0
  223. /package/plugins/solution-architect/skills/estimate/{references → classic/references}/interview.md +0 -0
  224. /package/plugins/solution-architect/skills/estimate/{references → classic/references}/scoring-guide.md +0 -0
  225. /package/plugins/solution-architect/skills/estimate/{references → classic/references}/slicing.md +0 -0
  226. /package/plugins/solution-architect/skills/estimate/{references → classic/references}/techniques.md +0 -0
  227. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/agentic-checks.mjs +0 -0
  228. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/components.mjs +0 -0
  229. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/md-tables.mjs +0 -0
  230. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/redact.mjs +0 -0
  231. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/scoring-checks.mjs +0 -0
  232. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/fixtures/agentic-estimation-fail.md +0 -0
  233. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/fixtures/agentic-estimation-pass.md +0 -0
  234. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/fixtures/agentic-inputs.json +0 -0
  235. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/fixtures/booking-inputs.json +0 -0
  236. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/fixtures/estimation-fail.md +0 -0
  237. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/fixtures/estimation-pass.md +0 -0
  238. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/fixtures/measurements.jsonl +0 -0
  239. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/zip.mjs +0 -0
  240. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/validate.mjs +0 -0
  241. /package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/baselines.mjs +0 -0
  242. /package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/estimate-math.mjs +0 -0
  243. /package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/measurements.mjs +0 -0
  244. /package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/pricing.mjs +0 -0
  245. /package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/project-price.mjs +0 -0
  246. /package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/score-diff.mjs +0 -0
@@ -0,0 +1,994 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <title><!-- slot:TITLE --> — estimate (component-based)</title>
7
+ <style>
8
+ :root {
9
+ color-scheme:light;
10
+ --paper:#e8ecef; --sheet:#fbfcfd; --ink:#141c24; --ink-dim:#5d6c78;
11
+ --rule:#d3dbe1; --grid:#edf1f4; --meter:#44586a; --mark:#b4232f; --mark-soft:#b4232f14;
12
+ --ok:#2f6b4a; --ok-soft:#2f6b4a14; --hi:#fbf1cf; --hi-line:#c8960c;
13
+ --t-s:#dfe6ec; --t-s-ink:#4a5a68; --t-m:#c3d2df; --t-m-ink:#2b3d4c; --t-l:#7d96ab; --t-l-ink:#fff; --t-xl:#2f4a60; --t-xl-ink:#fff;
14
+ --serif:"Iowan Old Style","Palatino Linotype",Palatino,Georgia,"Liberation Serif",serif;
15
+ --sans:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
16
+ }
17
+ @media (prefers-color-scheme:dark) { :root:not([data-theme="light"]) {
18
+ color-scheme:dark; --paper:#11171c; --sheet:#1a2229; --ink:#e6ecf1; --ink-dim:#93a3b0;
19
+ --rule:#2c3740; --grid:#222c34; --meter:#8fa8bb; --mark:#e26c60; --mark-soft:#e26c6021;
20
+ --ok:#7cc39a; --ok-soft:#7cc39a1c; --hi:#3b3519; --hi-line:#d9a92a;
21
+ --t-s:#263039; --t-s-ink:#9fb0bd; --t-m:#3a4a57; --t-m-ink:#d3dfe8; --t-l:#7d96ab; --t-l-ink:#0f161b; --t-xl:#bacdda; --t-xl-ink:#0f161b; } }
22
+ :root[data-theme="dark"] {
23
+ color-scheme:dark; --paper:#11171c; --sheet:#1a2229; --ink:#e6ecf1; --ink-dim:#93a3b0;
24
+ --rule:#2c3740; --grid:#222c34; --meter:#8fa8bb; --mark:#e26c60; --mark-soft:#e26c6021;
25
+ --ok:#7cc39a; --ok-soft:#7cc39a1c; --hi:#3b3519; --hi-line:#d9a92a;
26
+ --t-s:#263039; --t-s-ink:#9fb0bd; --t-m:#3a4a57; --t-m-ink:#d3dfe8; --t-l:#7d96ab; --t-l-ink:#0f161b; --t-xl:#bacdda; --t-xl-ink:#0f161b; }
27
+ * { box-sizing:border-box; }
28
+ body { margin:0; padding:2rem 1.5rem 6rem; background:var(--paper); color:var(--ink); font-family:var(--sans); font-size:.9rem; line-height:1.5; }
29
+ .page { max-width:78rem; margin:0 auto; }
30
+ :focus-visible { outline:2px solid var(--ink); outline-offset:2px; }
31
+ button, input, textarea { font:inherit; color:var(--ink); }
32
+ .hide { display:none !important; }
33
+ .mock { background:var(--mark); color:#fff; font-size:.72rem; font-weight:600; letter-spacing:.04em; padding:.2rem .6rem; display:inline-block; border-radius:.2rem; margin-bottom:.8rem; }
34
+ .head { display:flex; justify-content:space-between; gap:1rem; align-items:flex-start; }
35
+ h1 { font-family:var(--serif); font-size:2.1rem; font-weight:600; letter-spacing:-.015em; margin:0; }
36
+ .sub { margin:.15rem 0 .9rem; color:var(--ink-dim); font-size:.82rem; }
37
+ .lead { margin:0 0 1.2rem; max-width:70ch; color:var(--ink-dim); }
38
+ .btn { font-size:.78rem; font-weight:600; padding:.3rem .7rem; color:var(--ink-dim); background:var(--sheet); border:1px solid var(--rule); border-radius:.2rem; cursor:pointer; }
39
+ .btn:hover { color:var(--ink); border-color:var(--ink-dim); }
40
+ .btn.primary { background:var(--ink); color:var(--sheet); border-color:var(--ink); }
41
+ .btn.next { border-color:var(--mark); color:var(--mark); }
42
+ .btn:disabled { opacity:.55; cursor:default; }
43
+ .internal { font-size:.7rem; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:var(--mark); border:1px solid var(--mark); padding:0 .4rem; border-radius:.2rem; margin-left:.4rem; vertical-align:middle; }
44
+
45
+ /* strip */
46
+ .strip { display:grid; grid-template-columns:repeat(auto-fit,minmax(9rem,1fr)); background:var(--sheet); border:1px solid var(--rule); margin-bottom:1rem; }
47
+ .strip div { padding:.6rem .9rem; border-left:1px solid var(--rule); }
48
+ .strip div:first-child { border-left:0; }
49
+ .strip b { display:block; font-family:var(--serif); font-size:1.4rem; font-variant-numeric:tabular-nums; }
50
+ .strip span { font-size:.74rem; color:var(--ink-dim); }
51
+ .strip .warn b { color:var(--mark); }
52
+
53
+ /* spine: one dot per feature on its weighted score */
54
+ .spine-wrap { background:var(--sheet); border:1px solid var(--rule); padding:.9rem 1rem .7rem; margin-bottom:1rem; }
55
+ .spine, .zones { display:grid; grid-template-columns:repeat(21,1fr); }
56
+ .spine { align-items:end; min-height:2.6rem; }
57
+ .spine .col { display:flex; flex-direction:column-reverse; align-items:center; gap:2px; border-left:1px solid var(--grid); }
58
+ .dot { width:11px; height:11px; padding:0; border:1px solid var(--ink); border-radius:50%; background:var(--sheet); cursor:pointer; }
59
+ .dot:hover, .dot.hl { background:var(--hi-line); border-color:var(--hi-line); }
60
+ .dot.changed { border-color:var(--mark); background:var(--mark); }
61
+ .dot.flag { box-shadow:0 0 0 2px var(--sheet), 0 0 0 3px var(--hi-line); }
62
+ .zones { border-top:1px solid var(--rule); margin-top:.35rem; padding-top:.3rem; font-size:.72rem; color:var(--ink-dim); }
63
+ .zones span { border-left:1px solid var(--rule); padding-left:.35rem; } .zones span:first-child { border-left:0; }
64
+ .zones b { color:var(--ink); }
65
+ .spine-note { margin:.45rem 0 0; font-size:.75rem; color:var(--ink-dim); }
66
+
67
+ /* nav + filters */
68
+ nav.sys { position:sticky; top:0; z-index:5; display:flex; gap:.4rem; flex-wrap:wrap; align-items:center; padding:.6rem 0; background:var(--paper); border-bottom:1px solid var(--rule); margin-bottom:1rem; }
69
+ nav.sys a { font-size:.8rem; text-decoration:none; color:var(--ink-dim); padding:.25rem .6rem; border:1px solid var(--rule); border-radius:1rem; background:var(--sheet); }
70
+ nav.sys a:hover { color:var(--ink); }
71
+ nav.sys a .n { font-variant-numeric:tabular-nums; margin-left:.35rem; font-weight:600; color:var(--ink); }
72
+ nav.sys .filters { margin-left:auto; display:flex; gap:.25rem; }
73
+ nav.sys .filters button { font-size:.74rem; padding:.2rem .6rem; border:1px solid var(--rule); border-radius:1rem; background:var(--sheet); color:var(--ink-dim); cursor:pointer; }
74
+ nav.sys .filters button[aria-pressed="true"] { background:var(--ink); color:var(--sheet); border-color:var(--ink); }
75
+
76
+ /* system */
77
+ section.system { background:var(--sheet); border:1px solid var(--rule); padding:1.2rem 1.4rem 1.2rem; margin-bottom:1.6rem; scroll-margin-top:3.5rem; }
78
+ .sys-head { display:flex; justify-content:space-between; gap:1rem; align-items:flex-end; border-bottom:1px solid var(--rule); padding-bottom:.8rem; margin-bottom:.8rem; }
79
+ .eyebrow { font-size:.7rem; letter-spacing:.08em; text-transform:uppercase; color:var(--ink-dim); font-weight:600; }
80
+ h2 { font-family:var(--serif); font-size:1.5rem; font-weight:600; margin:.05rem 0 0; }
81
+ .subtotal { text-align:right; font-variant-numeric:tabular-nums; }
82
+ .subtotal b { font-family:var(--serif); font-size:1.35rem; display:block; }
83
+ .subtotal span { font-size:.74rem; color:var(--ink-dim); }
84
+ .subtotal .was { color:var(--mark); }
85
+ details.wf { margin:0 0 .6rem; }
86
+ details.wf summary { cursor:pointer; font-size:.74rem; letter-spacing:.07em; text-transform:uppercase; color:var(--ink-dim); font-weight:700; }
87
+ .flow { border:1px solid var(--grid); background:var(--paper); padding:.6rem; overflow-x:auto; margin-top:.4rem; }
88
+ .flow-name { font-size:.72rem; color:var(--ink-dim); margin:.5rem 0 0; }
89
+ .flow g.node.hl rect, .flow g.node.hl polygon { stroke:var(--hi-line) !important; stroke-width:3px !important; }
90
+
91
+ /* feature card */
92
+ .feat { display:grid; grid-template-columns:17rem 1fr; gap:1.4rem; padding:1rem 0; border-top:1px solid var(--rule); scroll-margin-top:4rem; }
93
+ .feat.hl { background:linear-gradient(90deg,var(--hi),transparent 60%); }
94
+ .feat.flash { animation:flash 1.4s ease-out; }
95
+ @keyframes flash { 0%,40% { box-shadow:inset 3px 0 0 var(--hi-line); } 100% { box-shadow:inset 3px 0 0 transparent; } }
96
+ .rail h3 { font-family:var(--serif); font-size:1.05rem; font-weight:600; margin:0 0 .15rem; }
97
+ .rail .id { font-size:.72rem; color:var(--ink-dim); font-variant-numeric:tabular-nums; }
98
+ .rail .does { margin:.2rem 0 .4rem; font-size:.78rem; color:var(--ink-dim); }
99
+ .chip { display:inline-block; font-size:.7rem; padding:0 .4rem; margin:0 .2rem .2rem 0; border:1px solid var(--rule); border-radius:.8rem; background:var(--paper); white-space:nowrap; }
100
+ .verdict { display:flex; align-items:center; gap:.5rem; flex-wrap:wrap; margin:.5rem 0 .2rem; font-variant-numeric:tabular-nums; }
101
+ .verdict .total { font-size:.8rem; color:var(--ink-dim); } .verdict .total b { font-size:1.15rem; color:var(--ink); }
102
+ .tier { font-size:.75rem; font-weight:700; padding:.08rem .45rem; border:1px solid var(--rule); border-radius:.2rem; }
103
+ .tier.t-S { background:var(--t-s); color:var(--t-s-ink); } .tier.t-M { background:var(--t-m); color:var(--t-m-ink); }
104
+ .tier.t-L { background:var(--t-l); color:var(--t-l-ink); border-color:var(--t-l); } .tier.t-XL { background:var(--t-xl); color:var(--t-xl-ink); border-color:var(--t-xl); }
105
+ .price { font-size:.8rem; font-variant-numeric:tabular-nums; } .price b { font-size:.95rem; }
106
+ .moved { font-size:.72rem; color:var(--mark); font-weight:600; }
107
+ .flagchip { font-size:.7rem; font-weight:700; color:var(--hi-line); border:1px solid var(--hi-line); border-radius:.8rem; padding:0 .45rem; }
108
+
109
+ .factors { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:.8rem 1rem; }
110
+ .factor .flabel { font-size:.72rem; font-weight:700; color:var(--ink-dim); display:flex; justify-content:space-between; }
111
+ .factor .flabel i { font-style:normal; font-weight:500; }
112
+ .pick { display:flex; gap:3px; margin:.3rem 0 .3rem; }
113
+ .pick button { flex:1; min-width:0; font-size:.78rem; font-weight:600; padding:.22rem 0; border:1px solid var(--rule); border-radius:.2rem; background:var(--sheet); color:var(--ink-dim); cursor:pointer; font-variant-numeric:tabular-nums; }
114
+ .pick button:hover { color:var(--ink); border-color:var(--ink-dim); }
115
+ .pick button.on { background:var(--meter); border-color:var(--meter); color:var(--sheet); }
116
+ .pick button.orig { box-shadow:inset 0 -2px 0 var(--ink-dim); }
117
+ .factor.changed .pick button.on { background:var(--mark); border-color:var(--mark); color:#fff; }
118
+ .anchor { margin:0; font-size:.74rem; line-height:1.35; color:var(--ink-dim); }
119
+ .why { margin:.2rem 0 0; font-size:.74rem; line-height:1.35; color:var(--ink); }
120
+ .why::before { content:'Evidence: '; color:var(--ink-dim); }
121
+ .factor.changed .why { text-decoration:line-through; opacity:.55; }
122
+ .note { display:block; margin-top:.7rem; font-size:.72rem; font-weight:700; color:var(--ink-dim); }
123
+ .note textarea { display:block; width:100%; max-width:70ch; margin-top:.25rem; padding:.35rem .5rem; min-height:2.2rem; field-sizing:content;
124
+ font-family:var(--serif); font-size:.86rem; font-weight:400; border:1px solid var(--rule); border-radius:.2rem; background:var(--sheet); resize:vertical; }
125
+
126
+ details.guide { margin:1.6rem 0; background:var(--sheet); border:1px solid var(--rule); padding:.8rem 1rem; }
127
+ details.guide summary { cursor:pointer; font-weight:600; }
128
+ .guide-table { border-collapse:collapse; width:100%; margin-top:.7rem; font-size:.76rem; }
129
+ .guide-table th, .guide-table td { border:1px solid var(--rule); padding:.35rem .45rem; text-align:left; vertical-align:top; }
130
+ .guide-table th { color:var(--ink-dim); } .guide-table td.dim { font-weight:600; white-space:nowrap; }
131
+
132
+ /* bottom bar + dialog */
133
+ .bar { position:fixed; left:0; right:0; bottom:0; background:var(--sheet); border-top:1px solid var(--rule); z-index:10; }
134
+ .bar .in { max-width:84rem; margin:0 auto; padding:.7rem 1.5rem; display:flex; gap:1rem; align-items:center; justify-content:space-between; flex-wrap:wrap; }
135
+ .bar .stat { font-size:.8rem; color:var(--ink-dim); font-variant-numeric:tabular-nums; } .bar .stat b { color:var(--ink); }
136
+ .saved { font-size:.72rem; color:var(--ink-dim); }
137
+ dialog { max-width:64rem; width:calc(100% - 3rem); border:1px solid var(--rule); background:var(--sheet); color:var(--ink); padding:1rem 1.2rem; box-shadow:0 18px 60px #0006; border-radius:.4rem; }
138
+ dialog::backdrop { background:rgb(10 14 18 / .45); backdrop-filter:blur(6px); -webkit-backdrop-filter:blur(6px); }
139
+ dialog .sum { max-height:62vh; overflow:auto; }
140
+ .sum h4 { font-family:var(--serif); font-size:1.05rem; margin:1rem 0 .3rem; }
141
+ .sum table { width:100%; border-collapse:collapse; font-size:.82rem; font-variant-numeric:tabular-nums; }
142
+ .sum th { text-align:left; font-size:.7rem; text-transform:uppercase; letter-spacing:.05em; color:var(--ink-dim); padding:.3rem .4rem; border-bottom:1px solid var(--rule); }
143
+ .sum td { padding:.3rem .4rem; border-bottom:1px solid var(--grid); vertical-align:top; }
144
+ .sum .up { color:var(--mark); font-weight:600; } .sum .down { color:var(--ok); font-weight:600; }
145
+ .quiet { color:var(--ink-dim); font-size:.82rem; }
146
+ #feedback { display:block; width:100%; min-height:5rem; margin-top:.5rem; padding:.5rem; font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:.7rem; border:1px solid var(--rule); background:var(--paper); color:var(--ink-dim); }
147
+ .dlg-foot { display:flex; justify-content:flex-end; align-items:center; gap:.5rem; margin-top:.8rem; border-top:1px solid var(--rule); padding-top:.8rem; }
148
+ #copied { font-size:.78rem; color:var(--ok); }
149
+ @media (max-width:980px) { .factors { grid-template-columns:repeat(2,minmax(0,1fr)); } }
150
+ @media (max-width:760px) { body { padding:1.2rem 1rem 8rem; } .feat { grid-template-columns:1fr; gap:.8rem; } nav.sys .filters { margin-left:0; } }
151
+ .reason { margin-top:.3rem; }
152
+ .reason .was { margin:0 0 .2rem; font-size:.72rem; color:var(--mark); font-weight:600; }
153
+ .reason textarea { display:block; width:100%; min-height:3.2rem; field-sizing:content; resize:vertical; font-size:.8rem; line-height:1.4;
154
+ padding:.35rem .45rem; border:1px solid var(--mark); border-radius:.2rem; background:var(--sheet); }
155
+ .reason:not(.missing) textarea { border-color:var(--rule); }
156
+ .warnbox { background:var(--mark-soft); color:var(--mark); padding:.5rem .7rem; font-size:.84rem; margin:.2rem 0 .6rem; }
157
+ .pinbar { position:fixed; right:1.2rem; bottom:4.6rem; z-index:11; display:flex; gap:.4rem; align-items:center; background:var(--sheet);
158
+ border:1px solid var(--hi-line); box-shadow:0 4px 18px #0002; padding:.45rem .6rem; border-radius:.3rem; max-width:calc(100% - 2.4rem); }
159
+ .pin-txt { display:flex; flex-direction:column; min-width:0; margin-right:.3rem; }
160
+ .pin-txt b { font-size:.8rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:22rem; }
161
+ .pin-txt small { font-size:.72rem; color:var(--ink-dim); }
162
+ .feat.cur { box-shadow:inset 3px 0 0 var(--hi-line); }
163
+ .flow g.node.cur rect, .flow g.node.cur polygon { stroke-width:5px !important; }
164
+ .flow g.node, .rail h3, .dot { cursor:pointer; }
165
+ .page { max-width:84rem; }
166
+ .feat { grid-template-columns:1fr; gap:.8rem; padding:1.2rem 0 1.3rem; }
167
+ .rail { display:flex; justify-content:space-between; gap:1.5rem; align-items:flex-start; }
168
+ .rail .who { max-width:44rem; }
169
+ .score-box { flex:none; min-width:15rem; text-align:right; }
170
+ .score-box .verdict { justify-content:flex-end; margin-top:0; }
171
+ .factors { grid-template-columns:repeat(5,minmax(0,1fr)); gap:0; border:1px solid var(--grid); border-radius:.3rem; background:var(--paper); }
172
+ .factor { padding:.7rem .9rem .8rem; border-left:1px solid var(--rule); }
173
+ .factor:first-child { border-left:0; }
174
+ .factor .flabel { font-size:.76rem; }
175
+ .pick { gap:5px; margin:.45rem 0 .45rem; }
176
+ .pick button { padding:.34rem 0; font-size:.84rem; }
177
+ .anchor { font-size:.76rem; line-height:1.4; }
178
+ @media (max-width:980px) { .factors { grid-template-columns:repeat(2,minmax(0,1fr)); } .factor:nth-child(odd) { border-left:0; } .factor { border-top:1px solid var(--rule); } .rail { flex-direction:column; } .score-box { text-align:left; } .score-box .verdict { justify-content:flex-start; } }
179
+ .bar .actions { display:flex; gap:.5rem; align-items:center; margin-left:auto; }
180
+
181
+ /* capability map + links */
182
+ section.map .quiet { margin:.1rem 0 .6rem; }
183
+ .view { display:inline-flex; border:1px solid var(--rule); border-radius:.25rem; overflow:visible; background:var(--sheet); }
184
+ .view button { border:0; border-left:1px solid var(--rule); background:transparent; color:var(--ink-dim); font-size:.78rem; font-weight:600; padding:.3rem .75rem; cursor:pointer; }
185
+ .view button:first-child { border-left:0; }
186
+ .view button:hover { color:var(--ink); }
187
+ .view button[aria-pressed="true"] { background:var(--ink); color:var(--sheet); }
188
+ details.capsys { border-top:1px solid var(--rule); padding-top:.6rem; margin-top:.6rem; }
189
+ details.capsys summary { cursor:pointer; font-size:.82rem; font-weight:700; }
190
+ table.caps { width:100%; border-collapse:collapse; font-size:.82rem; margin:.5rem 0 .3rem; }
191
+ table.caps th { text-align:left; font-size:.7rem; text-transform:uppercase; letter-spacing:.05em; color:var(--ink-dim); padding:.3rem .45rem; border-bottom:1px solid var(--rule); }
192
+ table.caps td { padding:.4rem .45rem; border-bottom:1px solid var(--grid); vertical-align:top; }
193
+ table.caps td:first-child { width:30%; } table.caps td:nth-child(2) { width:28%; }
194
+ table.caps tr[data-cap] { cursor:pointer; }
195
+ table.caps tr.hl td { background:var(--hi); }
196
+ table.caps tr.cur td { box-shadow:inset 0 2px 0 var(--hi-line), inset 0 -2px 0 var(--hi-line); }
197
+ table.caps tr.gap td { background:var(--mark-soft); }
198
+ table.caps tr.flash td { animation:flash 1.4s ease-out; }
199
+ .dim { color:var(--ink-dim); }
200
+ .chip.eng { cursor:pointer; border-color:var(--meter); }
201
+ .chip.hl { background:var(--hi); border-color:var(--hi-line); }
202
+ .gapnote { color:var(--mark); font-weight:700; font-size:.78rem; }
203
+ .ask { display:flex; flex-wrap:wrap; gap:.3rem .5rem; align-items:center; font-size:.78rem; }
204
+ .ask textarea { flex:1 1 100%; field-sizing:content; min-height:1.9rem; font-size:.8rem; padding:.25rem .4rem; border:1px solid var(--rule); border-radius:.2rem; background:var(--sheet); }
205
+ /* Builds: the link from this feature to the client's capabilities, tinted per system */
206
+ :root { --s1:#2f6fa3; --s2:#b5651d; --s3:#2f7d5b; --s4:#7b4fa8; }
207
+ @media (prefers-color-scheme:dark) { :root:not([data-theme="light"]) { --s1:#6fa8d6; --s2:#e09a5a; --s3:#6cc39a; --s4:#b190dc; } }
208
+ :root[data-theme="dark"] { --s1:#6fa8d6; --s2:#e09a5a; --s3:#6cc39a; --s4:#b190dc; }
209
+ .builds { margin-top:.55rem; padding:.5rem .65rem .55rem; border:1px solid var(--rule); border-left:3px solid var(--meter); border-radius:.3rem; background:var(--paper); }
210
+ .builds.none { border-color:var(--hi-line); border-left-color:var(--hi-line); border-style:dashed; border-left-style:solid; background:var(--hi); }
211
+ .bhead { font-size:.7rem; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:var(--ink-dim); margin-bottom:.4rem; }
212
+ .bhead b { color:var(--ink); }
213
+ .builds.none .bhead { color:var(--ink); margin-bottom:.35rem; }
214
+ .bhead .hint { text-transform:none; letter-spacing:0; font-weight:500; color:var(--ink-dim); margin-left:.25rem; }
215
+ .btags { display:flex; flex-wrap:wrap; gap:.35rem; align-items:center; }
216
+ .cap { display:inline-flex; align-items:stretch; font-size:.78rem; border:1px solid var(--rule); border-left:3px solid var(--sc); border-radius:.3rem; background:var(--sheet); cursor:pointer; overflow:hidden; }
217
+ .cap > * { display:flex; align-items:center; padding:.18rem .45rem; }
218
+ .cap .cid { font-weight:700; font-size:.72rem; color:var(--sc); background:color-mix(in srgb, var(--sc) 12%, transparent); font-variant-numeric:tabular-nums; }
219
+ .cap .cname { font-weight:600; color:var(--ink); }
220
+ .cap .csys { font-size:.68rem; font-weight:600; color:var(--sc); padding-left:0; }
221
+ .cap button { all:unset; display:flex; align-items:center; cursor:pointer; color:var(--ink-dim); padding:0 .5rem; border-left:1px solid var(--grid); }
222
+ .cap button:hover { color:var(--mark); background:var(--mark-soft); }
223
+ .cap.added { box-shadow:0 0 0 1px var(--ok); }
224
+ .cap.added .cname::after { content:'new'; margin-left:.4rem; font-size:.62rem; font-weight:700; text-transform:uppercase; color:var(--ok); }
225
+ .cap.removed { opacity:.5; cursor:default; } .cap.removed .cname { text-decoration:line-through; }
226
+ .cap.hl { background:var(--hi); border-color:var(--hi-line); border-left-color:var(--sc); }
227
+ .builds select { font:inherit; font-size:.76rem; font-weight:600; color:var(--ink-dim); background:transparent; border:1px dashed var(--ink-dim); border-radius:.3rem; padding:.2rem .45rem; cursor:pointer; max-width:15rem; }
228
+ .builds select:hover { color:var(--ink); border-color:var(--ink); }
229
+ .note textarea { max-width:none; min-height:4.6rem; line-height:1.45; }
230
+ .feat.unasked .rail h3::after { content:' · not asked for'; font-family:var(--sans); font-size:.72rem; font-weight:600; color:var(--ink-dim); }
231
+ .warnbox.soft { background:var(--hi); color:var(--ink); }
232
+ /* nav: row 1 = system toggle + filters, row 2 = jump links; hints on hover */
233
+ nav.sys { flex-direction:column; align-items:stretch; gap:.45rem; }
234
+ nav.sys .navrow { display:flex; flex-wrap:wrap; gap:.4rem; align-items:center; }
235
+ nav.sys .filters { padding-left:1.5rem; }
236
+ nav.sys .navlbl { font-size:.68rem; font-weight:700; letter-spacing:.07em; text-transform:uppercase; color:var(--ink-dim); margin:0 .2rem 0 0; cursor:help; border-bottom:1px dotted var(--ink-dim); }
237
+ nav.sys .cnt { font-variant-numeric:tabular-nums; opacity:.7; margin-left:.15rem; }
238
+ .seg button { font-size:.8rem; padding:.32rem .9rem; }
239
+ [data-tip] { position:relative; }
240
+ [data-tip]:hover::after, [data-tip]:focus-visible::after { content:attr(data-tip); position:absolute; left:0; top:calc(100% + .45rem); z-index:20; width:max-content; max-width:18rem;
241
+ white-space:normal; text-transform:none; letter-spacing:0; font-size:.74rem; font-weight:500; line-height:1.4; color:var(--sheet); background:var(--ink); padding:.4rem .55rem; border-radius:.25rem; box-shadow:0 4px 14px #0003; pointer-events:none; }
242
+ nav.sys .filters [data-tip]:hover::after { left:auto; right:0; }
243
+ /* Built by: one row per component under the feature it builds */
244
+ .feat .builds { margin:.2rem 0 .1rem; }
245
+ .crows { display:flex; flex-direction:column; gap:.3rem; margin:.1rem 0 .45rem; }
246
+ .crow { display:grid; grid-template-columns:9.5rem minmax(12rem,1fr) auto auto auto; align-items:center; gap:.7rem; padding:.4rem .6rem; border:1px solid var(--grid); border-radius:.3rem; background:var(--sheet); font-size:.9rem; cursor:pointer; }
247
+ .crow .ccont { font-size:.76rem; font-weight:600; color:var(--ink-dim); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
248
+ .crow .cname { font-weight:600; }
249
+ .crow .calso { font-size:.82rem; color:var(--ink-dim); display:flex; flex-wrap:wrap; gap:.25rem; align-items:center; }
250
+ .crow .chrs { font-variant-numeric:tabular-nums; font-weight:700; }
251
+ .crow button { all:unset; cursor:pointer; color:var(--ink-dim); padding:0 .3rem; }
252
+ .crow button:hover { color:var(--mark); }
253
+ .crow.hl { background:var(--hi); border-color:var(--hi-line); }
254
+ .crow.added { box-shadow:0 0 0 1px var(--ok); } .crow.added .cname::after { content:' new'; font-size:.7rem; color:var(--ok); text-transform:uppercase; }
255
+ .crow.removed { opacity:.5; cursor:default; } .crow.removed .cname { text-decoration:line-through; }
256
+ .cmini { font-size:.74rem; font-weight:700; color:var(--sc); border:1px solid var(--rule); border-left:3px solid var(--sc); border-radius:.25rem; padding:0 .35rem; background:var(--paper); cursor:pointer; }
257
+ .cmini.hl { background:var(--hi); }
258
+ .bhead .arch { margin-left:.6rem; text-transform:none; letter-spacing:0; font-weight:600; }
259
+ .archlink { color:var(--ink); font-weight:600; text-transform:none; letter-spacing:0; text-decoration:underline; text-underline-offset:2px; }
260
+ .archlink:hover { color:var(--mark); }
261
+ @media (max-width:760px) { .crow { grid-template-columns:1fr auto; } .crow .ccont, .crow .calso { grid-column:1 / -1; } }
262
+ /* long-reading comfort: bigger type, wider leading, shorter lines, calmer contrast */
263
+ body { font-size:1rem; line-height:1.65; }
264
+ .page { max-width:76rem; }
265
+ h1 { font-size:2.35rem; line-height:1.15; }
266
+ h2, section.card h2, section.system h2 { font-size:1.65rem; line-height:1.25; }
267
+ .sub { font-size:.9rem; }
268
+ .lead, .sec-lead, p.quiet { font-size:.98rem; line-height:1.7; max-width:68ch; }
269
+ .does, .fdoes, .demo, .anchor, .why, .meta, .spine-note, .bhead .hint { font-size:.9rem; line-height:1.6; }
270
+ section.card, section.system { padding:1.9rem 2.1rem; margin-bottom:2.2rem; }
271
+ .eyebrow, section.card h3, th, .bhead, .flabel { font-size:.76rem !important; letter-spacing:.06em; }
272
+ table.bd, table.caps, table.kv, details.tasks table, .sum table { font-size:.92rem; line-height:1.55; }
273
+ table.bd td, table.caps td, table.kv td, details.tasks td { padding-top:.55rem; padding-bottom:.55rem; }
274
+ .chip { font-size:.78rem; padding:.05rem .5rem; }
275
+ .twocol li { font-size:.96rem; line-height:1.65; margin:.4rem 0; }
276
+ .headline span { font-size:.84rem; }
277
+ .m .demo { font-size:.92rem; }
278
+ .feat { padding-top:1.6rem; padding-bottom:1.7rem; }
279
+ .rail h3 { font-size:1.25rem; margin-bottom:.25rem; }
280
+ .rail .does { font-size:.92rem; line-height:1.6; } .rail .id { font-size:.8rem; }
281
+ .cap { font-size:.84rem; }
282
+ @media (prefers-color-scheme:dark) { :root:not([data-theme="light"]) { --ink:#dbe2e8; --ink-dim:#a3b2be; } }
283
+ :root[data-theme="dark"] { --ink:#dbe2e8; --ink-dim:#a3b2be; }
284
+ .sys .meta, .sys .eyebrow { font-size:.82rem !important; line-height:1.5; }
285
+ body.client .headline { grid-template-columns:1.4fr 1fr; }
286
+ /* every page: tables, strips, nav chips, hints and small notes */
287
+ table td { font-size:.92rem; line-height:1.55; }
288
+ .strip span, .legend, .pin-hint, small, nav.sys a, nav.toc a, p.map, .hint, .gone-note, .gapnote, .saved, .pin-txt small, .zones, label { font-size:.85rem; line-height:1.5; }
289
+ .pick button, .seg button, .view button, .btn { font-size:.84rem; }
290
+ textarea, input, select { font-size:.92rem; }
291
+ .flow-name { font-size:.84rem; } .cap .csys { font-size:.76rem; } .cap .cid { font-size:.78rem; } .flagchip { font-size:.78rem; }
292
+
293
+ /* how to read: the System → Feature → Block chain at the top of every page */
294
+ .howto { margin:0 0 1.4rem; padding:.85rem 1rem .8rem; border:1px solid var(--rule); border-radius:.35rem; background:var(--sheet); max-width:60rem; }
295
+ .howto-t { display:block; font-size:.74rem; font-weight:700; letter-spacing:.07em; text-transform:uppercase; color:var(--ink-dim); margin-bottom:.55rem; }
296
+ .howto-chain { display:flex; flex-wrap:wrap; align-items:stretch; gap:.45rem; }
297
+ .howto-chain > span { flex:1 1 12rem; display:flex; flex-direction:column; gap:.1rem; padding:.5rem .7rem; border:1px solid var(--grid); border-radius:.3rem; background:var(--paper); font-size:.9rem; line-height:1.4; }
298
+ .howto-chain > span b { font-family:var(--serif); font-size:1.05rem; }
299
+ .howto-chain small { font-size:.8rem; color:var(--ink-dim); }
300
+ .howto-chain > i { align-self:center; font-style:normal; color:var(--ink-dim); }
301
+ .howto-rule { margin:.6rem 0 0; font-size:.9rem; color:var(--ink-dim); max-width:68ch; }
302
+ .howto-rule b { color:var(--ink); }
303
+ .howto-page { display:block; margin-top:.25rem; color:var(--ink); }
304
+ @media (max-width:640px) { .howto-chain > i { display:none; } }
305
+
306
+ /* native dropdowns follow the theme: dark popups in dark mode, readable option text */
307
+ :root { color-scheme:light; }
308
+ @media (prefers-color-scheme:dark) { :root:not([data-theme="light"]) { color-scheme:dark; } }
309
+ :root[data-theme="dark"] { color-scheme:dark; }
310
+ select option, select optgroup { background:var(--sheet); color:var(--ink); }
311
+
312
+ :root { --c1:#44586a; --c2:#7d96ab; }
313
+ @media (prefers-color-scheme:dark) { :root:not([data-theme="light"]) { --c1:#bacdda; --c2:#8fa8bb; } }
314
+ :root[data-theme="dark"] { --c1:#bacdda; --c2:#8fa8bb; }
315
+ section.card { background:var(--sheet); border:1px solid var(--rule); padding:1.3rem 1.4rem; margin-bottom:1.4rem; scroll-margin-top:3.5rem; }
316
+ section.card h2 { margin-bottom:.2rem; }
317
+ .sec-lead { margin:0 0 1rem; color:var(--ink-dim); max-width:72ch; font-size:.84rem; }
318
+ section.card h3 { font-size:.74rem; letter-spacing:.07em; text-transform:uppercase; color:var(--ink-dim); margin:1.2rem 0 .5rem; font-weight:700; }
319
+ section.card .internal { all:unset; display:revert; }
320
+ .num { font-variant-numeric:tabular-nums; }
321
+ .head-ctl { display:flex; gap:.5rem; align-items:center; }
322
+ .view.pages a { display:inline-block; text-decoration:none; color:var(--ink-dim); background:var(--sheet); font-size:.78rem; font-weight:600; padding:.3rem .75rem; border-left:1px solid var(--rule); }
323
+ .view.pages a:first-child { border-left:0; }
324
+ .view.pages a[aria-current="page"] { background:var(--ink); color:var(--sheet); }
325
+ .bar { display:none; }
326
+ body { padding-bottom:3rem; }
327
+ .pinbar { bottom:1.2rem; }
328
+ /* summary */
329
+ .headline { display:grid; grid-template-columns:1.4fr 1fr 1fr 1fr; border:1px solid var(--rule); }
330
+ .headline > div { padding:.9rem 1.1rem; border-left:1px solid var(--rule); }
331
+ .headline > div:first-child { border-left:0; background:var(--paper); }
332
+ .headline b { display:block; font-family:var(--serif); font-size:1.5rem; font-variant-numeric:tabular-nums; line-height:1.2; }
333
+ .headline .big b { font-size:2rem; }
334
+ .headline span { font-size:.74rem; color:var(--ink-dim); }
335
+ .buildup { margin-top:1.2rem; }
336
+ .bu-row { display:grid; grid-template-columns:16rem 1fr 7rem; gap:.8rem; align-items:center; padding:.25rem 0; font-size:.84rem; }
337
+ .bu-row .lbl small { display:block; color:var(--ink-dim); font-size:.72rem; }
338
+ .bu-bar { height:1.1rem; position:relative; background:var(--grid); border-radius:.15rem; }
339
+ .bu-bar i { position:absolute; top:0; bottom:0; border-radius:.15rem; background:var(--c2); }
340
+ .bu-row.total { border-top:1px solid var(--rule); margin-top:.3rem; padding-top:.5rem; font-weight:700; }
341
+ .bu-row.total .bu-bar i { background:var(--c1); }
342
+ .bu-row .amt { text-align:right; font-variant-numeric:tabular-nums; }
343
+ .bu-row.range .bu-bar i { background:repeating-linear-gradient(90deg,var(--hi-line) 0 6px,transparent 6px 9px); opacity:.8; }
344
+
345
+ /* roadmap */
346
+ .ms { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:.9rem; }
347
+ .m { border:1px solid var(--rule); border-radius:.3rem; padding:.9rem 1rem; }
348
+ .m h4 { margin:.1rem 0 .3rem; font-family:var(--serif); font-size:1.05rem; }
349
+ .m .demo { font-size:.8rem; color:var(--ink-dim); margin:0 0 .6rem; }
350
+ .m .amt { font-variant-numeric:tabular-nums; font-size:.84rem; margin-bottom:.5rem; } .m .amt b { font-family:var(--serif); font-size:1.15rem; }
351
+ .m .chip { cursor:pointer; }
352
+
353
+ /* register + method */
354
+ .twocol { display:grid; grid-template-columns:1fr 1fr; gap:1.4rem; }
355
+ .twocol ul { margin:.2rem 0; padding-left:1.1rem; } .twocol li { margin:.25rem 0; font-size:.84rem; }
356
+ table.kv { width:100%; border-collapse:collapse; font-size:.82rem; }
357
+ table.kv td, table.kv th { padding:.35rem .5rem; border-bottom:1px solid var(--grid); text-align:left; }
358
+ table.kv th { font-size:.7rem; text-transform:uppercase; letter-spacing:.05em; color:var(--ink-dim); font-weight:600; border-bottom-color:var(--rule); }
359
+ table.kv td.r, table.kv th.r { text-align:right; font-variant-numeric:tabular-nums; }
360
+ table.kv tr.sum td { font-weight:700; border-top:1px solid var(--rule); }
361
+
362
+
363
+ .factor.ro .ro-n { font-family:var(--serif); font-size:1.6rem; font-weight:600; line-height:1.1; margin:.25rem 0 .3rem; font-variant-numeric:tabular-nums; }
364
+ .factor.ro .ro-n span { font-size:.8rem; color:var(--ink-dim); margin-left:.1rem; }
365
+ .factor.ro .ro-n.hot { color:var(--mark); }
366
+ body:not(.side-effort-on) .side-effort, body.side-effort-on .side-score { display:none !important; }
367
+ nav.sys .navrow:first-child { gap:.6rem; }
368
+ .effort { text-align:right; } .effort b { display:block; font-family:var(--serif); font-size:1.5rem; font-variant-numeric:tabular-nums; } .effort span { font-size:.74rem; color:var(--ink-dim); }
369
+ table.caps th.c, table.caps td.c { text-align:center; } table.caps td.r, table.caps th.r { text-align:right; font-variant-numeric:tabular-nums; white-space:nowrap; }
370
+ .flag { font-size:.75rem; color:var(--hi-line); font-weight:700; }
371
+ details.tasks { margin-top:.7rem; border:1px solid var(--grid); border-radius:.3rem; background:var(--paper); }
372
+ details.tasks summary { cursor:pointer; padding:.45rem .7rem; font-size:.76rem; font-weight:700; letter-spacing:.04em; text-transform:uppercase; color:var(--ink-dim); }
373
+ details.tasks table { width:100%; border-collapse:collapse; font-size:.8rem; }
374
+ details.tasks th { text-align:left; font-size:.68rem; text-transform:uppercase; letter-spacing:.05em; color:var(--ink-dim); padding:.3rem .7rem; border-top:1px solid var(--rule); }
375
+ details.tasks td { padding:.35rem .7rem; border-top:1px solid var(--grid); vertical-align:top; }
376
+ details.tasks .r { text-align:right; font-variant-numeric:tabular-nums; white-space:nowrap; }
377
+ details.tasks td .dim { font-size:.72rem; }
378
+ .conf { font-size:.7rem; font-weight:700; } .conf.c-LOW { color:var(--mark); } .conf.c-MED { color:var(--hi-line); } .conf.c-HIGH { color:var(--ok); }
379
+ </style>
380
+ </head>
381
+ <body>
382
+ <div class="page">
383
+ <div class="head">
384
+ <div>
385
+ <h1><!-- slot:TITLE --> — estimate <span class="internal">internal</span></h1>
386
+ <p class="sub">Component-based view · <span id="subcount"></span> · scores signed off in the score review</p>
387
+ </div>
388
+ <div class="head-ctl"><nav class="view pages" aria-label="Estimate view"><a href="estimate.html">Workflow-based</a><a href="estimate-components.html" aria-current="page">Component-based</a></nav>
389
+ <button class="btn" id="theme" type="button">Dark</button></div>
390
+ </div>
391
+ <p class="lead">The engineer's view of the estimate: the signed-off score review, read-only, with the price on top. <b>Scoring</b> shows each feature's scores and price; <b>Effort</b> shows the components behind it, with their hours and tasks. The client receives the proposal.</p>
392
+ <section class="card" id="summary"><h2>Summary</h2><p class="sec-lead">The price for this scope, from the features below.</p>
393
+ <div class="headline" id="headline"></div><div class="buildup" id="buildup"></div>
394
+ <p><button class="btn" id="xlsx" type="button" title="every feature as the v2 estimator workbook">download xlsx</button> <span class="quiet">Adjust stack familiarity or any score in the workbook; it reprices itself.</span></p></section>
395
+ <div class="howto"><b class="howto-t">How to read this page</b>
396
+ <div class="howto-chain"><span><b>System</b>a part of the business<small>e.g. Warehouse Mgmt System</small></span><i>→</i><span><b>Feature</b>something the client asked for<small>e.g. F04 Order intake &amp; quotation entry</small></span><i>→</i><span><b>Component</b>a piece engineers build<small>e.g. Catalogue and item identity</small></span></div>
397
+ <p class="howto-rule">A feature is built by one or more components, and one component can serve several features. <span class="howto-page"><b>Scoring</b> shows each feature&#39;s scores and price; <b>Effort</b> the components behind it, with tasks and hours. Containers and components are the ones in the architecture document: <a class="archlink" href="index.html#panel-containers" target="_blank" rel="noopener">C2 containers ↗</a></span></p></div>
398
+
399
+ <div class="strip" id="strip"></div>
400
+ <div class="spine-wrap">
401
+ <div class="spine" id="spine"></div>
402
+ <div class="zones">
403
+ <span style="grid-column:1/8">S <b>&lt;11.5</b></span><span style="grid-column:8/14">M <b>11.5–17.4</b></span>
404
+ <span style="grid-column:14/19">L <b>17.5–22.4</b></span><span style="grid-column:19/22">XL <b>22.5+</b></span>
405
+ </div>
406
+ <p class="spine-note">Each dot is one feature on its weighted score (5–25). Hover to see it, click to pin it and jump to its card. Red = you changed it; ringed = flagged for a deep estimate.</p>
407
+ </div>
408
+
409
+ <section class="system map" id="map">
410
+ <div class="sys-head"><div><div class="eyebrow">From the PO's scope review · read only</div><h2>Systems &amp; workflows</h2></div>
411
+ <div class="subtotal" id="cover"></div></div>
412
+ <p class="quiet">Open a system to see its workflows, the features on each step, and the components that build them. Hover any box, feature or component to see its links; click to pin.</p>
413
+ <div id="systems"></div>
414
+ </section>
415
+
416
+ <nav class="sys" id="nav"></nav>
417
+ <div id="groups"></div>
418
+ <div id="unasked"></div>
419
+
420
+ <section class="card" id="roadmap"><h2>Milestones</h2><p class="sec-lead">Each milestone lists the client's features it finishes. Its range is its share of the build applied to the project range.</p><div class="ms" id="ms"></div></section>
421
+ <section class="card" id="register"><h2>Assumptions &amp; exclusions</h2><p class="sec-lead">Shared word for word with the proposal.</p>
422
+ <div class="twocol"><div><h3>Assumptions</h3><ul id="assume"></ul></div><div><h3>Exclusions</h3><ul id="exclude"></ul></div></div></section>
423
+ <section class="card" id="method"><h2>Method</h2><p class="sec-lead">Estimator v2: five weighted scores per feature price it on continuous bands; the project roll-up adds the work feature scoring never captures.</p>
424
+ <div class="twocol"><div><h3>Project context factors</h3><table class="kv" id="ctx"></table></div><div><h3>Work outside the features</h3><table class="kv" id="ovh"></table></div></div>
425
+ <div class="twocol"><div><h3>Contingency</h3><table class="kv" id="cont"></table></div><div><h3>Range</h3><table class="kv" id="rng"></table></div></div>
426
+ <h3>Cross-check: the engineering work behind the price</h3><p class="sec-lead">If the implied rate sits far from what the team costs, the scores or the task list need another look.</p><table class="kv" id="xcheck" style="max-width:40rem"></table></section>
427
+ <details class="guide"><summary>Scoring guide — what each 1–5 means</summary><div id="guide"></div></details>
428
+ </div>
429
+
430
+ <div class="bar"><div class="in">
431
+ <span class="stat" id="stat"></span>
432
+ <span class="saved" id="saved">Your edits are saved in this browser as you go.</span>
433
+ <div class="actions">
434
+ <button class="btn" id="reset" type="button">Start over</button>
435
+ <button class="btn next" id="nextc" type="button" title="Jump to the next gap, changed or flagged item (n)">Next to check ↓</button>
436
+ <button class="btn primary" id="preview" type="button">Review &amp; send →</button> <span class="quiet">You can reopen this page later; your changes stay in this browser.</span>
437
+ </div>
438
+ </div></div>
439
+
440
+ <div class="pinbar hide" id="pinbar" role="status">
441
+ <span>📌</span><div class="pin-txt"><b id="pinLabel"></b><small id="pinCount"></small></div>
442
+ <button class="btn" id="pinPrev" type="button" title="Previous (k)">↑</button>
443
+ <button class="btn" id="pinNext" type="button" title="Next (j)">↓ Next</button>
444
+ <button class="btn" id="pinClear" type="button" title="Esc">Clear</button>
445
+ </div>
446
+ <dialog id="xlsx-remind" aria-labelledby="xlsx-remind-title" style="max-width:32rem"><p><b id="xlsx-remind-title">Review the Project Roll-up tab</b></p>
447
+ <p>The workbook's last tab, Project Roll-up, sets the project context levels, the work outside features (foundation, QA, DevOps, PM…) and contingency. These change the final cost. Review and update them before you use the workbook's price.</p>
448
+ <div class="dlg-foot"><form method="dialog"><button class="btn primary">Got it</button></form></div></dialog>
449
+ <dialog id="dlg"><p><b>Your changes, before you send them</b></p><div class="sum" id="sum"></div>
450
+ <div id="sendable">
451
+ <p class="quiet" style="margin:.8rem 0 0">Feedback block — paste this into the chat. The agent asks why for every score you moved.</p>
452
+ <textarea id="feedback" readonly></textarea>
453
+ </div>
454
+ <div class="dlg-foot"><span id="copied"></span><form method="dialog"><button class="btn">Keep editing</button></form>
455
+ <button class="btn" id="goGap" type="button">Take me to the next gap</button>
456
+ <button class="btn primary" id="copy" type="button">Copy feedback</button></div></dialog>
457
+
458
+ <script type="application/json" id="page-data"><!-- slot:DATA --></script>
459
+ <script type="module">
460
+ const PAGE = JSON.parse(document.getElementById('page-data').textContent);
461
+ const DATA = PAGE.data; const ENG = PAGE.eng; const IMPLEMENTS = PAGE.implements; const CAP_SCORES = PAGE.scores; const TASKS = PAGE.tasks;
462
+ // FINAL: the Component-based page of the estimate, the same layout read-only after sign-off, plus tasks and hours
463
+ const FINAL = true;
464
+ const K = ['tech', 'size', 'deps', 'unc', 'risk'];
465
+ const LABEL = { tech: 'Tech', size: 'Size', deps: 'Deps', unc: 'Uncertainty', risk: 'Risk' };
466
+ const ANCHOR = PAGE.anchor;
467
+
468
+ // ---- v2 pricing, inlined from shared/lib/pricing.mjs ----
469
+ <!-- slot:MATH -->
470
+ const price = (s) => featurePrice(s);
471
+ const money = (n) => `$${Math.round(n).toLocaleString('en-US')}`;
472
+
473
+ // ---- two layers: features (scored, priced) and components (what builds them, linked N-to-N) ----
474
+ const $ = (s, el = document) => el.querySelector(s);
475
+ const esc = (s) => String(s).replace(/[&<>"]/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;' }[c]));
476
+ const CAPS = DATA.systems.flatMap((s) => s.features.map((c) => ({ ...c, sys: s })));
477
+ const capById = Object.fromEntries(CAPS.map((c) => [c.id, c]));
478
+ const COMPS = ENG;
479
+ const compById = Object.fromEntries(COMPS.map((b) => [b.id, b]));
480
+ const sysNo = (capId) => DATA.systems.indexOf(capById[capId].sys) + 1;
481
+ const sid = (s) => `s-${s.id}`;
482
+ const orig = (id) => Object.fromEntries(K.map((k, i) => [k, CAP_SCORES[id][i]]));
483
+ const cur = Object.fromEntries(CAPS.map((c) => [c.id, orig(c.id)]));
484
+ const links = Object.fromEntries(COMPS.map((b) => [b.id, [...(IMPLEMENTS[b.id] || [])]]));
485
+ const notes = {}; const reasons = {}; const asks = {}; // asks[capId] = note when the engineer asks the agent to add a component
486
+ let pin = null; // pinned highlight, see the hover/pin section
487
+ const STORE = `score-review:${DATA.project}:v4:${PAGE.baseline}`;
488
+ if (!FINAL) try { const v = JSON.parse(localStorage.getItem(STORE) || '{}');
489
+ for (const [o, src] of [[notes, v.notes], [reasons, v.reasons], [asks, v.asks]]) Object.assign(o, src || {});
490
+ for (const [id, sc] of Object.entries(v.scores || {})) if (cur[id]) Object.assign(cur[id], sc);
491
+ for (const [id, l] of Object.entries(v.links || {})) if (links[id]) links[id] = l.filter((c) => capById[c]); } catch { /* start fresh */ }
492
+ function save() {
493
+ if (FINAL) return;
494
+ try { localStorage.setItem(STORE, JSON.stringify({ scores: cur, notes, reasons, links, asks }));
495
+ $('#saved').textContent = `Saved in this browser at ${new Date().toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}`; }
496
+ catch { $('#saved').textContent = 'This browser cannot save; copy the feedback before closing.'; }
497
+ }
498
+ const changedKeys = (id) => K.filter((k) => cur[id][k] !== orig(id)[k]);
499
+ const sameSet = (a, b) => a.length === b.length && a.every((x) => b.includes(x));
500
+ const buildersOf = (capId) => COMPS.filter((b) => links[b.id].includes(capId)).map((b) => b.id);
501
+ const origBuilders = (capId) => COMPS.filter((b) => (IMPLEMENTS[b.id] || []).includes(capId)).map((b) => b.id);
502
+ const isChanged = (id) => changedKeys(id).length > 0 || !sameSet(buildersOf(id), origBuilders(id));
503
+ // "unlinked" has two sides: a feature no component builds (blocks sending:
504
+ // nobody would build it) and a component that builds no feature (shown, so it gets a look)
505
+ const notBuilt = (capId) => !buildersOf(capId).length && asks[capId] === undefined;
506
+ const notAsked = (bid) => !links[bid].length;
507
+ const notBuiltCount = () => CAPS.filter((c) => notBuilt(c.id)).length;
508
+ const unlinkedCount = () => notBuiltCount() + COMPS.filter((b) => notAsked(b.id)).length;
509
+ // a feature lands in the milestone of its main component: the one most specific to it
510
+ // (fewest other features; earliest milestone on a tie), as the roll-up does
511
+ const mainComp = (capId) => buildersOf(capId).map((id) => compById[id]).sort((a, b) => links[a.id].length - links[b.id].length || a.milestone.localeCompare(b.milestone))[0];
512
+
513
+ // ---- systems & workflows: one panel per system, diagrams + feature table; one open at a time ----
514
+ function flowCode(fl) {
515
+ const ids = new Map(); const id = (n) => { if (!ids.has(n)) ids.set(n, `n${ids.size}`); return ids.get(n); };
516
+ const L = ['flowchart LR'];
517
+ fl.steps.forEach((st, i) => { if (i) L.push(` ${id(fl.steps[i - 1])} --> ${id(st)}`); });
518
+ fl.branches.forEach((b) => L.push(` ${id(b.from)} -.-> ${id(b.to)}`));
519
+ const map = {}; for (const [n, i] of ids) { L.push(` ${i}["${n.replace(/"/g, "'")}"]`); map[i] = `${fl.id}:${n}`; }
520
+ return { code: L.join('\n'), map };
521
+ }
522
+ const flowsOf = (s) => [s.main, ...s.subs].filter(Boolean);
523
+ const stepsOfSys = (s) => flowsOf(s).flatMap((fl) => [...fl.steps, ...fl.branches.map((b) => b.to)].map((st) => `${fl.id}:${st}`));
524
+ const capRefs = (c) => new Set(c.steps.includes('*') ? stepsOfSys(c.sys) : c.steps);
525
+ const stepName = (r) => r.slice(r.indexOf(':') + 1);
526
+ function diagrams(s) {
527
+ return flowsOf(s).map((fl) => { const m = flowCode(fl);
528
+ return `<p class="flow-name">${fl === s.main ? 'Main' : 'Sub'} · ${esc(fl.name)}</p><div class="flow" data-map="${esc(JSON.stringify(m.map))}"><pre class="mermaid">${esc(m.code)}</pre></div>`; }).join('');
529
+ }
530
+ function capRow(c) {
531
+ const steps = c.steps.includes('*') ? '<span class="chip">every step</span>' : c.steps.map((r) => `<span class="chip">${esc(stepName(r))}</span>`).join('') || '<span class="chip">off-step</span>';
532
+ return `<tr data-cap="${c.id}"><td><span class="dim">${c.id}</span> <b>${esc(c.name)}</b></td><td>${steps}</td><td class="built" data-built="${c.id}"></td></tr>`;
533
+ }
534
+ function renderMap() {
535
+ $('#systems').innerHTML = DATA.systems.map((s, i) => `<details class="capsys" data-sys="${s.id}"><summary>System ${i + 1} · ${esc(s.name)} <span class="dim" data-syscover="${s.id}"></span></summary>
536
+ ${diagrams(s)}<table class="caps"><tr><th>Feature</th><th>Workflow steps</th><th>Built by (components)</th></tr>${s.features.map((c) => capRow({ ...c, sys: s })).join('')}</table></details>`).join('');
537
+ }
538
+ function paintCap(c) {
539
+ const by = buildersOf(c.id);
540
+ $(`tr[data-cap="${c.id}"]`).classList.toggle('gap', notBuilt(c.id));
541
+ $(`[data-built="${c.id}"]`).innerHTML = by.length ? by.map((id) => `<span class="chip eng" data-comp-chip="${id}">${esc(compById[id].name)}</span>`).join('')
542
+ : asks[c.id] !== undefined ? '<span class="dim">asked the agent to add a component</span>' : '<span class="gapnote">⚠ Not built yet: see its card</span>';
543
+ }
544
+
545
+ // ---- feature cards, one section per system ----
546
+ function factorHtml(c, k) {
547
+ if (FINAL) { const n = cur[c.id][k];
548
+ return `<div class="factor ro"><div class="flabel">${LABEL[k]}<i>${WEIGHTS[k] * 100}%</i></div><div class="ro-n${n === 5 ? ' hot' : ''}">${n}<span>/5</span></div><p class="anchor">${esc(ANCHOR[k][n - 1])}</p></div>`; }
549
+ const pick = [1, 2, 3, 4, 5].map((n) => `<button type="button" data-f="${c.id}" data-k="${k}" data-n="${n}" title="${n} — ${esc(ANCHOR[k][n - 1])}">${n}</button>`).join('');
550
+ // the read-back contract: one hidden select per score, value 1–5, title = rubric anchor
551
+ const sel = `<select class="hide" data-id="${c.id}" data-key="${k}">${[1, 2, 3, 4, 5].map((n) => `<option value="${n}" title="${esc(ANCHOR[k][n - 1])}">${n}</option>`).join('')}</select>`;
552
+ return `<div class="factor" data-fk="${c.id}:${k}"><div class="flabel">${LABEL[k]}<i>${WEIGHTS[k] * 100}%</i></div>${sel}
553
+ <div class="pick">${pick}</div><p class="anchor"></p><div class="reason hide"><p class="was"></p><textarea data-reason="${c.id}:${k}" rows="2" placeholder="Why this score? e.g. no sample emails yet"></textarea></div></div>`;
554
+ }
555
+ function capHtml(c) {
556
+ const who = `<div class="who"><div class="id">${c.id} · System ${sysNo(c.id)} · ${esc(c.sys.name.split(' (')[0])}<span data-ms="${c.id}"></span></div><h3>${esc(c.name)}</h3><p class="does">${esc(c.does)}</p></div>`;
557
+ const effort = FINAL ? `<div class="side-effort effort"><b data-hrs="${c.id}"></b><span>expected effort of its components</span></div>` : '';
558
+ const box = `<div class="score-box"><div class="side-score"><div class="verdict"><span class="total">Σ <b data-total="${c.id}"></b></span><span class="tier" data-tier="${c.id}"></span><span class="moved" data-moved="${c.id}"></span></div>
559
+ <div class="price" data-price="${c.id}"></div><div data-flag="${c.id}"></div></div>${effort}</div>`;
560
+ const note = FINAL ? '' : `<label class="note">Note in plain words (optional)<textarea data-note="${c.id}" rows="3" placeholder="e.g. scan rules need sample barcodes before we can price it tighter"></textarea></label>`;
561
+ return `<article class="feat" id="c-${c.id}" data-feat="${c.id}"><div class="rail">${who}${box}</div>
562
+ <div class="builds" data-builtby="${c.id}"></div>
563
+ <div class="side-score"><div class="factors">${K.map((k) => factorHtml(c, k)).join('')}</div>${note}</div></article>`;
564
+ }
565
+ // ---- components: tasks and hours (Component-based page only) ----
566
+ const pert = (x) => x[2]; // expected hours from estimation.json (agentic baselines)
567
+ const hoursOf = (id) => Math.round((typeof TASKS === 'undefined' ? [] : TASKS[id] || []).reduce((n, x) => n + pert(x), 0));
568
+ function tasksHtml(b) {
569
+ const ts = TASKS[b.id] || [];
570
+ return `<details class="tasks side-effort"><summary>${esc(b.name)} · ${ts.length} tasks · ${hoursOf(b.id)}h expected</summary><table><tr><th>Task</th><th class="r">Low / Expected / High h</th><th class="r">Expected</th><th>Confidence</th></tr>${ts.map((x) =>
571
+ `<tr><td>${esc(x[0])}${x[5] ? `<div class="dim">${esc(x[5])}</div>` : ''}</td><td class="r">${x[1]} / ${x[2]} / ${x[3]}</td><td class="r"><b>${Math.round(pert(x))}h</b></td><td><span class="conf c-${x[4]}">${x[4]}</span></td></tr>`).join('')}</table></details>`;
572
+ }
573
+ // the architecture document holds the C4 views; this page links there instead of redrawing them.
574
+ // PAGE.c3 maps a container's name to its id when it has components (a C3 view); the rest live in C2.
575
+ const ARCH = PAGE.arch;
576
+ const archLink = (containers) => {
577
+ const c3 = containers.filter((c) => Object.hasOwn(PAGE.c3, c));
578
+ const c2 = containers.some((c) => !Object.hasOwn(PAGE.c3, c));
579
+ return [...c3.map((c) => `<a class="archlink" href="${ARCH}#panel-components-${PAGE.c3[c]}" target="_blank" rel="noopener">C3 ${esc(c)} ↗</a>`),
580
+ c2 && `<a class="archlink" href="${ARCH}#panel-containers" target="_blank" rel="noopener">C2 containers ↗</a>`].filter(Boolean).join(' · ');
581
+ };
582
+ // one row per component: its container, its name, and the other features it builds
583
+ function compRow(bid, capId, cls = '') {
584
+ const b = compById[bid]; const others = links[bid].filter((c) => c !== capId);
585
+ const also = others.length ? `also builds ${others.map((c) => `<span class="cmini" style="--sc:var(--s${sysNo(c)})" data-cap-chip="${c}" title="${esc(capById[c].name)}">${c}</span>`).join('')}` : '<span class="dim">only this feature</span>';
586
+ const x = !FINAL && !cls.includes('removed') ? `<button type="button" data-unlink="${bid}:${capId}" title="This component does not build it">×</button>` : '';
587
+ return `<div class="crow${cls}" data-comp-chip="${bid}"><span class="ccont">${esc(b.container)}</span><b class="cname">${esc(b.name)}</b><span class="calso">${also}</span>${FINAL ? `<span class="chrs">${hoursOf(bid)}h</span>` : ''}${x}</div>`;
588
+ }
589
+ // the "Built by" panel on a feature card: rows (× unlinks), a picker to add one, or the gap
590
+ function paintBuilt(capId) {
591
+ const by = buildersOf(capId); const was = origBuilders(capId); const box = $(`[data-builtby="${capId}"]`);
592
+ const conts = [...new Set(by.map((b) => compById[b].container))]; const ms = mainComp(capId)?.milestone;
593
+ $(`[data-ms="${capId}"]`).textContent = ms ? ` · ${ms}` : '';
594
+ box.classList.toggle('none', !by.length);
595
+ const head = by.length ? `Built by <b>${by.length}</b> component${by.length > 1 ? 's' : ''} in <b>${conts.length}</b> container${conts.length > 1 ? 's' : ''}` : 'Not built yet';
596
+ if (FINAL) { const h = by.reduce((n, b) => n + hoursOf(b), 0); $(`[data-hrs="${capId}"]`).textContent = `${h.toLocaleString('en-US')}h`;
597
+ box.innerHTML = `<div class="bhead">${head}<span class="arch">${archLink(conts)}</span></div><div class="crows">${by.map((b) => compRow(b, capId)).join('')}</div>${by.map((b) => tasksHtml(compById[b])).join('')}`; return; }
598
+ const rows = by.map((b) => compRow(b, capId, was.includes(b) ? '' : ' added')).join('') + was.filter((b) => !by.includes(b)).map((b) => compRow(b, capId, ' removed')).join('');
599
+ const conts2 = [...new Set(COMPS.map((b) => b.container))];
600
+ const pick = `<select data-link="${capId}" aria-label="Link a component"><option value="">+ Link a component</option>${conts2.map((g) => `<optgroup label="${esc(g)}">${COMPS.filter((b) => b.container === g && !by.includes(b.id)).map((b) =>
601
+ `<option value="${b.id}">${esc(b.name)}${notAsked(b.id) ? ' · builds nothing yet' : ''}</option>`).join('')}</optgroup>`).join('')}</select>`;
602
+ const gap = by.length ? '' : asks[capId] !== undefined
603
+ ? `<div class="ask"><b>Asked the agent to add a component</b> <button type="button" class="btn" data-unask="${capId}">undo</button><textarea data-ask="${capId}" rows="1" placeholder="What should it cover? e.g. parse emails/faxes into a draft order">${esc(asks[capId])}</textarea></div>`
604
+ : `<div class="ask"><span class="gapnote">⚠ No component builds this, so nobody would build it.</span> <button type="button" class="btn" data-ask-btn="${capId}">Ask the agent to add one</button> <span class="dim">or link one</span></div>`;
605
+ box.innerHTML = `<div class="bhead">${head}${conts.length ? `<span class="arch">${archLink(conts)}</span>` : ''}</div>${gap}<div class="crows">${rows}</div>${pick}`;
606
+ }
607
+ // components that build no feature: listed once below the cards, so they get a look
608
+ function paintUnasked() {
609
+ const un = COMPS.filter((b) => notAsked(b.id));
610
+ $('#unasked').innerHTML = un.length ? `<section class="system" id="unasked-sec"><div class="sys-head"><div><div class="eyebrow">Unlinked · ${un.length}</div><h2>Components that build no feature</h2></div></div>
611
+ <p class="quiet">If the roll-up already covers one (foundation, DevOps) or an assumption excludes it, it should go; otherwise link it from a feature card above.</p>
612
+ <div class="crows">${un.map((b) => `<div class="crow" data-comp-chip="${b.id}"><span class="ccont">${esc(b.container)}</span><b class="cname">${esc(b.name)}</b><span class="calso dim">${esc(b.does)}</span></div>`).join('')}</div></section>` : '';
613
+ }
614
+ function render() {
615
+ renderMap();
616
+ $('#groups').innerHTML = DATA.systems.map((s, i) => `<section class="system" id="${sid(s)}" data-sec="${s.id}"><div class="sys-head"><div><div class="eyebrow">System ${i + 1} · ${s.features.length} features</div><h2>${esc(s.name)}</h2></div>
617
+ <div class="subtotal" data-sub="${s.id}"></div></div>${s.features.map((c) => capHtml({ ...c, sys: s })).join('')}</section>`).join('');
618
+ $('#guide').innerHTML = `<table class="guide-table"><tr><th></th>${[1, 2, 3, 4, 5].map((n) => `<th>${n}</th>`).join('')}</tr>${K.map((k) =>
619
+ `<tr><td class="dim">${LABEL[k]} ${WEIGHTS[k] * 100}%</td>${ANCHOR[k].map((a) => `<td>${esc(a)}</td>`).join('')}</tr>`).join('')}</table>`;
620
+ if (!FINAL) CAPS.forEach((c) => { $(`[data-note="${c.id}"]`).value = notes[c.id] || ''; });
621
+ }
622
+ function paint(id) {
623
+ const s = cur[id]; const p = price(s); const o = price(orig(id));
624
+ $(`[data-total="${id}"]`).textContent = p.score.toFixed(1);
625
+ const t = $(`[data-tier="${id}"]`); t.textContent = p.tier; t.className = `tier t-${p.tier}`;
626
+ $(`[data-moved="${id}"]`).textContent = p.tier !== o.tier ? `was ${o.tier}` : '';
627
+ $(`[data-price="${id}"]`).innerHTML = `<b>${money(p.point)}</b> <span class="quiet">(${money(p.low)}–${money(p.high)})</span>${Math.round(p.point) !== Math.round(o.point) ? ` <span class="moved">was ${money(o.point)}</span>` : ''}`;
628
+ $(`[data-flag="${id}"]`).innerHTML = p.flag ? `<span class="flagchip">⚑ ${p.flag}</span>` : '';
629
+ if (!FINAL) K.forEach((k) => {
630
+ const box = $(`[data-fk="${id}:${k}"]`); const was = orig(id)[k];
631
+ box.classList.toggle('changed', s[k] !== was);
632
+ box.querySelectorAll('.pick button').forEach((b) => { b.classList.toggle('on', +b.dataset.n === s[k]); b.classList.toggle('orig', +b.dataset.n === was && s[k] !== was); });
633
+ $('select', box).value = String(s[k]);
634
+ $('.anchor', box).textContent = ANCHOR[k][s[k] - 1];
635
+ const r = $('.reason', box); r.classList.toggle('hide', s[k] === was);
636
+ $('.was', r).textContent = `Agent proposed ${was}. Your evidence for ${s[k]}:`;
637
+ const inp = $('textarea', r); if (document.activeElement !== inp) inp.value = reasons[`${id}:${k}`] || '';
638
+ r.classList.toggle('missing', s[k] !== was && !(reasons[`${id}:${k}`] || '').trim());
639
+ });
640
+ paintBuilt(id);
641
+ }
642
+ function strip(sum) {
643
+ const { now, tiers, flags, covered, gaps } = sum; const unasked = COMPS.filter((b) => notAsked(b.id)).length;
644
+ const scoring = `<div><b>${CAPS.length}</b><span>features scored</span></div>
645
+ <div class="${gaps ? 'warn' : ''}"><b>${covered} / ${CAPS.length}</b><span>built by a component</span></div>
646
+ <div><b>${tiers.S} · ${tiers.M} · ${tiers.L} · ${tiers.XL}</b><span>S · M · L · XL</span></div>
647
+ <div><b>${money(now)}</b><span>feature build subtotal (before context, overheads, contingency)</span></div>
648
+ <div class="${flags ? 'warn' : ''}"><b>${flags}</b><span>need a closer look (deep estimate recommended)</span></div>`;
649
+ // hours once per component: a shared component is listed under several features but built once
650
+ if (FINAL) { const H = COMPS.reduce((n, b) => n + hoursOf(b.id), 0); const T = COMPS.reduce((n, b) => n + (TASKS[b.id] || []).length, 0);
651
+ return `${scoring}<div><b>${COMPS.length}</b><span>components</span></div><div><b>${T}</b><span>tasks</span></div><div><b>${H.toLocaleString('en-US')}h</b><span>expected effort, each component counted once</span></div>`; }
652
+ return `${scoring}<div class="${unasked ? 'warn' : ''}"><b>${COMPS.length}${unasked ? ` · ${unasked}` : ''}</b><span>components${unasked ? ' · build no feature' : ''}</span></div>
653
+ <div class="${gaps ? 'warn' : ''}"><b>${gaps}</b><span>features not built yet (blocks sending)</span></div>`;
654
+ }
655
+ function navHtml(count) {
656
+ const openName = openSys && DATA.systems.find((s) => s.id === openSys).name.split(' (')[0];
657
+ const toggle = `<div class="view seg" role="group" aria-label="Cards"><button type="button" data-cards="all" aria-pressed="${!sysFilter}" data-tip="Every feature card">All</button><button type="button" data-cards="wf" aria-pressed="${sysFilter}" data-tip="Only the feature cards of the system open in Systems &amp; workflows above. Open another system there to switch.">Workflows${sysFilter ? ` · ${esc(openName)}` : ''}</button></div>`;
658
+ const sides = FINAL ? `<div class="view seg" role="group" aria-label="Card view"><button type="button" data-side="score" aria-pressed="${side === 'score'}" data-tip="Each feature&#39;s scores, tier and price, as signed off in the score review">Scoring</button><button type="button" data-side="effort" aria-pressed="${side === 'effort'}" data-tip="The components behind each feature, with their tasks and hours">Effort</button></div>` : '';
659
+ const jumps = DATA.systems.map((s) => { const n = s.features.filter((c) => capVisible({ ...c, sys: s })).length; const c = s.features.filter((x) => isChanged(x.id)).length;
660
+ return n ? `<a href="#${sid(s)}" data-tip="Jump to the ${esc(s.name)} cards (${n} shown)">${esc(s.name.split(' (')[0])} <span class="cnt">${n}</span>${c ? `<span class="n">${c} edited</span>` : ''}</a>` : ''; }).join('');
661
+ const FILTERS = [...(FINAL ? [] : [['edits', 'my edits', 'Cards where you moved a score or a component link']]),
662
+ ['closer', 'needs a closer look', 'The pricing rule recommends a deep estimate: the range is ±40% or wider, or the price is $6,000 or more'],
663
+ ['unlinked', 'unlinked', 'Not built yet: a feature no component builds (blocks sending). Also lists components that build no feature.']];
664
+ return `<div class="navrow">${toggle}${sides}</div>`
665
+ + `<div class="navrow"><span class="navlbl" data-tip="Each system is a section of feature cards below">Jump to</span>${jumps}`
666
+ + `<span class="filters"><span class="navlbl" data-tip="Narrow the cards; click again to clear. Combines with All | Workflows.">Show</span>${FILTERS.map(([f, label, tip]) =>
667
+ `<button type="button" data-filter="${f}" aria-pressed="${filter === f}" data-tip="${tip}">${label} <span class="cnt">${count[f]}</span></button>`).join('')}</span></div>`;
668
+ }
669
+ function totals() {
670
+ let now = 0; let was = 0; let flags = 0; let changed = 0; const tiers = { S: 0, M: 0, L: 0, XL: 0 };
671
+ DATA.systems.forEach((s) => {
672
+ let sn = 0; let sw = 0;
673
+ s.features.forEach((c) => { const p = price(cur[c.id]); sn += p.point; sw += price(orig(c.id)).point; tiers[p.tier] += 1; if (p.flag) flags += 1; if (isChanged(c.id)) changed += 1; });
674
+ now += sn; was += sw;
675
+ $(`[data-sec="${s.id}"]`).classList.toggle('hide', !s.features.some((c) => capVisible({ ...c, sys: s })));
676
+ const hrs = FINAL ? new Set(s.features.flatMap((c) => buildersOf(c.id))) : null;
677
+ $(`[data-sub="${s.id}"]`).innerHTML = `<div class="side-score"><b>${money(sn)}</b><span>feature build subtotal</span>${Math.round(sn) !== Math.round(sw) ? `<span class="was"> · was ${money(sw)}</span>` : ''}</div>`
678
+ + (FINAL ? `<div class="side-effort"><b>${[...hrs].reduce((n, b) => n + hoursOf(b), 0).toLocaleString('en-US')}h</b><span>${hrs.size} components, each counted once</span></div>` : '');
679
+ });
680
+ CAPS.forEach(paintCap);
681
+ const covered = CAPS.filter((c) => buildersOf(c.id).length).length; const gaps = notBuiltCount();
682
+ DATA.systems.forEach((s) => { const n = s.features.filter((c) => notBuilt(c.id)).length; $(`[data-syscover="${s.id}"]`).innerHTML = n ? `<span class="gapnote">· ⚠ ${n} not built</span>` : `· ${s.features.length} features, all built`; });
683
+ $('#cover').innerHTML = `<b class="${gaps ? 'gapnote' : ''}">${covered} / ${CAPS.length}</b><span>features built by a component</span>`;
684
+ $('#strip').innerHTML = strip({ now, tiers, flags, covered, gaps });
685
+ $('#stat').innerHTML = `<b>${changed}</b> edited · <b class="${gaps ? 'gapnote' : ''}">${gaps}</b> not built yet · subtotal <b>${money(now)}</b>${Math.round(now) !== Math.round(was) ? ` (was ${money(was)})` : ''}`;
686
+ $('#preview').title = gaps ? `${gaps} feature${gaps === 1 ? '' : 's'} not built yet: you can review, but not send` : '';
687
+ repaintNav();
688
+ }
689
+ function repaintNav() {
690
+ const count = { edits: CAPS.filter((c) => isChanged(c.id)).length, closer: CAPS.filter((c) => price(cur[c.id]).flag).length, unlinked: unlinkedCount() };
691
+ $('#nav').innerHTML = navHtml(count);
692
+ spine();
693
+ if (pin) highlight(...pin.hit);
694
+ }
695
+ function spine() {
696
+ const cols = Array.from({ length: 21 }, () => []);
697
+ CAPS.forEach((c) => { const p = price(cur[c.id]); cols[Math.min(20, Math.round(p.score) - 5)].push({ c, p }); });
698
+ $('#spine').innerHTML = cols.map((col) => `<div class="col">${col.map(({ c, p }) =>
699
+ `<button class="dot${isChanged(c.id) ? ' changed' : ''}${p.flag ? ' flag' : ''}" data-go="${c.id}" title="${c.id} ${esc(c.name)} · ${p.score.toFixed(1)} ${p.tier}"></button>`).join('')}</div>`).join('');
700
+ }
701
+ let filter = 'all';
702
+ let side = 'score'; // FINAL only: Scoring | Effort
703
+ let sysFilter = false; let openSys = null; // system open in Systems & workflows + the All | Workflows toggle
704
+ const PASS = { all: () => true, edits: (c) => isChanged(c.id), closer: (c) => !!price(cur[c.id]).flag, unlinked: (c) => notBuilt(c.id) };
705
+ const capVisible = (c) => PASS[filter](c) && (!sysFilter || c.sys.id === openSys);
706
+ function applyFilter() {
707
+ CAPS.forEach((c) => $(`#c-${c.id}`).classList.toggle('hide', !capVisible(c)));
708
+ $('#unasked').classList.toggle('hide', !['all', 'unlinked'].includes(filter));
709
+ }
710
+ function openSystem(s) {
711
+ openSys = s;
712
+ if (!s) sysFilter = false; // nothing picked: Workflows has nothing to follow
713
+ document.querySelectorAll('details.capsys').forEach((d) => { d.open = d.dataset.sys === s; });
714
+ }
715
+ const refresh = (id) => { if (id) paint(id); totals(); applyFilter(); };
716
+ const relink = () => { CAPS.forEach((c) => paintBuilt(c.id)); paintUnasked(); refresh(); save(); };
717
+
718
+ // ---- feedback: the --read contract (feature scores + component links) ----
719
+ const reasonsFor = (id) => Object.fromEntries(changedKeys(id).map((k) => [k, (reasons[`${id}:${k}`] || '').trim()]).filter(([, v]) => v));
720
+ window.__feedback = () => ({
721
+ features: CAPS.map((c) => ({ id: c.id, scores: { ...cur[c.id] }, scoreNote: notes[c.id] || '', ...(changedKeys(c.id).length ? { reasons: reasonsFor(c.id) } : {}) })),
722
+ components: COMPS.map((b) => ({ id: b.id, implements: [...links[b.id]] })),
723
+ addComponent: CAPS.filter((c) => asks[c.id] !== undefined && !buildersOf(c.id).length).map((c) => ({ feature: c.id, note: asks[c.id].trim() })) });
724
+ const missingReasons = () => CAPS.flatMap((c) => changedKeys(c.id).filter((k) => !(reasons[`${c.id}:${k}`] || '').trim()).map((k) => `${c.id} ${LABEL[k]}`));
725
+ function linkSummary() {
726
+ const rows = CAPS.filter((c) => !sameSet(buildersOf(c.id), origBuilders(c.id))).map((c) => { const was = origBuilders(c.id); const now = buildersOf(c.id);
727
+ return `<tr><td><b>${c.id} ${esc(c.name)}</b></td><td>${now.filter((b) => !was.includes(b)).map((b) => `<span class="down">+ ${esc(compById[b].name)}</span>`).join('<br>')}${was.filter((b) => !now.includes(b)).map((b) => `<span class="up">− ${esc(compById[b].name)}</span>`).join('<br>')}</td></tr>`; }).join('');
728
+ const asked = CAPS.filter((c) => asks[c.id] !== undefined && !buildersOf(c.id).length).map((c) => `<tr><td><b>${c.id}</b> ${esc(c.name)}</td><td>Ask the agent to add a component${asks[c.id].trim() ? `: “${esc(asks[c.id].trim())}”` : ''}</td></tr>`).join('');
729
+ return (rows ? `<h4>Components you linked or unlinked</h4><table><tr><th>Feature</th><th>Components</th></tr>${rows}</table>` : '')
730
+ + (asked ? `<h4>Not built yet — you asked the agent to add a component</h4><table><tr><th>Feature</th><th>Request</th></tr>${asked}</table>` : '');
731
+ }
732
+ function summaryHtml() {
733
+ const rows = (s) => s.features.filter((c) => changedKeys(c.id).length || notes[c.id]).map((c) => {
734
+ const p = price(cur[c.id]); const o = price(orig(c.id)); const d = p.point - o.point;
735
+ return `<tr><td><b>${c.id} ${esc(c.name)}</b></td><td>${changedKeys(c.id).map((k) => { const why = (reasons[`${c.id}:${k}`] || '').trim();
736
+ return `${LABEL[k]} ${orig(c.id)[k]}→${cur[c.id][k]}<div class="${why ? 'quiet' : 'up'}">${why ? `“${esc(why)}”` : 'no reason yet'}</div>`; }).join('') || '—'}</td>
737
+ <td>${o.tier}${p.tier !== o.tier ? ` → <b>${p.tier}</b>` : ''}</td><td>${money(o.point)} → ${money(p.point)} <span class="${d > 0 ? 'up' : 'down'}">${d ? `${d > 0 ? '+' : '−'}${money(Math.abs(d))}` : ''}</span></td>
738
+ <td>${notes[c.id] ? `“${esc(notes[c.id])}”` : ''}</td></tr>`; }).join('');
739
+ const parts = DATA.systems.map((s) => { const r = rows(s); return r ? `<h4>${esc(s.name)}</h4><table><tr><th>Feature</th><th>Scores moved</th><th>Tier</th><th>Point price</th><th>Note</th></tr>${r}</table>` : ''; }).join('');
740
+ const gaps = notBuiltCount(); const miss = missingReasons(); const unasked = COMPS.filter((b) => notAsked(b.id));
741
+ const block = gaps ? `<div class="warnbox"><b>${gaps} feature${gaps > 1 ? 's' : ''} not built yet — you can&#39;t send until each is built by a component, or you ask the agent to add one.</b> ${CAPS.filter((c) => notBuilt(c.id)).map((c) => `${c.id} ${esc(c.name)}`).join(' · ')}</div>` : '';
742
+ const info = unasked.length ? `<p class="quiet">Components that build no feature (check they should stay): ${unasked.map((b) => esc(b.name)).join(' · ')}</p>` : '';
743
+ const warn = miss.length ? `<div class="warnbox soft">${miss.length} changed score${miss.length > 1 ? 's have' : ' has'} no reason (${esc(miss.join(', '))}). You can still send; the agent will ask in chat.</div>` : '';
744
+ const body = parts + linkSummary();
745
+ return block + warn + info + (body || '<p class="quiet">No changes: you accepted every proposed score and component link. The feedback block still records that.</p>');
746
+ }
747
+
748
+ // ---- wiring ----
749
+ $('#subcount').textContent = `${CAPS.length} features in ${DATA.systems.length} systems, built by ${COMPS.length} components`;
750
+ render(); CAPS.forEach((c) => paint(c.id)); paintUnasked(); totals(); applyFilter();
751
+ function onEdit(e) {
752
+ const b = e.target.closest('.pick button');
753
+ if (b) { const { f, k } = b.dataset; cur[f][k] = +b.dataset.n; refresh(f); save(); return true; }
754
+ const un = e.target.closest('[data-unlink]')?.dataset.unlink;
755
+ if (un) { const [bid, c] = un.split(':'); links[bid] = links[bid].filter((x) => x !== c); relink(); return true; }
756
+ const ask = e.target.closest('[data-ask-btn]')?.dataset.askBtn;
757
+ if (ask) { asks[ask] = ''; relink(); $(`[data-ask="${ask}"]`)?.focus(); return true; }
758
+ const unask = e.target.closest('[data-unask]')?.dataset.unask;
759
+ if (unask) { delete asks[unask]; relink(); return true; }
760
+ return false;
761
+ }
762
+ function onCards(cards) {
763
+ sysFilter = cards === 'wf';
764
+ if (!sysFilter) openSystem(null); // All: every card, every system collapsed
765
+ if (sysFilter && !openSys) openSystem((DATA.systems.find((s) => s.features.some((c) => notBuilt(c.id))) || DATA.systems[0]).id);
766
+ refresh(); if (sysFilter) $('#map').scrollIntoView({ block: 'start', behavior: 'smooth' });
767
+ }
768
+ function onNav(e) {
769
+ const go = e.target.closest('[data-go]');
770
+ if (go && $(`#c-${go.dataset.go}`).classList.contains('hide')) { filter = 'all'; sysFilter = false; refresh(); }
771
+ const fl = e.target.closest('[data-filter]');
772
+ if (fl) { filter = filter === fl.dataset.filter ? 'all' : fl.dataset.filter; refresh(); if (filter === 'unlinked') { lastC = null; nextItem(true); } }
773
+ const sd = e.target.closest('[data-side]')?.dataset.side;
774
+ if (sd) { side = sd; document.body.classList.toggle('side-effort-on', side === 'effort'); totals(); }
775
+ const cards = e.target.closest('[data-cards]')?.dataset.cards;
776
+ if (cards) onCards(cards);
777
+ }
778
+ document.addEventListener('click', (e) => { if (!onEdit(e)) onNav(e); });
779
+ // one system open at a time; with Workflows on, the open system picks the cards
780
+ $('#systems').addEventListener('toggle', (e) => {
781
+ const d = e.target; if (!d.matches?.('details.capsys') || drawing) return;
782
+ if (d.open) { openSystem(d.dataset.sys); sysFilter = true; } // opening a system shows its cards
783
+ else if (openSys === d.dataset.sys) openSystem(null);
784
+ refresh();
785
+ }, true);
786
+ document.addEventListener('change', (e) => {
787
+ const capId = e.target.dataset.link;
788
+ if (capId && e.target.value) { links[e.target.value] = [...links[e.target.value], capId]; relink(); }
789
+ });
790
+ document.addEventListener('input', (e) => {
791
+ const n = e.target.dataset.note; if (n) { notes[n] = e.target.value; save(); }
792
+ const a = e.target.dataset.ask; if (a) { asks[a] = e.target.value; save(); }
793
+ const r = e.target.dataset.reason;
794
+ if (r) { reasons[r] = e.target.value; e.target.closest('.reason').classList.toggle('missing', !e.target.value.trim()); save(); }
795
+ });
796
+ // ---- hover previews, click pins: diagram box ↔ feature ↔ component, everywhere they show ----
797
+ // A step lights its features and the components that build them; a component
798
+ // lights every feature it builds and their steps, in every system.
799
+ const compsOf = (caps) => new Set([...caps].flatMap(buildersOf));
800
+ const refsOf = (caps) => new Set([...caps].flatMap((c) => [...capRefs(capById[c])]));
801
+ function fromStep(ref) { const caps = new Set(CAPS.filter((c) => capRefs(c).has(ref)).map((c) => c.id)); return [new Set([ref]), caps, compsOf(caps)]; }
802
+ function fromCap(id) { const caps = new Set([id]); return [refsOf(caps), caps, compsOf(caps)]; }
803
+ function fromComp(id) { const caps = new Set(links[id]); return [refsOf(caps), caps, new Set([id])]; }
804
+ function highlight(refs, caps, comps) {
805
+ document.querySelectorAll('.feat').forEach((c) => c.classList.toggle('hl', caps.has(c.dataset.feat)));
806
+ document.querySelectorAll('.dot').forEach((d) => d.classList.toggle('hl', caps.has(d.dataset.go)));
807
+ document.querySelectorAll('tr[data-cap]').forEach((t) => t.classList.toggle('hl', caps.has(t.dataset.cap)));
808
+ document.querySelectorAll('[data-cap-chip]').forEach((t) => t.classList.toggle('hl', caps.has(t.dataset.capChip)));
809
+ document.querySelectorAll('[data-comp-chip]').forEach((t) => t.classList.toggle('hl', comps.has(t.dataset.compChip)));
810
+ document.querySelectorAll('.flow').forEach((d) => { const map = JSON.parse(d.dataset.map);
811
+ d.querySelectorAll('g.node').forEach((g) => g.classList.toggle('hl', refs.has(map[(g.id.match(/flowchart-(n\d+)-/) || [])[1]]))); });
812
+ }
813
+ const clearHl = () => document.querySelectorAll('.hl, .cur').forEach((x) => x.classList.remove('hl', 'cur'));
814
+ function hitAt(t) {
815
+ if (t.closest('button:not(.dot), input, textarea, select, .factors, nav, .bar, dialog, details.tasks, a')) return null;
816
+ const node = t.closest('.flow g.node');
817
+ if (node) { const ref = JSON.parse(node.closest('.flow').dataset.map)[(node.id.match(/flowchart-(n\d+)-/) || [])[1]];
818
+ return ref ? { hit: fromStep(ref), label: `Step “${stepName(ref)}”` } : null; }
819
+ const cap = t.closest('[data-cap-chip]')?.dataset.capChip;
820
+ if (cap) return { hit: fromCap(cap), label: `${cap} ${capById[cap].name}` };
821
+ const comp = t.closest('[data-comp-chip]')?.dataset.compChip;
822
+ if (comp) return { hit: fromComp(comp), label: compById[comp].name };
823
+ const id = t.closest('tr[data-cap]')?.dataset.cap || t.closest('.rail')?.closest('[data-feat]')?.dataset.feat || t.closest('.dot')?.dataset.go;
824
+ return id ? { hit: fromCap(id), label: `${id} ${capById[id].name}` } : null;
825
+ }
826
+ // only what is on screen: skip parts inside a collapsed system or a hidden section
827
+ const onScreen = (x) => !x.closest('.hide, details:not([open])') && x.getClientRects().length > 0;
828
+ const litParts = () => [...document.querySelectorAll('.flow g.node.hl, tr[data-cap].hl, .feat.hl')].filter(onScreen);
829
+ function showPin() {
830
+ const n = litParts(); const [refs, caps, comps] = pin.hit; const pl = (x, w) => `${x} ${w}${x === 1 ? '' : 's'}`;
831
+ $('#pinLabel').textContent = pin.label;
832
+ $('#pinCount').textContent = `${pl(refs.size, 'step')} · ${pl(caps.size, 'feature')} · ${pl(comps.size, 'component')} · ${pin.i + 1}/${n.length}`;
833
+ $('#pinbar').classList.remove('hide');
834
+ }
835
+ function jump(d) {
836
+ const n = litParts(); if (!n.length) return;
837
+ pin.i = (pin.i + d + n.length) % n.length;
838
+ n.forEach((x) => x.classList.remove('cur')); n[pin.i].classList.add('cur');
839
+ n[pin.i].scrollIntoView({ block: 'center', behavior: 'smooth' }); showPin();
840
+ }
841
+ function unpin() { pin = null; clearHl(); $('#pinbar').classList.add('hide'); }
842
+ document.addEventListener('mouseover', (e) => { if (pin) return; const h2 = hitAt(e.target); if (h2) highlight(...h2.hit); else clearHl(); });
843
+ document.addEventListener('click', (e) => {
844
+ if (e.target.closest('#pinbar')) return;
845
+ const h2 = hitAt(e.target); if (!h2) return;
846
+ if (pin && pin.label === h2.label) { unpin(); return; }
847
+ pin = { ...h2, i: -1 }; clearHl(); highlight(...h2.hit); showPin();
848
+ const dot = e.target.closest('.dot'); // a spine dot pins and goes straight to its card
849
+ if (dot) { pin.i = litParts().indexOf($(`#c-${dot.dataset.go}`)) - 1; jump(1); }
850
+ });
851
+ document.addEventListener('keydown', (e) => {
852
+ if (!pin || e.target.closest('input, textarea, select')) return;
853
+ if (e.key === 'Escape') unpin(); else if (e.key === 'j') jump(1); else if (e.key === 'k') jump(-1);
854
+ });
855
+ $('#pinNext').onclick = () => jump(1); $('#pinPrev').onclick = () => jump(-1); $('#pinClear').onclick = unpin;
856
+ // next gap, changed or flagged card, in page order after the last one visited
857
+ let lastC = null;
858
+ function nextItem(onlyGaps) {
859
+ const gaps = CAPS.filter((c) => notBuilt(c.id)).map((c) => $(`#c-${c.id}`));
860
+ const rest = onlyGaps ? [] : CAPS.filter((c) => isChanged(c.id) || price(cur[c.id]).flag).map((c) => $(`#c-${c.id}`));
861
+ const items = [...gaps, ...rest].filter((el) => !el.closest('.hide')).sort((a, b) => (a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1));
862
+ if (!items.length) return;
863
+ const el = (lastC?.isConnected && items.find((x) => lastC.compareDocumentPosition(x) & Node.DOCUMENT_POSITION_FOLLOWING)) || items[0]; lastC = el;
864
+ el.scrollIntoView({ block: 'center', behavior: 'smooth' }); el.classList.remove('flash'); void el.offsetWidth; el.classList.add('flash');
865
+ }
866
+ $('#nextc').onclick = () => nextItem(false);
867
+ document.addEventListener('keydown', (e) => { if (e.key === 'n' && !e.target.closest('input, textarea, select') && !pin) nextItem(false); });
868
+ $('#preview').onclick = () => {
869
+ const gaps = notBuiltCount();
870
+ $('#sum').innerHTML = summaryHtml(); $('#feedback').value = JSON.stringify(window.__feedback()); $('#copied').textContent = '';
871
+ $('#sendable').classList.toggle('hide', !!gaps); $('#copy').disabled = !!gaps; $('#goGap').classList.toggle('hide', !gaps);
872
+ $('#dlg').showModal();
873
+ };
874
+ $('#goGap').onclick = () => { $('#dlg').close(); filter = 'all'; refresh(); lastC = null; nextItem(true); };
875
+ $('#copy').onclick = async () => { try { await navigator.clipboard.writeText($('#feedback').value); $('#copied').textContent = 'Copied — paste it into the chat'; }
876
+ catch { $('#feedback').select(); $('#copied').textContent = 'Press Ctrl+C to copy'; } };
877
+ let armed = false;
878
+ $('#reset').onclick = () => { if (!armed) { armed = true; $('#reset').textContent = 'Click again to reset everything'; setTimeout(() => { armed = false; $('#reset').textContent = 'Start over'; }, 4000); return; }
879
+ try { localStorage.removeItem(STORE); } catch { /* nothing saved */ } location.reload(); };
880
+
881
+ // ---- theme + diagrams (mockup loads mermaid from a CDN; the real page inlines the skill's bundle) ----
882
+ const dark = () => document.documentElement.dataset.theme === 'dark' || (!document.documentElement.dataset.theme && matchMedia('(prefers-color-scheme: dark)').matches);
883
+ const src = [...document.querySelectorAll('pre.mermaid')].map((p) => p.textContent);
884
+ let mermaid; let drawing = false;
885
+ // Mermaid cannot measure boxes inside a closed <details>, so every system opens
886
+ // for the draw and the open one is restored afterwards; the toggle events that
887
+ // causes are ignored while `drawing` is set.
888
+ async function draw() {
889
+ drawing = true; const all = [...document.querySelectorAll('details.capsys')];
890
+ try {
891
+ mermaid ??= (await import('https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs')).default;
892
+ const t = (v) => getComputedStyle(document.documentElement).getPropertyValue(v).trim();
893
+ mermaid.initialize({ startOnLoad: false, theme: 'base', flowchart: { curve: 'basis', padding: 10 }, themeVariables: { fontFamily: 'system-ui,sans-serif', fontSize: '12px',
894
+ background: t('--paper'), primaryColor: t('--sheet'), primaryTextColor: t('--ink'), primaryBorderColor: t('--meter'), lineColor: t('--ink-dim'), edgeLabelBackground: t('--paper'), textColor: t('--ink') } });
895
+ all.forEach((d) => { d.open = true; });
896
+ const pres = [...document.querySelectorAll('#systems pre.mermaid')];
897
+ pres.forEach((p, i) => { p.removeAttribute('data-processed'); p.textContent = src[i]; });
898
+ await mermaid.run({ nodes: pres });
899
+ if (pin) highlight(...pin.hit); // redraw makes new boxes; re-light a pinned selection
900
+ } catch { /* diagrams need a connection */ } finally {
901
+ all.forEach((d) => { d.open = d.dataset.sys === openSys; });
902
+ setTimeout(() => { drawing = false; }, 100);
903
+ }
904
+ }
905
+ $('#theme').onclick = () => { document.documentElement.dataset.theme = dark() ? 'light' : 'dark'; $('#theme').textContent = dark() ? 'Light' : 'Dark'; draw(); };
906
+ $('#theme').textContent = dark() ? 'Light' : 'Dark';
907
+ // a step link from the Workflow-based page (#step=<ref>) opens its system and pins it
908
+ function pinFromHash() {
909
+ const ref = decodeURIComponent(location.hash.match(/^#step=(.+)$/)?.[1] ?? '');
910
+ if (!ref || pin?.ref === ref) return;
911
+ const sys = DATA.systems.find((s) => stepsOfSys(s).includes(ref)); if (!sys) return;
912
+ openSystem(sys.id); refresh();
913
+ pin = { hit: fromStep(ref), label: `Step “${stepName(ref)}”`, ref, i: -1 }; clearHl(); highlight(...pin.hit); showPin();
914
+ $(`details.capsys[data-sys="${sys.id}"]`).scrollIntoView({ block: 'start' });
915
+ }
916
+ if (FINAL) addEventListener('hashchange', pinFromHash);
917
+ draw().then(() => { if (FINAL) setTimeout(pinFromHash, 150); });
918
+ // ---- price sections, shared by the Workflow-based and Component-based pages ----
919
+ // Every amount arrives computed in PAGE (scripts/lib/page-view.mjs); this
920
+ // formats and places them and prices nothing.
921
+ const viewMoney = (n) => `${PAGE.currency === 'USD' ? '$' : `${PAGE.currency} `}${Math.round(n).toLocaleString('en-US')}`;
922
+ const viewKv = (rows, sum) => rows.map(([a, b]) => `<tr><td>${a}</td><td class="r">${b}</td></tr>`).join('')
923
+ + `<tr class="sum"><td>${sum[0]}</td><td class="r">${sum[1]}</td></tr>`;
924
+ function viewBuRow(r, max) {
925
+ return `<div class="bu-row ${r.cls ?? ''}"><div class="lbl">${r.lbl}<small>${r.note}</small></div>
926
+ <div class="bu-bar"><i style="left:${r.from / max * 100}%;width:${Math.max(0.4, (r.to - r.from) / max * 100)}%"></i></div><div class="amt">${r.amt}</div></div>`;
927
+ }
928
+ function viewHeadline(p) {
929
+ $('#headline').innerHTML = `<div class="big"><span>Range to present</span><b>${viewMoney(p.presentLow)} – ${viewMoney(p.presentHigh)}</b><span>expected cost to worst realistic case</span></div>
930
+ <div><span>If one fixed number is unavoidable</span><b>${viewMoney(p.singleNumber)}</b><span>confident figure (80% chance at or under)</span></div>
931
+ <div><span>Expected cost</span><b>${viewMoney(p.p50)}</b><span>half the time lower, half higher</span></div>
932
+ <div><span>Implied accuracy</span><b>±${Math.round(p.impliedAccuracy * 100)}%</b><span>under 30%: a ballpark you can quote</span></div>`;
933
+ }
934
+ function viewSummary(v) {
935
+ const p = v.price; const base = p.adjustedBase; const out = base + p.overheads.amount;
936
+ viewHeadline(p);
937
+ const rows = [
938
+ { lbl: 'Feature build', note: `${v.featureCount} scored features`, from: 0, to: p.featurePoints, amt: viewMoney(p.featurePoints) },
939
+ { lbl: `× ${p.contextMultiplier.toFixed(2)} project context`, note: 'spec quality, decisions, compliance, familiarity', from: p.featurePoints, to: base, amt: `+${viewMoney(base - p.featurePoints)}` },
940
+ { lbl: `+ ${Math.round(p.overheads.totalPct * 100)}% work outside features`, note: 'foundation, discovery, UX, QA, DevOps, docs, PM, integration', from: base, to: out, amt: `+${viewMoney(p.overheads.amount)}` },
941
+ { lbl: `+ ${(p.contingencyRate * 100).toFixed(1)}% contingency`, note: 'known unknowns inside the agreed scope', from: out, to: p.p50, amt: `+${viewMoney(p.contingencyAmount)}` },
942
+ { lbl: '= Expected cost', note: '', from: 0, to: p.p50, amt: viewMoney(p.p50), cls: 'total' },
943
+ { lbl: 'Range to present', note: 'expected cost → worst realistic case, rounded up to 500', from: p.presentLow, to: p.presentHigh, amt: `${viewMoney(p.presentLow)}–${viewMoney(p.presentHigh)}`, cls: 'range' },
944
+ ];
945
+ $('#buildup').innerHTML = `<h3>How the price builds up</h3>${rows.map((r) => viewBuRow(r, p.presentHigh || 1)).join('')}`;
946
+ }
947
+ function viewMs(m) {
948
+ const n = m.features.length;
949
+ return `<div class="m"><div class="dim num">${n} feature${n === 1 ? '' : 's'} finished<span class="internal"> · ${m.components} components</span></div>
950
+ <h4>${esc(m.title)}</h4>
951
+ <div class="amt internal"><b>${viewMoney(m.low)}–${viewMoney(m.high)}</b> · ${Math.round(m.share * 100)}% of the build</div>
952
+ <div>${m.features.map((f) => `<span class="chip" data-f="${esc(f.id)}" title="${esc(f.system ?? '')}">${esc(f.name)}</span>`).join('')}</div></div>`;
953
+ }
954
+ function viewRoadmap(page) {
955
+ $('#ms').innerHTML = page.milestones.map(viewMs).join('');
956
+ $('#assume').innerHTML = page.register.assumptions.map((a) => `<li>${esc(a)}</li>`).join('');
957
+ $('#exclude').innerHTML = page.register.exclusions.map((a) => `<li>${esc(a)}</li>`).join('');
958
+ }
959
+ function viewContext(v) {
960
+ $('#ctx').innerHTML = `<tr><th>Factor</th><th>Level</th><th class="r">Multiplier</th></tr>${v.context.map((c) =>
961
+ `<tr><td>${esc(c.label)}</td><td>${c.level} · ${esc(c.anchor)}</td><td class="r">${c.multiplier.toFixed(2)}</td></tr>`).join('')}
962
+ <tr class="sum"><td colspan="2">Composite (1 + sum of deviations, cap 2.5)</td><td class="r">${v.price.contextMultiplier.toFixed(2)}</td></tr>`;
963
+ }
964
+ function viewOverheads(v) {
965
+ const o = v.price.overheads;
966
+ $('#ovh').innerHTML = `<tr><th>Cost line</th><th class="r">% of base</th><th class="r">Amount</th></tr>${v.overheads.map((r) =>
967
+ `<tr><td>${esc(r.label)}</td><td class="r">${Math.round(r.pct * 100)}%</td><td class="r">${viewMoney(r.amount)}</td></tr>`).join('')}
968
+ <tr class="sum"><td>Total</td><td class="r">${Math.round(o.totalPct * 100)}%</td><td class="r">${viewMoney(o.amount)}</td></tr>`;
969
+ }
970
+ function viewMethod(v) {
971
+ const p = v.price; const e = v.effort;
972
+ viewContext(v); viewOverheads(v);
973
+ $('#cont').innerHTML = viewKv([['Average uncertainty across features', v.avgUnc.toFixed(2)], ['Average risk across features', v.avgRisk.toFixed(2)],
974
+ ['Rate: 5% + 2% × uncertainty + 2% × risk', `${(p.contingencyRate * 100).toFixed(1)}%`]], ['On build + outside work', viewMoney(p.contingencyAmount)]);
975
+ $('#rng').innerHTML = viewKv([['Optimistic (20% chance at or under)', viewMoney(p.p20)], ['Expected cost', viewMoney(p.p50)],
976
+ ['Confident (80%)', viewMoney(p.p80)], ['Worst realistic case (95%)', viewMoney(p.p95)]],
977
+ ['Presented: expected → worst, rounded up to 500', `${viewMoney(p.presentLow)}–${viewMoney(p.presentHigh)}`]);
978
+ $('#xcheck').innerHTML = viewKv([['Components', e.components], ['Tasks', e.tasks], ['Expected effort (agentic baselines)', `${Math.round(e.hours).toLocaleString('en-US')}h`]],
979
+ ['Implied rate at the expected cost', e.rate === null ? '—' : `${viewMoney(e.rate)}/h`]);
980
+ }
981
+
982
+ viewSummary(PAGE.view); viewRoadmap(PAGE); viewMethod(PAGE.view);
983
+ const XLSX_SOURCE = {
984
+ rows: () => PAGE.xlsx.rows, container: (row) => row.container, levels: () => PAGE.xlsx.levels,
985
+ template: () => PAGE.xlsx.template, system: (row) => row.system, // the SYSTEM / MODULE workbook (estimator-system.xlsx)
986
+ register: () => PAGE.xlsx.register, // project name, assumptions, exclusions
987
+ };
988
+ { // the shared workbook export, block-scoped so its helpers never collide with this page's
989
+ <!-- slot:XLSX -->
990
+ }
991
+ $('#xlsx').onclick = () => { window.__downloadXlsx(); $('#xlsx-remind').showModal(); }; // the download runs on; the reminder shows meanwhile
992
+ </script>
993
+ </body>
994
+ </html>