const HEALTH_DEF = [
  { k: 'food', ic: 'bowl-food', n: ['Food cost', 'Coût alimentaire'], unit: '%', good: 28, poor: 36, w: 3, prov: 'e', to: ['finance', 'foodbev'], f: ['food COGS ÷ food sales', 'coût des aliments ÷ ventes d’aliments'] },
  { k: 'lab', ic: 'users-three', n: ['Labour', 'Main-d’œuvre'], unit: '%', good: 26, poor: 36, w: 3, prov: 'e', to: ['finance', 'labour'], f: ['wages + employer costs ÷ revenue', 'salaires + charges ÷ ventes'] },
  { k: 'prime', ic: 'scales', n: ['Prime cost', 'Coût principal'], unit: '%', good: 58, poor: 68, w: 2, prov: 'e', to: ['finance', 'prime'], f: ['(COGS + labour) ÷ revenue', '(marchandises + main-d’œuvre) ÷ ventes'] },
  { k: 'op', ic: 'coins', n: ['Operating margin', 'Marge d’exploitation'], unit: '%', good: 15, poor: 0, w: 3, prov: 'e', to: ['finance', 'pnl'], f: ['operating profit (est.) ÷ revenue', 'profit d’exploitation (est.) ÷ ventes'] },
  { k: 'growth', ic: 'trend-up', n: ['Sales vs. last year', 'Ventes vs l’an dernier'], unit: '%', good: 8, poor: -5, w: 2, prov: 'v', to: ['finance', 'revenue'], f: ['this month ÷ same month last year − 1', 'ce mois ÷ même mois l’an dernier − 1'] },
  { k: 'waste', ic: 'trash', n: ['Waste', 'Pertes'], unit: '%', good: 1.5, poor: 5, w: 1, prov: 'v', to: ['inventory', 'waste'], f: ['logged waste per month ÷ food & beverage cost', 'pertes mensuelles ÷ coût des aliments et boissons'] },
  { k: 'count', ic: 'clipboard-text', n: ['Count variance', 'Écart d’inventaire'], unit: '%', good: 1, poor: 8, w: 1, prov: 'v', to: ['inventory', 'counts'], f: ['|last full-count variance| ÷ inventory value', '|écart du dernier inventaire| ÷ valeur du stock'] },
  { k: 'ap', ic: 'receipt', n: ['Overdue bills', 'Factures en retard'], unit: '%', good: 0, poor: 20, w: 1, prov: 'v', to: ['finance', 'ap'], f: ['overdue ÷ all unpaid supplier invoices', 'en retard ÷ factures impayées'] },
  { k: 'recon', ic: 'cash-register', n: ['Days reconciled', 'Jours rapprochés'], unit: '%', good: 100, poor: 80, w: 1, prov: 'v', to: ['sales', 'recon'], f: ['sales days matched to bank deposits', 'jours de ventes concordant avec la banque'] },
  { k: 'deliv', ic: 'moped', n: ['Delivery error rate', 'Erreurs de livraison'], unit: '%', good: 0.5, poor: 3, w: 1, prov: 'v', to: ['sales', 'delivery'], f: ['orders with errors ÷ delivery orders', 'commandes erronées ÷ commandes livrées'] },
];
const hScore = (v, d) => Math.max(0, Math.min(100, ((d.poor - v) / (d.poor - d.good)) * 100));
const hBand = (s, L) => (s >= 80 ? [L('Strong', 'Solide'), 'pos'] : s >= 65 ? [L('Healthy', 'Sain'), 'pos'] : s >= 50 ? [L('Needs attention', 'À surveiller'), 'warn'] : [L('At risk', 'À risque'), 'neg']);

function healthValues(c, I, a) {
  const { O, inv, invoices, ops } = c, F = window.MIZO_FIN;
  const invVal = inv.reduce((s, i) => s + i.onHand * i.cost, 0), full = O.counts.find((x) => x.kind === 'full');
  const unpaid = invoices.filter((v) => v.status !== 'paid'), od = unpaid.filter((v) => v.status === 'overdue');
  const dl = O.delivery;
  return { food: a.foodPct, lab: a.labPct, prime: a.primePct, op: a.opPct, growth: F.months[11].g * 100, waste: (I.wMonthly / ((a.fb * 31) / 28)) * 100, count: (Math.abs(full.varc) / invVal) * 100, ap: (od.reduce((s, v) => s + v.amount, 0) / unpaid.reduce((s, v) => s + v.amount, 0)) * 100, recon: ((28 - ops.recon.filter((r) => r.status === 'review').length) / 28) * 100, deliv: ((dl.uber.errors + dl.dd.errors) / (dl.uber.orders + dl.dd.orders)) * 100 };
}

