// ─────────────────────────────────────────────────────────────
// GRIDSHIFT — Portal data
// All figures are illustrative for portal mockup purposes.
// ─────────────────────────────────────────────────────────────

const PILLARS = [
  { id: "strategic",   step: "01", label: "Strategic Overview",    color: "var(--blue-700)" },
  { id: "inventories", step: "02", label: "Inventories & Sites",    color: "var(--orange)" },
  { id: "scenarios",   step: "03", label: "Emission Scenarios",     color: "var(--cyan)" },
  { id: "plans",       step: "04", label: "Plans & Targets",        color: "var(--heat-green-dim)" },
  { id: "partners",    step: "05", label: "Partner Ecosystem",      color: "var(--blue-500)" },
];

const COUNTRIES = [
  { id: "all",  label: "All countries (consolidated)",        stations: 30,  mass: 24480 },
  { id: "sen",  label: "Senegal — BMW-GLO-NDE pilot",         stations: 30,  mass: 480   },
  { id: "ken",  label: "Kenya — CTCN-KEN-SF6 pilot",          stations: 0,   mass: 24000 },
  { id: "eu",   label: "EU-27 — F-Gas Reg. 2024/573 framework",stations: 0,  mass: 0, regulatory: true },
  { id: "deu",  label: "Germany — TSO forum (scoping)",       stations: 0,   mass: 0 },
  { id: "btn",  label: "Bhutan — scoping",                    stations: 0,   mass: 0 },
  { id: "bwa",  label: "Botswana — scoping",                  stations: 0,   mass: 0 },
];
const OPERATORS = COUNTRIES;

