/* ============================================================
   UPDOWN NOC — Layouts por tela
   ============================================================ */

/* ---------------------------------------------------------
   1. Autenticação (login / nova senha)
   --------------------------------------------------------- */
/* Um fundo só para a tela inteira: a pintura e a malha de rede atravessam as
   duas colunas, então não existe mais divisória entre marca e formulário — a
   grade continua servindo só para posicionar o conteúdo.
   O painel de marca leva ~65% porque os recursos ficam numa fila só e precisam
   da largura; o piso de 448px na coluna do formulário existe para que essa
   folga nunca seja tirada do card de acesso (400px + respiro lateral). */
.auth {
  position: relative;
  overflow: hidden;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(448px, 1fr);
  background: var(--auth-bg);
  color: var(--text-1);
}

.auth-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--s-10) clamp(var(--s-6), 3.4vw, var(--s-12));
}
/* Classe, não a tag `h1`: é a manchete decorativa do painel de marca, e a
   página já tem seu próprio `<h1>` no formulário — duas por página quebra a
   hierarquia de títulos para quem navega por leitor de tela. */
.auth-tagline {
  display: block;
  font-size: clamp(var(--fs-32), 3.4vw, var(--fs-44));
  font-weight: 700;
  letter-spacing: -.035em;
  line-height: var(--lh-tight);
  max-width: 12ch;
  margin: var(--s-5) 0 var(--s-4);
}
.auth-tagline em {
  font-style: normal;
  background: linear-gradient(90deg, var(--text-1), var(--cyan-400));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.auth-visual p { color: var(--text-2); font-size: var(--fs-14); max-width: 46ch; }

/* A malha nasce dentro do painel de marca, mas o fundo não termina mais no meio
   da tela: `width: 100vw` a partir da borda esquerda faz o desenho atravessar a
   página inteira, senão os traços apareceriam cortados no ar na antiga costura.
   O `.auth` recorta o excedente e o `z-index: 0` mantém a arte atrás de tudo. */
.auth-net {
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 0;
  width: 100vw;
  pointer-events: none;
  opacity: .9;
}
.auth-net svg { width: 100%; height: 100%; }
.net-edge { fill: none; stroke: rgba(80, 190, 255, .22); stroke-width: 1.2; }
.net-edge.is-hot { stroke: rgba(29, 201, 255, .55); stroke-width: 1.8; }
.net-node { fill: #071b2c; stroke: #55d0ff; stroke-width: 1.4; }
.net-core { fill: rgba(17, 129, 255, .16); stroke: #1dc9ff; stroke-width: 1.6; }
.net-label { fill: var(--text-3); font: 700 9px var(--font-mono); letter-spacing: .08em; }

/* No tema claro a malha some sobre o fundo pálido: traço mais firme e nó branco
   devolvem o desenho sem mexer no SVG da página. */
:root[data-theme="light"] .net-edge { stroke: rgba(11, 116, 255, .26); }
:root[data-theme="light"] .net-edge.is-hot { stroke: rgba(11, 116, 255, .5); }
:root[data-theme="light"] .net-node { fill: #ffffff; stroke: var(--brand-500); }
:root[data-theme="light"] .net-core { fill: rgba(11, 116, 255, .12); stroke: var(--brand-500); }
:root[data-theme="light"] .net-pulse { fill: var(--brand-500); filter: none; }
.net-pulse { fill: #6adfff; filter: drop-shadow(0 0 6px #1dc9ff); }
.net-pulse-anim { animation: net-travel 4.6s linear infinite; }
.net-pulse-anim.d2 { animation-delay: -1.6s; }
.net-pulse-anim.d3 { animation-delay: -3.1s; }
@keyframes net-travel {
  0% { transform: translate(0, 0); opacity: 0; }
  12% { opacity: 1; }
  84% { opacity: 1; }
  100% { transform: translate(250px, 96px); opacity: 0; }
}

/* Uma fila só: `grid-auto-flow: column` mantém os recursos lado a lado sem
   depender da quantidade — o login tem cinco, a troca de senha tem três — e
   `minmax(0, 1fr)` deixa cada coluna encolher para quebrar a descrição em
   linhas em vez de estourar a largura do painel. */
.auth-stats {
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: var(--s-5);
}
.auth-stats div { min-width: 0; }
.auth-stats strong {
  display: block;
  font-size: clamp(var(--fs-16), 1.35vw, var(--fs-24));
  letter-spacing: -.03em;
}
/* `--text-2`, não `--text-3`: com o fundo claro do tema light a descrição de
   11px caía para 2.7:1 de contraste sobre a pintura da tela. */
.auth-stats small {
  color: var(--text-2);
  font-size: var(--fs-11);
  text-transform: uppercase;
  letter-spacing: .06em;
  overflow-wrap: break-word;
}

/* Sem superfície própria: o painel de acesso é só uma área de posicionamento
   sobre o fundo comum. O `z-index` o mantém acima da malha, que agora passa por
   baixo dele. */
.auth-panel {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  padding: var(--s-8) var(--s-6);
  background: transparent;
}
/* O card recupera a legibilidade que a antiga faixa sólida dava ao formulário:
   vidro sobre a arte, em vez de um segundo fundo colado ao primeiro. */
.auth-card {
  width: min(400px, 100%);
  padding: var(--s-8);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--surface-glass);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-3);
}
.auth-card .brand { display: none; margin-bottom: var(--s-6); }
.auth-form { display: grid; gap: var(--s-4); margin-top: var(--s-6); }
.auth-foot {
  margin-top: var(--s-6);
  padding-top: var(--s-5);
  border-top: 1px solid var(--line);
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
  color: var(--text-3);
  font-size: var(--fs-11);
  line-height: 1.5;
}
.auth-foot .shield {
  width: 26px; height: 26px;
  flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--info-line);
  border-radius: var(--r-sm);
  color: var(--cyan-400);
}

.alert {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--danger-line);
  border-radius: var(--r-md);
  background: var(--danger-bg);
  color: var(--danger-text);
  font-size: var(--fs-12);
  line-height: 1.5;
  animation: shake var(--dur-3) var(--ease);
}
.alert-info { border-color: var(--info-line); background: var(--info-bg); color: var(--info-text); }
.alert-warn { border-color: var(--warn-line); background: var(--warn-bg); color: var(--warn-text); }
@keyframes shake {
  0%, 100% { transform: none; }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.caps-warn { display: flex; gap: 6px; align-items: center; color: var(--warn-text); font-size: var(--fs-11); }

/* Força da senha: barra + lista de requisitos com estado explícito */
.strength { display: grid; gap: var(--s-2); }
.strength-bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.strength-bars i { height: 4px; border-radius: var(--r-full); background: var(--surface-3); transition: background var(--dur-2) var(--ease); }
.strength[data-level="1"] .strength-bars i:nth-child(-n+1) { background: var(--danger-500); }
.strength[data-level="2"] .strength-bars i:nth-child(-n+2) { background: var(--warn-500); }
.strength[data-level="3"] .strength-bars i:nth-child(-n+3) { background: var(--cyan-400); }
.strength[data-level="4"] .strength-bars i { background: var(--ok-500); }
.strength-label { font-size: var(--fs-11); color: var(--text-3); }
.reqs { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.reqs li { display: flex; gap: var(--s-2); align-items: center; font-size: var(--fs-11); color: var(--text-3); }
.reqs li .icon { width: 14px; height: 14px; }
.reqs li.is-ok { color: var(--ok-text); }

@media (max-width: 980px) {
  .auth { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .auth-card .brand { display: inline-flex; }
  .auth-panel { align-items: start; padding-top: var(--s-10); }
}

/* ---------------------------------------------------------
   2. Topologia
   --------------------------------------------------------- */
/* A tela da topologia é desenhada para caber exatamente na janela, sem rolagem.
   Por isso a altura desconta as duas barras fixas: o appbar em cima e, no
   celular, a navegação inferior (`--mobile-nav-h` vale 0 no desktop). Com
   `100vh` os últimos ~70px — onde ficam os controles de zoom — ficavam atrás
   da barra inferior; `dvh` ainda evita o mesmo corte quando a barra de
   endereço do navegador móvel se recolhe. */
.topo-layout {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: calc(100dvh - var(--appbar-h) - var(--mobile-nav-h));
}
.topo-toolbar {
  position: relative;
  z-index: 12;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
  padding: var(--s-3) var(--s-5);
  border-bottom: 1px solid var(--line);
  background: var(--surface-glass);
}
.topo-filter-toggle {
  gap: 7px;
}
.topo-filter-toggle[aria-expanded="true"],
.topo-filter-toggle.has-active {
  border-color: var(--cyan-400);
  color: var(--text-1);
  background: var(--info-bg);
}
.topo-filter-toggle .icon { width: 15px; height: 15px; }
.topo-filter-count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--r-full);
  background: var(--cyan-400);
  color: #04101c;
  font: 800 var(--fs-10)/18px var(--font-mono);
  text-align: center;
}
.topo-filter-panel {
  position: absolute;
  z-index: 13;
  top: 100%;
  left: 0;
  right: 0;
  display: grid;
  grid-template-rows: 0fr;
  padding: 0 var(--s-5);
  background: var(--surface-glass);
  border-bottom: 1px solid transparent;
  box-shadow: none;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  visibility: hidden;
  pointer-events: none;
  transition: grid-template-rows var(--dur-2) var(--ease-out),
              padding var(--dur-2) var(--ease-out),
              border-color var(--dur-2) var(--ease-out),
              box-shadow var(--dur-2) var(--ease-out),
              visibility 0s var(--dur-2);
}
.topo-filter-panel.is-open {
  grid-template-rows: 1fr;
  padding-top: var(--s-3);
  padding-bottom: var(--s-3);
  border-bottom-color: var(--line-strong);
  box-shadow: var(--shadow-3);
  visibility: visible;
  pointer-events: auto;
  transition: grid-template-rows var(--dur-2) var(--ease-out),
              padding var(--dur-2) var(--ease-out),
              border-color var(--dur-2) var(--ease-out),
              box-shadow var(--dur-2) var(--ease-out),
              visibility 0s;
}
.topo-filter-panel-inner {
  min-height: 0;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  overflow: hidden;
  border-top: 0 solid transparent;
  transition: padding-top var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out);
}
.topo-filter-panel.is-open .topo-filter-panel-inner {
  border-top-color: transparent;
}
.topo-filter-search { flex: 0 1 280px; min-width: 220px; }
.topo-filter-categories { flex: 1 1 420px; gap: 6px; }
.topo-filter-summary {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--s-2);
  flex: none;
  font-size: var(--fs-11);
  white-space: nowrap;
}
.topo-filter-panel-inner-fibra {
  align-items: stretch;
  gap: var(--s-5);
}
.topo-filter-fibra {
  flex: 1 1 560px;
  max-height: 250px;
  overflow: auto;
  padding-right: var(--s-2);
}
.topo-filter-equipment {
  flex: 1 1 420px;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding-left: var(--s-4);
  border-left: 1px solid var(--line);
}
.topo-filter-equipment .topo-filter-search { flex: none; width: 100%; }
.topo-filter-results {
  flex: 1 1 340px;
  min-width: 280px;
  max-height: 220px;
  overflow: auto;
  padding-left: var(--s-4);
  border-left: 1px solid var(--line);
}
.topo-filter-results .list-group:last-child { margin-bottom: 0; }
.topo-filter-results-equipment {
  flex: none;
  width: 100%;
  min-width: 0;
  max-height: 170px;
  padding: var(--s-2) 0 0;
  border-left: 0;
  border-top: 1px solid var(--line);
}
.topo-main {
  display: grid;
  grid-template-columns: 312px minmax(0, 1fr);
  min-height: 0;
}
.topology-no-sidebar .topo-main {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}
.topology-no-sidebar .topo-stage,
.topology-no-sidebar #listView {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  min-height: 0;
}
.topo-main.is-side-hidden { grid-template-columns: minmax(0, 1fr); }
.topo-main.is-side-hidden .topo-side { display: none; }
.topo-side {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-4);
  border-right: 1px solid var(--line);
  background: var(--surface-glass);
  overflow: hidden auto;
}
.topo-side-scroll { overflow: auto; margin: 0 calc(var(--s-2) * -1); padding: 0 var(--s-2); }