function HealthScore() {
  const c = useMizo(); const { L, lang, fmt, F, calc, go, toast } = c;
  const I = useIntel();
  const [cfg, setCfgS] = React.useState(() => { try { return JSON.parse(localStorage.getItem('mizo.health')) || {}; } catch (e) { return {}; } });
  const setCfg = (n) => { setCfgS(n); localStorage.setItem('mizo.health', JSON.stringify(n)); };
  const [edit, setEdit] = React.useState(false);
  const defs = HEALTH_DEF.map((d) => ({ ...d, ...(cfg[d.k] || {}), on: cfg[d.k] && cfg[d.k].on === false ? false : true }));
  const a = finK(fsum(F.days.filter((x) => x.d >= '2026-10-01'))), vals = healthValues(c, I, a);
  const rows = defs.map((d) => ({ d, v: vals[d.k], s: hScore(vals[d.k], d) }));
  const act = rows.filter((r) => r.d.on && r.d.w > 0), W = act.reduce((s, r) => s + r.d.w, 0);
  const score = W ? act.reduce((s, r) => s + r.s * r.d.w, 0) / W : 0, band = hBand(score, L);
  const hist = F.months.slice(-6).map((m, i, arr) => { const k = finK(fsum([m])), v = { ...vals, food: k.foodPct, lab: k.labPct, prime: k.primePct, op: k.opPct, growth: m.g * 100 }; return { label: m.label[lang], s: W ? act.reduce((s, r) => s + hScore(v[r.d.k], r.d) * r.d.w, 0) / W : 0 }; });
  const upd = (k, p) => setCfg({ ...cfg, [k]: { ...(cfg[k] || {}), ...p } });
  const R = 54, C = 2 * Math.PI * R;
  const weakest = act.slice().sort((x, y) => (100 - y.s) * y.d.w - (100 - x.s) * x.d.w).slice(0, 3);
  const drill = (r) => calc({ title: L(...r.d.n), value: `${fmt.num(Math.round(r.s))} / 100`, prov: r.d.prov, period: L('October 1–28', '1–28 octobre'), formula: L(`Score = (poor − value) ÷ (poor − great) × 100, kept between 0 and 100`, `Score = (faible − valeur) ÷ (faible − excellent) × 100, borné de 0 à 100`), inputs: [{ label: L('Value', 'Valeur') + ' · ' + L(r.d.f[0], r.d.f[1]), v: fmt.pct(r.v), prov: r.d.prov }, { label: L('Great at', 'Excellent à'), v: fmt.pct(r.d.good) }, { label: L('Poor at', 'Faible à'), v: fmt.pct(r.d.poor) }, { tot: true, op: '=', label: L('Metric score', 'Score de l’indicateur'), v: fmt.num(Math.round(r.s)) }, { label: L('Weight', 'Poids'), v: `${r.d.w} / ${W}` }, { label: L('Points in total score', 'Points dans le total'), v: fmt.num(Math.round((r.s * r.d.w) / W * 10) / 10) }], to: r.d.to, toLabel: L('Open the report', 'Ouvrir le rapport') });
  return (
    <div className="page">
      <PageHead sub={L('One number for how the restaurant is running — every part of it shown, weighted the way you choose.', 'Un chiffre pour l’état du restaurant — chaque composante visible, pondérée comme vous le voulez.')}>
        <button className={'btn ' + (edit ? 'btn-primary' : 'btn-secondary')} onClick={() => setEdit(!edit)}><Icon n={edit ? 'check' : 'sliders-horizontal'} />{edit ? L('Done', 'Terminé') : L('Configure', 'Configurer')}</button>
      </PageHead>
      <section className="grid-1-2">
        <div className="panel health-hero">
          <Meander />
          <div className="ai-kicker"><Icon n="heartbeat" />{L('Restaurant health', 'Santé du restaurant')}</div>
          <div className="gauge">
            <svg viewBox="0 0 128 128" aria-hidden="true"><circle cx="64" cy="64" r={R} className="g-track" /><circle cx="64" cy="64" r={R} className={'g-fill ' + band[1]} strokeDasharray={C} strokeDashoffset={C * (1 - score / 100)} transform="rotate(-90 64 64)" /></svg>
            <div className="gauge-v"><b className="tnum">{Math.round(score)}</b><span>/ 100</span></div>
          </div>
          <div className="health-band"><Pill tone={band[1]}>{band[0]}</Pill><span className="muted sm">{L(`${act.length} metrics · October to date`, `${act.length} indicateurs · octobre à ce jour`)}</span></div>
          <div className="health-hist">{hist.map((h, i) => <div key={i}><span className="hh-bar"><i style={{ height: h.s + '%' }} className={i === hist.length - 1 ? 'last' : ''}></i></span><span className="muted sm">{h.label}</span></div>)}</div>
          <p className="muted sm" style={{ margin: 0 }}>{L('Past months recompute the financial metrics; operational metrics use current values.', 'Les mois passés recalculent les indicateurs financiers; les indicateurs opérationnels utilisent les valeurs actuelles.')}</p>
        </div>
        <div className="panel">
          <h3>{L('What would lift your score most', 'Ce qui ferait monter votre score')}</h3>
          {weakest.map((r) => <button key={r.d.k} className="health-lift" onClick={() => drill(r)}><span className="alert-ic acc"><Icon n={r.d.ic} /></span><span><b>{L(...r.d.n)}</b> · {fmt.pct(r.v)}<br /><span className="muted sm">{L(`Reaching ${fmt.pct(r.d.good)} adds ${fmt.num(Math.round(((100 - r.s) * r.d.w) / W))} points`, `Atteindre ${fmt.pct(r.d.good)} ajoute ${fmt.num(Math.round(((100 - r.s) * r.d.w) / W))} points`)}</span></span><Icon n="calculator" className="muted" /></button>)}
          <div className="calc-formula">{L('Health score = Σ (metric score × weight) ÷ Σ weights', 'Score santé = Σ (score × poids) ÷ Σ poids')}</div>
        </div>
      </section>
      <div className="panel panel-flush">
        <div className="panel-head pad"><div><h3>{L('Score breakdown', 'Détail du score')}</h3><p className="muted">{edit ? L('Change weights, thresholds, or switch metrics off', 'Modifiez poids et seuils, ou désactivez des indicateurs') : L('Click a metric to see its calculation', 'Cliquez sur un indicateur pour son calcul')}</p></div>{edit ? <button className="btn btn-ghost" onClick={() => { setCfg({}); toast(L('Defaults restored', 'Valeurs par défaut rétablies')); }}>{L('Reset to defaults', 'Rétablir')}</button> : null}</div>
        <div className="table-scroll">
          <table className="table mtable">
            <thead><tr><th>{L('Metric', 'Indicateur')}</th><th className="num">{L('Value', 'Valeur')}</th><th className="num hide-sm">{L('Great', 'Excellent')}</th><th className="num hide-sm">{L('Poor', 'Faible')}</th><th>{L('Score', 'Score')}</th><th className="num">{L('Weight', 'Poids')}</th><th className="num hide-sm">{L('Points', 'Points')}</th></tr></thead>
            <tbody>{rows.map((r) => (
              <tr key={r.d.k} className={(edit ? '' : 'clickable') + (r.d.on ? '' : ' row-off')} onClick={edit ? undefined : () => drill(r)}>
                <td><div className="emp-cell">{edit ? <Toggle on={r.d.on} label={L(...r.d.n)} onChange={(v) => upd(r.d.k, { on: v })} /> : <span className="alert-ic acc"><Icon n={r.d.ic} /></span>}<div><div className="cell-main">{L(...r.d.n)}</div><div className="cell-sub"><Prov k={r.d.prov} short /> {L(r.d.f[0], r.d.f[1])}</div></div></div></td>
                <td className="num tnum">{fmt.pct(r.v)}</td>
                <td className="num hide-sm">{edit ? <input className="input h-in" type="number" step="0.5" value={r.d.good} onChange={(e) => upd(r.d.k, { good: Number(e.target.value) })} /> : <span className="tnum muted">{fmt.pct(r.d.good)}</span>}</td>
                <td className="num hide-sm">{edit ? <input className="input h-in" type="number" step="0.5" value={r.d.poor} onChange={(e) => upd(r.d.k, { poor: Number(e.target.value) })} /> : <span className="tnum muted">{fmt.pct(r.d.poor)}</span>}</td>
                <td><div className="h-score"><span className="budbar"><span className={'budbar-fill h-' + hBand(r.s, L)[1]} style={{ width: r.s + '%' }}></span></span><b className="tnum">{Math.round(r.s)}</b></div></td>
                <td className="num">{edit ? <input className="input h-in" type="number" min="0" max="5" value={r.d.w} onChange={(e) => upd(r.d.k, { w: Math.max(0, Number(e.target.value)) })} /> : <span className="tnum">{r.d.w}</span>}</td>
                <td className="num tnum hide-sm">{r.d.on && W ? fmt.num(Math.round((r.s * r.d.w) / W * 10) / 10) : '—'}</td>
              </tr>
            ))}</tbody>
          </table>
        </div>
      </div>
    </div>
  );
}

