/* Keep360 web: colores de la marca (Marca/README.md) */
:root {
    --azul: #12263F;
    --azul-2: #1B3A5C;
    --verde: #0D9488;
    --verde-claro: #2DD4BF;
    --gris: #64748B;
    --borde: #D8DEE6;
    --fondo: #F3F5F8;
    --rojo: #B42318;
    --texto: #1E293B;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--fondo);
    color: var(--texto);
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
    font-size: 15px;
}

/* ---- Barra superior ---- */
.encabezado {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 16px;
    background: var(--azul);
    color: #fff;
}

.marca {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    text-decoration: none;
    font-size: 20px;
    font-weight: 700;
}

.marca b { color: var(--verde-claro); }
.marca img { border-radius: 7px; }

.sesion {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    min-width: 0;
}

.sesion .empresa { color: var(--verde-claro); font-weight: 600; }
.sesion form { margin: 0; }

.boton-salir {
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .45);
    border-radius: 6px;
    padding: 5px 10px;
    font: inherit;
    cursor: pointer;
}

.boton-salir:hover { background: rgba(255, 255, 255, .12); }

/* ---- Contenido ---- */
.contenido {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
}

h1 {
    margin: 4px 0 14px;
    font-size: 22px;
    color: var(--azul);
}

.boton {
    background: var(--verde);
    color: #fff;
    border: 0;
    border-radius: 8px;
    padding: 10px 18px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.boton:hover { background: #0B7F75; }

input {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--borde);
    border-radius: 8px;
    font: inherit;
    background: #fff;
    color: var(--texto);
}

input:focus {
    outline: 2px solid var(--verde-claro);
    outline-offset: 0;
    border-color: var(--verde);
}

.error { color: var(--rojo); font-size: 13px; }

/* ---- Login ---- */
.login-fondo {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 16px;
    background: linear-gradient(160deg, var(--azul-2), var(--azul));
}

.login-tarjeta {
    width: 100%;
    max-width: 360px;
    background: #fff;
    border-radius: 14px;
    padding: 28px 24px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .3);
}

.login-logo {
    display: block;
    width: 220px;
    height: auto;
    margin: 0 auto 20px;
}

.login-tarjeta label {
    display: block;
    margin: 12px 0 4px;
    font-weight: 600;
    font-size: 13px;
    color: var(--gris);
}

.login-tarjeta .boton { width: 100%; margin-top: 18px; padding: 12px; }

/* ---- Busqueda ---- */
.busqueda {
    background: #fff;
    border: 1px solid var(--borde);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 12px;
}

.busqueda-principal { display: flex; gap: 8px; }

.filtros { margin-top: 10px; }

.filtros summary {
    cursor: pointer;
    color: var(--verde);
    font-weight: 600;
    font-size: 13px;
}