// Substations — Senegal SF6 registry (BMW-GLO-NDE pilot)
const STATIONS = [
  { id: "SEN-SUB-019", name: "Centrale Bel Air", op: "Senelec", country: "Senegal", voltage: 225, mass: 184.0, year: "1968*", status: "sf6", region: "Dakar" },
  { id: "SEN-SUB-020", name: "Centrale Cap des Biches", op: "Senelec", country: "Senegal", voltage: 225, mass: 184.0, year: "1976*", status: "sf6", region: "Dakar" },
  { id: "SEN-SUB-014", name: "Kounoune", op: "Senelec", country: "Senegal", voltage: 225, mass: 96.0, year: "2014", status: "sf6", region: "Dakar" },
  { id: "SEN-SUB-015", name: "Diass", op: "Senelec", country: "Senegal", voltage: 225, mass: 16.0, year: "2018*", status: "sf6", region: "Thiès" },
  { id: "SEN-SUB-016", name: "Aéroport LSS", op: "Senelec", country: "Senegal", voltage: 90, mass: 0.0, year: "2017*", status: "retrofit", region: "Dakar" },
  { id: "SEN-SUB-026", name: "Bakel", op: "SOGEM / Senelec", country: "Senegal", voltage: 225, mass: 0.0, year: "2016", status: "retrofit", region: "Tambacounda" },
  { id: "SEN-SUB-001", name: "Bel Air", op: "Senelec", country: "Senegal", voltage: 90, mass: 0.0, year: "1973*", status: "retrofit", region: "Dakar" },
  { id: "SEN-SUB-004", name: "Cap des Biches", op: "Senelec", country: "Senegal", voltage: 225, mass: 0.0, year: "1984*", status: "retrofit", region: "Dakar" },
  { id: "SEN-SUB-012", name: "Dagana", op: "SOGEM / Senelec", country: "Senegal", voltage: 225, mass: 0.0, year: "2016", status: "retrofit", region: "Saint-Louis" },
  { id: "SEN-SUB-002", name: "Hann", op: "Senelec", country: "Senegal", voltage: 90, mass: 0.0, year: "1978*", status: "retrofit", region: "Dakar" },
  { id: "SEN-SUB-030", name: "Kahone solar plant step-up", op: "Kahone Solaire SA / Senelec", country: "Senegal", voltage: 30, mass: 0.0, year: "2017", status: "retrofit", region: "Kaolack" },
  { id: "SEN-SUB-009", name: "Kaolack", op: "Senelec", country: "Senegal", voltage: 225, mass: 0.0, year: "1989*", status: "retrofit", region: "Kaolack" },
  { id: "SEN-SUB-023", name: "Linguère", op: "Senelec", country: "Senegal", voltage: 225, mass: 0.0, year: "2025◦", status: "retrofit", region: "Louga" },
  { id: "SEN-SUB-011", name: "Matam", op: "SOGEM / Senelec", country: "Senegal", voltage: 225, mass: 0.0, year: "2016", status: "retrofit", region: "Matam" },
  { id: "SEN-SUB-003", name: "Mbao", op: "Senelec", country: "Senegal", voltage: 90, mass: 0.0, year: "1995*", status: "retrofit", region: "Dakar" },
  { id: "SEN-SUB-006", name: "Mbour", op: "Senelec", country: "Senegal", voltage: 90, mass: 0.0, year: "2008*", status: "retrofit", region: "Thiès" },
  { id: "SEN-SUB-022", name: "Ndioum-Matam 2", op: "Senelec", country: "Senegal", voltage: 225, mass: 0.0, year: "2026◦", status: "retrofit", region: "Matam" },
  { id: "SEN-SUB-017", name: "Patte d'Oie", op: "Senelec", country: "Senegal", voltage: 225, mass: 0.0, year: "2009*", status: "retrofit", region: "Dakar" },
  { id: "SEN-SUB-018", name: "Rive Bel Air", op: "Senelec", country: "Senegal", voltage: 225, mass: 0.0, year: "2010*", status: "retrofit", region: "Dakar" },
  { id: "SEN-SUB-013", name: "Sakal", op: "SOGEM / Senelec", country: "Senegal", voltage: 225, mass: 0.0, year: "2016", status: "retrofit", region: "Louga" },
  { id: "SEN-SUB-029", name: "Sendou power plant step-up", op: "Compagnie d’Électricité du Sénégal / Senelec", country: "Senegal", voltage: 225, mass: 0.0, year: "2018", status: "retrofit", region: "Dakar" },
  { id: "SEN-SUB-010", name: "Sococim", op: "Senelec / SOCOCIM", country: "Senegal", voltage: 90, mass: 0.0, year: "1992*", status: "retrofit", region: "Dakar" },
  { id: "SEN-SUB-027", name: "Taiba N'Diaye wind farm step-up", op: "Parc Eolien Taiba N’Diaye SA / Senelec", country: "Senegal", voltage: 225, mass: 0.0, year: "2017", status: "retrofit", region: "Thiès" },
  { id: "SEN-SUB-025", name: "Tambacounda", op: "OMVG / Senelec", country: "Senegal", voltage: 225, mass: 0.0, year: "2020", status: "retrofit", region: "Tambacounda" },
  { id: "SEN-SUB-028", name: "Ten Merina solar plant step-up", op: "Ten Merina / Senelec", country: "Senegal", voltage: 30, mass: 0.0, year: "2016", status: "retrofit", region: "Thiès" },
  { id: "SEN-SUB-021", name: "Thiès digital 225 kV substation", op: "Senelec", country: "Senegal", voltage: 225, mass: 0.0, year: "2024", status: "retrofit", region: "Thiès" },
  { id: "SEN-SUB-005", name: "Thiès Thiona", op: "Senelec", country: "Senegal", voltage: 90, mass: 0.0, year: "2001*", status: "retrofit", region: "Thiès" },
  { id: "SEN-SUB-007", name: "Tobène", op: "Senelec", country: "Senegal", voltage: 225, mass: 0.0, year: "2016", status: "retrofit", region: "Thiès" },
  { id: "SEN-SUB-008", name: "Touba 1 / Ndindy", op: "Senelec", country: "Senegal", voltage: 225, mass: 0.0, year: "2017*", status: "retrofit", region: "Diourbel" },
  { id: "SEN-SUB-024", name: "Touba 2", op: "Senelec", country: "Senegal", voltage: 225, mass: 0.0, year: "2026◦", status: "retrofit", region: "Diourbel" },
  // === Kenya ===
  { id: "KEN-SUB-001", name: "Suswa Substation", op: "KETRACO", country: "Kenya", voltage: 500, mass: 0, year: "", status: "sf6", region: "Narok" },
  { id: "KEN-SUB-002", name: "Isinya Substation", op: "KETRACO", country: "Kenya", voltage: 400, mass: 0, year: "", status: "sf6", region: "Kajiado" },
  { id: "KEN-SUB-003", name: "Loiyangalani Substation", op: "KETRACO", country: "Kenya", voltage: 400, mass: 0, year: "", status: "sf6", region: "Marsabit" },
  { id: "KEN-SUB-004", name: "Mariakani Substation", op: "KETRACO", country: "Kenya", voltage: 400, mass: 0, year: "", status: "sf6", region: "Kilifi" },
  { id: "KEN-SUB-005", name: "Rabai Substation", op: "KETRACO", country: "Kenya", voltage: 220, mass: 0, year: "", status: "sf6", region: "Kilifi" },
  { id: "KEN-SUB-006", name: "New Bamburi Substation", op: "KETRACO", country: "Kenya", voltage: 132, mass: 0, year: "", status: "sf6", region: "Mombasa / Kilifi" },
  { id: "KEN-SUB-007", name: "Kilifi Substation", op: "KETRACO", country: "Kenya", voltage: 132, mass: 0, year: "", status: "sf6", region: "Kilifi" },
  { id: "KEN-SUB-008", name: "Olkaria KETRACO Substation", op: "KETRACO", country: "Kenya", voltage: 220, mass: 0, year: "", status: "sf6", region: "Nakuru" },
  { id: "KEN-SUB-009", name: "Lessos Substation", op: "KETRACO", country: "Kenya", voltage: 220, mass: 0, year: "", status: "sf6", region: "Nandi" },
  { id: "KEN-SUB-010", name: "Kibos Substation", op: "KETRACO", country: "Kenya", voltage: 220, mass: 0, year: "", status: "sf6", region: "Kisumu" },
  { id: "KEN-SUB-011", name: "Kisumu Substation", op: "KETRACO / KPLC", country: "Kenya", voltage: 132, mass: 0, year: "", status: "sf6", region: "Kisumu" },
  { id: "KEN-SUB-012", name: "Eldoret Substation", op: "KETRACO / KPLC", country: "Kenya", voltage: 132, mass: 0, year: "", status: "sf6", region: "Uasin Gishu" },
  { id: "KEN-SUB-013", name: "Garissa Substation", op: "KETRACO", country: "Kenya", voltage: 132, mass: 0, year: "", status: "sf6", region: "Garissa" },
  { id: "KEN-SUB-014", name: "Hola Substation", op: "KETRACO", country: "Kenya", voltage: 132, mass: 0, year: "", status: "sf6", region: "Tana River" },
  { id: "KEN-SUB-015", name: "Garsen Substation", op: "KETRACO", country: "Kenya", voltage: 132, mass: 0, year: "", status: "sf6", region: "Tana River" },
  { id: "KEN-SUB-016", name: "Machakos Substation", op: "KETRACO", country: "Kenya", voltage: 132, mass: 0, year: "", status: "sf6", region: "Machakos" },
  { id: "KEN-SUB-017", name: "Konza Substation", op: "KETRACO", country: "Kenya", voltage: 400, mass: 0, year: "", status: "sf6", region: "Machakos / Makueni" },
  { id: "KEN-SUB-018", name: "Namanga Substation", op: "KETRACO", country: "Kenya", voltage: 400, mass: 0, year: "", status: "sf6", region: "Kajiado" },
  { id: "KEN-SUB-019", name: "Menengai Substation", op: "KETRACO / KenGen", country: "Kenya", voltage: 132, mass: 0, year: "", status: "sf6", region: "Nakuru" },
  { id: "KEN-SUB-020", name: "Soilo Substation", op: "KETRACO / KPLC", country: "Kenya", voltage: 132, mass: 0, year: "", status: "sf6", region: "Nakuru" },
  { id: "KEN-SUB-021", name: "Kisii Substation", op: "KETRACO / KPLC", country: "Kenya", voltage: 132, mass: 0, year: "", status: "sf6", region: "Kisii" },
  { id: "KEN-SUB-022", name: "Awendo Substation", op: "KETRACO / KPLC", country: "Kenya", voltage: 132, mass: 0, year: "", status: "sf6", region: "Migori" },
  { id: "KEN-SUB-023", name: "Embu Substation", op: "KETRACO / KPLC", country: "Kenya", voltage: 132, mass: 0, year: "", status: "sf6", region: "Embu" },
  { id: "KEN-SUB-024", name: "Kibirigwi Substation", op: "KETRACO / KPLC", country: "Kenya", voltage: 132, mass: 0, year: "", status: "sf6", region: "Kirinyaga" },
  { id: "KEN-SUB-025", name: "Thika Substation", op: "KETRACO / KPLC", country: "Kenya", voltage: 132, mass: 0, year: "", status: "sf6", region: "Kiambu" },
  { id: "KEN-SUB-026", name: "Embakasi Substation", op: "KPLC / KETRACO", country: "Kenya", voltage: 220, mass: 0, year: "", status: "sf6", region: "Nairobi" },
  { id: "KEN-SUB-027", name: "Juja Road Substation", op: "KPLC", country: "Kenya", voltage: 132, mass: 0, year: "", status: "sf6", region: "Nairobi" },
  { id: "KEN-SUB-028", name: "Dandora Substation", op: "KPLC / KETRACO", country: "Kenya", voltage: 220, mass: 0, year: "", status: "sf6", region: "Nairobi" },
  { id: "KEN-SUB-029", name: "Athi River 66/11 kV Substation", op: "KPLC", country: "Kenya", voltage: 66, mass: 0, year: "", status: "sf6", region: "Machakos" },
  { id: "KEN-SUB-030", name: "Ruaraka Substation", op: "KPLC", country: "Kenya", voltage: 66, mass: 0, year: "", status: "sf6", region: "Nairobi" },
  { id: "KEN-SUB-031", name: "Limuru Power Substation", op: "KPLC", country: "Kenya", voltage: 66, mass: 0, year: "", status: "sf6", region: "Kiambu" },
  { id: "KEN-SUB-032", name: "Komarock Power Substation", op: "KPLC", country: "Kenya", voltage: 66, mass: 0, year: "", status: "sf6", region: "Nairobi" },
  { id: "KEN-SUB-033", name: "Olkaria I Power Station Step-up Substation", op: "KenGen", country: "Kenya", voltage: 220, mass: 0, year: "1981", status: "sf6", region: "Nakuru" },
  { id: "KEN-SUB-034", name: "Olkaria II Substation / Power Station", op: "KenGen / KETRACO", country: "Kenya", voltage: 220, mass: 0, year: "", status: "sf6", region: "Nakuru" },
  { id: "KEN-SUB-035", name: "Olkaria IV Substation / Power Station", op: "KenGen / KETRACO", country: "Kenya", voltage: 220, mass: 0, year: "", status: "sf6", region: "Nakuru" },
  { id: "KEN-SUB-036", name: "Olkaria V Substation / Power Station", op: "KenGen / KETRACO", country: "Kenya", voltage: 220, mass: 0, year: "", status: "sf6", region: "Nakuru" },
  { id: "KEN-SUB-037", name: "Eburru Power Station Step-up Substation", op: "KenGen", country: "Kenya", voltage: 33, mass: 0, year: "", status: "sf6", region: "Nakuru" },
  { id: "KEN-SUB-038", name: "Menengai Geothermal Step-up Substation", op: "IPP — Menengai geothermal IPPs / KETRACO", country: "Kenya", voltage: 132, mass: 0, year: "", status: "sf6", region: "Nakuru" },
  { id: "KEN-SUB-039", name: "Kindaruma Power Station Substation", op: "KenGen", country: "Kenya", voltage: 132, mass: 0, year: "", status: "sf6", region: "Embu / Machakos" },
  { id: "KEN-SUB-040", name: "Gitaru Power Station Substation", op: "KenGen", country: "Kenya", voltage: 132, mass: 0, year: "", status: "sf6", region: "Embu" },
  { id: "KEN-SUB-041", name: "Kiambere Power Station Substation", op: "KenGen", country: "Kenya", voltage: 132, mass: 0, year: "", status: "sf6", region: "Embu" },
  { id: "KEN-SUB-042", name: "Kamburu Power Station Substation", op: "KenGen", country: "Kenya", voltage: 220, mass: 0, year: "", status: "sf6", region: "Embu" },
];

