/* E.3 (§7.7, §7.10) — Administración global con la línea visual del diseño aprobado 4 (azul oscuro y dorado). */
body.tp-body {
  --tp-navy: #050d1d; --tp-navy-2: #0a1a36; --tp-blue: #2563eb; --tp-blue-soft: rgba(37, 99, 235, .18);
  --tp-bg: #061126; --tp-card: rgba(12, 28, 58, .9); --tp-text: #e8f0ff; --tp-muted: #a9bcdc; --tp-line: rgba(84, 132, 214, .3);
  --tp-ok: #16a34a; --tp-warn: #d97706; --tp-danger: #dc2626; --tp-shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --tp-focus: 0 0 0 3px rgba(147, 197, 253, .55); --tp-oro: #f5b83d;
  background: radial-gradient(1200px 600px at 70% -10%, #12306a 0%, transparent 60%), linear-gradient(180deg, #061126, #0a1c3a) fixed;
  color: var(--tp-text);
}
body.tp-body .tp-sidebar { background: linear-gradient(180deg, #040b19, #081833 70%, #06122a); border-right: 1px solid rgba(70, 120, 200, .25); }
body.tp-body .tp-brand strong { color: var(--tp-oro); letter-spacing: .5px; font-size: 20px; text-shadow: 0 0 12px rgba(245, 184, 61, .35); }
body.tp-body .tp-brand small { color: var(--tp-muted); }
body.tp-body .tp-nav-group { color: #f5c451; }
body.tp-body .tp-nav a { color: #d6e2fa; border-radius: 10px; }
body.tp-body .tp-nav a[aria-current="page"] { background: linear-gradient(90deg, #1d4ed8, #2563eb); box-shadow: 0 0 18px rgba(37, 99, 235, .45); }
body.tp-body .tp-topbar { background: rgba(6, 16, 36, .85); border-bottom: 1px solid rgba(70, 120, 200, .25); backdrop-filter: blur(10px); }
body.tp-body .tp-topbar input, body.tp-body .tp-card input:not([type="checkbox"]):not([type="radio"]),
body.tp-body .tp-card select, body.tp-body .tp-card textarea, body.tp-body .erp-form input, body.tp-body .erp-form select {
  background: rgba(6, 18, 40, .9); color: var(--tp-text); border: 1px solid rgba(110, 150, 220, .45); border-radius: 10px;
}
body.tp-body .tp-chip { background: rgba(245, 184, 61, .15); color: #fde68a; border: 1px solid rgba(245, 184, 61, .55); }
body.tp-body .tp-card, body.tp-body .tp-kpi { border: 1px solid var(--tp-line); }
body.tp-body .tp-table th { background: rgba(20, 44, 88, .95); color: #dbe7ff; }
body.tp-body .tp-table td { border-color: rgba(84, 132, 214, .18); }
body.tp-body .tp-table tbody tr:hover td { background: rgba(59, 130, 246, .1); }
body.tp-body a { color: #8ec5ff; }
body.tp-body .tp-quick a { background: rgba(12, 30, 62, .9); border: 1px solid rgba(96, 156, 255, .4); color: #e8f0ff; border-radius: 12px; }
body.tp-body .tp-quick a:hover { border-color: var(--tp-oro); }
body.tp-body .tp-subtitulo { margin: 18px 0 8px; font-size: 18px; color: #fff; }
body.tp-body .tp-error { background: rgba(127, 29, 29, .4); color: #fecaca; }
body.tp-body .tp-aviso { background: rgba(120, 53, 15, .35); color: #fde68a; border: 1px solid rgba(251, 191, 36, .55); }

/* Auditoría final de interfaz (2026-11-22, §24): restos del estilo claro y consola del agente de soporte. */
body.tp-body { color-scheme: dark; }
body.tp-body .tp-badge-ok { background: rgba(34, 197, 94, .18); color: #86efac; }
body.tp-body .tp-badge-off { background: rgba(148, 163, 184, .16); color: #cbd5e1; }
body.tp-body .tp-badge-warn { background: rgba(245, 158, 11, .18); color: #fcd34d; }
body.tp-body .tp-badge-sim { background: rgba(59, 130, 246, .2); color: #bfdbfe; }
body.tp-body .tp-skip:focus { background: #0b1d3d; color: #fff; outline: 3px solid #93c5fd; }
body.tp-body .tp-kpi { background: var(--tp-card); border-radius: 14px; padding: 14px 16px; box-shadow: var(--tp-shadow); }
body.tp-body .tp-kpi span { color: var(--tp-muted); }
body.tp-body .tp-kpi strong { color: #fff; }
body.tp-body #tp-cargando { background: rgba(59, 130, 246, .2); color: #dbeafe; }
body.tp-body #tp-aviso-lento { background: rgba(120, 53, 15, .35); color: #fde68a; }
body.tp-body .tp-quick a[aria-current="page"] { background: linear-gradient(90deg, #1d4ed8, #2563eb); border-color: var(--tp-oro); color: #fff; }

/* Consola de la mesa de ayuda (agente de soporte): barra propia, sin el menú de administración. */
body.tp-body.tp-mesa .tp-mesa-barra { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 22px; position: sticky; top: 0; z-index: 5; }
body.tp-body.tp-mesa .tp-mesa-marca { display: flex; flex-direction: column; padding: 0; border: 0; margin: 0; }
body.tp-body.tp-mesa .tp-mesa-usuario { color: var(--tp-muted); font-size: 13px; }
body.tp-body.tp-mesa .tp-top-actions form { margin: 0; }
body.tp-body.tp-mesa .tp-mesa-kpis { margin: 0 0 16px; }
body.tp-body.tp-mesa .tp-mesa-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 8px 0 12px; }
body.tp-body.tp-mesa .tp-mesa-form label { color: var(--tp-muted); font-size: 13px; }
body.tp-body.tp-mesa .tp-mesa-form select, body.tp-body.tp-mesa .tp-mesa-form input:not([type="checkbox"]):not([type="file"]),
body.tp-body.tp-mesa .tp-mesa-form textarea { background: rgba(6, 18, 40, .9); color: var(--tp-text); border: 1px solid rgba(110, 150, 220, .45); border-radius: 10px; padding: 8px 10px; font: inherit; }
body.tp-body.tp-mesa .tp-mesa-respuesta { flex-direction: column; align-items: stretch; max-width: 760px; }
body.tp-body.tp-mesa .tp-mesa-respuesta button { align-self: flex-start; }
body.tp-body.tp-mesa .tp-mesa-check { display: flex; align-items: center; gap: 8px; }
body.tp-body.tp-mesa input[type="file"] { color: var(--tp-muted); }
body.tp-body.tp-mesa #mesa-hilo { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 10px; }
body.tp-body.tp-mesa .mesa-msg { background: rgba(16, 36, 72, .92); border: 1px solid var(--tp-line); border-radius: 12px; padding: 10px 14px; max-width: 760px; }
body.tp-body.tp-mesa .mesa-msg.mesa-op { margin-left: auto; background: rgba(29, 78, 216, .25); border-color: rgba(96, 156, 255, .55); }
body.tp-body.tp-mesa .mesa-msg.mesa-interno { background: rgba(120, 53, 15, .3); border: 1px dashed rgba(245, 184, 61, .7); }
body.tp-body.tp-mesa .mesa-msg small { color: var(--tp-muted); }
body.tp-body.tp-mesa .mesa-msg p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
@media screen and (max-width: 700px) {
  body.tp-body.tp-mesa .tp-mesa-barra { padding: 10px 12px; position: static; }
  body.tp-body.tp-mesa .tp-page { padding: 14px 12px 40px; }
}

/* Páginas de denegación y de «no encontrado» sin menú (cuentas sin empresa activa, aislamiento). */
body.tp-body.tp-error-pagina { min-height: 100vh; }
body.tp-body .tp-error-tarjeta { max-width: 640px; margin: 8vh auto 0; }
body.tp-body .tp-error-tarjeta .tp-card { padding: 24px 26px; }
body.tp-body .tp-error-tarjeta h1 { margin: 4px 0 10px; color: #fff; }
body.tp-body .tp-error-marca { margin: 0; color: var(--tp-oro); font-weight: 800; letter-spacing: .06em; }
body.tp-body .tp-publica .tp-publica-form { display: grid; gap: 12px; margin: 14px 0; }
body.tp-body .tp-publica .tp-publica-form label { display: grid; gap: 6px; color: var(--tp-muted); font-size: 13px; }
body.tp-body .tp-publica .tp-publica-form input { background: rgba(6, 18, 40, .9); color: var(--tp-text); border: 1px solid rgba(110, 150, 220, .45); border-radius: 10px; padding: 10px 12px; font: inherit; }
body.tp-body .tp-publica .tp-publica-form button { justify-self: start; }
body.tp-body .tp-publica-nota { color: var(--tp-muted); font-size: 13px; }
/* Botones que son enlaces (<a class="tp-btn">): el color de enlace (#8ec5ff) sobre el azul del botón quedaba en 2,8:1. */
body.tp-body a.tp-btn:not(.tp-btn-ghost):not(.tp-iconbtn) { color: #fff; }
body.tp-body a.tp-btn-ghost, body.tp-body .tp-btn-ghost { color: var(--tp-text); }
/* Texto solo para lectores de pantalla (cabeceras de la columna de acciones). */
.tp-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
body.tp-body .tp-table-wrap:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
/* Móvil (≤ 900 px): barra superior que se pliega y tablas que se desplazan dentro de su tarjeta (antes desbordaban la
   página: hasta 906 px de ancho en un teléfono de 390 px). */
@media screen and (max-width: 900px) {
  body.tp-body .tp-topbar { flex-wrap: wrap; gap: 8px; }
  body.tp-body .tp-topbar .tp-search { flex: 1 1 100%; order: 3; min-width: 0; }
  body.tp-body .tp-top-actions { flex-wrap: wrap; margin-left: 0; gap: 6px; }
  body.tp-body .tp-chip { white-space: normal; }
  body.tp-body .tp-page pre, body.tp-body .tp-page code { white-space: pre-wrap; overflow-wrap: anywhere; }
}
body.tp-body .erp-table-scroll-auto { display: block; max-width: 100%; min-width: 0; overflow-x: auto; }
body.tp-body .erp-table-scroll-auto:focus-visible, body.tp-body pre:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
/* Dentro de una cabecera de tabla, en flujo: así queda dentro del contenedor desplazable y no ensancha la página. */
th > .tp-sr-only { position: static; display: inline-block; vertical-align: top; width: 1px; height: 1px; margin: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Iconos del menú lateral de la plataforma (diseño 4): antes cada opción mostraba un cuadrado hueco (SVG de relleno).
   Se usan los iconos SVG del proyecto como máscara, así toman el color del texto (también en el elemento activo). */
body.tp-body .tp-nav-icono { width: 18px; height: 18px; flex: none; background-color: currentColor;
  -webkit-mask: center / contain no-repeat; mask: center / contain no-repeat; }
body.tp-body .tp-nav-icono[data-icono="inicio"] { -webkit-mask-image: url("../empresas/icons/house.svg"); mask-image: url("../empresas/icons/house.svg"); }
body.tp-body .tp-nav-icono[data-icono="empresas"] { -webkit-mask-image: url("../empresas/icons/building-2.svg"); mask-image: url("../empresas/icons/building-2.svg"); }
body.tp-body .tp-nav-icono[data-icono="usuarios"] { -webkit-mask-image: url("../empresas/icons/users-round.svg"); mask-image: url("../empresas/icons/users-round.svg"); }
body.tp-body .tp-nav-icono[data-icono="permisos"] { -webkit-mask-image: url("../empresas/icons/user-round-plus.svg"); mask-image: url("../empresas/icons/user-round-plus.svg"); }
body.tp-body .tp-nav-icono[data-icono="certificados"] { -webkit-mask-image: url("../empresas/icons/file-text.svg"); mask-image: url("../empresas/icons/file-text.svg"); }
body.tp-body .tp-nav-icono[data-icono="configuracion"] { -webkit-mask-image: url("../empresas/icons/settings.svg"); mask-image: url("../empresas/icons/settings.svg"); }
body.tp-body .tp-nav-icono[data-icono="supervision"] { -webkit-mask-image: url("../empresas/icons/activity.svg"); mask-image: url("../empresas/icons/activity.svg"); }
body.tp-body .tp-nav-icono[data-icono="auditoria"] { -webkit-mask-image: url("../empresas/icons/list.svg"); mask-image: url("../empresas/icons/list.svg"); }
body.tp-body .tp-nav-icono[data-icono="planes"] { -webkit-mask-image: url("../empresas/icons/layout-dashboard.svg"); mask-image: url("../empresas/icons/layout-dashboard.svg"); }
body.tp-body .tp-nav-icono[data-icono="modulos"] { -webkit-mask-image: url("../empresas/icons/package.svg"); mask-image: url("../empresas/icons/package.svg"); }
body.tp-body .tp-nav-icono[data-icono="suscripciones"] { -webkit-mask-image: url("../empresas/icons/shield-check.svg"); mask-image: url("../empresas/icons/shield-check.svg"); }
body.tp-body .tp-nav-icono[data-icono="facturacion"] { -webkit-mask-image: url("../empresas/icons/receipt.svg"); mask-image: url("../empresas/icons/receipt.svg"); }
body.tp-body .tp-nav-icono[data-icono="soporte"] { -webkit-mask-image: url("../empresas/icons/circle-help.svg"); mask-image: url("../empresas/icons/circle-help.svg"); }
body.tp-body .tp-nav-icono[data-icono="asistencia"] { -webkit-mask-image: url("../empresas/icons/network.svg"); mask-image: url("../empresas/icons/network.svg"); }
body.tp-body .tp-nav-icono[data-icono="instalacion"] { -webkit-mask-image: url("../empresas/icons/download.svg"); mask-image: url("../empresas/icons/download.svg"); }
body.tp-body .tp-nav-icono[data-icono="terminal"] { -webkit-mask-image: url("../empresas/icons/database.svg"); mask-image: url("../empresas/icons/database.svg"); }
/* Base oscura del lienzo: con el degradado «fixed» del body, las capturas de página completa (y la vista previa de
   impresión de páginas muy largas) dejaban blanco el lienzo por debajo de la primera pantalla. Al desplazarse en el
   navegador no ocurría; así el lienzo es oscuro en cualquier caso. */
html:has(> body.tp-body) { background-color: #061126; }
@media print { html:has(> body.tp-body) { background-color: #fff; } }

/* 7-18: marco del diseño 4 aprobado (corona y título, campana, ayuda, avatar, logotipo y pie de la barra lateral). */
body.tp-body .tp-brand { padding: 14px 16px 12px; }
body.tp-body .tp-brand-logo { display: block; width: 100%; max-width: 230px; height: auto; margin-bottom: 6px; }
body.tp-body .tp-sidebar-pie { position: relative; flex: none; min-height: 128px; padding: 74px 16px 14px; text-align: center; overflow: hidden;
  background: url("../empresas/e3/marco-fibra.webp") center top / cover no-repeat; }
body.tp-body .tp-sidebar-marca { display: block; color: #fff; font-weight: 800; font-style: italic; letter-spacing: .04em; text-shadow: 0 1px 6px #000, 0 0 2px #000; }
body.tp-body .tp-sidebar-marca b { color: var(--tp-oro); }
body.tp-body .tp-sidebar-pie small { display: inline-block; margin-top: 4px; padding: 1px 8px; border-radius: 999px; background: rgba(4, 11, 25, .85); color: #dbe7ff; }
@media screen and (max-height: 760px) { body.tp-body .tp-sidebar-pie { min-height: 0; padding: 10px 16px; background: none; } }
body.tp-body .tp-titular { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 0 1 auto; }
body.tp-body .tp-titular p { margin: 0; min-width: 0; }
body.tp-body .tp-titular strong { display: block; color: #fff; font-size: 17px; line-height: 1.2; white-space: nowrap; }
body.tp-body .tp-titular small { display: block; color: var(--tp-muted); font-size: 13px; }
body.tp-body .tp-corona, body.tp-body .tp-redondo, body.tp-body .tp-avatar { flex: none; width: 44px; height: 44px; border-radius: 50%; display: inline-grid; place-items: center;
  background: rgba(12, 30, 62, .9); border: 1px solid rgba(96, 156, 255, .35); position: relative; }
body.tp-body .tp-corona::before, body.tp-body .tp-redondo::before, body.tp-body .tp-avatar::before { content: ""; width: 22px; height: 22px; background-color: #e8f0ff;
  -webkit-mask: var(--tp-icono) center / contain no-repeat; mask: var(--tp-icono) center / contain no-repeat; }
body.tp-body .tp-corona { --tp-icono: url("../empresas/icons/crown.svg"); }
body.tp-body .tp-corona::before { background-color: var(--tp-oro); }
body.tp-body .tp-campana { --tp-icono: url("../empresas/icons/bell.svg"); }
body.tp-body .tp-ayuda { --tp-icono: url("../empresas/icons/circle-help.svg"); }
body.tp-body .tp-avatar { --tp-icono: url("../empresas/icons/user-round.svg"); width: 40px; height: 40px; border-color: rgba(245, 184, 61, .55); }
body.tp-body .tp-redondo:hover { border-color: var(--tp-oro); }
body.tp-body .tp-redondo:focus-visible, body.tp-body .tp-usuario:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
body.tp-body .tp-campana-n { position: absolute; top: -4px; right: -4px; min-width: 20px; padding: 0 5px; border-radius: 999px; background: #b91c1c; color: #fff; font-size: 12px; line-height: 20px; text-align: center; }
body.tp-body .tp-usuario { display: flex; align-items: center; gap: 10px; padding: 2px 6px 2px 2px; border-radius: 999px; color: #fff; }
body.tp-body .tp-usuario::after { content: ""; width: 8px; height: 8px; margin: 0 4px 4px 2px; border: solid #e8f0ff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
body.tp-body .tp-usuario-texto strong { display: block; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
body.tp-body .tp-usuario-texto small { display: block; color: var(--tp-muted); font-size: 12px; }
body.tp-body .tp-menu-nota { margin: 6px 10px; color: var(--tp-muted); font-size: 12px; }
body.tp-body .tp-topbar form.tp-search { min-width: 180px; }
body.tp-body header.tp-topbar .tp-top-actions { margin-left: auto; }
@media screen and (min-width: 901px) { body.tp-body header.tp-topbar .tp-chip { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } }
body.tp-body .tp-menu-panel { background: #0b1b38; }
body.tp-body .tp-search input { border-radius: 999px; padding-left: 16px; }
@media screen and (min-width: 901px) { body.tp-body .tp-hamb { display: none; } }
@media screen and (max-width: 1500px) { body.tp-body .tp-titular small { display: none; } }
/* El nombre sigue siendo el texto accesible del menú aunque no quepa. */
@media screen and (max-width: 1180px) { body.tp-body .tp-usuario-texto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; } }
@media screen and (max-width: 900px) {
  body.tp-body .tp-titular { flex: 1 1 auto; }
  body.tp-body .tp-corona { width: 36px; height: 36px; }
}
@media print { body.tp-body .tp-sidebar-pie, body.tp-body .tp-titular { display: none; } }
/* Una lista con opciones largas no ensancha la página (etapas PSFE en el teléfono). */
body.tp-body .tp-page form > label { max-width: 100%; }
body.tp-body .tp-page input, body.tp-body .tp-page select, body.tp-body .tp-page textarea { max-width: 100%; min-width: 0; }
