/* Panel de control — identidad del formulario de registro.
   Tokens: web/src/styles/_tokens.scss */

:root {
  --navy: #071a3a;
  --navy-mid: #0f2d5c;
  --teal: #12b5b0;
  --teal-deep: #0d8f8b;
  --magenta: #c2186b;
  --rosa: #d81b70;
  --azul: #1a4fb8;
  --surface: #f5f7fb;
  --surface-2: #e8eef6;
  --card: #ffffff;
  --text: #132039;
  --text-muted: #5b6b82;
  --border: #d5deea;
  --border-strong: #b7c4d8;
  --ok: #1b7a45;
  --error: #c62828;
  --aviso: #7a4b12;
  --font: 'Manrope', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --lateral-w: 246px;
  --sombra: 0 18px 40px rgba(7, 26, 58, 0.08);
  --sombra-alta: 0 24px 60px rgba(7, 26, 58, 0.18);
}

* { box-sizing: border-box; }

/* Los estilos del autor ganan sobre la regla [hidden] del navegador, así que
   cualquier regla con `display` dejaría visible un elemento oculto (le pasó a
   .ficha y a .brindis). Esto lo garantiza para todos. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }

/* ================================================================ layout */
.app { display: flex; min-height: 100vh; }

.lateral {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--lateral-w);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--navy) 0%, #0a2249 60%, var(--navy-mid) 100%);
  color: #fff;
  z-index: 40;
}