const STATUS_LABEL = {
  sf6:      { label: "Legacy SF₆",       cls: "sf6"      },
  retrofit: { label: "Retrofit candidate", cls: "retrofit" },
  clean:    { label: "SF₆-free",         cls: "clean"    },
  decom:    { label: "Decommissioned",   cls: "decom"    },
};

const FILTER_CHIPS = [
  { id: "all",      label: "All",            count: STATIONS.length },
  { id: "sf6",      label: "Legacy SF₆",     count: STATIONS.filter(s => s.status === "sf6").length },
  { id: "retrofit", label: "Retrofit cand.", count: STATIONS.filter(s => s.status === "retrofit").length },
  { id: "clean",    label: "SF₆-free",       count: STATIONS.filter(s => s.status === "clean").length },
  { id: "decom",    label: "Decomm.",        count: STATIONS.filter(s => s.status === "decom").length },
];

// Emission scenario series (kt CO₂e per year, by scenario, 2026–2050)
const SCENARIO_YEARS = [2026, 2028, 2030, 2032, 2034, 2036, 2038, 2040, 2042, 2044, 2046, 2048, 2050];
const SCENARIOS = {
  bau: {
    label: "Business as Usual",
    color: "var(--orange)",
    desc: "Continued fleet operation with industry-average leakage; no proactive replacement.",
    data: [118, 122, 126, 129, 132, 134, 136, 137, 138, 138, 139, 139, 139],
  },
  steady: {
    label: "End-of-life replacement",
    color: "var(--ink-700)",
    desc: "Replace each switchgear with SF₆-free at end of design life only (45 yrs).",
    data: [118, 116, 112, 105,  96,  84,  72,  59,  46,  35,  26,  20,  16],
  },
  acc: {
    label: "Accelerated retrofit",
    color: "var(--heat-green-dim)",
    desc: "Proactive retrofit of high-leakage stations + new builds SF₆-free from 2028.",
    data: [118, 102,  82,  62,  44,  30,  20,  13,   8,   5,   3,   2,   1],
  },
};

