/* =====================================================
   FarmaNoba — estilos del panel de administración
   Misma paleta que el sitio (#01464c, #e4f4ec, #9fd3bf).
   ===================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --verde: #01464c;
    --verde-oscuro: #01353a;
    --verde-claro: #9fd3bf;
    --fondo: #e4f4ec;
    --blanco: #ffffff;
    --gris: #5b7d74;
    --gris-claro: #8aa39b;
    --borde: #d5e8df;
    --rojo: #b3243c;
    --rojo-fondo: #fdecea;
    --amarillo: #8a6a12;
    --amarillo-fondo: #fdf5dc;
    --sombra: 0 16px 40px rgba(1, 70, 76, .10);
    --radio: 16px;
}

[hidden] {
    display: none !important;
}

body {
    min-height: 100vh;
    background: var(--fondo);
    color: var(--verde);
    font-family: Arial, Helvetica, sans-serif;
    -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
}

/* =====================================================
   Cabecera
   ===================================================== */
.admTop {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px clamp(16px, 4vw, 40px);
    background: var(--verde);
    color: #fff;
    box-shadow: 0 10px 30px rgba(1, 70, 76, .18);
}

.admMarca {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    text-decoration: none;
}

.admMarca__icono {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .14);
    color: var(--verde-claro);
    font-size: 1.05rem;
}

.admMarca strong {
    display: block;
    font-size: 1.05rem;
    letter-spacing: .3px;
}

.admMarca small {
    display: block;
    font-size: .7rem;
    letter-spacing: .45px;
    text-transform: uppercase;
    color: #bfe3d5;
}

.admTop__derecha {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.admVivo {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 10px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 999px;
    color: #bfe3d5;
    font-size: .72rem;
    letter-spacing: .2px;
    white-space: nowrap;
}

.admVivo__punto {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4ade80;
    animation: admLatido 2.2s ease-out infinite;
}

.admVivo--malo {
    color: #ffd7d7;
    border-color: rgba(255, 140, 140, .4);
}

.admVivo--malo .admVivo__punto {
    background: #ff8080;
    animation: none;
}

@keyframes admLatido {
    0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, .5); }
    70% { box-shadow: 0 0 0 6px rgba(74, 222, 128, 0); }
    100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .admVivo__punto {
        animation: none;
    }
}

.admLink {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 10px;
    color: #d9f0e6;
    font-size: .88rem;
    text-decoration: none;
    transition: background .2s ease;
}

.admLink:hover {
    background: rgba(255, 255, 255, .1);
}

.admUsuario {
    font-size: .84rem;
    color: #d9f0e6;
}

/* =====================================================
   Botones
   ===================================================== */
.admBoton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: 0;
    border-radius: 10px;
    background: #eef7f2;
    color: var(--verde);
    font-weight: 700;
    font-size: .88rem;
    transition: transform .15s ease, box-shadow .15s ease, background .2s ease;
}

.admBoton:hover {
    transform: translateY(-1px);
}

.admBoton:disabled {
    opacity: .6;
    cursor: not-allowed;
    transform: none;
}

.admBoton--principal {
    background: var(--verde);
    color: #fff;
    box-shadow: 0 8px 20px rgba(1, 70, 76, .18);
}

.admBoton--principal:hover {
    background: var(--verde-oscuro);
}

.admBoton--fantasma {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, .35);
    color: #fff;
}

.admBoton--fantasma:hover {
    background: rgba(255, 255, 255, .12);
}

.admDialogo .admBoton--fantasma {
    border-color: var(--borde);
    color: var(--verde);
}

.admDialogo .admBoton--fantasma:hover {
    background: #eef7f2;
}

/* =====================================================
   Ingreso
   ===================================================== */
.admLogin {
    display: grid;
    place-items: center;
    min-height: calc(100vh - 72px);
    padding: 34px 18px;
}

.admLogin__caja {
    width: min(100%, 430px);
    padding: 34px;
    border: 1px solid rgba(1, 70, 76, .06);
    border-radius: 22px;
    background: var(--blanco);
    box-shadow: var(--sombra);
}

.admLogin__caja h1 {
    margin-bottom: 8px;
    font-size: 1.5rem;
}

.admLogin__bajada {
    margin-bottom: 22px;
    color: var(--gris);
    font-size: .9rem;
    line-height: 1.5;
}