.filtros-grilla {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.filtros-grilla label { font-size: 12px; color: var(--gris); }
.filtros-grilla input { margin-top: 3px; }

.aviso {
    background: #fff;
    border: 1px dashed var(--borde);
    border-radius: 10px;
    padding: 18px;
    text-align: center;
    color: var(--gris);
}

.aviso.error { border-color: var(--rojo); color: var(--rojo); font-size: 15px; }

.contador { color: var(--gris); font-size: 13px; margin: 0 0 8px; }

/* ---- Grilla de productos (columnas como frmProductosListar) ---- */
.productos {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid var(--borde);
    border-radius: 10px;
    overflow: hidden;
}

.productos th {
    background: var(--azul);
    color: #fff;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    padding: 9px 10px;
    white-space: nowrap;
}

.productos td {
    padding: 8px 10px;
    border-top: 1px solid var(--borde);
    vertical-align: top;
}

.productos tbody tr:nth-child(even) { background: #F8FAFC; }
.productos tbody tr:hover { background: #E6F6F4; }

.productos .num { text-align: right; }
.productos .stock { font-weight: 700; font-variant-numeric: tabular-nums; }
.con-stock { color: var(--verde); }
.sin-stock { color: var(--rojo); }
.productos .barra, .productos .codigo { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---- Celular: cada producto es una tarjeta ---- */
@media (max-width: 720px) {
    .sesion .empresa, .sesion .usuario { display: none; }

    .filtros-grilla { grid-template-columns: 1fr 1fr; }

    .productos, .productos tbody { display: block; background: none; border: 0; }
    .productos thead { display: none; }

    .productos tbody tr,
    .productos tbody tr:nth-child(even) {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "desc   stock"
            "codigo um"
            "flia   flia";
        gap: 2px 12px;
        background: #fff;
        border: 1px solid var(--borde);
        border-radius: 10px;
        padding: 10px 12px;
        margin-bottom: 8px;
    }

    .productos td { border: 0; padding: 0; }
    .productos .descripcion { grid-area: desc; font-weight: 600; }
    .productos .stock { grid-area: stock; font-size: 18px; }
    .productos .codigo { grid-area: codigo; color: var(--gris); font-size: 13px; }
    .productos .um { grid-area: um; color: var(--gris); font-size: 12px; text-align: right; }
    .productos .barra { display: none; }
    .productos .subfamilia { display: none; }
    .productos .familia { grid-area: flia; color: var(--gris); font-size: 12px; }
}

/* ---- Menu principal (mismas secciones que la barra de frmMain) ---- */
.boton-menu { display: none; }

.menu {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 0 16px;
    background: #fff;
    border-bottom: 1px solid var(--borde);
    position: relative;
    z-index: 20;
}

.menu-seccion { position: relative; }

.menu-seccion summary {
    list-style: none;
    padding: 10px 12px 8px;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-weight: 600;
    color: var(--azul);
    user-select: none;
}

.menu-seccion summary::-webkit-details-marker { display: none; }
.menu-seccion summary::after { content: " ▾"; color: var(--gris); font-size: 11px; }
.menu-seccion summary:hover { background: #F1F5F9; }
.menu-seccion summary.activa { border-bottom-color: var(--verde); }
.menu-seccion[open] summary { background: #E6F6F4; }

.menu-desplegable {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 250px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    padding: 6px 0;
    background: #fff;
    border: 1px solid var(--borde);
    border-radius: 0 0 10px 10px;
    box-shadow: 0 10px 30px rgba(18, 38, 63, .18);
}

.menu-seccion:last-child .menu-desplegable { left: auto; right: 0; }

.menu-opcion {
    display: block;
    padding: 7px 16px;
    color: var(--texto);
    text-decoration: none;
    white-space: nowrap;
    border-left: 3px solid transparent;
}

a.menu-opcion:hover { background: #E6F6F4; }
.menu-opcion.activa { color: var(--verde); font-weight: 600; border-left-color: var(--verde); }
.menu-opcion.pronto { color: #A3AEBD; cursor: default; }

.menu-grupo-titulo {
    display: block;
    padding: 8px 16px 3px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--gris);
}

.menu-grupo .menu-opcion { padding-left: 26px; }

.menu-separador { border: 0; border-top: 1px solid var(--borde); margin: 6px 0; }

@media (max-width: 720px) {
    .boton-menu {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 4px;
        width: 38px;
        height: 38px;
        padding: 0 8px;
        background: transparent;
        border: 1px solid rgba(255, 255, 255, .35);
        border-radius: 8px;
        cursor: pointer;
    }

    .boton-menu span { display: block; height: 2px; background: #fff; border-radius: 2px; }
    .encabezado .marca { margin-right: auto; }

    .menu {
        display: none;
        flex-direction: column;
        gap: 0;
        padding: 0;
        max-height: calc(100vh - 56px);
        overflow-y: auto;
        box-shadow: 0 10px 30px rgba(18, 38, 63, .18);
    }

    body.menu-abierto .menu { display: block; }

    .menu-seccion summary { display: flex; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid var(--borde); }
    .menu-seccion summary.activa { border-bottom-color: var(--borde); color: var(--verde); }

    .menu-desplegable {
        position: static;
        max-height: none;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        background: #F8FAFC;
        border-bottom: 1px solid var(--borde);
    }

    .menu-opcion { white-space: normal; padding: 10px 24px; }
    .menu-grupo .menu-opcion { padding-left: 34px; }
    .menu-grupo-titulo { padding: 10px 24px 2px; }
}

/* ---- Inicio ---- */
.accesos { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }

.acceso {
    display: block;
    min-width: 180px;
    padding: 18px 20px;
    background: #fff;
    border: 1px solid var(--borde);
    border-left: 4px solid var(--verde);
    border-radius: 10px;
    color: var(--azul);
    font-weight: 600;
    text-decoration: none;
}

.acceso:hover { background: #E6F6F4; }

.nota { color: var(--gris); font-size: 13px; }