/* Abaixo de 1100px a lista deixa de ser coluna e vira painel sobreposto ao
   mapa, aberto e fechado pelo mesmo botão da barra de ferramentas. Antes ela
   era simplesmente escondida: no tablet e no celular não havia caminho nenhum
   para a lista de equipamentos, e o botão de mostrar/ocultar não fazia nada. */
@media (max-width: 1100px) {
  .topo-main { position: relative; grid-template-columns: minmax(0, 1fr); }
  .topo-side {
    position: absolute;
    z-index: 8;
    top: 0; left: 0; bottom: 0;
    width: min(320px, 86vw);
    border-right: 1px solid var(--line-strong);
    background: var(--surface-1);
    box-shadow: var(--shadow-3);
    transition: transform var(--dur-2) var(--ease-out);
  }
  /* Fechado: sai da tela e sai também da ordem de tabulação. O `visibility`
     não entra na transição — ele espera o deslize terminar para virar
     `hidden` (`0s var(--dur-2)`) e volta a `visible` na hora ao abrir. Deixá-lo
     interpolando faria o painel sumir antes de deslizar. */
  .topo-main.is-side-hidden .topo-side {
    display: flex;
    visibility: hidden;
    transform: translateX(-100%);
    transition: transform var(--dur-2) var(--ease-out), visibility 0s var(--dur-2);
  }
}

