/* =========================================================
   Control de Papeleria e Inventario - Nexen E-Logistics
   Paleta institucional: azul marino #0B2C6B / rojo #F5333F
   Layout: menu lateral vertical + barra superior
   ========================================================= */

:root {
    --azul:        #0b2c6b;
    --azul-oscuro: #061a41;
    --azul-claro:  #1b4396;
    --rojo:        #f5333f;
    --rojo-oscuro: #d31f2b;
    --gris-fondo:  #f4f6fa;
    --gris-borde:  #dde3ee;
    --texto:       #1b2436;
    --texto-suave: #667089;
    --verde:       #0f8a4d;
    --ambar:       #b7791f;
    --lateral-ancho: 252px;
    --radio:       10px;
    --sombra:      0 1px 3px rgba(11, 44, 107, .08), 0 6px 20px rgba(11, 44, 107, .06);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--gris-fondo);
    color: var(--texto);
    font-size: 15px;
}

a { color: var(--azul-claro); text-decoration: none; }
a:hover { text-decoration: underline; }

/* =========================================================
   LOGIN
   ========================================================= */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--azul-oscuro), var(--azul) 55%, #123a86);
    padding: 24px;
}

.login-caja {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 14px;
    padding: 34px 32px 28px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, .3);
}

.login-caja .logo { display: block; margin: 0 auto 6px; max-width: 190px; }
.login-caja h1 { font-size: 17px; text-align: center; color: var(--azul); margin: 4px 0 2px; }
.login-caja p.sub { text-align: center; color: var(--texto-suave); font-size: 13px; margin: 0 0 22px; }
.login-pie { text-align: center; font-size: 12px; color: var(--texto-suave); margin-top: 18px; }

/* =========================================================
   MENU LATERAL
   ========================================================= */
.lateral {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--lateral-ancho);
    background: linear-gradient(180deg, var(--azul) 0%, var(--azul-oscuro) 100%);
    display: flex;
    flex-direction: column;
    z-index: 40;
    transition: transform .22s ease;
}