const SCENARIO_ASSUMPTIONS = [
  { lbl: "GWP (AR6, 100-yr)",           bau: "23,500",  steady: "23,500",  acc: "23,500" },
  { lbl: "Avg. fleet leakage rate",     bau: "0.7 %/yr",steady: "0.55 %/yr",acc: "0.30 %/yr" },
  { lbl: "End-of-life retirement age",  bau: "—",       steady: "45 yrs",   acc: "32 yrs" },
  { lbl: "New builds SF₆-free from",    bau: "—",       steady: "2032",     acc: "2028" },
  { lbl: "Recovery rate at retirement", bau: "85 %",    steady: "95 %",     acc: "98 %" },
  { lbl: "Annual retrofit budget (€M)", bau: "0",       steady: "14",       acc: "36" },
];

const TIMELINE = [
  { year: "2024",      status: "done",  tag: "Baseline",    tagCls: "",
    title: "Inventory baseline established",
    note: "30 substations catalogued in Senegal pilot (480 kg SF₆ quantified); Kenya stock estimate 24 000 kg confirmed via CTCN-KEN-SF6." },
  { year: "2026 Q2",   status: "done",  tag: "Leakage",     tagCls: "leak",
    title: "Fleet-wide leak survey · baseline year",
    note: "TDLAS handheld + fixed IoT pressure sensors deployed on 100 % of GIS bays. Baseline fleet-average leakage: 0.70 %/yr." },
  { year: "2026 Q3",   status: "now",   tag: "In progress", tagCls: "",
    title: "Retrofit & gas-conversion pilot — 8 stations",
    note: "Bushing replacement + gas conversion on 8 mid-life GIS bays at Senelec / KPLC pilot sites (Embakasi 220/66 kV among them)." },
  { year: "2027",      status: "future",tag: "Leakage",     tagCls: "leak",
    title: "Continuous monitoring · all HV bays",
    note: "Live pressure/density telemetry into the portal. Threshold alerts within 24 h of any leak ≥ 0.5 %/yr." },
  { year: "2028",      status: "future",tag: "Target",      tagCls: "",
    title: "Fleet-average leakage ≤ 0.5 %/yr",
    note: "First leakage-discipline milestone — interim step toward 2032 ≤ 0.3 %/yr target." },
  { year: "2030",      status: "future",tag: "EU F-Gas",    tagCls: "regulation",
    title: "New ≤ 24 kV switchgear: SF₆-free",
    note: "EU 2024/573 places-on-market ban for medium-voltage primary distribution under 24 kV." },
  { year: "2032",      status: "future",tag: "EU F-Gas",    tagCls: "regulation",
    title: "New ≤ 145 kV switchgear: SF₆-free",
    note: "Extended ban for sub-transmission GIS up to 145 kV — 245 kV at 2032 under EU framework." },
  { year: "2032",      status: "future",tag: "Leakage",     tagCls: "leak",
    title: "Fleet-average leakage ≤ 0.3 %/yr",
    note: "Best-in-class leakage discipline + 98 % recovery rate at decommissioning." },
  { year: "2040",      status: "future",tag: "Target",      tagCls: "",
    title: "100 % SF₆-free fleet",
    note: "All transmission and distribution assets transitioned to vacuum, dry-air, or g³/AirPlus." },
];