@media (max-width: 760px) {
  .topo-filter-panel-inner {
    align-items: stretch;
    flex-direction: column;
    gap: var(--s-2);
  }
  .topo-filter-search,
  .topo-filter-categories { flex: none; width: 100%; min-width: 0; }
  .topo-filter-summary { justify-content: space-between; }
  .topo-filter-results {
    flex: none;
    width: 100%;
    min-width: 0;
    max-height: 200px;
    padding: var(--s-3) 0 0;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .topo-filter-panel-inner-fibra { gap: var(--s-3); }
  .topo-filter-fibra { flex: none; width: 100%; max-height: 220px; }
  .topo-filter-equipment {
    flex: none;
    width: 100%;
    min-width: 0;
    padding: var(--s-3) 0 0;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

.topo-stage {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 22% 30%, rgba(11, 116, 255, .10), transparent 45%),
    radial-gradient(circle at 78% 70%, rgba(29, 201, 255, .07), transparent 45%);
  cursor: grab;
  touch-action: none;
}
.topo-stage.is-panning { cursor: grabbing; }
.topo-world {
  position: absolute;
  top: 0; left: 0;
  width: 2400px;
  height: 520px;
  transform-origin: 0 0;
  transition: transform var(--dur-3) var(--ease-out);
}
.topo-world.no-anim { transition: none; }
.topo-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }

.topo-edge {
  fill: none;
  stroke: var(--line-strong);
  stroke-width: 2;
  cursor: pointer;
  transition: stroke var(--dur-2) var(--ease), stroke-width var(--dur-2) var(--ease);
}
.topo-edge:hover, .topo-edge.is-active { stroke: var(--cyan-400); stroke-width: 3; }
.topo-edge.is-dim { opacity: .18; }
/* Rota do anel óptico: tracejada e roxa, para não se confundir com enlace lógico */
.topo-edge.is-ring {
  stroke: var(--purple-400);
  stroke-width: 2;
  stroke-dasharray: 9 7;
  opacity: .65;
}
.topo-edge.is-ring:hover { opacity: 1; stroke-width: 3; }
.topo-flow {
  fill: none;
  stroke: var(--cyan-400);
  stroke-width: 2;
  stroke-dasharray: 5 16;
  opacity: .75;
  animation: flow 1.5s linear infinite;
  pointer-events: none;
}
@keyframes flow { to { stroke-dashoffset: -21; } }
.topo-edge-label { font: 700 10px var(--font-mono); fill: var(--text-3); pointer-events: none; }
.topo-edge-chip { fill: var(--surface-2); stroke: var(--line); }

/* Caixa de localidade (POP / site) — nível 1 do mapa */
.topo-site {
  position: absolute;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--surface-glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-2);
  transition: box-shadow var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease), opacity var(--dur-2) var(--ease);
}
.topo-site.is-core { border-color: rgba(11, 116, 255, .55); }
.topo-site.is-core::before {
  content: "";
  position: absolute; inset: -1px;
  border-radius: inherit;
  background: linear-gradient(160deg, rgba(11, 116, 255, .14), transparent 55%);
  pointer-events: none;
}
.topo-site.is-expanded { background: var(--surface-1); border-color: var(--cyan-400); }
.topo-site.is-dim { opacity: .35; }

.site-head {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  width: 100%;
  padding: var(--s-4);
  border: 0;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: transparent;
  color: inherit;
  text-align: left;
}
.site-head:hover { background: var(--surface-2); }
.site-head[disabled] { opacity: .6; cursor: not-allowed; }
.site-head b { font-size: var(--fs-14); letter-spacing: -.01em; }
.site-chevron { display: grid; place-items: center; width: 26px; height: 26px; border-radius: var(--r-sm); background: var(--surface-3); color: var(--cyan-400); flex: none; }
.site-metrics { display: flex; gap: var(--s-4); text-align: right; flex: none; }
.site-metrics strong { display: block; font-size: var(--fs-16); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.site-metrics small { display: block; font-size: var(--fs-10); color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.site-foot { display: flex; align-items: center; gap: var(--s-3); margin-top: auto; padding: 0 var(--s-4) var(--s-4); }

/* Equipamento dentro da localidade — nível 2 */
.topo-device {
  position: absolute;
  width: 190px;
  height: 118px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: var(--s-3);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  text-align: left;
  overflow: hidden;
  transition: transform var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease), opacity var(--dur-2) var(--ease);
}
.topo-device:hover { transform: translateY(-2px); border-color: var(--cyan-400); }
.topo-device.is-active { border-color: var(--cyan-400); box-shadow: 0 0 0 3px rgba(29, 201, 255, .2); }
.topo-device.is-dim { opacity: .3; }
.topo-device b { font-size: var(--fs-13); }
.topo-device small { font-size: var(--fs-10); }
.topo-device .meter { margin-top: auto; }

.topo-node {
  position: absolute;
  width: 210px;
  height: 150px;
  overflow: hidden;
  padding: var(--s-4);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface-1);
  box-shadow: var(--shadow-2);
  text-align: left;
  transition: transform var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease), opacity var(--dur-2) var(--ease);
}
.topo-node:hover { transform: translateY(-3px); border-color: var(--cyan-400); }
.topo-node.is-active { border-color: var(--cyan-400); box-shadow: 0 0 0 3px rgba(29, 201, 255, .22), var(--shadow-2); }
.topo-node.is-dim { opacity: .32; }
.topo-node .node-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); }
.topo-node h3 { font-size: var(--fs-14); margin: var(--s-2) 0 2px; }
.topo-node p { font-size: var(--fs-11); color: var(--text-3); }
.topo-node .node-meter { margin-top: var(--s-3); }
.topo-node .node-ports {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-10);
  color: var(--text-3);
  margin-top: 6px;
  font-family: var(--font-mono);
}
.topo-node.is-core { border-color: rgba(11, 116, 255, .5); background: linear-gradient(160deg, rgba(11, 116, 255, .12), var(--surface-1) 55%); }
.topo-node.is-pop { border-color: rgba(165, 107, 255, .45); }

