/* Inventario CE — estilos propios (sin dependencias externas) */
:root {
  --azul: #1f4e8c; --azul-osc: #163a69; --azul-claro: #e8eff9;
  --texto: #1d2733; --suave: #5b6878; --borde: #d8dee6; --fondo: #f4f6f9; --blanco: #fff;
  --verde: #1e7b45; --verde-f: #e6f4ec; --rojo: #b42318; --rojo-f: #fdecea;
  --ambar: #8a5a00; --ambar-f: #fff4e0; --radio: 8px;
  --sombra: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
       color: var(--texto); background: var(--fondo); line-height: 1.45; }
a { color: var(--azul); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
.suave { color: var(--suave); }
.mono { font-family: Consolas, "Cascadia Mono", monospace; }
.nowrap { white-space: nowrap; }
.derecha { text-align: right; }

/* --- Barra superior ------------------------------------------------------ */
.barra { background: var(--azul); color: #fff; }
.barra .contenido { display: flex; align-items: center; gap: .75rem; padding: .55rem 1.25rem; flex-wrap: wrap; }
.barra a, .barra button.enlace { color: #dfe8f5; }
.barra a:hover { color: #fff; text-decoration: none; }
.marca { font-weight: 700; color: #fff !important; font-size: 1.05rem; letter-spacing: .2px; }
.menu { display: flex; gap: .2rem; flex-wrap: wrap; }
.menu a { padding: .35rem .5rem; border-radius: 6px; }
.menu a.activo, .menu a:hover { background: var(--azul-osc); color: #fff; }
.barra .espacio { flex: 1; }
.chip-centro { background: var(--azul-osc); padding: .3rem .7rem; border-radius: 999px; font-size: .9rem; }
.escaner { display: flex; }
.escaner input { width: 12rem; border: 0; border-radius: 6px 0 0 6px; padding: .4rem .6rem; font-size: .95rem; }
.escaner button { border: 0; border-radius: 0 6px 6px 0; background: #f0b429; color: #1d2733; padding: 0 .7rem;
                  font-weight: 600; cursor: pointer; }

/* --- Estructura ---------------------------------------------------------- */
main { max-width: 1280px; margin: 0 auto; padding: 1.25rem; }
.encabezado { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem;
              margin-bottom: 1rem; flex-wrap: wrap; }
.tarjeta { background: var(--blanco); border: 1px solid var(--borde); border-radius: var(--radio);
           box-shadow: var(--sombra); padding: 1.1rem 1.25rem; margin-bottom: 1rem; }
.rejilla { display: grid; gap: 1rem; }
.r2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.r3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.r4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .r2, .r3, .r4 { grid-template-columns: 1fr; } .escaner input { width: 11rem; } }

.cifra { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.cifra-et { color: var(--suave); font-size: .9rem; }

/* --- Tablas -------------------------------------------------------------- */
.tabla-env { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--blanco); }
th, td { padding: .5rem .6rem; border-bottom: 1px solid var(--borde); text-align: left; vertical-align: top; }
th { font-size: .82rem; text-transform: uppercase; letter-spacing: .3px; color: var(--suave);
     background: #f8fafc; position: sticky; top: 0; }
tbody tr:hover { background: #f7f9fc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* --- Formularios --------------------------------------------------------- */
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .25rem; }
.campo { margin-bottom: .85rem; }
.ayuda { color: var(--suave); font-size: .82rem; margin-top: .2rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date],
input[type=search], select, textarea {
  width: 100%; padding: .5rem .6rem; border: 1px solid #c3ccd8; border-radius: 6px; font: inherit;
  background: #fff; color: var(--texto); }
input:focus, select:focus, textarea:focus { outline: 2px solid #8fb3e6; outline-offset: 0; border-color: var(--azul); }
textarea { min-height: 5rem; resize: vertical; }
.filtros { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; }
.filtros .campo { margin: 0; }
.filtros .q { flex: 1 1 18rem; }
.casilla { display: flex; align-items: center; gap: .4rem; font-weight: 400; }
.casilla input { width: auto; }

.btn { display: inline-flex; align-items: center; gap: .35rem; padding: .5rem .95rem; border-radius: 6px;
       border: 1px solid var(--azul); background: var(--azul); color: #fff; font: inherit; font-weight: 600;
       cursor: pointer; text-decoration: none !important; white-space: nowrap; }
.btn:hover { background: var(--azul-osc); }
.btn.sec { background: #fff; color: var(--azul); }
.btn.sec:hover { background: var(--azul-claro); }
.btn.peligro { background: var(--rojo); border-color: var(--rojo); }
.btn.peq { padding: .25rem .6rem; font-size: .85rem; }
button.enlace { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; color: var(--azul); }
.acciones { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
form.en-linea { display: inline; }

/* --- Avisos y etiquetas -------------------------------------------------- */
.aviso { padding: .7rem .9rem; border-radius: 6px; margin-bottom: .75rem; border: 1px solid transparent; }
.aviso.success { background: var(--verde-f); color: var(--verde); border-color: #b7e0c6; }
.aviso.danger  { background: var(--rojo-f);  color: var(--rojo);  border-color: #f5c2bd; }
.aviso.warning { background: var(--ambar-f); color: var(--ambar); border-color: #f3d9a4; }
.aviso.info    { background: var(--azul-claro); color: var(--azul-osc); border-color: #c5d6ef; }
.et { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .8rem; font-weight: 600;
      background: #eef1f5; color: var(--suave); }
.et.Excelente { background: var(--verde); color: #fff; }
.et.Bueno { background: var(--verde-f); color: var(--verde); }
.et.Regular { background: var(--ambar-f); color: var(--ambar); }
.et.Malo, .et.Inservible, .et.BAJA { background: var(--rojo-f); color: var(--rojo); }
.et.ACTIVO { background: var(--azul-claro); color: var(--azul-osc); }

/* --- Bitácora ------------------------------------------------------------ */
table.bitacora td { font-size: .92rem; }
.et.accion-INSERT { background: var(--verde-f); color: var(--verde); }
.et.accion-UPDATE, .et.accion-SOPORTE { background: var(--azul-claro); color: var(--azul-osc); }
.et.accion-DELETE, .et.accion-LOGIN_FALLO { background: var(--rojo-f); color: var(--rojo); }
.et.accion-CAMBIO_CLAVE { background: var(--ambar-f); color: var(--ambar); }

/* --- Ficha de activo ----------------------------------------------------- */
.ficha { display: grid; grid-template-columns: 11rem 1fr; gap: .45rem 1rem; margin: 0; }
.ficha dt { color: var(--suave); }
.ficha dd { margin: 0; font-weight: 500; }
.numero-grande { font-family: Consolas, monospace; font-size: 1.6rem; font-weight: 700; color: var(--azul-osc); }

/* --- Paginación ---------------------------------------------------------- */
.paginacion { display: flex; gap: .3rem; align-items: center; justify-content: flex-end; margin-top: .75rem; }
.paginacion a, .paginacion span { padding: .3rem .65rem; border: 1px solid var(--borde); border-radius: 6px;
                                  background: #fff; }
.paginacion .actual { background: var(--azul); color: #fff; border-color: var(--azul); }

/* --- Barras simples (tablero) ------------------------------------------- */
.barra-dato { display: grid; grid-template-columns: 9rem 1fr 3.5rem; align-items: center; gap: .6rem;
              margin-bottom: .4rem; font-size: .92rem; }
.barra-dato .pista { background: #eef1f5; border-radius: 4px; height: .7rem; overflow: hidden; }
.barra-dato .relleno { background: var(--azul); height: 100%; border-radius: 4px; }
.barra-dato .nombre { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- Acceso -------------------------------------------------------------- */
.acceso { max-width: 400px; margin: 8vh auto; }
.acceso .logo { text-align: center; margin-bottom: 1rem; }
.acceso .logo b { display: block; font-size: 1.35rem; color: var(--azul-osc); }

.clave-temporal { font-family: Consolas, monospace; font-size: 1.6rem; letter-spacing: 2px;
                  background: var(--ambar-f); padding: .6rem 1rem; border-radius: 6px; display: inline-block; }
.oculto { display: none !important; }
@media print { .barra, .no-imprimir { display: none !important; } body { background: #fff; } }
.barra-dato meter { width: 100%; height: .8rem; }

/* --- Tomas físicas ------------------------------------------------------- */
.panel-escaneo { border: 2px solid var(--azul); }
.fila-escaneo { display: flex; gap: .5rem; flex-wrap: wrap; }
.campo-escaneo { flex: 1 1 16rem; font-size: 1.4rem !important; padding: .6rem .8rem !important; }
.resultado-lectura { margin: .75rem 0 0; font-size: 1.15rem; font-weight: 600; }
.zona-camara { margin-top: .75rem; }
.zona-camara video { width: 100%; max-width: 480px; border-radius: 8px; background: #000; display: block; margin-bottom: .4rem; }
.contadores-toma meter { width: 100%; margin-top: .4rem; }
.columna-doble { grid-column: span 2; }
@media (max-width: 900px) { .columna-doble { grid-column: auto; } }
.pestanas { display: flex; gap: .25rem; flex-wrap: wrap; border-bottom: 1px solid var(--borde); margin-bottom: .6rem; }
.pestanas a { padding: .45rem .8rem; border-radius: 6px 6px 0 0; color: var(--suave); }
.pestanas a.activa { background: var(--azul-claro); color: var(--azul-osc); font-weight: 600; }
.lista-lecturas { list-style: none; margin: 0; padding: 0; font-size: .9rem; }
.lista-lecturas li { padding: .3rem .4rem; border-left: 4px solid var(--borde); margin-bottom: .25rem; background: #fafbfc; }
.lista-lecturas .lectura-ENCONTRADO { border-color: var(--verde); }
.lista-lecturas .lectura-OTRA_UBICACION { border-color: #e0a000; }
.lista-lecturas .lectura-BAJA, .lista-lecturas .lectura-DESCONOCIDO { border-color: var(--rojo); }
.et.toma-ABIERTA { background: var(--ambar-f); color: var(--ambar); }
.et.toma-CERRADA { background: var(--verde-f); color: var(--verde); }
.et.toma-ANULADA { background: #eef1f5; color: var(--suave); }

/* Barra superior compacta en pantallas medianas */
.escaner input[type=search] { width: 10rem; min-width: 0; }
.chip-centro { max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1440px) { .barra .contenido { font-size: .93rem; } .marca { font-size: 1rem; } }

/* --- Suscripción y cobros ------------------------------------------------ */
.aviso-suscripcion { margin: 0; border-radius: 0; text-align: center; border-width: 0 0 1px; }
.aviso-suscripcion a { margin-left: .5rem; font-weight: 600; }
.cifra-suscripcion { margin: .3rem 0 .6rem; font-size: 1.1rem; }
.cifra-suscripcion .et { font-size: 1rem; padding: .2rem .7rem; }
.planes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6rem; margin-bottom: .8rem; }
@media (max-width: 900px) { .planes { grid-template-columns: 1fr 1fr; } }
.plan { border: 1px solid var(--borde); border-radius: 8px; padding: .7rem; cursor: pointer; display: flex;
        flex-direction: column; gap: .2rem; font-weight: 400; }
.plan:has(input:checked) { border-color: var(--azul); background: var(--azul-claro); }
.plan input { width: auto; }
.plan .precio { font-size: 1.25rem; font-weight: 700; color: var(--azul-osc); }
.tabla-totales { width: 100%; max-width: 560px; }
.tabla-totales td { border: 0; padding: .3rem .4rem; }
.tabla-totales tr.total td { border-top: 2px solid var(--texto); font-weight: 700; font-size: 1.1rem; }
.tabla-totales-doc { margin: 3mm 0 0 auto; max-width: 90mm; }
.instrucciones { white-space: pre-line; background: #f8fafc; border: 1px solid var(--borde); border-radius: 6px; padding: .6rem .8rem; }
.et.cobro-PENDIENTE, .et.pago-EN_REVISION { background: var(--ambar-f); color: var(--ambar); }
.et.cobro-PAGADO, .et.pago-CONFIRMADO { background: var(--verde-f); color: var(--verde); }
.et.cobro-ANULADO, .et.pago-RECHAZADO { background: var(--rojo-f); color: var(--rojo); }
.texto-alerta { color: var(--rojo); }
.pestanas-seccion { margin-bottom: 1rem; }
.zona-peligro { border: 2px solid var(--rojo); }
.en-linea-flex { display: inline-flex; gap: .4rem; }
.en-linea-flex input { width: 22rem; }

.tarjeta-alerta { border-color: #e0a000; background: var(--ambar-f); }

/* Entregas y actas de baja */
.et.doc-BORRADOR { background: var(--ambar-f); color: var(--ambar); }
.et.doc-CONFIRMADA, .et.doc-APROBADA { background: var(--verde-f); color: var(--verde); }
.et.doc-ANULADA { background: var(--rojo-f); color: var(--rojo); }
.et.doc-HISTORICA { background: #eef1f5; color: var(--suave); }
label.casilla { display: inline-flex; gap: .35rem; align-items: center; margin: 0 1.2rem .4rem 0; font-weight: 500; }
fieldset.campo { border: 1px solid var(--borde); border-radius: 6px; padding: .5rem .8rem; }
details.tarjeta > summary { cursor: pointer; }
details.tarjeta[open] > summary { margin-bottom: .8rem; }