.admCampo {
    display: block;
    margin-bottom: 14px;
}

.admCampo > span {
    display: block;
    margin-bottom: 6px;
    color: var(--gris);
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .35px;
    text-transform: uppercase;
}

.admCampo input,
.admCampo select,
.admCampo textarea {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--borde);
    border-radius: 10px;
    background: #fbfefc;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.admCampo input:focus,
.admCampo select:focus,
.admCampo textarea:focus {
    border-color: var(--verde-claro);
    box-shadow: 0 0 0 3px rgba(159, 211, 191, .35);
}

.admCampo textarea {
    min-height: 84px;
    resize: vertical;
}

.admHint {
    margin-top: 16px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #eef7f2;
    color: var(--gris);
    font-size: .78rem;
    line-height: 1.5;
}

.admError {
    margin: 6px 0 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--rojo-fondo);
    color: var(--rojo);
    font-size: .84rem;
    font-weight: 700;
}

/* =====================================================
   Panel y pestañas
   ===================================================== */
.admPanel {
    width: min(100%, 1360px);
    margin: 0 auto;
    padding: 24px clamp(14px, 3vw, 34px) 60px;
}

.admTabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 22px;
}

.admTab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 15px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: var(--blanco);
    color: var(--gris);
    font-size: .85rem;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(1, 70, 76, .06);
    transition: color .2s ease, background .2s ease, border-color .2s ease;
}

.admTab:hover {
    border-color: var(--verde-claro);
    color: var(--verde);
}

.admTab.activo {
    border-color: var(--verde);
    background: var(--verde);
    color: #fff;
}

.admSeccion {
    animation: admEntra .25s ease both;
}

@keyframes admEntra {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* =====================================================
   Resumen
   ===================================================== */
.admCards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.admCard {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    border: 1px solid rgba(1, 70, 76, .04);
    border-radius: var(--radio);
    background: var(--blanco);
    box-shadow: 0 8px 24px rgba(1, 70, 76, .07);
}

.admCard__icono {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: #eef7f2;
    color: var(--verde);
    font-size: 1.1rem;
}

.admCard--alerta .admCard__icono {
    background: var(--amarillo-fondo);
    color: var(--amarillo);
}

.admCard--malo .admCard__icono {
    background: var(--rojo-fondo);
    color: var(--rojo);
}

.admCard__valor {
    display: block;
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.1;
}

.admCard__etiqueta {
    display: block;
    margin-top: 3px;
    color: var(--gris);
    font-size: .74rem;
    letter-spacing: .35px;
    text-transform: uppercase;
}

.admDos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
}

.admCaja {
    padding: 20px;
    border-radius: var(--radio);
    background: var(--blanco);
    box-shadow: 0 8px 24px rgba(1, 70, 76, .07);
}

.admCaja h2 {
    margin-bottom: 14px;
    font-size: 1rem;
}

.admLista {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admLista__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 10px;
    background: #f7fbf9;
    font-size: .85rem;
}

.admLista__item small {
    display: block;
    color: var(--gris);
    font-size: .74rem;
}

.admLista__der {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.admVacio {
    padding: 12px 4px;
    color: var(--gris-claro);
    font-size: .85rem;
}

/* =====================================================
   Barra de sección
   ===================================================== */
.admBarra {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.admBarra h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.15rem;
}

.admContador {
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--blanco);
    color: var(--gris);
    font-size: .78rem;
    font-weight: 700;
}

.admBarra__acciones {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.admBuscar {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 240px;
    padding: 8px 12px;
    border: 1px solid var(--borde);
    border-radius: 10px;
    background: var(--blanco);
    color: var(--gris-claro);
}

.admBuscar input {
    width: 100%;
    border: 0;
    background: transparent;
    outline: none;
}

/* =====================================================
   Tablas
   ===================================================== */
.admTablaWrap {
    max-height: calc(100vh - 260px);
    overflow: auto;
    border-radius: var(--radio);
    background: var(--blanco);
    box-shadow: 0 8px 24px rgba(1, 70, 76, .07);
}

.admTabla {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
    font-size: .85rem;
}

.admTabla thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 12px 14px;
    border-bottom: 1px solid var(--borde);
    background: #eef7f2;
    color: var(--verde);
    font-size: .71rem;
    letter-spacing: .4px;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

.admTabla tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid #eef3f0;
    vertical-align: middle;
}

