/* 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); }
.fo-busca-linha { display: flex; gap: 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; }
.fo-bases { display: flex; gap: 6px; flex-wrap: wrap; }
.fo-bases .btn.active { background: var(--accent); color: var(--accent-ink, #fff); border-color: var(--accent); }
.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); }
.fo-status { position: absolute; left: 10px; bottom: 10px; z-index: 800; 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; }
.fo-status { max-width: calc(100% - 20px); box-sizing: border-box; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fo-status.fo-erro { color: var(--danger); }
.fo-aviso-mapa { position: absolute; left: 50%; top: 16px; transform: translateX(-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); max-width: calc(100% - 32px); flex-wrap: wrap; }
.fo-aviso-mapa[hidden] { display: none; }
/* lembrete de filtro de projetos ligado (embaixo à esquerda, acima do status) */
.fo-filtro-mapa { position: absolute; left: 10px; bottom: 40px; z-index: 800; 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: calc(100% - 20px); 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 { position: absolute; top: 0; right: 0; bottom: 0; width: min(460px, 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-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 { width: 100%; }
.fo-bt-editar.active { background: var(--accent); color: var(--accent-ink, #fff); border-color: var(--accent); }
.fo-barra-ed { position: absolute; top: 10px; left: 56px; 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 */
/* projeto em edição + status dos itens novos: bloco na lateral (só no modo edição) */
.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; }
/* 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); }
.fo-desenho { position: absolute; left: 50%; bottom: 40px; transform: translateX(-50%); z-index: 850; 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: calc(100% - 20px); box-sizing: border-box; }
.fo-acoes { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.fo-perigo { color: var(--danger); }
.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 não passa por baixo dela */
.fo:has(.fo-ficha:not([hidden])) .fo-barra-ed { right: min(470px, 60%); }
.fo:has(.fo-ficha:not([hidden])) .fo-desenho { left: calc((100% - min(460px, 100%)) / 2); }

/* 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-bt-painel { display: inline-flex; align-items: center; white-space: nowrap; }
  .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; }
  .fo:has(.fo-ficha:not([hidden])) .fo-desenho { left: 50%; bottom: 88px; }
  /* 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: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.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; }
.fo-diag-bts .form-input { width: 52px; padding: 3px 6px; font-size: 12px; }
.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); }
.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-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; } }
.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); }