const WORKSTREAMS = [
  { num: "WS-01", title: "Leakage detection, monitoring & repair (LDAR)", pct: 78,
    desc: "Continuous IoT pressure/density telemetry on 100 % of GIS bays + annual TDLAS leak surveys. Target ≤ 0.5 %/yr by 2028, ≤ 0.3 %/yr by 2032. Live data into the portal." },
  { num: "WS-02", title: "End-of-life replacement pipeline",    pct: 42,
    desc: "Identify and budget for substations reaching 45-yr design life in 2026–2034. Framework procurement with Hitachi g³, GE Vernova g³, Schneider AIS." },
  { num: "WS-03", title: "Retrofit / gas-conversion programme", pct: 18,
    desc: "Convert eligible GIS to fluoronitrile mixture where vacuum is not viable > 145 kV. Pilot at Embakasi (KPLC) + Senelec Dakar peninsula." },
  { num: "WS-04", title: "Recovery & end-of-life processing",   pct: 64,
    desc: "Push fleet-wide recovery from 85 → 98 %. Certified destruction per IEC 62271-4; cradle-to-grave tracking; gas-quality CBM via TJH2b/DILO." },
  { num: "WS-05", title: "Staff F-Gas certification & H&S",     pct: 91,
    desc: "Field crews trained on clean-air switching, SO₂/SOF₂ handling, vacuum interrupter SOPs. Joint curriculum with IEC TC 17." },
  { num: "WS-06", title: "Standards & regulatory alignment",    pct: 35,
    desc: "Engagement with IEC TC 17, CIGRE WG B3.45, and IEA RETA + RISE regulatory indicators. SF₆ Regulatory Readiness Index in design." },
];

const TARGETS = [
  { n: "≤0.3",unit: "%/yr",    l: "Fleet-average <b>leakage rate</b> by 2032 — continuous LDAR monitoring, 24 h alert threshold.", color: "" },
  { n: "100", unit: "%",       l: "Fleet <b>SF₆-free</b> by 2040 (transmission + distribution).",                            color: "green" },
  { n: "98",  unit: "%",       l: "<b>Recovery rate</b> at decommissioning — certified destruction per IEC 62271-4.",       color: "" },
  { n: "186", unit: "kt CO₂e", l: "<b>Cumulative emissions avoided</b> 2026–2040 vs. business-as-usual.",                    color: "orange" },
];

const PARTNERS_OEM = [
  { logo: <span className="lw">Hitachi <span className="a-blue">Energy</span></span>,
    role: "Tier-1 OEM", title: "EconiQ™ / g³ portfolio",
    tech: "<b>EconiQ™ / g³ Clean Air</b> (CO₂ + O₂) — drop-in GIS retrofit, GWP ≈ 1. Commercial 72.5–550 kV. First 420 kV at Fingrid (FI); KETRACO 245 kV pilot specified.",
    coverage: "GIS · 72.5–550 kV", since: "Series 2016" },
  { logo: <span className="lw">Siemens <span className="a-green">Energy</span></span>,
    role: "Tier-1 OEM", title: "Blue™ / 8VN1 portfolio",
    tech: "<b>Blue Switchgear</b> using clean air (80 % N₂ / 20 % O₂) + vacuum interrupters at ≤ 145 kV. <b>8VN1</b> fluoronitrile (C4-FN) at 72.5–170 kV — PFAS supply risk after 3M exit 2025.",
    coverage: "GIS · ≤ 170 kV", since: "Series 2017" },
  { logo: <span className="lw">GE <span className="a-blue">Vernova</span></span>,
    role: "Tier-1 OEM", title: "g³ technology",
    tech: "<b>g³</b> (Green Gas for Grid) — 99 % less climate impact. Live at 420 kV with National Grid (UK); Dead-Tank CB applicable to KETRACO / KPLC 245 kV scope.",
    coverage: "GIS / DT · 72.5–420 kV", since: "Series 2018" },
  { logo: <span className="lw">Schneider <span className="a-green">Electric</span></span>,
    role: "OEM", title: "SM AirSeT / AIS range",
    tech: "<b>SM AirSeT</b> medium-voltage RMU using shielded vacuum + pure air. <b>SF₆-free AIS</b> at 72.5–245 kV for greenfield open-bus.",
    coverage: "MV / AIS · 12–245 kV", since: "Series 2022" },
  { logo: <span className="lw">ABB</span>,
    role: "OEM", title: "AirPlus™ & vacuum live-tank",
    tech: "<b>AirPlus™</b> (fluoroketone C5-FK) for primary MV; vacuum live-tank CB commercial at 72.5–145 kV. Not yet at 245 kV live-tank.",
    coverage: "MV · 12–40 kV · HV ≤ 145 kV", since: "Series 2015" },
  { logo: <span className="lw">Eaton <span className="a-blue">Cooper</span></span>,
    role: "OEM", title: "Solid-dielectric & vacuum",
    tech: "<b>VPI / Pad-mounted</b> solid-dielectric and vacuum reclosers for 15–38 kV distribution. SF₆-free since 1990s — Senelec / KPLC MV programmes.",
    coverage: "MV · ≤ 38 kV", since: "Series 1995" },
];

