/* =========================================================
   LOOJ - ESTILOS GLOBALES / SOLO PRESENTACION
   No contiene logica PHP ni modifica autenticacion.
   ========================================================= */
*{box-sizing:border-box}
html{width:100%;overflow-x:hidden}
body{margin:0;font-family:Arial,sans-serif;background:#07111f;color:#eaf0f7;min-width:0;line-height:1.5}

/* ---------- Barra superior ---------- */
.topbar{min-height:64px;background:#050b14;color:#fff;padding:10px 5%;display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap;border-bottom:1px solid rgba(255,255,255,.08)}
.topbar strong{color:#fff;font-size:20px;letter-spacing:.3px;white-space:nowrap}
.topbar a{color:#fff;text-decoration:none;margin-left:18px;font-weight:600}
.topbar a:hover{text-decoration:underline}
.topbar .empresa-contexto,.topbar .superadmin-contexto,.topbar .usuario-contexto{color:#fff!important;opacity:1!important;font-size:13px!important}
.topbar .usuario-contexto{margin-left:auto}

/* ---------- Contenedor ---------- */
.container{width:100%;max-width:1100px;margin:35px auto;padding:0 18px;min-width:0}

/* ---------- Titulos y subtitulos ---------- */
h1,h2,h3,h4,h5,h6{margin-top:0;color:#fff;line-height:1.2}
.card h1,.card h2,.card h3,.card h4,.card h5,.card h6,
.login-card h1,.login-card h2,.login-card h3,.login-card h4,.login-card h5,.login-card h6{color:#182333}
.card p,.card label,.card td,.card th,.card li{color:#263445}
.card a{color:#0b63ce}

/* ---------- Tarjetas ---------- */
.card{background:#fff;color:#182333;border-radius:16px;padding:22px;margin-bottom:20px;box-shadow:0 8px 30px rgba(0,0,0,.20);overflow:hidden}
.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:18px}

/* ---------- Formularios ---------- */
label{color:#fff;font-weight:600}
.card label,.login-card label{color:#182333}
.input{width:100%;max-width:100%;padding:11px;border:1px solid #ccd3dd;border-radius:9px;margin:7px 0 15px;background:#fff;color:#182333;font-size:15px}
input,select,textarea{max-width:100%;font-family:inherit}
input:focus,select:focus,textarea:focus{outline:3px solid rgba(13,110,253,.16);border-color:#0d6efd}

/* ---------- Botones ---------- */
.btn{display:inline-block;border:0;border-radius:10px;padding:11px 16px;background:#0d6efd;color:#fff!important;text-decoration:none;cursor:pointer;font-weight:600}
.btn.secondary{background:#566}
.btn.danger{background:#b42318}
button{font-family:inherit}

/* ---------- Alertas ---------- */
.alert{padding:12px 14px;border-radius:10px;background:#e8f1ff;color:#123b69;margin:14px 0;border:1px solid #c9defb}
.alert-error{background:#fff1f2;color:#9f1239;border-color:#fecdd3}

/* ---------- Textos auxiliares ---------- */
.muted{color:#667085!important}
.badge{display:inline-block;padding:5px 9px;border-radius:999px;background:#eef2f6;color:#334155;font-size:12px;font-weight:600}
.timeline{border-left:3px solid #0d6efd;padding-left:18px}
.footer{padding:30px;text-align:center;color:#cbd5e1}

/* ---------- Login / 2FA / recuperacion ---------- */
.login-container{min-height:calc(100vh - 150px);display:flex;align-items:center;justify-content:center;padding:40px 20px;width:100%}
.login-card{width:100%;max-width:460px;background:#fff;color:#182333;border-radius:18px;padding:32px;box-shadow:0 14px 45px rgba(0,0,0,.28);border:1px solid rgba(255,255,255,.12)}
.login-card h1{margin:0 0 6px;text-align:center;font-size:30px;font-weight:800}
.login-card h2{margin:0 0 25px;text-align:center;font-size:22px;font-weight:700}
.login-card p{color:#475467;text-align:center}
.login-card .form-group{margin-bottom:18px}
.login-card .form-group label{display:block;margin-bottom:7px;font-weight:700;color:#182333}
.login-card input[type="text"],.login-card input[type="email"],.login-card input[type="password"],.login-card input[inputmode="numeric"]{width:100%;box-sizing:border-box;padding:13px 14px;border:1px solid #cbd5e1;border-radius:10px;font-size:16px;background:#fff;color:#111827;min-height:48px}
.login-card input::placeholder{color:#98a2b3}
.login-card button{width:100%;border:0;border-radius:10px;padding:13px;font-size:16px;font-weight:700;cursor:pointer;background:#0d6efd;color:#fff;min-height:48px}
.login-card button:hover{filter:brightness(.96)}
.login-card a{color:#0b63ce;font-weight:600}
.login-card .security-code-input,#codigo{width:100%!important;height:64px!important;min-height:64px!important;text-align:center!important;font-size:30px!important;font-weight:800!important;letter-spacing:12px!important;color:#111827!important;background:#fff!important;border:2px solid #94a3b8!important;border-radius:12px!important;padding:8px 12px!important;line-height:1!important}
.login-card .security-code-input:focus,#codigo:focus{border-color:#0d6efd!important;outline:4px solid rgba(13,110,253,.13)!important}
.login-card form + form button{background:#f1f5f9!important;color:#0f172a!important;border:1px solid #dbe3ee!important}
.empresa-option{display:flex!important;width:100%;justify-content:space-between;align-items:center;text-align:left!important;background:#f8fafc!important;color:#111827!important;border:1px solid #dbe3ee!important;margin:10px 0;padding:16px!important;border-radius:10px!important;min-height:58px}
.empresa-option strong{color:#111827!important}
.empresa-option span{font-size:13px;color:#2563eb!important;white-space:nowrap}

/* ---------- Tablas y contenido amplio ---------- */
table{max-width:100%;border-collapse:collapse}
img,video,iframe{max-width:100%;height:auto}
pre,code{max-width:100%;overflow:auto}

/* ---------- Responsive ---------- */
@media (max-width:768px){
  .topbar{padding:12px 16px;justify-content:center;text-align:center;gap:8px}
  .topbar strong{width:100%}
  .topbar .empresa-contexto,.topbar .superadmin-contexto,.topbar .usuario-contexto{margin:0!important;width:100%;text-align:center}
  .topbar nav{width:100%;display:flex;justify-content:center;align-items:center;flex-wrap:wrap;gap:8px}
  .topbar nav a{margin:0;padding:6px 8px}
  .container{margin:22px auto;padding:0 12px}
  .grid{grid-template-columns:1fr;gap:12px}
  .card{padding:16px;border-radius:12px}
  .login-container{min-height:calc(100vh - 190px);padding:22px 12px;align-items:flex-start}
  .login-card{max-width:100%;padding:22px 17px;border-radius:14px;margin-top:10px}
  .login-card h1{font-size:26px}
  .login-card h2{font-size:20px;margin-bottom:20px}
  .login-card .security-code-input,#codigo{height:58px!important;min-height:58px!important;font-size:25px!important;letter-spacing:8px!important}
}

@media (max-width:420px){
  .topbar nav a{font-size:13px}
  .container{padding:0 10px}
  .login-card{padding:20px 14px}
  .login-card .security-code-input,#codigo{font-size:22px!important;letter-spacing:5px!important;padding-left:8px!important;padding-right:8px!important}
}


/* =========================================================
   AJUSTE VISUAL GLOBAL V2
   Solo presentacion. No modifica logica PHP, sesiones ni SQL.
   ========================================================= */

/* Encabezado: una sola linea limpia en escritorio */
.topbar{
  flex-wrap:nowrap;
  min-width:0;
  padding:10px clamp(16px,4vw,48px);
}
.topbar > strong{flex:0 0 auto}
.topbar .empresa-contexto,
.topbar .superadmin-contexto{
  flex:1 1 auto;
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.topbar .usuario-contexto{
  flex:0 0 auto;
  margin-left:0!important;
  white-space:nowrap;
}
.topbar nav{
  flex:0 0 auto;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  flex-wrap:nowrap;
  gap:10px;
  min-width:0;
}
.topbar nav a{margin-left:0}

/* Cualquier panel blanco creado con estilos inline debe tener texto oscuro.
   Evita texto blanco sobre blanco en dashboards y tablas. */
.container [style*="background:#fff"],
.container [style*="background: #fff"]{
  color:#182333;
}
.container [style*="background:#fff"] h1,
.container [style*="background:#fff"] h2,
.container [style*="background:#fff"] h3,
.container [style*="background:#fff"] h4,
.container [style*="background:#fff"] h5,
.container [style*="background:#fff"] h6,
.container [style*="background: #fff"] h1,
.container [style*="background: #fff"] h2,
.container [style*="background: #fff"] h3,
.container [style*="background: #fff"] h4,
.container [style*="background: #fff"] h5,
.container [style*="background: #fff"] h6{
  color:#182333!important;
}
.container [style*="background:#fff"] p,
.container [style*="background:#fff"] div,
.container [style*="background:#fff"] span,
.container [style*="background:#fff"] small,
.container [style*="background: #fff"] p,
.container [style*="background: #fff"] div,
.container [style*="background: #fff"] span,
.container [style*="background: #fff"] small{
  color:#263445;
}
.container [style*="background:#fff"] a:not(.btn),
.container [style*="background: #fff"] a:not(.btn){color:#0b63ce}

/* Tablas sobre panel blanco: texto siempre legible */
.container table,
.container table th,
.container table td{
  color:#263445;
}
.container table th{font-weight:700}
.container table small{color:#64748b!important}

/* Dashboards con grids inline */
.container [style*="grid-template-columns:repeat(4,1fr)"]{
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
}
.container [style*="grid-template-columns:1fr 1fr"]{
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
}

/* Evita que botones en cabeceras se partan de forma desordenada */
.container [style*="display:flex"][style*="justify-content:space-between"]{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) auto auto auto;
  align-items:center!important;
  gap:15px!important;
}
.container [style*="display:flex"][style*="justify-content:space-between"] .btn{
  width:auto;
  white-space:nowrap;
}

/* Formularios y controles: contraste consistente */
.container input,
.container select,
.container textarea{
  color:#182333;
  background:#fff;
}
.container input::placeholder,
.container textarea::placeholder{color:#64748b}

@media (max-width:900px){
  .topbar{
    flex-wrap:wrap;
    justify-content:center;
    text-align:center;
  }
  .topbar > strong{width:auto}
  .topbar .empresa-contexto,
  .topbar .superadmin-contexto,
  .topbar .usuario-contexto{
    flex:1 1 auto;
    width:auto;
    text-align:center;
  }
  .topbar nav{
    width:100%;
    justify-content:center;
    flex-wrap:wrap;
  }
  .container [style*="display:flex"][style*="justify-content:space-between"]{
    grid-template-columns:1fr auto;
  }
  .container [style*="grid-template-columns:repeat(4,1fr)"]{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
  .container [style*="grid-template-columns:1fr 1fr"]{
    grid-template-columns:1fr!important;
  }
  .container [style*="display:flex"][style*="justify-content:space-between"]{
    grid-template-columns:1fr;
  }
}

@media (max-width:560px){
  .topbar{padding:12px 12px}
  .topbar > strong{width:100%;font-size:20px}
  .topbar .empresa-contexto,
  .topbar .superadmin-contexto,
  .topbar .usuario-contexto{width:100%;flex-basis:100%}
  .topbar nav a{font-size:14px;padding:6px 7px}
  .container [style*="grid-template-columns:repeat(4,1fr)"]{
    grid-template-columns:1fr!important;
  }
  .container [style*="display:flex"][style*="justify-content:space-between"] .btn{
    width:100%;
  }
}
