GLOBALGRID2050 / EXPLORE CODE

Part of: Explore Code / Maps, GIS and field navigation / globalgrid2050 / repd_grid_atlasv6/scripts

Update Prices v6 and 2 more files

A Python command-line tool in the scripts folder of GlobalGrid2050 that fetches cables and 33kV, using BS 7870 from open.er-api.com and query1.finance.yahoo.com. It gets market (`get_market_data`).

473 lines of Python and CSS from globalgrid2050, in 3 files. Topic: Maps, GIS and field navigation. Section 498 of 2044.

Cut 2026-12-06T03:07:51+00:00. A copy for reading; the repository at the stated commit is the source.

In the State lines below, domain stage, users and canonical status are rule-based first approximations from code and path evidence (rules explore-agent-rules-v1), not observed facts: the rules.

In this section

  1. Update Prices Lvv6 energy-data · globalgrid2050 / repd_grid_atlasv6/scripts/update_prices_lvv6.py lines 1–155
  2. Update Prices v6 storage · globalgrid2050 / repd_grid_atlasv6/scripts/update_pricesv6.py lines 1–161
  3. Ventus v6 render · globalgrid2050 / repd_grid_atlasv6/ventusv6.css lines 1–157

Update Prices Lvv6

A Python command-line tool in the scripts folder of GlobalGrid2050 that fetches cables from open.er-api.com and query1.finance.yahoo.com.

energy-dataglobalgrid2050 / repd_grid_atlasv6/scripts/update_prices_lvv6.py · lines 1–155 of 155 · Entry point · pattern get_market_data (shared by 3 files)

What it does
It fetches cables. Defines get_market_data, main. Uses libraries requests, os, pathlib, datetime. Side effects: reads or writes files; makes network requests.
Why it exists in the grid workflow
Domain stage hv_procurement (path word 'prices'): HV materials procurement, which Ventus Ltd states is within its commercial execution boundary. Domain terms in the code: cables.
Inputs & outputs
In: data source: open.er-api.com; data source: query1.finance.yahoo.com.
Downstream impact
It is itself an entry point (Python CLI); no other file was found loading it.
What it achieves
Its name says it updates prices Lvv6. Defines `get_market_data`.
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
globalgrid2050 · repd_grid_atlasv6/scripts · Python CLI
Uses
requests, os, pathlib, datetime
Used by
none found
Produces
get_market_data, main
Defines here
get_market_data, main
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 repd_grid_atlasv6/scripts/update_prices_lvv6.py:1-155 · blob e9cd745ef1f1c884e1861c3a83691757240becb1 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: filesystem, network · domain stage: hv_procurement · users: IPP_developer, EPC_contractor, procurement_buyer · canonical: production_core
import requests
import os
from pathlib import Path
from datetime import datetime, timezone

FILE = Path(__file__).parent.parent / "lv_ac_dc_price_estimator" / "index.md"


def get_market_data():
    data = {
        "gbp_usd": 1.3339,
        "eur_usd": 1.1586,
        "gbp_eur": 1.1510,
        "cu_usd": 12850.0,
        "al_usd": 3520.0,
        "used_fallback": False
    }

    try:
        fx = requests.get("https://open.er-api.com/v6/latest/GBP", timeout=15).json()
        data["gbp_usd"] = fx["rates"]["USD"]
        data["gbp_eur"] = fx["rates"]["EUR"]
        data["eur_usd"] = data["gbp_usd"] / data["gbp_eur"]
    except Exception as e:
        print(f"::warning::FX fetch failed, using fallback rates: {e}")
        data["used_fallback"] = True

    try:
        r = requests.get(
            "https://query1.finance.yahoo.com/v8/finance/chart/HG=F",
            timeout=10,
            headers={"User-Agent": "Mozilla/5.0"}
        )
        cu_lb = r.json()["chart"]["result"][0]["meta"]["regularMarketPrice"]
        data["cu_usd"] = cu_lb * 2204.62
    except Exception as e:
        print(f"::warning::Copper fetch failed, using fallback: {e}")
        data["used_fallback"] = True

    try:
        r = requests.get(
            "https://query1.finance.yahoo.com/v8/finance/chart/ALI=F",
            timeout=10,
            headers={"User-Agent": "Mozilla/5.0"}
        )
        data["al_usd"] = r.json()["chart"]["result"][0]["meta"]["regularMarketPrice"]
    except Exception as e:
        print(f"::warning::Aluminium fetch failed, using fallback: {e}")
        data["used_fallback"] = True

    return data