.lateral-marca {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 18px 18px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
}
.lateral-marca img {
    height: 40px;
    background: #fff;
    border-radius: 8px;
    padding: 5px 8px;
    flex-shrink: 0;
}
.lateral-titulo {
    color: #fff;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.35;
}
.lateral-titulo span { color: #9db4e4; font-weight: 500; }

.lateral-nav { flex: 1; overflow-y: auto; padding: 14px 12px; }

.lateral-nav .grupo {
    color: #7f97cd;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 12px 12px 7px;
    font-weight: 600;
}

.lateral-nav .item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    margin-bottom: 3px;
    border-radius: 8px;
    color: #d6e0f5;
    font-size: 14.5px;
    text-decoration: none;
    position: relative;
    transition: background .15s, color .15s;
}
.lateral-nav .item svg { width: 19px; height: 19px; flex-shrink: 0; opacity: .9; }
.lateral-nav .item:hover { background: rgba(255, 255, 255, .1); color: #fff; text-decoration: none; }
.lateral-nav .item.activo { background: var(--rojo); color: #fff; font-weight: 600; box-shadow: 0 4px 12px rgba(245, 51, 63, .35); }
.lateral-nav .item.activo svg { opacity: 1; }

.lateral-pie {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-top: 1px solid rgba(255, 255, 255, .12);
    background: rgba(0, 0, 0, .16);
}
.lateral-pie .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--rojo);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13.5px;
    flex-shrink: 0;
}
.lateral-pie .datos { flex: 1; min-width: 0; }
.lateral-pie .nombre {
    color: #fff;
    font-size: 13.5px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lateral-pie .rol { color: #9db4e4; font-size: 12px; }
.lateral-pie .salir {
    color: #d6e0f5;
    border: 1px solid rgba(255, 255, 255, .3);
    border-radius: 8px;
    padding: 6px;
    display: flex;
    flex-shrink: 0;
}
.lateral-pie .salir svg { width: 18px; height: 18px; }
.lateral-pie .salir:hover { background: var(--rojo); border-color: var(--rojo); color: #fff; }

/* Velo para moviles */
.velo {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(6, 26, 65, .5);
    z-index: 35;
}

/* =========================================================
   AREA DE CONTENIDO
   ========================================================= */
.area {
    margin-left: var(--lateral-ancho);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: #fff;
    border-bottom: 1px solid var(--gris-borde);
    padding: 0 26px;
    height: 58px;
    display: flex;
    align-items: center;
    gap: 14px;
    position: sticky;
    top: 0;
    z-index: 30;
}
.topbar h1 { font-size: 17px; margin: 0; color: var(--azul); font-weight: 600; }
.topbar-info { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 12.5px; color: var(--texto-suave); }
.topbar-info .empresa { font-weight: 600; color: var(--azul); }

.hamburguesa {
    display: none;
    background: none;
    border: 1px solid var(--gris-borde);
    border-radius: 8px;
    padding: 6px;
    cursor: pointer;
    color: var(--azul);
}
.hamburguesa svg { width: 20px; height: 20px; display: block; }

.contenedor {
    width: 100%;
    max-width: 1200px;
    margin: 24px auto 40px;
    padding: 0 26px;
    flex: 1;
}

.titulo-pagina {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.titulo-pagina h2 { margin: 0; font-size: 21px; color: var(--azul); }
.titulo-pagina .desc { color: var(--texto-suave); font-size: 13px; margin-top: 3px; }

/* =========================================================
   TARJETAS Y PANELES
   ========================================================= */
.tarjetas { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 26px; }
.tarjeta {
    background: #fff;
    border-radius: var(--radio);
    padding: 18px 20px;
    box-shadow: var(--sombra);
    border-left: 4px solid var(--azul);
}
.tarjeta.rojo  { border-left-color: var(--rojo); }
.tarjeta.verde { border-left-color: var(--verde); }
.tarjeta.ambar { border-left-color: var(--ambar); }
.tarjeta .etiqueta { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--texto-suave); }
.tarjeta .valor { font-size: 27px; font-weight: 700; color: var(--azul); margin-top: 6px; }
.tarjeta.rojo .valor { color: var(--rojo); }

.panel {
    background: #fff;
    border-radius: var(--radio);
    box-shadow: var(--sombra);
    padding: 20px 22px;
    margin-bottom: 22px;
}
.panel h3 { margin: 0 0 14px; font-size: 16px; color: var(--azul); }

/* =========================================================
   TABLAS
   ========================================================= */
.tabla-scroll { overflow-x: auto; }
table.tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tabla th {
    background: #eef2fa;
    color: var(--azul);
    text-align: left;
    padding: 10px 12px;
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: .4px;
    border-bottom: 2px solid var(--gris-borde);
    white-space: nowrap;
}
table.tabla td { padding: 10px 12px; border-bottom: 1px solid #eef1f7; }
table.tabla tbody tr:hover { background: #f8faff; }
.num { text-align: right; }
.vacio { text-align: center; color: var(--texto-suave); padding: 26px; }

/* ---------- Etiquetas de estado ---------- */
.pill { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.pill.ok    { background: #e3f6ec; color: var(--verde); }
.pill.bajo  { background: #fdeaec; color: var(--rojo-oscuro); }
.pill.medio { background: #fdf3e0; color: var(--ambar); }
.pill.gris  { background: #eceff5; color: var(--texto-suave); }
.pill.azul  { background: #e6ecfa; color: var(--azul); }

/* Bloque de datos de solo lectura (detalle de una compra) */
.dato { display: flex; flex-direction: column; gap: 3px; }
.dato b { color: var(--azul); font-size: 15px; }

/* =========================================================
   FORMULARIOS
   ========================================================= */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.campo { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.campo label { font-size: 13px; font-weight: 600; color: #3b4763; }
.campo small { color: var(--texto-suave); font-size: 12px; }
input[type=text], input[type=password], input[type=number], input[type=email],
input[type=date], select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gris-borde);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: var(--texto);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--azul-claro);
    box-shadow: 0 0 0 3px rgba(27, 67, 150, .12);
}
textarea { resize: vertical; min-height: 74px; }

/* ---------- Botones ---------- */
.btn {
    display: inline-block;
    background: var(--azul);
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
}
.btn:hover { background: var(--azul-claro); text-decoration: none; color: #fff; }
.btn.rojo { background: var(--rojo); }
.btn.rojo:hover { background: var(--rojo-oscuro); }
.btn.verde { background: var(--verde); }
.btn.verde:hover { background: #0c7040; }
.btn.ambar { background: #f0f4fb; color: var(--ambar); border: 1px solid #e6d3ac; }
.btn.ambar:hover { background: #fdf3e0; color: var(--ambar); }
.btn.gris { background: #e6eaf3; color: #43506e; }
.btn.gris:hover { background: #d8deec; color: #43506e; }
.btn.bloque { width: 100%; text-align: center; padding: 12px; }
.btn-mini { padding: 5px 10px; font-size: 12.5px; border-radius: 6px; white-space: nowrap; }

.acciones { display: flex; gap: 6px; flex-wrap: wrap; }

/* Acciones dentro de una tabla: compactas, pero SIEMPRE visibles.
   Si no caben en una linea se acomodan en dos; nunca se recortan. */
.tabla .acciones { gap: 4px; flex-wrap: wrap; row-gap: 4px; }
.tabla .acciones .btn-mini { padding: 4px 8px; font-size: 12px; white-space: nowrap; }
.tabla td { vertical-align: middle; }

/* La columna de acciones se queda fija a la derecha al desplazar la tabla */
.tabla-acciones th:last-child,
.tabla-acciones td:last-child {
    position: sticky;
    right: 0;
    background: #fff;
    box-shadow: -8px 0 8px -8px rgba(11, 44, 107, .25);
    min-width: 250px;                 /* espacio para que quepan los botones */
}
.tabla-acciones th:last-child { background: #eef2fa; z-index: 2; }
.tabla-acciones tr:hover td:last-child { background: #f7f9fe; }

/* En pantallas chicas la columna deja de ser fija: los botones bajan
   a dos renglones y se ven completos sin tapar el resto de la fila. */
@media (max-width: 900px) {
    .tabla-acciones th:last-child,
    .tabla-acciones td:last-child { position: static; box-shadow: none; min-width: 0; }
}

/* ---------- Filtros ---------- */
.filtros { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filtros .campo { margin-bottom: 0; min-width: 170px; }

/* ---------- Alertas ---------- */
.alerta {
    padding: 11px 15px;
    border-radius: 8px;
    margin-bottom: 14px;
    font-size: 14px;
    border-left: 4px solid;
}
.alerta-ok    { background: #e8f7ef; border-color: var(--verde); color: #11603a; }
.alerta-error { background: #fdecee; border-color: var(--rojo); color: #9b1c24; }
.alerta-info  { background: #eaf1fd; border-color: var(--azul-claro); color: #17356f; }

/* ---------- Paginacion ---------- */
.paginacion { display: flex; gap: 6px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.paginacion a, .paginacion span {
    padding: 7px 12px;
    border-radius: 7px;
    background: #fff;
    border: 1px solid var(--gris-borde);
    font-size: 13px;
    color: var(--azul);
}
.paginacion span.actual { background: var(--azul); color: #fff; border-color: var(--azul); font-weight: 600; }

/* ---------- Pie ---------- */
.pie { text-align: center; color: var(--texto-suave); font-size: 12.5px; padding: 16px 0 28px; }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 980px) {
    .lateral { transform: translateX(-100%); box-shadow: 0 0 40px rgba(0, 0, 0, .35); }
    .area { margin-left: 0; }
    .hamburguesa { display: block; }
    body.menu-abierto .lateral { transform: translateX(0); }
    body.menu-abierto .velo { display: block; }
    .topbar-info .empresa { display: none; }
    .contenedor { padding: 0 16px; }
    .titulo-pagina { flex-direction: column; align-items: flex-start; }
}

/* =========================================================
   IMPRESION
   ========================================================= */
@media print {
    .lateral, .topbar, .velo, .filtros, .acciones, .btn, .paginacion { display: none !important; }
    .area { margin-left: 0; }
    body { background: #fff; }
    .panel, .tarjeta { box-shadow: none; border: 1px solid #ccc; }
}

/* =========================================================
   ESCANER DE CODIGO DE BARRAS
   ========================================================= */
.panel.escaner { border-top: 3px solid var(--rojo); }
.panel.escaner input[type=text] { font-size: 16px; letter-spacing: .5px; }
.panel.escaner input#codigo_externo,
.panel.escaner input#escaneo {
    background: #fffdf5;
    border-color: #f0c36d;
    font-weight: 600;
}
.panel.escaner input[readonly] { background: #f3f5fa; color: var(--azul); font-weight: 700; }

.campo label.check {
    display: flex;
    align-items: center;
    gap: 7px;
    font-weight: 500;
    font-size: 13px;
    color: var(--texto-suave);
    cursor: pointer;
}
.campo label.check input { width: auto; }

/* =========================================================
   ETIQUETAS IMPRIMIBLES
   ========================================================= */
.hoja-etiquetas {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 10px;
}
.etiqueta-imp {
    background: #fff;
    border: 1px dashed #b9c3d8;
    border-radius: 6px;
    padding: 10px 12px;
    text-align: center;
    page-break-inside: avoid;
}
.etiqueta-imp .et-empresa { font-size: 9.5px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--azul); font-weight: 700; }
.etiqueta-imp .et-nombre  { font-size: 12.5px; font-weight: 600; margin: 3px 0 6px; line-height: 1.25; }
.etiqueta-imp .et-barras svg { max-width: 100%; height: auto; }
.etiqueta-imp .et-codigo  { font-family: "Consolas", monospace; font-size: 13px; font-weight: 700; letter-spacing: 1.5px; margin-top: 2px; }
.etiqueta-imp .et-datos   { font-size: 10.5px; color: var(--texto-suave); margin-top: 3px; }
.etiqueta-imp .et-externo { font-size: 9.5px; color: #9aa4bb; margin-top: 1px; }

@media print {
    .no-print { display: none !important; }
    .hoja-etiquetas { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .etiqueta-imp { border: 1px solid #ddd; }
}

/* =========================================================
   CAMPO DE CONTRASENA CON OJO (mostrar / ocultar)
   ========================================================= */
.campo-clave { position: relative; display: block; }
.campo-clave input { padding-right: 44px; }
.campo-clave .ojo {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 7px;
    color: var(--texto-suave);
    cursor: pointer;
    padding: 0;
}
.campo-clave .ojo svg { width: 19px; height: 19px; }
.campo-clave .ojo:hover { background: #eef2fa; color: var(--azul); }
.campo-clave .ojo.activo { color: var(--rojo); }
/* Linea diagonal cuando la contrasena esta visible */
.campo-clave .ojo.activo::after {
    content: "";
    position: absolute;
    width: 21px;
    height: 2px;
    background: currentColor;
    transform: rotate(-45deg);
    border-radius: 2px;
}
/* Oculta el ojo nativo de Edge para no duplicarlo */
input::-ms-reveal, input::-ms-clear { display: none; }

/* =========================================================
   FIRMAS DEL VALE DE SOLICITUD (solo al imprimir)
   ========================================================= */
.firma-vale { display: none; }

@media print {
    .firma-vale {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 26px;
        margin-top: 60px;
        text-align: center;
        font-size: 11.5px;
    }
    .firma-vale span {
        display: block;
        border-top: 1px solid #333;
        margin-bottom: 6px;
    }
    .firma-vale small { color: #555; }
}

/* =========================================================
   BUSCADOR DE ARTICULOS (autocompletado)
   ========================================================= */
.campo.buscador { position: relative; }
.campo.buscador .resultados {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 25;
    background: #fff;
    border: 1px solid var(--gris-borde);
    border-radius: 8px;
    box-shadow: 0 10px 26px rgba(11, 44, 107, .16);
    max-height: 280px;
    overflow-y: auto;
    margin-top: 3px;
}
.campo.buscador .opcion {
    padding: 9px 12px;
    font-size: 13.5px;
    cursor: pointer;
    display: flex;
    gap: 8px;
    align-items: baseline;
    border-bottom: 1px solid #f1f4fa;
}
.campo.buscador .opcion:last-child { border-bottom: none; }
.campo.buscador .opcion b { color: var(--azul); font-family: "Consolas", monospace; }
.campo.buscador .opcion .dispo { margin-left: auto; color: var(--texto-suave); font-size: 12px; white-space: nowrap; }
.campo.buscador .opcion:hover,
.campo.buscador .opcion.marcada { background: #eef2fa; }
.campo.buscador .opcion.vacia { color: var(--texto-suave); cursor: default; }

/* =========================================================
   PESTANAS (solicitudes por estado)
   ========================================================= */
.pestanas {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--gris-borde);
    padding-bottom: 0;
}
.pestanas .pestana {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 9px 9px 0 0;
    background: #eef2fa;
    color: #46577d;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
    border-bottom: none;
    margin-bottom: -2px;
}
.pestanas .pestana:hover { background: #e2e9f7; color: var(--azul); text-decoration: none; }
.pestanas .pestana .cuenta {
    background: rgba(11, 44, 107, .12);
    color: inherit;
    border-radius: 20px;
    padding: 1px 9px;
    font-size: 12px;
    font-weight: 700;
    min-width: 24px;
    text-align: center;
}
.pestanas .pestana.activa {
    background: #fff;
    color: var(--azul);
    border-color: var(--gris-borde);
    border-bottom: 2px solid #fff;
    box-shadow: 0 -2px 0 var(--rojo) inset, 0 -3px 0 var(--rojo);
}
.pestanas .pestana.activa .cuenta { background: var(--rojo); color: #fff; }
.pestanas .pestana.pendiente.activa   { box-shadow: 0 -3px 0 var(--ambar); }
.pestanas .pestana.pendiente.activa .cuenta { background: var(--ambar); }
.pestanas .pestana.surtida.activa,
.pestanas .pestana.aprobada.activa    { box-shadow: 0 -3px 0 var(--verde); }
.pestanas .pestana.surtida.activa .cuenta,
.pestanas .pestana.aprobada.activa .cuenta { background: var(--verde); }
/* Historial de movimientos */
.pestanas .pestana.entradas.activa    { box-shadow: 0 -3px 0 var(--verde); }
.pestanas .pestana.entradas.activa .cuenta { background: var(--verde); }
.pestanas .pestana.salidas.activa     { box-shadow: 0 -3px 0 var(--ambar); }
.pestanas .pestana.salidas.activa .cuenta { background: var(--ambar); }

@media (max-width: 720px) {
    .pestanas .pestana { padding: 8px 11px; font-size: 13px; }
}

/* Aviso cuando un catalogo esta vacio */
.aviso-vacio { color: var(--rojo-oscuro); }
.aviso-vacio a { color: var(--rojo-oscuro); text-decoration: underline; }
/* Las ayudas bajo los campos no se recortan */
.campo small { line-height: 1.5; padding-bottom: 1px; }

/* =========================================================
   FLUJO DE AUTORIZACION (linea de pasos)
   ========================================================= */
.flujo {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}
.flujo .paso {
    flex: 1 1 190px;
    display: flex;
    align-items: center;
    gap: 11px;
    background: #fff;
    border-radius: var(--radio);
    padding: 13px 16px;
    box-shadow: var(--sombra);
    border-left: 4px solid var(--gris-borde);
}
.flujo .paso .marca {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #eef2fa;
    color: var(--texto-suave);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}
.flujo .paso .etapa { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--texto-suave); }
.flujo .paso .quien { font-size: 14px; font-weight: 600; color: var(--texto); }
.flujo .paso .cuando { font-size: 11.5px; color: var(--texto-suave); }

.flujo .paso.hecho { border-left-color: var(--verde); }
.flujo .paso.hecho .marca { background: var(--verde); color: #fff; }
.flujo .paso.detenido { opacity: .55; }
.flujo .paso.detenido .marca { background: #fdeaec; color: var(--rojo-oscuro); }

/* Pestaña que le toca autorizar al rol actual */
.pestanas .pestana.mia:not(.activa) { box-shadow: 0 -3px 0 var(--rojo) inset; }

@media print { .flujo { display: none; } }

/* Panel del acuse de entrega */
.panel.acuse { border-top: 3px solid var(--verde); }
.etiqueta-imp .et-marca { font-size: 10.5px; color: var(--texto-suave); margin: -3px 0 5px; }

/* =========================================================
   SELECT CON BOTON "+" PARA ALTA RAPIDA
   ========================================================= */
.campo-con-boton { display: flex; gap: 6px; align-items: stretch; }
.campo-con-boton select,
.campo-con-boton input[type="text"] { flex: 1; min-width: 0; }

/* Tarjeta que explica que significa el rol elegido */
.tarjeta-rol {
    display: flex; gap: 10px; align-items: flex-start;
    margin-top: 8px; padding: 9px 11px;
    background: #f4f7fd; border: 1px solid #dbe4f5; border-radius: 8px;
}
.tarjeta-rol b { display: block; font-size: 13px; color: #1f2a44; }
.tarjeta-rol small { display: block; color: #667089; line-height: 1.35; }
.icono-rol {
    font-size: 18px; line-height: 1.2; min-width: 26px; text-align: center;
}

/* Banda del acceso generado (alta de usuarios) */
.banda-acceso {
    background: #f4f7fd; border: 1px solid #dbe4f5; border-radius: 10px;
    padding: 12px 14px; margin: 2px 0 4px;
}
.banda-titulo { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-bottom: 8px; }
.banda-titulo b { font-size: 13.5px; color: #1f2a44; }
.banda-titulo span { font-size: 12.5px; color: #667089; }
.banda-campos { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.banda-campos .campo { flex: 1 1 260px; margin: 0; }
.banda-campos .acciones { margin: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.banda-acceso input[readonly] { background: #fff; font-weight: 600; letter-spacing: .2px; }
.banda-acceso > small { display: block; margin-top: 8px; color: #667089; line-height: 1.4; }

/* A quien le llega la solicitud (pantalla de captura) */
.destino-aviso h3 { margin-top: 0; }
.tarjeta-destino {
    display: flex; gap: 12px; align-items: flex-start;
    background: #f4f7fd; border: 1px solid #dbe4f5; border-radius: 10px;
    padding: 12px 14px; margin-bottom: 8px;
}
.tarjeta-destino b { font-size: 14.5px; color: #1f2a44; }
.dato-destino { font-size: 13px; color: #43506e; margin-top: 4px; }
.dato-destino .etiqueta-dato { display: inline-block; min-width: 54px; }

/* Barra de seleccion de la lista de compras */
.barra-seleccion {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap;
    margin-top: 14px; padding: 10px 14px;
    background: #f4f7fd; border: 1px solid #dbe4f5; border-radius: 8px;
    font-size: 13.5px; color: #43506e;
}
.barra-seleccion b { color: var(--azul); font-size: 15px; }
.tabla tr.marcada > td { background: #f2f8ff; }

/* Barra de avance de la carga masiva */
.barra-avance {
    height: 20px; background: #e8edf7; border-radius: 10px;
    overflow: hidden; border: 1px solid #dbe4f5;
}
.barra-avance > span {
    display: block; height: 100%; width: 0;
    background: linear-gradient(90deg, #2f6fed, #1fbf7a);
    transition: width .18s ease;
}
.avance-texto { margin-top: 6px; font-size: 12.5px; color: #667089; }
.btn-mas {
    flex-shrink: 0;
    width: 40px;
    border: 1px solid var(--gris-borde);
    background: #eef2fa;
    color: var(--azul);
    border-radius: 8px;
    font-size: 20px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.btn-mas:hover { background: var(--azul); color: #fff; border-color: var(--azul); }

/* =========================================================
   VENTANA MODAL
   ========================================================= */
.modal-fondo {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(6, 26, 65, .55);
    z-index: 60;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-fondo.abierto { display: flex; animation: aparecer .15s ease; }

@keyframes aparecer { from { opacity: 0; } to { opacity: 1; } }

.modal {
    background: #fff;
    width: 100%;
    max-width: 440px;
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
    overflow: hidden;
    animation: subir .18s ease;
}

@keyframes subir { from { transform: translateY(14px); } to { transform: translateY(0); } }

.modal-cabeza {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 16px 20px;
    background: var(--azul);
    color: #fff;
}
.modal-cabeza h3 { margin: 0; font-size: 16.5px; color: #fff; }
.modal-cerrar {
    background: none;
    border: none;
    color: #cfd9ef;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}
.modal-cerrar:hover { color: #fff; }

.modal-cuerpo { padding: 20px; font-size: 14.5px; }
.modal-cuerpo .campo { margin-bottom: 0; }

.modal-resumen {
    background: #eef2fa;
    border-radius: 10px;
    padding: 14px 16px;
    margin: 12px 0 14px;
    font-size: 15px;
    line-height: 1.6;
    display: grid;
    grid-template-columns: minmax(74px, max-content) 1fr;
    gap: 8px 16px;
    align-items: baseline;
}
.modal-resumen br { display: none; }
.modal-resumen b { color: var(--azul); word-break: break-word; }
.etiqueta-dato {
    display: inline-block;
    min-width: 74px;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--texto-suave);
}

/* ---------- Solicitud: buscador de articulos ---------- */
.caja-buscar {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}
.caja-buscar .campo { flex: 1; min-width: 220px; margin-bottom: 0; }
.caja-buscar .btn { width: 100%; }

.elegido {
    margin: 12px 0 0;
    padding: 10px 14px;
    border-radius: 9px;
    background: #f2fbf6;
    border: 1px solid #cdebd9;
    font-size: 14px;
}
.elegido.vacio-sel { background: #f6f8fd; border-color: var(--gris-borde); color: var(--texto-suave); }

/* ---------- Vista previa del comprobante ---------- */
.adjunto {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-top: 10px;
    padding: 12px;
    background: #f6f8fd;
    border: 1px solid var(--gris-borde);
    border-radius: 10px;
}
.adjunto-mini {
    width: 76px;
    height: 76px;
    flex: 0 0 76px;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--gris-borde);
    display: flex;
    align-items: center;
    justify-content: center;
}
.adjunto-mini img { width: 100%; height: 100%; object-fit: cover; }
.adjunto-mini.pdf { background: var(--rojo); border-color: var(--rojo); }
.adjunto-mini.pdf span { color: #fff; font-weight: 800; font-size: 18px; letter-spacing: 1px; }
.adjunto-datos { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.adjunto-datos b { color: var(--azul); word-break: break-all; }
.adjunto-datos span { font-size: 12.5px; color: var(--texto-suave); }
.adjunto-datos .acciones { margin-top: 4px; }
.adjunto-estado { font-size: 12px; }
.adjunto.por-revisar { border-color: var(--ambar); background: #fffaf0; }
.adjunto.revisado    { border-color: var(--verde); background: #f2fbf6; }

/* Visor a pantalla grande */
.visor .visor-caja { max-width: 940px; width: 94%; }
.visor-marco {
    background: #2b3550;
    min-height: 340px;
    max-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
}
.visor-marco iframe { width: 100%; height: 70vh; border: 0; background: #fff; }
.visor-marco img { max-width: 100%; max-height: 70vh; display: block; }
.visor-aviso {
    padding: 8px 16px;
    font-size: 12.5px;
    color: var(--texto-suave);
    background: #f6f8fd;
    border-top: 1px solid var(--gris-borde);
}

.modal-pie {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding: 14px 20px;
    background: var(--gris-fondo);
    border-top: 1px solid var(--gris-borde);
}

@media (max-width: 520px) {
    .modal-pie { flex-direction: column-reverse; }
    .modal-pie .btn { width: 100%; text-align: center; }
}
