/* Watts Up live: the old site's Watts Up page (themisto-www/watts-up), restyled in Zenith. Its own styles
   are kept as they were, and every rule here is nested under the page's <main> so none of it reaches another
   page once this sheet is loaded (site.js keeps stylesheets as pages change). Builds on site.css. */

@keyframes bolt-outline-zap {
  0%, 78% { stroke-dashoffset: 14; opacity: 0; }
  80% { stroke-dashoffset: 14; opacity: 1; }
  97% { stroke-dashoffset: -100; opacity: 1; }
  100% { stroke-dashoffset: -100; opacity: 0; }
}
@keyframes mix-flow-sweep { from { stroke-dashoffset: 0; } to { stroke-dashoffset: -50; } }

main[data-page="watts-live"] {
  /* ---- The page's old token names, pointed at the site's tokens (site.css). Note --muted here is a text
     colour, as on the old page; for shadcn's muted background use --sunken. ---- */
  & {
    --text: var(--ink); --text-2: var(--ink-2); --muted: var(--ink-2);
    --accent: #c2660c; --accent-soft: rgba(27,27,31,.07);
    --glass-strong: var(--glass); --line-strong: rgba(0,0,0,.24);
    --panel: rgba(255,255,255,.78);
    /* Halo Cards signal colours, as its Agile and Solar cards */
    --ok: #1f9d63; --warn: #d89a1b; --bad: #d6453d; --idle: #8a8f9b; --info: #2f86cf;
    --solar: #c28a0c; --battery: #1f9d63; --grid: #8a5cf6;
    --chart-line: #2f7bff; --chart-gen: #8a5cf6;
    --radius: 16px;
    --font-display: var(--title-font);
    --font-body: var(--font-sans);
    --font-mono: var(--mono);
  }

  /* ---- Head card: where it was (it holds every panel), now the site's hero with the Watts Up bloom ---- */
  .top-card { position: relative; overflow: hidden; border-radius: 14px; background: var(--surface); box-shadow: var(--card-ring); }
  .top-card > :not(.bloom, .grain, .inner-shadow) { position: relative; }
  .hero { display: flex; flex-direction: column; align-items: center; text-align: center; padding: clamp(28px, 5vw, 64px) clamp(14px, 3vw, 40px) 48px; }
  /* The app icon comes in a light and a dark version */
  .hero-icon > img.only-dark { display: none; }

  /* ---- Type ---- */
  .t-page, .t-section, .t-card { font-family: var(--font-display); font-weight: 600; }
  .t-page { margin: 0; font-size: clamp(44px, 7vw, 76px); line-height: 1; letter-spacing: -0.045em; }
  /* Panel titles and readings take the Halo Cards card type */
  .t-card { margin: 0; font-family: var(--font-body); font-weight: 500; text-transform: none; font-size: 16px; line-height: 22px; }
  .t-section { font-family: var(--font-body); font-weight: 600; text-transform: none; font-size: 30px; line-height: 34px; letter-spacing: -.04em; }
  .fig { text-transform: none; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .label { font-family: var(--font-body); font-size: 12px; line-height: 16px; font-weight: 500; color: var(--ink-2); }
  .label strong { color: var(--ink); font-weight: 600; }

  /* ---- Pills, chips, tips. The panels' .pill is a chip, not the nav's pill (site.css), so it resets that. ---- */
  .dot, .pill > i { --k-dot: var(--k, var(--idle)); width: 7px; height: 7px; flex-shrink: 0; border-radius: 50%; background: var(--k-dot); }
  .pill { --k: var(--idle); display: inline-flex; align-items: center; justify-content: flex-start; gap: 6px; min-height: 0; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); box-shadow: none; font-size: 12px; font-weight: 500; line-height: 16px; color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; cursor: default; }
  .pill svg { width: 13px; height: 13px; flex: none; color: var(--k); }
  .hero-pill { --k: var(--idle); display: inline-flex; align-items: center; gap: 10px; max-width: 100%; min-height: 36px; padding: 6px 14px 6px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--pg); font-size: 14px; font-weight: 500; line-height: 1.35; color: var(--ink); text-align: left; }
  .hero-pill > i { width: 8px; height: 8px; flex-shrink: 0; border-radius: 50%; background: var(--k); }
  .hero-pill .hero-pill-score { display: inline-grid; place-items: center; min-width: 36px; height: 24px; padding: 0 8px; margin-left: -4px; border-radius: 6px; background: var(--k); color: #fff; font: 600 12px/1 var(--mono); }
  .hero-pill .hero-pill-score + span { margin-left: -2px; }
  [data-signal="ok"] { --k: var(--ok); } [data-signal="warn"] { --k: var(--warn); } [data-signal="bad"] { --k: var(--bad); }
  [data-signal="info"] { --k: var(--info); } [data-signal="idle"] { --k: var(--idle); } [data-signal="accent"] { --k: var(--accent); }
  .has-tip { position: relative; cursor: help; }
  .tip {
    position: absolute; bottom: calc(100% + 10px); left: 50%; width: max-content; max-width: min(240px, calc(100vw - 48px));
    padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--sheet);
    -webkit-backdrop-filter: blur(18px) saturate(1.5); backdrop-filter: blur(18px) saturate(1.5); box-shadow: var(--shadow);
    font-family: var(--font-body); font-size: 12px; font-weight: 400; line-height: 1.5; color: var(--ink); text-align: left; white-space: normal;
    opacity: 0; visibility: hidden; pointer-events: none; transform: translate(-50%, 6px); transition: opacity .18s ease, transform .18s ease, visibility .18s; z-index: 20;
  }
  .tip a { color: var(--ink); text-decoration-color: var(--wu1); text-decoration-thickness: 2px; text-underline-offset: 2px; }
  .tip.right { left: auto; right: 0; transform: translate(0, 6px); }
  @media (hover: hover) and (pointer: fine) {
    .has-tip:hover > .tip { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
    .has-tip:hover > .tip.right { transform: translate(0, 0); }
  }
  .has-tip.tip-open > .tip { opacity: 1; visibility: visible; pointer-events: auto; transform: translate(-50%, 0); }
  .has-tip.tip-open > .tip.right { transform: translate(0, 0); }

  /* ---- Panels: the site's cards (shadcn's Card), inside the head card ---- */
  .panel { min-width: 0; padding: 16px; border-radius: 14px; border: 0; background: var(--surface); box-shadow: var(--card-ring); }
  .panel.compact { padding: 10px 12px; border-radius: 10px; background: var(--sunken); box-shadow: none; }

  /* ---- Charts: Halo Cards colours (the signal colours above, blue for demand, purple for INDGEN) ---- */
  .chart, .trend, .rates, .day-bars, .comparison-legend { --accent: var(--chart-line); }
  #dfGenLine { stroke: var(--chart-gen); }
  .comparison-legend .indgen-key { border-color: var(--chart-gen); }

  /* ---- Controls ---- */
  /* shadcn's tabs */
  .segmented { display: inline-flex; padding: 3px; border-radius: 10px; border: 0; background: var(--sunken); box-shadow: none; }
  .segmented button { display: inline-flex; align-items: center; justify-content: center; min-height: 30px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-2); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; transition: background .2s, color .2s; }
  .segmented button[aria-pressed="true"] { background: var(--pg); color: var(--ink); box-shadow: var(--press); }
  .btn-soft { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--pg); color: var(--ink); box-shadow: var(--press); text-decoration: none; font-size: 14px; font-weight: 500; }

  /* ===== The page's own styles, as they were on the old site ===== */
  /* Same hero card as the home page, with every panel on this page inside it. */
  .hero { padding-bottom: 48px; }

  .hero-icon { position: relative; display: block; flex: none; width: 88px; height: 88px; margin-bottom: 1.25rem; filter: drop-shadow(0 8px 24px rgba(245, 158, 11, 0.25)); }
  .hero-icon > img { display: block; width: 100%; height: 100%; }
  .bolt-zap { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
  .bolt-zap path {
    fill: none;
    stroke: #fffbe0;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 14 100;
    stroke-dashoffset: 14;
    opacity: 0;
    filter: drop-shadow(0 0 3px #fff6b0) drop-shadow(0 0 7px #ffbf00);
    animation: bolt-outline-zap 5s linear infinite;
  }
  /* A short travelling spark, followed by a quiet interval; no full-logo flash. */



  /* ---------- Verdict chip: is now a good time to use energy? ---------- */
  /* align-items: stretch (not center) so the toggle matches the chip's actual rendered height
     instead of a guessed padding/font-size combination that would drift out of sync if either
     one's content ever changes. */
  .hero-controls { display: flex; flex-wrap: wrap; align-items: stretch; justify-content: center; gap: 0.6rem; margin-top: 1.25rem; }

  .verdict > .tip { bottom: auto; top: calc(100% + 10px); width: max-content; max-width: 260px; text-align: left; line-height: 1.7; }

  /* Verdict score on the signal scale */
  .hero-pill[data-score] { --k: var(--idle); }
  .hero-pill[data-score="3"], .hero-pill[data-score="2"] { --k: var(--ok); }
  .hero-pill[data-score="1"] { --k: var(--warn); }
  .hero-pill[data-score="0"] { --k: var(--bad); }

  /* Keep data-ready charts hidden until their first reveal; cards are always visible. */
  .chart-entrance-pending { opacity: 0; }
  @media (prefers-reduced-motion: reduce) {
    .chart-entrance-pending { opacity: 1; }
  }

  /* Link to the about page, under the panels */

  /* ---------- Panels ---------- */
  .panels {
    width: 100%;
    max-width: 1060px;
    margin-top: 2.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    text-align: left;
  }

  /* Not glass: glass inside the glass hero loses its blur. The near-solid reading surface (as
     on the article pages) keeps the aurora from showing through behind the numbers and charts. */
  .panels > .panel { display: flex; flex-direction: column; padding: 1.1rem; }

  .panel-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
  .panel-head-right { display: flex; align-items: center; gap: 0.5rem; }

  /* The (i) in each panel's top right; its tip opens below so it stays inside the hero. */
  .info { display: grid; place-items: center; width: 26px; height: 26px; margin: -3px -5px 0 0; border-radius: 50%; color: var(--muted); }
  .info:hover, .info.tip-open { color: var(--text); }
  .info svg { width: 17px; height: 17px; }
  .info > .tip { bottom: auto; top: calc(100% + 8px); width: max-content; max-width: 220px; }

  .panel-foot {
    margin-top: auto;
    padding-top: 1rem;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--muted);
  }

  .mini-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; margin-bottom: 0.45rem; }


  .is-loading .reading, .is-loading .trend { opacity: 0.35; }
  .reading, .trend { transition: opacity 0.375s ease; }

  /* ---------- Carbon intensity ---------- */
  .reading { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 0.75rem; margin-top: 1.1rem; }

  /* Readings are section-title figures (.t-section .fig) */
  .reading-value { line-height: 1; }

  .reading-value .unit { font-family: var(--font-mono); font-size: 0.75rem; font-weight: 700; margin-left: 0.2rem; }

  .reading-unit { margin-top: 0.4rem; font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); }



  /* NESO's five bands on the three signal colours */
  [data-index="very low"], [data-index="low"] { --level: var(--ok); }
  [data-index="moderate"] { --level: var(--warn); }
  [data-index="high"], [data-index="very high"] { --level: var(--bad); }
  .pill[data-index] { --k: var(--level, var(--idle)); text-transform: capitalize; }

  .trend { margin-top: 1.25rem; }
  .trend[hidden] { display: none; }
  .trend svg { display: block; width: 100%; height: 56px; overflow: visible; }
  .trend-line { fill: none; stroke: var(--level, var(--accent)); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
  #dfGenLine { stroke: #8b5cf6; stroke-dasharray: 5 4; }
  .comparison-legend { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; margin-top: 0.65rem; font-family: var(--font-mono); font-size: 0.68rem; color: var(--text-2); }
  .comparison-legend > span { display: inline-flex; align-items: center; gap: 0.35rem; }
  .comparison-legend i { width: 15px; border-top: 2px solid var(--accent); }
  .comparison-legend .indgen-key { border-color: #8b5cf6; border-top-style: dashed; }
  .comparison-legend strong { color: var(--text); font-weight: 600; }

  .trend-area { fill: color-mix(in srgb, var(--level, var(--accent)) 14%, transparent); stroke: none; }
  .trend-foot { display: flex; justify-content: space-between; margin-top: 0.3rem; font-family: var(--font-mono); font-size: 0.64rem; color: var(--muted); }

  /* ---------- Chart readout: hover (or tap) a chart and the big number shows that point ---------- */
  .chart { position: relative; touch-action: pan-y; cursor: crosshair; }

  .chart-dot[hidden], .chart-guide[hidden] { display: none; }

  .chart-dot {
    position: absolute;
    width: 9px;
    height: 9px;
    margin: -4.5px 0 0 -4.5px;
    border-radius: 50%;
    border: 2px solid var(--tip-bg);
    background: var(--level, var(--accent));
    pointer-events: none;
  }

  .chart-guide { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line-strong); pointer-events: none; }

  /* While a bar is picked out, the rest fade back */
  .chart.is-picking .day-bar span, .chart.is-picking rect { opacity: 0.4; }
  .chart.is-picking .day-bar.picked span, .chart.is-picking rect.picked { opacity: 1; }

  /* ---------- Home solar ---------- */


  .days { margin-top: 1.25rem; }

  .day-bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; height: 92px; }
  .day-bar { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
  .day-bar span {
    display: block;
    min-height: 3px;
    border-radius: 5px 5px 2px 2px;
    background: color-mix(in srgb, var(--solar) 55%, transparent);
    transition: height 0.75s ease;
  }
  .day-bar.today span { background: var(--solar); }

  .day-labels { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 0.35rem; text-align: center; font-family: var(--font-mono); font-size: 0.64rem; color: var(--muted); }
  .day-labels .today { color: var(--text); font-weight: 600; }

  .is-loading .days { opacity: 0.35; }
  .days { transition: opacity 0.375s ease; }

  /* ---------- Agile pricing and slot charts ---------- */
  .rates { margin-top: 1.25rem; }
  .rates[hidden] { display: none; }
  .rates svg { display: block; width: 100%; height: 72px; overflow: visible; }
  .rates .zero { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
  .rates rect.now { stroke: var(--text); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
  .rates .solar-slot { fill:var(--solar); }
  .rates .solar-slot.zero { opacity:.28; }

  /* Price bands, p/kWh: paid to use (plunge), cheap, middling, peak */
  .band-plunge { fill: var(--info); }
  .band-cheap  { fill: var(--ok); }
  .band-mid    { fill: var(--warn); }
  .band-peak   { fill: var(--bad); }

  .is-loading .rates { opacity: 0.35; }
  .rates { transition: opacity 0.375s ease; }

  @media (max-width: 600px) {
    .hero { padding: 100px 12px 16px; }
    .hero-icon { width: 72px; height: 72px; }
    .panels { grid-template-columns: minmax(0, 1fr); margin-top: 2rem; }
  }

  @media (prefers-reduced-motion: reduce) {
    .reading, .trend, .days, .day-bar span, .rates { transition: none; }
    .mix-map svg .sweep { animation: none; display: none; }
    .bolt-zap path { animation: none; display: none; }
  }

  /* ---------- Grid mix (ported from Mission Control) ---------- */
  /* Darker base line / chip identity vs. a distinctly lighter sweep pulse, per flow direction —
     single source of truth for the chip colour, the cable line, the sweep, and the legend dots
     below, so all four always agree. */
  & { --flow-in: #047857; --flow-in-light: #6ee7b7; --flow-out: #0369a1; --flow-out-light: #7dd3fc; }


  /* Fills whatever width the panel actually renders at (fluid, like the rest of the card), capped
     so it doesn't sprawl on a lone wide column, floored at 250px so it never gets narrower than
     what's actually been checked for chip overlap.
     250px specifically: .panels is `grid-template-columns: repeat(auto-fill, minmax(300px,
     1fr))`, which packs in as many 300px+ columns as fit — so a .panel's rendered width sits
     right at that 300px floor whenever an extra column just barely fits, on desktop as much as
     mobile (this isn't a screen-width problem, a wide viewport can still produce a tight column).
     .panel's own padding (1.25rem = 20px a side) eats 40px of that, so 260px is the hard
     guaranteed minimum content width available, from the grid's own CSS — meaning `width: 100%`
     can never actually go below 260px, and min-width here is a small margin under that, not the
     thing doing the work. Below even that (shouldn't happen, but just in case), the wrapper
     scrolls horizontally rather than the map re-shrinking and risking chip overlap. */
  .interconnector-totals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }

  .mix-map-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 1rem; }
  .mix-map { width: 100%; max-width: 450px; min-width: 250px; margin: 0 auto; overflow: hidden; }
  .mix-map-stage { position: relative; }
  .mix-map svg { display: block; width: 100%; height: auto; aspect-ratio: 480 / 527; overflow: visible; }
  .mix-map svg .track { fill: none; stroke: var(--line); stroke-width: 1.6; }
  .mix-map svg .live { fill: none; stroke: var(--c); stroke-width: 3.4; stroke-linecap: round; opacity: 0.9; }
  .mix-map svg .sweep { fill: none; stroke: var(--c-light); stroke-width: 3.4; stroke-linecap: round; stroke-dasharray: 16 34; filter: drop-shadow(0 0 5px var(--c-light)); animation: mix-flow-sweep var(--dur, 2s) linear infinite; }

  .map-land path { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
  .map-land-home path { fill: color-mix(in srgb, var(--text) 11%, transparent); }
  .map-land-neighbour path { fill: color-mix(in srgb, var(--text) 4%, transparent); }
  .ic-dot { fill: var(--text-2); }
  .ic-dot-far { fill: var(--muted); }
  /* Map labels are the shared .pill, kept small: their anchors are fixed points on the map */
  .pill.mix-ic-chip { font-weight: 500; letter-spacing: -0.01em; }
  /* --lx/--ly are in the *original* 500x527 geography (IC_GEO is untouched) — % multipliers
     convert to the cropped 480x527 viewBox (see svg viewBox + aspect-ratio above): x is
     * (100/480), not * (100/500), so the same gb/far/label numbers land correctly on the
     narrower, more zoomed-in canvas. 480, not a tighter crop like 460: NOR and DEN sit close to
     this edge already, and DEN is centre-aligned (its pill extends past its point both ways) —
     460 left too little margin for either at the narrow end of .mix-map's responsive range,
     clipped by this element's own overflow:hidden regardless of room in the card around it. */
  .mix-ic-chip { position: absolute; z-index: 1; display: inline-flex; align-items: center; left: calc(var(--lx) * 0.20833%); top: calc(var(--ly) * 0.18975%); font-size: 0.625rem; padding: 0.12rem 0.34rem; gap: 0.22rem; line-height: 1.25; white-space: nowrap; transform: translateY(-50%); background: color-mix(in srgb, var(--k) 20%, var(--glass-read)); border: 1px solid color-mix(in srgb, var(--k) 55%, var(--line)); box-shadow: 0 1px 3px rgba(0,0,0,0.15); }
  .mix-ic-chip[data-align="end"] { transform: translate(-100%, -50%); }
  .mix-ic-chip[data-align="centre"] { transform: translate(-50%, -50%); }
  .mix-ic-chip i { width: 5px; height: 5px; border-radius: 50%; background: var(--k); flex: none; }
  .mix-ic-chip b { margin-left: 0.2em; font-weight: 700; }
  .mix-ic-chip .ic-unit { display: none; }
  .mix-map-note { margin: 0.5rem 0 0; font-family: var(--font-mono); font-size: 0.66rem; color: var(--muted); text-align: left; }
  .mix-map-note i { display: inline-block; width: 7px; height: 7px; margin: 0 0.3rem 0 0.1rem; border-radius: 50%; vertical-align: 0.05em; }
  .mix-map-note .key-in { background: var(--flow-in); } .mix-map-note .key-out { background: var(--flow-out); }

  /* ---------- Demand forecast (Today/Tomorrow toggle, ported from Mission Control) ---------- */

  /* ---------- DFS alerts ---------- */
  .dfs-status { display: flex; align-items: center; gap: 0.55rem; margin-top: 1.1rem; padding: 0.65rem 0.9rem; border-radius: var(--radius); border: 1px solid var(--line); background: var(--glass-strong); font-size: 0.85rem; color: var(--muted); }
  .dfs-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--idle); flex: none; }
  .dfs-status.is-active { color: var(--text); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: color-mix(in srgb, var(--accent) 12%, var(--glass-strong)); }
  .dfs-status.is-active .dot { background: var(--accent); }

  .rows { display: grid; gap: 0.5rem; margin-top: 0.7rem; }
  /* .row is a compact .panel */
  .row { display: flex; align-items: center; gap: 0.65rem; }
  .row-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; flex: none; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
  .row-icon svg { width: 15px; height: 15px; }
  .row-text { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
  .row-when { font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted); white-space: nowrap; }
  .row-main { font-size: 0.85rem; color: var(--text); overflow-wrap: anywhere; }
  .row.empty-row { color: var(--muted); font-size: 0.85rem; display: block; }

  .tip a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

  /* ---------- Layout test: system overview cards ---------- */
  #gridMix .interconnector-totals { display: none; }
  .balance-fuel-bar { display:flex; gap:2px; height:8px; margin-top:.5rem; overflow:hidden; border-radius:999px; background:var(--line); }
  .balance-fuel-bar span { min-width:2px; background:var(--fuel); flex:0 0 0%; opacity:0; transform-origin:left center; transition:flex-basis 1.1s cubic-bezier(.22,.61,.36,1), opacity .35s ease; }
  @media (prefers-reduced-motion: reduce) { .balance-fuel-bar span { transition:none; } }
  .balance-source-grid, .balance-connector-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.4rem .6rem; margin-top:.65rem; }
  .balance-demand-grid { display:grid; gap:.4rem; margin-top:.65rem; }
  .balance-source, .balance-connector { display:grid; grid-template-columns:16px minmax(0,1fr) auto; align-items:center; gap:.35rem; min-width:0; font-size:.68rem; color:var(--text-2); }
  .balance-source[hidden] { display:none; }
  .balance-source-icon { width:15px; height:15px; background:var(--fuel); -webkit-mask:var(--source-icon) center/contain no-repeat; mask:var(--source-icon) center/contain no-repeat; }
  .balance-flag { width:17px; height:12px; object-fit:cover; border-radius:2px; border:1px solid color-mix(in srgb,var(--text) 15%,transparent); box-shadow:0 1px 2px rgba(0,0,0,.12); }
  .balance-item-name { min-width:0; overflow-wrap:anywhere; line-height:1.3; }
  .balance-item-value { font-family:var(--font-mono); font-size:.61rem; font-weight:600; color:var(--text); white-space:nowrap; }
  .balance-connector.import .balance-item-value { color:#059669; }
  .balance-connector.export .balance-item-value { color:#0284c7; }
  .balance-empty { grid-column:1/-1; color:var(--muted); font-size:.7rem; }

  /* ===== Meridian changes to the page's own styles, so they come after them ===== */
  /* Units beside a reading: Halo Cards' small unit, not bold mono */
  .reading-value .unit { font-family: var(--font-body); font-size: 13px; font-weight: 500; letter-spacing: 0; color: var(--ink-2); margin-left: 4px; }
}

/* Dark: the same names on the v2 dark tokens */
:root[data-theme="dark"] main[data-page="watts-live"] {
  --accent: #f4a36a; --accent-soft: rgba(236,236,240,.08); --line-strong: rgba(255,255,255,.24);
  --panel: rgba(28,28,31,.72);
  --ok: #4cc9a0; --warn: #f2b84a; --bad: #ff7b72; --idle: #6b7080; --info: #6cc3ec;
  --solar: #f2b84a; --battery: #4cc9a0; --grid: #b79bff;
  --chart-line: #6aa3ff; --chart-gen: #b79bff;

  .hero-icon > img.only-light { display: none; }
  .hero-icon > img.only-dark { display: block; }
}
