/* Fair-Share Building: the page around the 3D picture.
   Design "calm" (chosen from three variants on 2026-11-16), with the judges' grafts from "bold" and "friendly":
   a neutral light surface, hairline borders in place of shadows, the system type stack, compact segmented controls,
   thin line icons (inline SVG in index.html), and the brand accent (--accent, set by app.js from js/brand.js) for the
   chosen state (one solid fill everywhere), focus and the one main button. Colour that teaches stays: each flat's
   colour (tabs, Now rows, pie), each pipe's colour (pipe switches, whole-building rows), each season's colour.
   Nothing dark sits beside the picture; the big numbers are bold on light cards.
   Scale: type 12 / 12.5 / 14 / 16 / 26 px; space 4 / 8 / 12 / 16 px; radius 6 (inner) / 8 (controls) / 12 (cards). */

:root {
  --accent: #0f9fc4;
  --ink: #101828;
  --ink2: #475467;
  --mute: #4f5b6d;          /* 6.6:1 on white: small grey text stays readable */
  --bg: #f3f4f6;
  --card: #ffffff;
  --sunk: #f7f8fa;          /* a field or a track inside a card */
  --line: #e3e6eb;          /* hairline */
  --line2: #d0d5dd;         /* a hairline that has to be seen (fields, switches) */
  --good: #15803d;
  --bad: #c2410c;
  --cw: #2f7df6; --dhw: #e5322d; --hs: #f97a16; --cs: #13b7d6; --gas: #e0a800;
  --ev: #76d000; --ev-d: #3f7a00;  /* the electric cars' charging: the colour of their cables in the picture, and as text on white */
  --run: #d9461f;           /* a running tap: the main button turns this red-orange (white text 4.6:1) */
  --acc-t: color-mix(in srgb, var(--accent) 9%, #fff);      /* accent tint */
  --acc-d: color-mix(in srgb, var(--accent) 78%, #000);     /* accent as text on white */
  --r: 12px;
  --shadow: none;
  --lift: 0 1px 2px rgba(16, 24, 40, 0.06);
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
  font-size: 14px;
  color: var(--ink);
  color-scheme: light;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body { overflow: hidden; }
button, select, input { font: inherit; color: inherit; }
button, select { cursor: pointer; }
.hidden { display: none !important; }
.k { color: var(--mute); font-size: 12.5px; font-weight: 500; }
b { font-variant-numeric: tabular-nums; font-weight: 600; }
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }

#app {
  height: 100vh; height: 100dvh;
  display: grid;
  grid-template-columns: 296px minmax(0, 1fr) 336px;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "top top top" "left stage right";
  gap: 12px; padding: 0 12px 12px;
}
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.col { overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; gap: 10px; scrollbar-width: thin; scrollbar-color: #c8ced8 transparent; min-height: 0; padding: 3px; margin: -3px; }
#left { grid-area: left; }
#right { grid-area: right; }
/* a card's title: small, quiet, with its line icon in the accent */
h2 { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink2); margin: 0 0 12px; }
h2 .i { width: 16px; height: 16px; color: var(--accent); }

/* ---------- header: one white bar with a hairline under it ---------- */
#top { grid-area: top; display: flex; align-items: center; gap: 16px; margin: 0 -12px; padding: 9px 16px; background: var(--card); border-bottom: 1px solid var(--line); min-height: 56px; }
.brand { display: flex; gap: 12px; align-items: center; flex: none; }
.brand img { height: 24px; max-width: 132px; object-fit: contain; }
.brand .brandHome { display: flex; border-radius: 4px; }
.brand .brandHome:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.brand img:not([src]), .brand img[src=""] { display: none; }
.brand img:not([src]) + .bsep, .brand img[src=""] + .bsep { display: none; }
.bsep { width: 1px; height: 24px; background: var(--line); }
.brand h1 { font-size: 16px; margin: 0; font-weight: 650; letter-spacing: -0.01em; line-height: 1.2; }
.brand p { margin: 1px 0 0; font-size: 12px; color: var(--mute); font-weight: 400; }
#tries { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; justify-content: center; }
#tries .lbl { font-size: 11px; font-weight: 600; color: var(--mute); text-transform: uppercase; letter-spacing: .08em; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { white-space: nowrap; border: 1px solid var(--line2); background: var(--card); border-radius: 8px; height: 32px; padding: 0 11px; font-size: 13px; font-weight: 500; color: var(--ink); transition: border-color .15s, background .15s, color .15s; }
.chip:hover { border-color: var(--accent); color: var(--acc-d); background: var(--acc-t); }
.chip:active { background: color-mix(in srgb, var(--accent) 16%, #fff); }
.topbtns { display: flex; gap: 6px; align-items: center; flex: none; }
.ghost { display: inline-flex; align-items: center; gap: 6px; height: 32px; background: var(--card); border: 1px solid var(--line2); border-radius: 8px; padding: 0 11px; font-size: 13px; font-weight: 500; color: var(--ink); }
.ghost:hover { background: var(--sunk); }
.ghost .i { color: var(--ink2); }
.ghost.icon { width: 32px; padding: 0; justify-content: center; }
.langWrap { position: relative; display: inline-flex; align-items: center; height: 32px; border: 1px solid var(--line2); border-radius: 8px; background: var(--card); padding-left: 9px; }
.langWrap:hover { background: var(--sunk); }
/* embedded in a website (?embed=1): the site's header has the logo and the language switch */
.embed .brand > img, .embed .brand > .brandHome, .embed .brand > .bsep, .embed .langWrap { display: none; }
.langWrap .i { color: var(--ink2); width: 16px; height: 16px; pointer-events: none; }
#langSel { appearance: none; -webkit-appearance: none; border: 0; background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23475467' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 9px center; height: 30px; padding: 0 28px 0 6px; font-size: 13px; font-weight: 500; border-radius: 8px; }
.langWrap:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
#langSel:focus-visible { outline: none; }

/* ---------- segmented controls: one sunk track, the chosen part a white chip on it ---------- */
.seasons, .btypes, .unitTabs, .seg3, .storyTabs { display: flex; gap: 2px; background: #eceef2; border-radius: 9px; padding: 3px; }
.seasons button, .btypes button, .unitTabs button, .seg3 button, .storyTabs button { flex: 1 1 0; min-width: 0; border: 0; background: none; border-radius: 6px; color: var(--ink2); font-weight: 500; transition: background .15s, color .15s; }
.seasons button:hover, .btypes button:hover, .unitTabs button:hover, .seg3 button:hover, .storyTabs button:hover { color: var(--ink); background: rgba(255,255,255,.55); }
.seasons button[aria-pressed=true], .btypes button[aria-pressed=true], .unitTabs button[aria-selected=true], .seg3 button[aria-pressed=true], .storyTabs button[aria-selected=true] { background: var(--acc-d); color: #fff; box-shadow: 0 1px 2px rgba(16,24,40,.16); font-weight: 600; }
.seasons button[aria-pressed=true] .i, .btypes button[aria-pressed=true] .i, .seg3 button[aria-pressed=true] .i, .storyTabs button[aria-selected=true] .i { color: #fff; }
.btypes button[aria-pressed=true] small { color: rgba(255,255,255,.85); }
/* each season and building type keeps its own colour on its icon while it is not chosen */
.seasons [data-s=winter] .i { color: #2f7df6; } .seasons [data-s=spring] .i { color: #16a34a; }
.seasons [data-s=summer] .i { color: #e08a00; } .seasons [data-s=autumn] .i { color: #c2410c; }
.btypes [data-b=rad] .i { color: var(--hs); } .btypes [data-b=fc] .i { color: #0e9bb8; }

/* season */
.seasons button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 1px 6px; }
.seasons button .i { width: 20px; height: 20px; }
.seasons button b { font-size: 12px; letter-spacing: -0.01em; font-weight: inherit; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thermo { margin-top: 12px; display: flex; align-items: center; gap: 10px; padding: 10px 2px 0; border-top: 1px solid var(--line); }
.thermo .ti { width: 22px; height: 22px; color: #e5322d; }
.thermo .tbulb { display: none; }
.thermo > div { flex: 1; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.thermo b { font-size: 26px; font-weight: 700; line-height: 1; letter-spacing: -0.01em; }
.clock { margin-top: 10px; display: flex; align-items: center; gap: 8px; }
.mini { border: 1px solid var(--line2); background: #fff; border-radius: 6px; width: 32px; height: 28px; font-weight: 600; }

/* building type */
.btypes button { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 7px; align-items: center; text-align: left; padding: 7px 8px; }
.btypes button .i { grid-row: 1 / 3; width: 20px; height: 20px; }
.btypes button b { font-size: 13px; font-weight: inherit; line-height: 1.2; overflow-wrap: anywhere; hyphens: auto; }
.btypes button small { font-size: 12px; font-weight: 400; color: var(--mute); line-height: 1.25; }

/* rotary knobs: they turn round (app.js makeKnob). A flat white cap with a hairline edge, fine grip ticks round
   it, a thin arc that fills with the value in the knob's colour, and a mark that turns (--a). */
.knob { --a: 0deg; width: 58px; height: 58px; border-radius: 50%; position: relative; touch-action: none; user-select: none;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M19 12a7 7 0 1 1-2.05-4.95' fill='none' stroke='%23fff' stroke-width='4.5' stroke-linecap='round'/%3E%3Cpath d='M20.5 3.5v5h-5z' fill='%23fff' stroke='%23fff' stroke-width='2.5' stroke-linejoin='round'/%3E%3Cpath d='M19 12a7 7 0 1 1-2.05-4.95' fill='none' stroke='%23101828' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M20.5 3.5v5h-5z' fill='%23101828'/%3E%3C/svg%3E") 12 12, grab;
  background:
    radial-gradient(closest-side, #fff 0, #fbfcfd 70%, #d0d5dd 71.5%, transparent 73%),
    repeating-conic-gradient(from var(--a), rgba(16,24,40,.2) 0deg 1.2deg, transparent 1.2deg 15deg),
    radial-gradient(closest-side, #f3f4f6 0, #eef0f3 100%);
  box-shadow: 0 0 0 1px var(--line2), 0 1px 2px rgba(16,24,40,.1); }
.knob::before { content: ""; position: absolute; inset: -8px; border-radius: 50%; background: conic-gradient(from -135deg, var(--k) 0 calc(var(--p) * 270deg), #e3e6eb calc(var(--p) * 270deg) 270deg, transparent 270deg); -webkit-mask: radial-gradient(circle, transparent 34.5px, #000 35px); mask: radial-gradient(circle, transparent 34.5px, #000 35px); }
.knob::after { content: ""; position: absolute; left: calc(50% - 1.5px); top: 7px; width: 3px; height: 14px; border-radius: 2px; background: var(--k); transform-origin: 1.5px 22px; transform: rotate(var(--a)); }
.knob:active { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M19 12a7 7 0 1 1-2.05-4.95' fill='none' stroke='%23fff' stroke-width='4.5' stroke-linecap='round'/%3E%3Cpath d='M20.5 3.5v5h-5z' fill='%23fff' stroke='%23fff' stroke-width='2.5' stroke-linejoin='round'/%3E%3Cpath d='M19 12a7 7 0 1 1-2.05-4.95' fill='none' stroke='%230f9fc4' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M20.5 3.5v5h-5z' fill='%230f9fc4'/%3E%3C/svg%3E") 12 12, grabbing; }
.knob:focus-visible { outline: 2px solid var(--accent); outline-offset: 11px; }
.kval { font-size: 14px; font-weight: 600; margin-top: 4px; }

/* the building's hot-water temperature */
.hotT { margin-top: 12px; display: flex; align-items: center; gap: 18px; padding: 14px 2px 2px 10px; border-top: 1px solid var(--line); }
.hotT .knob, .taps .knob { flex: none; width: 50px; height: 50px; }
.hotT .knob::before, .taps .knob::before { -webkit-mask: radial-gradient(circle, transparent 30.5px, #000 31px); mask: radial-gradient(circle, transparent 30.5px, #000 31px); }
.hotT .knob::after, .taps .knob::after { top: 6px; height: 12px; transform-origin: 1.5px 19px; }
.hotTtxt { min-width: 0; }
.hotTtxt b { display: block; font-size: 22px; font-weight: 700; line-height: 1.15; }
.hotTtxt small { display: block; font-size: 12px; font-weight: 400; color: var(--mute); line-height: 1.35; margin-top: 2px; }
.hotTtxt small.warn { color: var(--bad); font-weight: 600; }
.hotTtxt .hotTGas:not(:empty) { margin-top: 4px; color: var(--ink2); }

/* ---------- the chosen flat ---------- */
.unitTabs { display: flex; margin-bottom: 12px; }
/* each tab: the flat's colour dot (the same colour as its Now row and its pie slice), its name, its family */
.unitTabs button { padding: 5px 0 4px; font-size: 14px; line-height: 1.2; position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.unitTabs button small { font-size: 12px; line-height: 1.1; }
.unitTabs .ul { display: flex; align-items: center; justify-content: center; gap: 5px; padding: 0 3px; overflow-wrap: anywhere; font-weight: 600; }
.unitTabs .ul::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--mute)); }
.unitTabs button[aria-selected=true] .ul::before { box-shadow: 0 0 0 1.5px #fff; }
.unitTabs button.long .ul { font-size: 11.5px; line-height: 1.3; }
.persona { margin-bottom: 12px; display: flex; flex-direction: column; gap: 1px; }
.pname { font-weight: 700; font-size: 16px; overflow-wrap: anywhere; }
.tiles { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.tile { min-width: 0; overflow: hidden; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; transition: background .2s, border-color .2s; }
.tile.wide { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; padding: 8px 10px; }
.tile.wide .tl { flex: 1; text-align: left; }
.tile .ic { line-height: 0; color: var(--ink2); }
.tile .ic .i { width: 22px; height: 22px; }
.tile .tl { font-size: 13px; font-weight: 500; color: var(--ink2); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile.on { background: var(--acc-t); border-color: color-mix(in srgb, var(--accent) 35%, #fff); }
.tile.on .ic { color: var(--acc-d); }
#tileLeak.on { background: #fff6ed; border-color: #f9c79a; }
/* in a season without air con the leak tile is alone on its row: it becomes a wide row, icon, words, switch */
body.noCooling #tileLeak { grid-column: 1 / -1; flex-direction: row; gap: 10px; padding: 8px 10px; }
body.noCooling #tileLeak .tl { flex: 1; text-align: left; font-size: 13px; color: var(--ink); }
body.noCooling #tileLeak .ic .i { width: 20px; height: 20px; }
#tileLeak.on .ic { color: var(--bad); }
/* on / off buttons: a quiet outlined pill; on = filled */
.tog { height: 28px; border: 1px solid var(--line2); border-radius: 999px; padding: 0 12px; font-weight: 500; font-size: 12.5px; background: var(--card); color: var(--ink2); min-width: 80px; transition: background .15s, color .15s, border-color .15s; }
.tog:hover { border-color: var(--ink2); color: var(--ink); }
.tog.on { background: var(--acc-d); border-color: var(--acc-d); color: #fff; font-weight: 600; }
#tileLeak .tog.on { background: var(--bad); border-color: var(--bad); }
.winBtns { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; max-width: 100%; }
.winBtns .tog { flex: 0 0 auto; min-width: 0; height: 26px; padding: 0 8px; font-size: 12px; white-space: nowrap; }
#winCount { font-size: 12px; font-weight: 500; color: var(--mute); line-height: 1.2; }
#winCount.some { color: var(--acc-d); }
.step { display: flex; align-items: center; gap: 4px; border: 1px solid var(--line2); border-radius: 8px; padding: 2px; }
.step button { width: 26px; height: 24px; border: 0; border-radius: 6px; background: var(--sunk); font-size: 16px; font-weight: 500; line-height: 1; }
.step button:hover { background: #eceef2; }
.step b { min-width: 34px; font-size: 14px; }
body.noCooling .coolOnly { display: none; }
#tileHeat .kseason { display: none; font-size: 12px; line-height: 1.25; color: var(--mute); }
body:not(.noCooling) #tileHeat .kseason { display: block; }
body:not(.noCooling) #tileHeat .knob, body:not(.noCooling) #tileHeat .kval { opacity: .45; }

/* the taps tile */
.tile.wide.taps { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px; }
.tile.wide.taps > .tl { text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink2); }
.seg3 { padding: 2px; border-radius: 8px; }
.seg3 button { padding: 4px 6px; font-size: 12px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.seg3 button .i { width: 16px; height: 16px; }
.tile.wide.taps .seg3 button { min-height: 28px; }
/* (the grid must fit the tile, which clips: a knob's ring is 66px wide and may reach 4px past its 58px column
   into the tile's 10px padding, never past the tile's edge; the readout in the middle takes what is left) */
.knobs { display: grid; grid-template-columns: minmax(58px, 1fr) minmax(0, auto) minmax(58px, 1fr); align-items: start; justify-items: center; column-gap: 4px; padding: 10px 0 0; }
.kcol { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.kcol small { font-size: 12px; font-weight: 600; color: var(--ink2); text-align: center; line-height: 1.2; }
.kcol small b { display: block; font-weight: 500; color: var(--mute); white-space: nowrap; font-size: 12px; }
.mix { display: flex; flex-direction: column; align-items: center; line-height: 1.25; min-width: 0; padding: 2px 4px 0; }
.mix b { font-size: 19px; font-weight: 700; white-space: nowrap; }
.mix small { font-size: 12px; font-weight: 500; color: var(--mute); text-align: center; white-space: pre-line; }
.mix span { font-size: 18px; margin-top: 2px; }
.mix.idle { opacity: .5; filter: grayscale(1); }
.unitTabs button, #tapSeg button { position: relative; }
.unitTabs button.run::after, #tapSeg button.run::after { content: ""; position: absolute; top: 4px; right: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--cw); box-shadow: 0 0 0 2px #fff; animation: runDot 1.2s ease-in-out infinite; }
@keyframes runDot { 50% { opacity: .35; } }
.tapusual { font-size: 12px; font-weight: 400; color: var(--mute); text-align: center; line-height: 1.35; min-height: 2.7em; text-wrap: balance; }
.tapusual.soon { color: var(--ink2); }
.tapuse { font-size: 12.5px; font-weight: 400; color: var(--ink2); line-height: 1.3; }
.urow { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 4px 0; border-top: 1px solid var(--line); }
.urow span { min-width: 0; text-align: left; }
.urow b { color: var(--ink); font-weight: 600; text-align: right; white-space: nowrap; }
.urow b small { display: block; font-size: 12px; font-weight: 400; color: var(--mute); }
body.tapSink #showerSeg { display: none; }
/* the one main button of the page: filled with the accent, no gradient */
.big { width: 100%; margin-top: 12px; display: flex; align-items: center; justify-content: center; gap: 8px; height: 42px; border: 1px solid var(--acc-d); border-radius: 9px; font-size: 14px; font-weight: 600; background: var(--acc-d); color: #fff; transition: background .15s, color .15s; }
.big:hover { background: color-mix(in srgb, var(--accent) 62%, #000); }
.big #tapIcon { display: none; }
.big .i { width: 18px; height: 18px; }
.big .i { fill: rgba(255,255,255,.25); }
.big.busy { background: var(--run); border-color: var(--run); color: #fff; }
.big.busy:hover { background: color-mix(in srgb, var(--run) 85%, #000); }
.big.busy .i { fill: #fff; }

/* pipe switches: a list of rows, each with the pipe's colour as a short line and a switch at the end */
.legend h2 { margin-bottom: 8px; }
.ptoggles { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.ptoggles button { position: relative; display: flex; align-items: center; gap: 10px; border: 0; border-top: 1px solid var(--line); background: none; border-radius: 0; padding: 6px 2px; font-size: 13.5px; font-weight: 500; text-align: left; color: var(--mute); }
.ptoggles button:first-child { border-top: 0; }
.ptoggles button span { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: #eceef2; color: #98a2b3; transition: background .2s, color .2s; }
.ptoggles button span .i { width: 16px; height: 16px; }
.ptoggles button i { margin-left: auto; width: 30px; height: 18px; border-radius: 99px; background: #d0d5dd; position: relative; flex: none; transition: background .2s; }
.ptoggles button i::after { content: ""; position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(16,24,40,.2); transition: left .2s; }
.ptoggles button.on { color: var(--ink); }
.ptoggles button.on span { background: color-mix(in srgb, var(--c) 15%, #fff); color: var(--c); }
.ptoggles button.on i { background: var(--accent); }
.ptoggles button.on i::after { left: 14px; }
.legend p { margin: 8px 2px 0; font-size: 12px; color: var(--mute); font-weight: 400; line-height: 1.4; }

/* ---------- the picture and the line under it ---------- */
#stage { grid-area: stage; display: flex; flex-direction: column; gap: 10px; min-height: 0; min-width: 0; padding-top: 0; }
#view3d { position: relative; flex: 1; min-height: 0; border-radius: 12px; overflow: hidden; background: linear-gradient(#a9cbe9, #edf3f9 72%); border: 1px solid var(--line); }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; touch-action: none; }
#view:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
#msg { flex: none; min-height: 46px; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px 10px 44px; font-size: 14px; font-weight: 400; line-height: 1.4; display: flex; align-items: center; position: relative; }
#msg::before { content: ""; position: absolute; left: 14px; top: 50%; width: 20px; height: 20px; margin-top: -10px; background: var(--accent); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5.5M12 7.5h.01'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5.5M12 7.5h.01'/%3E%3C/svg%3E") center / contain no-repeat; }
#msg b { color: var(--acc-d); font-weight: 600; }

/* ---------- the right column ---------- */
#right h2 small { font-size: 12px; font-weight: 600; color: var(--acc-d); background: var(--acc-t); border-radius: 5px; padding: 1px 6px; margin-left: 2px; letter-spacing: 0; text-transform: none; }
#right h3, #allFlats h3 { font-size: 12.5px; font-weight: 600; margin: 0 0 6px; color: var(--ink); }

/* the four flats in one line at the top of the right column, shown while the rows of "Now" are scrolled out of
   sight (app.js renderMini). It takes no room of its own (height 0), so the column does not jump when it shows. */
#nowMini { position: sticky; top: 0; z-index: 4; height: 0; margin-bottom: -10px; }
.nmIn { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; background: var(--card); border: 1px solid var(--line2); border-radius: 10px; padding: 4px; box-shadow: 0 4px 12px rgba(16, 24, 40, .10); opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity .18s, transform .18s, visibility 0s .18s; }
#nowMini.on .nmIn { opacity: 1; visibility: visible; transform: none; transition: opacity .18s, transform .18s; }
.nm { min-width: 0; display: grid; gap: 1px; padding: 4px 3px 4px 8px; border-radius: 7px; cursor: pointer; position: relative; line-height: 1.15; }
.nm::before { content: ""; position: absolute; left: 2px; top: 5px; bottom: 5px; width: 3px; border-radius: 2px; background: var(--c); }
.nm:hover { background: var(--sunk); }
.nm.sel { background: var(--acc-t); box-shadow: inset 0 0 0 1px var(--accent); }
.nmh { display: flex; align-items: center; gap: 3px; min-width: 0; }
.nmh b { min-width: 0; font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nmh span { flex: none; font-size: 10.5px; line-height: 1; }
.nm small { font-size: 11.5px; font-weight: 600; color: color-mix(in srgb, var(--hs) 55%, #000); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nm small.cool { color: color-mix(in srgb, var(--cs) 55%, #000); }
.nm small.w { color: color-mix(in srgb, var(--cw) 70%, #000); }

/* "Now": one row for each flat in a hairline list; the four rows' bars share one scale */
.flats { list-style: none; margin: 0 -6px; padding: 0; display: grid; gap: 2px; }
.flat { width: 100%; display: grid; gap: 4px; text-align: left; border: 1px solid transparent; border-radius: 8px; background: none; padding: 6px 7px 7px 11px; line-height: 1.2; transition: background .15s; position: relative; }
/* the flat's colour as a short straight stripe at the row's left */
.flat::before, .bfig::before { content: ""; position: absolute; left: 3px; top: 6px; bottom: 6px; width: 3px; border-radius: 2px; background: var(--c); }
.flat:hover { background: var(--sunk); }
.flat[aria-pressed=true] { background: var(--acc-t); border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.flat.point:not([aria-pressed=true]) { border-style: dashed; border-color: var(--c); background: color-mix(in srgb, var(--c) 6%, #fff); }
.fhead { display: flex; align-items: center; gap: 7px; min-width: 0; }
.fdot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.fname { min-width: 0; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fmarks { flex: none; display: flex; gap: 3px; font-size: 12px; line-height: 1; }
.ftemp { flex: none; margin-left: auto; font-size: 13px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.fbars { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.fbar { display: flex; align-items: center; gap: 5px; min-width: 0; font-size: 12px; }
.fbar .fic { flex: none; line-height: 1; }
.fbar b { flex: none; min-width: 42px; text-align: right; font-size: 12.5px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.fbar.water b { min-width: 58px; }
.track { flex: 1; min-width: 10px; display: flex; height: 6px; border-radius: 6px; background: #eceef2; overflow: hidden; }
.track i { display: block; height: 100%; width: var(--w, 0%); transition: width .3s; }
.fbar.heat .track .k { background: var(--hs); }
.fbar.heat.cool .track .k { background: var(--cs); }
.fbar.heat .track .h { background: var(--dhw); }
.fbar.water .track .h { background: var(--dhw); }
.fbar.water .track .c { background: var(--cw); }
#hwHow { margin: 8px 0 0; font-size: 12px; }
.fnote { display: none; font-size: 12px; font-weight: 500; color: var(--mute); }
.flat[aria-pressed=true] .fnote:not(:empty) { display: block; }
.bnow { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.bfigs { margin: 0; display: grid; gap: 4px; }
.bfig { --c: var(--line2); display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; font-weight: 500; color: var(--ink2); padding: 5px 9px 5px 13px; line-height: 1.35; background: var(--sunk); border-radius: 6px; position: relative; }
.bfig dt { min-width: 0; }
.bfig dd { margin: 0; color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
#bnWater { --c: var(--cw); } #bnHeat { --c: var(--hs); } #bnHeat.cool { --c: var(--cs); } #bnElec { --c: #7a5af8; } #bnGas { --c: var(--gas); }
#bnGas dd { font-size: 15px; }
.gsplit { display: flex; height: 6px; border-radius: 6px; background: #eceef2; overflow: hidden; margin: 8px 0 6px; gap: 1px; }
.gsplit i { display: block; height: 100%; width: var(--w, 0%); background: var(--c); transition: width .3s; }
.gkey { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 12px; font-weight: 400; color: var(--ink2); line-height: 1.35; }
.gkey li { white-space: nowrap; }
.gkey li::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--c); margin-right: 5px; vertical-align: 0; }
.gkey b { color: var(--ink); font-weight: 600; }

/* "This month": the bill as a quiet table, the total big */
.bill { background: none; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.btop { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 8px; }
.btop b { font-size: 26px; font-weight: 700; display: block; line-height: 1.1; letter-spacing: -0.01em; }
.brow { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--ink); padding: 5px 0 3px; border-top: 1px solid var(--line); }
.brow b { color: var(--ink); font-weight: 700; }
.bsub { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; font-weight: 400; color: var(--mute); line-height: 1.3; padding: 0 0 2px 24px; }
.bsub + .brow { margin-top: 3px; }
.bsub b { color: var(--ink2); font-weight: 500; }
.bsub.shared, .bsub.shared b { color: #6941c6; }
.bill .ran { margin: 8px 0 0; font-size: 12px; line-height: 1.4; font-weight: 400; color: var(--ink2); background: color-mix(in srgb, var(--dhw) 6%, #fff); border-radius: 6px; padding: 5px 8px; }
.note { font-size: 12.5px; font-weight: 400; color: var(--ink2); line-height: 1.45; margin: 10px 0 0; }
.delta { font-size: 12.5px; font-weight: 700; border-radius: 999px; padding: 3px 9px; background: var(--sunk); color: var(--ink2); white-space: nowrap; }
.delta.good { color: var(--good); background: #ecfdf3; }
.delta.bad { color: var(--bad); background: #fff6ed; }

.shares { margin-top: 14px; container-type: inline-size; }
#monthFine { margin-top: 10px; }
#pieNote { margin-top: 6px; }
#pieSeg { margin-bottom: 10px; min-width: 0; }
#pieSeg button { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#pieSeg .pi { display: none; }
.pieWrap { display: grid; grid-template-columns: 124px minmax(0, 1fr); gap: 12px; align-items: center; }
#pie { display: block; width: 124px; height: 124px; }
#pie .slice { cursor: pointer; }
#pie .slice path, #pie .slice circle { fill: var(--c); stroke: #fff; stroke-width: 1.5; }
#pie .none { fill: #eceef2; }
#pie text { font-size: 10.5px; font-weight: 600; fill: #fff; text-anchor: middle; paint-order: stroke; stroke: rgba(0,0,0,.35); stroke-width: 2px; stroke-linejoin: round; pointer-events: none; }
#pie text.pc { font-size: 9.5px; font-weight: 500; }
.pieKey { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.pk { width: 100%; display: grid; grid-template-columns: 9px minmax(0, 1fr) auto auto; column-gap: 7px; align-items: center; text-align: left; border: 1px solid transparent; border-radius: 6px; background: none; padding: 3px 6px; font-size: 12.5px; }
.pk:hover { background: var(--sunk); }
.pk[aria-pressed=true] { background: var(--acc-t); border-color: var(--accent); }
.pk .pn { min-width: 1.7em; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk .pp { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.pk .pv { min-width: 52px; text-align: right; font-size: 12px; font-weight: 400; color: var(--mute); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pk .px { display: block; font-size: 11px; line-height: 1.1; font-weight: 600; color: var(--dhw); }
.pk .px:empty { display: none; }
.pieKey.wide .pk { grid-template-columns: 9px minmax(0, 1fr) auto; line-height: 1.15; padding-top: 2px; padding-bottom: 2px; }
.pieKey.wide .pk .pn { grid-column: 2 / 4; }
.pieKey.wide .pk .pp { grid-column: 2; text-align: left; }
.pieKey.wide .pk .pv { grid-column: 3; }

/* the pinned meter's card: a hairline card with a thin bar of the accent along its top */
#infoCard { position: relative; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
#infoCard h2 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--ink); padding-right: 34px; overflow-wrap: anywhere; display: block; }
#infoCard .read { font-size: 26px; font-weight: 700; margin: 8px 0 2px; font-variant-numeric: tabular-nums; color: var(--c); }
#infoCard .read b { font-weight: 600; }
#infoCard .read small { font-size: 13px; color: var(--mute); font-weight: 400; }
#infoCard p { font-size: 13px; line-height: 1.45; margin: 8px 0 0; color: var(--ink2); font-weight: 400; }
#infoCard p.rule { font-size: 12px; color: var(--mute); margin-top: 6px; }
#infoCard .tag { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .04em; color: #fff; border-radius: 5px; padding: 2px 7px; margin: 2px 0 6px; }
#infoCard .warn { color: var(--bad); font-weight: 600; margin: 0 0 6px; }
.pace { height: 6px; border-radius: 6px; background: #eceef2; overflow: hidden; margin: 4px 0 10px; }
.pace i { display: block; height: 100%; width: var(--w, 0%); background: var(--c); border-radius: 6px; transition: width .3s; }
.mrows .hrow { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 400; color: var(--ink2); padding: 5px 0; border-top: 1px solid var(--line); }
.mrows .hrow b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mrows .hrow.sub { border-top: 0; padding: 0 0 3px 14px; font-size: 12px; color: var(--mute); }
.mrows .hrow.sub b { font-weight: 500; color: var(--ink2); }
/* a long worked-out rule wraps under its label instead of running past the card's edge */
.mrows .hrow.sub { flex-wrap: wrap; }
.mrows .hrow.sub > span { white-space: nowrap; }
.mrows .hrow.sub b { white-space: normal; text-align: right; margin-left: auto; }
/* a card's close button: a small cross, a 36 px place to hit it */
.x { position: absolute; top: 6px; right: 6px; width: 36px; height: 36px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 8px; background: none; font-size: 22px; font-weight: 300; line-height: 1; color: var(--mute); }
.x:hover { background: var(--sunk); color: var(--ink); }

/* the stories */
.storyTabs { margin-bottom: 14px; }
.storyTabs button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 6px 2px; font-size: 12.5px; white-space: nowrap; overflow: hidden; }
.storyTabs button .i { width: 16px; height: 16px; }
.storyTabs button span { overflow: hidden; text-overflow: ellipsis; }
/* the story tabs and the two tap switches share their bar by the length of their words, not in equal parts, so a
   long word ("¿Quién paga?", "Kitchen & basin") takes room from a short one instead of being cut */
.storyTabs button, #tapSeg button { flex: 1 1 auto; }
.intro { font-size: 13px; font-weight: 400; color: var(--ink2); margin: 0 0 12px; line-height: 1.45; }
.say { font-size: 13.5px; font-weight: 500; line-height: 1.45; margin: 12px 0 0; background: var(--sunk); border: 1px solid var(--line); border-left: 3px solid #f59e0b; border-radius: 4px 8px 8px 4px; padding: 9px 12px; }
.say.ok { border-left-color: var(--good); }
.twins { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.twin { background: none; border-radius: 10px; padding: 10px; text-align: center; border: 1px solid var(--line); }
.twin.open { border-color: color-mix(in srgb, var(--accent) 45%, #fff); background: var(--acc-t); }
.twin h4 { margin: 0 0 8px; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.twin .tog { margin-bottom: 10px; }
.twin .kw { font-size: 21px; font-weight: 700; color: #c2560c; }
.twin .sub { font-size: 12px; font-weight: 400; color: var(--mute); }
.hbar { height: 6px; border-radius: 6px; background: #eceef2; overflow: hidden; margin: 6px 0 8px; }
.hbar i { display: block; height: 100%; background: var(--hs); border-radius: 6px; transition: width .4s; }
.twin .money { font-size: 18px; font-weight: 700; }
.payrows { display: grid; grid-template-columns: minmax(34px, max-content) minmax(0, 1fr); gap: 8px 10px; align-items: center; margin-bottom: 10px; }
.payrow { display: contents; }
.payrow .id { font-weight: 600; font-size: 13.5px; background: none; border: 1px solid var(--line2); border-radius: 6px; text-align: center; padding: 5px 6px; max-width: 122px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.payrow.sel .id { background: var(--acc-t); border-color: var(--accent); color: var(--acc-d); }
.pbar { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 400; color: var(--ink2); line-height: 1.5; }
.pbar b { color: var(--ink); }
.pbar i { height: 6px; border-radius: 6px; display: block; }
.pkey { display: flex; gap: 14px; font-size: 12px; font-weight: 400; color: var(--ink2); margin-bottom: 10px; flex-wrap: wrap; }
.pkey span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 0; background: var(--c); }
.goal { position: relative; height: 10px; background: #eceef2; border-radius: 999px; overflow: hidden; margin: 8px 0 6px; }
.goal i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; transition: width .4s; }
.goal em { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ink); }
.gl { display: flex; justify-content: space-between; font-size: 12px; font-weight: 400; color: var(--mute); }
.stars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 12px; }
.stars div { min-width: 0; background: none; border: 1px solid var(--line); border-radius: 8px; padding: 8px 4px; text-align: center; font-size: 12px; font-weight: 400; }
.stars b { display: block; font-size: 14px; overflow-wrap: anywhere; }
.fine { font-size: 12px; color: var(--mute); line-height: 1.45; margin: 10px 0 0; font-weight: 400; }
/* the disclaimer at the foot of the left column (the owner, 2026-11-16) */
.col > .fine.simplified { margin: 4px 4px 8px; font-size: 11.5px; }

/* settings, opened with the gear: the flats' names, then the prices */
#btnPrices[aria-pressed=true] { background: var(--ink); border-color: var(--ink); }
#btnPrices[aria-pressed=true] .i { color: #fff; }
#priceCard { position: relative; border-color: var(--ink2); box-shadow: 0 0 0 3px rgba(16,24,40,.06); font-size: 13px; font-weight: 400; color: var(--ink2); }
#priceCard h2 { margin: 0 0 8px; padding-right: 34px; font-size: 15px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--ink); }
#priceCard h3 { margin: 0 0 4px; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.setsec + .setsec, .setfoot { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.nrow { display: grid; grid-template-columns: 40px 100px minmax(0, 1fr); gap: 6px; align-items: center; margin-bottom: 6px; }
.nhead { margin-bottom: 2px; font-size: 11.5px; font-weight: 500; color: var(--mute); text-transform: uppercase; letter-spacing: .05em; }
.nid { display: flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink); }
.nrow input, #priceCard input[type=number], #priceCard select, #pLink { width: 100%; min-width: 0; font: inherit; font-weight: 500; color: var(--ink); border: 1px solid var(--line2); border-radius: 6px; padding: 5px 8px; background: #fff; transition: border-color .15s; }
.nrow input:hover, #priceCard input[type=number]:hover, #priceCard select:hover { border-color: #98a2b3; }
.nrow input::placeholder { color: #667085; font-weight: 400; opacity: 1; }
.nrow input:focus-visible, #priceCard input:focus-visible, #priceCard select:focus-visible, #pLink:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
#priceCard .pnote { margin: 4px 0 10px; font-size: 12px; line-height: 1.4; color: var(--mute); }
#priceCard fieldset { border: 1px solid var(--line); background: none; border-radius: 8px; padding: 9px 10px; margin: 0 0 8px; min-width: 0; }
#priceCard legend { float: left; width: 100%; padding: 0; margin-bottom: 8px; font-weight: 600; color: var(--ink); font-size: 13px; }
#priceCard input[type=number] { width: 68px; text-align: right; padding: 4px 6px; }
#priceCard select { width: auto; padding: 4px 6px; }
#priceCard input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; }
.pline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-bottom: 10px; }
.pline .chk { display: flex; align-items: center; gap: 5px; font-size: 12px; }
.prow { clear: both; display: grid; grid-template-columns: 52px 68px 30px 68px 22px; gap: 5px; align-items: center; margin-bottom: 4px; }
.prow span { font-size: 12px; }
.prow2 { display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 6px; font-size: 12px; }
.prow2 input[type=number] { width: 58px; }
.padd, .pdel { border: 1px solid var(--line2); background: #fff; border-radius: 6px; font-weight: 500; font-size: 12px; padding: 3px 8px; }
.padd:hover, .pdel:hover { background: var(--sunk); }
.pdel { padding: 1px 0; width: 22px; color: var(--mute); }
.pplant label { clear: both; display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-bottom: 5px; font-size: 12px; }
.pplant label input { flex: none; margin-left: auto; }
#pLink { font-size: 11px; font-weight: 400; color: var(--ink2); background: var(--sunk); }
.pbtns { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.pbtns .ghost { height: 30px; font-size: 12.5px; padding: 0 11px; }

/* 3D labels (they mark parts of the model, so they sit on it): the page's own, in this type */
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.lab { position: absolute; left: 0; top: 0; white-space: nowrap; user-select: none; -webkit-user-select: none; pointer-events: auto; cursor: pointer; will-change: transform; transition: opacity .25s; }
.lab.dim { opacity: 0; pointer-events: none; }
.lab.unit { background: rgba(255,255,255,.96); border-radius: 999px; padding: 2px 9px 2px 2px; font-size: 12.5px; font-weight: 600; box-shadow: 0 1px 4px rgba(16,24,40,.18); display: flex; align-items: center; gap: 6px; border: 1px solid rgba(16,24,40,.08); }
.lab.unit .id { background: var(--ink); color: #fff; border-radius: 999px; padding: 1px 8px; }
.lab.unit.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 1px 4px rgba(16,24,40,.18); }
.lab.unit.sel .id { background: var(--accent); }
.lab.meter { font-size: 10.5px; font-weight: 700; color: #fff; border-radius: 5px; padding: 2px 6px; letter-spacing: .03em; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.lab.meter.read { z-index: 2; font-size: 14px; padding: 3px 9px; border-radius: 7px; letter-spacing: 0; font-variant-numeric: tabular-nums; box-shadow: 0 0 0 2px #fff, 0 3px 10px rgba(0,0,0,.3); }
.lab.callout, .lab.plant { padding: 0 0 20px; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #18222f; text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 6px #fff; pointer-events: none; }
.lab.callout::after, .lab.plant::after { content: ""; position: absolute; left: 50%; bottom: 3px; width: 1px; height: 17px; background: rgba(24,34,47,.75); }
.lab.callout::before, .lab.plant::before { content: ""; position: absolute; left: calc(50% - 3px); bottom: 0; width: 6px; height: 6px; border-radius: 50%; background: #18222f; box-shadow: 0 0 0 2px #fff; }

/* the help dialog */
.modal { position: fixed; inset: 0; background: rgba(16,24,40,.42); z-index: 20; display: grid; place-items: center; padding: 16px; }
.modal .card { position: relative; max-width: 600px; max-height: 86vh; overflow-y: auto; padding: 24px 28px 22px; border: 0; border-radius: 14px; box-shadow: 0 20px 48px rgba(16,24,40,.22); }
.modal h2 { font-size: 19px; font-weight: 600; letter-spacing: -0.01em; text-transform: none; color: var(--ink); padding-right: 30px; margin-bottom: 12px; }
.modal p { font-size: 14.5px; line-height: 1.6; margin: 0 0 10px; color: var(--ink2); font-weight: 400; }
.modal p b { color: var(--ink); }
/* the fine print (example prices, the Canada heat-meter note) in a quiet box at the foot */
.modal .fine { margin-top: 14px; padding: 10px 12px; background: var(--sunk); border: 1px solid var(--line); border-radius: 8px; font-size: 12.5px; color: var(--ink2); }
.modal .x { top: 12px; right: 12px; }

#loading { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 4px; background: #eef1f5; color: var(--ink2); font-size: 14px; font-weight: 500; transition: opacity .4s; }
.spinner { width: 30px; height: 30px; border: 2px solid rgba(16,24,40,.12); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* keyboard focus: always a 2 px ring in the accent, with a gap */
button:focus-visible, select:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.seasons button:focus-visible, .btypes button:focus-visible, .unitTabs button:focus-visible, .seg3 button:focus-visible, .storyTabs button:focus-visible { outline-offset: 0; }
#sheetTabs { display: none; }

@media (max-width: 1500px) { .brand p { display: none; } }
@media (min-width: 1800px) {
  #app { grid-template-columns: 320px minmax(0, 1fr) 360px; gap: 14px; }
}
/* the header gives way in this order: the subtitle, the globe and the language menu (it shows EN, FR or ES:
   app.js showLangNames), the gaps; then, below 1360 px, the words "Try" and "How it works" (the help button keeps
   its icon and its tooltip), so that every "Try" chip fits at 1250 px in all three languages */
@media (max-width: 1500px) {
  .langWrap .i { display: none; }
  .langWrap { padding-left: 1px; }
  #langSel { max-width: 104px; padding-right: 22px; background-position: right 6px center; }
  #top { gap: 12px; }
  .chip { padding: 0 9px; }
}
@media (max-width: 1360px) {
  #tries .lbl { display: none; }
  #btnAbout span { display: none; }
  #btnAbout { width: 32px; padding: 0; justify-content: center; }
}
@media (max-width: 1250px) {
  #app { grid-template-columns: 270px minmax(0, 1fr) 292px; }
  .brand img { max-width: 104px; }
  .pieWrap { grid-template-columns: 104px minmax(0, 1fr); gap: 8px; }
  #pie { width: 104px; height: 104px; }
  .fbars { gap: 6px; }
  .pk { column-gap: 4px; padding: 2px 3px; }
  .pk .pv { min-width: 0; }
}

/* phones and small tablets: the picture on top; under it a two-part switch that stays at the top of the screen
   while the sheet under it scrolls */
@media (max-width: 900px) {
  body { overflow: auto; }
  #app { height: auto; min-height: 100dvh; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto auto auto; grid-template-areas: "top" "stage" "flats" "tabs" "sheet"; padding: 0 10px 16px; gap: 10px; }
  /* the overview of the four flats stands outside the two sheets, so it shows with either (app.js placeNow) */
  #app > #allFlats { grid-area: flats; min-width: 0; }
  #nowMini { display: none; }
  #top { flex-wrap: wrap; gap: 8px 10px; margin: 0 -10px; padding: 8px 12px; }
  /* row 1: the logo and the four buttons; row 2: the title; row 3: the "Try" chips, which scroll sideways */
  .brand { display: contents; }
  .brand img { order: 0; height: 20px; max-width: 110px; }
  .bsep { display: none; }
  .brand > div { order: 2; flex-basis: 100%; min-width: 0; }
  .brand img:not([src]) ~ div, .brand img[src=""] ~ div { order: 0; flex: 1 1 0%; }
  .brand h1 { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbtns { order: 1; }
  #tries { order: 3; flex-basis: 100%; min-width: 0; justify-content: flex-start; margin: 0 -12px; padding: 0 10px; }
  #tries .lbl { display: none; }
  .chip { height: 30px; font-size: 12.5px; padding: 0 10px; }
  .topbtns { margin-left: auto; gap: 4px; }
  .langWrap .i { display: none; }
  .langWrap { padding-left: 2px; }
  #langSel { max-width: 92px; }
  #btnAbout span { display: none; }
  #btnAbout { width: 32px; padding: 0; justify-content: center; }
  #stage { height: 62vh; }
  #view3d { border-radius: 10px; }
  #msg { font-size: 13.5px; min-height: 44px; padding: 9px 12px 9px 40px; }
  #msg::before { left: 12px; width: 18px; height: 18px; margin-top: -9px; }
  #sheetTabs { grid-area: tabs; display: flex; gap: 2px; position: sticky; top: 0; z-index: 5; background: #eceef2; border-radius: 10px; padding: 3px; box-shadow: 0 0 0 6px var(--bg); }
  #sheetTabs button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 0; background: none; border-radius: 7px; height: 40px; font-size: 14px; font-weight: 500; color: var(--ink2); }
  #sheetTabs button[aria-selected=true] { background: var(--acc-d); color: #fff; font-weight: 600; box-shadow: 0 1px 2px rgba(16,24,40,.16); }
  #sheetTabs button[aria-selected=true] .i { color: #fff; }
  .pieWrap { grid-template-columns: 140px minmax(0, 1fr); gap: 14px; }
  #pie { width: 140px; height: 140px; }
  #left, #right { grid-area: sheet; overflow: visible; padding: 0; margin: 0; }
  #app[data-sheet=left] #right, #app[data-sheet=right] #left { display: none; }
  #infoCard { order: -1; }
  .seasons button, .btypes button, .unitTabs button, .seg3 button, .storyTabs button { min-height: 40px; }
  .tog { height: 34px; }
  .nrow { grid-template-columns: 40px 128px minmax(0, 1fr); }
  .nrow input { font-size: 16px; padding: 7px 8px; }
  .winBtns { gap: 6px; }
  .winBtns .tog { height: 34px; padding: 0 11px; font-size: 13px; }
  .lab.unit > span:nth-child(2), .lab.plant, .lab.callout { display: none; }
}
@container (max-width: 280px) {
  .pieWrap { grid-template-columns: 104px minmax(0, 1fr); gap: 8px; }
  #pie { width: 104px; height: 104px; }
  .pk { column-gap: 4px; padding: 2px 3px; }
  .pk .pv { min-width: 0; }
}

/* the speaker button: muted by default; waves show when sound is on */
#btnSound .sOn { display: none; }
#btnSound[aria-pressed=true] .sOn { display: inline; }
#btnSound[aria-pressed=true] .sOff { display: none; }
#btnSound[aria-pressed=true] { color: var(--acc-d); }

/* ---------- electric cars (js/ev.js): the switch in the Building card, the car tile of a flat that has one ---------- */
.evRow { margin-top: 12px; display: flex; align-items: center; gap: 12px; padding: 12px 2px 2px 10px; border-top: 1px solid var(--line); }
.evRow .ic, #tileEv .ic { flex: none; line-height: 0; color: var(--ev-d); }
.evRow .ic .i, #tileEv .ic .i { width: 24px; height: 24px; }
.evTxt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; text-align: left; }
.evTxt b { font-size: 13px; font-weight: 600; line-height: 1.25; }
.evTxt small { font-size: 12px; font-weight: 400; color: var(--mute); line-height: 1.3; }
#tileEv { gap: 6px 10px; align-items: center; flex-wrap: wrap; }
#tileEv .evTxt { flex: 1 1 140px; }
#tileEv .tl { flex: none; font-size: 13px; color: var(--ink); }
#tileEv.on { background: #f2fae6; border-color: #b8df7c; }
#tileEv.on #evState { color: var(--ev-d); font-weight: 600; }
/* the charger's amps: five steps under the switch, the whole width of the tile; dimmed while the charger is Off */
#tileEv .evAmps { flex: 1 1 100%; display: flex; flex-direction: column; gap: 4px; text-align: left; }
#tileEv .evAmps .k { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink2); }
#ampSeg button { min-height: 28px; font-variant-numeric: tabular-nums; }
#ampSeg button[aria-pressed=true] { background: var(--ev-d); }
#ampSeg.off button[aria-pressed=true] { background: #9aa1ab; box-shadow: none; }
#btnCharge { flex: none; min-width: 0; white-space: nowrap; margin-left: auto; }
#btnCharge.on, #btnEv.on { background: var(--ev-d); border-color: var(--ev-d); color: #fff; }
.fbar.ev .track .e { background: var(--ev); }
.fbar.ev b { color: var(--ev-d); }
#bnElec.ev { --c: var(--ev); }
.unitTabs button.car .ul::after { content: "🚗"; font-size: 10px; line-height: 1; margin-left: -1px; }
.bill .ran.ev { background: color-mix(in srgb, var(--ev) 10%, #fff); }