const PARTNERS_REG = [
  { name: "IEA · RETA (Regulators' Energy Transition Accelerator)", role: "Multilateral · convener",
    desc: "International peer-learning network for energy regulators on the clean-energy transition. Convening role for the proposed SF₆ Regulator Community of Practice — zero-cost, high-leverage. Contacts: Floris van Dedem, Esra Bozkir Broekman.",
    tag: "IEA · global" },
  { name: "CTCN / UNEP (Climate Technology Centre & Network)", role: "Implementation partner · co-host",
    desc: "UNFCCC operational arm for technology transfer. Co-host of the portal. Funded CTCN-KEN-SF6 pilot (Kenya, ~24 000 kg fleet — Embakasi 220/66 kV pilot site with KPLC). Operates the public SF₆ Knowledge Hub.",
    tag: "UNFCCC TT" },
  { name: "IEA · RISE (Regulatory Indicators for Sustainable Energy)", role: "Benchmarking partner",
    desc: "World Bank / ESMAP / IEA joint initiative benchmarking 140 countries on energy regulation. SF₆ Regulatory Readiness Index proposed by HEAT — methodology analogous to RISE scoring.",
    tag: "WB · ESMAP · IEA" },
  { name: "European Commission · DG CLIMA", role: "EU regulator",
    desc: "Owner of Regulation (EU) 2024/573 on fluorinated greenhouse gases. Phase-out: MV ≤ 24 kV by 2030, sub-transmission ≤ 145 kV by 2032, comprehensive ban 2035. Global procurement reference.",
    tag: "EU regulation" },
  { name: "California Air Resources Board (CARB)", role: "Sub-national regulator",
    desc: "Declining annual emission-rate limits for utilities; mandatory SF₆ inventory + emissions reporting; procurement restrictions on new SF₆ equipment with narrow exemptions. Enforcement-driven model.",
    tag: "US · CA" },
  { name: "ENTSO-E", role: "TSO association",
    desc: "Coordinates 10-Year Network Development Plan; common position on SF₆-free transmission asset specifications. Methodology partner for the portal scenario engine (HEAT × ENTSO-E TYNDP v2.1).",
    tag: "TSO body" },
];

const PARTNERS_STD = [
  { name: "IEC TC 17 / SC 17C",   role: "International standards", desc: "Standards for HV switchgear. Work item 62271-4 on gas handling, alternative gases, and end-of-life destruction protocol (WS-04).", tag: "IEC" },
  { name: "CIGRE WG B3.45 / D1.67", role: "Technical association", desc: "Working groups on alternative gases. Reference brochures 791, 802 — industry-aligned testing methodology and field-experience reporting.", tag: "Working group" },
  { name: "IRENA", role: "Intergovernmental agency", desc: "Renewable Energy Statistics + Country Energy Profiles — anchor dataset for grid-expansion planning across Senegal, Kenya, Bhutan, Botswana scoping.", tag: "Intergovernmental" },
  { name: "GIZ · Energy & Climate", role: "Bilateral cooperation", desc: "Co-financing partner on CTCN-KEN-SF6 and West Africa F-Gas roadmap. Procurement support and capacity building with national utilities.", tag: "Bilateral" },
];

const PARTNERS_RESEARCH = [
  { name: "Utilities — Senelec · KPLC · KETRACO · Fingrid · National Grid · KEPCO", role: "Operating partners",
    desc: "Reference utilities operating commercial SF₆-free transmission (Fingrid 420 kV EconiQ; National Grid UK g³) + pilot host utilities (Senelec — Senegal; KPLC + KETRACO — Kenya, Embakasi 220/66 kV pilot).",
    tag: "Pilot operators" },
  { name: "TU Darmstadt — HST", role: "Research", desc: "Institute for High Voltage Technology. Long-term ageing studies on fluoronitrile mixtures under field conditions.", tag: "University" },
  { name: "Fraunhofer ISE", role: "Research", desc: "Life-cycle assessment for switchgear platforms; emissions accounting methodology for the portal's scenario engine.", tag: "Applied research" },
  { name: "EPRI", role: "Research consortium", desc: "Electric Power Research Institute — international knowledge exchange on SF₆ alternatives field experience (US, JP, KR utilities).", tag: "Consortium" },
  { name: "NDE Germany / HEAT GmbH", role: "Portal host", desc: "BMW-GLO-NDE programme lead. Portal architecture, GHG accounting framework, NDC integration, independent verification of operator submissions.", tag: "Co-host" },
];

const NEWS = [
  { date: "17 May 2026", t: "Knowledge Report \"Pathways for SF₆ phase-down in developing countries\" pitched to IEA — awaiting response (Valentin / NDE)" },
  { date: "05 May 2026", t: "CTCN SF₆ Knowledge Hub goes live — ctc-n.org/sf6-knowledge-hub" },
  { date: "14 May 2026", t: "First SF₆-free 420 kV bay energised at Fingrid (FI) — Hitachi Energy EconiQ" },
  { date: "02 May 2026", t: "Regulation (EU) 2024/573 — Q2 reporting templates published by DG CLIMA" },
  { date: "27 Apr 2026", t: "CIGRE Symposium Cairns — eight new field papers on fluoronitrile experience" },
];