.lateralMarca {
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 22px 22px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.lateralMarca img { width: 118px; height: auto; }
.lateralTech { width: 96px !important; opacity: 0.95; }

.nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.navTitulo {
  margin: 14px 10px 7px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
}
.navTitulo:first-child { margin-top: 2px; }

.navItem {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 3px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}
.navItem:hover { background: rgba(255, 255, 255, 0.09); color: #fff; }
.navItem.activo {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--teal);
}
.navIcono { font-size: 0.7rem; opacity: 0.9; width: 12px; }
.navIcono.azul { color: #6f9bef; }
.navIcono.rosa { color: #f280ad; }
.navIcono.teal { color: var(--teal); }
.navTag {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.lateralPie { padding: 14px 18px 18px; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.conexion {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.74rem; color: rgba(255, 255, 255, 0.72); margin-bottom: 10px;
}
.pulso {
  width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none;
  animation: pulso 2.4s infinite;
}
.pulso.malo { background: var(--error); animation: none; }
@keyframes pulso {
  0%   { box-shadow: 0 0 0 0 rgba(39, 174, 96, 0.6); }
  70%  { box-shadow: 0 0 0 7px rgba(39, 174, 96, 0); }
  100% { box-shadow: 0 0 0 0 rgba(39, 174, 96, 0); }
}
.usuario {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 0.76rem; color: rgba(255, 255, 255, 0.6); margin-bottom: 14px;
}
.usuario b { color: #fff; }
.usuario a { color: rgba(255, 255, 255, 0.8); text-decoration: none; font-weight: 600; }
.usuario a:hover { color: #fff; text-decoration: underline; }
.lateralGabor { width: 92px; height: auto; opacity: 0.5; filter: brightness(0) invert(1); }

.principal { flex: 1; margin-left: var(--lateral-w); min-width: 0; display: flex; flex-direction: column; }

/* ============================================================== cabecera */
.cabecera {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 18px;
  padding: 16px 28px;
  background: rgba(245, 247, 251, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.cabeceraTexto { flex: 1; min-width: 0; }
.kicker {
  margin: 0 0 3px;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--teal-deep);
}
.titulo {
  margin: 0; font-size: 1.4rem; font-weight: 800;
  letter-spacing: -0.01em; color: var(--navy); line-height: 1.2;
}
.cabeceraAcciones { display: flex; align-items: center; gap: 12px; }

.sello {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--border);
  font-size: 0.78rem; color: var(--text-muted); white-space: nowrap;
}
.selloPunto {
  width: 7px; height: 7px; border-radius: 50%; background: var(--ok);
  animation: pulso 2.4s infinite;
}
.sello.actualizando .selloPunto { background: var(--teal); }
.sello.error .selloPunto { background: var(--error); animation: none; }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 17px; border: none; border-radius: 11px;
  font-size: 0.88rem; font-weight: 700;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s ease;
}
.btnPrimario {
  background: linear-gradient(180deg, #16407c 0%, var(--navy) 100%);
  color: #fff; box-shadow: 0 10px 18px rgba(7, 26, 58, 0.22);
}
.btnPrimario:hover {
  background: linear-gradient(180deg, var(--teal) 0%, var(--teal-deep) 100%);
  box-shadow: 0 12px 20px rgba(13, 143, 139, 0.28);
}
.btnPrimario:active { transform: translateY(1px); }
.btnPrimario:disabled { opacity: 0.6; cursor: progress; }

.menuExport { position: relative; }
.menuExportLista {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 190px; padding: 6px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--sombra-alta);
  display: none; z-index: 50;
}
.menuExportLista.abierto { display: block; }
.menuExportLista button {
  display: block; width: 100%; padding: 9px 12px;
  border: none; border-radius: 8px; background: transparent;
  text-align: left; font-size: 0.85rem; color: var(--text);
}
.menuExportLista button:hover { background: var(--surface-2); }

.menuBtn {
  display: none; width: 38px; height: 38px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--card); font-size: 1.2rem; color: var(--navy);
}

/* =============================================================== contenido */
.contenido { padding: 24px 28px 48px; }
.vista { display: none; }
.vista.activa { display: block; animation: entrar 0.28s ease; }
@keyframes entrar { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.aviso {
  margin-bottom: 18px; padding: 12px 16px; border-radius: 12px;
  background: #fff8ef; border: 1px solid #efd2a8; color: var(--aviso);
  font-size: 0.86rem;
}

.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g21 { grid-template-columns: 1.3fr 1fr; }

/* ================================================================ tarjeta */
.tarjeta {
  background: var(--card);
  border: 1px solid rgba(15, 45, 92, 0.08);
  border-radius: 16px;
  box-shadow: var(--sombra);
  overflow: hidden;
}
.tarjetaCab {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fcfdff 0%, #f7f9fc 100%);
}
.tarjetaTitulo {
  margin: 0; padding-left: 11px; border-left: 3px solid var(--teal);
  font-size: 0.97rem; font-weight: 700; color: var(--navy);
}
.tarjetaSub { margin: 5px 0 0 14px; font-size: 0.76rem; color: var(--text-muted); }
.tarjetaCuerpo { padding: 18px 20px; }
.tarjetaCuerpo.sinPad { padding: 0; }

/* ==================================================================== KPI */
.kpiGrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.kpi { position: relative; padding: 20px; }
.kpi::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--teal); }
.kpi.azul::before { background: var(--azul); }
.kpi.rosa::before { background: var(--rosa); }
.kpi.navy::before { background: var(--navy-mid); }
.kpiLabel {
  margin: 0; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-muted);
}
.kpiValue {
  margin: 9px 0 3px; font-size: 2.45rem; font-weight: 800; line-height: 1;
  color: var(--navy); letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
}
.kpi.azul .kpiValue { color: var(--azul); }
.kpi.rosa .kpiValue { color: var(--rosa); }
.kpi.teal .kpiValue { color: var(--teal-deep); }
.kpiHint { margin: 0; font-size: 0.78rem; color: var(--text-muted); }
.destello { animation: destello 1.1s ease; }
@keyframes destello {
  0% { background: rgba(18, 181, 176, 0.22); }
  100% { background: transparent; }
}

/* ================================================================= donas */
.donaFila { display: flex; align-items: center; gap: 16px; }
.donaTexto { flex: 1; min-width: 0; }
.donaTotal { font-size: 1.6rem; font-weight: 800; color: var(--navy); line-height: 1; font-variant-numeric: tabular-nums; }
.donaDetalle { margin-top: 6px; font-size: 0.79rem; color: var(--text-muted); line-height: 1.55; }
.donaDetalle b { color: var(--text); }

/* ================================================================ barras */
.barras { display: flex; flex-direction: column; gap: 10px; }
.barraFila { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; }
.barraEtiqueta { font-size: 0.81rem; color: var(--text); line-height: 1.35; }
.barraTotal { font-size: 0.81rem; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.barraPista { grid-column: 1 / -1; height: 7px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.barraValor {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--teal) 0%, var(--teal-deep) 100%);
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.barras.azul .barraValor { background: linear-gradient(90deg, #4a7cdc 0%, var(--azul) 100%); }
.barras.rosa .barraValor { background: linear-gradient(90deg, #e8578f 0%, var(--rosa) 100%); }

/* ============================================================== recientes */
.reciente {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 20px; border-bottom: 1px solid #eef2f7;
  cursor: pointer; transition: background 0.14s ease;
}
.reciente:last-child { border-bottom: none; }
.reciente:hover { background: var(--surface); }
.recienteTexto { flex: 1; min-width: 0; }
.recienteNombre {
  font-size: 0.85rem; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.recienteDetalle {
  font-size: 0.74rem; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ================================================================= tabla */
.tablaBarra {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 15px 18px; border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fcfdff 0%, #f7f9fc 100%);
}
.buscador { position: relative; flex: 1; min-width: 240px; }
.buscadorIcono {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 1rem;
}
.buscador input {
  width: 100%; padding: 10px 13px 10px 36px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  font-family: var(--font); font-size: 0.88rem; color: var(--text);
  background: #fff; outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.buscador input:focus { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(18, 181, 176, 0.16); }

.filtros { display: flex; gap: 6px; }
.chip {
  padding: 7px 13px; border: 1px solid var(--border-strong); border-radius: 999px;
  background: #fff; font-size: 0.78rem; font-weight: 600; color: var(--text-muted);
  transition: all 0.15s ease;
}
.chip:hover { border-color: var(--teal); color: var(--teal-deep); }
.chip.activo { background: var(--navy); border-color: var(--navy); color: #fff; }

.tablaMeta { font-size: 0.79rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.tablaEnvoltura { overflow-x: auto; max-height: calc(100vh - 320px); }
.tabla { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.83rem; }
.tabla thead th {
  position: sticky; top: 0; z-index: 2;
  padding: 11px 12px; text-align: left; white-space: nowrap;
  font-size: 0.69rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: #fff; background: var(--navy); cursor: pointer; user-select: none;
}
.tabla thead th:hover { background: var(--navy-mid); }
.tabla thead th .orden { opacity: 0.45; margin-left: 4px; font-size: 0.8em; }
.tabla thead th.ordenado .orden { opacity: 1; color: var(--teal); }
.tabla tbody td {
  padding: 10px 12px; border-bottom: 1px solid #eef2f7;
  vertical-align: top; color: var(--text);
}
.tabla tbody tr { cursor: pointer; transition: background 0.12s ease; }
.tabla tbody tr:nth-child(even) { background: #fafbfd; }
.tabla tbody tr:hover { background: #eef4fc; }
.tabla tbody tr.nuevo { animation: destello 1.6s ease; }
.celdaNum { text-align: center; font-variant-numeric: tabular-nums; }
.celdaId { font-weight: 700; color: var(--navy-mid); text-align: center; }
.vacio { padding: 40px 16px; text-align: center; color: var(--text-muted); font-size: 0.88rem; }

.pill { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 0.71rem; font-weight: 700; white-space: nowrap; }
.pill.si { background: #e6f4ec; color: var(--ok); }
.pill.no { background: #fdeaea; color: var(--error); }
.pill.azul { background: #e9f0fc; color: var(--azul); }
.pill.rosa { background: #fdeef4; color: var(--rosa); }
.pill.teal { background: #e4f6f5; color: var(--teal-deep); }

.paginacion {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 18px; border-top: 1px solid var(--border); flex-wrap: wrap;
}
.pagBotones { display: flex; gap: 5px; }
.pagBtn {
  min-width: 34px; padding: 7px 10px;
  border: 1px solid var(--border-strong); border-radius: 9px;
  background: #fff; font-size: 0.82rem; font-weight: 600; color: var(--text);
}
.pagBtn:hover:not(:disabled) { border-color: var(--teal); color: var(--teal-deep); }
.pagBtn.activo { background: var(--navy); border-color: var(--navy); color: #fff; }
.pagBtn:disabled { opacity: 0.4; cursor: default; }
.pagInfo { font-size: 0.79rem; color: var(--text-muted); }

/* ================================================================= ficha */
.capa {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(7, 26, 58, 0.42); backdrop-filter: blur(2px);
  animation: aparecer 0.2s ease;
}
@keyframes aparecer { from { opacity: 0; } to { opacity: 1; } }

.ficha {
  position: fixed; inset: 0 0 0 auto; z-index: 61;
  width: min(480px, 100%); display: flex; flex-direction: column;
  background: var(--card); box-shadow: var(--sombra-alta);
  animation: deslizar 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes deslizar { from { transform: translateX(100%); } to { transform: none; } }

.fichaCab {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 22px 24px; color: #fff;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
}
.fichaTipo {
  margin: 0 0 5px; font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--teal);
}
.fichaNombre { margin: 0; font-size: 1.15rem; font-weight: 800; line-height: 1.25; }
.fichaCerrar {
  margin-left: auto; width: 32px; height: 32px; flex: none;
  border: 1px solid rgba(255, 255, 255, 0.28); border-radius: 9px;
  background: transparent; color: #fff; font-size: 1.3rem; line-height: 1;
}
.fichaCerrar:hover { background: rgba(255, 255, 255, 0.14); }
.fichaCuerpo { flex: 1; overflow-y: auto; padding: 6px 0 24px; }

.fichaFila {
  display: grid; grid-template-columns: 148px 1fr; gap: 14px;
  padding: 11px 24px; border-bottom: 1px solid #eef2f7;
}
.fichaEtiqueta {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--text-muted); padding-top: 1px;
}
.fichaValor { font-size: 0.87rem; color: var(--text); word-break: break-word; }
.fichaValor a { color: var(--azul); text-decoration: none; }
.fichaValor a:hover { text-decoration: underline; }
.etiquetas { display: flex; flex-wrap: wrap; gap: 5px; }
.etiqueta {
  padding: 3px 9px; border-radius: 7px;
  background: var(--surface-2); color: var(--navy-mid);
  font-size: 0.74rem; font-weight: 600;
}

/* =============================================================== brindis */
.brindis {
  position: fixed; right: 24px; bottom: 24px; z-index: 70;
  display: flex; align-items: center; gap: 10px;
  padding: 13px 18px; border-radius: 12px;
  background: var(--navy); color: #fff;
  font-size: 0.86rem; font-weight: 600;
  box-shadow: var(--sombra-alta);
  animation: subir 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes subir { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.brindis .punto { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); }

/* ============================================================ responsive */
@media (max-width: 1180px) {
  .kpiGrid { grid-template-columns: repeat(2, 1fr); }
  .g3, .g21 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .lateral { transform: translateX(-100%); transition: transform 0.25s ease; }
  .lateral.abierto { transform: none; box-shadow: var(--sombra-alta); }
  .principal { margin-left: 0; }
  .menuBtn { display: block; }
  .g2 { grid-template-columns: 1fr; }
  .contenido { padding: 18px 16px 40px; }
  .cabecera { padding: 13px 16px; }
  .titulo { font-size: 1.15rem; }
}
@media (max-width: 620px) {
  .kpiGrid { grid-template-columns: 1fr; }
  .cabeceraAcciones .sello { display: none; }
  .tablaEnvoltura { max-height: none; }
}

/* =================================================================== login */
.loginPage {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(18, 181, 176, 0.14), transparent 55%),
    radial-gradient(900px 420px at 95% 0%, rgba(15, 45, 92, 0.18), transparent 50%),
    linear-gradient(180deg, #eef3f9 0%, var(--surface) 42%, #e7edf5 100%);
}
.loginCard {
  width: min(430px, 100%);
  background: var(--card); border: 1px solid rgba(15, 45, 92, 0.08);
  border-radius: 18px; box-shadow: var(--sombra); overflow: hidden;
}
.loginHead {
  padding: 30px 32px 24px; text-align: center;
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-mid) 100%);
}
.loginLogos { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 18px; }
.loginLogos img:first-child { height: 38px; }
.loginLogos img:last-child { height: 25px; }
.loginTitulo { margin: 0; color: #fff; font-size: 1.2rem; font-weight: 800; }
.loginSub { margin: 6px 0 0; color: rgba(255, 255, 255, 0.66); font-size: 0.82rem; }
.loginBody { padding: 26px 32px 30px; }
.grupo { margin-bottom: 16px; }
.label {
  display: block; margin-bottom: 7px;
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--text-muted);
}
.input {
  width: 100%; padding: 13px 14px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  font-size: 0.98rem; font-family: var(--font); color: var(--text);
  background: #fff; outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.input:focus { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(18, 181, 176, 0.16); }
.btnLogin { width: 100%; margin-top: 6px; justify-content: center; }
.alerta {
  margin-bottom: 16px; padding: 11px 14px; border-radius: 10px; font-size: 0.85rem;
  background: #fdeaea; border: 1px solid #f3c6c6; color: var(--error);
}
.loginPie { margin-top: 20px; text-align: center; font-size: 0.75rem; color: var(--text-muted); }
