:root {
  --bg: #0a111f; --panel: #111a2e; --panel2: #16213a; --line: #25324d; --text: #e6edf7; --muted: #8fa0bd;
  --accent: #38bdf8; --ok: #22c55e; --warn: #f59e0b; --bad: #ef4444; --pend: #94a3b8; --violet: #a78bfa;
  --radius: 10px; --nav-w: 208px; --panel-w: 400px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; }
h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 16px 0 8px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .hidden { display: none !important; }
.link { color: var(--accent); cursor: pointer; } .link:hover { text-decoration: underline; }
code { background: #0b1324; padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* Layout */
#app { height: 100%; display: grid; grid-template-columns: var(--nav-w) 1fr; grid-template-rows: 54px 1fr; grid-template-areas: "nav top" "nav main"; }
.nav { grid-area: nav; background: #0c1527; border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 10px 8px; gap: 2px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; font-weight: 700; letter-spacing: .01em; }
.brand .logo { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #0ea5e9, #22c55e); display: grid; place-items: center; color: #04101f; }
.brand small { display: block; color: var(--muted); font-weight: 500; font-size: 11px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: #b6c3dc; }
.nav a:hover { background: #14203a; color: #fff; }
.nav a.active { background: #13294a; color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav .spacer { flex: 1; }
.nav .sep { height: 1px; background: var(--line); margin: 8px 6px; }
.topbar { grid-area: top; display: flex; align-items: center; gap: 12px; padding: 0 16px; border-bottom: 1px solid var(--line); background: #0c1527; position: relative; }
.crumbs { display: flex; gap: 6px; align-items: center; color: var(--muted); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs b { color: var(--text); font-weight: 600; }
.search { margin-left: auto; position: relative; width: min(420px, 40vw); }
.search input { width: 100%; padding: 8px 12px 8px 34px; background: #0a1322; border: 1px solid var(--line); border-radius: 8px; color: var(--text); }
.search input:focus { outline: 2px solid #1f6f9a; }
.search .ico { position: absolute; left: 10px; top: 9px; color: var(--muted); }
.results { position: absolute; top: 40px; left: 0; right: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; max-height: 70vh; overflow: auto; z-index: 2000; box-shadow: 0 16px 40px #0009; }
.results a { display: grid; grid-template-columns: 78px 1fr auto; gap: 8px; align-items: center; padding: 8px 12px; border-bottom: 1px solid #1b2742; }
.results a:hover, .results a.hl { background: #16264a; }
.results .t { font-size: 11px; text-transform: uppercase; color: var(--accent); letter-spacing: .05em; }
.results .sub { color: var(--muted); font-size: 12px; }
.userbox { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.userbox b { color: var(--text); }
main { grid-area: main; overflow: auto; position: relative; min-width: 0; }
.page { padding: 18px 22px 40px; max-width: 1500px; }
.page.fill { padding: 0; max-width: none; height: 100%; display: flex; flex-direction: column; }
body.panel-open main { margin-right: var(--panel-w); }

/* Panel contextual */
.panel { position: fixed; right: 0; top: 54px; bottom: 0; width: var(--panel-w); background: var(--panel); border-left: 1px solid var(--line); z-index: 900; display: flex; flex-direction: column; box-shadow: -10px 0 30px #0006; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.panel-head h3 { font-size: 16px; word-break: break-word; }
.panel-body { overflow: auto; padding: 14px 16px 30px; flex: 1; }
.card-stack > * + * { margin-top: 12px; }

/* Botones y controles */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line); background: #15203a; color: var(--text); cursor: pointer; font: inherit; }
.btn:hover { background: #1b2a4c; border-color: #35507f; }
.btn.primary { background: #0e7490; border-color: #0891b2; } .btn.primary:hover { background: #0891b2; }
.btn.danger { background: #3a1620; border-color: #7f1d1d; color: #fecaca; } .btn.danger:hover { background: #55202c; }
.btn.small { padding: 4px 8px; font-size: 12px; } .btn.on { background: #13425e; border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { background: transparent; border: 1px solid transparent; color: var(--muted); padding: 5px; border-radius: 6px; cursor: pointer; display: inline-grid; place-items: center; }
.icon-btn:hover { background: #1a2a4a; color: #fff; } .icon-btn.tiny { padding: 2px; }
input, select, textarea { background: #0a1322; color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font: inherit; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid #1f6f9a; border-color: transparent; }
input[type=checkbox] { width: auto; }
.row { display: flex; align-items: center; } .gap { gap: 8px; } .wrap { flex-wrap: wrap; }
.badge { --c: #94a3b8; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 2px 9px; border-radius: 99px; border: 1px solid color-mix(in srgb, var(--c) 55%, transparent); background: color-mix(in srgb, var(--c) 16%, transparent); color: color-mix(in srgb, var(--c) 70%, white); white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.chip { --c: #475569; display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 6px; background: color-mix(in srgb, var(--c) 25%, #0b1324); border: 1px solid color-mix(in srgb, var(--c) 50%, transparent); }
.chip.blue { --c: #3b82f6; } .chip.violet { --c: #8b5cf6; }

/* Props */
.props { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; margin: 0; }
.props dt { color: var(--muted); font-size: 12px; padding-top: 1px; } .props dd { margin: 0; word-break: break-word; }

/* Cabecera de página */
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h2 { font-size: 22px; } .page-head .grow { flex: 1; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters input, .filters select { width: auto; min-width: 150px; }
.empty { text-align: center; color: var(--muted); padding: 28px 10px; }

/* Tarjetas */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; cursor: pointer; position: relative; overflow: hidden; }
.card:hover { border-color: #3b5a8c; background: #131f38; }
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c, #475569); }
.card h3 { font-size: 16px; margin-bottom: 4px; }
.card .meta { display: flex; gap: 14px; margin-top: 10px; color: var(--muted); font-size: 12px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: block; }
.stat:hover { border-color: #3b5a8c; } .stat b { font-size: 28px; display: block; } .stat span { color: var(--muted); font-size: 12px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; } @media (max-width: 1100px) { .two-col { grid-template-columns: 1fr; } }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }

/* Tablas */
table.t { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.t th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 9px 10px; background: #0e1830; position: sticky; top: 0; }
table.t td { padding: 8px 10px; border-top: 1px solid #1b2742; vertical-align: top; }
table.t tbody tr { cursor: pointer; } table.t tbody tr:hover { background: #15233f; } table.t tr.sel { background: #12335a; }
.table-wrap { overflow: auto; border-radius: var(--radius); }

/* Pestañas */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 14px 0; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; gap: 6px; align-items: center; }
.tabs a:hover { color: #fff; } .tabs a.active { color: #fff; border-color: var(--accent); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-tab { padding: 5px 12px; border-radius: 99px; background: #14203a; border: 1px solid var(--line); color: #b6c3dc; cursor: pointer; font: inherit; font-size: 13px; }
.chip-tab.active { background: #0e7490; border-color: #0891b2; color: #fff; }

/* Escenarios SVG */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.toolbar .rk-actions { margin-left: auto; }
.stage { display: flex; flex-direction: column; gap: 10px; }
.svg-host { position: relative; height: calc(100vh - 290px); min-height: 460px; background: radial-gradient(circle at 50% 0, #101c35, #080e1b); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.svg-host.tall { height: calc(100vh - 200px); }
.canvas { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; user-select: none; }
.canvas.panning { cursor: grabbing; }
.legend { position: absolute; left: 10px; bottom: 10px; display: flex; gap: 12px; background: #0a1322cc; padding: 5px 10px; border-radius: 8px; font-size: 11px; color: var(--muted); flex-wrap: wrap; max-width: 70%; pointer-events: none; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.hint { position: absolute; right: 12px; bottom: 10px; background: #0a1322cc; padding: 5px 10px; border-radius: 8px; font-size: 11px; color: var(--muted); max-width: 40%; pointer-events: none; text-align: right; }
.zoombar { display: inline-flex; background: #0e1830; border: 1px solid var(--line); border-radius: 8px; }
.unmounted { background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); padding: 4px 14px 12px; }

/* Rack */
.unum { fill: #7c8db0; font-size: 11px; font-family: ui-monospace, monospace; }
.uline { stroke: #16213a; stroke-width: 1; }
.screw { fill: #3a4767; }
.slot rect { fill: transparent; stroke: #16213a; } .slot text { fill: transparent; font-size: 12px; }
.slot:hover rect { fill: #0e7490; fill-opacity: .12; stroke: #0891b2; stroke-dasharray: 4 3; } .slot:hover text { fill: #67e8f9; }
.slot { cursor: pointer; }
.dev { cursor: pointer; } .dev .face { transition: stroke .15s; } .dev:hover .face { stroke: #5c7bb5; }
.dname { fill: #eaf1ff; font-size: 12.5px; font-weight: 650; } .dmodel { fill: #93a5c6; font-size: 10.5px; } .dip { fill: #6d7fa3; font-size: 9.5px; font-family: ui-monospace, monospace; }
.pnum { font-size: 7.5px; font-family: ui-monospace, monospace; pointer-events: none; }
.port { cursor: pointer; outline: none; } .port:hover > *:first-child { stroke: #fff; stroke-opacity: 1; stroke-width: 2; }
.port.sel > *:first-child { stroke: #38bdf8; stroke-width: 2.8; stroke-opacity: 1; filter: drop-shadow(0 0 4px #38bdf8); }
.port.remote > *:first-child { stroke: #38bdf8; stroke-width: 2.4; stroke-opacity: 1; filter: drop-shadow(0 0 4px #38bdf8); }
.port:focus-visible > *:first-child { stroke: #fff; stroke-width: 2; }
.cable .hit { cursor: pointer; } .cable path { transition: opacity .15s; } .cable:hover path:nth-child(1) { opacity: .9; }
.pill { cursor: pointer; } .pill rect { fill: #0e3a54; stroke: #38bdf8; } .pill text { fill: #e0f2fe; font-size: 11px; } .pill text.sub { fill: #8fb5cc; font-size: 9.5px; }
.pill:hover rect { fill: #11506f; }
.ghost.ok { fill: #22c55e; fill-opacity: .2; stroke: #22c55e; stroke-dasharray: 5 3; } .ghost.bad { fill: #ef4444; fill-opacity: .2; stroke: #ef4444; stroke-dasharray: 5 3; }

/* Topología / fibra / radio */
.node-box rect.bx { fill: #14203a; stroke: #3b4a6b; stroke-width: 1.4; }
.node-box { cursor: pointer; } .node-box:hover rect.bx { stroke: #7fa2dc; }
.node-box.sel rect.bx { stroke: #38bdf8; stroke-width: 2.6; }
.node-box.dim { opacity: .28; } .node-box.ghostnode rect.bx { stroke-dasharray: 5 4; fill: #0e1830; }
.node-box text.t1 { fill: #eaf1ff; font-size: 12px; font-weight: 600; } .node-box text.t2 { fill: #93a5c6; font-size: 10px; }
.edge { fill: none; stroke-width: 2; } .edge.logical { stroke-dasharray: 6 4; } .edge.sel { stroke-width: 4; filter: drop-shadow(0 0 5px #38bdf8); }
.edge-hit { fill: none; stroke: transparent; stroke-width: 14; cursor: pointer; } .edge-lbl { fill: #a9b8d4; font-size: 9.5px; font-family: ui-monospace, monospace; }
.edge.dim, .edge-hit.dim, .dim { opacity: .2; }
.flow { stroke-dasharray: 9 7; animation: flow 1.2s linear infinite; } @keyframes flow { to { stroke-dashoffset: -16; } }
@media (prefers-reduced-motion: reduce) { .flow { animation: none; } }
.fiber-edge { fill: none; stroke-width: 1.6; opacity: .7; } .fiber-edge.hl { opacity: 1; stroke-width: 3; filter: drop-shadow(0 0 4px currentColor); }
.collapse-badge { fill: #0e7490; stroke: #67e8f9; cursor: pointer; } .collapse-txt { fill: #fff; font-size: 10px; font-weight: 700; pointer-events: none; }
.site rect.card { fill: #101b33; stroke: #3b4a6b; stroke-width: 1.4; } .site text.sname { fill: #eaf1ff; font-size: 13px; font-weight: 650; } .site text.stype { fill: #8fa0bd; font-size: 10.5px; }
.ant { cursor: pointer; } .ant rect { fill: #17253f; stroke: #31456b; } .ant:hover rect, .ant.sel rect { stroke: #38bdf8; fill: #173050; } .ant text { fill: #dbe6fb; font-size: 11.5px; }
.rlink { fill: none; stroke-width: 2.6; } .rlink.ptmp { stroke-width: 1.8; }
.link-chip rect { fill: #0e1830; stroke: #3b4a6b; } .link-chip text { fill: #cbd8ef; font-size: 10.5px; } .link-chip { cursor: pointer; }

/* Modal */
.overlay { position: fixed; inset: 0; background: #020611b0; z-index: 3000; display: grid; place-items: center; padding: 20px; }
.modal { background: var(--panel); border: 1px solid #2d3d5f; border-radius: 14px; width: min(520px, 100%); max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 30px 80px #000a; }
.modal.wide { width: min(860px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 16px 18px; overflow: auto; } .modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; } .field.span2, .form-section.span2 { grid-column: 1 / -1; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; } .field small { color: var(--muted); font-size: 11px; display: block; margin-top: 3px; }
.req { color: var(--bad); } .form-section { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--accent); border-bottom: 1px solid var(--line); padding-bottom: 4px; margin-top: 6px; }
.form-error { color: #fca5a5; margin-top: 8px; }
.pg-rows { display: grid; gap: 6px; margin-bottom: 8px; } .pg-row { display: grid; grid-template-columns: 110px 1fr 86px 78px 90px 30px; gap: 6px; align-items: center; } .pg-row .mini { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); margin: 0; }
.endpoints { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } .endpoint { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px 10px; display: grid; gap: 6px; } .endpoint legend { color: var(--accent); font-size: 12px; padding: 0 6px; }
@media (max-width: 760px) { .form-grid, .endpoints { grid-template-columns: 1fr; } }

/* Misc */
#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 5000; display: grid; gap: 8px; }
.toast { background: #0f3a2a; border: 1px solid #166534; padding: 10px 16px; border-radius: 10px; box-shadow: 0 10px 30px #0008; } .toast.err { background: #3b1219; border-color: #7f1d1d; } .toast.warn { background: #3b2a0c; border-color: #92400e; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; } .gallery figure { margin: 0; background: #0a1322; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.gallery img { width: 100%; height: 90px; object-fit: cover; display: block; cursor: zoom-in; } .gallery figcaption { display: flex; justify-content: space-between; gap: 4px; padding: 3px 6px; font-size: 10.5px; color: var(--muted); } .gallery figcaption span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox { max-width: 100%; max-height: 72vh; display: block; margin: auto; border-radius: 8px; }
.doclist { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 4px; } .simple { padding-left: 18px; margin: 4px 0; }
.files > * + * { margin-top: 10px; }
.end-card, .dest-banner { background: #0d172b; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; } .dest-banner { border-color: #15607e; background: #0a2133; display: grid; gap: 4px; }
.end-main, .dest-main { display: flex; gap: 8px; align-items: center; font-size: 15px; } .conn-arrow { text-align: center; color: var(--muted); margin: -4px 0; } .conn-card > * + * { margin-top: 10px; }
.audit { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; } .audit-item { border-left: 2px solid var(--line); padding-left: 10px; } .diff { font-size: 12px; color: var(--muted); } .diff ul { margin: 4px 0; padding-left: 18px; } del { color: #fca5a5; } ins { color: #86efac; text-decoration: none; }
.act-crear { --c: #22c55e; } .act-eliminar { --c: #ef4444; } .act-modificar { --c: #3b82f6; } .act-inicio_sesion { --c: #64748b; }
.impact-sum { display: flex; gap: 16px; flex-wrap: wrap; margin: 10px 0; } .impact-sum div { background: #0d172b; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; } .impact-sum b { font-size: 20px; }
.impact-sec ul { margin: 4px 0 10px; padding-left: 18px; } .impact-sec li { margin: 3px 0; }

/* Mapa */
#map { height: 100%; width: 100%; background: #0a111f; } .leaflet-container { font: inherit; }
.tiles-dark { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.92) saturate(.7); }
.map-wrap { position: relative; flex: 1; min-height: 400px; }
.map-ctl { position: absolute; top: 12px; left: 58px; z-index: 1000; background: #0e1830ee; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; width: 232px; max-height: calc(100% - 24px); overflow: auto; }
.map-ctl h5 { margin: 10px 0 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); } .map-ctl label { display: flex; align-items: center; gap: 8px; padding: 2px 0; cursor: pointer; font-size: 13px; }
.dotc { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.nmark { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--st); background: #0a1322; color: #fff; font-weight: 700; font-size: 13px; display: grid; place-items: center; box-shadow: 0 0 0 2px #0008, 0 0 12px color-mix(in srgb, var(--st) 60%, transparent); }
.nmark span { color: var(--ty); } .amark { width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 12px solid var(--c); }
.measure-box { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 1000; background: #0e1830f2; border: 1px solid var(--accent); border-radius: 10px; padding: 8px 14px; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #111a2e; color: var(--text); } .leaflet-popup-content { margin: 12px 14px; } .leaflet-popup-content h4 { color: var(--text); font-size: 15px; text-transform: none; letter-spacing: 0; margin: 0 0 6px; }

/* Login */
.login { min-height: 100%; display: grid; place-items: center; background: radial-gradient(circle at 30% 10%, #0f2a4d, #070c18 60%); padding: 20px; }
.login-box { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px; display: grid; gap: 14px; }
.login-box .brand { padding: 0 0 4px; } .login-box label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 4px; }
.err-line { color: #fca5a5; min-height: 18px; font-size: 13px; }

@media (max-width: 900px) {
  #app { grid-template-columns: 1fr; grid-template-rows: 54px auto 1fr; grid-template-areas: "top" "nav" "main"; }
  .nav { flex-direction: row; overflow-x: auto; padding: 4px 8px; border-right: 0; border-bottom: 1px solid var(--line); } .nav .brand, .nav .spacer, .nav .sep { display: none; } .nav a span { display: none; }
  .panel { top: auto; height: 62vh; width: 100%; border-left: 0; border-top: 1px solid var(--line); } body.panel-open main { margin-right: 0; padding-bottom: 62vh; }
  .search { width: 46vw; } .userbox .name { display: none; }
  .svg-host { height: 62vh; }
}

/* Animación del flujo en radioenlaces del mapa */
.rl-flow { animation: rlflow 1.4s linear infinite; } @keyframes rlflow { to { stroke-dashoffset: -18; } }
@media (prefers-reduced-motion: reduce) { .rl-flow { animation: none; } }
.search input[type=search]::-webkit-search-cancel-button { filter: invert(.7); }

/* Login centrado (ocupa toda la rejilla de #app) y logo */
.login { grid-area: 1 / 1 / -1 / -1; width: 100%; }
.login-box .logo-tile { width: 168px; height: 168px; margin: 0 auto 4px; background: #fff; border-radius: 22px; display: grid; place-items: center; box-shadow: 0 8px 30px #0006; }
.login-box .logo-tile img { width: 148px; height: 148px; object-fit: contain; display: block; }
.login-box .login-title { text-align: center; font-weight: 700; font-size: 17px; }
.login-box .login-title small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; margin-top: 2px; }
.brand .logo.img { background: #fff; padding: 2px; } .brand .logo.img img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* Hilos de fibra y planta externa */
.strand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(30px, 1fr)); gap: 5px; margin: 8px 0; }
.strand { --col: #888; position: relative; border: 2px solid var(--col); background: color-mix(in srgb, var(--col) 22%, #0a1322); color: #fff; border-radius: 7px; height: 30px; cursor: pointer; font: 600 11px ui-monospace, monospace; padding: 0; }
.strand span { text-shadow: 0 0 3px #000, 0 0 3px #000; }
.strand.usada { background: var(--col); } .strand.usada span { color: #fff; }
.strand.reservada { border-style: dashed; } .strand.danada { outline: 2px solid var(--bad); outline-offset: 1px; background: repeating-linear-gradient(45deg, #3b1219, #3b1219 4px, #0a1322 4px, #0a1322 8px); }
.strand:hover { filter: brightness(1.3); }
.tool-ctl { position: absolute; top: 12px; left: 58px; z-index: 1000; background: #0e1830ee; border: 1px solid var(--line); border-radius: 12px; padding: 8px; display: grid; gap: 4px; width: 214px; max-height: calc(100% - 24px); overflow: auto; }
.tool-ctl h5 { margin: 8px 4px 2px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.tool-ctl .btn { justify-content: flex-start; } .tool-ctl label { display: flex; gap: 8px; align-items: center; padding: 2px 4px; font-size: 13px; cursor: pointer; }
.tool-ctl .btn.on { background: #0e7490; border-color: #22d3ee; }
.draw-bar { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 1000; background: #0e1830f5; border: 1px solid var(--accent); border-radius: 12px; padding: 8px 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; max-width: 92%; }
.pmark { width: 12px; height: 12px; border-radius: 50%; background: #e2e8f0; border: 2px solid var(--st, #64748b); box-shadow: 0 0 0 1px #000a; }
.emark { width: 22px; height: 22px; border-radius: 6px; background: var(--c); border: 2px solid #0a1322; color: #04101f; font: 700 11px system-ui; display: grid; place-items: center; box-shadow: 0 0 0 1px #000a; }
.emark.round { border-radius: 50%; } .vmark { width: 12px; height: 12px; border-radius: 50%; background: #facc15; border: 2px solid #422006; cursor: move; }
.leaflet-container.drawing { cursor: crosshair !important; }

.leaflet-control-layers { background: #0e1830f5; color: var(--text); border: 1px solid var(--line); border-radius: 10px; box-shadow: none; }
.leaflet-control-layers-expanded { padding: 8px 12px; } .leaflet-control-layers label { font-size: 13px; margin: 3px 0; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg .btn { border: 0; border-radius: 0; }

.proj-select { --pc: #64748b; background: #0e1830; color: var(--text); border: 1px solid var(--line); border-left: 4px solid var(--pc); border-radius: 10px; padding: 7px 10px; max-width: 230px; font: inherit; font-size: 13px; }
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; margin-top: 14px; }
.card.proj { --pc: #38bdf8; padding: 14px 16px; border-top: 4px solid var(--pc); } .card.proj.active { outline: 2px solid var(--pc); }
.card.proj .pdot { width: 12px; height: 12px; border-radius: 50%; background: var(--pc); }

.trace-sum { display: flex; gap: 18px; flex-wrap: wrap; padding: 8px 2px 10px; } .trace-sum b { font-size: 18px; }
table.t.trace td { padding: 5px 8px; } table.t.trace tr.end td { background: #0f2a1e; }
.splice-wrap { overflow: auto; max-height: 70vh; background: #0a1322; border: 1px solid var(--line); border-radius: 10px; }
.splice-wrap svg text { font: 11px system-ui, sans-serif; fill: #cbd5e1; } .splice-wrap .st { cursor: pointer; } .splice-wrap .st:hover rect.sw { stroke: #fff; }
.splice-wrap .fus { cursor: pointer; fill: none; stroke-width: 2.4; } .splice-wrap .fus:hover { stroke-width: 4.5; }