.admTabla tbody tr:hover {
    background: #f8fcfa;
}

.admTabla tbody tr:last-child td {
    border-bottom: 0;
}

.admTabla small {
    color: var(--gris);
    font-size: .75rem;
}

.admNum {
    font-weight: 700;
    white-space: nowrap;
}

.admCargando {
    padding: 18px !important;
    color: var(--gris-claro);
    font-size: .85rem;
    text-align: center;
}

.admProducto {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 220px;
}

.admProducto__foto {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    overflow: hidden;
    border-radius: 10px;
    background: #f2f8f5;
    color: var(--gris-claro);
}

.admProducto__foto img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.admProducto strong {
    display: block;
    font-size: .85rem;
    line-height: 1.25;
}

/* =====================================================
   Etiquetas de estado y acciones
   ===================================================== */
.admBadge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 800;
}

.admBadge--bien {
    background: #e5f4ec;
    color: #0f6b52;
}

.admBadge--alerta {
    background: var(--amarillo-fondo);
    color: var(--amarillo);
}

.admBadge--malo {
    background: var(--rojo-fondo);
    color: var(--rojo);
}

.admBadge--info {
    background: #e8f0fb;
    color: #245a9a;
    text-transform: capitalize;
}

.admAcciones {
    display: flex;
    gap: 6px;
    white-space: nowrap;
}

.admIcono {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--borde);
    border-radius: 9px;
    background: var(--blanco);
    color: var(--verde);
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.admIcono:hover {
    border-color: var(--verde-claro);
    background: #eef7f2;
}

.admIcono--malo {
    color: var(--rojo);
}

.admIcono--malo:hover {
    border-color: #f0c4c4;
    background: var(--rojo-fondo);
}

/* =====================================================
   Diálogo
   ===================================================== */
.admDialogo {
    width: min(94vw, 580px);
    max-height: 90vh;
    padding: 0;
    border: 0;
    border-radius: 18px;
    color: var(--verde);
    box-shadow: 0 30px 80px rgba(1, 70, 76, .3);
}

.admDialogo::backdrop {
    background: rgba(1, 35, 38, .5);
    backdrop-filter: blur(2px);
}

.admDialogo__form {
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    padding: 24px;
    overflow: auto;
}

.admDialogo__form h2 {
    margin-bottom: 16px;
    font-size: 1.25rem;
}

.admDialogo__cuerpo {
    display: flex;
    flex-direction: column;
}

.admDialogo__acciones {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--borde);
}

.admGrid2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 14px;
}

.admDetalle {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.admDetalle__fila {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #e3eee8;
    font-size: .87rem;
}

.admDetalle__fila strong {
    text-align: right;
}

.admDetalle__tabla {
    width: 100%;
    margin: 6px 0;
    border-collapse: collapse;
    font-size: .82rem;
}

.admDetalle__tabla th,
.admDetalle__tabla td {
    padding: 7px 8px;
    border-bottom: 1px solid #eef3f0;
    text-align: left;
}

.admDetalle__tabla th {
    background: #eef7f2;
    font-size: .7rem;
    letter-spacing: .35px;
    text-transform: uppercase;
}

/* =====================================================
   Aviso flotante
   ===================================================== */
.admToast {
    position: fixed;
    left: 50%;
    bottom: 22px;
    z-index: 1000;
    max-width: min(92vw, 560px);
    padding: 12px 20px;
    border-radius: 12px;
    background: var(--verde);
    color: #fff;
    font-size: .88rem;
    font-weight: 700;
    text-align: center;
    box-shadow: 0 16px 40px rgba(1, 70, 76, .3);
    transform: translateX(-50%);
}

.admToast--malo {
    background: var(--rojo);
}

/* =====================================================
   Responsive
   ===================================================== */
@media (max-width: 760px) {
    .admTop {
        flex-direction: column;
        align-items: flex-start;
    }

    .admTop__derecha {
        width: 100%;
        justify-content: space-between;
    }

    .admLogin__caja {
        padding: 26px 22px;
    }

    .admTablaWrap {
        max-height: none;
    }
}

@media (max-width: 520px) {
    .admGrid2 {
        grid-template-columns: 1fr;
    }

    .admBuscar {
        min-width: 0;
        width: 100%;
    }

    .admBarra__acciones {
        width: 100%;
    }
}
