/* Fiber RouteX — mapa da rede óptica */
.view[data-view="fibra"] { padding: 0; height: 100%; }
.fo { display: grid; grid-template-columns: 290px 1fr; height: calc(100vh - 64px); min-height: 480px; position: relative; }
.fo-lado { border-right: 1px solid var(--border); background: var(--bg-secondary); overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.fo-titulo h1 { margin: 0; font-size: 19px; }
.fo-titulo p { margin: 2px 0 0; font-size: 12px; color: var(--text-secondary); }
/* busca + botão de editar: no PC o botão é a linha de baixo (largura toda); no celular fica ao lado da busca, só o ícone */
.fo-busca-linha { display: flex; flex-wrap: wrap; gap: 10px 6px; align-items: stretch; }
.fo-busca { position: relative; flex: 1; min-width: 0; }
.fo-bt-painel { display: none; }
.fo-lado-corpo { display: flex; flex-direction: column; gap: 14px; }
.fo-busca .form-input { width: 100%; box-sizing: border-box; }
.fo-res { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 1200; background: var(--card-solid, var(--bg-primary)); border: 1px solid var(--border); border-radius: var(--radius-sm, 8px); box-shadow: var(--shadow-md); max-height: 340px; overflow-y: auto; }
.fo-res button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; background: none; color: var(--text-primary); text-align: left; cursor: pointer; font-size: 13px; }
.fo-res button:hover { background: var(--bg-hover); }
.fo-res button span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fo-res button em, .fo-cam em { font-style: normal; font-size: 11px; color: var(--text-secondary); }
.fo-res i, .fo-cam i { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 10px; }
.fo-bloco h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); }
.fo-cam { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; cursor: pointer; }
.fo-cam em { margin-left: auto; }
/* fundo do mapa: botões grudados numa linha só (um escolhido por vez) */
.fo-bases { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.fo-bases .btn { border: 0; border-radius: 0; padding: 6px 2px; min-width: 0; box-shadow: none; }
.fo-bases .btn + .btn { border-left: 1px solid var(--border); }
.fo-bases .btn.active { background: var(--accent); color: var(--accent-ink, #fff); border-color: var(--accent); }
/* bloco Exibição: subtítulo e chaves liga/desliga (diferentes das caixinhas de camada) */
.fo-sub { font-size: 12px; color: var(--text-secondary); margin: 0 0 4px; }
.fo-opcao { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0 0; font-size: 13px; cursor: pointer; }
.fo-opcao > span { display: flex; flex-direction: column; min-width: 0; }
.fo-opcao small { font-size: 11px; color: var(--text-secondary); }
.fo-chave { appearance: none; -webkit-appearance: none; flex: 0 0 32px; width: 32px; height: 18px; margin: 1px 0 0; border-radius: 999px; position: relative; cursor: pointer;
  background: color-mix(in srgb, var(--text-secondary) 45%, transparent); transition: background .15s; }
.fo-chave::before { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .35); transition: transform .15s; }
.fo-chave:checked { background: var(--accent); }
.fo-chave:checked::before { transform: translateX(14px); }
.fo-chave:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fo-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fo-kpis div { background: var(--bg-primary); border: 1px solid var(--border-subtle, var(--border)); border-radius: 8px; padding: 8px; display: flex; flex-direction: column; }
.fo-kpis b { font-size: 16px; }
.fo-kpis span { font-size: 11px; color: var(--text-secondary); }
.fo-imp { margin-top: 8px; font-size: 11px; }
.fo-dim { color: var(--text-secondary); font-size: 12px; }
.fo-dica { margin-top: auto; }
.fo-mapa-wrap { position: relative; min-width: 0; }
.fo-mapa { position: absolute; inset: 0; background: var(--bg-tertiary, #ddd); }
/* ---- zonas do mapa (cada coisa no seu canto, nada uma por cima da outra) ----
   topo à esquerda: zoom + ferramentas; abaixo delas: barra do editor; meio: aviso de mapa vazio;
   rodapé: barras de instrução/medição empilhadas + linha com status e filtro de projetos */
.fo-rodape { position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 850; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.fo-rodape > * { pointer-events: auto; max-width: 100%; }
/* status e filtro lado a lado; sem espaço, o filtro sobe para a linha de cima */
.fo-rodape-info { align-self: stretch; display: flex; flex-wrap: wrap-reverse; align-items: center; gap: 6px; pointer-events: none !important; }
.fo-rodape-info > * { pointer-events: auto; }
.fo-status { background: var(--card-solid, var(--bg-primary)); border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; font-size: 12px; color: var(--text-secondary); pointer-events: none !important; }
.fo-status { max-width: 100%; box-sizing: border-box; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fo-status[hidden] { display: none; }
.fo-status.fo-erro { color: var(--danger); }
/* aviso de mapa vazio: no meio do mapa (o topo é do editor) */
.fo-aviso-mapa { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 850; background: var(--card-solid, var(--bg-primary)); border: 1px solid var(--warning, #f59e0b); border-radius: 8px; padding: 8px 12px; font-size: 13px; color: var(--text-primary); display: flex; align-items: center; gap: 10px; box-shadow: 0 4px 16px rgba(0,0,0,.25); width: max-content; max-width: calc(100% - 32px); box-sizing: border-box; flex-wrap: wrap; }
.fo-aviso-mapa[hidden] { display: none; }
/* lembrete de filtro de projetos ligado (rodapé, ao lado do status) */
.fo-filtro-mapa { display: flex; align-items: center; gap: 6px; background: var(--card-solid, var(--bg-primary)); border: 1px solid var(--accent); border-radius: 8px; padding: 4px 6px 4px 10px; font-size: 12px; color: var(--text-primary); box-shadow: var(--shadow-sm); max-width: 100%; box-sizing: border-box; }
.fo-filtro-mapa[hidden] { display: none; }
.fo-grupo span { display: flex; align-items: center; justify-content: center; border-radius: 50%; background: color-mix(in srgb, var(--c) 82%, transparent); color: #fff; font-size: 11px; font-weight: 700; border: 2px solid rgba(255, 255, 255, .85); box-shadow: 0 1px 4px rgba(0, 0, 0, .35); box-sizing: border-box; cursor: pointer; }
.fo { --ficha-w: 460px; }
/* CTO com a tabela de clientes (login, nome da ONU, ID do cliente, PON, RX): ficha mais larga */
.fo:has(.fo-ficha.fo-ficha-larga:not([hidden])) { --ficha-w: 620px; }
.fo-ficha { position: absolute; top: 0; right: 0; bottom: 0; width: min(var(--ficha-w), 100%); z-index: 1000; background: var(--bg-primary); border-left: 1px solid var(--border); box-shadow: -6px 0 24px rgba(0, 0, 0, .25); overflow-y: auto; padding: 16px; box-sizing: border-box; }
.fo-ficha-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; margin-bottom: 12px; }
.fo-ficha-head h2 { margin: 2px 0 0; font-size: 18px; word-break: break-word; }
.fo-cat { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--c); }
.fo-sec { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.fo-sec h3 { margin: 0 0 8px; font-size: 14px; }
.fo-kv { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.fo-kv:last-child { border-bottom: 0; }
.fo-kv span { color: var(--text-secondary); flex: 0 0 auto; }
.fo-kv b { text-align: right; font-weight: 600; word-break: break-word; }
.fo-obs { font-size: 12px; color: var(--text-secondary); margin: 8px 0 0; white-space: pre-wrap; }
.fo-linha { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: 13px; color: var(--text-primary); text-decoration: none; }
.fo-linha:last-child { border-bottom: 0; }
a.fo-linha:hover span { color: var(--accent); }
.fo-linha span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.fo-linha em { font-style: normal; font-size: 11px; color: var(--text-secondary); white-space: nowrap; }
.fo-tab-wrap { overflow-x: auto; }
.fo-tab { width: 100%; border-collapse: collapse; font-size: 12px; }
.fo-tab th { text-align: left; font-weight: 600; color: var(--text-secondary); padding: 4px 6px; border-bottom: 1px solid var(--border); }
.fo-tab td { padding: 5px 6px; border-bottom: 1px dashed var(--border); vertical-align: top; }
.fo-tab small { display: block; color: var(--text-secondary); font-size: 10px; }
.fo-cli-olt { font-size: 11.5px; margin: -2px 0 8px; } /* "Sinal lido na OLT às …" */
.fo-ocup { display: flex; align-items: center; gap: 10px; font-size: 12px; margin-bottom: 8px; }
.fo-barra { flex: 1; height: 8px; border-radius: 4px; background: var(--bg-tertiary, var(--bg-secondary)); overflow: hidden; }
.fo-barra i { display: block; height: 100%; }
.fo-portas { display: grid; grid-template-columns: repeat(auto-fill, minmax(30px, 1fr)); gap: 4px; margin-bottom: 10px; }
.fo-porta { text-align: center; font-size: 11px; font-weight: 600; padding: 4px 0; border-radius: 4px; border: 1px solid var(--border); }
.fo-porta.on { background: var(--success-soft); color: var(--success); border-color: var(--success); }
.fo-porta.off { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.fo-porta.livre { color: var(--text-secondary); }
.fo-bom { color: var(--success); font-weight: 600; }
.fo-medio { color: var(--warning); font-weight: 600; }
.fo-ruim { color: var(--danger); font-weight: 600; }
.fo-on { color: var(--success); font-size: 11px; }
.fo-off { color: var(--danger); font-size: 11px; }

.fo-legenda { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; font-size: 11px; color: var(--text-secondary); }
.fo-legenda span { display: inline-flex; align-items: center; gap: 5px; }
.fo-legenda b { width: 16px; height: 3px; border-radius: 2px; display: inline-block; }
.fo-legenda b.fo-tracejado { background: repeating-linear-gradient(90deg, #a855f7 0 5px, transparent 5px 8px); }

/* ícones de CTO / caixa de emenda / POP / OLT / rack */
.fo-icone { background: none; border: 0; }
.fo-ic { display: block; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .45)); cursor: pointer; }
.fo-ic svg { width: 100%; height: 100%; display: block; }
.fo-ic.inativo { opacity: .45; }
.fo-ic.projetado { opacity: .75; outline: 2px dashed #f59e0b; outline-offset: 1px; border-radius: 4px; }
.fo-arrastavel .fo-ic { outline: 2px solid #ff4414; outline-offset: 2px; border-radius: 4px; cursor: move; }
.fo-cam-ic { width: 16px; height: 16px; flex: 0 0 16px; display: inline-block; }
.fo-cam-ic svg { width: 100%; height: 100%; display: block; }

/* editor */
.fo-bt-editar { flex: 1 0 100%; }
/* .btn.… vence o :hover do tema (no celular o hover fica "preso" depois do toque e apagava o ✓) */
.btn.fo-bt-editar.active { background: var(--accent); color: var(--accent-ink, #fff); border-color: var(--accent); }
/* barra do editor: logo abaixo da linha de ferramentas (ao lado do zoom) */
.fo-barra-ed { position: absolute; top: 50px; left: 54px; right: 10px; z-index: 800; display: flex; flex-wrap: wrap; gap: 6px; pointer-events: none; }
.fo-barra-ed .btn { pointer-events: auto; display: inline-flex; align-items: center; gap: 6px; background: var(--card-solid, var(--bg-primary)); box-shadow: var(--shadow-sm); }
.fo-barra-ed .btn.active { background: var(--accent); color: var(--accent-ink, #fff); border-color: var(--accent); }
.fo-barra-ed i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
/* projeto em edição + status dos itens novos: bloco na lateral (só no modo edição).
   Borda tracejada na cor de destaque = "coisa do editor" (o mesmo nas ações da ficha) */
.fo-ed-ctx { display: flex; flex-direction: column; gap: 8px; border: 1px dashed var(--accent); border-radius: 8px; padding: 8px 10px; }
.fo-ed-ctx[hidden] { display: none; }
.fo-ed-ctx .form-select { font-size: 12px; }
.fo-ed-ctx-tit, .fo-acoes-rot { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); }
.fo-acoes-ed { align-items: center; border: 1px dashed var(--accent); border-radius: 8px; padding: 6px 8px; }
.fo-acoes-rot { margin-right: 2px; }
/* barra de ferramentas do editor: rótulo + botões numa linha */
.fo-barra-rot { pointer-events: auto; align-self: center; font-size: 12px; font-weight: 700; color: var(--text-primary); background: var(--card-solid, var(--bg-primary)); border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; box-shadow: var(--shadow-sm); }
.fo-barra-ed .fo-bt-sair { margin-left: auto; color: var(--accent); }
/* com a ficha aberta (PC) sobra pouco mapa: a barra fica só com os ícones (o nome aparece no title) */
.fo:has(.fo-ficha:not([hidden])) .fo-barra-ed .fo-rot, .fo:has(.fo-ficha:not([hidden])) .fo-barra-rot { display: none; }
.fo:has(.fo-ficha:not([hidden])) .fo-barra-ed .fo-bt-sair { margin-left: 0; }
.fo-ic-cabo { width: 16px !important; height: 3px !important; border-radius: 2px !important; background: #3b82f6; }
.fo-mirando { cursor: crosshair !important; }
.fo-mirando .leaflet-interactive { cursor: crosshair !important; }
.fo-desenho-txt { font-weight: 600; color: var(--text-primary); }
/* barra de instrução/medição: fica no rodapé do mapa (#fo-rodape), centralizada, larga o quanto precisar */
.fo-desenho { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; background: var(--card-solid, var(--bg-primary)); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; box-shadow: var(--shadow-md); font-size: 12px; max-width: 100%; box-sizing: border-box; }
.fo-acoes { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.fo-perigo { color: var(--danger); }
/* 📁 projeto do item: link na ficha/balão e a árvore na aba Projetos */
.fo-link-proj { all: unset; cursor: pointer; color: var(--accent); font-weight: 600; text-decoration: underline dotted; text-underline-offset: 2px; overflow-wrap: anywhere; }
.fo-link-proj:hover { text-decoration-style: solid; }
.fo-link-proj:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 3px; }
.fo-arv { border: 1px solid var(--accent); border-radius: 10px; padding: 8px; margin-bottom: 10px; background: color-mix(in srgb, var(--accent) 6%, transparent); }
.fo-arv-cab { display: flex; gap: 8px; align-items: flex-start; }
.fo-arv-cab > i { width: 10px; height: 10px; border-radius: 3px; margin-top: 18px; flex: none; }
.fo-arv-cab > span { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fo-arv-cab b { overflow-wrap: anywhere; }
.fo-arv-bts { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.fo-arv-gcab { all: unset; cursor: pointer; display: flex; gap: 6px; align-items: center; width: 100%; box-sizing: border-box; padding: 5px 4px; font-weight: 600; border-top: 1px solid var(--border); }
.fo-arv-gcab em { font-style: normal; color: var(--text-secondary); font-weight: 400; margin-left: auto; }
.fo-arv-gcab:focus-visible { outline: 2px solid var(--accent); }
.fo-arv-itens { max-height: 320px; overflow-y: auto; padding: 0 0 6px 14px; }
.fo-arv-it { display: block; padding: 4px 6px; border-radius: 6px; color: var(--text-primary); text-decoration: none; }
.fo-arv-it span { display: block; overflow-wrap: anywhere; }
.fo-arv-it small { display: block; color: var(--text-secondary); font-size: 11px; }
.fo-arv-it:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.fo-arv-it.atual { background: color-mix(in srgb, var(--accent) 26%, transparent); box-shadow: inset 3px 0 0 var(--accent); font-weight: 600; }
.fo-arv-mais { margin: 4px 0; }
/* 🗂 mudar o projeto de vários itens: a barra embaixo do mapa vira um painel */
.fo-bt-massa { width: 100%; margin-top: 6px; }
.fo-desenho.fo-massa { flex-direction: column; align-items: stretch; max-width: min(720px, 100%); max-height: 60vh; overflow: auto; }
.fo-massa-tit { font-weight: 700; font-size: 13px; }
.fo-massa-grupo { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.fo-massa-grupo > span { flex-basis: 100%; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); }
.fo-massa-ck { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.fo-massa-ck em { font-style: normal; color: var(--text-secondary); font-size: 11px; }
.fo-massa-fim { align-items: flex-end; gap: 8px; }
.fo-massa-fim .fo-campo { flex: 1 1 220px; margin: 0; }
/* ✎ Editar e 🗑 Remover numa linha própria, logo abaixo das ações da caixa; o Remover longe do Editar */
.fo-acoes-caixa + .fo-acoes-ger { margin-top: -4px; }
.fo-acoes-ger [data-remover-el] { margin-left: auto; }
/* nome do cabo nas fusões: toca e troca o nome ali mesmo */
.fo-cabo-nome { all: unset; cursor: pointer; font-weight: 600; color: var(--accent); text-decoration: underline dotted; text-underline-offset: 2px; overflow-wrap: anywhere; }
.fo-cabo-nome i { font-style: normal; font-size: 10px; margin-left: 3px; opacity: .7; }
.fo-cabo-nome:hover { text-decoration-style: solid; }
.fo-cabo-nome:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 3px; }
.fo-tab tr.fo-ren-linha td { padding: 2px 6px 8px; }
.fo-ren-cabo { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.fo-ren-cabo span { flex-basis: 100%; font-size: 11px; color: var(--text-secondary); }
.fo-ren-cabo .form-input { flex: 1; min-width: 0; padding: 4px 8px; font-size: 12.5px; height: auto; }
.fo-confirmar { background: var(--danger) !important; color: #fff !important; border-color: var(--danger) !important; }
.fo-aviso { background: var(--warning-soft); color: var(--warning); border-radius: 8px; padding: 8px 10px; font-size: 12px; margin-bottom: 10px; }
.fo-sec h3 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.btn.btn-xs { padding: 2px 8px; font-size: 11px; line-height: 1.6; min-height: 0; }
.fo-form { display: flex; flex-direction: column; gap: 8px; }
.fo-form.fo-inline { border: 1px dashed var(--border); border-radius: 8px; padding: 10px; margin-bottom: 10px; }
.fo-campo { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.fo-campo > span { color: var(--text-secondary); }
.fo-campo .form-input, .fo-campo .form-select { width: 100%; box-sizing: border-box; }
.fo-form-bts { display: flex; gap: 6px; }
.fo-ponta { display: grid; grid-template-columns: 44px 1fr; gap: 6px; align-items: center; }
.fo-ponta > b { font-size: 12px; grid-row: span 3; align-self: start; padding-top: 8px; }
.fo-ponta select { min-width: 0; }
.fo-ponta .fo-campo { grid-column: span 1; }
.fo-ponta:last-of-type { grid-template-columns: 1fr 1fr; }
.fo-x { border: 0; background: none; color: var(--danger); font-size: 15px; line-height: 1; cursor: pointer; padding: 0 4px; }
.fo-x.fo-confirmar { font-size: 11px; border-radius: 4px; padding: 2px 6px; }
.fo-linha a { color: inherit; text-decoration: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.fo-linha a:hover { color: var(--accent); }
.fo-vertice span, .fo-arraste span { display: block; width: 100%; height: 100%; border-radius: 50%; background: #fff; border: 2px solid #ff4414; box-sizing: border-box; cursor: move; }
/* com a ficha aberta, a barra do editor e o rodapé (status, filtro, barras) ficam na parte do mapa que ela não cobre */
.fo:has(.fo-ficha:not([hidden])) .fo-barra-ed, .fo:has(.fo-ficha:not([hidden])) .fo-rodape { right: min(calc(var(--ficha-w) + 10px), 70%); }
.fo:has(.fo-ficha:not([hidden])) .fo-aviso-mapa { left: calc((100% - min(calc(var(--ficha-w) + 10px), 70%)) / 2); max-width: calc(100% - min(calc(var(--ficha-w) + 10px), 70%) - 20px); }

/* a busca global do topo (veículos, motoristas) não faz sentido nesta tela */
body.fo-ativo .topbar-search { visibility: hidden; }

/* abas da lateral */
.fo-abas { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.fo-abas button { flex: 1; border: 0; background: none; color: var(--text-secondary); padding: 8px 4px; font-size: 13px; font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.fo-abas button.active { color: var(--accent); border-bottom-color: var(--accent); }
.fo-abas button { white-space: nowrap; }
.fo-abas em { font-style: normal; font-weight: 600; font-size: 10px; margin-left: 4px; padding: 1px 5px; border-radius: 999px; background: var(--accent); color: var(--accent-ink, #fff); vertical-align: 1px; }
.fo-abas em:empty { display: none; }
.fo-aba { display: flex; flex-direction: column; gap: 14px; }
.fo-aba[hidden] { display: none; }

/* ícone próprio (imagem enviada) */
.fo-ic img, .fo-cam-ic img, .fo-ic-prev img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* árvore de projetos */
.fo-proj-topo { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.fo-proj-topo .form-input { width: 100%; box-sizing: border-box; }
.fo-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.fo-chips button { border: 1px solid var(--border); background: var(--bg-primary); color: var(--text-secondary); border-radius: 999px; padding: 3px 10px; font-size: 12px; cursor: pointer; }
.fo-chips button.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink, #fff); }
.fo-chips em { font-style: normal; opacity: .8; }
.fo-chips-itens { margin-bottom: 8px; }
.fo-proj-acoes { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px; }
.fo-proj-ajuda { flex: 1 1 150px; font-size: 11px; }
.fo-todos { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; font-size: 13px; }
.fo-todos .fo-dim { margin-left: auto; font-size: 11px; }
.fo-grupo-proj { border-top: 1px solid var(--border-subtle, var(--border)); padding: 4px 0; }
.fo-grupo-cab { display: flex; align-items: center; gap: 6px; }
.fo-grupo-cab button { flex: 1; text-align: left; border: 0; background: none; color: var(--text-primary); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 6px 0; cursor: pointer; }
.fo-grupo-cab em { font-style: normal; color: var(--text-secondary); font-weight: 500; }
.fo-proj { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 4px 0 4px 18px; }
.fo-proj:not(.on) .fo-proj-nome { opacity: .6; }
span.fo-proj-nome { cursor: default; }
/* o que mostrar do projeto marcado (só CTO, só cabos…) */
.fo-proj-cats { flex: 1 0 100%; display: flex; flex-wrap: wrap; gap: 3px; padding: 2px 0 2px 22px; }
.fo-proj-cats button { border: 1px solid var(--border); background: var(--bg-primary); color: var(--text-secondary); border-radius: 999px; padding: 1px 8px; font-size: 11px; cursor: pointer; }
.fo-proj-cats button.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink, #fff); }
.fo-proj > i { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.fo-proj.on .fo-proj-nome b { color: var(--accent); }
.fo-proj-nome { flex: 1; min-width: 0; text-align: left; border: 0; background: none; color: var(--text-primary); cursor: pointer; padding: 0; display: flex; flex-direction: column; }
.fo-proj-nome b { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fo-proj-nome small { font-size: 11px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fo-proj-nome:hover b { text-decoration: underline; }
.fo-proj-bt { border: 0; background: none; cursor: pointer; font-size: 13px; padding: 2px 3px; opacity: .45; color: var(--text-secondary); }
.fo-proj-bt:hover, .fo-proj-bt.on { opacity: 1; }
.fo-itens-q { width: 100%; box-sizing: border-box; margin-bottom: 8px; }
.fo-itens-total { margin-bottom: 4px; }
.fo-mais { width: 100%; margin-top: 8px; }
.fo-2col { display: grid; grid-template-columns: 1fr 70px; gap: 8px; }

/* ícones próprios */
.fo-ic-linha { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.fo-ic-prev { width: 28px; height: 28px; flex: 0 0 28px; display: flex; align-items: center; justify-content: center; }
.fo-ic-prev svg { width: 100%; height: 100%; }
.fo-ic-prev.grande { width: 48px; height: 48px; flex-basis: 48px; }
.fo-ic-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.fo-ic-info b { font-size: 13px; }
.fo-ic-info small { font-size: 11px; color: var(--text-secondary); }
.fo-ic-modelo { display: flex; align-items: center; gap: 4px; }
.fo-ic-modelo img { width: 14px; height: 14px; object-fit: contain; }
.fo-ic-bts { display: flex; flex-direction: column; gap: 4px; }

/* ---- fotos dentro da caixa ---- */
.fo-bt-foto { cursor: pointer; }
.fo-fotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 6px; }
.fo-fotos > .fo-dim { grid-column: 1 / -1; }
.fo-foto { position: relative; border: 1px solid var(--border); border-radius: 6px; padding: 0; overflow: hidden; background: var(--bg-primary); cursor: pointer; aspect-ratio: 1; display: block; }
.fo-foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fo-foto > span { font-size: 11px; color: var(--text-secondary); }
.fo-foto small { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 10px; padding: 2px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.fo-foto:hover { border-color: var(--accent); }
.fo-fotos-form { margin-bottom: 8px; }
.fo-foto-nova { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.fo-foto-nova img { width: 56px; height: 56px; object-fit: cover; border-radius: 4px; flex: 0 0 56px; }
.fo-foto-nova .form-input { flex: 1; min-width: 0; }
.fo-foto-tela { position: fixed; inset: 0; z-index: 3000; background: rgba(0,0,0,.82); display: flex; align-items: center; justify-content: center; padding: 16px; }
.fo-foto-tela[hidden] { display: none; }
.fo-foto-caixa { background: var(--card-solid, var(--bg-primary)); border-radius: 10px; width: min(1100px, 100%); max-height: 100%; display: flex; flex-direction: column; overflow: hidden; }
.fo-foto-topo, .fo-foto-rodape { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; font-size: 13px; }
.fo-foto-rodape { flex-wrap: wrap; }
.fo-foto-rodape small { display: block; margin-top: 2px; }
.fo-foto-img { position: relative; flex: 1; min-height: 200px; background: #000; display: flex; align-items: center; justify-content: center; }
.fo-foto-img img { max-width: 100%; max-height: calc(100vh - 160px); object-fit: contain; display: block; }
.fo-foto-nav { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); border: 0; border-radius: 50%; width: 40px; height: 40px; background: rgba(255,255,255,.18); color: #fff; font-size: 28px; line-height: 1; cursor: pointer; }
.fo-foto-nav.dir { left: auto; right: 8px; }
.fo-foto-desc { display: flex; gap: 6px; width: min(520px, 80vw); }
.fo-foto-desc .form-input { flex: 1; }

/* ---- celular / tela estreita ---- */
@media (max-width: 860px) {
  .fo { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: calc(100vh - 56px); }
  /* lateral vira só a busca + botão "Camadas"; o resto abre por cima do mapa */
  .fo-lado { border-right: 0; border-bottom: 1px solid var(--border); padding: 8px 10px; gap: 0; overflow: visible; position: relative; z-index: 1100; }
  .fo-titulo { display: none; }
  .fo-busca-linha { flex-wrap: nowrap; }
  .fo-bt-painel { display: inline-flex; align-items: center; white-space: nowrap; }
  /* editar sempre à vista no celular: só o ✎ (ou ✓ no modo edição), ao lado da busca */
  .fo-bt-editar { flex: 0 0 auto; padding-left: 13px; padding-right: 13px; font-size: 15px; }
  .fo-bt-editar-rot { display: none; }
  .fo-lado-corpo { display: none; }
  .fo-lado.fo-aberto .fo-lado-corpo { display: flex; position: absolute; left: 0; right: 0; top: 100%; max-height: 70vh; overflow-y: auto; background: var(--bg-secondary); border-bottom: 1px solid var(--border); box-shadow: 0 12px 24px rgba(0, 0, 0, .3); padding: 12px; box-sizing: border-box; }
  .fo-mapa-wrap { min-height: 320px; }
  /* ficha = folha embaixo (o mapa continua visível em cima); toque no cabeçalho recolhe */
  .fo-ficha { top: auto; height: 58%; width: 100%; border-left: 0; border-top: 1px solid var(--border); border-radius: 14px 14px 0 0; box-shadow: 0 -6px 24px rgba(0, 0, 0, .3); padding-top: 20px; }
  .fo-ficha::before { content: ''; position: absolute; top: 7px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: var(--border); }
  .fo-ficha .fo-ficha-head { cursor: pointer; }
  .fo-ficha.fo-min { height: auto; max-height: 78px; overflow: hidden; }
  .fo:has(.fo-ficha:not([hidden])) .fo-barra-ed { right: 10px; }
  /* rodapé acima da folha: recolhida (78 px) ou inteira (58% da tela, contada a partir do mapa);
     com a folha inteira, status e filtro somem (a ficha é o foco) e só as barras de ação ficam */
  .fo:has(.fo-ficha:not([hidden])) .fo-rodape { right: 10px; bottom: 88px; }
  .fo:has(.fo-ficha:not([hidden]):not(.fo-min)) .fo-rodape { bottom: calc(58% + 44px); }
  .fo:has(.fo-ficha:not([hidden]):not(.fo-min)) .fo-rodape-info { display: none; }
  /* aviso de mapa vazio: no meio da parte do mapa que a folha não cobre */
  .fo:has(.fo-ficha:not([hidden])) .fo-aviso-mapa { left: 50%; max-width: calc(100% - 32px); }
  .fo:has(.fo-ficha:not([hidden]):not(.fo-min)) .fo-aviso-mapa { top: 18%; }
  /* barra do editor: uma linha só, rola para o lado */
  .fo-barra-ed { left: 54px; flex-wrap: nowrap; overflow-x: auto; pointer-events: auto; scrollbar-width: none; padding-bottom: 2px; }
  .fo-barra-ed::-webkit-scrollbar { display: none; }
  .fo-barra-ed .btn { flex: 0 0 auto; }
  .fo-barra-rot { display: none; }
  .fo:has(.fo-ficha:not([hidden])) .fo-barra-ed .fo-rot { display: inline; }
}

/* ---- toque (celular/tablet): alvos maiores ---- */
@media (pointer: coarse) {
  .fo-cam { padding: 7px 0; }
  .btn.btn-xs { padding: 5px 10px; font-size: 12px; }
  .fo-proj-bt { padding: 6px 7px; font-size: 15px; opacity: .7; }
  .fo-proj-cats button, .fo-chips button { padding: 5px 12px; }
  .fo-x { padding: 4px 8px; font-size: 18px; }
  .fo-proj { padding-top: 6px; padding-bottom: 6px; }
}

/* ---- cadastros (tipos de cabo, splitters) ---- */
.fo-cad-abas { margin-bottom: 10px; }
.fo-cad-topo { display: flex; gap: 6px; align-items: center; justify-content: space-between; margin: 8px 0 4px; }
.fo-cad-topo .form-input { flex: 1; min-width: 0; }
.fo-cad-inat { display: flex; align-items: center; gap: 6px; font-size: 12px; margin-bottom: 6px; }
.fo-cad-lista { display: flex; flex-direction: column; gap: 4px; }
.fo-cad-item { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; }
.fo-cad-item > .btn { margin-left: auto; }
.fo-cad-item.inativo { opacity: .55; }
.fo-cad-nome { flex: 1 0 100%; min-width: 0; display: flex; flex-direction: column; }
.fo-cad-nome b { font-size: 12px; overflow-wrap: anywhere; }
.fo-cad-nome small { font-size: 11px; color: var(--text-secondary); }
.fo-cad-aviso { color: var(--warning) !important; }
.fo-amostra { display: flex; flex-direction: column; gap: 2px; flex: 0 0 auto; }
.fo-amostra span { display: flex; gap: 1px; }
.fo-amostra i { width: 6px; height: 7px; border-radius: 1px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.35); }
.fo-sp-badge { font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 4px; background: var(--bg-primary); border: 1px solid var(--border); }
.fo-cad-prev { border: 1px dashed var(--border); border-radius: 6px; padding: 6px 8px; margin: 6px 0; font-size: 12px; }
.fo-cad-cores { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; margin-top: 4px; }
.fo-cad-cores .fo-dim { width: 44px; font-size: 11px; }
.fo-cad-cores i { width: 18px; height: 18px; border-radius: 50%; font-style: normal; font-size: 9px; display: inline-flex; align-items: center; justify-content: center; color: #fff; text-shadow: 0 0 2px #000; box-shadow: inset 0 0 0 1px rgba(0,0,0,.4); }

/* ---- diagrama de fusões ---- */
.fo-sec h3 > span { display: inline-flex; align-items: center; gap: 4px; }
.fo-diag-tela { position: fixed; inset: 0; z-index: 3000; background: rgba(0,0,0,.72); display: flex; align-items: stretch; justify-content: center; padding: 12px; }
.fo-diag-tela[hidden] { display: none; }
.fo-diag-caixa { background: var(--card-solid, var(--bg-primary)); border-radius: 10px; width: min(1200px, 100%); display: flex; flex-direction: column; overflow: hidden; }
.fo-diag-topo { display: flex; align-items: center; justify-content: space-between; gap: 8px 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.fo-diag-tit { flex: 1 1 200px; min-width: 0; }
.fo-diag-topo small { display: block; font-size: 11px; }
.fo-diag-bts { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fo-diag-bts label { display: flex; align-items: center; gap: 4px; font-size: 12px; }
/* grupos da barra do diagrama: ver | editar (com a borda tracejada do editor) | fechar */
.fo-diag-grupo { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fo-diag-grupo-ed { border: 1px dashed var(--accent); border-radius: 8px; padding: 3px 6px; }
.fo-diag-bts .form-input { width: 52px; padding: 3px 6px; font-size: 12px; height: 26px; min-height: 0; box-sizing: border-box; }
.fo-diag-corpo { flex: 1; overflow: auto; background: var(--bg-secondary, var(--bg-primary)); }
.fo-diag-svg { display: block; margin: 0 auto; font-family: inherit; }
.fo-diag-info { padding: 8px 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-secondary); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fo-diag-info b { color: var(--text-primary); }
.fo-diag-info.escolhendo { background: color-mix(in srgb, var(--accent) 14%, transparent); }
/* nome da fibra: no desenho (destaque) e a barra de escrever */
.fo-dg-nome { fill: var(--accent); font-weight: 700; }
.fo-diag-info.nomeando { background: color-mix(in srgb, var(--accent) 10%, transparent); align-items: flex-end; }
.fo-dg-nomear-tit { flex-basis: 100%; color: var(--text-primary); font-weight: 600; }
.fo-dg-nomear { display: flex; flex-direction: column; gap: 2px; flex: 1 1 220px; min-width: 0; }
.fo-dg-nomear small { overflow-wrap: anywhere; line-height: 1.3; }
.fo-dg-nomear .form-input { padding: 4px 8px; font-size: 12.5px; height: auto; }
.fo-dg-bloco { fill: var(--card-solid, var(--bg-primary)); stroke: var(--border); stroke-width: 1; }
.fo-dg-bloco.comp { stroke-dasharray: 4 3; }
.fo-dg-tit { font-size: 12px; font-weight: 700; fill: var(--text-primary); }
.fo-dg-sub { font-size: 10.5px; fill: var(--text-secondary); }
.fo-dg-tubo { cursor: pointer; }
.fo-dg-tubo-fx { stroke: rgba(0,0,0,.35); stroke-width: 1; }
.fo-dg-tubo-tx { font-size: 11px; font-weight: 600; fill: #fff; paint-order: stroke; stroke: rgba(0,0,0,.55); stroke-width: 2.5px; }
.fo-dg-tubo-tx.escuro { fill: #111827; stroke: rgba(255,255,255,.6); }
.fo-dg-band-fx { fill: #475569; } /* bandeja do DIO (o tubo tem a cor dele) */
/* × no canto do bloco do diagrama: tira o cabo/splitter da caixa */
.fo-dg-x { cursor: pointer; }
.fo-dg-x rect { fill: transparent; stroke: var(--border); stroke-width: 1; }
.fo-dg-x text { font-size: 15px; font-weight: 700; fill: var(--text-secondary); pointer-events: none; }
.fo-dg-x:hover rect { fill: var(--danger); stroke: var(--danger); }
.fo-dg-x:hover text { fill: #fff; }
.fo-dg-row-fx { fill: transparent; cursor: pointer; }
.fo-dg-row:hover .fo-dg-row-fx { fill: color-mix(in srgb, var(--accent) 10%, transparent); }
.fo-dg-tx { font-size: 11px; fill: var(--text-secondary); pointer-events: none; }
.fo-dg-tx.usada { fill: var(--text-primary); font-weight: 600; }
.fo-dg-pt { stroke: #0b1220; stroke-width: 1.4; cursor: pointer; }
.fo-dg-pt.usada { stroke-width: 2.2; }
.fo-dg-pt.marcado { stroke: #ff4414; stroke-width: 3.5; }
.fo-dg-linhas { pointer-events: none; }
.fo-dg-fus { pointer-events: auto; cursor: pointer; }
.fo-dg-fus path { fill: none; }
.fo-dg-sombra { stroke: #0b1220; stroke-width: 4.6; opacity: .8; }
.fo-dg-linha { stroke-width: 2.6; }
.fo-dg-toque { stroke: transparent; stroke-width: 12; }
.fo-dg-fus.rec .fo-dg-linha { stroke-dasharray: 5 4; }
.fo-dg-fus:hover .fo-dg-sombra, .fo-dg-fus.sel .fo-dg-sombra { stroke: #ff4414; stroke-width: 6.5; opacity: 1; }
@media (max-width: 860px) {
  .fo-diag-tela { padding: 0; } .fo-diag-caixa { border-radius: 0; }
  /* celular: título e ✕ na primeira linha, botões embaixo (cabeçalho baixo, mais diagrama na tela) */
  .fo-diag-x { order: 2; }
  .fo-diag-bts { order: 3; flex: 1 0 100%; }
  .fo-diag-band-txt { display: none; }
}
.fo-acoes-caixa .btn-primary { font-weight: 700; }
.fo-diag-add { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--accent) 8%, transparent); font-size: 12px; }
.fo-diag-add .form-select { width: auto; max-width: 280px; padding: 3px 6px; font-size: 12px; height: auto; }
.fo-diag-add-it { display: inline-flex; align-items: center; gap: 4px; padding: 3px 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--card-solid, var(--bg-primary)); }
.fo-diag-bts .btn.active { background: var(--accent); color: var(--accent-ink, #fff); border-color: var(--accent); }
/* ID do cadastro no IXC ao lado do nome da caixa */
.fo-id-ixc { display: inline-block; vertical-align: middle; margin-left: 6px; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); }
/* nomes escritos no mapa (CTO, CEO, cabo…): texto claro com contorno escuro, legível em ruas e satélite */
.fo-rotulo { pointer-events: none; }
.fo-rotulo span { position: absolute; left: 0; top: 0; transform: translate(-50%, 12px); white-space: nowrap; font-size: 11px; font-weight: 700; color: #fff; letter-spacing: .2px;
  text-shadow: 0 0 2px #0b1220, 0 0 2px #0b1220, 0 0 3px #0b1220, 1px 1px 0 #0b1220, -1px -1px 0 #0b1220; }
.fo-rotulo.cabo span { transform: translate(-50%, -50%); font-size: 10px; font-weight: 600; color: #dbeafe; }
.fo-rotulo.poste span, .fo-rotulo.reserva span { font-size: 9.5px; font-weight: 600; transform: translate(-50%, 7px); color: #e2e8f0; }

/* ---- ferramentas do mapa (ao lado do zoom): medir e medições salvas, num grupo só ---- */
.fo-ferramentas { position: absolute; left: 54px; top: 10px; z-index: 800; display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; box-shadow: var(--shadow-md); background: var(--card-solid, var(--bg-primary)); }
.fo-ferramentas .btn { border: 0; border-radius: 0; background: var(--card-solid, var(--bg-primary)); box-shadow: none; padding: 0 10px; height: 32px; }
.fo-ferramentas .btn + .btn { border-left: 1px solid var(--border); }
.fo-ferramentas .btn:hover { background: var(--bg-hover, var(--bg-tertiary)); }
.fo-ferramentas .btn.active { background: #facc15; color: #111827; }

/* ---- medição (régua) ---- */
/* lista de medições salvas: abre logo abaixo das ferramentas */
.fo-medicoes { position: absolute; left: 54px; top: 50px; z-index: 850; width: min(320px, calc(100% - 64px)); max-height: 55%; overflow: auto; background: var(--card-solid, var(--bg-primary)); border: 1px solid var(--border); border-radius: 8px; padding: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.3); font-size: 12px; box-sizing: border-box; }
.fo-medicoes[hidden] { display: none; }
.fo-medicoes-cab { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.fo-medicoes-it { display: flex; align-items: center; gap: 4px; border-top: 1px solid var(--border); }
.fo-medicoes-abrir { flex: 1; min-width: 0; text-align: left; border: 0; background: none; color: var(--text-primary); padding: 6px 2px; cursor: pointer; display: flex; flex-direction: column; }
.fo-medicoes-abrir small { color: var(--text-secondary); font-size: 11px; }
.fo-medicoes-abrir:hover b { text-decoration: underline; }
.fo-medida-barra { flex-wrap: wrap; }
/* total da medição: etiqueta amarela (a cor da régua), legível no tema claro e no escuro */
.fo-medida-tot { font-size: 15px; color: #111827; background: #facc15; border-radius: 6px; padding: 1px 8px; }
.fo-medida-salvar { display: inline-flex; gap: 6px; align-items: center; }
.fo-medida-salvar[hidden] { display: none; }
.fo-medida-salvar .form-input { width: 240px; max-width: 60vw; padding: 4px 8px; font-size: 12px; }
.fo-medida-rot { pointer-events: none; }
.fo-medida-rot span { position: absolute; left: 0; top: 0; transform: translate(-50%, -26px); white-space: nowrap; font-size: 11.5px; font-weight: 800; color: #facc15;
  text-shadow: 0 0 2px #0b1220, 0 0 2px #0b1220, 0 0 3px #0b1220, 1px 1px 0 #0b1220, -1px -1px 0 #0b1220; }
/* manobra de porta (grava no IXC) */
.fo-manobra-linha td { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.fo-manobra { display: flex; flex-direction: column; gap: 6px; padding: 4px 0; font-size: 12px; }
.fo-manobra-portas { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.fo-manobra-portas .btn { min-width: 30px; }
.fo-manobra-portas .btn.active { background: var(--accent); color: var(--accent-ink, #fff); border-color: var(--accent); }
.fo-manobra-portas .form-input { width: 80px; padding: 3px 6px; }
.fo-manobra-conf { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.fo-manobra-conf[hidden] { display: none; }

/* ---- Cadastros: tela própria por cima do mapa ---- */
.fo-cad-tela { position: fixed; inset: 0; z-index: 2900; background: rgba(0,0,0,.6); display: flex; align-items: stretch; justify-content: center; padding: 16px; }
.fo-cad-tela[hidden] { display: none; }
.fo-cad-janela { background: var(--card-solid, var(--bg-primary)); border-radius: 12px; width: min(1280px, 100%); display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 12px 40px rgba(0,0,0,.4); }
.fo-cad-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.fo-cad-head h2 { margin: 0; font-size: 18px; }
.fo-cad-head small { color: var(--text-secondary); font-size: 12px; }
.fo-cad-menu { display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.fo-cad-menu button { border: 0; background: none; color: var(--text-secondary); font: inherit; font-size: 14px; font-weight: 600; padding: 10px 14px; border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.fo-cad-menu button:hover { color: var(--text-primary); }
.fo-cad-menu button.active { color: var(--accent); border-bottom-color: var(--accent); }
.fo-cad-menu em { font-style: normal; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--bg-primary); border: 1px solid var(--border); color: var(--text-secondary); }
.fo-cad-menu em:empty { display: none; }
.fo-cad-area { flex: 1; display: flex; min-height: 0; }
.fo-cad-principal { flex: 1; min-width: 0; overflow: auto; padding: 12px 16px 16px; }
.fo-cad-lado { flex: 0 0 380px; border-left: 1px solid var(--border); overflow: auto; background: var(--bg-secondary, var(--bg-primary)); }
.fo-cad-lado[hidden] { display: none; }
.fo-cad-lado-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: inherit; z-index: 1; }
.fo-cad-lado-corpo { padding: 12px 14px; }
.fo-cad-intro { margin: 0 0 10px; font-size: 12px; }
.fo-cad-barra { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; }
.fo-cad-barra .form-input { flex: 1 1 260px; max-width: 420px; }
.fo-cad-barra .btn-primary { margin-left: auto; }
.fo-cad-inat { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.fo-cad-tabela-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
.fo-cad-tabela { width: 100%; border-collapse: collapse; font-size: 13px; }
.fo-cad-tabela th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); padding: 8px 10px; border-bottom: 1px solid var(--border); background: var(--bg-primary); position: sticky; top: 0; white-space: nowrap; }
.fo-cad-tabela td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.fo-cad-tabela .r { text-align: right; white-space: nowrap; }
.fo-cad-tabela tbody tr { cursor: pointer; }
.fo-cad-tabela tbody tr:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.fo-cad-tabela tbody tr.fo-cad-sel { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.fo-cad-tabela tbody tr.inativo { opacity: .55; }
.fo-cad-tabela tbody tr.aviso td:first-child { box-shadow: inset 3px 0 0 var(--warning); }
.fo-cad-tabela td small { display: block; font-size: 11px; color: var(--text-secondary); }
.fo-cad-st { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-secondary); }
.fo-cad-st.on { color: var(--success); border-color: color-mix(in srgb, var(--success) 50%, transparent); }
.fo-amostra i { width: 8px; height: 9px; }
.fo-ic-grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.fo-ic-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 14px 10px; border: 1px solid var(--border); border-radius: 10px; }
.fo-ic-card .fo-ic-prev.grande { width: 52px; height: 52px; display: flex; align-items: center; justify-content: center; }
.fo-ic-card .fo-ic-prev.grande svg, .fo-ic-card .fo-ic-prev.grande img { width: 44px; height: 44px; object-fit: contain; }
.fo-ic-card .fo-ic-bts { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin-top: 6px; }
@media (max-width: 860px) {
  .fo-cad-tela { padding: 0; }
  .fo-cad-janela { border-radius: 0; }
  .fo-cad-lado { position: absolute; inset: 0; z-index: 2; flex: none; border-left: 0; }
  .fo-cad-area { position: relative; }
  .fo-cad-head small { display: none; }
}
/* foto da caixa: situação no IXC */
.fo-foto-ixc { position: absolute; top: 3px; right: 3px; font-size: 9.5px; font-weight: 800; padding: 1px 5px; border-radius: 999px; color: #fff; background: rgba(0,0,0,.6); }
.fo-foto-ixc.ok { background: #15803d; }
.fo-foto-ixc.erro { background: #b91c1c; }
.fo-foto-ixc.pend { background: #a16207; }
.fo-foto-ixc-txt { display: block; margin-top: 3px; }
/* cadastros: equipamentos e ativos */
.fo-eq-tipos { margin-bottom: 10px; }
.fo-eq-tipos em { font-style: normal; opacity: .75; margin-left: 2px; }
.fo-eq-badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); white-space: nowrap; }
.fo-eq-campos { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
@media (max-width: 860px) { .fo-eq-campos { grid-template-columns: 1fr; } }
/* busca: botões "por coordenada" / "por elemento" ao lado do campo */
.fo-busca { display: flex; gap: 4px; align-items: stretch; }
.fo-busca-modo { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-primary); flex: 0 0 auto; }
.fo-busca-modo button { display: inline-flex; align-items: center; justify-content: center; width: 32px; border: 0; border-radius: 6px; background: none; color: var(--text-secondary); cursor: pointer; }
.fo-busca-modo button:hover { color: var(--text-primary); }
.fo-busca-modo button.active { background: var(--accent); color: var(--accent-ink, #fff); }
.fo-busca-campo { position: relative; flex: 1; min-width: 0; }
.fo-res-pino { background: #ef4444 !important; border-radius: 50% 50% 50% 0 !important; transform: rotate(-45deg); }
/* pino da coordenada procurada */
.fo-pino span { display: block; width: 26px; height: 26px; border-radius: 50% 50% 50% 0; background: #ef4444; border: 3px solid #fff; transform: rotate(-45deg); box-shadow: 0 2px 6px rgba(0,0,0,.45); }
.fo-pino span::after { content: ''; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: #fff; }
.fo-pino-pop { font-size: 12px; display: flex; flex-direction: column; gap: 4px; }
/* ---- potência das ONUs da CTO (relatório por caixa) ---- */
.fo-porta.sem { color: var(--text-secondary); border-style: dashed; }
.fo-onu-mini { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--text-secondary); margin: -2px 0 8px; }
.fo-onu-head-bts { display: flex; gap: 6px; flex: 0 0 auto; }
.fo-onu-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; margin-bottom: 12px; }
.fo-onu-card { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fo-onu-card span { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .03em; }
.fo-onu-card b { font-size: 17px; font-variant-numeric: tabular-nums; }
.fo-onu-card.bom b { color: var(--success); }
.fo-onu-card.medio b { color: var(--warning); }
.fo-onu-card.ruim b { color: var(--danger); }
.fo-onu-card.ruim { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.fo-onu-card-olt { grid-column: span 2; }
.fo-onu-card-olt b { font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
.fo-onu-card-olt small { font-weight: 400; color: var(--text-secondary); }
.fo-onu-filtros { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 10px; }
.fo-onu-filtros em { font-style: normal; opacity: .7; margin-left: 2px; }
.fo-onu-legenda { margin-left: auto; font-size: 11px; }
.fo-onu-legenda i { font-style: normal; margin-left: 6px; }
.fo-onu-tab td { white-space: nowrap; }
.fo-onu-tab td:nth-child(2) { white-space: normal; min-width: 170px; }
.fo-onu-tab .r { font-variant-numeric: tabular-nums; }
.fo-onu-tab tbody tr.fo-onu-off td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.fo-onu-tab tbody tr.fo-onu-det { cursor: default; background: var(--bg-secondary, var(--bg-primary)); }
.fo-onu-tab tbody tr.fo-onu-det:hover { background: var(--bg-secondary, var(--bg-primary)); }
.fo-onu-velha { color: var(--text-secondary); font-style: italic; }
.fo-onu-causa { font-size: 12px; }
.fo-onu-tab td:nth-last-child(2) { white-space: normal; min-width: 130px; }
.fo-onu-det-corpo { display: flex; gap: 16px; padding: 6px 2px; flex-wrap: wrap; white-space: normal; position: sticky; left: 10px; width: var(--det-w, auto); max-width: 100%; box-sizing: border-box; }
.fo-onu-det-info { flex: 0 0 230px; }
.fo-onu-graf { flex: 1 1 380px; min-width: 0; }
.fo-graf { width: 100%; height: 180px; display: block; }
.fo-graf text { font-size: 10px; fill: var(--text-secondary); }
.fo-graf .fo-graf-grade { stroke: var(--border); stroke-width: 1; }
.fo-graf-leg { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.fo-graf-leg i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }
.fo-graf-leg i.fo-graf-leg-q { height: 0; border-top: 2px dashed var(--danger); background: none; }
.fo-onu-rodape { font-size: 11px; margin: 10px 0 0; }
@media (max-width: 860px) {
  .fo-onu-tela .fo-cad-head h2 { font-size: 15px; }
  .fo-onu-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .fo-onu-card { padding: 6px 8px; }
  .fo-onu-card span { font-size: 10px; }
  .fo-onu-card b { font-size: 14px; }
  .fo-onu-card-olt { grid-column: 1 / -1; }
  .fo-onu-legenda { margin-left: 0; width: 100%; }
  .fo-onu-det-info { flex: 1 1 100%; }
}
/* ---- cor da caixa (CTO/CEO/caixa subterrânea) ---- */
.fo-ic.com-cor { border-radius: 6px; box-shadow: 0 0 0 2px #fff, 0 0 0 4.5px var(--cor); }
.fo-cor-campo { display: flex; align-items: center; gap: 8px; }
.fo-cor-campo i { flex: 0 0 24px; height: 24px; border-radius: 6px; border: 1px solid var(--border); }
.fo-cor-campo i.vazia { background: repeating-linear-gradient(45deg, transparent 0 4px, var(--border) 4px 6px) !important; }
.fo-cor-campo .form-select { flex: 1; min-width: 0; }
.fo-cor-ficha { display: inline-flex; align-items: center; gap: 6px; }
.fo-cor-ficha i { width: 14px; height: 14px; border-radius: 4px; border: 1px solid rgba(127,127,127,.6); display: inline-block; flex: 0 0 14px; }
.fo-leg-cores { flex-direction: column; gap: 3px; }
.fo-leg-cores[hidden] { display: none; }
.fo-leg-cores .fo-sub { margin: 4px 0 0; }
.fo-leg-cores i { width: 11px; height: 11px; border-radius: 3px; border: 1px solid rgba(127,127,127,.6); display: inline-block; }
.fo-cores-tab tbody tr { cursor: default; }
.fo-cores-tab td:nth-child(2) { width: 60%; }
/* ---- menu do botão direito no mapa ---- */
.fo-menu-pop .leaflet-popup-content-wrapper { padding: 0; border-radius: 10px; background: var(--card-solid, var(--bg-primary)); color: var(--text-primary); box-shadow: 0 8px 28px rgba(0,0,0,.35); }
.fo-menu-pop .leaflet-popup-content { margin: 0; width: auto !important; min-width: 230px; }
.fo-menu-pop .leaflet-popup-tip { background: var(--card-solid, var(--bg-primary)); }
.fo-menu { display: flex; flex-direction: column; padding: 6px; font-size: 13px; max-height: 60vh; overflow-y: auto; }
.fo-menu-tit { font-weight: 700; font-size: 12px; padding: 6px 8px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; display: flex; flex-direction: column; gap: 2px; font-variant-numeric: tabular-nums; }
.fo-menu-tit small { font-weight: 400; color: var(--text-secondary); }
.fo-menu > button, .fo-menu > a { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 7px; background: none; color: var(--text-primary) !important; font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.fo-menu > button:hover, .fo-menu > a:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.fo-menu > button i, .fo-menu > a i { font-style: normal; width: 18px; text-align: center; flex: 0 0 18px; }
.fo-menu-sep { height: 1px; background: var(--border); margin: 4px 2px; }
.fo-menu-txt { padding: 6px 8px; font-size: 12px; }
.fo-menu .fo-menu-cto { justify-content: space-between; align-items: flex-start; }
.fo-menu-cto span { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.fo-menu-cto span b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fo-menu-cto small { font-size: 11px; color: var(--text-secondary); }
.fo-menu-cto > em { font-style: normal; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fo-menu-proj { font-style: normal; font-size: 10px; color: #f59e0b; }
/* CTO sem ID do IXC */
.fo-sem-id-bts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.fo-sem-id-lista { margin: 8px 0 4px; }
.fo-sem-id-lista .fo-linha span { min-width: 0; }
/* fotos que estão no IXC (abrem no IXC) */
.fo-fotos-ixc { margin-top: 10px; }
.fo-fotos-ixc[hidden] { display: none; }
.fo-fotos-ixc-tit { display: flex; flex-direction: column; gap: 1px; margin-bottom: 6px; font-size: 13px; }
.fo-fotos-ixc-tit small { font-size: 11px; }
.fo-fotos-ixc-lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.fo-foto-ixc-it { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; color: var(--text-primary); text-decoration: none; min-width: 0; }
.fo-foto-ixc-it:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.fo-foto-ixc-it i { font-style: normal; font-size: 18px; flex: 0 0 auto; }
.fo-foto-ixc-it span { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.fo-foto-ixc-it b { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fo-foto-ixc-it small { font-size: 10.5px; color: var(--text-secondary); }
.fo-foto-ixc-it em { font-style: normal; color: var(--text-secondary); }
/* PON dos clientes da CTO */
.fo-tab td.fo-pon { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }
.fo-tab td.fo-pon small { display: block; font-weight: 400; }
.fo-pons { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-size: 12px; color: var(--text-secondary); margin: 0 0 8px; }
.fo-pons b { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.fo-pons small { margin-left: -4px; }
.fo-pons.varias { padding: 6px 8px; border-radius: 8px; background: color-mix(in srgb, var(--warning) 12%, transparent); border: 1px solid color-mix(in srgb, var(--warning) 40%, transparent); }
.fo-tab th.r, .fo-tab td.r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fo-menu-proj.inativa { color: var(--text-secondary); }
/* ---- visões salvas do mapa ---- */
.fo-visoes { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.fo-visoes-cam { margin-bottom: 10px; }
.fo-visoes-cam:empty { display: none; }
.fo-visoes-linha { display: flex; align-items: center; gap: 6px; }
.fo-visoes-rot { font-size: 12px; font-weight: 700; color: var(--text-secondary); flex: 0 0 auto; }
.fo-visoes-linha .form-select { flex: 1; min-width: 0; padding-top: 5px; padding-bottom: 5px; font-size: 13px; }
.fo-visoes-linha .btn { flex: 0 0 auto; }
.fo-visoes-linha .btn[hidden] { display: none; }
.fo-visoes-status { font-size: 12px; margin-top: 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.fo-visoes-status:empty { display: none; }
.fo-visoes-painel { margin-top: 8px; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-secondary, var(--bg-primary)); }
.fo-visoes-painel[hidden] { display: none; }
.fo-visoes-form { display: flex; flex-direction: column; gap: 6px; }
.fo-visoes-resumo { font-size: 11px; }
.fo-visoes-op { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.fo-visoes-lista { display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow: auto; }
.fo-visoes-it { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 4px 2px; border-bottom: 1px dashed var(--border); }
.fo-visoes-it span { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.fo-visoes-it span b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fo-visoes-it span small { font-size: 11px; }
.fo-visoes-it em { font-style: normal; display: flex; gap: 2px; flex: 0 0 auto; }
/* ---- exportar área (KML/KMZ) ---- */
.fo-exp-menu { position: absolute; left: 54px; top: 48px; z-index: 900; min-width: 250px; max-width: calc(100% - 70px); background: var(--card-solid, var(--bg-primary)); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.35); padding: 6px; display: flex; flex-direction: column; }
.fo-exp-menu[hidden] { display: none; }
.fo-exp-tit { font-size: 12px; font-weight: 700; color: var(--text-secondary); padding: 4px 8px 6px; }
.fo-exp-menu > button { text-align: left; border: 0; background: none; color: var(--text-primary); font: inherit; font-size: 13px; padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.fo-exp-menu > button:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.fo-exp-nota { font-size: 11px; color: var(--text-secondary); padding: 6px 8px 2px; border-top: 1px solid var(--border); margin-top: 4px; }
/* ---- Street View dentro do mapa: o mapa em cima e o Street View embaixo (como no Google Maps) ---- */
.fo-mapa-wrap { --sv-h: 55%; }
.fo-com-sv .fo-mapa { bottom: var(--sv-h); }
.fo-com-sv .fo-rodape { bottom: calc(var(--sv-h) + 10px); }
/* o aviso de mapa vazio e a lista de Medições ficam na parte do mapa que aparece */
.fo-com-sv .fo-aviso-mapa { top: calc((100% - var(--sv-h)) / 2); }
.fo-com-sv .fo-medicoes { max-height: calc(100% - var(--sv-h) - 60px); }
.fo-sv { position: absolute; left: 0; right: 0; bottom: 0; height: var(--sv-h); z-index: 870; display: flex; flex-direction: column; background: #0b1220; border-top: 3px solid #facc15; box-sizing: border-box; }
.fo-sv[hidden] { display: none; }
/* ⤢ maior: o Street View ocupa o mapa todo (o +/− do mapa fica escondido) */
.fo-sv-grande .fo-sv { height: 100%; border-top: 0; z-index: 960; }
.fo-sv-grande .leaflet-control-container { visibility: hidden; }
/* ficha aberta à direita (PC): o Street View para onde ela começa, como o rodapé */
.fo:has(.fo-ficha:not([hidden])) .fo-sv { right: min(calc(var(--ficha-w) + 10px), 70%); }
.fo-sv-barra { display: flex; align-items: center; gap: 8px; padding: 5px 8px; background: var(--card-solid, var(--bg-primary)); border-bottom: 1px solid var(--border); font-size: 13px; }
.fo-sv-barra > b, .fo-sv-barra > .btn { flex: 0 0 auto; }
.fo-sv-barra [aria-pressed="true"] { background: #facc15; color: #111827; }
.fo-sv-st { order: 1; flex: 1; min-width: 0; color: var(--text-secondary); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fo-sv-pano { position: relative; flex: 1; min-height: 0; }
.fo-sv-dica { position: absolute; left: 50%; top: 50px; transform: translateX(-50%); z-index: 2; max-width: calc(100% - 32px); box-sizing: border-box; pointer-events: none; background: rgba(11, 18, 32, .82); color: #f1f5f9; padding: 6px 12px; border-radius: 999px; font-size: 12px; text-align: center; }
.fo-sv-dica[hidden] { display: none; }
.fo-sv-falha { position: absolute; inset: 0; z-index: 3; background: #0b1220; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 20px; box-sizing: border-box; text-align: center; color: #e5e7eb; font-size: 14px; }
.fo-sv-falha p { margin: 6px 0 12px; color: #cbd5e1; max-width: 420px; }
/* boneco no mapa: onde se está no Street View e para onde se olha (o cone gira) */
.fo-sv-boneco { cursor: grab; }
.fo-sv-boneco svg { display: block; overflow: visible; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .6)); }
.fo-sv-boneco circle { fill: #facc15; stroke: #0b1220; stroke-width: 2.5; }
.fo-sv-cone { fill: rgba(250, 204, 21, .35); stroke: #facc15; stroke-width: 1.5; }
@media (max-width: 860px) {
  .fo-mapa-wrap { --sv-h: 50%; }
  .fo-sv-barra > b { display: none; }
  .fo-sv-dica { top: 46px; font-size: 11px; }
  /* celular: a ficha é a folha de baixo (recolhida ao abrir o Street View: só o cabeçalho, 78 px) */
  .fo:has(.fo-ficha:not([hidden])) .fo-sv { right: 0; }
  .fo:has(.fo-ficha.fo-min:not([hidden])) .fo-mapa-wrap:not(.fo-sv-grande) .fo-sv { bottom: 78px; height: calc(var(--sv-h) - 78px); }
  .fo:has(.fo-ficha.fo-min:not([hidden])) .fo-com-sv .fo-rodape { bottom: calc(var(--sv-h) + 10px); }
}
@media (max-width: 480px) { .fo-ferr-txt { display: none; } }
/* boneco do Street View (como no Google): na barra e no canto do mapa; arraste e solte na rua */
.fo-boneco-ctrl a { touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
/* no canto do mapa: quadradinho branco como o controle do Google */
.fo-boneco-ctrl.leaflet-bar { border: 0 !important; border-radius: 3px !important; box-shadow: 0 1px 4px rgba(0, 0, 0, .35) !important; }
.fo-boneco-ctrl a { display: flex !important; align-items: center; justify-content: center; width: 40px !important; height: 40px !important; background: #fff !important; border: 0 !important; border-radius: 3px; }
.fo-boneco-ctrl a:hover { background: #f1f3f4 !important; }
.fo-boneco-ctrl .fo-boneco-svg { width: 28px; height: 28px; }
.fo-boneco-ctrl a:hover .fo-boneco-svg { transform: scale(1.15); }
.fo-boneco-svg { display: block; pointer-events: none; transition: transform .15s; }
.fo-boneco-ctrl a.arrastando { opacity: .35; cursor: grabbing; }
.fo-boneco-ctrl a.active { background: #fef3c7 !important; box-shadow: inset 0 0 0 2px #facc15; }
.fo-boneco-fantasma { position: fixed; z-index: 9999; pointer-events: none; transform: translate(-50%, -92%); filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .45)); }
.fo-boneco-fantasma .fo-boneco-svg { width: 36px; height: 40px; }
.fo-mapa.fo-sv-soltar { outline: 3px dashed rgba(250, 204, 21, .9); outline-offset: -3px; }
/* ↻ Atualizar (barra do mapa e bloco Clientes da ficha): o ícone gira enquanto lê */
.fo-cli-acoes { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.fo-cli-lido { margin: -4px 0 8px; font-size: 11px; }
.fo-bt-atualizar .fo-gira { display: inline-block; }
.fo-bt-atualizar.fo-girando .fo-gira { animation: fo-gira .8s linear infinite; }
@keyframes fo-gira { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .fo-bt-atualizar.fo-girando .fo-gira { animation: none; } }
/* tabela de clientes da CTO: nome da ONU (lacre em destaque) e ID do cliente */
.fo-tab-clientes td.fo-nome-onu { word-break: break-all; min-width: 110px; font-size: 11px; color: var(--text-secondary); }
.fo-tab-clientes td.fo-nome-onu b { color: var(--text-primary); font-weight: 700; }
.fo-tab-clientes td.fo-id-cliente { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; user-select: all; }
/* ---- arquivos importados (KML, KMZ, GeoJSON, GPX): referência por baixo da rede ---- */
.fo-arquivos h3 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fo-arq-form { margin: 2px 0 8px; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-secondary, var(--bg-primary)); display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.fo-arq-form[hidden] { display: none; }
.fo-arq-form .form-input { padding: 5px 8px; font-size: 13px; }
.fo-arq-resumo { display: flex; flex-direction: column; gap: 2px; word-break: break-all; }
.fo-arq-cor { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fo-arq-cor input[type=color], .fo-arq-edit input[type=color] { width: 32px; height: 26px; padding: 0; border: 1px solid var(--border); border-radius: 4px; background: none; cursor: pointer; flex: 0 0 auto; }
.fo-arq-bts { display: flex; gap: 6px; }
.fo-arq-erro { color: var(--danger, #ef4444); }
.fo-arq-it { display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; }
.fo-arq-it .fo-cam { flex: 1; min-width: 0; }
.fo-arq-nome { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fo-arq-acoes { display: inline-flex; gap: 2px; flex: 0 0 auto; }
.fo-arq-edit { flex-basis: 100%; display: flex; gap: 4px; align-items: center; padding: 2px 0 6px 22px; }
.fo-arq-edit[hidden] { display: none; }
.fo-arq-edit .form-input { flex: 1; min-width: 0; padding: 4px 6px; font-size: 12px; }
.fo-arq-pop-c { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.fo-arq-desc { max-height: 180px; overflow: auto; word-break: break-word; border-top: 1px solid var(--border); padding-top: 4px; }
.fo-rotulo-arq span { font-style: italic; opacity: .9; transform: translate(-50%, 26px); } /* abaixo do nome da rede no mesmo lugar */
.fo-arq-acoes .fo-x { color: var(--text-secondary); font-size: 14px; }
.fo-arq-acoes .fo-x:hover { color: var(--text-primary); }
.fo-arq-pop .leaflet-popup-content-wrapper { border-radius: 10px; background: var(--card-solid, var(--bg-primary)); color: var(--text-primary); box-shadow: 0 8px 28px rgba(0,0,0,.35); }
.fo-arq-pop .leaflet-popup-tip { background: var(--card-solid, var(--bg-primary)); }
.fo-arq-pop .leaflet-popup-content { margin: 10px 12px; }
.fo-arq-pop a { color: var(--accent); }
/* editar traçado: as pontas do cabo (tocar continua o cabo dali, como no Google Earth) */
.fo-vertice-ponta span { background: #ff4414; border: 3px solid #fff; box-shadow: 0 0 0 2px #ff4414, 0 1px 4px rgba(0, 0, 0, .5); cursor: pointer; }
.fo-vertice-ponta.ativa span { background: #facc15; box-shadow: 0 0 0 3px #ff4414, 0 0 12px #facc15; }
.fo-desenho .btn[hidden] { display: none; }
/* cliente cancelado (login desativado no IXC, ONU ainda na porta): preto/vermelho, diferente do offline */
.fo-porta.cancel { background: #0b0f17; color: #f87171; border-color: var(--danger); text-decoration: line-through; }
.fo-cancelado, .fo-login-cancel { color: var(--danger); font-weight: 700; }
.fo-outra-caixa { color: var(--warning, #f59e0b); }
/* fotos do IXC: painel com ‹ › (a imagem abre numa janela do IXC por cima) */
.fo-fip { position: fixed; left: 16px; bottom: 16px; z-index: 2500; width: min(360px, calc(100vw - 32px)); box-sizing: border-box; display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; background: var(--card-solid, var(--bg-primary)); color: var(--text-primary); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 32px rgba(0, 0, 0, .45); font-size: 13px; }
.fo-fip[hidden] { display: none; }
.fo-fip-topo { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fo-fip-desc { display: flex; flex-direction: column; gap: 2px; word-break: break-word; }
.fo-fip-nav { display: flex; gap: 6px; }
.fo-fip-nav .btn { flex: 1; }
@media (max-width: 860px) { .fo-fip { left: 8px; right: 8px; bottom: 8px; width: auto; } }
/* balão do cabo (toque num cabo): resumo e atalhos */
.fo-cb { display: flex; flex-direction: column; gap: 4px; font-size: 12px; min-width: 220px; }
.fo-cb-tit { display: flex; flex-direction: column; gap: 2px; margin-bottom: 2px; }
.fo-cb-tit b { font-size: 14px; word-break: break-word; }
.fo-cb-kv { display: flex; justify-content: space-between; gap: 10px; }
.fo-cb-kv span { color: var(--text-secondary); flex: 0 0 auto; }
.fo-cb-kv b { font-weight: 600; text-align: right; word-break: break-word; }
.fo-cb-cx, .fo-cb-obs { color: var(--text-secondary); border-top: 1px dashed var(--border); padding-top: 4px; word-break: break-word; }
.fo-cb-bts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.fo-cb-bts .btn { flex: 1 1 auto; }
/* plano de fusão no fim da ficha da caixa: prévia do diagrama (tocar amplia) */
.fo-plano-svg { max-height: 480px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-secondary, var(--bg-primary)); cursor: zoom-in; padding: 4px; }
.fo-plano-svg svg { width: 100%; min-width: var(--min-w, 0); max-width: var(--max-w, none); height: auto; margin: 0 auto; pointer-events: none; }
.fo-plano-svg:focus-visible { outline: 2px solid var(--accent); }
.fo-plano h3 em { font-style: normal; font-size: 11px; font-weight: 400; }
/* ✂ romper o cabo: tesoura arrastável no corte, rótulos das duas partes e o resumo do formulário */
.fo-romper-tesoura span { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: #fff; color: #ff4414;
  border: 3px solid #ff4414; box-shadow: 0 1px 6px rgba(0, 0, 0, .55); font-size: 16px; font-weight: 800; line-height: 1; cursor: grab; box-sizing: border-box; }
.fo-romper-tesoura:active span { cursor: grabbing; }
.fo-romper-rot span { color: #fff; }
.fo-romper-resumo { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; margin-bottom: 4px; }
.fo-romper-resumo span { display: inline-flex; align-items: center; gap: 6px; }
.fo-romper-resumo i { display: inline-block; width: 18px; height: 5px; border-radius: 3px; }
.fo-romper-cx { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; }
.fo-romper-emendar { display: flex; gap: 8px; align-items: flex-start; color: var(--text-primary); }
.fo-romper-emendar input { margin-top: 2px; }