const KENYA_INVENTORY = [
  { utility: "KPLC",       kg: 13940, pct: 58, scope: "Distribution + transmission, MV + HV" },
  { utility: "KETRACO",    kg: 5850,  pct: 24, scope: "National HV backbone (132–400 kV)" },
  { utility: "Others/IPP", kg: 4210,  pct: 18, scope: "IPPs, industrial captive" },
];
const ALT_TECH = [
  { tech: "g³ Clean Air",        medium: "CO₂ + O₂",     quench: "CO₂ puffer",   gwp: "≈ 1",    v245: "✓ Commercial",  notes: "Hitachi Energy + GE Vernova; series since 2016. Drop-in GIS retrofit; first 420 kV at Fingrid." },
  { tech: "Dry Air / N₂ AIS",    medium: "Pure dry air", quench: "Vacuum / air", gwp: "0",      v245: "✓ AIS only",    notes: "Schneider Electric SF₆-free AIS; open-bus design, larger footprint, zero special-gas handling." },
  { tech: "Vacuum CB",           medium: "Vacuum",       quench: "Vacuum",       gwp: "0",      v245: "✗ Not yet",     notes: "ABB + Siemens. Commercial to 72.5 kV; 145 kV in testing; NOT yet at 245 kV live-tank." },
  { tech: "Fluoronitrile",       medium: "C4-FN + CO₂",  quench: "C4-FN mix",    gwp: "≈ 2 100",v245: "✓ ≤ 170 kV",    notes: "Siemens 8VN1; GWP lower but still F-gas. PFAS supply risk post 3M exit 2025." },
  { tech: "Fluoroketone (C5-FK)",medium: "C5-FK + air",  quench: "C5-FK",        gwp: "≈ 1",    v245: "✗ MV only",     notes: "ABB AirPlus, Siemens Blue MV. Commercial at ≤ 40.5 kV only." },
  { tech: "Oil (legacy)",        medium: "Mineral oil",  quench: "Oil",          gwp: "0",      v245: "✗ Obsolete",    notes: "Never specify for new installations. Phase-out programme only." },
];
const KNOWLEDGE_REPORT = {
  title: "Pathways for the Management and Phase-Down of SF₆ in Developing Countries",
  status: "Pitched to IEA · awaiting response (May 2026)",
  authors: "CTCN · NDE Germany / HEAT · IEA RETA",
  hub_url: "https://www.ctc-n.org/sf6-knowledge-hub",
  pages: "~20",
  outline: [
    { num: "1", title: "Executive Summary",                pages: 2,
      bullets: ["Why SF₆ is a priority now (climate + grid expansion)",
                "Global regulatory momentum: EC · California · Japan",
                "Key insights from CTCN + IEA RETA",
                "Main gaps and opportunities in developing countries"] },
    { num: "2", title: "Why SF₆ Matters for Energy Systems", pages: 1.5,
      bullets: ["Role in T&D equipment", "Emission sources: leakage, maintenance, end-of-life",
                "Climate impact and mis-alignment with net-zero targets"] },
    { num: "3", title: "Technology options for SF₆ mitigation", pages: 2,
      bullets: ["Equipment + measures for safe management", "SF₆-free equipment landscape and maturity"] },
    { num: "4", title: "Global Regulatory Momentum and Lessons", pages: 3,
      bullets: ["EU · Reg. 2024/573 (regulatory-driven)",
                "California · CARB declining-limits (enforcement-driven)",
                "Japan · voluntary commitments + technical guidelines (industry-led)",
                "Sequencing: data → management → transition"] },
    { num: "5", title: "SF₆ in Developing Countries", pages: 5,
      bullets: ["Energy infrastructure + rapid grid expansion + lock-in risk",
                "Policy context: limited NDC inclusion, indirect coverage under F-gases",
                "Barriers: data gaps · technical capacity · finance · regulation · supply chain",
                "Opportunities: alignment with other energy priorities, TCO, carbon markets, CoP"] },
    { num: "6", title: "Practical Steps to Tackle SF₆ Emissions", pages: 6,
      bullets: ["Step 1 — Foundation: inventories & reporting",
                "Step 2 — Reduce emissions: leak limits & technical standards",
                "Step 3 — Investment: procurement rules & incentives",
                "Step 4 — Alternatives: approval & standards",
                "Step 5 — Transition: phase-out pathways"] },
    { num: "7", title: "Stakeholder responsibilities", pages: 2,
      bullets: ["Regulators · Utilities · Manufacturers · Financial institutions · International orgs"] },
    { num: "8", title: "Conclusions and Key Recommendations", pages: 1, bullets: [] },
  ],
};


