/* =====================================================================
   PAGO AL DÍA · Sistema de diseño plano
   Fondo gris azulado, tarjetas blancas, azul como único acento.
   ===================================================================== */

:root {
    --fondo:        #e8eef7;
    --fondo-2:      #f4f6fb;
    --superficie:   #ffffff;
    --superficie-2: #ffffff;

    --primario:     #2b62f0;
    --primario-2:   #4f81f7;
    --primario-osc: #1743c4;
    --secundario:   #10b981;
    --secundario-2: #34d399;
    --acento:       #f59e0b;
    --peligro:      #ef4444;
    --ok:           #10b981;

    --texto:        #0f172a;
    --texto-suave:  #94a3b8;
    --linea:        #eef1f7;

    --radio-sm: 16px;
    --radio:    22px;
    --radio-lg: 26px;

    --sombra-clay:  0 12px 30px -14px rgba(15, 23, 42, .16);
    --sombra-suave: 0 8px 22px -14px rgba(15, 23, 42, .18);

    --fuente: 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--fuente);
    background: var(--fondo);
    color: var(--texto);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primario); text-decoration: none; }
a:hover { text-decoration: underline; }

/* =====================================================================
   ESTRUCTURA
   ===================================================================== */
.app { display: flex; min-height: 100vh; }

.lateral {
    width: 258px;
    flex: 0 0 258px;
    padding: 24px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    background: var(--superficie);
    box-shadow: 0 0 40px -22px rgba(15, 23, 42, .35);
    z-index: 40;
}

.marca-app {
    display: flex; align-items: center; gap: 11px;
    padding: 2px 8px 24px;
}
.marca-app__icono {
    width: 44px; height: 44px; flex: 0 0 44px;
    display: grid; place-items: center;
    border-radius: 14px;
    background: var(--primario);
    color: #fff; font-weight: 800; font-size: 1.05rem;
    box-shadow: 0 10px 20px -12px rgba(43, 98, 240, .9);
}
.marca-app__txt { line-height: 1.15; min-width: 0; }
.marca-app__txt strong { display: block; font-size: .96rem; font-weight: 800; letter-spacing: -.2px; }
.marca-app__txt small { color: var(--texto-suave); font-size: .66rem; text-transform: uppercase; letter-spacing: 1.1px; font-weight: 700; }

