// Atoms — buttons, chips, badges, inputs, terminal frame // Exported to window for cross-script use. const fmt = (n, ccy) => { if (n === null || n === undefined) return "—"; const abs = Math.abs(n); const formatted = abs.toLocaleString("en-US", { maximumFractionDigits: ccy === "EUR" ? 2 : 0 }); return formatted; }; const sign = (n) => (n > 0 ? "+ " : n < 0 ? "− " : ""); // --- ENTITY BADGE --- function EntityBadge({ entity, size = "md" }) { const map = { personal: { label: "Personal", cls: "personal" }, tfox: { label: "9TFox", cls: "tfox" }, finacode: { label: "Finacode", cls: "finacode" }, }; const e = map[entity]; if (!e) return null; return {e.label}; } // --- CONFIDENCE CHIP --- function ConfidenceChip({ score, tier }) { let cls = "low"; if (tier === "rules" || (score !== null && score >= 1)) cls = "rules"; else if (score !== null && score >= 0.85) cls = "high"; else if (score !== null && score >= 0.70) cls = "mid"; const display = score === null ? "—" : score.toFixed(2); return ( ★ {display} ); } // --- TIER BADGE --- function TierBadge({ tier }) { const map = { rules: "Rules", llm: "LLM", agent: "Agent", unmatched: "Unmatched" }; return {map[tier]}; } // --- AMOUNT --- function Amount({ value, ccy, alignRight = true }) { if (value === null || value === undefined) return —; const cls = value > 0 ? "pos" : value < 0 ? "neg" : "zero"; return ( {sign(value)}{fmt(value, ccy)} {ccy} ); } // --- BUTTONS --- function Btn({ children, variant = "ghost", onClick, type = "button", bracket = false, disabled = false }) { const cls = bracket ? "btn bracket" : `btn ${variant}`; return ( ); } // --- INPUT --- function TextInput({ value, onChange, placeholder, mono = false, align = "left", icon = null }) { return (