def main():
    d = get_market_data()
    ts_obj = datetime.now(timezone.utc)
    ts = ts_obj.strftime("%A %d %B %Y %H:%M UTC")

    if d["used_fallback"]:
        print("::warning::One or more prices are fallback values - verify API sources")

    # Currency Math
    cu_gbp = d["cu_usd"] / d["gbp_usd"]
    al_gbp = d["al_usd"] / d["gbp_usd"]
    
    cu_eur = cu_gbp * d["gbp_eur"]
    al_eur = al_gbp * d["gbp_eur"]

    # --- UPDATED: Cable Size Definitions (DC Strings Removed) ---
    LV_AL_CABLES = [95, 120, 150, 185, 240, 300, 400, 500, 630]
    LV_CU_CABLES = [16, 25, 35, 50, 70, 95, 120, 150, 185, 240, 300, 400]

    # --- UPDATED: Calculation Engine (EUR added, Al changed to 20%) ---
    lv_al_rows = ""
    for mm2 in LV_AL_CABLES:
        weight = mm2 * 2.92
        metal_val = (weight / 1000) * al_gbp
        net_price_gbp = metal_val / 0.20  # Aluminium changed to 20%
        net_price_eur = net_price_gbp * d["gbp_eur"]
        lv_al_rows += f"| {mm2} | {weight:,.1f} | {metal_val:,.0f} | {net_price_gbp:,.0f} | {net_price_eur:,.0f} |\n"

    lv_cu_rows = ""
    for mm2 in LV_CU_CABLES:
        weight = mm2 * 9.6
        metal_val = (weight / 1000) * cu_gbp
        net_price_gbp = metal_val / 0.30  # Copper stays at 30%
        net_price_eur = net_price_gbp * d["gbp_eur"]
        lv_cu_rows += f"| {mm2} | {weight:,.1f} | {metal_val:,.0f} | {net_price_gbp:,.0f} | {net_price_eur:,.0f} |\n"

    # --- UPDATED: Markdown Generation ---
    md_content = f"""---
layout: page
title: LV AC and DC Distribution Cables Price Estimator
permalink: /lv_ac_dc_price_estimator/
---
# LV AC and DC Distribution Cables Price Estimator

Large scale price estimator for Low Voltage (LV) Alternating Current (AC) and Direct Current (DC) cables. These form the electrical backbone of Solar PV arrays, BESS installations, and standard distribution networks.

---

## Market Inputs

| Parameter | Value |
|---|---|
| LME Copper (USD) | USD {d['cu_usd']:,.0f} / tonne |
| LME Aluminium (USD) | USD {d['al_usd']:,.0f} / tonne |
| Exchange Rates | 1 GBP = {d['gbp_usd']:.4f} USD <br> 1 GBP = {d['gbp_eur']:.4f} EUR |
| Copper (GBP) | GBP {cu_gbp:,.0f} / tonne |
| Aluminium (GBP) | GBP {al_gbp:,.0f} / tonne |
| Copper (EUR) | EUR {cu_eur:,.0f} / tonne |
| Aluminium (EUR) | EUR {al_eur:,.0f} / tonne |
| Last Update | {ts} |

---

## Weight Formulas & Pricing Rule

- **Copper kg per km:** Area (mm²) × 9.6
- **Aluminium kg per km:** Area (mm²) × 2.92
- **Copper Net Price:** Metal value ÷ 0.30 (Assuming raw metal constitutes 30% of the final delivered cost)
- **Aluminium Net Price:** Metal value ÷ 0.20 (Assuming raw metal constitutes 20% of the final delivered cost)

---

## LV / DC Main Cables (Aluminium)
Typical single core aluminium distribution cables.

| Conductor (mm²) | Aluminium (kg/km) | Metal Value (GBP/km) | Net Price (GBP/km) | Net Price (EUR/km) |
|---|---|---|---|---|
{lv_al_rows}
---

## LV Distribution Cables (Copper)
Typical single core copper distribution cables.

| Conductor (mm²) | Copper (kg/km) | Metal Value (GBP/km) | Net Price (GBP/km) | Net Price (EUR/km) |
|---|---|---|---|---|
{lv_cu_rows}
---
## Notes
Estimates are DAP (Delivered at Place) for large-scale utility procurement. Values do not represent small-batch wholesale counter prices.
Final prices vary based on formal manufacturer negotiations and hedging contracts against copper, aluminium, polymers, energy costs, shipping, currency exchange rates and engineering sign off on appropriate materials selection.
Price is inflated slightly to counter procurement risks but nothing is guaranteed until contract signature and payment terms agreement with suppliers and appropriate insurance against force majeure.
"""

    FILE.parent.mkdir(parents=True, exist_ok=True)
    with open(FILE, "w", encoding="utf-8") as f:
        f.write(md_content)

    print(f"✅ Successfully updated LV AC/DC Price Estimator at: {FILE}")