.topo-hud {
  position: absolute;
  right: var(--s-4);
  bottom: var(--s-4);
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2);
  border-radius: var(--r-md);
}
.topo-legend {
  position: absolute;
  left: var(--s-4);
  right: 190px;
  bottom: var(--s-4);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  font-size: var(--fs-11);
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--s-4);
  white-space: nowrap;
  overflow-x: auto;
  width: max-content;
  max-width: calc(100% - 222px);
}
.topo-legend .row { gap: var(--s-2); }

@media (max-width: 760px) {
  .topo-legend {
    left: var(--s-3);
    right: 150px;
    bottom: var(--s-3);
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: var(--s-4);
    white-space: nowrap;
    width: auto;
    max-width: none;
  }
}

/* Barra de edição do layout do mapa (posição dos POPs) */
.topo-layout-bar {
  left: var(--s-4);
  right: auto;
  bottom: var(--s-4);
  flex-wrap: wrap;
  max-width: calc(100% - var(--s-6) * 2);
  padding: var(--s-2) var(--s-3);
}

/* Modo de edição: o cabeçalho do POP vira alça de arrasto */
.topo-stage.is-editing-layout .site-head { cursor: grab; }
.topo-stage.is-editing-layout .site-head[disabled] { opacity: 1; cursor: grab; }
.topo-site.is-dragging {
  cursor: grabbing;
  z-index: 6;
  box-shadow: 0 0 0 2px var(--cyan-400), var(--shadow-2);
  transition: none;
}
.topo-site.is-placed { border-style: dashed; }
.site-grip {
  position: absolute;
  top: 6px;
  right: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  color: var(--text-3);
  font-size: var(--fs-10);
  letter-spacing: .04em;
  text-transform: uppercase;
  pointer-events: none;
}

/* ---------- Mapa com fundo geográfico (OpenStreetMap) ----------
   A camada de tiles mora dentro do mundo da topologia: herda o mesmo
   translate/scale das caixas dos POPs e nunca desliza em relação a elas. */
.topo-basemap {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: visible;
  pointer-events: none;
}
.topo-basemap img {
  position: absolute;
  max-width: none;
  opacity: 0;
  transition: opacity var(--dur-2) var(--ease-out);
}
.topo-basemap img.is-ready { opacity: 1; }

/* O tile do OSM é claro. No tema escuro ele é invertido para virar um fundo
   escuro coerente com a interface — e recuado, para as caixas continuarem
   sendo o elemento mais forte da tela. */
:root[data-theme="dark"] .topo-basemap {
  filter: invert(1) hue-rotate(180deg) brightness(.78) contrast(.88) saturate(.7);
}
:root[data-theme="dark"] .topo-basemap img.is-ready { opacity: .78; }
:root[data-theme="light"] .topo-basemap img.is-ready { opacity: .9; }

/* Alfinete: marca o ponto exato da coordenada cadastrada, já que a caixa do
   POP cresce ao ser expandida e deixa de ser centrada nele. */
.site-pin {
  position: absolute;
  left: 50%;
  top: 46px;
  z-index: 3;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  border: 2px solid var(--surface-1);
  background: var(--cyan-400);
  box-shadow: 0 0 0 2px rgba(29, 201, 255, .35);
  pointer-events: none;
}
.topo-site.is-locating .site-pin { background: var(--purple-400); box-shadow: 0 0 0 3px rgba(165, 107, 255, .4); }

/* Alfinete do POP no mapa geográfico — nível 0, antes do card.
   A cor diz o estado operacional vindo do Zabbix (regras mais abaixo) e o
   número, a quantidade de equipamentos. */
.topo-marker {
  position: absolute;
  display: grid;
  place-items: center;
  padding: 0;
  border: 2px solid var(--cyan-400);
  border-radius: 50%;
  background: var(--surface-1);
  color: var(--cyan-400);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .45), 0 0 0 4px rgba(29, 201, 255, .16);
  cursor: pointer;
  transition: transform var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease);
}
.topo-marker:hover, .topo-marker:focus-visible {
  transform: scale(1.12);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .5), 0 0 0 6px rgba(29, 201, 255, .26);
}
.topo-marker.is-locating { border-color: var(--purple-400); color: var(--purple-400); border-style: dashed; }
.topo-marker.is-dim { opacity: .35; }
.topo-marker .icon { width: 20px; height: 20px; }
.topo-marker .marker-count {
  position: absolute;
  top: -5px; right: -5px;
  min-width: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--cyan-400);
  color: var(--bg);
  font: 700 var(--fs-10) / 18px var(--font-mono);
  text-align: center;
}
/* O nome fica fora do círculo e não recebe clique, para não crescer o alvo */
.topo-marker .marker-label {
  position: absolute;
  top: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  max-width: 190px;
  padding: 1px 6px;
  border-radius: var(--r-sm);
  background: var(--surface-glass);
  color: var(--text-1);
  font: 700 var(--fs-10) var(--font-sans);
  white-space: nowrap;
  pointer-events: none;
}
.topo-stage.is-editing-layout .topo-marker { cursor: grab; }
.topo-marker.is-dragging { cursor: grabbing; z-index: 6; transition: none; }

