:root {
  --violeta: #6d3ff2;
  --violeta-osc: #5227d1;
  --lila: #a78bfa;
  --carbon: #131022;
  --fondo: #f5f4fa;
  --blanco: #fff;
  --borde: #e3e0ee;
  --texto: #1e1b2e;
  --suave: #6b6780;
  --verde: #16a34a;
  --verde-fondo: #e8f8ee;
  --rojo: #dc2626;
  --rojo-fondo: #fdecec;
  --ambar: #d97706;
  --ambar-fondo: #fff5e0;
  --gris: #9ca3af;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Poppins', system-ui, sans-serif; background: var(--fondo); color: var(--texto); font-size: 15px; }
a { color: var(--violeta); }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
.sub { color: var(--suave); margin: 0 0 1.5rem; }

/* ---------- Layout con menú lateral ---------- */
.layout { display: flex; min-height: 100vh; }
.lateral { width: 240px; background: var(--carbon); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; flex-shrink: 0; }
.marca { display: flex; gap: .7rem; align-items: center; padding: 1.3rem 1.1rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.marca strong { display: block; font-size: .95rem; }
.marca small { color: var(--lila); font-size: .75rem; }
.logo { width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, var(--violeta), var(--verde)); display: grid; place-items: center; font-weight: 700; font-size: 1.05rem; letter-spacing: -.5px; }
.lateral nav { padding: 1rem .6rem; flex: 1; }
.lateral nav a { display: block; color: #d6d3e6; text-decoration: none; padding: .6rem .8rem; border-radius: 8px; margin-bottom: 2px; font-size: .92rem; }
.lateral nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.lateral nav a.activo { background: var(--violeta); color: #fff; }
.nav-sep { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #7c7894; padding: 1rem .8rem .4rem; }
.lateral-pie { padding: 1rem 1.1rem; border-top: 1px solid rgba(255,255,255,.08); font-size: .8rem; color: #a9a5bd; }
.lateral-pie span { display: block; color: #fff; margin-bottom: .2rem; }
.lateral-pie a { color: var(--lila); text-decoration: none; }
.contenido { flex: 1; padding: 2rem; max-width: 1100px; min-width: 0; }
.menu-movil { display: none; }

/* ---------- Componentes ---------- */
.tarjeta { background: var(--blanco); border: 1px solid var(--borde); border-radius: 14px; padding: 1.4rem; margin-bottom: 1.2rem; }
.btn { display: inline-block; border: 0; border-radius: 10px; padding: .65rem 1.2rem; font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; background: var(--violeta); color: #fff; }
.btn:hover { background: var(--violeta-osc); }
.btn-sec { background: #ece9f7; color: var(--texto); }
.btn-sec:hover { background: #dedaf0; }
.btn-grande { padding: .9rem 1.8rem; font-size: 1.05rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
label { display: block; font-weight: 500; font-size: .88rem; margin-bottom: .3rem; }
input[type=text], input[type=password], input[type=url], input[type=number], select, textarea {
  width: 100%; padding: .65rem .8rem; border: 1px solid var(--borde); border-radius: 10px; font: inherit; background: #fff;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--lila); border-color: var(--violeta); }
.campo { margin-bottom: 1rem; }
.fila { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.aviso { padding: .8rem 1rem; border-radius: 10px; margin-bottom: 1rem; }
.aviso-ok { background: var(--verde-fondo); color: #14532d; }
.aviso-error { background: var(--rojo-fondo); color: #7f1d1d; }
.aviso-info { background: #efeafe; color: #3b2a86; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .65rem .6rem; border-bottom: 1px solid var(--borde); font-size: .9rem; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--suave); }
.tabla-scroll { overflow-x: auto; }
.mono { font-family: ui-monospace, Consolas, monospace; letter-spacing: .02em; }
.chip { display: inline-block; padding: .2rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.chip-aprobado, .chip-ok { background: var(--verde-fondo); color: var(--verde); }
.chip-bloqueado { background: var(--rojo-fondo); color: var(--rojo); }
.chip-revisar, .chip-no_inscrito { background: var(--ambar-fondo); color: var(--ambar); }

/* ---------- Consulta IMEI ---------- */
.imei-entrada { display: flex; gap: .8rem; align-items: flex-end; flex-wrap: wrap; }
.imei-entrada .campo { flex: 1; min-width: 240px; margin: 0; }
#imei { font-size: 1.4rem; letter-spacing: .12em; font-family: ui-monospace, Consolas, monospace; padding: .8rem 1rem; }
.imei-msg { font-size: .85rem; margin-top: .4rem; min-height: 1.2em; }
.imei-msg.ok { color: var(--verde); }
.imei-msg.error { color: var(--rojo); }

.semaforo { display: flex; align-items: center; gap: 1.4rem; }
.icono-estado { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; background: #eceaf3; color: var(--gris); transition: background .3s, transform .3s; }
.icono-estado svg { width: 56px; height: 56px; }
.icono-estado.aprobado { background: var(--verde); color: #fff; box-shadow: 0 0 0 10px var(--verde-fondo); transform: scale(1.05); }
.icono-estado.bloqueado { background: var(--rojo); color: #fff; box-shadow: 0 0 0 10px var(--rojo-fondo); }
.icono-estado.revisar { background: var(--ambar); color: #fff; box-shadow: 0 0 0 10px var(--ambar-fondo); }
.semaforo h2 { font-size: 1.35rem; margin: 0 0 .2rem; }
.semaforo p { margin: 0; color: var(--suave); }
.progreso { height: 8px; background: #eceaf3; border-radius: 99px; overflow: hidden; margin-top: .7rem; max-width: 320px; }
.progreso div { height: 100%; background: var(--violeta); width: 0; transition: width .3s; }

.operadores { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1rem; }
.op { background: #fff; border: 2px solid var(--borde); border-radius: 14px; padding: 1.1rem; display: flex; flex-direction: column; gap: .75rem; transition: border-color .2s; }
.op.res-ok { border-color: var(--verde); background: #fbfefc; }
.op.res-bloqueado { border-color: var(--rojo); background: #fffafa; }
.op.res-no_inscrito { border-color: var(--ambar); }
.op-cab { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.op-nombre { display: flex; align-items: center; gap: .55rem; font-weight: 600; font-size: 1.05rem; }
.op-punto { width: 14px; height: 14px; border-radius: 4px; }
.op-estado { font-size: 1.4rem; }
.op-inst { font-size: .8rem; color: var(--suave); margin: 0; }
.op-botones { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.op-botones button { border: 1px solid var(--borde); background: #fff; border-radius: 9px; padding: .55rem .3rem; font: inherit; font-size: .78rem; font-weight: 500; cursor: pointer; }
.op-botones button:hover { background: #f5f4fa; }
.op-botones button.sel-ok { background: var(--verde); border-color: var(--verde); color: #fff; }
.op-botones button.sel-bloqueado { background: var(--rojo); border-color: var(--rojo); color: #fff; }
.op-botones button.sel-no_inscrito { background: var(--ambar); border-color: var(--ambar); color: #fff; }
.op-extra { display: none; gap: .5rem; flex-direction: column; }
.op.con-resultado .op-extra { display: flex; }
.op-extra input[type=text] { font-size: .85rem; padding: .5rem .65rem; }
.op-extra .archivo { font-size: .78rem; color: var(--suave); }
.op-abrir { width: 100%; text-align: center; }
.oculto { display: none !important; }

/* ---------- Login ---------- */
.login-fondo { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: radial-gradient(circle at 20% 20%, #2a2146, var(--carbon)); }
.login { width: 100%; max-width: 380px; background: #fff; border-radius: 18px; padding: 2rem; }
.login .marca { border: 0; padding: 0 0 1.4rem; color: var(--texto); }
.login .marca small { color: var(--suave); }

/* ---------- Detalle / certificado ---------- */
.cert-cab { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.evid img { max-width: 100%; max-height: 380px; border: 1px solid var(--borde); border-radius: 8px; margin-top: .4rem; }

@media (max-width: 800px) {
  .layout { display: block; }
  .lateral { position: fixed; left: -260px; z-index: 20; transition: left .25s; }
  .lateral.abierto { left: 0; }
  .contenido { padding: 1rem; }
  .menu-movil { display: inline-block; margin-bottom: 1rem; background: var(--carbon); color: #fff; border: 0; border-radius: 8px; padding: .5rem .9rem; font: inherit; }
  .semaforo { flex-direction: column; text-align: center; }
  .progreso { margin: .7rem auto 0; }
}

@media print {
  .lateral, .menu-movil, .no-imprimir { display: none !important; }
  body { background: #fff; }
  .contenido { padding: 0; }
  .tarjeta { border: 1px solid #ccc; }
}