// Per-country profiles drive Inventories / Scenarios / Plans
const COUNTRY_PROFILES = {
  all: {
    code: "all", short: "All countries", name: "All countries (consolidated)",
    stations: 30, mass_kg: 24480, scale: 5.08,
    map_src: "map.html",
    available: true,
    inv_lede: "Consolidated view across the BMW-GLO-NDE pilot fleet — Senegal (30 substations · 480 kg site-mapped) plus Kenya (24 000 kg fleet via CTCN-KEN-SF6, KPLC + KETRACO + IPP). Detail map shows Senegal pilot first; Kenya site-mapping in progress.",
    scen_lede: "Modelled annual SF₆ emissions across the consolidated fleet (24 480 kg installed). Three policy responses, identical asset boundary, same GWP factor — outcomes diverge by more than two orders of magnitude.",
    plans_lede: "Six workstreams aligned to EU F-Gas 2024/573, the CTCN-KEN-SF6 framework, and operator-led 2040 fleet targets. Status updated quarterly from operator submissions and verified by HEAT.",
    plans_meta: "All-country programme · HEAT-chaired",
  },
  sen: {
    code: "sen", short: "Senegal", name: "Senegal — BMW-GLO-NDE pilot",
    stations: 30, mass_kg: 480, scale: 0.0995,
    map_src: "map.html",
    available: true,
    inv_lede: "Senegal national grid · 30 / 90 / 225 kV transmission & sub-transmission. 30 substations catalogued (Senelec + IPP step-up + OMVS interconnection); 480 kg SF₆ quantified to date; balance pending nameplate verification.",
    scen_lede: "Modelled annual SF₆ emissions from the Senegal pilot fleet (480 kg installed). With current 0.7 %/yr fleet leakage, BAU peaks below 12 kt CO₂e/yr — small in absolute terms but locked-in for decades. Accelerated retrofit closes the gap by 2035.",
    plans_lede: "Six workstreams for the Senegal pilot. LDAR baseline 2026 Q2; accelerated retrofit pilot at Cap des Biches / Bel Air / Cape Verde MV; 2040 SF₆-free target aligned with Senegalese NDC update.",
    plans_meta: "Senegal · NDC programme · Senelec lead",
  },
  ken: {
    code: "ken", short: "Kenya", name: "Kenya — CTCN-KEN-SF6 pilot",
    stations: 42, mass_kg: 24000, scale: 4.98,
    map_src: "ken-map.html",
    available: true,
    inv_lede: "Kenya national grid · KPLC (13 940 kg, 58 %) + KETRACO (5 850 kg, 24 %) + IPP / industrial (4 210 kg, 18 %). ~24 000 kg total stock — confirmed via CTCN-KEN-SF6 project intelligence. Site-mapping pending; Embakasi 220/66 kV pilot site confirmed by KPLC.",
    scen_lede: "Modelled annual SF₆ emissions from the Kenya fleet (24 000 kg installed). With 0.7 %/yr leakage, BAU exceeds 600 kt CO₂e cumulative by 2050. Accelerated retrofit closes the gap by 2040 — directly relevant to KETRACO 245 kV procurement and EU 2032 lock-out.",
    plans_lede: "CTCN-KEN-SF6 framework: KPLC + KETRACO joint pilot at Embakasi, then phased fleet roll-out. Gas-quality CBM via TJH2b/DILO before recovery. 245 kV replacement aligned with Hitachi g³ + GE Vernova g³ procurement windows.",
    plans_meta: "Kenya · CTCN technology transfer · GIZ co-financing",
  },
  eu: {
    code: "eu", short: "EU-27", name: "EU-27 — F-Gas Reg. 2024/573 framework",
    stations: 0, mass_kg: 0, scale: 0,
    map_src: "",
    available: false,
    inv_lede: "EU is treated as a regulatory framework country in this portal — no consolidated stock inventory is published at EU-27 level (operator-level data sits with national regulators e.g. BNetzA / UBA). The framework drives global procurement standards.",
    scen_lede: "No country-level scenario engine for the EU-27 — the F-Gas Regulation 2024/573 is itself the trajectory: MV ≤ 24 kV ban 2030, ≤ 145 kV ban 2032, comprehensive ban 2035.",
    plans_lede: "Regulation (EU) 2024/573 is the active workplan. Operator obligations on leak detection, reporting, certification, and recovery apply from day one across all 27 Member States.",
    plans_meta: "EU regulatory framework",
  },
  deu: {
    code: "deu", short: "Germany", name: "Germany — TSO forum (scoping)",
    stations: 0, mass_kg: 0, scale: 0, map_src: "", available: false,
    inv_lede: "Germany TSO-forum scoping under way. TenneT / 50Hertz / Amprion / TransnetBW + selected DSOs (Bayernwerk Netz) — illustrative national figures: ~247 GIS substations, ~4 820 kg SF₆.",
    scen_lede: "Data acquisition in progress with the German TSO forum. Scenarios will be published once operator submissions are verified.",
    plans_lede: "Germany scoping ongoing — pending operator participation agreements via BNetzA and UBA.",
    plans_meta: "Germany · TSO forum scoping",
  },
  btn: {
    code: "btn", short: "Bhutan", name: "Bhutan — scoping",
    stations: 0, mass_kg: 0, scale: 0, map_src: "", available: false,
    inv_lede: "Bhutan scoping under way via HEAT NDC engagement (Druk Green Power Corp + Bhutan Power Corp). Inventory expected 2026 Q4.",
    scen_lede: "No data yet.",
    plans_lede: "Scoping engagement only.",
    plans_meta: "Bhutan · scoping",
  },
  bwa: {
    code: "bwa", short: "Botswana", name: "Botswana — scoping",
    stations: 0, mass_kg: 0, scale: 0, map_src: "", available: false,
    inv_lede: "Botswana scoping under way via SADC MEPS programme. Inventory expected 2026 Q4.",
    scen_lede: "No data yet.",
    plans_lede: "Scoping engagement only.",
    plans_meta: "Botswana · scoping",
  },
};

// Make available across babel-script scopes
Object.assign(window, {
  PILLARS, OPERATORS, COUNTRIES, STATIONS, STATUS_LABEL, FILTER_CHIPS,
  SCENARIO_YEARS, SCENARIOS, SCENARIO_ASSUMPTIONS,
  TIMELINE, WORKSTREAMS, TARGETS,
  PARTNERS_OEM, PARTNERS_REG, PARTNERS_STD, PARTNERS_RESEARCH,
  ALT_TECH, KENYA_INVENTORY, KNOWLEDGE_REPORT, COUNTRY_PROFILES,
  NEWS,
});