/* Fecha o card e devolve o POP ao alfinete */
.site-close {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text-3);
  cursor: pointer;
}
.site-close:hover { color: var(--text-1); border-color: var(--cyan-400); }
.site-close .icon { width: 14px; height: 14px; }
/* No modo de localização o canto superior direito é da alça de arrasto */
.topo-stage.is-editing-layout .site-close { display: none; }

/* Lista de POPs que ainda não podem ser desenhados no mapa geográfico */
.topo-missing {
  right: auto;
  bottom: auto;
  left: var(--s-4);
  top: var(--s-4);
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  max-width: 300px;
  padding: var(--s-3);
  font-size: var(--fs-11);
}
.topo-missing .row-between { gap: var(--s-3); }

/* No mapa geográfico a atribuição ocupa a base da tela: os controles sobem
   uma linha para não ficarem por cima dela. A lista de POPs fora do mapa fica
   no topo e não entra nessa conta. */
.topo-stage.is-geo .topo-hud:not(.topo-missing) { bottom: calc(var(--s-4) + 20px); }

.topo-attrib {
  position: absolute;
  right: var(--s-4);
  bottom: 2px;
  z-index: 2;
  padding: 2px 6px;
  border-radius: var(--r-sm);
  background: var(--surface-glass);
  color: var(--text-3);
  font-size: var(--fs-10);
}
/* `display: inline-block` + preenchimento vertical: sem isso a área de toque
   do link herdava só a altura da linha de texto (~14px), abaixo do mínimo
   utilizável no celular. */
.topo-attrib a { color: inherit; display: inline-block; padding: 5px 0; }

/* Barra de edição (sequência de POPs, anel) */
.edit-bar {
  position: sticky;
  top: var(--s-3);
  z-index: 3;
  border-color: var(--cyan-400);
}

/* Anel óptico editável: cada nó vira alvo de arrasto */
.ring-svg.is-editing .ring-node { cursor: grab; }
.ring-svg.is-editing .ring-node:active { cursor: grabbing; }
.ring-svg.is-editing .ring-node circle { stroke-width: 2.2; }
.ring-svg .ring-node.is-dragging circle { fill: var(--surface-3); }

/* Porta física — grade que espelha a face do equipamento */
.port-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 6px;
}

/* OLT modular: cada placa vira um bloco próprio, na mesma organização do
   "Gerenciar portas" — reaproveita .slot-numero/.slot-tipo/.slot-tecnologia/
   .slot-qtd já usados lá. */
.port-slot-groups {
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
}
.port-slot-header {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding-bottom: var(--s-2);
  margin-bottom: var(--s-3);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.port {
  position: relative;
  aspect-ratio: 1.5;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: var(--fs-11);
  font-weight: 700;
  transition: transform var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
.port:hover { transform: translateY(-2px); border-color: var(--cyan-400); color: var(--text-1); }
.port.is-used {
  background: var(--grad-brand-soft);
  border-color: var(--info-line);
  color: var(--cyan-300);
}
.port.is-used::after {
  content: "";
  position: absolute;
  top: 4px; right: 4px;
  width: 5px; height: 5px;
  border-radius: var(--r-full);
  background: var(--ok-500);
}
.port.is-alert { border-color: var(--danger-line); background: var(--danger-bg); color: var(--danger-text); }
.port[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--cyan-400); }
:root[data-theme="light"] .port.is-used { color: var(--brand-600); }

/* Tráfego por porta: a borda esquerda segue a escala de utilização dos
   enlaces (verde -> amarelo -> vermelho) via --port-traf, definido inline
   pela topologia. A cor é a mesma da legenda, para o operador ler a porta
   como lê um enlace. */
.port.is-traf { border-left-width: 4px; border-left-color: var(--port-traf); }
.port-traf {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: var(--fs-11);
  font-weight: 700;
  color: var(--text-1);
}
.port-traf::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: var(--r-full);
  background: var(--port-traf);
  box-shadow: 0 0 6px var(--port-traf);
}

.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: var(--s-3); }
.kv > div {
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.kv label { display: block; font-size: var(--fs-10); text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); font-weight: 800; }
.kv strong { display: block; font-size: var(--fs-16); margin-top: 4px; letter-spacing: -.02em; }
.kv .unit { font-size: var(--fs-11); color: var(--text-3); font-weight: 500; }

/* Lista lateral de equipamentos, agrupada por localidade */
.device-list { display: grid; gap: var(--s-2); }
.list-group { display: grid; gap: var(--s-2); margin-bottom: var(--s-4); }
.list-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  font-size: var(--fs-10);
  font-weight: 800;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-3);
}
.device-item {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: var(--s-3);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-1);
  text-align: left;
  transition: border-color var(--dur-1) var(--ease), background var(--dur-1) var(--ease);
}
.device-item:hover { border-color: var(--cyan-400); background: var(--surface-2); }
.device-item[aria-current="true"] { border-color: var(--cyan-400); background: var(--grad-brand-soft); }
.device-item b { font-size: var(--fs-13); }
.device-item small { color: var(--text-3); font-size: var(--fs-11); }

