/* Fontes servidas pela própria página (SIL OFL 1.1): nenhum terceiro. */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 700; font-display: swap; src: url(fontes/Inter-latin.woff2) format('woff2'); }
@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-weight: 500 800; font-display: swap; src: url(fontes/PlusJakartaSans-latin.woff2) format('woff2'); }

/* Tokens: a paleta Brasa v2 do portal.
   --acao = #C2410C (fundo que carrega rótulo e texto laranja em fundo claro);
   --acento = #EA580C (só não-texto: anel de foco, traço, borda). */
:root {
  --bg: #F1EBE0;            /* --background */
  --surface: #FFFDF8;       /* --card */
  --surface-2: #FAF6EE;     /* --secondary */
  --selecao: #FAF0E1;       /* --accent */
  --ink: #1B2333;
  --muted: #5B6475;
  --line: #E8DFCD;          /* --border */
  --acao: #C2410C;          /* --primary */
  --acao-hover: #9A3412;
  --acao-texto: #C2410C;
  --acento: #EA580C;        /* --ring, --brand-orange */
  --estrutura-texto: #1E3A8A; /* --brand-navy */
  --mar: #F6F0E4;
  --terra: #C9BCA4;
  --ok: #15803D;  --ok-texto: #15803D;  --ok-fundo: #E7F3EA;
  --alerta: #B45309; --alerta-texto: #92400E; --alerta-fundo: #FBF0DC;
  --falha: #DC2626; --falha-texto: #B91C1C; --falha-fundo: #FBE6E2;
  --sem-dado: #DDD3C2;
  --sem-dado-forte: #8F8470; /* a barra e o marcador do mapa: 3:1 contra o fundo */
  --sobre-icone: #FFFDF8;
  --sombra: 0 1px 2px rgba(120,90,40,.08), 0 8px 24px rgba(120,90,40,.10);
  --veu: rgba(27,35,51,.45);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #090E1A; --surface: #101829; --surface-2: #162036; --selecao: #1C2942; --ink: #E8ECF4; --muted: #9AA6BD; --line: #22304B;
    --acao: #C2410C; --acao-hover: #9A3412; --acao-texto: #FB923C; --acento: #FB923C; --estrutura-texto: #9DB4F2;
    --mar: #0D1526; --terra: #3A4D74;
    --ok: #4ADE80; --ok-texto: #4ADE80; --ok-fundo: #10291D;
    --alerta: #FBBF24; --alerta-texto: #FCD34D; --alerta-fundo: #2E2410;
    --falha: #F87171; --falha-texto: #FCA5A5; --falha-fundo: #33161A;
    --sem-dado: #2A3550;
    --sem-dado-forte: #64739A;
    --sobre-icone: #0B1220;
    --sombra: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.45);
    --veu: rgba(0,0,0,.6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 16px; line-height: 1.5; overflow-x: hidden; }