const SIM0 = { ing: 0, scope: 'all', price: 0, elast: -0.4, lab: 0, vol: 0, waste: 0 };
function simRun(s, base, I, catShare) {
  const F = window.MIZO_FIN, varShare = (F.oct.card + F.oct.commissions + F.oct.promos) / F.months[11].other;
  const volF = (1 + s.vol / 100) * (1 + (s.elast * s.price) / 100);
  const rev = base.rev * (1 + s.price / 100) * volF;
  const wasteSave = I.wMonthly * (s.waste / 100) * (1 + s.ing / 100 * catShare[s.scope]);
  const fb = base.fb * volF * (1 + (s.ing / 100) * catShare[s.scope]) - wasteSave;
  const lab = base.lab * (1 - s.lab / 100) * (volF > 1.1 ? 1 + (volF - 1.1) * 0.6 : 1);
  return finK({ ...base, rev, fb, pack: base.pack * volF, lab, other: base.other * (varShare * (rev / base.rev) + (1 - varShare)), tk: base.tk * volF });
}

function Simulator() {
  const { L, lang, fmt, F, invMap, recipes } = useMizo();
  const I = useIntel();
  const [s, setS] = React.useState(() => { try { return { ...SIM0, ...JSON.parse(localStorage.getItem('mizo.sim')) }; } catch (e) { return SIM0; } });
  const set = (p) => { const n = { ...s, ...p }; setS(n); localStorage.setItem('mizo.sim', JSON.stringify(n)); };
  const mo = F.months[11], k = 31 / 28;
  const base = { rev: mo.rev * k, fb: mo.fb * k, pack: mo.pack * k, lab: mo.lab * k, rent: mo.rent, util: mo.util * k, other: mo.other * k, tk: (mo.rev * k) / 25.65, days: 31 };
  const catCost = {}; Object.entries(I.use).forEach(([id, q]) => { const i = invMap[id]; if (i) catCost[i.cat] = (catCost[i.cat] || 0) + q * i.cost; });
  const tot = Object.values(catCost).reduce((a, b) => a + b, 0);
  const catShare = { all: 1, meat: (catCost.meat || 0) / tot, dairy: (catCost.dairy || 0) / tot, produce: (catCost.produce || 0) / tot };
  const b0 = simRun(SIM0, base, I, catShare), r = simRun(s, base, I, catShare);
  const levers = [['ing', L('Ingredient prices', 'Prix des ingrédients'), { ing: s.ing, scope: s.scope }], ['price', L('Menu prices', 'Prix du menu'), { price: s.price, elast: s.elast }], ['lab', L('Labour hours', 'Heures travaillées'), { lab: s.lab }], ['vol', L('Sales volume', 'Volume des ventes'), { vol: s.vol }], ['waste', L('Waste reduction', 'Réduction des pertes'), { waste: s.waste }]];
  const eff = levers.map(([k2, n, p]) => ({ k: k2, n, v: simRun({ ...SIM0, ...p }, base, I, catShare).op - b0.op }));
  const inter = r.op - b0.op - eff.reduce((a, x) => a + x.v, 0), maxE = Math.max(1, ...eff.map((x) => Math.abs(x.v)), Math.abs(inter));
  const presets = [[L('Meat +10%', 'Viande +10 %'), { ...SIM0, ing: 10, scope: 'meat' }], [L('Prices +4%', 'Prix +4 %'), { ...SIM0, price: 4 }], [L('Halve waste', 'Pertes ÷ 2'), { ...SIM0, waste: 50 }], [L('Slow winter', 'Hiver lent'), { ...SIM0, vol: -8, ing: 4 }], [L('Full plan', 'Plan complet'), { ...SIM0, price: 3, lab: 5, waste: 40, ing: 3 }]];
  const sl = (key, lab, min, max, step, unit, sub) => <div className="sim-sl"><div className="sim-sl-top"><label htmlFor={'sim-' + key}>{lab}</label><b className="tnum">{s[key] > 0 && key !== 'elast' ? '+' : ''}{fmt.num(s[key])}{unit}</b></div><input id={'sim-' + key} type="range" min={min} max={max} step={step} value={s[key]} onChange={(e) => set({ [key]: Number(e.target.value) })} />{sub ? <div className="muted sm">{sub}</div> : null}</div>;
  const out = [[L('Revenue', 'Ventes'), 'rev', false], [L('Cost of goods', 'Coût des marchandises'), 'cogs', true], [L('Gross profit', 'Profit brut'), 'gross', false], [L('Labour', 'Main-d’œuvre'), 'lab', true], [L('Operating costs', 'Frais d’exploitation'), 'opx', true], [L('Operating profit (est.)', 'Profit d’exploitation (est.)'), 'op', false]];
  const warn = [s.lab > 10 ? L('Cutting more than 10% of hours usually shows up in service times and reviews.', 'Couper plus de 10 % des heures se voit souvent dans le service et les avis.') : null, s.price > 8 ? L('Price rises above 8% at once go beyond what the elasticity assumption can predict.', 'Une hausse de plus de 8 % dépasse ce que l’hypothèse d’élasticité peut prévoir.') : null, s.waste > 70 ? L('Some waste is unavoidable; 70%+ reductions are rare.', 'Certaines pertes sont inévitables; plus de 70 % est rare.') : null].filter(Boolean);
  return (
    <div className="page">
      <PageHead sub={L('Move the levers to see what a change does to a full month. Starting point: October projected to 31 days.', 'Déplacez les leviers pour voir l’effet sur un mois complet. Point de départ : octobre projeté sur 31 jours.')}>
        <button className="btn btn-ghost" onClick={() => set(SIM0)}><Icon n="arrow-counter-clockwise" />{L('Reset', 'Réinitialiser')}</button>
      </PageHead>
      <SeeAlso k="sim" />
      <div className="chips">{presets.map(([n, p]) => <button key={n} className="chip" onClick={() => set(p)}>{n}</button>)}</div>
      <section className="grid-1-2">
        <div className="panel sim-levers">
          <h3>{L('Levers', 'Leviers')}</h3>
          {sl('ing', L('Ingredient prices', 'Prix des ingrédients'), -10, 25, 1, '%')}
          <Seg size="sm" value={s.scope} onChange={(v) => set({ scope: v })} options={[['all', L('All', 'Tous')], ['meat', L('Meat', 'Viande')], ['dairy', L('Dairy', 'Laitiers')], ['produce', L('Produce', 'Légumes')]]} />
          <div className="muted sm">{s.scope === 'all' ? L('Applies to all food & beverage cost', 'S’applique à tout le coût des aliments et boissons') : L(`${fmt.pct(catShare[s.scope] * 100)} of recipe food cost`, `${fmt.pct(catShare[s.scope] * 100)} du coût des recettes`)}</div>
          {sl('price', L('Menu prices', 'Prix du menu'), -5, 15, 0.5, '%')}
          {sl('elast', L('Guest price sensitivity', 'Sensibilité des clients'), -1.5, 0, 0.1, '', L(`Each 1% price rise loses ${fmt.num(Math.abs(s.elast))}% of orders`, `Chaque 1 % de hausse fait perdre ${fmt.num(Math.abs(s.elast))} % des commandes`))}
          {sl('lab', L('Labour hours cut', 'Heures coupées'), 0, 20, 1, '%')}
          {sl('vol', L('Sales volume', 'Volume des ventes'), -15, 20, 1, '%')}
          {sl('waste', L('Waste reduction', 'Réduction des pertes'), 0, 100, 5, '%', L(`Logged waste is ${fmt.money0(I.wMonthly)} a month`, `Pertes consignées : ${fmt.money0(I.wMonthly)} par mois`))}
        </div>
        <div className="panel">
          <div className="panel-head"><div><h3>{L('Monthly result', 'Résultat mensuel')}</h3><p className="muted">{L('Baseline → with your changes', 'Base → avec vos changements')}</p></div><SimTag /></div>
          <div className="sim-hero"><span className="muted">{L('Operating profit (est.)', 'Profit d’exploitation (est.)')}</span><div><b className="tnum">{fmt.money0(r.op)}</b><Delta v={b0.op ? ((r.op - b0.op) / Math.abs(b0.op)) * 100 : 0} /></div><span className="muted sm">{fmt.money0(r.op - b0.op)} {L('a month', 'par mois')} · {fmt.money0((r.op - b0.op) * 12)} {L('a year', 'par an')} · {L('margin', 'marge')} {fmt.pct(b0.opPct)} → {fmt.pct(r.opPct)}</span></div>
          <div className="sim-out">{out.map(([n, key, cost]) => { const d = r[key] - b0[key]; return <div key={key} className={'ln' + (key === 'op' ? ' tot' : '')}><span>{n}</span><span className="sim-cmp"><span className="muted tnum">{fmt.money0(b0[key])}</span><Icon n="arrow-right" className="muted" /><b className="tnum">{fmt.money0(r[key])}</b><span className={'tnum sim-d ' + (Math.abs(d) < 1 ? 'muted' : (cost ? d < 0 : d > 0) ? 'txt-pos' : 'txt-neg')}>{d >= 0 ? '+' : '−'}{fmt.money0(Math.abs(d))}</span></span></div>; })}</div>
          <div className="sim-ratios">{[[L('Food cost', 'Coût alim.'), 'foodPct'], [L('Labour', 'Main-d’œuvre'), 'labPct'], [L('Prime cost', 'Coût principal'), 'primePct']].map(([n, key]) => <div key={key}><span className="muted sm">{n}</span><b className="tnum">{fmt.pct(r[key])}</b><Pts v={r[key] - b0[key]} invert /></div>)}</div>
          <div className="dr-label">{L('Where the change comes from', 'D’où vient l’écart')}</div>
          <div className="sim-eff">{[...eff, { k: 'x', n: L('Levers combined', 'Effets combinés'), v: inter }].filter((x) => Math.abs(x.v) >= 1).map((x) => <div key={x.k} className="sim-eff-row"><span>{x.n}</span><span className="sim-eff-track"><i className={x.v < 0 ? 'neg' : 'pos'} style={{ width: (Math.abs(x.v) / maxE) * 50 + '%', [x.v < 0 ? 'right' : 'left']: '50%' }}></i></span><b className={'tnum ' + (x.v < 0 ? 'txt-neg' : 'txt-pos')}>{x.v >= 0 ? '+' : '−'}{fmt.money0(Math.abs(x.v))}</b></div>)}{eff.every((x) => Math.abs(x.v) < 1) ? <div className="muted sm">{L('Move a lever to see its effect.', 'Déplacez un levier pour voir l’effet.')}</div> : null}</div>
          {warn.map((w, i) => <div key={i} className="suggest warn-s"><Icon n="warning" /><div>{w}</div></div>)}
        </div>
      </section>
      <div className="panel">
        <h3>{L('Assumptions', 'Hypothèses')}</h3>
        <ul className="assume">
          <li>{L(`Baseline is October 1–28 scaled to 31 days: revenue ${fmt.money0(base.rev)}, operating profit ${fmt.money0(b0.op)} (estimated, before depreciation, interest, insurance and owner pay — not net profit).`, `Base : 1–28 octobre ramené à 31 jours : ventes ${fmt.money0(base.rev)}, profit d’exploitation ${fmt.money0(b0.op)} (estimé, avant amortissement, intérêts, assurances et rémunération de la propriétaire — pas le profit net).`)}</li>
          <li>{L('Food, beverage and packaging costs move with volume. Ingredient price changes apply to the chosen category’s share of recipe cost.', 'Aliments, boissons et emballages suivent le volume. Les hausses de prix s’appliquent à la part de la catégorie choisie.')}</li>
          <li>{L(`Card fees and delivery commissions (${fmt.pct(((F.oct.card + F.oct.commissions + F.oct.promos) / mo.other) * 100)} of other costs) move with revenue. Rent and utilities stay fixed.`, `Frais de carte et commissions (${fmt.pct(((F.oct.card + F.oct.commissions + F.oct.promos) / mo.other) * 100)} des autres frais) suivent les ventes. Loyer et énergie restent fixes.`)}</li>
          <li>{L('Current staff absorb up to 10% more volume; beyond that labour grows 0.6% per 1% of extra volume.', 'L’équipe absorbe jusqu’à 10 % de volume en plus; au-delà, la main-d’œuvre croît de 0,6 % par 1 %.')}</li>
          <li>{L('Waste reduction saves the matching share of logged waste only — unlogged waste isn’t counted.', 'La réduction ne compte que les pertes consignées.')}</li>
        </ul>
      </div>
    </div>
  );
}

Object.assign(window, { HEALTH_DEF, hScore, hBand, healthValues, HealthScore, Simulator, simRun, SIM0 });