/* ---------------------------------------------------------
   3. Dashboard NOC
   --------------------------------------------------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: var(--s-4);
}
.kpi {
  padding: var(--s-5);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: linear-gradient(160deg, var(--surface-2), var(--surface-1) 70%);
}
.kpi label { font-size: var(--fs-10); font-weight: 800; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--text-3); }
.kpi strong {
  display: block;
  margin-top: var(--s-2);
  font-size: var(--fs-32);
  letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
}
.kpi .kpi-foot { margin-top: var(--s-2); font-size: var(--fs-11); color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.kpi.is-accent { border-color: var(--info-line); background: linear-gradient(160deg, rgba(11, 116, 255, .18), var(--surface-1) 70%); }

.pop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--s-4);
}
.pop-card { display: flex; flex-direction: column; gap: var(--s-4); padding: var(--s-5); }
.pop-card-head { display: flex; align-items: flex-start; gap: var(--s-3); }
.pop-marker { width: 4px; align-self: stretch; border-radius: var(--r-full); background: var(--grad-brand); }
.pop-marker.purple { background: linear-gradient(180deg, #a56bff, #6f4bff); }
.pop-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-2); }
.pop-stats > div { text-align: center; padding: var(--s-2); border-radius: var(--r-sm); background: var(--surface-2); }
.pop-stats span { display: block; font-size: var(--fs-10); color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.pop-stats strong { font-size: var(--fs-16); font-variant-numeric: tabular-nums; }

.device-row {
  display: grid;
  gap: var(--s-2);
  padding: var(--s-3);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.device-row .row-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.device-row b { font-size: var(--fs-13); }
.device-row small { color: var(--text-3); font-size: var(--fs-11); }

.spark { width: 100%; height: 72px; display: block; overflow: visible; }
.spark-area { fill: url(#sparkFill); }
.spark-line { fill: none; stroke: var(--cyan-400); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }

.alert-item {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-4);
  border-bottom: 1px solid var(--line);
}
.alert-item:last-child { border-bottom: 0; }
.alert-item .alert-mark { width: 3px; border-radius: var(--r-full); background: var(--text-3); flex: none; }
.alert-item.is-critico .alert-mark { background: var(--danger-500); }
.alert-item.is-atencao .alert-mark { background: var(--warn-500); }
.alert-item.is-info .alert-mark { background: var(--cyan-400); }
.alert-item b { font-size: var(--fs-13); }
.alert-item p { font-size: var(--fs-12); color: var(--text-2); margin-top: 2px; }
.alert-item time { font-size: var(--fs-11); color: var(--text-3); white-space: nowrap; }

/* Modo TV: telão do NOC, tipografia ampliada e sem cromo de navegação */
body.tv-mode .appbar, body.tv-mode .sidebar, body.tv-mode .mobile-nav { display: none; }
body.tv-mode .shell { grid-template-columns: minmax(0, 1fr); }
body.tv-mode { --fs-32: 3.2rem; --fs-24: 2rem; --fs-16: 1.15rem; --fs-14: 1rem; --fs-13: .95rem; }
body.tv-mode .content { padding: var(--s-6) var(--s-8); }
/* O telão é a exceção, não o padrão: `.tv-only` some fora do modo TV e volta
   com ele. A regra de esconder precisa ser mais específica que a de qualquer
   componente marcado como `.tv-only` — sem isso, o `display:flex` do próprio
   componente (`.tv-bar`, logo abaixo) vencia por vir depois na folha, e a
   faixa do telão ficava permanentemente visível no dashboard, duplicando o
   título da página. */
body:not(.tv-mode) .tv-only { display: none !important; }
body.tv-mode .tv-only { display: flex; }
.tv-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-5);
  padding: var(--s-4) var(--s-8);
  border-bottom: 1px solid var(--line);
  background: var(--surface-glass);
}
.tv-clock { text-align: right; font-variant-numeric: tabular-nums; }
.tv-clock strong { display: block; font-size: var(--fs-24); letter-spacing: -.03em; }
.tv-clock small { color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; font-size: var(--fs-11); }

/* ---------------------------------------------------------
   4. Plataforma (RBAC / usuários / auditoria)
   --------------------------------------------------------- */
.split {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: var(--s-5);
  align-items: start;
}
@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } }

.role-item {
  position: relative;
  display: grid;
  gap: 3px;
  width: 100%;
  padding: var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-1);
  text-align: left;
  transition: border-color var(--dur-1) var(--ease), transform var(--dur-1) var(--ease);
}
.role-item:hover { border-color: var(--line-strong); transform: translateX(2px); }
.role-item[aria-current="true"] { border-color: var(--cyan-400); background: var(--grad-brand-soft); }
.role-item b { font-size: var(--fs-13); text-transform: capitalize; }
.role-item small { color: var(--text-3); font-size: var(--fs-11); line-height: 1.45; }

.perm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--s-4); }
.perm-box { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); padding: var(--s-4); }
.perm-box h3 { font-size: var(--fs-13); padding-bottom: var(--s-3); border-bottom: 1px solid var(--line); margin-bottom: var(--s-2); }

.timeline { display: grid; gap: 0; }
.timeline-item {
  display: grid;
  grid-template-columns: 116px 12px minmax(0, 1fr);
  gap: var(--s-3);
  padding: var(--s-3) 0;
}
.timeline-item time { font-size: var(--fs-11); color: var(--text-3); font-family: var(--font-mono); padding-top: 3px; }
.timeline-rail { position: relative; display: grid; justify-items: center; }
.timeline-rail::before { content: ""; position: absolute; top: 0; bottom: -14px; width: 1px; background: var(--line); }
.timeline-rail i { position: relative; width: 9px; height: 9px; margin-top: 6px; border-radius: var(--r-full); background: var(--cyan-400); }
.timeline-item:last-child .timeline-rail::before { display: none; }
.timeline-item.is-danger .timeline-rail i { background: var(--danger-500); }
.timeline-body b { font-size: var(--fs-13); }
.timeline-body p { font-size: var(--fs-12); color: var(--text-2); }
.timeline-body .meta { font-size: var(--fs-11); color: var(--text-3); margin-top: 3px; display: flex; gap: var(--s-3); flex-wrap: wrap; }

/* ---------------------------------------------------------
   4.1 Cadastro de clientes (lista)
   --------------------------------------------------------- */
/* Endereço às vezes chega como link colado do Google Maps (sem espaço para
   quebrar) — sem isso a célula estoura a tabela inteira para o lado. */
.clientes-table td { overflow-wrap: anywhere; }

/* Abaixo de 760px a tabela vira uma pilha de cartões: seis colunas lado a
   lado não cabem no celular e a rolagem horizontal escondia metade do
   cadastro. Cada `<td>` empresta o rótulo da coluna via `data-label`. */
@media (max-width: 760px) {
  .clientes-table-wrap { border: 0; background: transparent; overflow: visible; }
  .clientes-table, .clientes-table tbody, .clientes-table tr, .clientes-table td { display: block; width: 100%; }
  .clientes-table thead { display: none; }
  .clientes-table tr {
    padding: var(--s-4);
    margin-bottom: var(--s-3);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface-1);
  }
  .clientes-table tr:last-child { margin-bottom: 0; }
  .clientes-table td { padding: var(--s-2) 0; border-bottom: 0; }
  .clientes-table td:first-child { padding-top: 0; }
  .clientes-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    font-size: var(--fs-10);
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-3);
  }
  .clientes-table td:last-child {
    display: flex;
    justify-content: flex-end;
    padding-top: var(--s-3);
    margin-top: var(--s-2);
    border-top: 1px solid var(--line);
  }
}

