/* nap.ocarroeletrico.com — shares the ocarroeletrico.com language: Nunito,
   warm paper, navy ink, orange for actions. Status colours come in pairs with
   a shape, so no state is told by colour alone. */
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url("fonts/nunito-latin.woff2") format("woff2"); }

:root {
  color-scheme: light dark;
  --bg: #fbfaf5; --bg-alt: #fdf1ea; --card: #ffffff; --fg: #14203a; --muted: #56627a; --line: #ebe4dc;
  --ink: #c2410c; --ink-strong: #9a3412; --ink-soft: #ffe4d6; --on-ink: #ffffff;
  --bar: #1d4e89; --track: #eef0f4; --focus: #1d4ed8;
  --s-available: #15803d; --s-charging: #0369a1; --s-outOfOrder: #b45309; --s-inoperative: #c2410c;
  --s-unknown: #64748b; --s-blocked: #be185d; --s-planned: #475569; --s-removed: #7c3aed; --s-other: #b91c1c;
  --sev-critico: #b91c1c; --sev-alto: #c2410c; --sev-medio: #a16207; --sev-baixo: #56627a;
  --s-shared: color-mix(in srgb, var(--s-charging) 45%, var(--card));
  --r: 14px; --r-s: 8px; --gap: 16px; --wrap: 1180px;
  --step--1: .875rem; --step-0: 1rem; --step-1: 1.25rem; --step-2: 1.6rem; --step-3: clamp(1.9rem, 1.2rem + 3vw, 2.9rem);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0d1322; --bg-alt: #141a2b; --card: #172138; --fg: #e8edf8; --muted: #a2adc4; --line: #2a3654;
  --ink: #ff9f7a; --ink-strong: #ffd0bd; --ink-soft: #3a1d14; --on-ink: #1a0d08;
  --bar: #7fb2ee; --track: #222c45; --focus: #9cc2ff;
  --s-available: #4ade80; --s-charging: #38bdf8; --s-outOfOrder: #fbbf24; --s-inoperative: #fb923c;
  --s-unknown: #94a3b8; --s-blocked: #f472b6; --s-planned: #cbd5e1; --s-removed: #a78bfa; --s-other: #f87171;
  --sev-critico: #f87171; --sev-alto: #fb923c; --sev-medio: #fbbf24; --sev-baixo: #a2adc4; } }
:root[data-theme="dark"] {
  --bg: #0d1322; --bg-alt: #141a2b; --card: #172138; --fg: #e8edf8; --muted: #a2adc4; --line: #2a3654;
  --ink: #ff9f7a; --ink-strong: #ffd0bd; --ink-soft: #3a1d14; --on-ink: #1a0d08;
  --bar: #7fb2ee; --track: #222c45; --focus: #9cc2ff;
  --s-available: #4ade80; --s-charging: #38bdf8; --s-outOfOrder: #fbbf24; --s-inoperative: #fb923c;
  --s-unknown: #94a3b8; --s-blocked: #f472b6; --s-planned: #cbd5e1; --s-removed: #a78bfa; --s-other: #f87171;
  --sev-critico: #f87171; --sev-alto: #fb923c; --sev-medio: #fbbf24; --sev-baixo: #a2adc4; }
/* Colour-blind: Okabe-Ito pairs. */
:root[data-vision="cb"] { --ink: #0b5cad; --ink-strong: #083b73; --ink-soft: #dcebfa;
  --s-available: #0072b2; --s-charging: #8a7d00; --s-outOfOrder: #d55e00; --s-inoperative: #a86a00;
  --s-unknown: #4b5563; --s-blocked: #00755a; --s-planned: #374151; --s-removed: #a64f86; }
@media (prefers-color-scheme: dark) { :root[data-vision="cb"]:not([data-theme="light"]) { --ink: #7cc4f0; --ink-strong: #cfe9fb; --ink-soft: #12304d; --on-ink: #06121f;
  --s-available: #56b4e9; --s-charging: #f0e442; --s-outOfOrder: #ff7a45; --s-inoperative: #e69f00;
  --s-unknown: #9ca3af; --s-blocked: #2dd4a7; --s-planned: #e5e7eb; --s-removed: #cc79a7; } }
:root[data-vision="cb"][data-theme="dark"] { --ink: #7cc4f0; --ink-strong: #cfe9fb; --ink-soft: #12304d; --on-ink: #06121f;
  --s-available: #56b4e9; --s-charging: #f0e442; --s-outOfOrder: #ff7a45; --s-inoperative: #e69f00;
  --s-unknown: #9ca3af; --s-blocked: #2dd4a7; --s-planned: #e5e7eb; --s-removed: #cc79a7; }
:root[data-vision="hc"] { --bg: #fff; --bg-alt: #f0f0f0; --card: #fff; --fg: #000; --muted: #202020; --line: #000;
  --ink: #0033a0; --ink-strong: #001f66; --ink-soft: #e0e8ff; --bar: #000; --track: #d9d9d9; }
@media (prefers-color-scheme: dark) { :root[data-vision="hc"]:not([data-theme="light"]) { --bg: #000; --bg-alt: #0d0d0d; --card: #000; --fg: #fff; --muted: #e6e6e6; --line: #fff;
  --ink: #ffd60a; --ink-strong: #fff; --ink-soft: #332b00; --on-ink: #000; --bar: #fff; --track: #333; } }
:root[data-vision="hc"][data-theme="dark"] { --bg: #000; --bg-alt: #0d0d0d; --card: #000; --fg: #fff; --muted: #e6e6e6; --line: #fff;
  --ink: #ffd60a; --ink-strong: #fff; --ink-soft: #332b00; --on-ink: #000; --bar: #fff; --track: #333; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 400 var(--step-0)/1.55 "Nunito", system-ui, sans-serif; }
h1, h2, h3, h4 { line-height: 1.15; margin: 0; font-weight: 800; letter-spacing: -.01em; }
h1 { font-size: var(--step-3); font-weight: 900; }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
h4 { font-size: var(--step-0); margin: 1.2em 0 .4em; }
p { margin: 0 0 .8em; max-width: 68ch; }
a { color: var(--ink); text-underline-offset: 3px; }
a:hover { color: var(--ink-strong); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; background: var(--bg-alt); padding: .05em .35em; border-radius: 5px; overflow-wrap: anywhere; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--card); color: var(--fg); padding: 10px 14px; border-radius: var(--r-s); z-index: 50; }
.skip:focus { top: 8px; }
html[lang="pt"] [data-lang="en"], html[lang="en"] [data-lang="pt"] { display: none; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: var(--step--1); }

/* ---- top bar ---- */
.top { position: sticky; top: 0; z-index: 30; background: var(--bg); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 12px; min-height: 56px; flex-wrap: wrap; padding-block: 6px; }
.brand { font-weight: 900; font-size: 1.1rem; color: var(--fg); text-decoration: none; margin-right: auto; display: flex; align-items: center; gap: 8px; }
.brand img { width: 28px; height: 33px; display: block; }
.nav { display: flex; gap: 4px; order: 3; width: 100%; overflow-x: auto; }
.nav a { padding: 8px 12px; border-radius: 999px; color: var(--fg); text-decoration: none; font-weight: 700; white-space: nowrap; min-height: 44px; display: inline-flex; align-items: center; }
.nav a[aria-current="page"] { background: var(--fg); color: var(--bg); }
.nav a:hover:not([aria-current]) { background: var(--bg-alt); }
.tools { display: flex; gap: 6px; align-items: center; }
@media (min-width: 760px) { .nav { order: 0; width: auto; margin-right: auto; } .brand { margin-right: 12px; } }

.btn { font: inherit; font-weight: 700; min-height: 44px; padding: 8px 16px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--card); color: var(--fg); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.btn:hover { border-color: var(--fg); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.btn.primary:hover { background: var(--ink-strong); border-color: var(--ink-strong); }
.btn[aria-pressed="true"] { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.btn.sm { min-height: 44px; padding: 4px 12px; font-size: var(--step--1); }
.menu { position: relative; }
.menu-panel { position: absolute; right: 0; top: calc(100% + 6px); background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r); padding: 14px; width: min(300px, 88vw); box-shadow: 0 12px 30px rgb(20 32 58 / .18); }
.menu-panel fieldset { border: 0; padding: 0; margin: 0 0 12px; }
.menu-panel legend { font-weight: 800; margin-bottom: 6px; padding: 0; }
.seg { display: flex; gap: 4px; flex-wrap: wrap; }

/* ---- page head ---- */
.hero { padding: 28px 0 18px; }
.hero p { color: var(--muted); font-size: 1.05rem; margin-top: 8px; }
.note { background: var(--bg-alt); border-radius: var(--r-s); padding: 10px 14px; font-size: var(--step--1); color: var(--muted); }
.note b { color: var(--fg); }
section.block { padding: 26px 0; border-top: 1px solid var(--line); }
section.block > h2 { margin-bottom: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.grid { display: grid; gap: var(--gap); }
@media (min-width: 760px) { .grid.two { grid-template-columns: 1fr 1fr; } .grid.three { grid-template-columns: repeat(3, 1fr); } }

/* ---- form controls ---- */
label.field { display: grid; gap: 4px; font-weight: 700; font-size: var(--step--1); }
input[type="search"], select { font: inherit; min-height: 48px; padding: 8px 14px; border-radius: var(--r); border: 1.5px solid var(--muted); background: var(--card); color: var(--fg); width: 100%; }
.searchrow { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .searchrow { grid-template-columns: 1fr auto; align-items: end; } }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 0; padding: 0; list-style: none; }
.morefilters { margin-top: 12px; }
.morefilters summary { cursor: pointer; font-weight: 700; min-height: 44px; display: inline-flex; align-items: center; }
.morefilters .grid { margin-top: 8px; }
details.ms { border: 1.5px solid var(--muted); border-radius: var(--r); background: var(--card); }
details.ms > summary { cursor: pointer; font-weight: 700; font-size: var(--step--1); min-height: 48px; display: flex; align-items: center; gap: 6px; padding: 8px 14px; }
details.ms .msbody { max-height: 280px; overflow-y: auto; padding: 4px 14px 12px; display: grid; gap: 2px; border-top: 1px solid var(--line); }
details.ms .mssearch { margin: 0 14px 6px; width: calc(100% - 28px); min-height: 40px; }
details.ms .msnone { padding: 0 14px 10px; }
details.ms label.chk { display: flex; align-items: center; gap: 8px; min-height: 36px; font-weight: 400; cursor: pointer; }
details.ms input[type="checkbox"] { width: 20px; height: 20px; flex: none; }

/* ---- find: results + map ---- */
.viewswitch { display: flex; gap: 6px; margin: 16px 0 10px; }
/* minmax(0, 1fr): sem isto a coluna toma a largura do conteúdo (tabela de tomadas, gráficos)
   e o detalhe passa da largura do telemóvel. */
.findlayout { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 980px) { .viewswitch { display: none; } .findlayout { grid-template-columns: minmax(0, 1fr) minmax(0, 440px); align-items: start; }
  .findlayout > .mapbox { position: sticky; top: 76px; display: block !important; } .findlayout > .results { display: block !important; } }
.count { font-weight: 700; margin: 0 0 10px; }
.sites { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.site { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.site.sel { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink); }
.site > button { all: unset; box-sizing: border-box; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; width: 100%; padding: 14px 16px; cursor: pointer; border-radius: var(--r); }
.site > button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.site .nm { font-weight: 800; font-size: 1.05rem; overflow-wrap: anywhere; }
.site .where { color: var(--muted); font-size: var(--step--1); grid-column: 1; }
.site .kw { font-weight: 900; font-size: 1.35rem; text-align: right; white-space: nowrap; grid-row: 1 / span 2; grid-column: 2; }
.site .kw small { display: block; font-weight: 600; font-size: .75rem; color: var(--muted); }
.site .line { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin-top: 6px; font-size: var(--step--1); }
.tag { border: 1px solid var(--line); border-radius: 999px; padding: 1px 10px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.tag.warn { border-color: var(--s-outOfOrder); }
/* MCS (veículos pesados): a ficha mais rara e mais potente, em destaque com a cor de ação. */
.tag.mcs { border-color: var(--ink); background: var(--ink-soft); color: var(--ink-strong); }
.btn.mcs[aria-pressed="false"] { border-color: var(--ink); }
.detail { border-top: 1px solid var(--line); padding: 14px 16px 16px; }
.detail dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0 0 12px; font-size: var(--step--1); }
.detail dt { color: var(--muted); }
.detail dd { margin: 0; overflow-wrap: anywhere; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.more { margin: 14px auto 0; display: flex; }

/* Status mark: colour + shape + text. */
.st { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; white-space: nowrap; }
.dot { width: 12px; height: 12px; flex: none; background: var(--c, var(--s-unknown)); border-radius: 50%; display: inline-block; }
.dot[data-s="available"] { --c: var(--s-available); }
.dot[data-s="charging"] { --c: var(--s-charging); border-radius: 2px; }
/* Tomada partilhada em uso pela outra: a cor de "a carregar", mais clara, com contorno. */
.dot[data-s="shared"] { --c: var(--s-shared); border-radius: 2px; box-shadow: inset 0 0 0 2px var(--s-charging); }
.dot[data-s="outOfOrder"] { --c: var(--s-outOfOrder); clip-path: polygon(50% 0, 100% 100%, 0 100%); border-radius: 0; }
.dot[data-s="inoperative"] { --c: var(--s-inoperative); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); border-radius: 0; }
.dot[data-s="unknown"] { --c: transparent; border: 2.5px solid var(--s-unknown); }
.dot[data-s="blocked"] { --c: var(--s-blocked); clip-path: polygon(0 35%, 100% 35%, 100% 65%, 0 65%); border-radius: 0; }
.dot[data-s="planned"] { --c: transparent; border: 2.5px dashed var(--s-planned); }
.dot[data-s="removed"] { --c: var(--s-removed); clip-path: polygon(20% 0, 50% 30%, 80% 0, 100% 20%, 70% 50%, 100% 80%, 80% 100%, 50% 70%, 20% 100%, 0 80%, 30% 50%, 0 20%); border-radius: 0; }
.sockets { display: inline-flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: var(--step--1); margin: 10px 0 0; padding: 0; list-style: none; }

.mapbox { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; }
.mapbox canvas { width: 100%; height: auto; aspect-ratio: 3 / 4; display: block; border-radius: var(--r-s); background: var(--bg-alt); touch-action: none; cursor: grab; }
.maptools { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.mapgl { width: 100%; aspect-ratio: 3 / 4; max-height: 80vh; border-radius: var(--r-s); overflow: hidden; background: var(--bg-alt); }
.mapgl[hidden], .mapbox canvas[hidden] { display: none; }
/* «Expandir mapa» (desktop only: on a phone the map is already its own full-width view). The
   list stays beside it, since tapping a point opens that site in the list. The layout breaks
   out of the page width and the map fills the window's height; find.js resizes the canvas. */
.wideonly { display: none; }
@media (min-width: 980px) {
  .mapbox .wideonly { display: inline-flex; }
  .findlayout.wide { grid-template-columns: minmax(0, 440px) minmax(0, 1fr); margin-inline: calc(50% - min(50vw - 24px, 900px)); }
  .findlayout.wide .mapbox canvas, .findlayout.wide .mapgl { aspect-ratio: auto; height: max(420px, calc(100dvh - 250px)); max-height: none; }
}
#mDetail[aria-pressed="true"] { background: var(--ink); color: var(--card); }

/* ---- tables ---- */
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.scroll:focus-visible { outline: 3px solid var(--focus); }
table { border-collapse: collapse; width: 100%; font-size: var(--step--1); font-variant-numeric: tabular-nums; }
th, td { padding: 8px 10px; text-align: right; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 800; color: var(--muted); white-space: nowrap; }
th:first-child, td:first-child, th.l, td.l { text-align: left; }
tbody tr:last-child td { border-bottom: 0; }
th button { all: unset; cursor: pointer; font-weight: 800; }
th button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
th[aria-sort="ascending"] button::after { content: " ▲"; } th[aria-sort="descending"] button::after { content: " ▼"; }

/* Bar chart = a table whose middle cell is the bar. */
table.bars td.b { width: 55%; min-width: 90px; padding-inline: 6px; vertical-align: middle; }
table.bars .track { background: var(--track); border-radius: 4px; height: 12px; }
table.bars .fill { background: var(--bar); height: 12px; border-radius: 0 4px 4px 0; min-width: 2px; }
table.bars td, table.bars th { border-bottom: 0; padding-block: 5px; }
table.bars th { font-weight: 600; color: var(--fg); white-space: normal; text-align: left; }
table.bars caption, table caption { text-align: left; font-weight: 800; font-size: var(--step-0); padding-bottom: 8px; color: var(--fg); }
.heatwrap td[class^="h"] { color: var(--fg); }
/* mapa de calor do histórico: 21 passos, sem style inline (CSP sem unsafe-inline) */
.heat td.h0 { background: color-mix(in srgb, var(--s-charging) 0%, transparent); }
.heat td.h5 { background: color-mix(in srgb, var(--s-charging) 5%, transparent); }
.heat td.h10 { background: color-mix(in srgb, var(--s-charging) 10%, transparent); }
.heat td.h15 { background: color-mix(in srgb, var(--s-charging) 15%, transparent); }
.heat td.h20 { background: color-mix(in srgb, var(--s-charging) 20%, transparent); }
.heat td.h25 { background: color-mix(in srgb, var(--s-charging) 25%, transparent); }
.heat td.h30 { background: color-mix(in srgb, var(--s-charging) 30%, transparent); }
.heat td.h35 { background: color-mix(in srgb, var(--s-charging) 35%, transparent); }
.heat td.h40 { background: color-mix(in srgb, var(--s-charging) 40%, transparent); }
.heat td.h45 { background: color-mix(in srgb, var(--s-charging) 45%, transparent); }
.heat td.h50 { background: color-mix(in srgb, var(--s-charging) 50%, transparent); }
.heat td.h55 { background: color-mix(in srgb, var(--s-charging) 55%, transparent); }
.heat td.h60 { background: color-mix(in srgb, var(--s-charging) 60%, transparent); }
.heat td.h65 { background: color-mix(in srgb, var(--s-charging) 65%, transparent); }
.heat td.h70 { background: color-mix(in srgb, var(--s-charging) 70%, transparent); }
.heat td.h75 { background: color-mix(in srgb, var(--s-charging) 75%, transparent); }
.heat td.h80 { background: color-mix(in srgb, var(--s-charging) 80%, transparent); }
.heat td.h85 { background: color-mix(in srgb, var(--s-charging) 85%, transparent); }
.heat td.h90 { background: color-mix(in srgb, var(--s-charging) 90%, transparent); }
.heat td.h95 { background: color-mix(in srgb, var(--s-charging) 95%, transparent); }
.heat td.h100 { background: color-mix(in srgb, var(--s-charging) 100%, transparent); }
.mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }

/* ---- stat tiles ---- */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 0; padding: 0; list-style: none; }
@media (min-width: 760px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
.kpis li { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.kpis .v { font-size: var(--step-2); font-weight: 900; line-height: 1.1; display: block; }
.kpis .t { font-weight: 700; display: block; }
.kpis .s { color: var(--muted); font-size: .8rem; display: block; margin-top: 4px; }

.subnav { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0; position: sticky; top: 56px; background: var(--bg); z-index: 20; border-bottom: 1px solid var(--line); }
.subnav a { white-space: nowrap; padding: 8px 12px; border-radius: 999px; text-decoration: none; color: var(--fg); font-weight: 700; font-size: var(--step--1); min-height: 40px; display: inline-flex; align-items: center; border: 1px solid var(--line); }
.subnav a[aria-current] { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.subnav a.all { margin-left: auto; border-style: dashed; }

/* ---- Rede: summary on top, then one section at a time ---- */
.net .hero { padding: 20px 0 12px; }
.summary { padding-bottom: 14px; }
.summary .kpis li { padding: 10px 12px; }
.summary .kpis .t { font-size: var(--step--1); }
@media (min-width: 980px) { .summary .kpis { grid-template-columns: repeat(6, 1fr); } }
.summary .now { margin-top: 10px; padding: 12px 14px; }
.summary .now h3 { font-size: var(--step-0); margin-bottom: 8px; }
.summary .legend b { font-variant-numeric: tabular-nums; }
.summary .note { background: none; padding: 0; margin: 8px 0 0; max-width: none; }
.stack { display: flex; gap: 2px; height: 18px; border-radius: 6px; overflow: hidden; }
.stack i { flex: 1 0 3px; background: var(--c, var(--s-unknown)); }
.stack i[data-s="available"] { --c: var(--s-available); } .stack i[data-s="charging"] { --c: var(--s-charging); }
.stack i[data-s="outOfOrder"] { --c: var(--s-outOfOrder); } .stack i[data-s="inoperative"] { --c: var(--s-inoperative); }
.stack i[data-s="blocked"] { --c: var(--s-blocked); } .stack i[data-s="planned"] { --c: var(--s-planned); }
.stack i[data-s="removed"] { --c: var(--s-removed); } .stack i[data-s="shared"] { --c: var(--s-shared); }
.net section.block { padding: 20px 0; }
.net .card.wide { margin-top: var(--gap); }
.net .grid { align-content: start; }
.net table.bars td, .net table.bars th { padding-block: 3px; }
.tabbed section.block { display: none; border-top: 0; }
.tabbed section.block.on, .tabbed.all section.block { display: block; }
.tabbed.all section.block + section.block { border-top: 1px solid var(--line); }
details.fold { border: 1px solid var(--line); border-radius: var(--r); background: var(--card); margin-top: 10px; padding: 0 14px; }
details.fold > summary { cursor: pointer; min-height: 48px; display: flex; align-items: center; gap: 10px; padding: 8px 0; }
details.fold > summary::before { content: "+"; font-weight: 900; color: var(--ink); width: 1ch; flex: none; }
details.fold[open] > summary::before { content: "−"; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold h3 { font-size: var(--step-0); display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
details.fold[open] { padding-bottom: 12px; }
.panel table.cut tr:nth-child(n+12) { display: none; }
@media (min-width: 980px) { #factos ul { columns: 2; column-gap: 40px; } #factos li { break-inside: avoid; } }

/* ---- pre-rendered panels from the pipeline ---- */
.panel ul { padding-left: 1.2em; margin: 0; } .panel li { margin-bottom: .5em; max-width: 78ch; }
.panel ol { padding-left: 0; list-style: none; margin: 0; display: grid; gap: 10px; }
.panel ol > li, .panel > div > li { list-style: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin: 0 0 10px; }
.panel .head { font-weight: 800; margin-bottom: 4px; }
.panel .meta { color: var(--muted); font-size: var(--step--1); margin-bottom: 8px; max-width: 78ch; }
.panel li .meta { color: var(--fg); margin: 0; }
.panel table { margin: 8px 0 16px; display: block; overflow-x: auto; }
.panel .biglink { margin-top: 8px; font-weight: 700; }
.panel .mut { color: var(--muted); }

/* ---- operators ---- */
.sev { font-weight: 800; font-size: .78rem; border-radius: 6px; padding: 2px 8px; border: 1.5px solid currentColor; white-space: nowrap; }
.sev[data-sev="CRÍTICO"] { color: var(--sev-critico); } .sev[data-sev="ALTO"] { color: var(--sev-alto); }
.sev[data-sev="MÉDIO"] { color: var(--sev-medio); } .sev[data-sev="BAIXO"] { color: var(--sev-baixo); }
.finding { border-left: 4px solid var(--line); padding: 4px 0 4px 14px; margin: 0 0 16px; }
.finding h4 { margin: 0 0 6px; display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.finding p { font-size: var(--step--1); margin: 0 0 4px; }
tr.pick { cursor: pointer; } tr.pick:hover td { background: var(--bg-alt); }

footer { border-top: 1px solid var(--line); margin-top: 30px; padding: 22px 0 40px; color: var(--muted); font-size: var(--step--1); }
footer p { max-width: none; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
@media print { .top, .subnav, .mapbox, .tools, .chips, .viewswitch { display: none !important; } }
@media print { .tabbed section.block:not([hidden]) { display: block; } .panel table.cut tr:nth-child(n+12) { display: table-row; } }

/* Phones: results must start inside the first screen. */
@media (max-width: 619px) {
  .hero { padding: 16px 0 10px; } .hero p { font-size: var(--step-0); margin-bottom: 0; }
  #search .chips { flex-wrap: nowrap; overflow-x: auto; margin-inline: -16px; padding-inline: 16px; scrollbar-width: none; }
  #search .chips .btn { white-space: nowrap; }
  #search.card { padding: 12px; } .morefilters { margin-top: 4px; }
  .note { margin-top: 10px; }
}
table.kinds { margin-top: 18px; }
#cSession { margin-top: 16px; }
#cSession .seg { margin: 10px 0 4px; }
table.sess { margin-top: 14px; }

/* ---- Rede > Novidades: the last 24 h (rede.js renderDay) ---- */
.day { margin-bottom: 26px; }
.day > h3 { margin-bottom: 4px; }
.day .tally { list-style: none; padding: 0; margin: 14px 0 6px; display: flex; flex-wrap: wrap; gap: 8px; }
.day .tally li { margin: 0; }
.day .tally a { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); color: var(--fg); text-decoration: none; font-size: var(--step--1); }
.day .tally a:hover { border-color: var(--fg); }
.day .tally b { font-size: var(--step-1); font-weight: 900; font-variant-numeric: tabular-nums; }
.day .dgrid { display: grid; gap: 22px var(--gap); margin-top: 16px; }
@media (min-width: 900px) { .day .dgrid { grid-template-columns: 1fr 1fr; } }
.day .dgroup h4 { margin: 0 0 6px; display: flex; align-items: center; gap: 8px; }
.day .dgroup h4:focus { outline: none; }
.day .dgroup h4:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.day ul.rows { list-style: none; padding: 0; margin: 0 0 8px; border-top: 1px solid var(--line); }
.day ul.rows li { margin: 0; max-width: none; padding: 8px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 0 12px; }
.day ul.rows a { font-weight: 700; overflow-wrap: anywhere; }
.day ul.rows .where { grid-column: 1; color: var(--muted); font-size: var(--step--1); }
.day ul.rows .what { grid-column: 2; grid-row: 1 / span 2; align-self: center; text-align: right; font-size: var(--step--1); font-variant-numeric: tabular-nums; max-width: 24ch; }
.day ul.rows.cut li:nth-child(n+9) { display: none; }
.panel .weekh { margin-bottom: 8px; }
@media (max-width: 619px) { .day ul.rows li { grid-template-columns: 1fr; } .day ul.rows .what { grid-column: 1; grid-row: auto; text-align: left; max-width: none; } }
@media print { .day ul.rows.cut li { display: grid; } }

/* ---- Rede > Concelhos + card payment (rede.js fastCard/growthCard/cardPayCard) ---- */
#cFast, #cGrowth, #cCardPay { margin-top: 16px; }
#cGrowth .seg { margin: 10px 0 4px; }
table.conc { margin-top: 14px; }

/* Fotos no detalhe do posto (find.js photos()): miniaturas de 500 px, lado a lado. */
.detail .photos { display: flex; flex-wrap: wrap; gap: .75rem; margin: .75rem 0; }
.detail .photos > p { flex-basis: 100%; margin: 0; }
.detail .photo { margin: 0; flex: 0 1 15rem; max-width: 100%; }
.detail .photo img { display: block; width: 100%; height: 12rem; object-fit: cover; border-radius: .5rem; background: var(--line, #ddd); }
.detail .photo figcaption { margin-top: .25rem; }


/* Uso ao longo do tempo no detalhe (uso.js): barras empilhadas por estado, uma faixa
   por tomada, e o mapa dia da semana x hora. Estados pelas cores --s-<estado>. */
.uso { margin: .5rem 0 1rem; min-width: 0; }
.uso h4 { margin: 1rem 0 .4rem; }
.uso .uctl { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; margin-bottom: 8px; }
.uso .uctl .lbl { font-size: var(--step--1); color: var(--muted); font-weight: 700; margin-right: 4px; align-self: center; }
.uso .uctl label.field { min-width: 14rem; }
.uso .ulane { margin-top: 8px; }
.uchart { display: block; width: 100%; height: auto; max-width: 100%; color: var(--muted); }
.uchart text { fill: var(--muted); font: 600 11px "Nunito", system-ui, sans-serif; }
.uchart .ugrid { stroke: var(--line); stroke-width: 1; }
.uchart .uh { stroke: currentColor; stroke-width: 1.2; opacity: .45; }
.u-charging { fill: var(--s-charging); background: var(--s-charging); }
.u-available { fill: var(--s-available); background: var(--s-available); }
.u-down { fill: var(--s-outOfOrder); background: var(--s-outOfOrder); }
.u-shared { fill: var(--s-shared); background: var(--s-shared); }
.uso .ukey i.u-shared { box-shadow: inset 0 0 0 2px var(--s-charging); }
.u-unknown { fill: var(--s-unknown); background: var(--s-unknown); opacity: .55; }
.uchart .us { opacity: .65; }
.uso .ukey { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin: 8px 0; }
.uso .ukey > span { display: inline-flex; align-items: center; gap: 6px; }
.uso .ukey i { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
.uso .ukey i.una, .uso .sw.na, .uheat td.na { background: repeating-linear-gradient(135deg, transparent 0 3px, var(--muted) 3px 4px); box-shadow: inset 0 0 0 1px var(--muted); opacity: .55; }
.uso .sw { width: 16px; height: 16px; border-radius: 4px; display: inline-block; background: color-mix(in srgb, var(--bar) var(--k, 0%), var(--track)); }
.uheat { border-collapse: separate; border-spacing: 2px; width: 100%; min-width: 520px; table-layout: fixed; }
.uheat thead td:first-child, .uheat tbody th { width: 5.6em; }
.uheat th, .uheat td { border: 0; padding: 0; text-align: center; font-size: .72rem; color: var(--muted); font-weight: 600; }
.uheat tbody th { text-align: left; padding-right: 6px; white-space: nowrap; color: var(--fg); }
.uheat tbody td { height: 20px; border-radius: 3px; background: color-mix(in srgb, var(--bar) var(--k, 0%), var(--track)); }

/* Instalar app (install.js): footer button, phone banner and the steps dialog. */
.linkbtn { font: inherit; color: var(--ink); background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.linkbtn:hover { color: var(--ink-strong); }
.linkbtn[data-install-open] { display: none; }
:root[data-install="ready"] .linkbtn[data-install-open] { display: inline; }
.install-bar { position: fixed; z-index: 50; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 12px; padding: 10px 8px 10px 12px; background: var(--card); color: var(--fg); border: 1.5px solid var(--line); border-radius: var(--r); box-shadow: 0 12px 30px rgb(20 32 58 / .18); }
.install-bar img { border-radius: 22%; display: block; }
.install-bar p { margin: 0; font-size: var(--step--1); line-height: 1.35; color: var(--muted); }
.install-bar strong { display: block; color: var(--fg); font-size: var(--step-0); }
.install-x { width: 44px; height: 44px; border: 0; background: none; color: var(--muted); font-size: 1.5rem; line-height: 1; cursor: pointer; border-radius: 50%; }
.install-x:hover { color: var(--fg); background: var(--track); }
.install-dlg { width: min(440px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 20px 22px 18px; border: 0; border-radius: var(--r); background: var(--card); color: var(--fg); }
.install-dlg::backdrop { background: rgb(13 19 34 / .5); }
.install-dlg h2 { margin: 14px 0 6px; font-size: var(--step-1); }
.install-tile { display: grid; justify-items: center; gap: 6px; padding: 18px 0 12px; border-radius: var(--r-s); background: var(--bg-alt); }
.install-tile img { border-radius: 22%; box-shadow: 0 6px 16px rgb(20 32 58 / .18); }
.install-tile span { font-size: .75rem; font-weight: 700; }
.install-lede { margin: 0 0 14px; color: var(--muted); }
.install-steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 10px; }
.install-steps li { counter-increment: step; position: relative; min-height: 28px; padding: 3px 0 0 38px; }
.install-steps li::before { content: counter(step); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ink-soft); color: var(--ink-strong); font-weight: 800; font-size: var(--step--1); }
.install-list { margin: 0; padding-left: 1.2em; display: grid; gap: 8px; }
.install-note { margin: 12px 0 0; font-size: var(--step--1); color: var(--muted); }
.install-glyph { width: 1.25em; height: 1.25em; vertical-align: -.25em; padding: 1px; border: 1px solid var(--line); border-radius: 5px; color: var(--ink); }
.install-copy { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0 0; }
.install-copy code { flex: 1 1 12em; min-width: 0; overflow-wrap: anywhere; font-size: var(--step--1); padding: 6px 8px; border-radius: var(--r-s); background: var(--track); }
.install-actions { margin: 18px 0 0; display: flex; justify-content: flex-end; }
/* On a narrow phone the banner keeps the title and the button; the dialog says the rest. */
@media (max-width: 420px) { .install-bar { gap: 10px; } .install-bar p > strong ~ span { display: none; } }
@media (max-width: 600px) {
  .install-dlg { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: var(--r) var(--r) 0 0; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: no-preference) {
  .install-dlg[open] { transition: translate .22s ease-out; @starting-style { translate: 0 24px; } }
}