.menu { display: flex; flex-direction: column; gap: 4px; }
.menu__sep {
    font-size: .64rem; font-weight: 800; text-transform: uppercase;
    letter-spacing: 1.2px; color: #b6c0d0;
    padding: 18px 12px 6px;
}
.menu a {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 12px;
    border-radius: 13px;
    color: var(--texto);
    font-weight: 700; font-size: .88rem;
    text-decoration: none;
    transition: background .15s ease, color .15s ease;
}
.menu a i {
    width: 30px; height: 30px; flex: 0 0 30px;
    display: grid; place-items: center;
    border-radius: 9px;
    background: var(--fondo-2);
    color: #7b8aa3;
    font-size: .92rem;
    transition: background .15s ease, color .15s ease;
}
.menu a:hover { background: var(--fondo-2); text-decoration: none; }
.menu a.activo { background: rgba(43, 98, 240, .1); color: var(--primario-osc); }
.menu a.activo i { background: var(--primario); color: #fff; }

.menu__num {
    margin-left: auto;
    min-width: 22px; height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    display: inline-grid; place-items: center;
    background: var(--peligro);
    color: #fff;
    font-size: .68rem; font-weight: 800; line-height: 1;
    letter-spacing: 0;
}

.cuerpo { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.barra {
    display: flex; align-items: center; gap: 14px;
    padding: 26px 30px 8px;
}
.barra h1 { margin: 0; font-size: 1.55rem; font-weight: 800; letter-spacing: -.6px; color: #0d1a2b; }
.barra__sub { color: var(--texto-suave); font-size: .84rem; margin: 3px 0 0; font-weight: 600; }

.barra__der { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.usuario-chip {
    display: flex; align-items: center;
    background: none; padding: 0;
    border-radius: 50%;
}
.usuario-chip__ini {
    width: 44px; height: 44px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--primario);
    color: #fff; font-weight: 800; font-size: .9rem;
    box-shadow: 0 10px 20px -12px rgba(43, 98, 240, .9);
}
.usuario-chip__txt { display: none; }

.contenido { padding: 14px 30px 46px; }

/* =====================================================================
   TARJETAS
   ===================================================================== */
.clay {
    background: var(--superficie);
    border-radius: var(--radio-lg);
    box-shadow: var(--sombra-clay);
}
.clay-cab {
    display: flex; align-items: center; gap: 12px;
    padding: 20px 22px 0;
    flex-wrap: wrap;
}
.clay-cab h2 {
    margin: 0; font-size: 1rem; font-weight: 800; letter-spacing: -.2px;
    display: flex; align-items: center; gap: 9px;
}
.clay-cab h2 i { color: var(--primario); }
.clay-cab .der { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.clay-cuerpo { padding: 16px 22px 22px; }

/* Sección con título pequeño y "Ver todo" */
.seccion-titulo {
    display: flex; align-items: center;
    margin: 26px 0 12px;
}
.seccion-titulo span {
    font-size: .68rem; font-weight: 800; text-transform: uppercase;
    letter-spacing: 1.3px; color: #a7b2c4;
}
.seccion-titulo a { margin-left: auto; font-size: .78rem; font-weight: 800; color: var(--primario); }

/* =====================================================================
   KPI
   ===================================================================== */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }

.kpi {
    background: var(--superficie);
    border-radius: var(--radio);
    padding: 18px;
    box-shadow: var(--sombra-suave);
    display: flex; gap: 13px; align-items: center;
    position: relative; overflow: hidden;
}
.kpi__icono {
    width: 46px; height: 46px; flex: 0 0 46px;
    border-radius: 14px;
    display: grid; place-items: center;
    font-size: 1.15rem; color: #fff;
    background: var(--primario);
}
.kpi--verde .kpi__icono    { background: #10b981; }
.kpi--amarillo .kpi__icono { background: #f59e0b; }
.kpi--rojo .kpi__icono     { background: #ef4444; }

.kpi__valor { font-size: 1.35rem; font-weight: 800; letter-spacing: -.5px; line-height: 1.15; }
.kpi__nombre { color: var(--texto-suave); font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .9px; }
.kpi__extra { font-size: .74rem; color: var(--texto-suave); margin-top: 2px; font-weight: 600; }

/* Tarjeta protagonista azul */
.kpi--hero {
    grid-column: 1 / -1;
    display: block;
    padding: 22px 24px;
    border-radius: var(--radio-lg);
    background: linear-gradient(135deg, #4f81f7 0%, #2b62f0 45%, #1743c4 100%);
    color: #fff;
    box-shadow: 0 20px 34px -18px rgba(23, 67, 196, .75);
}
.kpi--hero .kpi__nombre { color: rgba(255, 255, 255, .78); }
.kpi--hero .kpi__valor { font-size: 2rem; margin-top: 2px; }
.kpi--hero .kpi__extra { color: rgba(255, 255, 255, .8); }

.kpi--hero__fila {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
.kpi--hero__porc {
    display: flex; flex-direction: column; align-items: flex-end; gap: 2px;
    font-size: .78rem; font-weight: 800; color: rgba(255, 255, 255, .9);
}
.kpi--hero__porc i { font-size: 1.15rem; }
.kpi--hero__barra {
    height: 6px; border-radius: 999px;
    background: rgba(255, 255, 255, .3);
    margin-top: 14px; overflow: hidden;
}
.kpi--hero__barra span {
    display: block; height: 100%; border-radius: 999px;
    background: #fff;
}

/* =====================================================================
   BOTONES
   ===================================================================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 18px;
    border: none; border-radius: 14px;
    font-family: var(--fuente); font-size: .87rem; font-weight: 800;
    cursor: pointer; text-decoration: none;
    transition: filter .15s ease, transform .15s ease;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; filter: brightness(1.04); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

.btn--primario {
    background: var(--primario);
    color: #fff;
    box-shadow: 0 12px 22px -14px rgba(43, 98, 240, .95);
}
.btn--verde {
    background: #10b981;
    color: #fff;
    box-shadow: 0 12px 22px -14px rgba(16, 185, 129, .9);
}
.btn--peligro {
    background: #ef4444;
    color: #fff;
    box-shadow: 0 12px 22px -14px rgba(239, 68, 68, .9);
}
.btn--claro {
    background: var(--fondo-2);
    color: #4b5b73;
    box-shadow: none;
}
.btn--claro:hover { background: #eaeef7; }
.btn--mini { padding: 7px 12px; font-size: .76rem; border-radius: 11px; }
.btn--icono { padding: 8px; width: 36px; height: 36px; border-radius: 12px; }

/* =====================================================================
   FORMULARIOS
   ===================================================================== */
.campo { margin-bottom: 15px; }
.etiqueta {
    display: block; margin-bottom: 6px;
    font-size: .7rem; font-weight: 800; text-transform: uppercase;
    letter-spacing: .9px; color: var(--texto-suave);
}
.input, .select, .textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid transparent;
    border-radius: 14px;
    background: var(--fondo-2);
    font-family: var(--fuente); font-size: .92rem; color: var(--texto);
    box-shadow: none;
    transition: border-color .15s ease, background .15s ease;
}
.input::placeholder, .textarea::placeholder { color: #b3bdcb; }
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    background: #fff;
    border-color: var(--primario);
    box-shadow: 0 0 0 4px rgba(43, 98, 240, .12);
}
.textarea { resize: vertical; min-height: 84px; }
.ayuda { font-size: .74rem; color: var(--texto-suave); margin-top: 5px; font-weight: 600; }

.fila-form { display: grid; gap: 0 16px; }

/* =====================================================================
   TABLAS
   ===================================================================== */
.tabla-caja { overflow-x: auto; border-radius: var(--radio); }
.tabla { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tabla th {
    text-align: left; padding: 10px 12px;
    font-size: .66rem; font-weight: 800; text-transform: uppercase;
    letter-spacing: 1px; color: var(--texto-suave);
    border-bottom: 1px solid var(--linea);
    white-space: nowrap;
}
.tabla td { padding: 13px 12px; border-bottom: 1px solid var(--linea); vertical-align: middle; }
.tabla tbody tr:last-child td { border-bottom: none; }
.tabla tbody tr:hover { background: #fafbfd; }
.tabla .num { text-align: right; font-variant-numeric: tabular-nums; }

/* =====================================================================
   PASTILLAS
   ===================================================================== */
.pastilla {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 11px; border-radius: 999px;
    font-size: .7rem; font-weight: 800; letter-spacing: .2px;
    background: var(--fondo-2); color: #64748b;
}
.pastilla--ok      { background: #e3f8ef; color: #0f8a63; }
.pastilla--alerta  { background: #fff3d6; color: #9a6a08; }
.pastilla--rojo    { background: #ffe4ea; color: #a91b41; }
.pastilla--info    { background: #e2f1ff; color: #1657a0; }
.pastilla--gris    { background: #eef1f7; color: #64748b; }

/* =====================================================================
   AVISOS
   ===================================================================== */
.aviso {
    display: flex; align-items: flex-start; gap: 11px;
    padding: 13px 16px; border-radius: var(--radio-sm);
    font-size: .86rem; font-weight: 700;
    margin-bottom: 16px;
}
.aviso i { font-size: 1.05rem; margin-top: 1px; }
.aviso--ok    { background: #e3f8ef; color: #0f8a63; }
.aviso--error { background: #ffe4ea; color: #a91b41; }
.aviso--info  { background: #e2f1ff; color: #1657a0; }

/* =====================================================================
   LISTA DE ALERTAS (stock bajo)
   ===================================================================== */
.alerta-stock {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 4px;
    border-bottom: 1px solid var(--linea);
}
.alerta-stock:last-child { border-bottom: none; }
.alerta-stock__barra {
    width: 5px; height: 34px; border-radius: 4px;
    background: var(--peligro);
    flex: 0 0 5px;
}
.alerta-stock--medio .alerta-stock__barra { background: var(--acento); }
.alerta-stock__txt { flex: 1; min-width: 0; }
.alerta-stock__txt strong { display: block; font-size: .88rem; font-weight: 800; }
.alerta-stock__txt small { color: var(--texto-suave); font-size: .76rem; }
.alerta-stock__cant {
    font-weight: 800; font-size: .9rem; color: var(--peligro);
    font-variant-numeric: tabular-nums;
}
.alerta-stock--medio .alerta-stock__cant { color: #9a6a08; }

/* =====================================================================
   ESTADOS VACÍOS
   ===================================================================== */
.vacio { text-align: center; padding: 40px 20px; color: var(--texto-suave); }
.vacio i { font-size: 2.2rem; display: block; margin-bottom: 10px; opacity: .55; }

/* =====================================================================
   MODAL
   ===================================================================== */
.modal-content.clay-modal {
    background: var(--superficie);
    border: none;
    border-radius: var(--radio-lg);
    box-shadow: 0 30px 60px -20px rgba(15, 23, 42, .4);
}
.modal-header, .modal-footer { border: none; padding: 20px 24px; }
.modal-header { padding-bottom: 4px; }
.modal-footer { padding-top: 0; }
.modal-title { font-weight: 800; font-size: 1.05rem; }
.modal-body { padding: 16px 24px; }

/* =====================================================================
   ACCESO (login)
   ===================================================================== */
.acceso {
    min-height: 100vh;
    display: grid; place-items: center;
    padding: 24px;
    background: var(--fondo);
}
.acceso__caja {
    width: 100%; max-width: 410px;
    background: var(--superficie);
    border-radius: 30px;
    padding: 34px 30px 28px;
    box-shadow: 0 26px 50px -26px rgba(15, 23, 42, .35);
}
.acceso__marca {
    width: 74px; height: 74px; margin: 0 auto 18px;
    border-radius: 22px;
    display: grid; place-items: center;
    background: var(--primario);
    color: #fff; font-size: 1.7rem; font-weight: 800;
    box-shadow: 0 18px 30px -16px rgba(43, 98, 240, .95);
}
.acceso h1 { text-align: center; font-size: 1.32rem; font-weight: 800; margin: 0 0 4px; letter-spacing: -.4px; }
.acceso__lema { text-align: center; color: var(--texto-suave); font-size: .84rem; margin: 0 0 24px; font-weight: 600; }
.acceso__pie { text-align: center; color: var(--texto-suave); font-size: .72rem; margin: 22px 0 0; }

/* =====================================================================
   MODAL PROPIO (sin framework)
   ===================================================================== */
.overlay {
    position: fixed; inset: 0; z-index: 90;
    background: rgba(15, 23, 42, .45);
    backdrop-filter: blur(2px);
    display: none; place-items: center;
    padding: 20px;
    overflow-y: auto;
}
.overlay.abierto { display: grid; }
.dialogo {
    width: 100%; max-width: 560px;
    background: var(--superficie);
    border-radius: var(--radio-lg);
    box-shadow: 0 34px 70px -24px rgba(15, 23, 42, .45);
    animation: entra .18s ease;
    margin: auto;
}
@keyframes entra { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.dialogo__cab {
    display: flex; align-items: center; gap: 10px;
    padding: 20px 24px 6px;
}
.dialogo__cab h3 { margin: 0; font-size: 1.05rem; font-weight: 800; flex: 1; }
.dialogo__cerrar {
    border: none; background: var(--fondo-2); color: #7b8aa3;
    width: 32px; height: 32px; border-radius: 10px; cursor: pointer;
    font-size: 1rem; line-height: 1;
}
.dialogo__cuerpo { padding: 12px 24px 6px; }
.dialogo__pie {
    display: flex; gap: 10px; justify-content: flex-end;
    padding: 16px 24px 22px; flex-wrap: wrap;
}

/* =====================================================================
   AVISOS FLOTANTES (toast)
   ===================================================================== */
.toasts {
    position: fixed; right: 18px; bottom: 96px; z-index: 120;
    display: flex; flex-direction: column; gap: 10px;
    max-width: min(360px, calc(100vw - 36px));
}
.toast-item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 13px 16px;
    border-radius: var(--radio-sm);
    background: var(--superficie);
    box-shadow: 0 18px 34px -14px rgba(15, 23, 42, .35);
    font-size: .86rem; font-weight: 700;
    animation: sube .2s ease;
}
@keyframes sube { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.toast-item--ok    { border-left: 4px solid var(--ok); }
.toast-item--error { border-left: 4px solid var(--peligro); }
.toast-item i { font-size: 1.05rem; margin-top: 1px; }
.toast-item--ok i    { color: var(--ok); }
.toast-item--error i { color: var(--peligro); }

/* =====================================================================
   BARRA INFERIOR (móvil) + BOTÓN FLOTANTE
   ===================================================================== */
.nav-inferior {
    position: fixed;
    left: 12px; right: 12px; bottom: 12px;
    z-index: 60;
    display: none;
    align-items: center;
    justify-content: space-around;
    height: 64px;
    padding: 0 6px;
    background: var(--superficie);
    border-radius: 22px;
    box-shadow: 0 18px 34px -14px rgba(15, 23, 42, .35);
}

.nav-inferior a {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 6px 12px;
    color: #a7b2c4;
    font-size: .62rem; font-weight: 800;
    text-decoration: none;
    position: relative;
}
.nav-inferior a i { font-size: 1.18rem; }
.nav-inferior a.activo { color: var(--primario); }
.nav-inferior a.activo::after {
    content: "";
    width: 4px; height: 4px; border-radius: 50%;
    background: var(--primario);
    position: absolute; bottom: -1px; left: 50%; transform: translateX(-50%);
}

.nav-inferior .hueco { width: 62px; flex: 0 0 62px; }

.fab {
    position: fixed;
    left: 50%; transform: translateX(-50%);
    bottom: 46px;
    z-index: 61;
    width: 58px; height: 58px;
    border: none; border-radius: 50%;
    display: none; place-items: center;
    background: var(--primario);
    color: #fff; font-size: 1.35rem;
    box-shadow: 0 16px 28px -12px rgba(43, 98, 240, .95);
    cursor: pointer;
}

/* =====================================================================
   RESPONSIVE
   ===================================================================== */
.btn-menu { display: none; }

@media (max-width: 991.98px) {
    .lateral {
        position: fixed; left: 0; top: 0;
        transform: translateX(-105%);
        transition: transform .24s ease;
        border-radius: 0 22px 22px 0;
        box-shadow: 0 0 60px -18px rgba(15, 23, 42, .45);
    }
    .lateral.abierto { transform: translateX(0); }
    .cuerpo { width: 100%; }
    .btn-menu { display: inline-flex; }
    .barra { padding: 18px 18px 4px; }
    .barra h1 { font-size: 1.35rem; }
    .contenido { padding: 10px 18px 108px; }
    .usuario-chip__txt { display: none; }
    .usuario-chip { display: none; }

    .nav-inferior { display: flex; }
    .fab { display: grid; }

    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .kpi { padding: 14px; border-radius: 18px; }
    .kpi__icono { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 12px; font-size: 1rem; }
    .kpi__valor { font-size: 1.05rem; }
    .kpi__nombre { font-size: .62rem; }

    .velo-menu {
        position: fixed; inset: 0; background: rgba(15, 23, 42, .4);
        opacity: 0; pointer-events: none; transition: opacity .24s ease; z-index: 30;
    }
    .velo-menu.visible { opacity: 1; pointer-events: auto; }
}

@media (min-width: 992px) {
    .velo-menu { display: none; }
    .nav-inferior { display: none; }
    .fab { display: none; }
}