/* ---------------------------------------------------------
   5. Hub do protótipo e guia visual
   --------------------------------------------------------- */
.hub { max-width: 1180px; margin: 0 auto; padding: var(--s-10) var(--s-5) var(--s-16); }
.hub-hero { text-align: center; margin-bottom: var(--s-10); }
.hub-hero h1 { font-size: clamp(var(--fs-32), 5vw, var(--fs-44)); margin: var(--s-4) 0; }
.hub-hero p { color: var(--text-2); max-width: 62ch; margin: 0 auto; }
.hub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--s-4); }
.hub-card { display: grid; gap: var(--s-3); padding: var(--s-5); text-decoration: none; color: inherit; }
.hub-card:hover { text-decoration: none; }
.hub-card .hub-icon {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  background: var(--grad-brand-soft);
  border: 1px solid var(--info-line);
  color: var(--cyan-400);
}
.hub-card h3 { font-size: var(--fs-16); }
.hub-card p { font-size: var(--fs-12); color: var(--text-2); }
.hub-card .hub-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }

.swatch { display: grid; gap: var(--s-2); }
.swatch .chipcolor { height: 56px; border-radius: var(--r-md); border: 1px solid var(--line); }
.spec-row { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: var(--s-4); padding: var(--s-4) 0; border-bottom: 1px solid var(--line); align-items: center; }
.spec-row:last-child { border-bottom: 0; }

/* ---------- Estado operacional vindo do Zabbix ----------
   A linha é verde quando as duas pontas monitoradas estão no ar, vermelha
   quando alguma caiu e âmbar quando só parte do feixe caiu. Sem interface
   monitorada ela fica cinza: a cor não afirma o que não foi medido. */
.topo-edge.is-up { stroke: var(--ok-500); opacity: .9; }
.topo-edge.is-partial { stroke: var(--warn-500); }
.topo-edge.is-down { stroke: var(--danger-500); stroke-width: 2.6; stroke-dasharray: 10 6; }
.topo-edge.is-up:hover, .topo-edge.is-up.is-active { stroke: var(--ok-500); stroke-width: 3.4; opacity: 1; }
.topo-edge.is-partial:hover, .topo-edge.is-partial.is-active { stroke: var(--warn-500); stroke-width: 3.4; }
.topo-edge.is-down:hover, .topo-edge.is-down.is-active { stroke: var(--danger-500); stroke-width: 3.6; }
.topo-edge-chip.is-up { stroke: var(--ok-500); }
.topo-edge-chip.is-partial { stroke: var(--warn-500); }
.topo-edge-chip.is-down { stroke: var(--danger-500); }

/* POP no ar / degradado: a cor basta. */
.topo-marker.is-online { border-color: var(--ok-500); color: var(--ok-500); box-shadow: 0 2px 10px rgba(0, 0, 0, .45), 0 0 0 4px rgba(47, 214, 160, .18); }
.topo-marker.is-online .marker-count { background: var(--ok-500); }
.topo-marker.is-degradado { border-color: var(--warn-500); color: var(--warn-500); box-shadow: 0 2px 10px rgba(0, 0, 0, .45), 0 0 0 4px rgba(255, 176, 32, .20); }
.topo-marker.is-degradado .marker-count { background: var(--warn-500); }

/* POP inteiro fora do ar: pisca, porque exige alguém agora. O halo cresce e
   some junto com a piscada — o alarme é visível de longe, no telão do NOC. */
@keyframes pop-offline {
  0%, 100% { opacity: 1; box-shadow: 0 2px 10px rgba(0, 0, 0, .45), 0 0 0 4px rgba(255, 95, 116, .40); }
  55% { opacity: .45; box-shadow: 0 2px 10px rgba(0, 0, 0, .45), 0 0 0 14px rgba(255, 95, 116, 0); }
}
.topo-marker.is-offline {
  border-color: var(--danger-500);
  color: var(--danger-500);
  animation: pop-offline 1.15s var(--ease, ease-out) infinite;
}
.topo-marker.is-offline .marker-count { background: var(--danger-500); }
.topo-marker.is-offline .marker-label { color: var(--danger-500); }

/* O mesmo alarme quando o POP está aberto como card */
@keyframes pop-offline-card {
  0%, 100% { border-color: var(--danger-500); box-shadow: 0 0 0 3px rgba(255, 95, 116, .34), var(--shadow-2); }
  55% { border-color: rgba(255, 95, 116, .45); box-shadow: 0 0 0 10px rgba(255, 95, 116, 0), var(--shadow-2); }
}
.topo-site.is-offline { border-color: var(--danger-500); animation: pop-offline-card 1.15s var(--ease, ease-out) infinite; }
.topo-site.is-degradado { border-color: var(--warn-500); }
.topo-site.is-online.is-core { border-color: rgba(47, 214, 160, .55); }

/* Sem animação para quem pediu menos movimento: a cor continua dizendo tudo. */
@media (prefers-reduced-motion: reduce) {
  .topo-marker.is-offline, .topo-site.is-offline { animation: none; }
  .topo-marker.is-offline { box-shadow: 0 2px 10px rgba(0, 0, 0, .45), 0 0 0 5px rgba(255, 95, 116, .45); }
}

/* ---------- Camada de caminhos de fibra (PARTE ISP) ----------
   Vive dentro do mesmo mundo do mapa geográfico, entre os tiles do
   OpenStreetMap e os enlaces da topologia: o cabo passa por baixo do
   POP, como em campo. */
.topo-fibra { z-index: 1; }
.topo-fibra[hidden] { display: none; }

.fibra-linha {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .85;
  /* O traço mantém a espessura na tela em qualquer zoom do mapa. */
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}
.fibra-linha.is-sel { stroke-width: 5; opacity: 1; }
.fibra-linha.is-editando { stroke-dasharray: 10 6; }
.fibra-linha.is-rascunho { stroke-dasharray: 8 6; opacity: .95; }