h1, h2, h3 { font-family: "Plus Jakarta Sans", Inter, system-ui, sans-serif; line-height: 1.25; margin: 0; }
a { color: var(--acao-texto); }
a:hover { color: var(--acao-hover); }
@media (prefers-color-scheme: dark) { a:hover { color: #FDBA74; } }
:focus-visible { outline: 3px solid var(--acento); outline-offset: 3px; border-radius: 6px; }
.so-leitor { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 16px 16px 40px; }
@media (min-width: 768px) { .wrap { padding: 24px 24px 56px; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--sombra); }
.pilha > * + * { margin-top: 16px; }
@media (min-width: 768px) { .pilha > * + * { margin-top: 20px; } }

/* ---------- Topo ---------- */
.topo { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.marca { font-family: "Plus Jakarta Sans", Inter, sans-serif; font-weight: 800; letter-spacing: .06em; font-size: 13px; color: var(--estrutura-texto); text-decoration: none; }
.marca:hover { color: var(--estrutura-texto); }
.topo-rot { font-size: 13px; color: var(--muted); }
@media (max-width: 435px) { .topo .topo-rot { display: none; } .numeros { grid-template-columns: auto auto; justify-content: start; column-gap: 28px; } .numeros dd { font-size: 20px; } .numeros dd small { display: block; font-size: 13px; } }


/* ---------- Estado geral ---------- */
.geral { padding: 20px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px 32px; }
.geral-cab { flex: 1 1 380px; }
@media (min-width: 768px) { .geral { padding: 28px 32px; } }
.geral-cab { display: flex; gap: 14px; align-items: flex-start; }
.selo { flex: none; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; }
.selo svg { width: 28px; height: 28px; }
.selo[data-e="ok"] { background: var(--ok-fundo); color: var(--ok); }
.selo[data-e="alerta"] { background: var(--alerta-fundo); color: var(--alerta); }
.selo[data-e="falha"] { background: var(--falha-fundo); color: var(--falha); }
.geral h1 { font-size: clamp(22px, 5.4vw, 30px); font-weight: 800; }
.geral-sub { margin: 4px 0 0; color: var(--muted); font-size: 15px; }
.numeros { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; }
@media (min-width: 436px) { .numeros { grid-template-columns: repeat(3, auto); gap: 12px 28px; } }
.numeros div { min-width: 0; }
.numeros dt { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.numeros dd { white-space: nowrap; margin: 2px 0 0; font-family: "Plus Jakarta Sans", Inter, sans-serif; font-weight: 800; font-size: 22px; font-variant-numeric: tabular-nums; }
.numeros dd small { font-size: 14px; font-weight: 700; color: var(--muted); }
@media (max-width: 435px) { .numeros div:first-child { grid-column: 1 / -1; } }

/* ---------- Mapa ---------- */
.mapa-card { padding: 18px 16px 16px; }
@media (min-width: 768px) { .mapa-card { padding: 24px 28px 24px; } }
.cab-sec { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; margin-bottom: 12px; }
.cab-sec h2 { font-size: 20px; font-weight: 700; }
.legenda { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); margin: 0; padding: 0; list-style: none; }
.legenda li { display: inline-flex; align-items: center; gap: 5px; }
.legenda svg { width: 16px; height: 16px; }
.ic-ok { color: var(--ok); } .ic-alerta { color: var(--alerta); } .ic-falha { color: var(--falha); }

.mapa { position: relative; border-radius: 14px; overflow: hidden; background: var(--mar); }
.mapa > svg.terra { display: block; width: 100%; height: auto; }
.terra path.blocos { stroke: var(--terra); stroke-width: 6; stroke-dasharray: 6 2; fill: none; }
.terra .elo { fill: none; stroke: var(--acento); stroke-width: 1.5; stroke-dasharray: 5 6; stroke-linecap: round; opacity: .85; animation: fluxo 1.6s linear infinite; }
@keyframes fluxo { to { stroke-dashoffset: -22; } }
.mapa svg.marcas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.marcas .guia { stroke: var(--muted); stroke-width: 1; opacity: .7; }
.marcas .nucleo { stroke: var(--surface); stroke-width: 2; }
.marcas .onda { fill: none; stroke-width: 2; transform-box: fill-box; transform-origin: center; animation: onda 2.6s ease-out infinite; }
.marcas [data-e="alerta"] .onda { animation-duration: 1.6s; }
.marcas [data-e="falha"] .onda { animation-duration: 1s; }
@keyframes onda { 0% { transform: scale(1); opacity: .75; } 100% { transform: scale(3.4); opacity: 0; } }
.marcas [data-e="ok"] { color: var(--ok); } .marcas [data-e="alerta"] { color: var(--alerta); } .marcas [data-e="falha"] { color: var(--falha); }

.ponto { position: absolute; top: 0; left: 0; display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 6px 12px 6px 9px; border-radius: 12px;
  background: var(--surface); color: var(--ink); border: 1.5px solid var(--line); box-shadow: var(--sombra); font: inherit; font-size: 14px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.ponto svg { width: 18px; height: 18px; flex: none; }
.ponto:hover { border-color: var(--acento); }
.ponto[aria-expanded="true"] { border-color: var(--acento); box-shadow: 0 0 0 3px rgba(234,88,12,.18), var(--sombra); }

.lugares { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.lugares { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
@media (min-width: 768px) { .lugares { gap: 14px; } }
.lugar { width: 100%; text-align: left; appearance: none; font: inherit; color: inherit; cursor: pointer; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 12px;
  padding: 12px 14px; min-height: 64px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.lugar:hover { border-color: var(--acento); }
.lugar > svg.est { width: 22px; height: 22px; grid-row: 1 / 4; }
.lugar-nome { font-weight: 700; font-size: 16px; }
.lugar-nome span { font-weight: 500; color: var(--muted); font-size: 14px; }
.lugar-info { grid-column: 2; font-size: 13px; color: var(--muted); }
.lugar > svg.ir { width: 18px; height: 18px; color: var(--muted); grid-row: 1 / 4; grid-column: 3; }

/* ---------- Incidentes ---------- */
.inc-card { padding: 18px 16px; }
@media (min-width: 768px) { .inc-card { padding: 24px 28px; } }
.incidentes { list-style: none; margin: 0; padding: 0; }
.incidentes > li + li { border-top: 1px solid var(--line); }
.incidentes details { padding: 12px 0; }
.incidentes summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: auto 1fr auto auto; grid-template-areas: "ic tit etq sv" "ic meta etq sv"; gap: 2px 12px; align-items: start; min-height: 44px; padding: 2px 0; }
@media (max-width: 435px) { .incidentes summary { grid-template-columns: auto 1fr auto; grid-template-areas: "ic tit sv" "ic meta sv" "ic etq sv"; } .incidentes summary .etiqueta { justify-self: start; margin-top: 4px; } }
.incidentes summary::-webkit-details-marker { display: none; }
.incidentes summary > svg.est { width: 20px; height: 20px; margin-top: 2px; grid-area: ic; }
.incidentes summary .etiqueta { grid-area: etq; align-self: start; }
.inc-tit { grid-area: tit; font-weight: 700; }
.inc-meta { grid-area: meta; font-size: 13px; color: var(--muted); }
.inc-fim { grid-area: sv; display: flex; align-items: center; padding-top: 2px; }
.inc-fim svg { width: 18px; height: 18px; color: var(--muted); transition: transform .15s ease; }
details[open] .inc-fim svg { transform: rotate(180deg); }
.etiqueta { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.etiqueta.viva { background: var(--alerta-fundo); color: var(--alerta-texto); border-color: transparent; }
.etiqueta.viva.f { background: var(--falha-fundo); color: var(--falha-texto); }
.linha-tempo { list-style: none; margin: 10px 0 2px 32px; padding: 0 0 0 16px; border-left: 2px solid var(--line); font-size: 14px; }
.linha-tempo li + li { margin-top: 8px; }
.linha-tempo b { display: block; font-size: 13px; }
.linha-tempo time { color: var(--muted); font-size: 13px; }
.mais { margin-top: 6px; appearance: none; background: none; border: 0; font: inherit; font-weight: 700; font-size: 15px; color: var(--acao-texto); min-height: 44px; padding: 8px 0; cursor: pointer; }
.mais:hover { color: var(--acao-hover); }


.fim { margin-top: 28px; text-align: center; font-size: 13px; color: var(--muted); }

/* ---------- Painel do ponto: folha de baixo no celular, gaveta à direita a partir de 768 ---------- */
dialog.painel { padding: 0; border: 0; margin: 0; max-width: none; max-height: none; background: var(--surface); color: var(--ink);
  position: fixed; inset: auto 0 0 0; width: 100%; max-height: 88dvh; border-radius: 22px 22px 0 0; box-shadow: 0 -10px 40px rgba(120,90,40,.25); overflow: hidden; display: none; flex-direction: column; }
dialog.painel[open] { display: flex; animation: subir .24s cubic-bezier(.2,.7,.2,1); }
dialog.painel::backdrop { background: var(--veu); }
@keyframes subir { from { transform: translateY(40px); opacity: 0; } }
@keyframes entrar { from { transform: translateX(40px); opacity: 0; } }
@media (min-width: 768px) {
  dialog.painel { inset: 0 0 0 auto; width: 460px; height: 100dvh; max-height: 100dvh; border-radius: 22px 0 0 22px; box-shadow: -10px 0 40px rgba(120,90,40,.25); }
  dialog.painel[open] { animation-name: entrar; }
  .alca { display: none; }
}
.alca { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 8px auto 0; flex: none; }
.p-cab { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--line); flex: none; }
.p-cab .selo { width: 40px; height: 40px; border-radius: 12px; }
.p-cab .selo svg { width: 22px; height: 22px; }
.p-cab h2 { font-size: 20px; font-weight: 800; }
.p-cab h2:focus { outline: none; }
.p-cab p { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.p-cab > div { flex: 1; min-width: 0; }
.fechar { flex: none; appearance: none; border: 0; background: var(--surface-2); color: var(--ink); width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; cursor: pointer; }
.fechar svg { width: 20px; height: 20px; }
.fechar:hover { background: var(--selecao); }
.p-corpo { overflow-y: auto; padding: 14px 16px 24px; overscroll-behavior: contain; }
@media (min-width: 768px) { .p-corpo { padding: 16px 20px 28px; } }
.servicos { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.servico { border: 1px solid var(--line); border-radius: 16px; padding: 14px; background: var(--surface); }
.s-cab { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.s-cab h3, .s-cab h4 { flex: 1; min-width: 0; margin: 0; font-family: "Plus Jakarta Sans", Inter, system-ui, sans-serif; font-size: 16px; font-weight: 700; line-height: 1.25; }
.sv { flex: none; width: 40px; height: 40px; }
.lugar-sv { display: flex; flex-wrap: wrap; gap: 2px; grid-column: 2; margin-top: 4px; }
.lugar-sv svg { width: 26px; height: 26px; }
.estado { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.estado svg { width: 16px; height: 16px; }
.estado[data-e="ok"] { color: var(--ok-texto); } .estado[data-e="alerta"] { color: var(--alerta-texto); } .estado[data-e="falha"] { color: var(--falha-texto); }
.estado[data-e="alerta"] svg { color: var(--alerta); } .estado[data-e="falha"] svg { color: var(--falha); }
.s-dados { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin: 12px 0 0; }
.s-dados div { min-width: 0; }
.s-dados dt { font-size: 12px; color: var(--muted); font-weight: 600; }
.s-dados dd { margin: 1px 0 0; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.s-dados dd small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
.barra { margin-top: 12px; }
.barra svg { display: block; width: 100%; height: 30px; }
.barra rect { fill: var(--ok); }
.barra rect.d-alerta { fill: var(--alerta); }
.barra rect.d-falha { fill: var(--falha); }
.barra rect.d-sem { fill: var(--sem-dado-forte); }
.barra-rot { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- Estados e blocos da página com dado real ---------- */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic-sem { color: var(--muted); }
.selo[data-e="sem_dado"] { background: var(--surface-2); color: var(--muted); }
.marcas [data-e="sem_dado"] { color: var(--sem-dado-forte); }
.marcas [data-e="sem_dado"] .onda { animation: none; opacity: 0; }
.estado[data-e="sem_dado"] { color: var(--muted); }
.estado[data-e="sem_dado"] svg { color: var(--muted); }
.atraso { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 14px; border-radius: 14px; background: var(--alerta-fundo); color: var(--alerta-texto); font-size: 14px; font-weight: 600; }
.atraso svg { width: 18px; height: 18px; flex: none; color: var(--alerta); }
.atualizado { font-variant-numeric: tabular-nums; }
.vazio { margin: 0; padding: 12px 0; color: var(--muted); font-size: 15px; }
.p-sec { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 4px 0 10px; }
.p-sec + .servicos, .recursos + .p-sec { margin-top: 0; }
.recursos { list-style: none; margin: 0 0 18px; padding: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); }
.recursos li { min-width: 0; }
.recursos .r-rot { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }
.recursos .r-val { display: block; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.recursos .r-val small { font-size: 12px; font-weight: 500; color: var(--muted); }
.uso { display: block; height: 6px; margin-top: 5px; border-radius: 3px; background: var(--sem-dado); overflow: hidden; }
.uso svg { display: block; width: 100%; height: 6px; }
.uso rect { fill: var(--ok); }
.uso rect.u-alerta { fill: var(--alerta); }
.uso rect.u-falha { fill: var(--falha); }
.contagem { font-weight: 600; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.novo { display: inline-block; margin-left: 6px; vertical-align: 2px; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--selecao); color: var(--acao-texto); border: 1px solid var(--line); }
.s-parte { margin: 6px 0 0; font-size: 13px; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .novo { animation: none; }
  .terra .elo, .marcas .onda, dialog.painel[open] { animation: none; }
  .marcas .onda { opacity: 0; }
  .inc-fim svg { transition: none; }
}