if __name__ == "__main__":
    main()

Update Prices v6

A Python command-line tool in the scripts folder of GlobalGrid2050 that fetches cables and 33kV, using BS 7870 from open.er-api.com and query1.finance.yahoo.com. It gets market (`get_market_data`).

storageglobalgrid2050 / repd_grid_atlasv6/scripts/update_pricesv6.py · lines 1–161 of 161 · Entry point · pattern get_market_data (shared by 3 files)

What it does
It fetches cables and 33kV. Defines get_market_data, main. Uses libraries requests, os, pathlib, datetime. Side effects: reads or writes files; makes network requests.
Why it exists in the grid workflow
Domain stage upstream_foresight (path word 'repd'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight. Domain terms in the code: cables, 33kV.
Inputs & outputs
In: data source: open.er-api.com; data source: query1.finance.yahoo.com. Voltage levels named: 33kV.
Downstream impact
It is itself an entry point (Python CLI); no other file was found loading it.
What it achieves
Define the target path (ensuring it targets the correct directory relative to the script). Its code works with 33 kV.
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
globalgrid2050 · repd_grid_atlasv6/scripts · Python CLI
Uses
requests, os, pathlib, datetime
Used by
none found
Produces
get_market_data, main
Defines here
get_market_data, main
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 repd_grid_atlasv6/scripts/update_pricesv6.py:1-161 · blob 7e8068ba90576d5c85115bad539fd6b3879e13c0 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: filesystem, network · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
import requests
import os
from pathlib import Path
from datetime import datetime, timezone

# Define the target path (ensuring it targets the correct directory relative to the script)
FILE = Path(__file__).parent.parent / "33kv_uk_dap_price_estimator" / "index.md"


def get_market_data():
    data = {
        "gbp_usd": 1.3339,
        "gbp_eur": 1.1510,
        "cu_usd": 12850.0,
        "al_usd": 3520.0,
        "used_fallback": False
    }

    try:
        fx = requests.get("https://open.er-api.com/v6/latest/GBP", timeout=15).json()
        data["gbp_usd"] = fx["rates"]["USD"]
        data["gbp_eur"] = fx["rates"]["EUR"]
    except Exception as e:
        print(f"::warning::FX fetch failed, using fallback rates: {e}")
        data["used_fallback"] = True

    try:
        r = requests.get(
            "https://query1.finance.yahoo.com/v8/finance/chart/HG=F",
            timeout=10,
            headers={"User-Agent": "Mozilla/5.0"}
        )
        cu_lb = r.json()["chart"]["result"][0]["meta"]["regularMarketPrice"]
        data["cu_usd"] = cu_lb * 2204.62
    except Exception as e:
        print(f"::warning::Copper fetch failed, using fallback: {e}")
        data["used_fallback"] = True

    try:
        r = requests.get(
            "https://query1.finance.yahoo.com/v8/finance/chart/ALI=F",
            timeout=10,
            headers={"User-Agent": "Mozilla/5.0"}
        )
        data["al_usd"] = r.json()["chart"]["result"][0]["meta"]["regularMarketPrice"]
    except Exception as e:
        print(f"::warning::Aluminium fetch failed, using fallback: {e}")
        data["used_fallback"] = True

    return data


def main():
    d = get_market_data()
    ts_obj = datetime.now(timezone.utc)
    ts = ts_obj.strftime("%A %d %B %Y %H:%M UTC")

    if d["used_fallback"]:
        print("::warning::One or more prices are fallback values - verify API sources")

    cu_gbp = d["cu_usd"] / d["gbp_usd"]
    al_gbp = d["al_usd"] / d["gbp_usd"]
    
    cu_eur = cu_gbp * d["gbp_eur"]
    al_eur = al_gbp * d["gbp_eur"]

    CABLES = [
        (120, 35), (150, 35), (185, 35), (240, 35), (300, 35),
        (400, 35), (500, 35), (630, 35),
        (800, 50), (1000, 50), (1200, 50), (1400, 50),
        (1600, 50), (1800, 50), (2000, 50), (2500, 50)
    ]

    cable_rows = ""
    for cond_mm2, cws_mm2 in CABLES:
        al_kg = cond_mm2 * 2.92
        cu_kg = cws_mm2 * 9.6
        al_val = (al_kg / 1000) * al_gbp
        cu_val = (cu_kg / 1000) * cu_gbp
        total_metal = al_val + cu_val
        net_price_gbp = total_metal / 0.3
        net_price_eur = net_price_gbp * d["gbp_eur"]
        
        cable_rows += (
            f"| {cond_mm2:,} | {cws_mm2} | {al_kg:,.1f} | {cu_kg:,.1f} | "
            f"{al_val:,.0f} | {cu_val:,.0f} | {total_metal:,.0f} | {round(net_price_gbp):,} | {round(net_price_eur):,} |\n"
        )

    md_content = f"""---
layout: page
title: 33kV Cable Price Estimator
permalink: /33kv_uk_dap_price_estimator/
---
# 33 kV Aluminium XLPE Cable Price Estimator
Single core 19/33 kV aluminium conductor XLPE insulated cable with copper wire screen 35 mm2 or 50 mm2 and MDPE oversheath to BS 7870.

Large scale price estimator for global 33 kV cable supply delivered to site with typical manufacturing lead times of 10 to 30 weeks.

---

## Market Inputs

| Parameter | Value |
|---|---|
| LME Copper (USD) | USD {d['cu_usd']:,.0f} / tonne |
| LME Aluminium (USD) | USD {d['al_usd']:,.0f} / tonne |
| Exchange Rates | 1 GBP = {d['gbp_usd']:.4f} USD <br> 1 GBP = {d['gbp_eur']:.4f} EUR |
| Copper (GBP) | GBP {cu_gbp:,.0f} / tonne |
| Aluminium (GBP) | GBP {al_gbp:,.0f} / tonne |
| Copper (EUR) | EUR {cu_eur:,.0f} / tonne |
| Aluminium (EUR) | EUR {al_eur:,.0f} / tonne |
| Last Update | {ts} |

---

## Weight Formulas

- Copper kg per km = mm2 x 9.6
- Aluminium kg per km = mm2 x 2.92

---

## Net Price Rule

Net cable price = Metal value divided by 0.3

Typical cost structure:
- Metal content: 30 percent
- Manufacturing, logistics, and margin: 70 percent

---

## Cable Metal and Net Price Estimator

| Conductor mm2 | CWS mm2 | Aluminium kg/km | Copper kg/km | Aluminium GBP/km | Copper GBP/km | Total metal GBP/km | Net GBP/km | Net EUR/km |
|---|---|---|---|---|---|---|---|---|
{cable_rows}

---

## Notes

This estimator supports rapid early stage cost analysis for:
- Solar farms
- Battery energy storage systems BESS
- Wind farms
- Utility substations
- Transmission and distribution connections
"""

    # Ensure the target directory exists before trying to write to it
    FILE.parent.mkdir(parents=True, exist_ok=True)
    
    # Open the file and write the generated markdown content
    with open(FILE, "w", encoding="utf-8") as f:
        f.write(md_content)
        
    print(f"✅ Successfully updated 33kV Price Estimator at: {FILE}")

if __name__ == "__main__":
    main()

Ventus v6

A style sheet in GlobalGrid2050. Served with the page at https://globalgrid2050.com/repd_grid_atlasv6/.

renderglobalgrid2050 / repd_grid_atlasv6/ventusv6.css · lines 1–157 of 157 · Entry point

What it does
Side effects: changes the web page (DOM).
Why it exists in the grid workflow
Domain stage upstream_foresight (path word 'repd'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight.
Downstream impact
Used directly by 5 files: GlobalGrid2050 — Renewable Energy Planning Database (REPD) Grid Atlas v5 Page (globalgrid2050, https://globalgrid2050.com/repd_grid_atlasv5/); GlobalGrid2050 — Renewable Energy Planning Database (REPD) Grid Atlas v6 Page (globalgrid2050, https://globalgrid2050.com/repd_grid_atlasv6/); GlobalGrid2050 — Renewable Energy Planning Database (REPD) Grid Atlas v7 Page (globalgrid2050, https://globalgrid2050.com/repd_grid_atlasv7/); GlobalGrid2050 — Renewable Energy Planning Database (REPD) Grid Atlas v8 Page (globalgrid2050, https://globalgrid2050.com/repd_grid_atlasv8/); and 1 more. Reached from 503 other entry points, including Code Generator — Index Page (code-generator, https://ventusltd.github.io/code-generator/); Generate (code-generator, https://ventusltd.github.io/code-generator/); Pilot (cosmic, https://ventusltd.github.io/cosmic/tools/explore/theme/pilot.html). It is itself an entry point, published at https://globalgrid2050.com/repd_grid_atlasv6/.
What it achieves
No statement of purpose was found in the file, a README line naming it, or its name.
Why it matters
Loaded by the Renewable Energy Planning Database (REPD) Grid Atlas v5 page at https://globalgrid2050.com/repd_grid_atlasv5/ and 4 other pages.
Application
globalgrid2050 · repd_grid_atlasv6 · style sheet
Uses
none found
Used by
loaded by GlobalGrid2050 — Renewable Energy Planning Database (REPD) Grid Atlas v5 Page (stylesheet), loaded by GlobalGrid2050 — Renewable Energy Planning Database (REPD) Grid Atlas v6 Page (stylesheet), loaded by GlobalGrid2050 — Renewable Energy Planning Database (REPD) Grid Atlas v7 Page (stylesheet), loaded by GlobalGrid2050 — Renewable Energy Planning Database (REPD) Grid Atlas v8 Page (stylesheet), loaded by Releases — Atlas V9 Page (stylesheet)
Produces
none declared
Defines here
none
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 repd_grid_atlasv6/ventusv6.css:1-157 · blob 29a2edb490407f489c29433d84e329b1038e0657 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
html, body { margin: 0; padding: 0; width: 100%; height: 100%; background: #000; font-family: 'Courier New', monospace; color: white; overflow: hidden; }
.dashboard { display: flex; flex-direction: column; height: 100vh; height: 100dvh; width: 100vw; padding: 4px; gap: 4px; box-sizing: border-box; }
#fatal-banner { display: none; position: fixed; top: 0; left: 0; width: 100%; background: #ff0000; color: #fff; text-align: center; padding: 10px; font-weight: bold; z-index: 9999; text-transform: uppercase; font-size: 12px; letter-spacing: 1px; }
.hud-header { background: #0a0a0a; border: 1px solid #333; border-radius: 6px; padding: 6px 12px; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
.hud-val { font-size: 16px; font-weight: bold; color: #00ffff; text-shadow: 0 0 5px #00ffff; }
.ventus-brand { text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.2; }
.ventus-main { font-family: -apple-system, sans-serif; font-size: 17px; font-weight: 800; color: #fff; letter-spacing: 5px; text-transform: uppercase; margin-bottom: 2px; }
.ventus-sub { font-family: -apple-system, sans-serif; font-size: 6.5px; color: #888; letter-spacing: 2px; text-transform: uppercase; }
.map-container { position: relative; flex-grow: 1; min-height: 0; border: 1px solid #222; border-radius: 6px; overflow: hidden; background: #0b0e14; }
#map { width: 100%; height: 100%; }
.podcast-shoutout { position: absolute; bottom: 6px; right: 8px; font-family: -apple-system, sans-serif; font-size: 8px; color: #fff; opacity: 0.5; text-align: right; text-transform: uppercase; letter-spacing: 1px; pointer-events: none; z-index: 10; text-shadow: 1px 1px 2px #000; }
.scada-wrapper { background: #050505; border: 1px solid #444; border-radius: 6px; padding: 12px; display: flex; flex-direction: column; flex-shrink: 0; max-height: 38vh; }
.scada-brand { display: flex; align-items: center; gap: 8px; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid #222; flex-shrink: 0; }
.scada-brand-main { font-family: -apple-system, sans-serif; font-size: 11px; font-weight: 800; color: #fff; letter-spacing: 4px; text-transform: uppercase; }
.scada-brand-sub { font-family: -apple-system, sans-serif; font-size: 6px; color: #555; letter-spacing: 2px; text-transform: uppercase; }
.scada-brand-tag { margin-left: auto; font-family: 'Courier New', monospace; font-size: 7px; color: #333; text-transform: uppercase; letter-spacing: 1px; }
.scada-keys { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; overflow-y: auto; padding-bottom: 5px; }
.key-group { border-left: 2px solid #333; padding-left: 10px; margin-bottom: 4px; }
.key-title { font-size: 10px; color: #66ccff; text-transform: uppercase; margin-bottom: 6px; font-weight: bold; }
.key-item { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 8px; cursor: pointer; }
input[type="checkbox"], input[type="radio"] { transform: scale(1.3); margin-right: 4px; accent-color: #00ffff; }
.maplibregl-popup-content { background: #000; color: #00ffff; border: 1px solid #444; font-family: monospace; font-size: 12px; padding: 8px; }

/* LCP fix: disclaimer box is the largest paint element — push it off the critical path */
.disclaimer-box { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; text-align: justify; font-size: 9px; line-height: 1.5; color: #666; margin-top: 10px; padding-top: 10px; border-top: 1px solid #222; user-select: none; pointer-events: none; flex-shrink: 0; content-visibility: auto; }

.custom-map-attrib { position: absolute; top: 10px; left: 10px; background: rgba(5, 5, 5, 0.7); color: #888; font-family: 'Courier New', monospace; font-size: 9px; border-radius: 4px; padding: 4px 8px; z-index: 10; border: 1px solid #333; pointer-events: auto; max-width: calc(100% - 60px); line-height: 1.6; }
.custom-map-attrib a { color: #00ffff; text-decoration: none; }
.custom-map-attrib a:hover { text-decoration: underline; }
body.fs-active .custom-map-attrib { top: 44px; }
.popup-search-btns { display: flex; gap: 6px; margin-top: 8px; }
.popup-btn { flex: 1; padding: 5px 0; font-family: monospace; font-size: 11px; font-weight: bold; border: 1px solid #444; border-radius: 3px; cursor: pointer; text-align: center; text-decoration: none; display: block; transition: border-color 0.15s, color 0.15s; }
.popup-btn-news { background: #0a0a0a; color: #ffae00; border-color: #ffae00; }
.popup-btn-news:hover { background: #ffae00; color: #000; }
.popup-btn-images { background: #0a0a0a; color: #00ffff; border-color: #00ffff; }
.popup-btn-images:hover { background: #00ffff; color: #000; }
.search-bar-wrapper { position: absolute; top: 72px; right: 10px; z-index: 20; display: flex; gap: 6px; }
body.fs-active .search-bar-wrapper { top: 100px; }
.search-input { background: rgba(5,5,5,0.85); border: 1px solid #444; border-radius: 4px; color: #00ffff; font-family: 'Courier New', monospace; font-size: 11px; padding: 5px 10px; width: 220px; outline: none; }
.search-input::placeholder { color: #444; }
.search-input:focus { border-color: #00ffff; }
.search-btn { background: #0a0a0a; border: 1px solid #00ffff; border-radius: 4px; color: #00ffff; font-family: 'Courier New', monospace; font-size: 11px; padding: 5px 10px; cursor: pointer; }
.search-btn:hover { background: #00ffff; color: #000; }
.search-results { position: absolute; top: 36px; right: 0; background: #050505; border: 1px solid #333; border-radius: 4px; width: 300px; max-height: 220px; overflow-y: auto; z-index: 21; display: none; }
.search-result-item { padding: 7px 10px; font-family: 'Courier New', monospace; font-size: 10px; color: #888; cursor: pointer; border-bottom: 1px solid #111; line-height: 1.5; }
.search-result-item:hover { background: #111; color: #00ffff; }
.search-result-item b { color: #ffcc00; }
.search-no-results { padding: 8px 10px; font-family: 'Courier New', monospace; font-size: 10px; color: #444; }
.map-controls { position: absolute; bottom: 30px; left: 10px; z-index: 20; display: flex; flex-direction: column; gap: 4px; }
.map-ctrl-btn { background: rgba(5,5,5,0.85); border: 1px solid #333; border-radius: 4px; color: #888; font-family: 'Courier New', monospace; font-size: 9px; padding: 5px 8px; cursor: pointer; text-transform: uppercase; letter-spacing: 1px; white-space: nowrap; }
.map-ctrl-btn:hover { border-color: #00ffff; color: #00ffff; }
.map-ctrl-btn.active { border-color: #00ffff; color: #00ffff; background: rgba(0,255,255,0.08); }

/* Radius area popup — stacked above radius search popup */
#radius-area-popup { bottom: 60px; }

/* Poly Zone panel — stacked above radius area popup, orange accent */
#polyzone-panel { bottom: 90px; border-color: #ff6600; }
.polyzone-label { color: #ff6600 !important; }

/* Radius search popup base */
.radius-popup { position: absolute; bottom: 30px; left: 120px; z-index: 20; background: #050505; border: 1px solid #444; border-radius: 4px; padding: 8px 12px; display: none; }
.radius-popup label { font-size: 9px; color: #888; text-transform: uppercase; letter-spacing: 1px; display: block; margin-bottom: 4px; }
.radius-input-row { display: flex; align-items: center; gap: 4px; }
#radius-input { background: #0a0a0a; border: 1px solid #333; color: #00ffff; font-family: 'Courier New', monospace; font-size: 12px; font-weight: bold; padding: 3px 6px; border-radius: 3px; width: 56px; outline: none; text-align: right; -moz-appearance: textfield; }
#radius-input::-webkit-outer-spin-button, #radius-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
#radius-input:focus { border-color: #00ffff; }
#radius-input.invalid { border-color: #ff4444; color: #ff4444; }

/* Radius area input — matches radius-input style, magenta accent */
#radius-area-input { background: #0a0a0a; border: 1px solid #333; color: #ff00ff; font-family: 'Courier New', monospace; font-size: 12px; font-weight: bold; padding: 3px 6px; border-radius: 3px; width: 72px; outline: none; text-align: right; -moz-appearance: textfield; }
#radius-area-input::-webkit-outer-spin-button, #radius-area-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
#radius-area-input:focus { border-color: #ff00ff; }
#radius-area-input.invalid { border-color: #ff4444; color: #ff4444; }

.radius-unit { font-size: 10px; color: #555; font-family: 'Courier New', monospace; white-space: nowrap; }
.radius-hint { font-size: 8px; color: #444; margin-top: 4px; letter-spacing: 0.5px; }

/* Measure display panel */
#measure-display { position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); z-index: 20; background: rgba(5,5,5,0.92); border: 1px solid #00ffff; border-radius: 4px; padding: 8px 14px; display: none; font-family: 'Courier New', monospace; font-size: 10px; color: #00ffff; text-align: center; white-space: nowrap; pointer-events: none; max-width: calc(100vw - 40px); box-sizing: borde  … [line shortened here: 408 characters; full line on GitHub]
@media (max-width: 480px) {
    #measure-display { white-space: normal; font-size: 9px; }
}
#measure-display .m-row { margin-bottom: 2px; color: #888; }
#measure-display .m-row span { color: #00ffff; }
#measure-display .m-hint { font-size: 8px; color: #444; margin-top: 4px; }
#btn-measure-undo { pointer-events: auto; background: #0a0a0a; border: 1px solid #555; border-radius: 3px; color: #888; font-family: 'Courier New', monospace; font-size: 8px; padding: 2px 6px; cursor: pointer; margin-top: 5px; text-transform: uppercase; letter-spacing: 1px; display: none; }
#btn-measure-undo:hover { border-color: #ffff00; color: #ffff00; }

/* Poly Zone display panel — orange accent, mirrors measure-display */
#polyzone-display { position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); z-index: 20; background: rgba(5,5,5,0.92); border: 1px solid #ff6600; border-radius: 4px; padding: 8px 14px; display: none; font-family: 'Courier New', monospace; font-size: 10px; color: #ff6600; text-align: center; white-space: nowrap; pointer-events: none; max-width: calc(100vw - 40px); box-sizing: bord  … [line shortened here: 409 characters; full line on GitHub]
#polyzone-display .m-row { margin-bottom: 2px; color: #888; }
#polyzone-display .m-row span { color: #ff6600; }
#polyzone-display .m-hint { font-size: 8px; color: #444; margin-top: 4px; }
#btn-polyzone-undo { pointer-events: auto; background: #0a0a0a; border: 1px solid #555; border-radius: 3px; color: #888; font-family: 'Courier New', monospace; font-size: 8px; padding: 2px 6px; cursor: pointer; margin-top: 5px; text-transform: uppercase; letter-spacing: 1px; display: none; }
#btn-polyzone-undo:hover { border-color: #ff6600; color: #ff6600; }
#btn-polyzone-undo:focus-visible { outline: 1px solid #ff6600; outline-offset: 2px; }
@media (max-width: 480px) {
    #polyzone-display { white-space: normal; font-size: 9px; }
}

/* Fullscreen letterhead */
#fs-letterhead { display: none; position: fixed; top: 8px; right: 12px; z-index: 512; text-align: right; pointer-events: none; }
#fs-letterhead .ventus-main { font-family: -apple-system, sans-serif; font-size: 15px; font-weight: 800; color: #fff; letter-spacing: 5px; text-transform: uppercase; margin-bottom: 1px; }
#fs-letterhead .ventus-sub { font-family: -apple-system, sans-serif; font-size: 6px; color: #888; letter-spacing: 2px; text-transform: uppercase; }
body.fs-active #fs-letterhead { display: block; }

/* Status legend */
.status-legend { display: flex; gap: 8px; flex-wrap: wrap; padding: 4px 0 6px 0; border-bottom: 1px solid #222; margin-bottom: 6px; flex-shrink: 0; }
.status-dot { display: inline-flex; align-items: center; gap: 4px; font-size: 8px; color: #555; }
.status-dot span { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }

/* Fullscreen map */
.map-container.is-fullscreen { position: fixed; top: 0; left: 0; width: 100vw; height: 100dvh; border-radius: 0; border: none; z-index: 500; }
#btn-fullscreen { position: absolute; top: 10px; right: 10px; z-index: 25; background: rgba(5,5,5,0.85); border: 1px solid #333; border-radius: 4px; color: #888; font-family: 'Courier New', monospace; font-size: 11px; padding: 5px 8px; cursor: pointer; letter-spacing: 1px; line-height: 1; }
#btn-fullscreen:hover { border-color: #00ffff; color: #00ffff; }
#btn-fullscreen-exit { display: none; position: fixed; top: 8px; left: 12px; z-index: 510; background: rgba(5,5,5,0.9); border: 1px solid #00ffff; border-radius: 4px; color: #00ffff; font-family: 'Courier New', monospace; font-size: 10px; padding: 5px 10px; cursor: pointer; letter-spacing: 1px; }
body.fs-active #btn-fullscreen-exit { display: block; }

/* Fullscreen curtain (layer panel slide-down) */
#fs-curtain { display: none; position: fixed; top: 0; left: 0; width: 100vw; z-index: 505; background: rgba(5, 5, 5, 0.96); border-bottom: 1px solid #333; transform: translateY(-100%); transition: transform 0.3s ease; max-height: 70dvh; overflow-y: auto; padding: 48px 16px 16px 16px; box-sizing: border-box; }
#fs-curtain.curtain-open { transform: translateY(0); }
body.fs-active #fs-curtain { display: block; }
#fs-curtain-tab { display: none; position: fixed; top: 0; left: 50%; transform: translateX(-50%); z-index: 510; background: rgba(5,5,5,0.9); border: 1px solid #333; border-top: none; border-radius: 0 0 6px 6px; color: #555; font-family: 'Courier New', monospace; font-size: 9px; padding: 4px 16px 5px 16px; cursor: pointer; letter-spacing: 1px; text-transform: uppercase; white-space: nowrap; transit  … [line shortened here: 439 characters; full line on GitHub]
#fs-curtain-tab:hover { color: #00ffff; border-color: #00ffff; }
body.fs-active #fs-curtain-tab { display: block; }
#fs-curtain-keys { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }

/* Responsive: single column on very narrow screens (iPhone SE etc.) */
@media (max-width: 480px) {
    .scada-keys, #fs-curtain-keys { grid-template-columns: 1fr; }
}

/* Custom scrollbars — prevents jarring default grey on dark SCADA theme */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #050505; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #00ffff; }

/* Firefox scrollbar */
* { scrollbar-width: thin; scrollbar-color: #333 #050505; }

/* Focus-visible states — keyboard accessibility without affecting mouse users */
.map-ctrl-btn:focus-visible,
.search-btn:focus-visible,
#btn-fullscreen:focus-visible,
#btn-fullscreen-exit:focus-visible,
#btn-measure-undo:focus-visible { outline: 1px solid #00ffff; outline-offset: 2px; }

/* Short viewport — landscape mobile or compact laptop screens */
@media (max-height: 600px) {
    .scada-wrapper { max-height: 28vh; }
    .hud-header { padding: 3px 10px; }
    .hud-val { font-size: 13px; }
    .ventus-main { font-size: 13px; }
    .key-item { margin-bottom: 4px; font-size: 11px; }
}