/* Faixa invisível e larga sobre a linha: dá área de clique num traço de 3 px. */
.fibra-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 16;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
}
.fibra-hit:hover + .fibra-linha,
.fibra-hit:hover { stroke-width: 18; }

.fibra-caixa { cursor: pointer; }
.fibra-caixa-alvo { fill: transparent; }
.fibra-caixa-ponto {
  fill: var(--surface-1);
  stroke: var(--purple-400);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}
.fibra-caixa:hover .fibra-caixa-ponto { fill: var(--purple-400); }

/* Alças do traçado em edição. */
.fibra-vertice {
  fill: var(--surface-1);
  stroke: var(--cyan-400);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  cursor: grab;
  touch-action: none;
}
.fibra-vertice:hover { fill: var(--cyan-400); }
.fibra-vertice.is-dragging { cursor: grabbing; fill: var(--cyan-400); }

.fibra-inserir { cursor: copy; opacity: .55; }
.fibra-inserir:hover { opacity: 1; }
.fibra-inserir circle { fill: var(--surface-1); stroke: var(--line-strong); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.fibra-inserir path { stroke: var(--text-2); stroke-width: 1.5; fill: none; vector-effect: non-scaling-stroke; }

/* Amostra da cor do cabo, na lista lateral e nos crachás. */
.fibra-amostra {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: -1px;
  flex: none;
}

/* Painel lateral dos caminhos de fibra: mesma coluna da lista de equipamentos. */
.fibra-panel {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  min-height: 0;
}
.fibra-item[aria-current="true"] { border-color: var(--cyan-400); }

/* Barra de edição do traçado. Vai no alto do palco para não brigar com a
   barra de layout dos POPs, que ocupa a base à esquerda. */
.topo-fibra-bar {
  left: var(--s-4);
  right: auto;
  top: var(--s-4);
  bottom: auto;
  flex-wrap: wrap;
  max-width: calc(100% - var(--s-6) * 2);
  padding: var(--s-2) var(--s-3);
}
/* No mapa geográfico o palco recua a base para a atribuição do OSM; a barra
   do traçado fica no topo e não é afetada por esse recuo. */
.topo-stage.is-geo .topo-hud.topo-fibra-bar { bottom: auto; }

/* ---------- Colunas de conteúdo e texto vindo do cadastro ----------
   O texto do KMZ e o digitado pelo operador chegam do jeito que vieram: o
   endereço de um POP pode ser uma URL do Google Maps com 700 caracteres e
   nenhum espaço. Sem quebrar essa palavra, a largura mínima dela vira a
   largura mínima da coluna inteira, o conteúdo escapa da grade e passa por
   baixo do painel lateral. */
.split > * { min-width: 0; }
.texto-livre { overflow-wrap: anywhere; word-break: break-word; }

/* Rede de proteção do cartão. `min-width: 0` impede a coluna de crescer, mas
   sozinho não impede o texto de transbordar por cima do painel ao lado — o
   cartão não recorta o conteúdo. Aqui a quebra vale para todo texto do cartão,
   sem depender de a tela ter marcado o parágrafo com .texto-livre. */
.split .card :is(p, h2, h3, b, small, span, td, summary) { overflow-wrap: anywhere; }
.split .card { overflow: clip; }

/* Conteúdo à esquerda, painel de apoio à direita — o inverso do .split, que
   nasceu com a lista à esquerda. Precisa ser classe, e não grid-template-columns
   no atributo style: estilo inline vence media query, e a tela ficaria com duas
   colunas espremidas no tablet e no celular em vez de empilhar.

   O painel é quem cede largura quando o espaço aperta: encolhe até 260 px em
   vez de manter 320 fixos e espremer os cartões da lista. */
.split-aside { grid-template-columns: minmax(0, 1fr) minmax(260px, 320px); }

/* Mesma razão do comentário acima, para as outras duas proporções que as
   telas precisam: dashboard.html e pops.html traziam essas colunas em
   style="grid-template-columns:…", que vence a media query de empilhamento
   de `.split` — em pops.html a coluna de 340px sozinha já era mais larga que
   a tela toda de um celular. */
.split-wide-aside { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.split-fixed-aside { grid-template-columns: minmax(0, 1fr) 340px; }
@media (max-width: 1100px) {
  /* `minmax(0, 1fr)`, não `1fr` puro: uma track `1fr` sozinha tem piso `auto`
     (a largura mínima do conteúdo) — é o mesmo estouro que o comentário do
     `.split-aside` já registra, só que reintroduzido aqui ao empilhar. Com
     `minmax(0, 1fr)` a track aceita encolher abaixo do conteúdo, e é isso que
     deixa o `flex-wrap` dos cartões (badge + botões) realmente quebrar linha
     em vez de vazar da tela. */
  .split-wide-aside, .split-fixed-aside { grid-template-columns: minmax(0, 1fr); }
}

/* Em tela alta o painel acompanha a rolagem — fica sempre visível sem custar
   mais largura para a lista. */
@media (min-width: 1401px) {
  .split-aside > :last-child { position: sticky; top: var(--s-5); align-self: start; }
}

/* O ponto de quebra sai da conta da tela, não de um número redondo: descontando
   o menu lateral (288 px), o respiro da página e o painel, abaixo de 1400 px a
   lista ficaria com menos de 700 px — estreito demais para um cartão com
   estatísticas, botões e equipamentos. Aí o painel desce e a lista fica com a
   largura inteira; lado a lado, os dois cartões de apoio não viram duas telas
   de rolagem antes do primeiro ISP. */
@media (max-width: 1400px) {
  .split-aside { grid-template-columns: minmax(0, 1fr); }
  .split-aside > :last-child {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    align-content: start;
  }
}

/* Observação longa não pode dominar o cartão: fica recolhida atrás de um
   resumo, e o texto inteiro continua a um clique — e no formulário de edição. */
.texto-longo > summary {
  cursor: pointer;
  font-size: var(--fs-12);
  color: var(--text-2);
  list-style: none;
}
.texto-longo > summary::-webkit-details-marker { display: none; }
.texto-longo > summary::before { content: "▸ "; color: var(--text-3); }
.texto-longo[open] > summary::before { content: "▾ "; }
.texto-longo > p { margin-top: var(--s-2); max-height: 260px; overflow: auto; }
