:root {
  --verde: #16a34a;
  --verde-oscuro: #15803d;
  --azul-marca: #1d6fe0;
  --azul-oscuro: #1558b8;
  --lateral: #0e1a2b;
  --lateral-2: #13233a;
  --lateral-borde: #1f3150;
  --lateral-texto: #b6c2d4;
  --naranja: #e08a00;
  --azul: #1d6fe0;
  --rojo: #dc2626;
  --fondo: #f4f7fb;
  --borde: #e5e9f0;
  --texto-suave: #64748b;
  --sombra: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 14px rgba(16, 24, 40, .05);
  --ancho-lateral: 260px;
}
body { background: var(--fondo); font-size: 14px; font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; color: #1e293b; }
.min-w-0 { min-width: 0; }
.btn-primary { background: var(--azul-marca); border-color: var(--azul-marca); }
.btn-primary:hover { background: var(--azul-oscuro); border-color: var(--azul-oscuro); }
.btn { border-radius: 8px; }
.form-control, .form-select { border-radius: 8px; border-color: #d6dce6; }
.alert { border-radius: 10px; }

/* ---------- menú lateral ---------- */
.lateral {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--ancho-lateral);
  background: var(--lateral); overflow-y: auto; z-index: 1040; transition: transform .2s;
  padding: 18px 14px 24px; scrollbar-width: thin; scrollbar-color: #2a3d5c transparent;
}
.lateral .marca {
  display: block; padding: 18px 0; margin-bottom: 18px; background: #fff; border-radius: 12px;
  color: #12387a; text-align: center; font-weight: 800; font-size: 30px; letter-spacing: -1px; text-decoration: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
}
.lateral .marca span { color: #2a9fd8; }
.lateral .marca img { display: block; width: 82%; max-width: 200px; height: auto; margin: 0 auto; }
.empresa-tarjeta {
  display: flex; align-items: center; gap: 12px; padding: 12px; margin-bottom: 8px; color: #fff;
  background: var(--lateral-2); border: 1px solid var(--lateral-borde); border-radius: 12px;
}
.empresa-tarjeta .nombre { font-weight: 700; }
.empresa-tarjeta small { display: block; color: var(--lateral-texto); font-size: 12px; line-height: 1.3; }
.empresa-ini {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 8px; background: #1e3a8a; color: #fff;
  display: grid; place-items: center; font-weight: 700;
}
.seccion-menu { color: #7d8ba1; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; padding: 18px 12px 8px; }
.lateral a.item, .lateral button.item {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 10px 12px; margin: 2px 0;
  color: var(--lateral-texto); text-decoration: none; border: 0; background: none; border-radius: 10px;
  text-align: left; font-size: 15px; font-weight: 500; position: relative;
}
.lateral .item i.icono { width: 20px; text-align: center; font-size: 16px; }
.lateral .item .flecha { margin-left: auto; font-size: 11px; transition: transform .2s; }
.lateral .item[aria-expanded="true"] .flecha { transform: rotate(180deg); }
.lateral .item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.lateral .item.activo { background: linear-gradient(90deg, #1d4ed8, #1d6fe0); color: #fff; box-shadow: 0 4px 12px rgba(29, 111, 224, .35); }
.lateral .item.activo::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: #93c5fd; }
.contador-menu { margin-left: auto; background: #ef4444; color: #fff; border-radius: 10px; font-size: 11px; font-weight: 700; padding: 1px 7px; }
.lateral .submenu { padding: 2px 0 4px 46px; }
.lateral .submenu a { display: block; padding: 7px 10px; color: var(--lateral-texto); text-decoration: none; font-size: 13.5px; border-radius: 8px; }
.lateral .submenu a:hover, .lateral .submenu a.activo { color: #fff; background: rgba(255, 255, 255, .06); }

/* ---------- barra superior ---------- */
.principal { margin-left: var(--ancho-lateral); min-height: 100vh; transition: margin .2s; }
.barra {
  background: #fff; min-height: 72px; display: flex; align-items: center; padding: 10px 28px; gap: 14px;
  position: sticky; top: 0; z-index: 1020; border-bottom: 1px solid var(--borde);
}
.barra .btn-menu { background: #f1f5f9; color: #334155; border: 1px solid var(--borde); border-radius: 10px; width: 40px; height: 40px; flex-shrink: 0; }
.titulo-barra small { display: block; color: var(--azul-marca); font-size: 11px; font-weight: 700; letter-spacing: .12em; }
.titulo-barra div { font-size: 20px; font-weight: 700; color: #0f172a; line-height: 1.2; }
.barra .derecha { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.chip-estado { align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  color: #15803d; background: #ecfdf3; border: 1px solid #bbf7d0; }
.campana { position: relative; width: 42px; height: 42px; border-radius: 50%; border: 1px solid #cbd5e1; display: grid; place-items: center;
  color: #1e293b; font-size: 18px; text-decoration: none; }
.campana:hover { background: #f1f5f9; color: #1e293b; }
.punto-aviso { position: absolute; top: -3px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: #ef4444; color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; }
.usuario-barra { display: flex; align-items: center; gap: 10px; line-height: 1.25; }
.usuario-barra .avatar { width: 42px; height: 42px; border-radius: 12px; background: #e8f0fe; color: var(--azul-marca); display: grid; place-items: center; font-weight: 700; }
.usuario-barra strong { display: block; font-size: 14px; }
.usuario-barra small { color: var(--texto-suave); font-size: 12.5px; }
.btn-salir { border: 1.5px solid #1e293b; background: #fff; color: #1e293b; border-radius: 10px; padding: 7px 14px; font-weight: 500; }
.btn-salir:hover { background: #1e293b; color: #fff; }
.contenido { padding: 28px 32px 48px; max-width: 1600px; }

.velo { display: none; }
body.menu-cerrado .lateral { transform: translateX(calc(-1 * var(--ancho-lateral))); }
body.menu-cerrado .principal { margin-left: 0; }
@media (max-width: 900px) {
  .lateral { transform: translateX(calc(-1 * var(--ancho-lateral))); }
  .principal { margin-left: 0; }
  body.menu-abierto .lateral { transform: none; }
  body.menu-abierto .velo { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 1035; }
  .barra { padding: 10px 16px; }
  .contenido { padding: 20px 16px 40px; }
}

/* ---------- títulos y tarjetas ---------- */
h1.titulo { font-size: 26px; font-weight: 700; padding: 0 0 4px; margin-bottom: 20px; color: #0f172a; letter-spacing: -.01em; }
h1.titulo i { color: var(--azul-marca); }
.seccion h4 { font-size: 17px; font-weight: 600; margin: 10px 0 12px 4px; }
.kpi {
  background: #fff; border: 1px solid var(--borde); border-radius: 14px; padding: 14px 16px; margin-bottom: 10px;
  display: flex; align-items: center; justify-content: space-between; min-height: 74px;
  text-decoration: none; color: inherit; box-shadow: var(--sombra);
}
.kpi:hover { box-shadow: 0 6px 20px rgba(16, 24, 40, .1); color: inherit; }
.kpi .valor { font-size: 21px; font-weight: 700; line-height: 1.2; }
.kpi .etiqueta { font-size: 12px; text-transform: uppercase; color: var(--texto-suave); }
.kpi i { font-size: 26px; }
.kpi.derecha-texto .txt { text-align: right; }
.c-verde { color: var(--verde) !important; }
.punto-estado { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.punto-estado.verde { background: var(--verde); box-shadow: 0 0 0 3px rgba(22, 163, 74, .15); }
.punto-estado.rojo { background: var(--rojo); box-shadow: 0 0 0 3px rgba(220, 38, 38, .15); }
.tabla-clientes td { vertical-align: top; font-size: 14px; }
.tabla-clientes small { font-size: 12.5px; }
.c-naranja { color: var(--naranja) !important; }
.c-azul { color: var(--azul) !important; }
.c-rojo { color: var(--rojo) !important; }

.caja { background: #fff; border: 1px solid var(--borde); border-radius: 14px; padding: 20px; margin-bottom: 20px; box-shadow: var(--sombra); }
.caja h5 { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.caja.p-0 { overflow: hidden; }
.table thead th { background: #f8fafc; font-weight: 600; font-size: 12.5px; white-space: nowrap; color: #475569; text-transform: uppercase; letter-spacing: .02em; }
.table td { vertical-align: middle; }

/* ---------- resumen (dashboard) ---------- */
.saludo-fecha { color: var(--azul-marca); font-size: 12.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.saludo h2 { font-size: 34px; font-weight: 600; letter-spacing: -.02em; margin: 4px 0 2px; color: #0f172a; }
.saludo p { color: var(--texto-suave); margin: 0; }
.acciones-rapidas .btn { border-radius: 999px; padding: 8px 16px; font-weight: 500; }
.acciones-rapidas .btn-light { background: #fff; border: 1px solid var(--borde); }
.tarjeta-dato {
  display: block; background: #fff; border: 1px solid var(--borde); border-radius: 16px; padding: 24px 20px; height: 100%;
  box-shadow: var(--sombra); text-decoration: none; color: inherit; transition: box-shadow .15s, transform .15s;
}
.tarjeta-dato:hover { box-shadow: 0 10px 28px rgba(16, 24, 40, .1); transform: translateY(-1px); color: inherit; }
.tarjeta-dato .ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 18px; margin-bottom: 20px; }
.tarjeta-dato .ico.azul { background: #e8f0fe; color: #1d6fe0; } .tarjeta-dato .ico.verde { background: #e7f8ee; color: #16a34a; }
.tarjeta-dato .ico.cian { background: #e6f6f8; color: #0e9aa7; } .tarjeta-dato .ico.violeta { background: #f1eafe; color: #7c3aed; }
.tarjeta-dato .ico.ambar { background: #fff4e0; color: #d97706; } .tarjeta-dato .ico.rojo { background: #fdecec; color: #dc2626; }
.tarjeta-dato .rotulo { font-size: 13.5px; color: #334155; font-weight: 500; }
.tarjeta-dato .numero { font-size: 26px; font-weight: 800; letter-spacing: -.02em; color: #0f172a; margin: 4px 0 6px; }
.tarjeta-dato .pie { font-size: 12.5px; color: var(--texto-suave); }
.chip-mes { font-size: 12px; font-weight: 600; color: var(--azul-marca); background: #eef4ff; border: 1px solid #cfe0ff; border-radius: 999px; padding: 2px 10px; }
.estado-activo, .estado-pagada, .estado-cerrado { background: #e3f6e8; color: #23843a; }
.estado-suspendido, .estado-pendiente, .estado-abierto { background: #fdecea; color: #c0392b; }
.estado-retirado, .estado-anulada { background: #eee; color: #777; }
.estado-en_proceso { background: #fff4e0; color: #b8730a; }
.estado { padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.dato small { display: block; color: #888; font-size: 11px; text-transform: uppercase; }
.dato { margin-bottom: 10px; }
.btn-verde { background: var(--verde); color: #fff; border: 0; }
.btn-verde:hover { background: var(--verde-oscuro); color: #fff; }

/* ---------- formulario de router (pestañas y barra de acciones) ---------- */
.nav-tabs .nav-link { color: #444; }
.nav-tabs .nav-link.active { border-top: 3px solid var(--verde); font-weight: 600; }
.tab-content.caja { border-top: 0; }
.barra-acciones {
  position: sticky; bottom: 0; z-index: 10; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: #fff; border: 1px solid #ddd; padding: 10px 16px; margin-top: 12px;
  box-shadow: 0 -2px 6px rgba(0,0,0,.05);
}

.secreto code { filter: blur(4px); cursor: pointer; }
.caja.border-danger { border-color: #e4a5a0 !important; }

/* ---------- OLT / potencias ópticas ---------- */
.tarjeta-olt { background: #fff; border: 1px solid #ddd; border-radius: 6px; padding: 16px; height: 100%; }
.tarjeta-olt h5 { font-size: 20px; margin: 0; }
.tarjeta-olt.estado-error, .tarjeta-olt.estado-vencida { border-color: #e4a5a0; }
.estado-olt { padding: 3px 10px; border-radius: 6px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.estado-olt.ok { background: #23843a; color: #fff; }
.estado-olt.parcial, .estado-olt.vencida { background: #fff4e0; color: #b8730a; }
.estado-olt.error { background: #c0392b; color: #fff; }
.estado-olt.nunca { background: #eee; color: #555; }
.contadores { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.contador { display: block; border-radius: 6px; padding: 10px 6px; text-align: center; text-decoration: none; }
.contador .n { display: block; font-size: 24px; font-weight: 700; line-height: 1.1; }
.contador .t { font-size: 13px; }
.contador:hover { filter: brightness(.96); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.contador.normal { background: #e3f6e8; color: #23843a; }
.contador.alerta { background: #fff4d6; color: #8a6100; }
.contador.critico { background: #fdecea; color: #c0392b; }
.contador.caida { background: #ececec; color: #444; }
.contador.vacio .n { color: #999; }
@media (max-width: 480px) { .contadores { grid-template-columns: repeat(2, 1fr); } }
.gravedad { padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.gravedad.alerta { background: #f5c242; color: #3d2b00; }
.gravedad.critico { background: #c0392b; color: #fff; }
tr.fila-alerta > td { background: #fffaf0; }
tr.fila-critico > td { background: #fdf1f0; }
.nivel { padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.nivel.normal { background: #e3f6e8; color: #23843a; }
.nivel.alerta { background: #fff4d6; color: #8a6100; }
.nivel.critico { background: #fdecea; color: #c0392b; }
.nivel.caida { background: #444; color: #fff; }
.nivel.sin_datos { background: #eee; color: #666; }
.filtro-nivel .btn.activo { box-shadow: inset 0 0 0 2px #333; }
.punto { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: -1px; }
.punto.normal { background: #2fa84f; } .punto.alerta { background: #f0ad1e; } .punto.critico { background: #e03131; }
.punto.caida { background: #333; } .punto.sin_datos { background: #bbb; }
.chip-pon { display: inline-block; border: 1px solid #ddd; background: #fff; border-radius: 4px; padding: 5px 10px;
  color: #1a5fb4; text-decoration: none; font-size: 13px; }
.chip-pon:hover { border-color: #1a5fb4; }
.chip-pon.activo { border-color: #1a5fb4; box-shadow: inset 0 0 0 1px #1a5fb4; background: #eef5ff; }
.chip-pon.caido { background: #f6f6f6; }
.tabla-onu td { padding-top: 10px; padding-bottom: 10px; }
.tabla-onu tr.fila-caida > td { background: #f1f1f1; }
.rx-badge { display: inline-block; min-width: 96px; text-align: center; padding: 4px 10px; border-radius: 4px;
  font-weight: 700; color: #fff; white-space: nowrap; }
.rx-badge.normal { background: #23843a; } .rx-badge.alerta { background: #e0a100; color: #2b1d00; }
.rx-badge.critico { background: #c0392b; }
.rx-texto { white-space: nowrap; } .rx-texto.normal { color: #23843a; } .rx-texto.alerta { color: #b07f00; }
.rx-texto.critico { color: #c0392b; }
.tabla-compacta td { padding-top: 6px !important; padding-bottom: 6px !important; vertical-align: middle; }
.tabla-compacta tr:not(.fila-detalle) > td { white-space: nowrap; }
.tabla-compacta .mb-1 { margin-bottom: 2px !important; }
.fila-filtros th { background: #fff !important; padding: 4px 4px !important; text-transform: none; }
.fila-filtros input { min-width: 80px; font-size: 12px; padding: 2px 6px; }
th.ordenable { cursor: pointer; user-select: none; }
th.ordenable::after { content: " ⇅"; color: #b8c2cf; font-size: 11px; }
th.ordenable[data-orden="asc"]::after { content: " ▲"; color: #2f80ed; }
th.ordenable[data-orden="desc"]::after { content: " ▼"; color: #2f80ed; }
.seccion-config { color: #2f6fdb; font-size: 1.05rem; font-weight: 600; padding-bottom: 8px; margin: 8px 0 14px;
  border-bottom: 1px solid #e3e8ef; }
.seccion-config i { width: 20px; }
.pegajosa { position: sticky; top: 90px; }
.c-azul { color: #229ed9; }
.menu-columnas { min-width: 230px; max-height: 70vh; overflow-y: auto; }
.btn-desplegar { width: 22px; height: 22px; border-radius: 50%; border: 0; padding: 0; line-height: 22px;
  background: #2f80ed; color: #fff; font-size: 12px; }
.btn-desplegar::before { content: "+"; font-weight: 700; }
.btn-desplegar.abierto { background: #d64545; } .btn-desplegar.abierto::before { content: "−"; }
.fila-detalle { display: none; } .fila-detalle.abierta { display: table-row; }
.fila-detalle > td { background: #f7f9fc; padding: 10px 16px 14px 46px !important; }
.detalle-datos { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 24px; }
.detalle-datos div { border-bottom: 1px solid #e6eaf0; padding: 3px 0; font-size: .85rem; }
.detalle-datos b { display: inline-block; min-width: 105px; color: #444; }
.estado-chip { display: inline-block; padding: 2px 12px; border-radius: 999px; font-size: .8rem; font-weight: 600;
  border: 1px solid; white-space: nowrap; }
.estado-chip.verde { color: #0f7a4f; background: #e8f8f0; border-color: #a7e3c6; }
.estado-chip.naranja { color: #9a6200; background: #fff6e0; border-color: #f2d48a; }
.estado-chip.rojo { color: #b3261e; background: #fdecea; border-color: #f2b8b3; }
.estado-chip.gris { color: #5f6b7a; background: #f2f4f7; border-color: #d5dbe3; }
.estado-chip.azul { color: #1d4ed8; background: #eaf1ff; border-color: #b9cdf7; }

/* Ficha del cliente (ventana desde Clientes) */
.ficha-encabezado { border: 1px solid #1f2937; border-radius: 12px; padding: 16px 18px; margin-bottom: 18px; }
.ficha-nombre { font-size: 1.25rem; font-weight: 700; }
.ficha-sub { color: #5b6b8c; font-size: .9rem; margin-top: 4px; }
.ficha-grilla { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px 24px; margin-bottom: 16px; }
.ficha-ancho { grid-column: 1 / -1; }
.ficha-etiqueta { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; color: #5b6b8c; }
.ficha-valor { font-size: 1rem; font-weight: 600; color: #111827; }
.ficha-aviso { background: #fffbeb; border: 1px solid #f6d97a; border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; }
.ficha-aviso .c-ambar { color: #9a6200; }
.ficha-titulo { margin: 20px 0 10px; padding-top: 14px; border-top: 1px solid #e5e7eb; font-weight: 700; }
.ficha-caja { border: 1px solid #e5e7eb; border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.ficha-mapa { width: 100%; height: 220px; border: 1px solid #e5e7eb; border-radius: 10px; margin-top: 8px; }
.fila-ficha { cursor: pointer; }
.avatar-cliente { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 10px; display: inline-flex;
  align-items: center; justify-content: center; font-size: .78rem; font-weight: 700; color: #1d4ed8; background: #eaf1ff; }
.nombre-ficha { cursor: pointer; }
.nombre-ficha:hover { text-decoration: underline; color: var(--bs-primary, #2563eb); }

/* ---------- login ---------- */
.login-fondo { min-height: 100vh; display: grid; place-items: center; background: var(--lateral); padding: 16px; }
.login-caja { background: #fff; padding: 32px; width: 100%; max-width: 360px; border-top: 4px solid var(--verde); }
